CheyenneAH56 77 Posted December 22, 2018 Hello everyone, I need a little help I try to create, through a script, a combination of modules to add a civilian presence to the cities crossed by the player. The problem is that at the launch of the mission, despite the generation of three modules (visible and existing in Zeus mode) the main module (ModuleCivilianPresence_F) does not link with the other two modules (ModuleCivilianPresenceSafeSpot_F and ModuleCivilianPresenceUnit_F), and I have the following error message : "bis_fnc_moduleCivilianPresence [x] Civilian Presence L-Alpha 1-2: 1 terminated." There are at least 1 spawnpoint and 1 position module. " How to make dialogue, synchronize the three modules, created via a script, ingame ? This is just a piece of extracted code; the rest of my project works perfectly : Do not pay attention to the two ways to create a unit, both ways work exactly the same, I put the necessary characters to hide the text for reading the script > /* and */ _townLoc = nearestLocations [getPos player, ["NameVillage","NameCity","NameCityCapital","NameLocal","CityCenter","Airport"], 2500]; if ((count _townLoc) > 0) then { sleep 0.01; _townPos = locationPosition (_townLoc select 0); /* sleep 0.50; _MCP_Spawn = (createGroup sideLogic) createUnit ["ModuleCivilianPresenceUnit_F",_townPos,[],0,"NONE"]; _MCP_Spawn setvariable ['BIS_fnc_initModules_disableAutoActivation', false]; sleep 0.50; _MCP_SafeSpot = (createGroup sideLogic) createUnit ["ModuleCivilianPresenceSafeSpot_F",_townPos,[],0,"NONE"]; _MCP_SafeSpot setvariable ['BIS_fnc_initModules_disableAutoActivation', false]; sleep 0.50; _MCP_Module = (createGroup sideLogic) createUnit ["ModuleCivilianPresence_F",_townPos,[],0,"NONE"]; _MCP_Module setvariable ['BIS_fnc_initModules_disableAutoActivation', false]; */ sleep 0.50; _MCP_SafeSpot = "ModuleCivilianPresenceSafeSpot_F" createUnit [_townPos, createGroup sideLogic, "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false];", 0.6, "PRIVATE"]; sleep 0.50; _MCP_Spawn = "ModuleCivilianPresenceUnit_F" createUnit [_townPos, createGroup sideLogic, "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false];", 0.6, "PRIVATE"]; sleep 0.50; _MCP_Module = "ModuleCivilianPresence_F" createUnit [_townPos, createGroup sideLogic, "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false];", 0.6, "PRIVATE"]; }; Otherwise I also tried another method : I to place the necessary modules in the 3den editor, then move them by script when the player is near a locality. The modules change position, but the created civil entities always go to the moduleCivilianPresenceSafeSpot module's initial position, ie the position of the module when it was placed in the editor, even if it was changed position. :/ 1 Share this post Link to post Share on other sites
Play3r 147 Posted December 22, 2018 http://www.armaholic.com/page.php?id=25219&highlight=EOS i use this for Civilian, when i want to use other that Vanilla civillians, you can put any faction inside the Script.. Share this post Link to post Share on other sites
CheyenneAH56 77 Posted December 22, 2018 Thank you very much for your help, but this script is part of a more complex project. I absolutely have to use BI resources. But thanks anyway 1 Share this post Link to post Share on other sites
pierremgi 4880 Posted December 22, 2018 You can place triggers to spawn/despawn civilians and make them move from a house to another. no need to add modules for that. Share this post Link to post Share on other sites
haleks 8212 Posted December 22, 2018 One of your problems is that modules only initiate once - that's why moving the modules themselves doesn't have any effect. You would need to create & delete them dynamically as the player moves around. Also, this should be usefull : https://community.bistudio.com/wiki/synchronizeObjectsAdd Share this post Link to post Share on other sites
gc8 977 Posted December 22, 2018 Hi, I needed also this module so I figured how to place it via script. Here's my code that does that, it's not perfect code but WIP and it only shows you how to create the modules: _grp = createGroup civilian; placeoneSpot = { _pos = getmarkerpos _this; _m1 = _grp createUnit ["ModuleCivilianPresenceSafeSpot_F", _pos, [], 0, "NONE"]; _m1 setVariable ["#capacity",5]; _m1 setVariable ["#usebuilding",true]; _m1 setVariable ["#terminal",false]; //_m1 setVariable ["#type",5]; _m2 = _grp createUnit ["ModuleCivilianPresenceUnit_F", _pos, [], 0, "NONE"]; //systemchat format["--> %1 %2", _m1,_m2]; }; "marker_0" call placeoneSpot; "marker_1" call placeoneSpot; _cen = getpos player; _m = _grp createUnit ["ModuleCivilianPresence_F", [0,0,0], [], 0, "NONE"]; _m setVariable ["#area",[_cen,1000,1000,0,true,-1]]; // Fixed! this gets passed to https://community.bistudio.com/wiki/inAreaArray _m setVariable ["#debug",true]; // Debug mode on _m setVariable ["#useagents",true]; _m setVariable ["#usepanicmode",false]; _m setVariable ["#unitcount",10]; You need "marker_0" and "marker_1" on the map for this to work. Don't place them too near player it maybe that the civilians wont spawn then. No need for sync. 3 1 Share this post Link to post Share on other sites
CheyenneAH56 77 Posted December 22, 2018 Thank you all ! Will test soon ! Share this post Link to post Share on other sites
gc8 977 Posted December 22, 2018 Fixed bug in _m setVariable ["#area" should now be in proper format 1 Share this post Link to post Share on other sites
CheyenneAH56 77 Posted December 22, 2018 Thanks a LOT gc8 ! :D Share this post Link to post Share on other sites
LSValmont 789 Posted November 12, 2019 On 12/22/2018 at 12:53 PM, gc8 said: Hi, I needed also this module so I figured how to place it via script. Here's my code that does that, it's not perfect code but WIP and it only shows you how to create the modules: _grp = createGroup civilian; placeoneSpot = { _pos = getmarkerpos _this; _m1 = _grp createUnit ["ModuleCivilianPresenceSafeSpot_F", _pos, [], 0, "NONE"]; _m1 setVariable ["#capacity",5]; _m1 setVariable ["#usebuilding",true]; _m1 setVariable ["#terminal",false]; //_m1 setVariable ["#type",5]; _m2 = _grp createUnit ["ModuleCivilianPresenceUnit_F", _pos, [], 0, "NONE"]; //systemchat format["--> %1 %2", _m1,_m2]; }; "marker_0" call placeoneSpot; "marker_1" call placeoneSpot; _cen = getpos player; _m = _grp createUnit ["ModuleCivilianPresence_F", [0,0,0], [], 0, "NONE"]; _m setVariable ["#area",[_cen,1000,1000,0,true,-1]]; // Fixed! this gets passed to https://community.bistudio.com/wiki/inAreaArray _m setVariable ["#debug",true]; // Debug mode on _m setVariable ["#useagents",true]; _m setVariable ["#usepanicmode",false]; _m setVariable ["#unitcount",10]; You need "marker_0" and "marker_1" on the map for this to work. Don't place them too near player it maybe that the civilians wont spawn then. No need for sync. Hey @gc8, have you complemented this script since you posted it here? I want to use it but also want to know if it needs any changes since its conception and how well did it worked for you? Share this post Link to post Share on other sites
gc8 977 Posted November 12, 2019 4 hours ago, LSValmont said: Hey @gc8, have you complemented this script since you posted it here? I want to use it but also want to know if it needs any changes since its conception and how well did it worked for you? Can't remember but it creates the modules so if that works then it should be ok 1 Share this post Link to post Share on other sites