No announcement yet.

Keeping a weapon down after PutDown()

  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Is that code from the weapon class? So do you only want to put that particular weapon down when your pawn is running? Or all weapons?

    If you wanted to do it with all weapons, you could make the pawn switch to a "fake" empty weapon, and then when you stop running you switch back to the previous weapon.

    I think the putdown function has more to do with the playing of the animation than anything else, and maybe temporarily disabling the weapon.

    If its with a particular weapon, you could create an empty state like weapon Idle or something. Then when you check, after you call putdown, throw that weapon into the empty state. Then when your not running, bring the weapon back to its "normal" state.

    Sound reasonable?

    Leave a comment:

  • started a topic Keeping a weapon down after PutDown()

    Keeping a weapon down after PutDown()

    The subject really says it all. I've been messing with inventory items that change a player's movement, or more accurately, weapons behavior while moving. I want to prevent firing the player's weapon when they are running (basically when their velocity is greater than crouching or walking speed). Right now, I'm calling Pawn(Owner).Weapon.PutDown() on a Tick which checks the player's speed against those previously mentioned values and although it puts the weapon down in the right place, it resets and keeps putting down the weapon instead of keeping it offscreen. How do I put the weapon down and keep it that way until the velocity drops back down?

    function Tick(float dt)
    	local Pawn P;
    	P = Pawn(Owner);
    	if ( (P == None) || (P.Controller == None) )
    	// if we're moving faster than a walk or crouch, whichever is higher
    	if ( (VSize(P.Velocity) > FMax((P.GroundSpeed * (P.WalkingPct * 1.1)),(P.GroundSpeed * (P.CrouchedPct * 1.1)))) && bArmed )
    		P.bNoWeaponFiring = true;
    		bArmed = false;
    	else if (!bArmed)
    		P.bNoWeaponFiring = false;
    		bArmed = true;