Replacing a Weapon

This tutorial will teach you how to make and import a new weapon model. You will have to replace a current weapon to do it. However, this is ONLY a model change of how the weapon looks. If you want the weapon to act differently, you will have to modify the source code. For this tutorial we are using 3d Studio Max R3 and the FOX tools. 

We will be replacing the SADAR weapon for this tutorial. The model must have the same number of parts as the original in order to work in the game. For example, the SADAR weapon has 6 different models to it. Here are all the different objects that are used for the SADAR weapon in the HUD.

The sadar body object is the part of the model we will be replacing. Any objects that you don't want used in the final version of your weapon can be deleted in Inteng.We will show how to do this later.

Make sure you have a reference object (Hudson) and a nucleus in your scene. The reference object must be exactly 2 meters tall in order for the weapon to scale properly in the game. You can use metric measurements in 3d Max by going to the Customize menu and selecting the Units Setup option. Select metric and hit ok. The ref. object must be named Hudson and the nucleus must be named Nucleus and set to a dummy object.

It is easier to just import a .rif file into max and delete all objects except for these than to make them. Do this by clicking on the File menu, select Import, then make the file type a .RIF file. Then just select the rif you want to import and delete all shapes except the nucleus and ref. object. We suggest you just do this to avoid any confusion.

Now, onto the fun stuff.

Create a model of the weapon you want to use in AvP. I am going to make a Pezman Dispenser gun. Used to terminate pesky Pezmans at long range. Try to keep your models under 450 polys to keep a good framerate. Otherwise gameplay will slow down. We suggest less if possible, as the less polys you have the better. It will help when you go to texture your model as well. We also suggest tokeep the orginal SADAR models in the scene until the very end. It will help when positioning the weapon later on.

Now, make your model. This particular weapon will be a Pez dispenser with an alien head.  For ease of creating we are using the alien head model file for AvP.

To import part of another .Rif rile, in this case, the alien head and neck, click on the file menu in 3d Max and select import. Select .Rif as the file type and open Hnpcalien.rif as the file to import. Click on and select the neck and head objects from the alien and move them aside. Then select the nucleus and hudson objects and move them aside. Now, select and delete all of the other shapes that you will not be using. The only objects in the scene now are neck, head, nucleus and hudson. It should look something like this.

Click file, export and export it as a .Rif file. Make a new name for this file such as head.rif. Now, open up your custom model file that you made. When it asks you if you want to save the changes to the hnpcalien file, select no. Import the new head.rif file into your scene and position the parts to where you want them. 

First, fuse the neck and head object into one object by clicking on and selecting the head object. Then, right click and convert it to an editable mesh. Now, right click again, select Attach/Detach and select attach. After that, click on the neck object they are now one piece. Right click to get out of attach mode. Then, scale your weapon down so that it is around the same size as the original model you are replacing. For this weapon, you want to make it exactly as long as the original weapon. That way, the head will not appear too large or too small when you see it in the HUD.

Delete all the pieces of the model you will not want to use in the HUD. Remember, you will still have to delete them in Inteng as well so they will not show up in the game. Delete everything except the new model you created. Make sure you know the name of the object you are replacing though before you delete it. Attach the head to the pez body the same way you attached the neck to the head. They should all be one piece now. If any textures look weird, that's ok, you can always fix that later in Inteng. 

Click on your new weapon and give it the name of the piece you want to replace. Name the new weapon "sadar body". Without the "" marks of course. This is how it looks when its all done and ready to import into the game. 

Get read to import it into the game. The model file that contains all of the marine's HUD weapons is Marwep.rif in your Avp_Huds directory. So now, click on file, export. Select .Rif as the export type and find marwep.rif. Select it and press ok. When it asks you if you want to replace it, click on yes. This will not overwrite the entire file, it will just update the objects you have edited. Press ok to the two boxes that come up and you should get to this screen. It should look something like this.

The model file you want to import should be in the box farthest to the left and not in the center box. Press ok, you can quit max for now and play the game to see how it looks in-game. 

Uh-Oh… what's happened here? Well, when the model was imported into the marwep.rif, its rotation data was changed. It is fairly simple to fix however but can take some time to get it exactly where you want. 

The alien's head is pointing upward and the base is projecting forward. So we must go back into 3d Max and rotate the model so that the alien head is pointing down. Then it will straighten itself out in the game.

Simply import it into marwep.rif the same way you did before and replace the old object.

Also, in the screenshot, you can still see parts of the SADAR model that should not be there anymore. To get rid of them, open up marwep.rif in Inteng by double clicking on it. Go into texture mode and in the selection menu, click on object. Then, click on the parts of the model you want deleted. Once they're highlighted, click on the Misc. menu and go to Poly Edit. Select delete polys. Then exit texture mode and save it when it asks you to. Now they will no longer show up in the game.

After all that is done, it should look something like this.

Ok, now the gun is facing the right way, but now it is too far forward and too high up. To fix this, we will attach "invisible" objects to the front and top of the gun model to "push" it into the right position. This is the most tedious and time consuming part of making the weapon as you must do trial and error to get the model into the position that you want. 

To make an invisible object to attach to the gun, create a simple plane and set the length and width segs to 1. This will keep the poly count for the plane as low as possible.

You must convert the plane object to an editable mesh and click on the vertex icon that appears on the right side of the screen. It is a button that has 3 red dots on it. Once you click on it, the vertices will show up as blue dots on the screen. Select the ones on one side of the plane and move them as close together to the other side as possible to make the object too thin to be seen in the game.

These pictures are looking up from the bottom of the gun. The plane is pointing in the same direction as the head and will "push" the model back towards you so it becomes closer to you in the HUD. Now, to make the model become lower in the HUD, move the plane object above the head of the alien gun to "push" the model down. It should look something like this.

Don't expect to get this all right on the first try though, it may take you a few tries and modifications before you can get it where you want it. 

Next, attach the planes to the gun model so they're all one object and import it into the game again. It took me about 8 or 9 tries to get it around how I wanted it.  With a little hard work it should look something like this...

You can see that the hands are in the way. You could just delete them if they don't look right, but there's one problem with that. The hand models for the SADAR are also used by the skeeter weapon. So if you delete the hands for the SADAR, you also delete the hands for the skeeter. So either you can live with the way they are now, or delete them and not have them with the skeeter. There is no real good way to get around this other than make new animations for the weapon, which is VERY hard to do. 

Now you can make some textures for your weapon. When you're done, make sure to save them in Bitmap format. Then use Fastfile explorer or TexConv to convert the bitmaps to .rim files. If you have Fastfile explorer it only takes a second to import them and export them as a rif, if not use TexConv. When you're done making them, you will want to import them into marwep.rif. Open up Ccamain and load the marwep.rif file. Click on the Edit menu, and select Bitmaps. Then you can add your textures to the file. Now you can open up marwep.rif in Inteng and texture your weapon.

For this walkthrough we just threw the texture together here to just have something to show in the pic. The gun actually says Pezman down the side.

Ok, now we will work on changing the projectile that this weapon shoots. Right now, it shoots the regular missile object for the SADAR. I will change it so it shoots a pez candy instead. Something you must know about the projectile objects is that they are stored within 3 Rif files in your avp_huds directory. Each file stores the same missile object, but the different weapon views (HUD, 3rd person, multiplayer) each shoot the object in a specific file.

We will be modifying the missile.rif file that is in your shapes~1 directory. 

The projectiles in these files are actually stored inside the Rif file as shapes. The pulse grenades, flares, etc are all shapes stored in the Rif file. You can not edit them directly in Inteng or 3d Max, they must be modified in their own Rif file and then imported into the desired file. Once they are imported, they cannot be edited or changed. They can be deleted however. You can look at a list of a Rif file's imported shapes by going into Ccamain and going to the edit menu and selecting fragment types. You will see them in the shapes box to the right.

We are finally ready to make the new projectile object. Open up 3d Max again and import the missile.rif file from your shapes~1 directory. Create your new projectile object and then look at the name of the original missile object. It's name is Missile. You must copy the name exactly like you did before with the weapon model so AvP uses the new object instead. Delete the old missile object and then give yours its name. Now, export it to the missile.rif file. Now, open up Ccamain and open the missile.rif file add your custom textures to it. Go into Inteng and texture your new projectile object however you want it and then exit and save the file. 

We are at the most important part. If you forget to do this, Ccamain will not import your new object and you will get an error. You must open up the missile.rif file again in Ccamain and save it again. Just open it up, and hit save. If that doesn't work for some reason, try modifying it somehow like adding a texture to it and then deleting the texture and then saving it. Now, you can import it into another Rif file. The Rif file info must be recompiled (saving does this).

All that is left to do is to import the new missile.rif into hnpcmarine.rif, marine.rif, and multip.rif. Open up one of the files, and go to the tools menu. Scroll down to find the old missile object and delete it. Click on the file menu, click import, shape (s), and From Rif File (single). A message box may pop up saying it can't find the missile.rif, so just click yes and find it again. Then simply save the file and exit. Make sure you replace the object in all three files. When you play the game, your weapon will shoot your new object.

Now, your weapon is complete. Now go kick some ass with it. But remember, Pezman is the good guy, don't shoot him with it :)