SeelieKnight 1 Posted December 7, 2020 I'm having major issues getting a small script to work in MP and I've narrowed it down to the IF THEN statement I'm using. For reference, this works: while {alive p1} do{ {hint "HE ALIVE";} spawn Bis_fnc_spawn; } But this does not: while {alive p1} do{ if (lifeState p1 == "INCAPACITATED") then { {hint "HE DEAD";} spawn Bis_fnc_spawn; }; } Why? The code is placed in the Init field of unit named 'p1'. Share this post Link to post Share on other sites
gc8 981 Posted December 7, 2020 maybe he's "DEAD" and not "INCAPACITATED" https://community.bistudio.com/wiki/lifeState Share this post Link to post Share on other sites
SeelieKnight 1 Posted December 7, 2020 1 minute ago, gc8 said: maybe he's "DEAD" and not "INCAPACITATED" https://community.bistudio.com/wiki/lifeState Nah, the code will ultimately use Incapacitated instead of dead. Got ACE settings so that players never actually die. To check my code I'm just knocking myself out with grenades and then checking my unit's lifeState. It is "INCAPACITATED" but the hint never fires. Share this post Link to post Share on other sites
gc8 981 Posted December 7, 2020 2 minutes ago, SeelieKnight said: Nah, the code will ultimately use Incapacitated instead of dead. Got ACE settings so that players never actually die. To check my code I'm just knocking myself out with grenades and then checking my unit's lifeState. It is "INCAPACITATED" but the hint never fires. ok well maybe alive returns false when INCAPACITATED Share this post Link to post Share on other sites
SeelieKnight 1 Posted December 7, 2020 New twist. Got it to work in SP by wrapping it in a [] spawn {} and adding a sleep of 2 sec. Apparently you just need a sleep between checks. However, this is still not working in MP. Does some part of this have weird locality issues? [] spawn{ while {alive p1} do{ if (lifeState p1 == "INCAPACITATED") then { {hint "HE DEAD";} spawn Bis_fnc_spawn; }; sleep 2; } } 1 Share this post Link to post Share on other sites
pierremgi 4915 Posted December 7, 2020 What i the added value of bis_fnc_spawn ?? when you just have to use spawn command?? (it's a real question, not a criticism) For MP (and SP): [] spawn { waitUntil {sleep 1; lifeState p1 == "incapacitated"}; "P1 is unconscious" remoteExec ["hint"]; waitUntil {sleep 1; lifeState p1 != "incapacitated"}; }; 2 Share this post Link to post Share on other sites
SeelieKnight 1 Posted December 7, 2020 4 minutes ago, pierremgi said: What i the added value of bis_fnc_spawn ?? when you just have to use spawn command?? (it's a real question, not a criticism) For MP (and SP): [] spawn { waitUntil {sleep 1; lifeState p1 == "incapacitated"}; "P1 is unconscious" remoteExec ["hint"]; waitUntil {sleep 1; lifeState p1 != "incapacitated"}; }; It was a combination of my poor understanding of MP scripting and a holdover from previous script testing. Your code actually does precisely what I want, so thank you! 1 Share this post Link to post Share on other sites
pierremgi 4915 Posted December 7, 2020 OK, but the interest of BIS_fnc_spawn remains not evident. This function is not a very old one (introduced in Arma3 V 0.56) .... If somebody could explain why using it instead of spawn command, thanks. 1 Share this post Link to post Share on other sites
SeelieKnight 1 Posted December 7, 2020 2 minutes ago, pierremgi said: OK, but the interest of BIS_fnc_spawn remains not evident. This function is not a very old one (introduced in Arma3 V 0.56) .... If somebody could explain why using it instead of spawn command, thanks. I was kind of using it in place of remoteExec. It basically just sends the hint to all players. (I think) Share this post Link to post Share on other sites
Larrow 2827 Posted December 7, 2020 2 hours ago, pierremgi said: OK, but the interest of BIS_fnc_spawn remains not evident. If somebody could explain why using it instead of spawn command 2 hours ago, SeelieKnight said: I was kind of using it in place of remoteExec. It basically just sends the hint to all players. (I think) You cannot use it in place of remoteExec as all it does is call the given code locally( it does not send the code to all players ). What it is useful for is remoteExecuting some code, as the commands spawn/call are not remoteExecutable, and you may not particularly need/want your own function to remoteExec. [[_some,_args],{/*some code*/}] remoteExec["spawn",0]; //Does not work, command spawn is not remoteExecutable [[_some,_args],{/*some code*/}] remoteExec["BIS_fnc_spawn",0]; //remoteExecute the code with args on all machines 2 Share this post Link to post Share on other sites
pierremgi 4915 Posted December 8, 2020 1 hour ago, Larrow said: You cannot use it in place of remoteExec as all it does is call the given code locally( it does not send the code to all players ). What it is useful for is remoteExecuting some code, as the commands spawn/call are not remoteExecutable, and you may not particularly need/want your own function to remoteExec. [[_some,_args],{/*some code*/}] remoteExec["spawn",0]; //Does not work, command spawn is not remoteExecutable [[_some,_args],{/*some code*/}] remoteExec["BIS_fnc_spawn",0]; //remoteExecute the code with args on all machines The command spawn seems to me remote executable... [arrayOfObjects ,{{_x hideObjectGlobal true} foreach _this}] remoteExec ["spawn",2]; works from client. 1 Share this post Link to post Share on other sites
Larrow 2827 Posted December 8, 2020 I apologise, I now see that I was working with old information and note that CfgRemoteExecCommands is obsolete. Which means any command is now remoteExecutable unless specifically blocked in CfgRemoteExec. 2 Share this post Link to post Share on other sites
Harzach 2518 Posted December 8, 2020 21 hours ago, Larrow said: What it is useful for is Looks like it was added to support BIS_fnc_MP, before we had remoteExec and its relatives. 2 Share this post Link to post Share on other sites
pierremgi 4915 Posted December 8, 2020 Yes, and the question is: if you can legally remoteExec some spawned home-made functions/scripts (from scenario or signed mods, here not a question of hack), how reacts battlEye is this case? I mean, if you add a teleport (scenario or shared signed mod), is there a risk for players to be banned? I guess not but... for dedicated server where battlEye is paramount (imho) , can we guarantee that undue ban will not occur in this case? 1 Share this post Link to post Share on other sites