PSYKO_nz 42 Posted August 28, 2018 hi there, I have a mission where AI OPFOR and INDFOR are fighting, however, I don't want them to start fighting until the players (BLUFOR) speak to the local priest, the players will be landing at an LZ within a few hundred meters of the town the fight is happening in, but the ai must not fire until the priest has spoken to the players (speak via addaction) the idea is that the players meet the priest in the middle of town, talk to him, then all hell erupts and the players have to fight their way out Share this post Link to post Share on other sites
HazJ 1288 Posted August 28, 2018 Many ways to do this. Here are a couple: enableSimulation - Depending on what you want and how the scenario is. If you want the AI to still move and play animations then this won't do. setCaptive - You can use a forEach loop and apply this to everyone. In your addAction code, just set it back to false, from true. https://community.bistudio.com/wiki/setCaptive https://community.bistudio.com/wiki/forEach { _x setCaptive true; // now captive - note: this command sets side to civilian } forEach allUnits; // addAction code: { _x setCaptive false; } forEach allUnits; 2 Share this post Link to post Share on other sites
PSYKO_nz 42 Posted August 28, 2018 18 hours ago, HazJ said: Many ways to do this. Here are a couple: enableSimulation - Depending on what you want and how the scenario is. If you want the AI to still move and play animations then this won't do. setCaptive - You can use a forEach loop and apply this to everyone. In your addAction code, just set it back to false, from true. https://community.bistudio.com/wiki/setCaptive https://community.bistudio.com/wiki/forEach { _x setCaptive true; // now captive - note: this command sets side to civilian } forEach allUnits; // addAction code: { _x setCaptive false; } forEach allUnits; this looks like it will be ideal (setcaptive), however, I can't seem to get it to work, they all engage before the set captive thing kicks off, what am I doing wrong? the first line is in a script called by the init (i have also tried it in the init as well) and they still start killing each other, I know its something that I'm doing wrong but I haven't had enough coffee to see what it is, but I'm keen to learn, I don't have much experience with this set captive thing but it looks like I will be using it a lot in the future Share this post Link to post Share on other sites
pierremgi 4738 Posted August 29, 2018 setCaptive should work at once. If not, are you playing with some mod or script altering the behavior of the units? If you don't want to change the side of the units, try to place them in careless mod (the only weird thing is they continue to throw grenades if too close to an enemy... That's ARMA! - forbid grenades) { _x setBehaviour "careless"} forEach allGroups; In addAction shift to "aware" or "combat". 2 Share this post Link to post Share on other sites
PSYKO_nz 42 Posted August 29, 2018 no mod or script, should I place it in a script called by the init or just right in the init?? the add action fires off the x setCaptive false; from a script too or should I be placing these in a trigger? Share this post Link to post Share on other sites
HazJ 1288 Posted August 29, 2018 1 hour ago, pierremgi said: setCaptive should work at once. If not, are you playing with some mod or script altering the behavior of the units? If you don't want to change the side of the units, try to place them in careless mod (the only weird thing is they continue to throw grenades if too close to an enemy... That's ARMA! - forbid grenades) { _x setBehaviour "careless"} forEach allGroups; In addAction shift to "aware" or "combat". For the grenade issue. You could add EH to catch the throw. Delete it and add the grenade back. Once scene ends, remove the EH. Share this post Link to post Share on other sites
pierremgi 4738 Posted August 29, 2018 5 hours ago, PSYKO_nz said: no mod or script, should I place it in a script called by the init or just right in the init?? the add action fires off the x setCaptive false; from a script too or should I be placing these in a trigger? in initServer.sqf if you are in MP. This way the "peace" behavior you want at start will run once. If init field or init.sqf, without condition: if (isServer) then ... you will have a start behavior at each JIP. Share this post Link to post Share on other sites
PSYKO_nz 42 Posted August 29, 2018 14 hours ago, pierremgi said: in initServer.sqf if you are in MP. This way the "peace" behavior you want at start will run once. If init field or init.sqf, without condition: if (isServer) then ... you will have a start behavior at each JIP. 4 worked like a charm first time!! does initServer.sqf include dedicated? also is there a way to make just one side captive? ie, turn all opfor captive once a trigger or addaction fires? Share this post Link to post Share on other sites
pierremgi 4738 Posted August 29, 2018 28 minutes ago, PSYKO_nz said: worked like a charm first time!! does initServer.sqf include dedicated? also is there a way to make just one side captive? ie, turn all opfor captive once a trigger or addaction fires? Yes Yes: {_x setCaptive true} forEach (allUnits select {side _x == east}); Note: allUnits is the array of all men (AIs or players). you can add a selection with select command as shown above. the _x is the variable related to each element in this scope. You can add also _x inArea your trigger for example: ... select {side _x == east && _x inArea yourTrigger} if you have a trigger named yourTrigger Share this post Link to post Share on other sites
PSYKO_nz 42 Posted August 29, 2018 AWESOME!!! thank you so much! one last question, after I make everyone captive can I set all player units (8 of them) to go back to blufor without affecting the ai units (opfor and indfor) who need to stay captive? this is going to change the way I build missions, wow, thank you so much! I suppose I could just do this in the init server {_x setCaptive true} forEach (allUnits select {side _x == east}); {_x setCaptive true} forEach (allUnits select {side _x == resistance}); is that right? EDIT: Nope that doesn't work how about { _x setCaptive true; // now captive - note: this command sets side to civilian } forEach allUnits; sleep 2; {_x setCaptive false} forEach (allUnits select {side _x == west}); EDIT EDIT: that did work either :( any ideas? Share this post Link to post Share on other sites
pierremgi 4738 Posted August 29, 2018 I can't imagine why your setCaptive doesn't work.... without clear understanding of your scenario and other scripts. Anyway, if you just want to work on players, use allPlayers instead of allUnits. (in MP, allPlayers can return an empty array if starting on dedicated server and all role disabled in lobby). Share this post Link to post Share on other sites
PSYKO_nz 42 Posted August 29, 2018 I managed to get it to work how I wanted, I had a ; in the wrong place because im special hahaha 1 Share this post Link to post Share on other sites
PSYKO_nz 42 Posted August 30, 2018 one last question, everything is working mean except for one thing, I am using the following to fire off the objective, opfor notpresent trigger condition: 0.3 * ( count ( allDeadMen select { _x inArea thisTrigger && ( [getNumber (configfile >> "CfgVehicles" >> typeOf _x >> "side")] call BIS_fnc_sideType == east ) } ) + count ( thisList select { side _x == east })) >= count ( thisList select { side _x == east }) on act: {_x setCaptive true} forEach (allUnits select {side _x == east}); however, the on act is not working, they stay active and hostile, I want them to turn peaceful, not surrender, just stop shooting at the indfor and blufor units Share this post Link to post Share on other sites