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

[Trigger] Why are these triggers not working..

Status
Not open for further replies.
Level 2
Joined
May 11, 2009
Messages
11
  • Events
  • Unit - A unit enters MiddleLocation <gen>
  • Conditions
  • (Unit - type of (Entering unit)) Equal to Footman
  • (Owner of (Entering unit)) Equal to Player 1 (Red)
  • Actions
  • Unit - Order (Triggering unit) to Attack-Move To (RightLocation <gen>)
This trigger selects footmen and sends them to the right

  • Events
  • Unit - A unit enters MiddleLocation <gen>
  • Conditions
  • (Unit-type of (Entering unit)) Equal to Grunt
  • (Owner of (Entering unit)) Equal to Player 1 (Red)
  • Actions
  • Unit - Order (Triggering unit) to Attack-Move To (LeftLocation <gen>)
This trigger selects grunts and sends them to the left.

Why are the units only listening to what ever trigger is written first....Both Grunts and Footmen goto the rightlocation when the grunts should be going to the Left location.
Am i doing it wrong? If so how should i trigger it?
 
Last edited:
Level 4
Joined
Feb 25, 2008
Messages
58
The reason it isn't working is because in your GUI code you have multiple conditions in the "Conditions" portion. This means that only one of these must be met in order to carry out the actions. Since both include "Unit belongs to Player 1 (Red)" ALL units belonging to Red will follow the actions of the footmen trigger. You can fix this by using the "And, Multiple Conditions" which is found at the very bottom of the types of conditions selection. However, I wrote you a single trigger that accounts for both the grunts and the footmen, so it's all in one trigger and reduces memory usage.

  • Trigger
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Footman
        • Then - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Center of Region 001 <gen>)
        • Else - Actions
          • If ((Unit-type of (Triggering unit)) Equal to Grunt) then do (Unit - Order (Triggering unit) to Attack-Move To (Center of Region 002 <gen>)) else do (Do nothing)
 
Level 15
Joined
Mar 31, 2009
Messages
1,397
It still leaks....

Also USE ENTERING UNIT, IT MAKES IT GO FASTER

  • Trigger
  • Events
  • Unit - A unit enters Region 000 <gen>
  • Conditions
  • (Owner of (Entering unit)) Equal to Player 1 (Red)
  • Actions
  • Set Left=Center of Region 001 <gen>
  • Set Right=(Center of Region 002 <gen>)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Unit-type of (Entering unit)) Equal to Footman
  • Then - Actions
  • Unit - Order (Entering unit) to Attack-Move To (Left)
  • Else - Actions
  • If ((Unit-type of (Entering unit)) Equal to Grunt) then do (Unit - Order (Entering) to Attack-Move To (Right)) else do (Do nothing)
  • Custom Script: call DestroyRect(udg_Left)
  • Custom Script: call DestroyRect(udg_Right)
btw, might have errors with custom script, doing this without opening WE
 
Level 4
Joined
Feb 25, 2008
Messages
58
Hmm.. I've always heard that triggering unit is more efficient in most cases... well, regions might be an exception but until I hear so I'm going with triggering unit. As far as I know, triggering unit and entering unit are both BJs so it doesn't matter either way...
 
Level 2
Joined
May 11, 2009
Messages
11
Im currently working out your solutions, thank you very much for your responses :D
BTW The original trigger is actually Entering not triggered unit, my mistake :(

However I have 1 question.
I'm making this like Dota, another team will spawn on this location if they control the tower in the region, so if i make another trigger for PLAYER 7(not 1) will the trigger leak or conflict with the player 1 trigger for moving the units?
 
Status
Not open for further replies.
Top