goliath86 11 Posted December 26, 2009 (edited) Hi guys! This is a little script that can re-initialize the ACM module in MP after respawn. //************************************************************** // This script allow the ACM Module to be re-initialized // after the unit which it is synchronized respawn. // //!!IMPORTANT!! To have this script to work you MUST // copy this line in the init field of the unit which // has to be synchronized with the ACM module after his // respawn: // // this addEventHandler ["killed", {null0 = [] execVM "acm_mod.sqf"}]; // // THE ONLY UNIT THAT CAN ACTIVATE THE ACM MODULE IS A PLAYER GROUP // LEADER AND ONLY ONE ACM MODULE CAN BE PRESENT IN A MISSION //************************************************************** //create a logic group - it is needed to create the ACM object _LogicCenter = createCenter sideLogic; _LogicGroup = createGroup _LogicCenter; //wait for player respawn waitUntil {alive player}; //Create the ACM object, add it at the "_LogicGroup" group and name it "ACM1" "AmbientCombatManager" createUnit [[0,0,0], _LogicGroup, "ACM1 = this;"]; //synchronize the ACM object with the player !! ONLY ONE UNIT NEED TO BE SYNCHRONIZED WITH THE ACM MODULE !! ACM1 synchronizeObjectsAdd [player]; //wait to initialize the ACM Module waitUntil {!isNil {ACM1 getVariable "initDone"}}; _fsm = ACM1 execFSM "ca\modules\ambient_combat\data\fsms\ambientcombat.fsm"; waitUntil {ACM1 getVariable "initDone"}; //ACM module parameters [1, ACM1] call BIS_ACM_setIntensityFunc; [ACM1, 280, 600] call BIS_ACM_setSpawnDistanceFunc; [["USMC", "RU", "INS"], ACM2] call BIS_ACM_setFactionsFunc; [0.1, 1, ACM1] call BIS_ACM_setSkillFunc; [0.1, 1, ACM1] call BIS_ACM_setAmmoFunc; ["ground_patrol", 1, ACM1] call BIS_ACM_setTypeChanceFunc; ["air_patrol", 1, ACM1] call BIS_ACM_setTypeChanceFunc; It will work! You must write in the initline of the unit that activate the ACM module: this addEventHandler ["killed", {null0 = [] execVM "acm_mod.sqf"}]; and remember: the ONLY unit that can activate the ACM module is a PLAYER GROUP LEADER !! this script allow only the re-initialization of the ACM module after respawn and if you want the ACM module at the start of the mission you have to put manually the ACM module in the editor and synchronize it with the player group leader !! Hope this can be helpful :) Edited January 4, 2010 by goliath86 Share this post Link to post Share on other sites
adamdf 10 Posted January 5, 2010 I have got this working fine with DNA's script, i have my ACM set to only spawn ground patrols, and its working nicely. However i still cant find clear instruction to make it only spawn infantry groups, can anyone tell me how to achieve this. I think you use the addGroupClassesFunc and removeGroupClassesFunc, just not sure exactly how to use it Share this post Link to post Share on other sites
goliath86 11 Posted January 5, 2010 Here you can find, under "Group Types", the two functions that you need to add/remove group classes from the ACM Manager: http://community.bistudio.com/wiki/Ambient_Combat_Manager_-_Functions#Patrol_types Functions are: to add groups to the ACM: //You can pass both actual CfgGroups Config entries or class name Strings. [<ACM reference | Object>, <types | Array of Configs and / or Strings>] call BIS_ACM_addGroupClassesFunc; and to remove groups from it: //Passing an empty types Array will completely disable the custom database and switch back to the default. [<ACM reference | Object>, <types | Array of Configs and / or Strings>] call BIS_ACM_removeGroupClassesFunc; A list of the groups is here: http://community.bistudio.com/wiki/Ambient_Combat_Manager_-_Group_types hope it helps ;) Share this post Link to post Share on other sites
Alex72 1 Posted January 5, 2010 And how to add other units/vehicles to ACM? Possible? If i want Apaches or even a vehicle/unit from an addon. I must confess that most examples made over at the wiki is too hardcore for me to understand. Its very seldom there is an example. Proper example that is. Simple example. Those empty lines with "array", "groups", "types" etc etc is not that clear to a noob. Share this post Link to post Share on other sites
goliath86 11 Posted January 5, 2010 If you want to add a squadron of AH1Z, for example, you have to write in the ACM initfield: [acm1, "USMC_AH1ZSquadron"] call BIS_ACM_addGroupClassesFunc; where 'acm1' stands for the name of the ACM module you have to put in the editor (and name it exactly acm1) and "USMC_AH1ZSquadron" (that you can find under this site http://community.bistudio.com/wiki/Ambient_Combat_Manager_-_Group_types) is a USMC Squadron of AH1Z helicopters. otherwise if you don't want the spawn of russian tanks platoon you have to write in the initfield of the ACM module: [acm1,"RU_TankPlatoon"] call BIS_ACM_removeGroupClassesFunc; and go on with all groups you want/don't want to spawn by the ACM module. A list of the common groups in ArmA2 you can find at this site http://community.bistudio.com/wiki/Ambient_Combat_Manager_-_Group_types but is already possible to add groups from addons (you only have to know the group's name, normally writed in ReadMe or similar files in the addon) Share this post Link to post Share on other sites
adamdf 10 Posted January 6, 2010 How do you remove multiple groups, iv tried [bIS_ACM,"RU_TankPlatoon", "RU_MechInfSquad_1"] call BIS_ACM_removeGroupClassesFunc; but im still getting tank groups its set to only spawn russian ground patrols, i just dont want any armored vehicles Share this post Link to post Share on other sites
goliath86 11 Posted January 6, 2010 (edited) Sorry, mine fault :rolleyes: the code must be: [bIS_ACM,[b][[/b]"RU_TankPlatoon", "RU_MechInfSquad_1"[b]][/b]] call BIS_ACM_removeGroupClassesFunc; there must be present the "[ ]" in the group definition.. Edited January 6, 2010 by goliath86 Share this post Link to post Share on other sites
adamdf 10 Posted January 6, 2010 Cheers Goliath Is it possible to set a triggerzone where nothing will spawn while using the ACM? I have a mission set up, using the reinforcements script and the ACM, i basically wanna make a USMC base where nothing will spawn. Share this post Link to post Share on other sites
goliath86 11 Posted January 6, 2010 Yes, it is possible and more easy than you expect ;) You only need to put markers in the editor (where you DON'T want the ACM module spawn units) and name it exactly: BIS_ACM_X where X must be a number from 1 and you can't skip any numbers. Here's the 'official' explaination to blacklisting areas: You may place markers with a special naming pattern BIS_ACM_X (where X has to start at 1 and may not skip any numbers). The areas defined by these markers are automatically blacklisted and the markers deleted. you can find all the ACM's functions here: http://community.bistudio.com/wiki/Ambient_Combat_Manager_-_Functions Share this post Link to post Share on other sites
adamdf 10 Posted January 6, 2010 (edited) What kinda markers? Just the F6 markers in the editor? and ifso do you place them in a sequence, eg 4 markers 1-4 to define a parameter Also how would i set a trigger so that any OPFOR that enter it die Edited January 6, 2010 by adamdf Share this post Link to post Share on other sites
goliath86 11 Posted January 7, 2010 You have to use the elliptical marker and/or the rectangular marker because you need to mark an area and the use of the icon marker has not sense at all. In your case you have to create a marker that cover all the US base and naming it BIS_ACM_1 If you have other areas which you don't want the ACM module spawn units in it, you have to create another marker (rectangular or elliptical) and naming it BIS_ACM_2 and so on.... to kill enemy units that enter in these areas you can create triggers (of the same dimensions of the marker and one for every markers you have created) and make it to activate by 'OPFOR', 'REPEATEDLY' and in the 'On Activation' field put the follow line: {_x setDamage 1} forEach thislist the code above lets the enemy units, which enter in the marker's area, to die immediately Share this post Link to post Share on other sites
Evil_Echo 11 Posted January 7, 2010 (edited) Sorry, mine fault :rolleyes:the code must be: [bIS_ACM,[b][[/b]"RU_TankPlatoon", "RU_MechInfSquad_1"[b]][/b]] call BIS_ACM_removeGroupClassesFunc; there must be present the "[ ]" in the group definition.. I tried that line and got a huge number of errors in my .RPT file. Commenting it out and the rest of my ACM configuration loop works fine. Patch 1.05+hotfix, CBA, ACE, ACEX, ACEX_SM { waitUntil {!isNil {_x getVariable "initDone"}}; waitUntil {_x getVariable "initDone"}; sleep 5; [0.5, _x] call BIS_ACM_setIntensityFunc; [_x, 400, 600] call BIS_ACM_setSpawnDistanceFunc; [["USMC", "RU"], _x] call BIS_ACM_setFactionsFunc; [0.1, 0.3, _x] call BIS_ACM_setSkillFunc; [0.5, 0.95, _x] call BIS_ACM_setAmmoFunc; [_x, ["RU_TankPlatoon", "RU_MechInfSquad_1"]] call BIS_ACM_removeGroupClassesFunc; ["ground_patrol", 1, _x] call BIS_ACM_setTypeChanceFunc; ["air_patrol", -1, _x] call BIS_ACM_setTypeChanceFunc; } forEach [ACM1, ACM2]; in the .RPT file.. Error in expression < }; }; if (!isnil "_class") then { [_dbCustom, _class] call BIS_fnc_removeNe> Error position: <_dbCustom, _class] call BIS_fnc_removeNe> Error Undefined variable in expression: _dbcustom File ca\modules\ambient_combat\data\scripts\functions\removeGroupClasses.sqf, line 62 Error in expression <_value = _this select 1; if ((typeName _array) != (typeName [])) exitWith {debu> Error position: <_array) != (typeName [])) exitWith {debu> Error Undefined variable in expression: _array File ca\modules\functions\arrays\fn_removeNestedElement.sqf, line 25 Error in expression <yFunc; }; }; if (!_found) then {_path resize ((count _path) - 1)}; }; [_array> Error position: <resize ((count _path) - 1)}; }; [_array> Error Zero divisor File ca\modules\functions\arrays\fn_findNestedElement.sqf, line 72 Error in expression < select 1; for "_i" from 0 to ((count _array) - 1) do { private ["_sub"]; _su> Error position: <_array) - 1) do { private ["_sub"]; _su> Error Undefined variable in expression: _array File ca\modules\functions\arrays\fn_findNestedElement.sqf, line 59 ... Edited January 7, 2010 by Evil_Echo more info Share this post Link to post Share on other sites
goliath86 11 Posted January 7, 2010 Why do you have two instances (ACM1, ACM2) of the ACM module? Share this post Link to post Share on other sites
Evil_Echo 11 Posted January 7, 2010 I have two groups, each synched to a ACM module. They could be in totally different parts of the mission map. Share this post Link to post Share on other sites
goliath86 11 Posted January 7, 2010 Ok, now I understand. It seems that the ACM module have some problems with that function (addGroupsClassesFunc) in MP games :confused:..it was discussed some posts ago.. with that function enabled the ACM module seems to don't start in MP games.. without that function the module works fine even in MP.. Share this post Link to post Share on other sites
Evil_Echo 11 Posted January 7, 2010 Agree. I just tried it with just one module and both groups synched to that. Still get errors. Must be something in the function that is not re-entrant. Share this post Link to post Share on other sites
major woody 11 Posted January 10, 2010 @goliath - Can you post a working templatemission with your acm_mod script. I'm having some issues in order to get it to work as I whan't it to - especially the BIS_ACM_removeGroupClassesFunc part... Cheers Share this post Link to post Share on other sites
major woody 11 Posted January 31, 2010 (edited) Allright - got the obove issue fixed by using BIS_ACM_addGroupClassesFunc instead of BIS_ACM_removeGroupClassesFunc. Got a new issue however. I would like to have a Squadron of CDF Su25 groundattack planes in my mission. Can I create a custom group like this or am I way off...? - my example below does'nt work at all. No Su25 spawns, instead everything else spawns and that's not the purpose... :confused: //create a custom group _Su25Squadron = createGroup west "Su25_CDF" createunit [_Su25Squadron, _ranskills, "CAPTAIN"]; "Su25_CDF" createunit [_Su25Squadron, _ranskills, "LIEUTENANT"]; //Sets frequency and number of patrols (0-1). BIS_ACM is module name [1, BIS_ACM] call BIS_ACM_setIntensityFunc; //min max spawn distance [bIS_ACM, 300, 400] call BIS_ACM_setSpawnDistanceFunc; //add groups [bIS_ACM, ["_Su25Squadron"]] call BIS_ACM_addGroupClassesFunc; //factions to be spawned [["CDF"], BIS_ACM] call BIS_ACM_setFactionsFunc; //Skill range for spawned units [1, 1, BIS_ACM] call BIS_ACM_setSkillFunc; Edited February 1, 2010 by Major Woody Share this post Link to post Share on other sites
splatsh 10 Posted February 15, 2010 I Have ACM on my map.... and it works nice and so... But after 30-45 minutes or so... (Have not checked the time) It's all stops, and nothing more is spawned. How to setup it to keep it spawn? I want to play it for hours... Share this post Link to post Share on other sites
StarvinMarvin 0 Posted February 17, 2010 I Have ACM on my map.... and it works nice and so...But after 30-45 minutes or so... (Have not checked the time) It's all stops, and nothing more is spawned. How to setup it to keep it spawn? I want to play it for hours... I have a similar problem. Not sure if the ACM stops after a while but i noticed that after i died (made a mission playing myself only in a warzone) the ACM seems to stop. not sure if this is because of the ACM stopping after a while or because the dude synced with the Module dies and is replaced by someone else.. do i need a script that syncs the module with the new guy after i respawn maybe?? Greetz // Marv Share this post Link to post Share on other sites
goliath86 11 Posted February 18, 2010 (edited) Hi guys! This is a little script that can re-initialize the ACM module in MP after respawn. //************************************************************** // This script allow the ACM Module to be re-initialized // after the unit which it is synchronized respawn. // //!!IMPORTANT!! To have this script to work you MUST // copy this line in the init field of the unit which // has to be synchronized with the ACM module after his // respawn: // // this addEventHandler ["killed", {null0 = [] execVM "acm_mod.sqf"}]; // // THE ONLY UNIT THAT CAN ACTIVATE THE ACM MODULE IS A PLAYER GROUP // LEADER AND ONLY ONE ACM MODULE CAN BE PRESENT IN A MISSION //************************************************************** //create a logic group - it is needed to create the ACM object _LogicCenter = createCenter sideLogic; _LogicGroup = createGroup _LogicCenter; //wait for player respawn waitUntil {alive player}; //Create the ACM object, add it at the "_LogicGroup" group and name it "ACM1" "AmbientCombatManager" createUnit [[0,0,0], _LogicGroup, "ACM1 = this;"]; //synchronize the ACM object with the player !! ONLY ONE UNIT NEED TO BE SYNCHRONIZED WITH THE ACM MODULE !! ACM1 synchronizeObjectsAdd [player]; //wait to initialize the ACM Module waitUntil {!isNil {ACM1 getVariable "initDone"}}; _fsm = ACM1 execFSM "ca\modules\ambient_combat\data\fsms\ambientcombat.fsm"; waitUntil {ACM1 getVariable "initDone"}; //ACM module parameters [1, ACM1] call BIS_ACM_setIntensityFunc; [ACM1, 280, 600] call BIS_ACM_setSpawnDistanceFunc; [["USMC", "RU", "INS"], ACM1] call BIS_ACM_setFactionsFunc; [0.1, 1, ACM1] call BIS_ACM_setSkillFunc; [0.1, 1, ACM1] call BIS_ACM_setAmmoFunc; ["ground_patrol", 1, ACM1] call BIS_ACM_setTypeChanceFunc; ["air_patrol", 1, ACM1] call BIS_ACM_setTypeChanceFunc; It will work! You must write in the initline of the unit that activate the ACM module: this addEventHandler ["killed", {null0 = [] execVM "acm_mod.sqf"}]; and remember: the ONLY unit that can activate the ACM module is a PLAYER GROUP LEADER !! this script allow only the re-initialization of the ACM module after respawn and if you want the ACM module at the start of the mission you have to put manually the ACM module in the editor and synchronize it with the player group leader !! Hope this can be helpful :) Edited February 21, 2010 by goliath86 Share this post Link to post Share on other sites
lostninja 10 Posted February 19, 2010 ive looked through this whole thread and i dont rly know wut im looking for answer this question but. I want to make a AI generated war between RU and US in Utes(test) how and wut do i need to do step by step. Would greatly appreaciate the assistance pls^^ Share this post Link to post Share on other sites
bracer 12 Posted February 20, 2010 (edited) Thanks for the code Goliath! But isn't the "setFactionsFunc" supposed to be applied to ACM1 and not ACM2? //ACM module parameters [1, ACM1] call BIS_ACM_setIntensityFunc; [ACM1, 280, 600] call BIS_ACM_setSpawnDistanceFunc; [["USMC", "RU", "INS"], ACM2] call BIS_ACM_setFactionsFunc; [0.1, 1, ACM1] call BIS_ACM_setSkillFunc; [0.1, 1, ACM1] call BIS_ACM_setAmmoFunc; ["ground_patrol", 1, ACM1] call BIS_ACM_setTypeChanceFunc; ["air_patrol", 1, ACM1] call BIS_ACM_setTypeChanceFunc; [/code] Btw; Could the same type of script be used to resync the SOM? Edited February 20, 2010 by bracer Share this post Link to post Share on other sites
goliath86 11 Posted February 21, 2010 (edited) Thanks for the code Goliath!But isn't the "setFactionsFunc" supposed to be applied to ACM1 and not ACM2? //ACM module parameters [1, ACM1] call BIS_ACM_setIntensityFunc; [ACM1, 280, 600] call BIS_ACM_setSpawnDistanceFunc; [["USMC", "RU", "INS"], ACM2] call BIS_ACM_setFactionsFunc; [0.1, 1, ACM1] call BIS_ACM_setSkillFunc; [0.1, 1, ACM1] call BIS_ACM_setAmmoFunc; ["ground_patrol", 1, ACM1] call BIS_ACM_setTypeChanceFunc; ["air_patrol", 1, ACM1] call BIS_ACM_setTypeChanceFunc; [/code] Oh yes, my fault :o sorry...ACM1 is the correct name ;) Thanks!!! Corrected in my first post Btw; Could the same type of script be used to resync the SOM? No, to resync the SOM there are some changes to do and to adjust ;) Edited February 21, 2010 by goliath86 Share this post Link to post Share on other sites
tedbell 0 Posted February 21, 2010 This is probably an impossible request, but is there a way to add an eventhandler for all created units? Share this post Link to post Share on other sites