Home   Help Search Login Register  

Author Topic: Order 3 + numbers hi - low? [solved]  (Read 1830 times)

0 Members and 1 Guest are viewing this topic.

Offline Bracks

  • Members
  • *
Order 3 + numbers hi - low? [solved]
« 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.
Code: [Select]
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
Code: [Select]
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.  :)

« Last Edit: 29 Mar 2008, 08:26:32 by Bracks »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Order 3 + numbers hi - low?
« Reply #1 on: 24 Mar 2008, 19:45:26 »
Code: [Select]
_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];

Offline Bracks

  • Members
  • *
Re: Order 3 + numbers hi - low? [solved]
« Reply #2 on: 29 Mar 2008, 08:27:12 »
Great thanks Mandoble!  :)