If you want to help us maintaining this wiki, check out or discord server: https://discord.gg/3u69jMa 

Create a new sciptable Class

From SWRC Wiki
Jump to: navigation, search

Creating new scriptable classes can be a little bit tricky sometimes. There a few methods to do so.


Creating a new class inside UnrealED

This is the common way of creating a new class. Open up UnrealED and look at the Actors browser. Pick a class where you would like to create a subclass.

Onces you found your parent class, mark it and place it in an empty BSP geometry eg. room.

Unrealed newclass.PNG

So I selected DMGame class and placed it in my room. The placed actor and the one in the list need to be marked/selected. Next on top bar, go to "Class" and select "New From Selection".

Now enter a name for your new subclass and package name.


Important!: If you don't place the parent actor in a BSP geometry and instead directly click on "New From Selection", you will be able to create a subclass, but it won't have a script to edit.


Anyway of you want to create multiple classes for one package, repeat the steps above and just change the name of the class but keep the package name. Before starting scripting after creating new classes, you should close UnrealED and save new packages first.

Also note that on some classes (mainly native classes), you won't be a to create sub classes. (Security) See below for bypassing this issue.


Create a new class with APC

APC - Actor Package Creator helps you creating new classes with a few mouse clicks, unfortunately you can only save one class per package which can be annoying.

Manipulating new class with Hex Editor

Imagine you want to create a new scriptable class for something where you shouldn't be able to (Native Classes) and you can't use any tools right now. There is a trick with changing names of classes with hex editor. Create a new sub class and save it. Open up the package with any hex editor and search for the class name. Replace the name with new desired class name and save it. Try to load it up and see if it worked.

Hex class.PNG

In this example, I opened up MoverProperties package and could be able to change the name of class to new one.


Creating new class with UCC

Using Republic Commando UCC to create new classes is kinda the easiest and most efficient way.

In your root gamefolder (not GameData, the one before), create a new folder called Code. In there, you can create another folder with the name of you new unrealscript package, in my case TestPackage. Inside this new folder, create another folder called Classes. At the end, it should look like this:

Ucc classes dir.PNG

Now inside Classes folder, you can simply create new text files, but the extension needs to be ".uc". In my case TestMod.uc

Now edit this file with any text editor you like and save it afterwards. Now go to your System folder where you "installed" the UCC.

Open up UCC.ini with any text editor and add under [Editor.EditorEngine] your package to compile.

[Editor.EditorEngine]
UseSound=True
CacheSizeMegs=32
GridEnabled=True
SnapVertices=False
SnapDistance=10.000000
GridSize=(X=16.000000,Y=16.000000,Z=16.000000)
RotGridEnabled=True
RotGridSize=(Pitch=1024,Yaw=1024,Roll=1024)
GameCommandLine=-windowed
FovAngleDegrees=90.000000
GodMode=True
AutoSave=True
AutoSaveTimeMinutes=5
AutoSaveIndex=6
UseAxisIndicator=True
MatineeCurveDetail=0.1
Editpackages+=TestPackage

I added my new package to the last line.

Finally open up a new command prompt inside System folder and run "UCC.exe make ini=UCC.ini". This will recompile every package added to the config before. If you see any script errors, you have to fix them obviously.

The compiled package will be saved in System folder afterwards.