Making a "No Jump" Mutator

From BiaSDK
Jump to: navigation, search

This page describes the process in creating a mutator that prevents players in a multiplayer game from jumping around (by making the JUMP key do nothing).

The first step is to figure out HOW players jump in the game so that we can override this behavior. Looking in the User.ini file, we find that the JUMP key is bound to a command called "Jump".

Now we need to search through the UnrealScript code to find an 'exec' function called "Jump". Searching through the .uc files in the Engine\Classes folder, we find this code in the PlayerController.uc file...

exec function Jump( optional float F )
if ( Level.Pauser == PlayerReplicationInfo )
bPressedJump = true;

...which sets the 'bPressedJump' variable to 'true' when the JUMP key is pressed. Now we need to find where this 'bPressedJump' variable is used elsewhere in the UnrealScript code.

After searching the code, we find 'bPressedJump' used in PlayerController.uc in the 'PlayerWalking' state code. In the ProcessMove() function, we find this code...

if ( bDoubleJump && (bUpdating || Pawn.CanDoubleJump()) )
else if ( bPressedJump )

...BiA doesn't have a DoubleJump (like UT has) so we can ignore the first part of that 'if' statement, but we see that whenever 'bPressedJump' is true, that this code will call the DoJump() function in the Pawn code.

Looking in the Pawn.uc file at the DoJump() function, we see that it checks to see what Physics state the Pawn is currently in (to make sure that jumping is allowed)...

if ( ((Physics == PHYS_Walking) || (Physics == PHYS_Ladder) || (Physics == PHYS_Spider)) )

BiA doesn't have ladders or spider physics (allows you to walk on walls), so if the Pawn is currently in the 'walking' physics state (which handles walking, running and crouching), we will go inside this 'if' statement.

A little further down inside the DoJump() function, we find this code...

else if ( bIsWalking )
Velocity.Z = Default.MinJumpZ + ((Default.JumpZ - Default.MinJumpZ) * m_flJumpEndurance);
log(self$".DoJump1( "$bUpdating$" ) - "$Default.JumpZ$" - "$m_flJumpEndurance$" - "$Base.Velocity.Z);
} else { Velocity.Z = MinJumpZ + ((JumpZ - MinJumpZ) * m_flJumpEndurance);

log(self$".DoJump2( "$bUpdating$" ) - "$JumpZ$" - "$m_flJumpEndurance$" - "$Base.Velocity.Z);


...which is checking to see if the player is walking or not-walking (running). You can also see some 'log' messages the developer stuck in there during debugging/testing. The only thing that we care about is the 'Velocity.Z =' code.

The Velocity of a Pawn is the direction that it is currently moving. Velocity has an X, Y and Z component. The X and Y components are the front-to-back and side-to-side movement of the Pawn. The Z component of the velocity is the up-or-down movement of the Pawn. By setting the Velocity.Z component of the Pawn to a positive number, you cause the Pawn to move up into the air (i.e. jumping). So, if we can prevent this code from being executed, the Pawn won't be able to jump (because the Velocity.Z value isn't being set when a JUMP command is executed).

If we were making a mod (modification) we could just comment out this code and we would be done. But, since we a making a mutator, we can't change the original BiA code, otherwise nobody would be able to connect to the server (since the server would be running different code than the client). We have to find a way around this Velocity.Z thing without changing the code.

One simple way to do this is to change the Pawn 'MinJumpZ' and 'JumpZ' variables and make them zero. This way, the Velocity.Z would get set to zero whenever someone jumps, which would effectively NOT lift them off the ground (i.e. no jumping). If you search for 'MinJumpZ' and 'JumpZ' in the defaultproperties section of Pawn, you will find this...

MinJumpZ=+00200.000000 by default, JumpZ is 420 and MinJumpZ is 200. When Velocity.Z gets set to these values, the Pawn will be moving upwards at 420 units/second or 200 units/second (based on whichever one of them is used to set Velocity.Z). If we can change both of these to zero, then no jumping will be possible. Again, we can't just edit the defaultproperties values in the Pawn.uc file and rebuild the code otherwise people won't be able to connect to our server. We have to create a mutator that changes these 'JumpZ' and 'MinJumpZ' values in the defaultproperties of the Pawn class.

So let's get started then. Inside your BrothersInArms folder (or BrothersInArmsEiB folder, if you have Earned In Blood), create a new folder called "NoJump". Inside this NoJump folder, create a folder called "Classes". NoJump will be the package name for our new mutator. Open up Notepad (or any text editor) and place the following code in it...

// NoJumpMutator prevents players from being able to jump in the game
class NoJumpMutator extends Mutator;
function PreBeginPlay() { class'gbxPlayerPawn'.default.JumpZ = 0.0f; class'gbxPlayerPawn'.default.MinJumpZ = 0.0f;

Save this as a file called "NoJumpMutator.uc" into the NoJump\Classes folder.

The PreBeginPlay() function in this mutator code will run as soon as the mutator is loaded on the server. The code inside this function will access the defaultproperties values for 'JumpZ' and 'MinJumpZ' and set them to zero. You will notice that I'm setting the defaultproperties values for the 'gbxPlayerPawn' class instead of for the 'Pawn' class. Why am I doing this instead of just setting them in 'Pawn' like I described above? Well, a player in a single player or multiplayer BiA game is actually using the gbxPlayerPawn class as its Pawn. gbxPlayerPawn is derrived from Pawn so it will also have the JumpZ and MinJumpZ variables. The things is, that EACH class in Unreal has IT'S OWN default settings for variables, so if I change the default values for Pawn, that won't effect the default values for gbxPlayerPawn. I must change the default values for gbxPlayerPawn EVEN THOUGH the code that is accessing these default values is in the Pawn.uc DoJump() function.

Now we need to build the NoJump package by compiling our new script code. Open the BiA.ini file (or the EiB.ini file if you are using Earned In Blood) and search for "EditPackages=". Add this line immediately BELOW all of the other EditPackages= lines in the .ini file...


Save the .ini file, then right click on it in Windows Explorer and check the 'Read-Only' box to make it read-only (so that the game won't overwrite it with your Profile version). Now open up an MS-DOS Prompt window and change directories to the BiA System folder. Run "ucc make" to build the UnrealScipt code. You should see it compiling the 'NoJump' package and you shouldn't get any errors (if you do get errors, double check your NoJumpMutator.uc code against the code shown above). When the compiler is done, you should have NoJump.u in your System folder (if not, go back and double check all of the steps above).

Now, to have the mutator show up in the Multiplayer game menu, you will need to create a .int file in your BiA System folder. The .int file must have the same filename as the package name (in this case it will be So let's open Notepad again and put the following in it...

Mutator=(Class=Class,MetaClass=Engine.Mutator,Name=NoJump.NoJumpMutator,Description="The NoJump mutator prevents players from jumping around in the game.")

...and save this as "" in the System folder.

When you create a Multiplayer game, you can click on the 'Mutators' item at the bottom of the game menu screen to add a mutator to your game. Select the NoJumpMutator and click on 'Add' to add it to the list on the right, then click on 'Back' to return to the previous game menu screen.

If you just want to download the NoJump mutator, you can use one of the two links below and unzip this into your BiA System folder.

The NoJump mutator for Brothers In Arms: Road to Hill 30:
(unzip into your BiA System folder)

The NoJump mutator for Brothers In Arms: Earned In Blood:

Back to Main Page