• 🏆 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!

[Trigger] Stupid guard doesn't patrol.

Status
Not open for further replies.
Level 19
Joined
Oct 29, 2007
Messages
1,184
Okay here are the two first triggers. (they work prefectly.)

  • Guard 01 Wander
    • Events
      • Unit - A unit enters Guard 01 Wander Path 01 <gen>
      • Unit - A unit enters Guard 01 Wander Path 02 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Guard 01 Wander Path 01 <gen> contains Guard[1]) Equal to True
          • (Triggering unit) Equal to Guard[1]
        • Then - Actions
          • Wait 2.00 seconds
          • Set TempPoints[1] = (Center of Guard 01 Wander Path 02 <gen>)
          • Unit - Order Guard[1] to Move To TempPoints[1]
          • Custom script: call RemoveLocation(udg_TempPoints[1])
        • Else - Actions
          • Wait 2.00 seconds
          • Set TempPoints[1] = (Center of Guard 01 Wander Path 01 <gen>)
          • Unit - Order Guard[1] to Move To TempPoints[1]
          • Custom script: call RemoveLocation(udg_TempPoints[1])
And the second...

  • Guard 02 Wander
    • Events
      • Unit - A unit enters Guard 02 Wander Path 01 <gen>
      • Unit - A unit enters Guard 02 Wander Path 02 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Guard 02 Wander Path 01 <gen> contains Guard[2]) Equal to True
          • (Triggering unit) Equal to Guard[2]
        • Then - Actions
          • Wait 2.00 seconds
          • Set TempPoints[1] = (Center of Guard 02 Wander Path 02 <gen>)
          • Unit - Order Guard[2] to Move To TempPoints[1]
          • Custom script: call RemoveLocation(udg_TempPoints[1])
        • Else - Actions
          • Wait 2.00 seconds
          • Set TempPoints[1] = (Center of Guard 02 Wander Path 01 <gen>)
          • Unit - Order Guard[2] to Move To TempPoints[1]
          • Custom script: call RemoveLocation(udg_TempPoints[1])
Okay. These two triggers makes two of the guards in my map patrol. So I thought I was gonna make one for the third guard. The trigger looks like this:

  • Guard 03 Wander
    • Events
      • Unit - A unit enters Guard 03 Wander Path 01 <gen>
      • Unit - A unit enters Guard 03 Wander Path 02 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Guard 03 Wander Path 01 <gen> contains Guard[3]) Equal to True
          • (Triggering unit) Equal to Guard[3]
        • Then - Actions
          • Wait 2.00 seconds
          • Set TempPoints[1] = (Center of Guard 03 Wander Path 02 <gen>)
          • Unit - Order Guard[3] to Move To TempPoints[1]
          • Custom script: call RemoveLocation(udg_TempPoints[1])
        • Else - Actions
          • Wait 2.00 seconds
          • Set TempPoints[1] = (Center of Guard 03 Wander Path 01 <gen>)
          • Unit - Order Guard[3] to Move To TempPoints[1]
          • Custom script: call RemoveLocation(udg_TempPoints[1])
The third one doesn't work. The guard moves from point A to B, but when he comes back to A he just stayes there like isn't supposed to go back to B. What am I doing wrong, and how do I fix it? : |
 
Level 12
Joined
Mar 16, 2006
Messages
992
You do realize you can make separate triggers and actually USE the conditions part of the trigger, right?
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Why not use:
  • Set TempPoint = Center of Gaurd1
  • Set TempPoint2 = Center of Gaurd2
  • Unit - Move gaurd[1] instantly to TempPoint
  • Unit - Order Gaurd[1] to Patrol to TempPoint2
  • Custom script: call RemoveLocation(udg_TempPoint)
  • Custom script: call RemoveLocation(udg_TempPoint2)
Or am i being weird now? o_O
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
Why not use:
  • Set TempPoint = Center of Gaurd1
  • Set TempPoint2 = Center of Gaurd2
  • Unit - Move gaurd[1] instantly to TempPoint
  • Unit - Order Gaurd[1] to Patrol to TempPoint2
  • Custom script: call RemoveLocation(udg_TempPoint)
  • Custom script: call RemoveLocation(udg_TempPoint2)
Or am i being weird now? o_O

No, that would work totally fine. But I want the wait 2 seconds to be in the trigger, cause that will make the movement of the guard look far more realistic.

Anyway, I find it very strange that the trigger doesn't work as it is, and I want to figure out how to solve it. : )
 
Level 12
Joined
Mar 16, 2006
Messages
992
I don't get what you are reffering to. Please explain it better.

joinbottom.gif
if.gif
(Triggering unit) Equal to Guard


Should be in the conditions of the trigger, so that it doesn't run the trigger for every unit that walks into the region. Not to mention, the triggers have a lot of room for improvement. Instead of checking if the unit is in the region, I'm pretty sure you can get which region the unit is entering, which would function better.

And I would double check to make sure you're assigning the patrolling unit to the Guard[3] unit variable.
 
Level 2
Joined
Feb 22, 2009
Messages
24
The problem has another nature...he made nothing wrong... i just recognized that problem today: When you react to an unit enters event, and the unit comes from the north side the trigger fires, but the unit is not inside the region yet!

  • Actions
    • --- Insert me and try again ---
    • Wait 0.20 seconds
    • --- Insert Me and try again ---
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Guard 03 Wander Path 01 <gen> contains Guard[3]) Equal to True
a small wait b4 the "containing Condition is a workaround".
A solution is to look if the ( Y-Value of the guard +64 ) is in...but as it is a unique situation i didnt recommend that...you have to watch it everytime you copy the function :ugly:

Why not use:
Set TempPoint = Center of Gaurd1
Set TempPoint2 = Center of Gaurd2
Unit - Move gaurd[1] instantly to TempPoint
Unit - Order Gaurd[1] to Patrol to TempPoint2
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: call RemoveLocation(udg_TempPoint2)
Or am i being weird now? o_O

-> You can insert an " Unit - Pause " on the waypoints...that freezes the units movement, but dont cancel the units orders! But: Patrol = Attack every hostile unit in range, Move = Run without react to hostile units.

I'm pretty sure you can get which region the unit is entering, which would function better.
I found nothing like that...if you can find...please share your wisdom :)
- GetTriggeringRegion() isnt working, as it reacts to an EVENT_GAME_ENTER_REGION event
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
joinbottom.gif
if.gif
(Triggering unit) Equal to Guard


Should be in the conditions of the trigger, so that it doesn't run the trigger for every unit that walks into the region. Not to mention, the triggers have a lot of room for improvement. Instead of checking if the unit is in the region, I'm pretty sure you can get which region the unit is entering, which would function better.

And I would double check to make sure you're assigning the patrolling unit to the Guard[3] unit variable.

I figured that out to, but thanks for mentioning it. ; ) I am just so frusrtated about the fact that the trigger won't work and I'm unable to tell what's wrong. : S

The problem has another nature...he made nothing wrong... i just recognized that problem today: When you react to an unit enters event, and the unit comes from the north side the trigger fires, but the unit is not inside the region yet!

  • Actions
    • --- Insert me and try again ---
    • Wait 0.20 seconds
    • --- Insert Me and try again ---
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Guard 03 Wander Path 01 <gen> contains Guard[3]) Equal to True
a small wait b4 the "containing Condition is a workaround".
A solution is to look if the ( Y-Value of the guard +64 ) is in...but as it is a unique situation i didnt recommend that...you have to watch it everytime you copy the function :ugly:

That was it, Thanks for helping me out. ^^ But.. How the hell did you figure it out?
 
Level 2
Joined
Feb 22, 2009
Messages
24
I had the same problem with my system im working on. Hmm... i have, as that wait isnt a good solution for me, cause i want the units to move further as fast a possible ;)
 

Attachments

  • runningtest.w3x
    22.2 KB · Views: 35
Level 19
Joined
Oct 29, 2007
Messages
1,184
I had the same problem with my system im working on. Hmm... i have, as that wait isnt a good solution for me, cause i want the units to move further as fast a possible ;)

Erm.. Can't you have like two regions for the bugging points, one slightly bigger that the other. And say some like:

Event: unit enteres small region

Condition: unit is in slightly bigger region equal to true

: O

Btw, really cool you made that running test. ^^
 
Level 11
Joined
May 31, 2008
Messages
698
Why not just order the guard to patrol to the point? That way it will automatically move back and forth. Also if an enemy unit comes near it the guard will attack instead of just continuing to move. Btw you only have to order it to patrol 1 time. If it doesnt start out at center of region just move it instantly to the center of one region and order it to patrol to the center of the other region. This should work fine.
 
Status
Not open for further replies.
Top