Writing Weapon Scripts

At this point we have three files. A material (baseball_bat.mtl), a third person geometry file (baseball_bat_tp.cgf) and a first person character file (baseball_bat_fp.chr). It’s not enough to get a weapon into the engine. But to test that it’s working (and we should at this point) we could drag the CGF file into a map as level-geometry. To test the CHR file, use the Character Editor.

First Person Weapon Asset

You’ll create a separate file from the source model. You’ll want to name this file similar to the third-person file, except use _fp as a suffix. (Mine is baseball_bat_fp.ma) And add onto it – a joint at the origin (name it weapon), and another at the weapons end-point (where you want the collision to happen.) Duplicate this second joint twice. (We need three joints, name them: weapon_01, collision, and weapon_term)

It's not quite ready...It's not quite ready...

With the joints in place, bind the mesh to the initial weapon root.

Third Person Weapon Asset

Fairly simple set up. We need to take our model, save it to a new file (I recommend a _tp suffix, for instance mine is named baseball_bat_tp.ma.) Now you’re going to have to create some “CryHelperNodes.” This is bogus, it’s technically just a fancy name for some other thing, which is simply being used to track a MAT16. Er, a positional translation matrix.