• 🏆 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] Unknown Trigger Problem

Status
Not open for further replies.
Level 15
Joined
Oct 18, 2008
Messages
1,588
Hey! I use this trigger to move the zombies on my map, but they doesn't react Oo
  • Zombie Move
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching (((Matching player) controller) Equal to User))
      • Unit Group - Pick every unit in (Units owned by Player 11 (Dark Green)) and do (Actions)
        • Loop - Actions
          • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Less than or equal to 1
              • Or - Any (Conditions) are true
                • Conditions
                  • (Current order of (Picked unit)) Equal to (Order(stop))
                  • (Current order of (Picked unit)) Equal to (Order(<Empty String>))
            • Then - Actions
              • Set TempPos = (Position of (Random unit from TempGroup))
              • Unit - Order (Picked unit) to Attack-Move To TempPos
            • Else - Actions
      • Custom script: call DestroyGroup( udg_TempGroup )
 
Level 12
Joined
Aug 22, 2008
Messages
911
Maker is right, you need 2 variables:
  • Set tempgroup = (Units in Playable Map Area matching (Owner of (Matching Unit) is a human player) equal to True
  • Set tempgroup2 = Units owned by Player 11
Make sure you use those variables wherever you're supposed to, and you'd better clear the point leak (the target point of the order issued to the units).
And what's with the custom value thing? Custom values start from 0 anyway so all zombies with unmodified custom values are going to be ordered to attack!
 
Level 15
Joined
Oct 18, 2008
Messages
1,588
GOD... I fell dumb Oo At all I got my trigger right now (custom value was made because a player suggested to use them to avoid zombies wandering pointlessly between 2 player, it should incrase to 10 when a zombie attacks, but nevermind, it works fine without it :)

At all I'll need some1 for my project, I'm a bit noob at making everything leakless (and a bit lazy) so I want to ask some1 to check every trigger :D I try to avoid the most leaks, but you see, I'm not very used to Jass or vJass, so I only use GUI (and I try to make it MUI if I can) but sometimes I miss some functions (and a quick question: specific unit event why can't use unit variables? XD)
 
It's because Blizzard is so damn sexy :p
Well, you need to use this instead:
  • Trigger - Add to Trigger 2 <gen> the event (Unit - Unit1 dies)
Unit1 is your unit variable and Trigger 2 is the trigger you want the actions for that Unit1 performed.
Tell me though, why would you need a specific unit event, when you have a variable?
You could just do this:
  • (Triggering unit) Equal to (Unit1)
which is a Unit Comparison.
 
  • Trigger1
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable Map Area)) and do (Actions)
      • Loop - Actions
        • Trigger - Add to Trigger 3 <gen> the event (Unit - (Picked unit) takes damage)
  • Trigger2
  • Events
    • Unit - A unit enters (Playable Map Area)
  • Conditions
  • Actions
    • Trigger - Add to Trigger3 <gen> the event (Unit - (Triggering unit) takes damage)
  • Trigger3
  • Events
  • Conditions
    • (Triggering unit) Equal to Unit1
  • Actions
    • //Actions here
 
Status
Not open for further replies.
Top