Blog Archives

Modding for UT3 – Editing and Compiling with uscript: An introduction

Compiling and modifying scripts in UT3

These instructions show how to mod various component of Unreal Tournament III or UE3 game through the use of Unreal’s scripting language uscript. Some simple and easy targets for this sort of operation are:

  • Increasing the damage of a weapon
  • Changing the amount of ammo and or health count of pickups
  • Increasing or decreasing the spawn times of pickups, e.g. for synchronisation purposes or making some items more scarce
  • Replacing the model used in game e.g. customising a health / ammo / power-up (udamage/Beserk/Invis) model

And many more functions, only limited by your imagination and perseverance.

These operations are relatively simple due to the inheritance structure of uscript. Which mean many new users can jump in and get their feet wet, tweaking default properties with little formal understanding of the language or its syntax 🙂

To explore the items available to mod I recommend getting a copy of the latest UT3 ScriptSource on UDN and look through it for scripts that you wish to control.

The property I will demonstrate modding is delaying the spawn time of the Super Health. This mod was used in the level DM-Richter. This was achieved by overriding the default properties of a class.

How to Override Default Properties of a class

Inside the ScriptSource, sift through the folders to:

UT3ScriptSource_1.5\Development\Src\UTGameContent\Classes

Find the file: UTPickupFactory_SuperHealth.uc

To get started modding this script go to:

C:\Users\”UserName”\Documents\My Games\Unreal Tournament 3\UTGame\Src\

Start by adding a folder where your work will be held. In my example I will label the folder “UTPickupFactory_SuperHealth_Delay” as the starting point. (It is customary to label the top level folder as the name of the script to be edited for ease of searching). Beneath that, add a folder named “Classes”. Then create a text file with a .uc extension in this location. By example, UTPickupFactory_SuperHealth_Delay.uc.

i.e. create:

C:\Users\UserName\Documents\My Games\Unreal Tournament 3\UTGame\Src\UTPickupFactory_SuperHealth_Delay\Classes\UTPickupFactory_SuperHealth_Delay.uc.

Be sure to save the txt file in ANSI format.

In this file UTPickupFactory_SuperHealth.uc I would start by adding the default properties of the .uc file I am seeking to mod taken from the Script Source.  Next I would hone in on the the code one wishes to change.

The folder and file structure should now look like this:

C:\Users\UserName\Documents\My Games\Unreal Tournament 3\UTGame\Src\UTPickupFactory_SuperHealth_Delay\Classes\UTPickupFactory_SuperHealth_Delay.uc

The entire UTPickupFactory_SuperHealth.uc file: From here I will review the properties I wish to edit.

/**
* Copyright 1998-2007 Epic Games, Inc. All Rights Reserved.
*/
class UTPickupFactory_SuperHealth extends UTHealthPickupFactory;var ParticleSystemComponent Crackle; // the crackling lightning effect that surrounds the keg on spawnsimulated function RespawnEffect()
{
super.RespawnEffect();
Crackle.SetActive(true);
}simulated function SetPickupHidden()
{
Glow.SetFloatParameter('LightStrength',0.0f);
Super.SetPickupHidden();
}simulated function SetPickupVisible()
{
Super.SetPickupVisible();
Glow.SetFloatParameter('LightStrength', 1.0f);
}defaultproperties
{
bSuperHeal=true
bPredictRespawns=true
bIsSuperItem=true
RespawnTime=60.000000
MaxDesireability=2.000000
HealingAmount=100
PickupSound=SoundCue'A_Pickups.Health.Cue.A_Pickups_Health_Super_Cue'Begin Object Name=BaseMeshComp
StaticMesh=StaticMesh'Pickups.Health_Large.Mesh.S_Pickups_Base_Health_Large'
Translation=(Z=-44)
Rotation=(Yaw=16384)
Scale=0.8
End Object
Begin Object Name=HealthPickUpMesh
StaticMesh=StaticMesh'Pickups.Health_Large.Mesh.S_Pickups_Health_Large_Keg'
CullDistance=7000
Materials(0)=Material'Pickups.Health_Large.Materials.M_Pickups_Health_Large_Keg'
End Object
Begin Object Name=ParticleGlow
Template=ParticleSystem'Pickups.Health_Large.Effects.P_Pickups_Base_Health_Glow'
Translation=(Z=-50.0)
SecondsBeforeInactive=1.0f
End Object
Components.Add(ParticleGlow)
Glow=ParticleGlow
Begin Object Name=ParticleCrackle
Template=ParticleSystem'Pickups.Health_Large.Effects.P_Pickups_Base_Health_Spawn'
Translation=(Z=-50.0)
SecondsBeforeInactive=1.0f
End Object
Components.Add(ParticleCrackle)
Crackle=ParticleCrackle
YawRotationRate=16384
bRotatingPickup=true
bHasLocationSpeech=true
LocationSpeech(0)=SoundNodeWave'A_Character_IGMale.BotStatus.A_BotStatus_IGMale_HeadingForTheSuperHealth'
LocationSpeech(1)=SoundNodeWave'A_Character_Jester.BotStatus.A_BotStatus_Jester_HeadingForTheSuperHealth'
LocationSpeech(2)=SoundNodeWave'A_Character_Othello.BotStatus.A_BotStatus_Othello_HeadingForTheSuperHealth'
}

In this case I am changing the RespawnTime from: RespawnTime=60.0 to RespawnTime=90.0 (the variable is in seconds). This will enable it to spawn at the same time as the weapon powerup, creating race conditions for these high value items.

To do this find UTPickupFactory_SuperHealth and create your own custom class using the syntax:

class "name of .uc file you made" extends "name of class your changing";
{
adding the variable you wish to change beneath this, 
enclosing in curly braces
}

So in my example I copy the Default Properties into a text file and change the property I’m after:

i.e.

class UTPickupFactory_SuperHealth_Delay extends UTPickupFactory_SuperHealth;
defaultproperties
{
bSuperHeal=true
bPredictRespawns=true
bIsSuperItem=true
RespawnTime=90.000000
MaxDesireability=2.000000
HealingAmount=100
PickupSound=SoundCue'A_Pickups.Health.Cue.A_Pickups_Health_Super_Cue'
}

Before compile time go to:

C:\Users\UserName\Documents\My Games\Unreal Tournament 3\UTGame\Config

Edit: UTEditor.ini

In the file just below search for:
[ModPackages]
ModPackageinPath=\UtGame\Src

Add this line.

ModPackages=UTPickupFactory_SuperHealth_Delay

UTPickupFactory_SuperHealth_Delay” Is the name of the top level folder you placed your script in. This tells the compiler where to look when compiling. Save and close this file.

To compile place the make flag on a short cut to UT3.exe
ie “C:\Program Files (x86)\Unreal Tournament 3\Binaries\UT3.exe” make

Now run the short cut!

If all goes well a console will pop up with green out put of the compilation telling if it completed successfully. If so continue. Otherwise carefully go back and check your file names, their paths and syntax are all correct and repeat.

The custom health pickup will be available inside of Generic Browser Pickup Factory Tree. Go ahead and place the actor inside of game.

When publishing this level place the resultant script (UTPickupFactory_SuperHealth_Delay.u) into the /Published/CookedPC/Script Folder. The new script should now be available in game.
Because of the inheritance properties of Uscipt it is easy to create new custom classes that extend (inherit) all the properties of another class. So allowing small and large changes to be made with next to no familiarity of the language, thus giving the novice a toe hold with which to explore the language.

Happy modding.
References:

http://www.3dbuzz.com/vbforum/sv_showvideo.php?v=962 (Override Default Properties?)

http://www.3dbuzz.com/vbforum/sv_showvideo.php?v=963 (Override Properties)