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

[Trigger] Trigger error X_X

Status
Not open for further replies.
Level 4
Joined
Feb 6, 2012
Messages
43
hello :wink:
i got problem with my trigger im already set If "Kobold King" death teleport to Item Place, the problem Why my hero teleport to Town :vw_wtf:
this the trigger
  • Kobold Teleport
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Kobold KING
    • Actions
      • Trigger - Turn on Kobold Drops <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Unit Group - Pick every unit in (Units in Kobold Item <gen>) and do (Actions)
            • Loop - Actions
              • Player - Add 150 to (Owner of (Picked unit)) Current gold
              • Player - Add 1 to (Owner of (Picked unit)) Current lumber
              • Special Effect - Destroy (Last created special effect)
              • Camera - Pan camera for Player 1 (Red) to (Center of Red item <gen>) over 5.00 seconds
              • Camera - Pan camera for Player 2 (Blue) to (Center of Blue item <gen>) over 5.00 seconds
              • Camera - Pan camera for Player 3 (Teal) to (Center of Teal item <gen>) over 5.00 seconds
              • Camera - Pan camera for Player 4 (Purple) to (Center of Purple Item <gen>) over 5.00 seconds
              • Camera - Pan camera for Player 5 (Yellow) to (Center of Yellow Item <gen>) over 5.00 seconds
              • Camera - Pan camera for Player 6 (Orange) to (Center of Orange Item <gen>) over 5.00 seconds
              • Camera - Pan camera for Player 7 (Green) to (Center of Green item <gen>) over 5.00 seconds
              • Camera - Pan camera for Player 8 (Pink) to (Center of Pink Item <gen>) over 5.00 seconds
              • Camera - Pan camera for Player 9 (Gray) to (Center of Gray Item <gen>) over 5.00 seconds
              • Game - Display to (Player group((Owner of (Picked unit)))) for 10.00 seconds the text: -leave for exit
              • If ((Owner of (Picked unit)) Equal to Player 1 (Red)) then do (Unit - Move (Picked unit) instantly to (Center of Red item <gen>)) else do (Do nothing)
              • If ((Owner of (Picked unit)) Equal to Player 2 (Blue)) then do (Unit - Move (Picked unit) instantly to (Center of Blue item <gen>)) else do (Do nothing)
              • If ((Owner of (Picked unit)) Equal to Player 3 (Teal)) then do (Unit - Move (Picked unit) instantly to (Center of Teal item <gen>)) else do (Do nothing)
              • If ((Owner of (Picked unit)) Equal to Player 4 (Purple)) then do (Unit - Move (Picked unit) instantly to (Center of Purple Item <gen>)) else do (Do nothing)
              • If ((Owner of (Picked unit)) Equal to Player 5 (Yellow)) then do (Unit - Move (Picked unit) instantly to (Center of Yellow Item <gen>)) else do (Do nothing)
              • If ((Owner of (Picked unit)) Equal to Player 6 (Orange)) then do (Unit - Move (Picked unit) instantly to (Center of Orange Item <gen>)) else do (Do nothing)
              • If ((Owner of (Picked unit)) Equal to Player 7 (Green)) then do (Unit - Move (Picked unit) instantly to (Center of Green item <gen>)) else do (Do nothing)
              • If ((Owner of (Picked unit)) Equal to Player 8 (Pink)) then do (Unit - Move (Picked unit) instantly to (Center of Pink Item <gen>)) else do (Do nothing)
              • If ((Owner of (Picked unit)) Equal to Player 9 (Gray)) then do (Unit - Move (Picked unit) instantly to (Center of Gray Item <gen>)) else do (Do nothing)
        • Else - Actions
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Your trigger leaks Unit Group, Points, and it's deeply unneficient. You can set Region[1, 2, 3, 4, etc.] = Center of Red, Blue, Teal, Purple, etc.

You don't need an "If/Then/Else for each player, just
Set u = Picked Unit
Set p = Owner of u
set i = Player number of p
-> Move p to Region

Same thing with "Pan Camera"

Create a point variable and Set Point = Center of Region then at the end of the trigger use "Custom script: Call RemoveLocation(udg_Point[udg_i])" to remove the Point leak, which will make the game prone to lag in some point.

Why do you destroy an special effect that isn't created)

Use "Custom Script: set bj_wantDestroyGroup = true" before the "Pick every unit in (Units in Kobold Item <gen>).

The only reason for your units to be moved to Town is that the Center of the Region is the town. It shouldn't move the hero somewhere else.
 
Level 4
Joined
Feb 6, 2012
Messages
43
Your trigger leaks Unit Group, Points, and it's deeply unneficient. You can set Region[1, 2, 3, 4, etc.] = Center of Red, Blue, Teal, Purple, etc.

You don't need an "If/Then/Else for each player, just
Set u = Picked Unit
Set p = Owner of u
set i = Player number of p
-> Move p to Region

Same thing with "Pan Camera"

Create a point variable and Set Point = Center of Region then at the end of the trigger use "Custom script: Call RemoveLocation(udg_Point[udg_i])" to remove the Point leak, which will make the game prone to lag in some point.

Why do you destroy an special effect that isn't created)

Use "Custom Script: set bj_wantDestroyGroup = true" before the "Pick every unit in (Units in Kobold Item <gen>).

The only reason for your units to be moved to Town is that the Center of the Region is the town. It shouldn't move the hero somewhere else.


im copy from other Maps, I will try tomorrow
 
Status
Not open for further replies.
Top