-
Trigger: AssignRankToUnits
-
Event:
-

- (timer) - Elapsed game time is 2.00 seconds
-
-
Conditions:
-

- (нет)
-
-
Actions:
-

Set UnitCount = 0
-

Set MyGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Footman))
-

Pick every unit in MyGroup and do (Actions)
-


Set UnitCount = UnitCount + 1
-


Set UnitArray[UnitCount] = (Picked unit)
-


Set UnitPower[UnitCount] = (Attack damage of (Picked unit))
-
-

// downgrade sorting
-

For each (Integer i) from 1 to (UnitCount - 1), do (Actions)
-


For each (Integer j) from (i + 1) to UnitCount, do (Actions)
-



If (UnitPower[i] < UnitPower[j]) then (Actions)
-




Set TempPower = UnitPower[i]
-




Set UnitPower[i] = UnitPower[j]
-




Set UnitPower[j] = TempPower
-




Set TempUnit = UnitArray[i]
-




Set UnitArray[i] = UnitArray[j]
-




Set UnitArray[j] = TempUnit
-
-
-
-

// numbers
-

For each (Integer i) from 1 to UnitCount, do (Actions)
-


Game - Display to (All players) the text: ((Name of UnitArray[i]) + " gets number " + (String(i)))
-
-
okay, code above is shite. i figured out, that i need just to find highest unit, give him number 1, kick him out, find next highest, he goes by 2 and so on until whole group is empty
i did it, with some scripting adive from another ai chat
-
sorting init
-

Events
-


Player - Player 1 (Red) types a chat message containing a as An exact match
-
-

Conditions
-

Actions
-


Unit Group - Remove all units from ProcessedGroup
-


Unit Group - Remove all units from UnitsGroup
-


Unit Group - Pick every unit in (Units in (Playable map area) matching ((Life of (Matching unit)) Greater than 0.99)) and do (Actions)
-



Loop - Actions
-




Game - Display to (All players) the text: (Добавляю в группу юнита + (Name of (Picked unit)))
-




Unit Group - Add (Picked unit) to UnitsGroup
-
-
-


Unit Group - Add all units of UnitsGroup to ProcessedGroup
-


Set CurrentRank = 1
-


Trigger - Run sorting loop <gen> (ignoring conditions)
-
-
-
sorting loop
-

Events
-

Conditions
-

Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Number of units in ProcessedGroup) Greater than 0
-
-



Then - Actions
-




Set MaxValue = -1
-




Set MaxUnit = No unit
-




Unit Group - Pick every unit in ProcessedGroup and do (Actions)
-





Loop - Actions
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








((Picked unit) is A Hero) Equal to True
-
-







Then - Actions
-








Set TempValue = (Intelligence of (Picked unit) (Include bonuses))
-
-







Else - Actions
-








Set TempValue = (Level of (Picked unit))
-
-
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








TempValue Greater than MaxValue
-
-







Then - Actions
-








Set MaxValue = TempValue
-








Set MaxUnit = (Picked unit)
-
-







Else - Actions
-
-
-
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






MaxUnit Not equal to No unit
-
-





Then - Actions
-






Unit - Set the custom value of MaxUnit to CurrentRank
-






Unit Group - Remove MaxUnit from ProcessedGroup
-






Set CurrentRank = (CurrentRank + 1)
-






Trigger - Run sorting loop <gen> (ignoring conditions)
-
-





Else - Actions
-
-
-



Else - Actions
-




Trigger - Run sorting endmsg <gen> (ignoring conditions)
-
-
-
-
-
sorting endmsg
-

Events
-

Conditions
-

Actions
-


Game - Display to (All players) the text: работа Ñ Ð³...
-


Unit Group - Pick every unit in (Units in (Entire map) matching (((Matching unit) is alive) Equal to True)) and do (Actions)
-



Loop - Actions
-




Game - Display to (All players) the text: (((Name of (Picked unit)) + ) + (String((Custom value of (Picked unit)))))
-
-
-
-
