TeriniousIsland-LoadEventsUnit-AnyUnitLoadscargoLocalVariablesx=0<Integer>Conditions(Triggeringunit)==Missions-Overlords[1][1]
Actions
Unit Group - Add (Triggering cargo unit) to Missions - Unit Group
Variable - Set Missions - Unit Group Unit[Missions-Count] = (Triggering cargo unit)
General - If (Conditions) then do (Actions) else do (Actions)
If
(Number of Living units in Missions - Unit Group) == 1
Then
UI - Display "Unit Group Is Empty" for (All players) to Subtitle area
UI - Display ("Level = " + (Text((Experience level of (Triggering cargo unit))))) for (All players) to Subtitle area
Variable - Set Missions - Highest Level = (Experience level of (Triggering cargo unit))
Else
General - For each integer x from 1 to Missions - Count with increment 1, do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Experience level of (Triggering cargo unit)) > (Experience level of Unit[x])
Then
Variable - Set Missions - Highest Level = (Experience level of (Triggering cargo unit))
UI - Display ("New Level = " + (Text((Experience level of (Triggering cargo unit))))) for (All players) to Subtitle area
Else
This doesn't work. I'm trying to find the highest level unit in the unit group and set that to the variable "Highest Level." What am I doing wrong?
This doesn't work. I'm trying to find the highest level unit in the unit group and set that to the variable "Highest Level." What am I doing wrong?
You always compare the cargo unit to the current group unit, and whenever the cargo unit's level is higher, its level is stored in the variable. Also, it is set to the cargo unit level in the beginning, so after the loop, it will always hold the level of the cargo unit.
If you just want to find the highest level in the group, set the variable to the level of the first unit in the group, then check if the level of the 2nd unit is higher than the variable. Rinse and repeat.
Kind of like this (pseudo):
This doesn't work. I'm trying to find the highest level unit in the unit group and set that to the variable "Highest Level." What am I doing wrong?
You always compare the cargo unit to the current group unit, and whenever the cargo unit's level is higher, its level is stored in the variable. Also, it is set to the cargo unit level in the beginning, so after the loop, it will always hold the level of the cargo unit.
If you just want to find the highest level in the group, set the variable to the level of the first unit in the group, then check if the level of the 2nd unit is higher than the variable. Rinse and repeat.
Kind of like this (pseudo):
@Kueken531: Go
Thank you. Works