Design 2, Design 4 (Computer and Video Games)
Unit 21 - 24th April 2003

Creating a new Weapon

I want to create a new weapon which uses the weapon scripts of a weapon already existing.

Let's say we want to set up a weapon called "Fluid_SkinGun" and have it behave like the SniperRifle.

i want the SkinGun to be equipped with the same animations the SniperRifle has for a firing or pickup movement and we also want to be able to use the altered view when shooting in 1st person view.

After we haven't got the original StudioMax files for the SniperRifle we need to use a trick to copy the animations, skeletal behaviour and the sockets of the SniperRifle to the SkinGun. (Sockets are elements where Unreal can fix additional objects like weapon lights.)

1. Build your model in StudioMax.
Use a UV-Texture for your mesh and provide it with a single material on ID 1 called SKIN00.
Attach the mesh to at least 2 bones called:
Bones_Flash (The latter is the small grey bone at the orange tip of the mesh, the fromer is the large grey bone.)

Now save the Texture into your Fluid_SkinGun/Textures directory.

2. Export the .psk mesh via the ActorX plugin.

If you want to use the ActorX plugin, you should take care to have the correct version installed.
StudioMax R4 requires ActorX (vers. 4) (68.7 kB).
whereas StudioMax R5 requires ActorX (vers. 5) (68.8 kB).

3. Open UnrealEd.

Open the textures browser. Create a new Texture package called "fluid_tool_textures" or something like that. Don't forget to save the package after having imported the image.

Open the animations browser. Open the Weapons package and select the SniperRifle weapon. You should start with Sniper_1st which is the rifle as seen in 1st person view.

Now find Mesh Import in the File menu.
Just import the new mesh ("Fluid_SkinGun") into your Weapons package for a second.

You will receive a message saying that a new mesh has been imported. The new mesh probably will show up in your browser in the wrong place, with no skin but the default texture on it. Don't worry!

Next thing is to get the mesh's texture upon it. Just select the texture in the textures browser and switch back to the animations browser to click the "Use" button in the Skins panel.

Here we go!

Now select the Weapon Sniper_1st again. Copy the mesh properties.
Select Weapon Fluid_SkinGun agian, with the mesh Sniper_1st selected. Paste the mesh properties.
The gun should move into the position which the Sniper_1st originally held.

Go to the Edit menu and select "Linkup anim and mesh". You should see a list of animations for your Fluid_SkinGun now.

Try out a few of the animations you have got. Do they work fine?

At this moment we still are doing mishief in package called Weapons. That is not good. We want to create a new packet of animations and meshes, which we inted to call "fluid_tool_animations".
To do so we have to get the "Rename mesh" menu.

It is important that you save your animation package now. By saving it you create a package called fluid-tool-animations.ukx in the Animations folder. From now on this animation should be available for the Editor, whenever you open it.

What we achieved until now is a plain skeletal animation of a textured mesh, no weapon we can pickup or access in the game. But there is not oo much to do to achieve that.

You have to create a new class which inherits the properties of the SniperRifle and is called Fluid_SkinGun. Thanks to Chris Beckford, there is such a class, which you can download here for test purposes.

Download Fluid SkinGun (171 kB)

Unzip and put the .ukx packages into the Animations folder, the .u packages in the System folder and the .utx packages into the Textures folder. There is a small testmap included to try the weapon out.