androkiller 10 Posted April 11, 2014 i something that checks if a player has killed a opfor unit but i cant use the unitname or group name as i am unsing ALiVE to spawn in units. so i check this thread out http://forums.bistudio.com/showthread.php?140402-Check-if-unit-was-killed-by-certain-unit but i still could get it to work. so i though why not check the player score should work in theory, so i made this: random.sqf _unitscore = score sas1; if (_unitscore > 0) then { hint "this stuff works good :)"; }; where sas1 is the unit name for score check but still this nooooo work. PLEASE HELP ME SOMEONE!!!!! Share this post Link to post Share on other sites
androkiller 10 Posted April 12, 2014 (edited) ohhhh yes i made it work only way i figured is make a trigger dont touch anything on it and put this in. condition: unitscore = score sas1; (unitscore > 0); On Activation hint "happy face"; i just dont know if using triggers in this way is bad for a dedicated server Edited April 12, 2014 by Androkiller forgot stuff Share this post Link to post Share on other sites
k0rd 3 Posted April 12, 2014 i something that checks if a player has killed a opfor unit but i cant use the unitname or group name as i am unsing ALiVE to spawn in units. so i check this thread out http://forums.bistudio.com/showthread.php?140402-Check-if-unit-was-killed-by-certain-unit but i still could get it to work. so i though why not check the player score should work in theory, so i made this:random.sqf _unitscore = score sas1; if (_unitscore > 0) then { hint "this stuff works good :)"; }; where sas1 is the unit name for score check but still this nooooo work. PLEASE HELP ME SOMEONE!!!!! here you go mang -change this to fit your situation _interval=5; while { true } do { { _cur=score _x; _last= _x getVariable["score_last",0]; if (_cur <> _last) then { // add whatever you want to do to unit _x - his score has changed. // the below is an example if you want to flag the unit for later processing _x setVariable["score_changed",1]; }; _x setVariable["score_last",_cur]; } forEach allUnits; sleep _interval; }; Share this post Link to post Share on other sites
androkiller 10 Posted April 12, 2014 very nice however can i change "_x" to the unit name, becuase doesnt this to check on all units, or do i add some kind of unit array at the point " forEach allUnits;" so maybe like this "forEach [unit1,unit2,.....];" and then thirdly i would need this to run a score check for multiple units, then check the sum all scores against a fixed score. so i devised this using a trigger. condition sas3score = score sas3; sas4score = score sas4; sas2score = score sas2; sas1score = score sas1; ((sas1score+sas2score+sas3score+sas4score) < -1); sas# are the unit names OnAct hint "whatever i want really"; Only problem with this is that all players must be present otherwise no worky. so how would i use your code in my new current situation. Share this post Link to post Share on other sites
k0rd 3 Posted April 12, 2014 (edited) try this bud, yeah you can use any array - _interval=5; while { true } do { _sum=0; { if (isPlayer _x) then { _cur=score _x; _last= _x getVariable["score_last",0]; //if (_cur <> _last) then { // add whatever you want to do to unit _x - his score has changed. // the below is an example if you want to flag the unit for later processing //_x setVariable["score_changed",1]; //}; _x setVariable["score_last",_cur]; _sum= _sum + _cur; }; } forEach playableUnits; //or any array if (_sum < -1) then { // do whatever you want }; sleep _interval; }; edit: also added a check to make sure _x is currently a player Edited April 12, 2014 by k0rd 1 Share this post Link to post Share on other sites