The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall
Legacy:Making Unreal Tournament Decorations (Vertex)
This is a great way for a beginner to get started on modeling for Unreal Tournament. Even though great tools like MeshMaker exist, learning the old fashioned way of importing models can teach good skills like setting up a project and compiling and working with Unrealscript.
To export a model from Max into something UT can use takes a few steps you must follow before actually exporting the object. For simplicity I'm assuming the decoration has no animations.
Export from Max
- It must be one object and named with a "01" at the end. For example: boulder01. It also needs texture coordinates
- It must not be bigger than a 256x256 grid extent centered on the origin. You can scale it to suit in script later so don't fret over that yet.
- Place a blank material on the object called "Skin".
- Export to .3ds.
Now, setting up your stuff for import into Unrealtournament. This is fun.
- Open up UnrealEd and then the Class Browser (little chess piece icon).
- Choose File -> Export All Scripts and let it burn. Close down UnrealEd.
- Open up your UnrealTournament folder and create a subfolder called MyDecoration (or whatever). Create two subfolders in MyDecoration called Classes and Models.
- Open up the file called Unrealtournament.ini located in your Unrealtournament\System directory. About half way down you will see a bunch of stuff saying "EditPackages=Botpack", etc. Add a line to those that says "EditPackages=MyDecoration". Save the file
- Download 3ds2unr from http://unreal.epicgames.com; the link is in the 3ds2unr doc located in the links to the left of the page. Extract the zip to a folder called C:\3ds2unr (create it).
- Open up a DOS prompt window. Type: "cd\3ds2unr". Then type: "3ds2unr -setproj"
A Browse window will pop up. Point to the MyDecoration folder under your Unrealtournament folder. Hit ok. Minimize the DOS prompt window
- Place your .3ds file into the 3ds2unr directory
- Bring up the DOS prompt again. Type: "3ds2unr MyDecoration whatever.3ds"
("Whatever" being the name of your .3ds file of course) Minimize the window again
- You will now have in the Classes directory of your MyDecoration folder a .uc file called "MyDecoration.uc". In the models folder will be two files called "MyDecoration_a.3d" and "MyDecoration_d.3d"
If you get any errors it's most likely because you did something wrong when exporting it from Max, like leaving a hidden object like a light around or something
- Place your 8 bit 256 color .pcx skin in the Models directory. Look in the .uc (in your Classes directory) for a line that says "#exec TEXTURE IMPORT NAME=Jwhatever1 FILE=MODELS\whatever0.PCX GROUP=Skins
- Change the .pcx name in the script to the name of your .pcx skin. Or vice versa. Doesn't matter as long as both names are the same
- At the top of the script is a line that says "Class MyDecoration expands Actor;"
Change it to read: "Class MyDecoration extends ut_Decoration;". Save the .uc file.
- Bring up your DOS prompt window again and type "cd\Unrealtournament\System". Then type "ucc make"
- Your code and model files will compile and may take a minute or so to get through checking all of UT's packages. If all goes well (i.e. no errors or warnings) you will have a file in your UT\System directory called MyDecoration.u.
You can now load that into your map from UnrealEd at will and your class will show up under Actor >> Decoration >> ut_Decoration in the Actor Classes Browser. You can also control its scale in the script by adding "DrawScale=" ,with 1 being its default size, to one of the lines under the DefaultProperties of the .uc file (at the bottom). If you recompile the code again, make sure you delete the MyDecoration.u file from your System directory first. Look at other ut_Decoration scripts located in ..\Unrealtournament\Botpack\Classes to get more default properties you can use for your decoration, like solidity.
Bean: Note, if you use an old version of 3ds2unr, such as the one at Epic's Unreal Site, you may encounter some problems with skins on decorations being mirrored backwards randomly. It's actually quite odd how that happens. If you are using an old version, encounter the problem, and don't feel like grabbing an updated version, just go into Photoshop and flip your canvas horizontally for the skin.