With a rigged mesh, and a skeleton – it’s time to get it into the engine. But how? Well, first we’ll have to export the character into a chr file, then we’ll need to copy the “default” (read: agent_fp_global) chrparam file. It is what points our rig to the animations and without it – things won’t ever look quite right. Then we’ll need to adjust the default player script and change which arms it’s pointing to.
So let’s see how I did that. Well the very first thing I noticed was I needed to create a place somewhere in the CDK which I can keep files. I’m not sure if you’d noticed, but any folders in the
The *.chr and *.mtl files are generated by the export. That process is fairly simple, you create a group for the character (in this case, the group was named cryexportnode_fp_arm) and put inside it everything related to the physical mesh of the character. What CryTek often refers to as the live-deforming mesh, fairly descriptive and I like it. You will want to make sure that the skeleton stays out of the group.
CryTek does a pretty good job writing up on how to export an animated skeleton in their Documentation, so I won’t go too far into the process. It’d just be regurgitation, as anything I learned about exporting characters into the engine was learned from there.
When you have your *.CHR and *.MTL file, you need to find a copy of agent_fp_global.chrparams and duplicate it, rename it to match your *.CHR and *.MTL files. Once again, in my case this was simply FP-ARMS.CHRPARAMS. Then move the three files to a folder you can locate inside the game engine.
Now you need to edit the player.lua file. Be careful with this, especially if you’re not familiar with LUA or scripting in general. You will want to open Scripts.PAK with an archiver. I prefer WinRAR for this task, as it allows me to save the file inside the package seamlessly. And navigate to
Approximately forty lines down, you will find a line which reads (and you may just want to search for it.)
fpItemHandsModel = “Objects/Weapons/Agent_fp/Agent_fp_Global.chr”,
You will want to change the area which reads “Objects/Weapons…” to where-ever you have placed your new arms. In my case, this line reads “MyGame/Objects/Characters/FP-Arms/fp_arms.chr” although chances are yours will probably be located somewhere else. Make sure you include the quotation marks, and ensure the comma at the end of the line; the script compiler looks for these things to know how to interpret the file… they’re important. Equally important is the direction of the slash, use / like a web browser, and not \ like a file explorer.
Anyway, when you’re done you will want to save it and put it back in the archive. As I mentioned, WinRAR allows you to open the file, work on it, save it, and close the package without too much trouble. Seamlessly even. You save the file in Notepad, and are asked if you want to update it in WinRAR. Simple.
You should then be able to launch the engine, and check to see if, you named everything right er, the arms appear. The moment you launch Game Mode – if you’ve misnamed a joint or something, then the Console Window will let you know. Plus, if things didn’t work right then the arms won’t appear… Gun will just be floating on the screen. Unless it’s not, that’s a different problem entirely though. We’ll get to that.
However, if the joints are named right and the arms are referenced properly, you will get the arms – all bright red from the default material file. But hopefully animated and acting quite proper. You’ll want to go into the Material Editor and change the values for the arm material, probably link it to DEFAULT_NOUVS.DDS, GREY.DDS or something similar while you build a texture for it. (Personally, I use GREY.DDS)
Next Time: Troubleshooting