Modify Class properties

  • 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/

TakumoKatekari

FNG / Fresh Meat
Jun 21, 2010
1
0
0
Hai, I'm new to UnrealScripting and I was wondering how I change the properties of a class (for example, KFHumanPawn JumpZ) I know that in the console its "set KFHumanPawn JumpZ [int]" but how do I do this from an UnrealScript? These properties are listed in the "defaultproperties" of the class's .uc file.
 

slavek

Grizzled Veteran
May 4, 2006
3,074
943
113
UnrealEd: Viewport #1
The properties and their values are listed in defaultproperties of the class. If you want to make a modified class, you will have to make a copy of the uc file you want to edit and recompile it with your modifications. The name can remain the same however, the .u file will need to be your own name. This is automatically done by:


  1. Make a folder in your KF dictionary. The name of this folder will be the name of your new .u file
  2. Inside that folder, make a second folder called "Classes" and put your .uc file in there.
  3. Compile mod using UCC/UCMake.
Take note however, the game will not read your new class as the old class is used by default in the gametype. If you want the game to utilize your new class, you will need to make a mutator to replace the old class or a new gametype that uses the new class.
 

Benjamin

Grizzled Veteran
May 17, 2009
3,631
635
113
France
You can simply change the defaultproperties of a class and any instances of the class spawned thereafter will use these changes. Note that since both the server and client have their own set of class default properties, you'll need to change it on both if you want it to work correctly online (since changes to defaultproperties aren't replicated).

However, for modifying such an attribute you can write a mutator and use this in the ModifyPlayer function:

Code:
Other.JumpZ = NewJumpZ;

See this thread for more information regarding mutators.