• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Set Rally Point + Patrol

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
You see, I want to do some patrolling over 4 places
Its path is shaped like box:
_ _ _ _
| |
| |
|_ _ _ |

That's the shape of my movement
Now, at every corner/edge of the box, I want to order my unit to patrol by using Triggers
I've noticed if you press Shift + Patrol Action + Click on ground, it can patrol to many places at once, at an infinite time
So, what trigger should I put in order to do exactly as "Shift + Patrol + Click Ground = Infinite Patrol to many places at once" ?
NOTE: PLEASE QUOTE MY STATEMENT TO SEE THE BOX IN CORRECT SHAPE !!!
 
Sadly, I don't think it is possible to activate the multi-point-patrol thing via triggers. However, it is certainly possible to do your square thing.

Just run a timer. Issue the point, and then wait until the unit gets to that point. Then, start the timer again, and issue to the next point. I don't think there is another way around it. :(
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
I remember getting orders to que if you issue an order in a trigger responding to an order. As the trigger runs before the order is issued but after the command to issue an order has been issued, the unit gets placed into an order quing state and thus will que up all orders issued immediatly at that time.

I encountered this 4 years ago (LONG ago) thus what I am describing may not or nolonger be the case.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I slapped something together. I spesifically didn't want to use regions.

Select a unit the hit ESC to make it patrol.

The patrol pattern is square, but it's easy to modify it to be a rectangle.

http://www.hiveworkshop.com/forums/pastebin.php?id=k3lcn2


  • Untitled Trigger 004
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set hash = (Last created hashtable)
      • // Angle towards which the unit first starts to move in radians.
      • Set ANGLE = -0.83
      • // Width of the boxes sides. The bow will be square.
      • Set OFFSET = 500.00
      • // Sqrt(this) is how close to the point a units must be before
      • // it can be considered as reached the patrol point
      • Set TOLERANCE = 6400.00
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Custom script: set udg_ID = GetHandleId(udg_u1)
      • Custom script: set udg_r1 = GetUnitX(udg_u1)
      • Custom script: set udg_r2 = GetUnitY(udg_u1)
      • -------- Point 1 --------
      • Custom script: call SaveReal( udg_hash , udg_ID , 10 , udg_r1 )
      • Custom script: call SaveReal( udg_hash , udg_ID , 11 , udg_r2 )
      • -------- Point 2 --------
      • Custom script: call SaveReal( udg_hash , udg_ID , 20 , udg_r1 + udg_OFFSET * Cos(udg_ANGLE) )
      • Custom script: call SaveReal( udg_hash , udg_ID , 21 , udg_r2 + udg_OFFSET * Sin(udg_ANGLE) )
      • -------- Point 3 --------
      • Custom script: call SaveReal( udg_hash , udg_ID , 30 , udg_r1 + SquareRoot( udg_OFFSET * udg_OFFSET + udg_OFFSET * udg_OFFSET ) * Cos(udg_ANGLE + bj_PI / 4 ) )
      • Custom script: call SaveReal( udg_hash , udg_ID , 31 , udg_r2 + SquareRoot( udg_OFFSET * udg_OFFSET + udg_OFFSET * udg_OFFSET ) * Sin(udg_ANGLE + bj_PI / 4 ) )
      • -------- Point 4 --------
      • Custom script: call SaveReal( udg_hash , udg_ID , 40 , udg_r1 + udg_OFFSET * Cos(udg_ANGLE + bj_PI / 2) )
      • Custom script: call SaveReal( udg_hash , udg_ID , 41 , udg_r2 + udg_OFFSET * Sin(udg_ANGLE + bj_PI / 2) )
      • -------- ----------------------------------------- --------
      • Custom script: call SaveInteger( udg_hash , udg_ID , StringHash("index") , 2 )
      • -------- ----------------------------------------- --------
      • Custom script: call IssuePointOrder( udg_u1 , "attack" , LoadReal( udg_hash , udg_ID , 20 ) , LoadReal( udg_hash , udg_ID , 21 ) )
      • -------- ----------------------------------------- --------
      • Unit Group - Add u1 to PatrolGroup
      • Trigger - Turn on Untitled Trigger 005 <gen>
  • Untitled Trigger 005
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in PatrolGroup and do (Actions)
        • Loop - Actions
          • Set Picked = (Picked unit)
          • Custom script: set udg_ID = GetHandleId(udg_Picked)
          • Custom script: set udg_r1 = GetUnitX(udg_Picked)
          • Custom script: set udg_r2 = GetUnitY(udg_Picked)
          • Custom script: set udg_i1 = LoadInteger( udg_hash , udg_ID , StringHash("index") )
          • Custom script: set udg_r3 = LoadReal( udg_hash , udg_ID ,S2I( I2S(udg_i1)+ "0") )
          • Custom script: set udg_r4 = LoadReal( udg_hash , udg_ID ,S2I( I2S(udg_i1)+ "1") )
          • Custom script: if (udg_r3 - udg_r1) * (udg_r3 - udg_r1) + (udg_r4 - udg_r2) * (udg_r4 - udg_r2 ) < udg_TOLERANCE then
          • Custom script: if udg_i1 < 4 then
          • Custom script: set udg_i1 = udg_i1 + 1
          • Custom script: else
          • Custom script: set udg_i1 = 1
          • Custom script: endif
          • Custom script: call IssuePointOrder( udg_u1 , "attack" , LoadReal( udg_hash , udg_ID , S2I( I2S(udg_i1)+ "0") ) , LoadReal( udg_hash , udg_ID , S2I( I2S(udg_i1)+ "1") ) )
          • Custom script: call SaveInteger( udg_hash , udg_ID , StringHash("index") , udg_i1 )
          • Custom script: endif
 
Status
Not open for further replies.
Top