• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Chaning JumpZ and GroundSpeed var

Slie

Grizzled Veteran
Dec 16, 2010
270
5
I am trying to change JumpZ and GroundSpeed of the pawn but nothing happens when it's called.

static function ModifyPlayer(Pawn Other)
{
Other.JumpZ = 0.1;
Other.GroundSpeed = 0.1;
}

I know the function is being called because when I put Other.HeadScale in there, the head size of the character changes. But jump and speed don't change at all.

Essentially it's just an additional !RTD that will temporarily change jump and speed.

Is there another way to change these variables? Or am I trying to change the correct variables?
 
I am trying to change JumpZ and GroundSpeed of the pawn but nothing happens when it's called.

static function ModifyPlayer(Pawn Other)
{
Other.JumpZ = 0.1;
Other.GroundSpeed = 0.1;
}

I know the function is being called because when I put Other.HeadScale in there, the head size of the character changes. But jump and speed don't change at all.

Essentially it's just an additional !RTD that will temporarily change jump and speed.

Is there another way to change these variables? Or am I trying to change the correct variables?


Try this.
The Pawn class is extended by XPawn ,at least in some other functions, it is supposed to write all of the values from Pawn to XPawn but doesn't always do so reliably.

Function ModifyPlayer(Pawn Other)
{
local xPawn MyPawn;
MyPawn = xPawn(Other);
MyPawn.JumpZ = 0.1;
MyPawn.GroundSpeed = 0.1;
}

Dunno It might work, just off the top of my head. Try it out. Sometimes changing the value in xPawn works better for some things.
 
Last edited:
Upvote 0
No guys. Its not that easy as you suppose. At first, I dunno from which class you are trying to change groundspeed and jumpz.

Try something like this. But I dont checked how behaves default section in concrete class instance. I guess it does not change defaults in class.

static function int ModifyPlayer(Pawn Other)
{
local KFMonster F__x_s_x;
local KFPawn Human;

if ( Other == none )
return 1; // Failure

F__x_s_x = KFMonster(Other);
Human = KFPawn(Other);
if ( F__x_s_x != none )
{
F__x_s_x.JumpZ = 0.1;
F__x_s_x.default.JumpZ = 0.1;
F__x_s_x.OriginalGroundSpeed = 0.1;
F__x_s_x.default.OriginalGroundSpeed = 0.1;
F__x_s_x.GroundSpeed = 0.1;
F__x_s_x.default.GroundSpeed = 0.1;
return 0; // Success
}
if ( Human != none )
{
Human.GroundSpeed = 0.1;
Human.default.GroundSpeed = 0.1;
Human.JumpZ = 0.1;
Human.default.JumpZ = 0.1;
return 0; // Success
}
return 1; // Failure
}

P.S.

Do remember that certain things will reset these values. Be careful with things like this.

Very useful and informative post.
 
Last edited:
Upvote 0