Once I get that upgrade to 36-hour days, I will tackle that. – Mychaeel
How to Make an Inventory
This page needs to be cleaned up to use Wiki markup. |
This is a tutorial for Unreal Tournament 3 written by Izanagi.
This tutorial will show you a really easy way of creating a customizable inventory for your mods. This tutorial also uses a static mesh component that you can either create yourself or use one already prepared earlier.
This tutorial will go into really in-depth information about it all, if you need more info check out the rest of wiki.beyondunreal.com.
Contents
The Basics and Downloads[edit]
This tutorial uses basic coding, so you will (if you haven't already) download yourself a copy of ConTEXT Editor, or Notepad++. Both programs are for Windows, but I'm sure there would be similar ones for other operating systems.
I use ConText because the syntax highlighter is available making coding easier. You may need to right-click the link and choose Save Target As... and place it in the Program Files\ConTEXT\Highlighters folder to enable syntax highlighting.
You may also need to download the source code files. You will have to unzip and export them into C:\Documents and Settings\My Documents\My Games\Unreal Tournament 3\UTGame\Src
If the folder doesn't exist, then you can create it.
Setting up the Scripts[edit]
In the C:\Documents and Settings\My Documents\My Games\Unreal Tournament 3\UTGame\Src folder create a new folder and name it something along the lines of "NewInventory". Then open that folder and create a new one called "Classes". This is where you should save all of your new code.
You have to tell the game about your new inventory, so UT3 has the ability to recognize your unpublished scripts.
Open My Documents\My Games\Unreal Tournament 3\UTGame\Config\UTEditor.ini in ConTEXT and search (Control+F) for [ModPackages]. Underneath the line that reads ModOutputDir=..\UTGame\Unpublished\CookedPC\Script, add the following line:
ModPackages=NewInventory
Setting up the Compiler[edit]
On your desktop you should have an Unreal Tournament 3 icon displayed. Copy the icon and paste it in the C:\Documents and Settings\My Documents\My Games\Unreal Tournament 3\UTGame\Src\NewInventory\Classes folder Right-click on it and open the Properties. In the Target line, after "C:/.../Unreal3/Binaries/UT3.exe" type make This creates the compiler.
I keep my compiler in with the code I write because it is easier to find.
Now to begin!
Inventory Creation[edit]
Create a new ConText file:
class NewItem extends UTInventory; defaultproperties { Begin object Class=StaticMeshComponent Name=StaticMeshComponent1 StaticMesh=StaticMesh'folder.folder.NameofMesh' scale=1 Rotation=(pitch=16384, yaw=0, roll=0) End Object DroppedPickupMesh=StaticMeshComponent1 PickupFactoryMesh=StaticMeshComponent1 }
Save the file as NewItem.uc, now going through the important parts of the code:
class NewItem extends...
The NewItem name can be named to anything you want, just make sure that the filename equal to the class name.
StaticMesh=StaticMesh'folder.folder.NameOfMesh'
Links the prepared static mesh to the code. The static mesh can be exported directly from 3DsMax or a similar 3D program, or you can use one from UT3.
scale=1
Sizes the mesh up or down, according to your tastes.
Rotation=(pitch=16384, yaw=0, roll=0)
Rotates the mesh. The 16384 is a 90 degree rotation.
Now create a new ConText document:
class PickupItem_NewItem extends UTPickupFactory; defaultproperties { InventoryType=class'NewItem' Begin object Name=BaseMeshComp StaticMesh=StaticMesh'folder.folder.NameofMesh' scale=1 Rotation=(pitch=16384, yaw=0, roll=0) End Object }
Save this one as PickupItem_NewItem.uc, this name is what will appear in the list in the UT3 editor. Remembering that you name the NewItem the same as in the previous code so that it reads properly. Now to go through the important parts of the code once again.
...extends UTPickupFactory;
This tells UT3 that you are extending the PickupFactory class so that the item will be a pickup when placed in the game.
InventoryType=class'NewItem'
This tells the PickupInventory that there is a new item that can be selected.
StaticMesh=StaticMesh'folder.folder.NameOfMesh' scale=1 Rotation=(pitch=16384, yaw=0, roll=0)
If you change the size or the rotation of the static mesh in one piece of code you must change the other as well.
Congratulations!
Now to compile the code.
Compiling the Code[edit]
Double-click on the compiler icon in the C:\Documents and Settings\My Documents\My Games\Unreal Tournament 3\UTGame\Src\NewInventory\Classes\ folder and watch it compile.
There should not be any errors, if there are, double-check the syntax.
Now to open the Editor...
Make sure that you have saved both your files as .uc. If you get the error Unexpected 'i', copy the code into a new file and re-save it. This just means that the UT3 compiler doesn't recognize the format that the file was saved under, even if it was saved as a .uc.
In the Editor[edit]
In the Generic Browser click on the Actor Classes tab. Go to Navigation Point then PickupFactory Open the UTPickupFactory and your item should be there in the list of pickups!! Select it then right click in the Perspective View and select Add PickupItem_NewItem Here And that is it!.