• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

picking unit

Status
Not open for further replies.
Level 29
Joined
Sep 26, 2009
Messages
2,596
This depends on some factors:
- how many units you pick (and the biggest number of units you can pick)
- are they in a unit group

Example:
I want to check if each murlock unit is in water and has some specific buff. I have over 300 units over the whole map and thus the process of creating a unit group, iterating through each unit to determine if it is murlock or not and then iterating through each murlock in the unit group and checking if it is in water and has buff and finally destroying that group (and all that every 0.5 seconds) will probably end up being very taxing on the game (considering it's a fully developed game with other mechanics than just this one thing).

In this case it's better to create a specific unit group that will hold all murlock units in it and update this group with triggers that fire upon "unit enters playable map area" and "unit dies" and then periodically every 0.5 seconds check only that unit group. In this case you would just iterate through each murlock unit in the group only once to check relevant stuff.
 
Status
Not open for further replies.
Top