sbsmac 0 Posted January 6, 2007 I want to experiment with the civilian fsms by overiding the fsmDanger and fsmFormation fields in the Civilian class. What I've done so far... Created a myciv directory Created a myciv.cpp file in that directory with the following contents <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class CfgPatches { class myciv { units [] = {myciv}; weapons[] ={}; requiredVersion = 0.1; requiredAddons[] = {}; }; }; class CfgVehicles { class myciv: Civilian { displayName = "my new civilian"; //fsmDanger= to be added later }; }; Used kegety's cpbo to generate a myciv.pbo from the contents of the myciv directory. Copied myciv.pbo to the ARMA Addons directory (the one in program files). Opened up the editor expecting to find 'myciv' as an option as a Civilian Man. Unfortunately I can't see this so I'm obviously missing some vital step. I've read a couple of tutorials but they seem geared to creating new vehicles and textures in OFP - nothing as simple as this. Share this post Link to post Share on other sites
.kju 3245 Posted January 6, 2007 your indentation is hm try this <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches { class YOURTAG_myciv { units[] = {"YOURTAG_myciv"}; weapons[] = {}; requiredVersion = 1.0; requiredAddons[] = {"CACharacters"}; }; }; class CfgVehicles { class Civilian; // Inheritance class YOURTAG_myciv: Civilian { displayName = "my new civilian"; //fsmDanger= to be added later }; }; Share this post Link to post Share on other sites
sbsmac 0 Posted January 6, 2007 Quote[/b] ]your indentation is hm Funny - I used to hate K&R indentation but seem to have fallen into it for sqf files Quote[/b] ]try this Thanks - try it I did and didn't get very far. Still, it has opened up a few new ideas to try. Am I actually looking for this to appear in the right place. My expectation is that when I go the editor I'll be able to place a unit by selecting side 'Civilian', class 'men' and I'll then see either 'myciv' or 'my new civilian' over in the Unit drop-down list with the other civilian types. Is that how it works or do I have to edit the mission.sqm file ? Share this post Link to post Share on other sites
sbsmac 0 Posted January 6, 2007 Ok - fixed it now. Missing steps were (in addition to fixes by Q):- 1) Instead of calling the file 'myciv.cpp' it needed to be called 'config.cpp'. 2) The base civilian class I'd been trying to inherit from doesn't have an associated model. Inheriting from 'Civilian2' solves this. Final file contents (myciv\config.cpp) looked like <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class CfgPatches { class myciv { units[] = {"myciv"}; weapons[] ={}; requiredVersion = 0.1; requiredAddons[] = {"CACharacters"}; }; }; class CfgVehicles { class Civilian2; class myciv: Civilian2 { displayName = "new civilian"; }; }; (Yes, I take the point about tags but this is just an experiment.) The new class does appear in the editor in the way I expected. Share this post Link to post Share on other sites
sbsmac 0 Posted January 6, 2007 Ok, new problem. When I add these lines:- fsmFormation="test.fsm"; fsmDanger="test.fsm" ; to the myciv class and try to preview the mission with a 'new civilian unit I get an error dialog "No entry test.fsm.FSM" test.fsm is included in the pbo and is syntactically correct (it can be successfully called from a normal script using doFSM). I have a horrible feeling this is something to do with the strange CfgFSMs class with its mysterious functions, parameters and thresholds. Share this post Link to post Share on other sites
sbsmac 0 Posted January 7, 2007 Quote[/b] ]I get an error dialog "No entry test.fsm.FSM" The trick is that the fsm needs to be referenced from the addon-name. So I needed to write fsmDanger = "myciv\test.fsm"; Share this post Link to post Share on other sites