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

Stop units using Regions

Status
Not open for further replies.
Moved to WorldEditor HelpZone, as Triggers & Scripts if you already have existing code.

Is the region staticely, or may it be moved? Maybe creating pathing blockers at borders is a solid solution.

An alternative would periodically to keep track of units in the region, and once they're outside the region (boolean condition) we need to do approrpiate operations... maybe like moving unit a bit closer to center again and ordering "stop". Calcularing the exact border distance would work, too, but it probably not too nice in GUI.
 
Moved to WorldEditor HelpZone, as Triggers & Scripts if you already have existing code.

Is the region staticely, or may it be moved? Maybe creating pathing blockers at borders is a solid solution.

An alternative would periodically to keep track of units in the region, and once they're outside the region (boolean condition) we need to do approrpiate operations... maybe like moving unit a bit closer to center again and ordering "stop". Calcularing the exact border distance would work, too, but it probably not too nice in GUI.
I'm really sorry i didn't notice your reply.

If it is to stop all units from entering then one can algorithmically fill the pathing of the rect (GUI Region) cell by cell. If it is to stop only certain units it is not possible directly, but one can repel units away from the rect as soon as they enter using SetUnitX/Y on a 0.03 period timer.
I need the region to act like a pathing blocker that blocks both air and land unit from entering the region, i tried the "Order Unit to Stop Trigger", I'm really bad at triggers and I need help really badly.
 
Last edited by a moderator:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
For every cell in the rect you set the pathing to the desired pathing. One starts at a corner of the rect then iterates through every cell using a 2 level nested loop. Assuming a cell is 32*32 units then the inner loop will add 32 to the current x coordinate and reset it to the one edge of the rect at the loop end. The other loop will add 32 to the y coordinate. The loops end when reaching the opposite edge of the rect.

Since there are a lot of cells per unit area this can be prone to hitting the op limit for larger rects.
 
SharpCraft World Editor Extended Bundle , it might be worth to try it out. ; )
How to fix this?
full
 
Status
Not open for further replies.
Top