• 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.

[Trigger] How do I do this properly?

Status
Not open for further replies.
Level 2
Joined
Aug 21, 2015
Messages
8
I'm working on a DotA like map,
and as I set the paths for monster groups,
something didn't work as expected.

Sure, the mons spawn and follow their path,
however, not only the spawned ones, but
every that enters the region. I tried
to look for a condition that makes
only a Certain Player's units follow the path.
The most similiar thing I found was that
allied player's units only will be following it.
So, the opposing side will have their own
paths too, and they don't get messed up.

However, heroes from said player's side
will still follow it. Let's say you're playing
the map online, and your hero joins the
wave and follows along with them. Ofc,
you can order them to move somewhere
else and they'll follow your orders only again,
but it's still an issue I don't want to be present
in the map. So, how do I fix that?


To put it more simply:
Player 1, 2, 3, 4 and 5 are in one force and allied.
1, 2, 3, 4 are user controled while 5 is
a computer player. Not does only player
5 follow the paths, but also the other ones
once they enter certain regions.

In the condition category I was unable
to find something that makes just ONE player's
units follow them.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
It will run like every unit per wave multiplied by number of waves multiplied by the number of waves per path plus the number of units that arent the creeps that walk into those regions...
But it does not leak, has a reasonable execution time and a few thousand times per game is nothing.

I think you are trying to pre-maturely optimize (or worry about optimization). It is a trap practically everyone has fallen into at some stage in their youth.

For smaller groups a group contents test is approximately O(1) complexity. It also scales fairly well with larger groups. Hashtables will be faster for larger groups but they are more complex to use as you need to be careful not to leak mappings. Groups can always be periodically purged to clean them of removed units.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
Because it uses ForGroup iteration.
It surely is the native blow?
JASS:
constant native IsUnitInGroup takes unit whichUnit,group whichGroup returns boolean
It creates a new thread and run that to check and it does not stop when it has found the unit, instead it will continue to look for all other units in the group as well.
It is run in a single thread as a single function call to native functionality? At least that is what I thought.
 
Status
Not open for further replies.
Top