Assuming you are using the event "Unit enters region", you will need to use the function "Triggering unit" to get the unit that entered the region. There is also a function to get the Unit Type of Unit, which will fetch the id of the unit type, so "Marine" "Marauder" etc.
So the code would look like the following:
if (UnitType(TriggeringUnit) == "Marine) then...
If you need to compare to a predefined list, I would suggest learning some basic search algorithms. The most brute force is to loop through a list/array, and check each one. This works for small lists (anything under 20 would be fine), but if the list is longer, there are faster methods.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Assuming you are using the event "Unit enters region", you will need to use the function "Triggering unit" to get the unit that entered the region. There is also a function to get the Unit Type of Unit, which will fetch the id of the unit type, so "Marine" "Marauder" etc.
So the code would look like the following:
if (UnitType(TriggeringUnit) == "Marine) then...
If you need to compare to a predefined list, I would suggest learning some basic search algorithms. The most brute force is to loop through a list/array, and check each one. This works for small lists (anything under 20 would be fine), but if the list is longer, there are faster methods.