Alpine_gremlin 13 Posted December 21, 2017 Hey guys its me again :P I`ve put together a small scale mission with some relatively hardcore settings. My group generally uses ACE Medical. This particular mission does not allow for respawns and rather than killing players immediately, places them into an unconscious state. Natrually this means that if all players are incapacitated like this, I would like to end the mission rather than have everyone sit there hoping they wake up. I had been using the following code linked to a trigger to end the mission, which worked well until recently: blufor countSide allUnits <= 0 Since (at least previously) when a unit went unconscious, they were set to captive state, this meant that they were no longer considered "BLUFOR" for the duration of being KO`d. As a result, this worked well. As of recent however, it seems that going unconscious no longer sets the player to captive (tested in debug console). I cannot seem to find alternate commands to use for this end mission trigger. Any ideas would be greatly appreciated! Cheers! :D 1 Share this post Link to post Share on other sites
pierremgi 4853 Posted December 21, 2017 {lifeState _x != "Incapacitated"} count allPlayers == 0 2 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted December 21, 2017 or _allDead = False; while{!_allDead} do{ _players = if(isMultiplayer) then{ playableUnits } else{ switchableUnits }; _nDead = 0; { if(alive _x && captive _x) then{ _nDead = _nDead + 1; }; }forEach _players; //this will be true when all players are dead as well //since playableUnits returns an empty array when all are dead. if(_nDead == count _players) then{ _allDead = True; sleep 6; hint "all players are unconcious"; //Individual letters appear quickly in random order, then disappear. Bottom right corner. any= [ "Everyone is unconcious" ] spawn BIS_fnc_infoText; sleep 2; "Mission_Failed" call BIS_fnc_endMission; }; sleep 3; }; failed = true; publicvariable "failed"; 1 Share this post Link to post Share on other sites
Alpine_gremlin 13 Posted December 21, 2017 Cheers guys I`ll give this a shot later! :) Share this post Link to post Share on other sites
fin_soldier 82 Posted May 29, 2020 On 12/21/2017 at 12:44 PM, GEORGE FLOROS GR said: or _allDead = False; while{!_allDead} do{ _players = if(isMultiplayer) then{ playableUnits } else{ switchableUnits }; _nDead = 0; { if(alive _x && captive _x) then{ _nDead = _nDead + 1; }; }forEach _players; //this will be true when all players are dead as well //since playableUnits returns an empty array when all are dead. if(_nDead == count _players) then{ _allDead = True; sleep 6; hint "all players are unconcious"; //Individual letters appear quickly in random order, then disappear. Bottom right corner. any= [ "Everyone is unconcious" ] spawn BIS_fnc_infoText; sleep 2; "Mission_Failed" call BIS_fnc_endMission; }; sleep 3; }; failed = true; publicvariable "failed"; Where is this suppose to be put? Description, Init, or a separate SQF? 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted May 30, 2020 On 5/29/2020 at 10:28 PM, fin_soldier said: Where is this suppose to be put? Description, Init, or a separate SQF? Hello @fin_soldier ! In the init.sqf 1 Share this post Link to post Share on other sites
fin_soldier 82 Posted May 31, 2020 15 hours ago, GEORGE FLOROS GR said: Hello @fin_soldier ! In the init.sqf I thought so, but I don't seem to get it working: I don't have anything else in the init.sqf 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted May 31, 2020 9 hours ago, fin_soldier said: I thought so, but I don't seem to get it working: I'll try to check it for tomorrow ok ! 1 Share this post Link to post Share on other sites
fin_soldier 82 Posted June 1, 2020 11 hours ago, GEORGE FLOROS GR said: I'll try to check it for tomorrow ok ! Thank you so much! 1 Share this post Link to post Share on other sites
pierremgi 4853 Posted June 1, 2020 There is no need to script somewhere else than server, so you can place these following codes in initserver.sqf or even a trigger (server only) set to TRUE as condition. For players only, the switchable or playable AIs are not taken into account: 0 = [] spawn { private _pass = TRUE; while {_pass} do { uisleep 0.5; if (allPlayers findIf {!(toLowerANSI lifeState _x in ["incapacitated","dead","dead-respawn"])} == -1) then { if (isMultiplayer) then {uisleep 6} else {uisleep 0.1}; _pass = FALSE; if (!isMultiplayer) exitWith {enableTeamSwitch FALSE}; if (allPlayers findIf {!(toLowerANSI lifeState _x in ["incapacitated","dead","dead-respawn"])} == -1) exitWith { "EveryoneLost" call BIS_fnc_endMissionServer; }; _pass = TRUE; }; }; }; For all playable units in MP (no interest in SP) : 0 = [] spawn { if (!isServer or !isMultiplayer) exitWith {}; private _pass = TRUE; while {_pass} do { uisleep 0.5; if (playableUnits findIf {!(toLowerANSI lifeState _x in ["incapacitated","dead","dead-respawn"])} == -1) then { uisleep 6; _pass = FALSE; if (playableUnits findIf {!(toLowerANSI lifeState _x in ["incapacitated","dead","dead-respawn"])} == -1) exitWith { "EveryoneLost" call BIS_fnc_endMissionServer; }; _pass = TRUE; }; }; }; 2 1 Share this post Link to post Share on other sites
fin_soldier 82 Posted June 1, 2020 7 hours ago, pierremgi said: There is no need to script somewhere else than server, so you can place these following codes in initserver.sqf or even a trigger (server only) set to TRUE as condition. For players only, the switchable or playable AIs are not taken into account: 0 = [] spawn { private _pass = TRUE; while {_pass} do { uisleep 0.5; if (allPlayers findIf {!(toLowerANSI lifeState _x in ["incapacitated","dead","dead-respawn"])} == -1) then { if (isMultiplayer) then {uisleep 6} else {uisleep 0.1}; _pass = FALSE; if (!isMultiplayer) exitWith {enableTeamSwitch FALSE}; if (allPlayers findIf {!(toLowerANSI lifeState _x in ["incapacitated","dead","dead-respawn"])} == -1) exitWith { "EveryoneLost" call BIS_fnc_endMissionServer; }; _pass = TRUE; }; }; }; For all playable units in MP (no interest in SP) : 0 = [] spawn { if (!isServer or !isMultiplayer) exitWith {}; private _pass = TRUE; while {_pass} do { uisleep 0.5; if (playableUnits findIf {!(toLowerANSI lifeState _x in ["incapacitated","dead","dead-respawn"])} == -1) then { uisleep 6; _pass = FALSE; if (playableUnits findIf {!(toLowerANSI lifeState _x in ["incapacitated","dead","dead-respawn"])} == -1) exitWith { "EveryoneLost" call BIS_fnc_endMissionServer; }; _pass = TRUE; }; }; }; Thanks, I'll take a look tomorrow! Share this post Link to post Share on other sites
fin_soldier 82 Posted June 5, 2020 On 6/1/2020 at 1:26 PM, pierremgi said: There is no need to script somewhere else than server, so you can place these following codes in initserver.sqf or even a trigger (server only) set to TRUE as condition. Hmm, I do get an error trying both methods... initServer.sqf: Trigger: I used the script below as I don't need it to work in SP: 1 Advanced issue found ▲ On 6/1/2020 at 8:53 PM, fin_soldier said: 0 = [] spawn { if (!isServer or !isMultiplayer) exitWith {}; private _pass = TRUE; while {_pass} do { uisleep 0.5; if (playableUnits findIf {!(toLowerANSI lifeState _x in ["incapacitated","dead","dead-respawn"])} == -1) then { uisleep 6; _pass = FALSE; if (playableUnits findIf {!(toLowerANSI lifeState _x in ["incapacitated","dead","dead-respawn"])} == -1) exitWith { "EveryoneLost" call BIS_fnc_endMissionServer; }; _pass = TRUE; }; }; }; I tried, the first one as well, but it gave the same error. Share this post Link to post Share on other sites
pierremgi 4853 Posted June 5, 2020 My scripts are working. So, perhaps that's the BI forum editor issue, adding for nuts some invisible character when copying/pasting. I don't know why there is no solution for that, this wasn't the case some months (years?) ago. 1 Share this post Link to post Share on other sites
fin_soldier 82 Posted June 5, 2020 7 hours ago, pierremgi said: My scripts are working. So, perhaps that's the BI forum editor issue, adding for nuts some invisible character when copying/pasting. I don't know why there is no solution for that, this wasn't the case some months (years?) ago. I managed to get it working by manually typing in the code character by character. Strange, but it works now. Thank you! Share this post Link to post Share on other sites