jaenak 0 Posted January 26, 2004 I've been messing with a script for a few hours now doing everything I have seen done and its not working. Can anybody help me with this? I'm at the place where I want to put my fist through the monitor. What I'm trying to do is make a script that'll set a variable named "gd" to true when everyone in "groupe1" and "groupe2" are dead. But to make it even more universal so I can use it in other missions, have the line entered in the trigger line pass the group names to the script. Like <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [groupe1, groupe2] exec "GroupDead.sqs" so the script would have <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _a = _this select 0 _b = _this select 1 then it would say if _a and _b are dead then gd = true What I currently have is <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _a = _this select 0 _b = _this select 1 If Not Alive _a And Not Alive _b Then gd = true And in the trigger init field I have <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [groupe1, groupe2] exec "GroupDead.sqs" What am I doing wrong? Share this post Link to post Share on other sites
RED 0 Posted January 26, 2004 This will work: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _a = _this select 0 _b = _this select 1 ?!( Alive _a )&& ! (Alive _b): gd = true RED Share this post Link to post Share on other sites
Rastavovich 0 Posted January 26, 2004 This will work:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _a = _this select 0 _b = _this select 1 ?!( Alive _a )&& ! (Alive _b): gd = true RED Would surprise me RED, since you pass 2 arrays.. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_ar = (_this select 0) + (_this select 1) #loop _i = 0 #loop2 _unit = _ar select _i ?!alive _unit : _ar set [_i, _ar select ((count _ar)-1)], _ar resize (count _ar - 1) ? _i < (count _ar - 1): _i = _i + 1, goto "loop2" ~10 ?count _ar > 0 : goto "loop" gd = true exit this script runs continuous and checks every 10 seconds if the condition is met. Share this post Link to post Share on other sites
Taurus 20 Posted January 26, 2004 what about: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_a = _this select 0 _b = _this select 1 @( ((count units _a)==0) && ((count units _b)==0) ) gd = true or <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_a = _this select 0 _b = _this select 1 #Loop1 ~10 ?( ((count units _a)>0) && ((count units _b)>0) ): goto "Loop1" gd = true perhaps this will not work if either of the two groups are zero? Share this post Link to post Share on other sites
Bart.Jan 0 Posted January 26, 2004 or <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_a = _this select 0 _b = _this select 1 #Loop1 ~10 ?{alive _x} count units _a + units _b == 0:goto "loop1" gd=true I experienced that sometimes (count units _a)==0 is not 0 even all group units are dead. Share this post Link to post Share on other sites
bn880 5 Posted January 26, 2004 Yes BartJan is right, sometimes it takes minutes before count of a group reaches zero after everyon is killed. Perhaps it is when someone looks at the last deceased man? Share this post Link to post Share on other sites
RED 0 Posted January 26, 2004 This will work:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _a = _this select 0 _b = _this select 1 ?!( Alive _a )&& ! (Alive _b): gd = true RED Would surprise me RED, since you pass 2 arrays.. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_ar = (_this select 0) + (_this select 1) #loop _i = 0 #loop2 _unit = _ar select _i ?!alive _unit : _ar set [_i, _ar select ((count _ar)-1)], _ar resize (count _ar - 1) ? _i < (count _ar - 1): _i = _i + 1, goto "loop2" ~10 ?count _ar > 0 : goto "loop" gd = true exit this script runs continuous and checks every 10 seconds if the condition is met. Opps must have had a frozen brain when I wrote that post RED Share this post Link to post Share on other sites