OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Bracks on 20 Mar 2008, 00:47:13
-
Hello,
I have two questions for anyone who has the time.and would like to answer.
1st-- How can I order three numbers from highest to lowest?
I'm making a three way capture the flag and in the outro I would like for the camera to focus first on the winners flag, then second place and then last placed teams.
So far I have something like this, but it only returns last place and first place.
if((Eastscore > westscore) && (Eastscore > guerscore)) then {returns highest};
if((Eastscore < westscore) && (Eastscore < Guerscore)) then {returns lowest};
2nd-- I am using 3 repeating triggers with the condition
alive unit and then they execute a random flag capture/move script for the ai leaders. Now the trigger seems to know not to exec the script again and again while the unit is alive; it only triggers when the unit respawns or at the start of the match.
However when I make an alive loop in a script to improve performance and only run it server side, it don't seem to work the same way. So how could I put that trigger into a script, so that it works in the same manner without executing the code repeatedly while the unit is alive?
Any help or suggestions is much appreciated. :)
-
_array = [westscore, eastscode, guerscore]
_max = -999999;
_min = 999999;
_mid = 0;
{if (_x > _max) then {_max = _x}; if (_x < _min) then {_min = _x}} forEach array
;Crappy way to get the middle value
{if ((_x != _max) && (_x != _min)) then {_mid = _x};} forEach array
_ordered_array = [_max, _mid, _min];
-
Great thanks Mandoble! :)