tomhighway 30 Posted April 14, 2016 I want to create a module (any module) dynamically in a script and change it's attributes on certain events. I've read that modules can be created like any other LOGIC object (example https://community.bistudio.com/wiki/Artillery_Module#Frequently_Asked_Questions for artillery module) using createUnit, synchronizeObjectsAdd, synchronizeObjectsRemove. But is there a way to: set the module attributes upon creation change them later during course of the mission Thank you. Share this post Link to post Share on other sites
tomhighway 30 Posted April 14, 2016 Judging by the example of how to create a module, getVariable and setVariable on module object should be used. See more here (write the module function). 1 Share this post Link to post Share on other sites
tomhighway 30 Posted April 14, 2016 Ok, I'm going to help out people following me. Here it is - I've dynamically added a ACE 3 sitting module by init.sqf. The essential thing is finding out the function name that has to be spawned (so the wiki says, modules are spawned, not called). You can do that in 3DEN by temporarily placing module in mission - right click on it and select Find in Config Viewer. Then look for value of the function attribute - that is module function name. _center = createCenter sideLogic; _group = createGroup _center; _pos = getPos player; module_sitting = _group createUnit ["ACE_ModuleSitting", _pos, [], 0, ""]; /* * this is where you set the arguments of the module, name can be found out from config viewer * class Arguments */ module_sitting setVariable ["enable", true]; // [name of the module, units that module is affecting, activated] spawn function_name; [module_sitting, [], true] spawn ace_sitting_fnc_moduleInit; 1 2 Share this post Link to post Share on other sites
tomhighway 30 Posted April 15, 2016 Unfortunately, I was getting excited too early. It seems that createUnit calls the initialization of the module but with default options rendering the following setVariable calls useless in ACE 3 case. There is a telling warning in the .rpt log SetSetting [ace_captives_allowHandcuffOwnSide] Trying to set forced setting I am stuck. I don't know if there is a Bohemia function that is spawning the modules instead of createUnit. Help appreciated. Share this post Link to post Share on other sites
oOKexOo 237 Posted May 19, 2018 I was also confronted with this question for the vanilla spawn AI modules. Although this thread is old, I still think it is the best place to post a solution. The solution is to use the alternative syntax of createUnit: type createUnit [position, group, init, skill, rank] The init argument is the init line, which is executed before the module function. Hence, if you do the synchronizations and set the variables here, then it works fine. Note that this syntax does not return the object, so you will have to assign the module to a global variable. 2 Share this post Link to post Share on other sites
PortalGunner 24 Posted May 13, 2019 Don't mean to necro but thank you for this! Turns out I was getting the arguments from the wrong place (game files themselves), Config Viewer fixed that. Now I can have the Warlords module on our Zeus template begin only if a mission parameter is set. Share this post Link to post Share on other sites