[UT2k4] AimDot / Forced Walk or crouch while firing

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Major-Lee-High

Im a ranter, ignore me!
Jun 27, 2000
901
0
0
43
The Dark Tower
www.modcentral.us
Ok so i just made a new versions of the sniper rifle (classic), basically i removed the smoke and made it "bFireOnRelease=True".

Now what i want to do to it, is make it so that when your holding down fire you are forced to walk or crouch along with no jumping. I made the new sniper with no problem so far (not even one error woot!!) but i dont know where to start with this. I also want to do the same thing to other guns like the minigun so when its being fired you cant jump etc just the same.

Also for the sniper rifle i want a aimdot when its being held down as well, just like the TFC sniper rifle so that it can be seen by other players on walls etc. In the remote strike mod for 2k3 there was something very similar to this although i dont know how it was done or even if other players could see it. This might be a bit harder to do (i dont know) and im still a newb at coding. The no jumping etc seems like it should be pretty simple (i hope lol, im sure i have seen something similar in a mod or other unreal game) but this im not sure of.

Please help meh!! Im a noob like i said too so please explain to help!!

Thanks (hopefully :p)

:rolleyes: :lol:
 

[SAS]Solid Snake

New Member
Jun 7, 2002
2,633
0
0
40
New Zealand
www.digitalconfectioners.com
Well try investigating the Player movement states, as they are the places where you can alter how a player moves like. There is PlayerWalking, PlayerSwimming etc etc.

Make a new state (copy & paste is the best way atm since your learning), which checks if the weapon being held is your sniper rifle and that one of the firemodes is being held down. If that is true, then give the conditions that you cannot press the jump key.

This method of course requires you to have your own player controller class.
 

Major-Lee-High

Im a ranter, ignore me!
Jun 27, 2000
901
0
0
43
The Dark Tower
www.modcentral.us
I think if i could figure out how to tell if fir or alt fire is being held down, or if the weapon is zoomed i could prolly get this to work. I cant figure out where to get that info though.

bfire and bfirealt?
 

Major-Lee-High

Im a ranter, ignore me!
Jun 27, 2000
901
0
0
43
The Dark Tower
www.modcentral.us
Uggh this is getting annoying....

I dont see why i need a new player controller just for this.... Our class based mutator makes all teh classes right out of inventory, calling pawn to change move speeds etc.... so i dont see why the hell i cant get it to let me temporarily change a few properties without making a whole lot more work than it should take...

Can this even work from teh fire class atl all? Or should i try to do it in the Sniper Class, although i would need to figure out how to tell what guns being held so it doesnt mess up the other weapons hell have...

Just slowing the player down alot would be fine with me.... or even making it so that if the player is running or jumping the gun wont fire or something....

This seems like it should be soo dammed easy, but every thing i do, even with no errors etc doesnt do ****...
 
Last edited:

Major-Lee-High

Im a ranter, ignore me!
Jun 27, 2000
901
0
0
43
The Dark Tower
www.modcentral.us
Heres my latest try....

I moved me attempts into the weapon class because it comes from inventory just like our classes..... Still cant get it to work or for my LOG to show at all...

Code:
class newsniper extends classicsniperrifle;

function SlowedPlayer(xpawn p)
{
	if ( Instigator.Controller.bFire != 0 )
	{
    		P.AirControl *= 0.1;
    		P.GroundSpeed *= 0.1;
    		P.WaterSpeed *= 0.1;
    		P.AirSpeed *= 0.1;
    		P.JumpZ *= 0.0;
		log("Fire was pressed");
	}

	else
	{
    		P.AirControl *= 1.0;
    		P.GroundSpeed *= 1.0;
    		P.WaterSpeed *= 1.0;
    		P.AirSpeed *= 1.0;
    		P.JumpZ *= 1.0;
	}
}

defaultproperties
{
     FireModeClass(0)=NewSniper.NewSniperFire
     PickupClass=NewSniper.NewSniperPickup
     AttachmentClass=NewSniper.NewSniperAttachment
}

Tried like 100 diffrent if things....
 

Zer0Zer0

New Member
Apr 1, 2004
35
0
0
from noob to noob have you tried this:

Code:
simulated function ClientStartFire(int mode)
{
    if (mode == 1)
    {
        FireMode[mode].bIsFiring = true;
        if( Instigator.Controller.IsA( 'PlayerController' ) )
            PlayerController(Instigator.Controller).ToggleZoom();
           //Slow Your man down here (zoomed mode)
    }
    else
    {
        If (!bFireOnRelease){
                Super.ClientStartFire(mode);
        }
        else
        {
            While(!bReleased){ //This loop will not work though, you'll have to figure this bit out
                 //Slow Player
            }
            Super.ClientStartFire(mode);
          }
    }
}

May need some tweaking and I'm not sure if it will work but that looks like the area you need to mess with.

Super.ClientStartFire calls the weapon class to spawn the bullets etc. I think so what you need to do is hold up this function from being called until the fire button is released and during this time slow the player down.
 
Last edited:

Major-Lee-High

Im a ranter, ignore me!
Jun 27, 2000
901
0
0
43
The Dark Tower
www.modcentral.us
Ok, heres my code (thanks to Rigear) for the Rocket Launcher atm. It makes it so when the gun is out, your all slow and gimpy, i also have primary fire wait for release set (so you have to let off the button to fire it again) and the multi rockets max hold time is 5 minutes, so you can charge up rockets and stand around, along with not killing yourself as much cause of the stupid ass auto fire...

This will be ok for the rl and mingun for now, since i also have special Shield guns made they can just whip those out and run around at their class speed then switch to their main gun and be slow, even though i would still like the only when firing command....

So common guys there HAS TO BE A WAY to make this into a state inside the weapon (like the biorifles hold state) or something, so that it only happens when YOU PRESS A FIRE KEY!!

PLEASE HELP :p


Code:
class NewRL extends RocketLauncher;

var bool InUse;

simulated function BringUp( optional Weapon PrevWeapon )
{
	Instigator.AirControl = InStigator.AirControl *= 0.5;
	Instigator.GroundSpeed = InStigator.GroundSpeed *= 0.5;
	Instigator.AirSpeed = InStigator.AirSpeed *= 0.5;
	Instigator.WaterSpeed = InStigator.WaterSpeed *= 0.5;
	Instigator.Jumpz = InStigator.Jumpz *= 0.5;
	InUse = true;

	Super.BringUp( PrevWeapon );
}

simulated function bool PutDown()
{
	Instigator.AirControl = InStigator.Default.AirControl;
	Instigator.GroundSpeed = InStigator.Default.GroundSpeed;
	Instigator.AirSpeed = InStigator.Default.AirSpeed;
	Instigator.WaterSpeed = InStigator.Default.WaterSpeed;
	Instigator.Jumpz = InStigator.Default.Jumpz;
	InUse = false;

    if ( Super.PutDown() )
		return true;
	return false;
}



defaultproperties
{
     InUse=false
     SeekCheckFreq=0.500000
     SeekRange=8000.000000
     LockRequiredTime=1.250000
     UnLockRequiredTime=0.500000
     LockAim=0.996000
     FireModeClass(0)=NewRL.NewRLFire
     FireModeClass(1)=NewRL.NewRLMultiFire
     PickupClass=NewRL.NewRLPickup
}
 

Postal

I apear to have lost my pin.
Nov 14, 1999
1,388
0
0
WoD.BeyondUnreal.com
make a function slowdown and a function speedup
then in the code where it starts firing call slowdown, and when you release fire, class speedup
 

Major-Lee-High

Im a ranter, ignore me!
Jun 27, 2000
901
0
0
43
The Dark Tower
www.modcentral.us
Hmm maybee thats why my code doesnt ever work lol, ive been just making a new function but never calling it?

Problem ive had so far is that i cant figure out how to tell if someone is firing, and if i do figure that out how to make the functions and call them :O

So could i do like....

Code:
Function SlowDown()
{
	Instigator.AirControl = InStigator.AirControl *= 0.5;
	Instigator.GroundSpeed = InStigator.GroundSpeed *= 0.5;
	Instigator.AirSpeed = InStigator.AirSpeed *= 0.5;
	Instigator.WaterSpeed = InStigator.WaterSpeed *= 0.5;
	Instigator.Jumpz = InStigator.Jumpz *= 0.5;
}

Then make one like

Code:
Function DefualtSpeed()
{
	Instigator.AirControl = InStigator.Default.AirControl;
	Instigator.GroundSpeed = InStigator.Default.GroundSpeed;
	Instigator.AirSpeed = InStigator.Default.AirSpeed;
	Instigator.WaterSpeed = InStigator.Default.WaterSpeed;
	Instigator.Jumpz = InStigator.Default.Jumpz;
}

Then somehow make the if statements using the bFire or bIsFiring os would it be !bIsFiring or something, that would call one of those functions?

>_< Where would i put the if statement, do i need to use a existing function thats called for the gun or can i just make a function with anyname that will run???

*head explodes*
 

Major-Lee-High

Im a ranter, ignore me!
Jun 27, 2000
901
0
0
43
The Dark Tower
www.modcentral.us
HOLY SH!T I HAVE DONE IT!!!!!!

OMG THANK EVERYONE!!!!

Code:
class NewSniper extends ClassicSniperRifle;

simulated function ClientStartFire(int mode)
{
    if (mode == 0)
    {
        FireMode[mode].bIsFiring = true;
        if( Instigator.Controller.IsA( 'PlayerController' ) )
            SlowDown();
    }
    else
    {
        Super.ClientStartFire(mode);
    }
}

simulated function ClientStopFire(int mode)
{
    if (mode == 0)
    {
        FireMode[mode].bIsFiring = false;
        if( PlayerController(Instigator.Controller) != None )
            DefualtSpeed();
    }
    else
    {
        Super.ClientStopFire(mode);
    }
}

Function SlowDown()
{
	Instigator.AirControl = InStigator.AirControl *= 0.5;
	Instigator.GroundSpeed = InStigator.GroundSpeed *= 0.5;
	Instigator.AirSpeed = InStigator.AirSpeed *= 0.5;
	Instigator.WaterSpeed = InStigator.WaterSpeed *= 0.5;
	Instigator.Jumpz = InStigator.Jumpz *= 0.5;
}

Function DefualtSpeed()
{
	Instigator.AirControl = InStigator.Default.AirControl;
	Instigator.GroundSpeed = InStigator.Default.GroundSpeed;
	Instigator.AirSpeed = InStigator.Default.AirSpeed;
	Instigator.WaterSpeed = InStigator.Default.WaterSpeed;
	Instigator.Jumpz = InStigator.Default.Jumpz;
}

defaultproperties
{
     FireModeClass(0)=NewSniper.NewSniperFire
     PickupClass=NewSniper.NewSniperPickup
     AttachmentClass=NewSniper.NewSniperAttachment
}
 

Major-Lee-High

Im a ranter, ignore me!
Jun 27, 2000
901
0
0
43
The Dark Tower
www.modcentral.us
Aiiieeee now ive got another problem.

The defualt settings are setting the defualts of the defualt players instead of our classes.

I COULD just make the defualt speed function match the class that uses it, but there has to be a diffrent way to call the speeds etc of our classes instead of instigator right?

I was thinking instigator meant whoever had it so that whatever their settings where would be changed, but i guess thats in pawn or something.

So what would i change in my functions to change teh settings of our new classes?

In the classes we have this:

Code:
function AlterPlayer(Pawn Player)
{
local int i;
local inventory tInv;

	Player.GroundSpeed*=ClassMaxSpeed;
	Player.DodgeSpeedFactor*=ClassDodgeSpeed;
	Player.DodgeSpeedZ*=ClassDodgeZ;
	Player.JumpZ*=ClassJumpZ;
        Player.HealthMax=ClassHealthMax;
        Player.Health=ClassHealth;

So i assume there is a way to call the class file and change the ClassMaxSpeed etc instead of ground speed, then default back to the class?

Like i said i thought instigator was the player, but i guess its in pawn >_< ill try some things.