• 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 is not working

Status
Not open for further replies.
Level 4
Joined
Jul 22, 2012
Messages
72
  • Claim Stormwind
    • Events
      • Unit - Stormwind Keep 0739 <gen>'s life becomes Less than 500.00
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Replace Stormwind Keep 0739 <gen> with a (Unit-type of Stormwind Keep 0739 <gen>) using The old unit's relative life and mana
Also this one
  • capturables
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Kharazan
      • (Unit-type of (Triggering unit)) Equal to Shadowfang Keep
      • (Unit-type of (Triggering unit)) Equal to Westfall Lighthouse
      • (Unit-type of (Triggering unit)) Equal to World Tree
      • (Unit-type of (Triggering unit)) Equal to Control Point (5g/min)
      • (Unit-type of (Triggering unit)) Equal to Control Point (10g/min)
      • (Unit-type of (Triggering unit)) Equal to Control Point (15g/min)
      • (Unit-type of (Triggering unit)) Equal to Control Point (20g/min)
      • (Unit-type of (Triggering unit)) Equal to Control Point (25g/min)
      • (Unit-type of (Triggering unit)) Equal to Control Point (30g/min)
      • (Unit-type of (Triggering unit)) Equal to Control Point (40g/min)
      • (Unit-type of (Triggering unit)) Equal to Control Point (50g/min)
    • Actions
      • Unit - Replace (Triggering unit) with a (Unit-type of (Triggering unit)) using The new unit's default life and mana
      • Unit - Change ownership of (Last replaced unit) to (Owner of (Killing unit)) and Change color
Any help is appreciated.
 
Level 4
Joined
May 25, 2009
Messages
100
Maybe:
  • Unit - Replace (Triggering unit) with a (Unit-type of (Triggering unit)) using The new unit's default life and mana
You have "Triggering unit in there 2times. So the dying unit is replaced with its own unittype...I guess one of it should be Attacking Unit
 
Level 4
Joined
Jul 22, 2012
Messages
72
  • New Hearthglen
    • Events
      • Time - Elapsed game time is 60.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in New Hearthglen <gen>) and do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units in New Hearthglen <gen>) and do (Unit - Change ownership of (Picked unit) to Player 1 (Red) and Change color)
          • Unit - Make (Picked unit) Vulnerable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Risen Equal to Balzannar Unveils himself <gen>
            • Then - Actions
              • Unit - Replace Barean Westwind 3520 <gen> with a Mal'Ganis using The new unit's max life and mana
              • Hero - Set (Last replaced unit) Hero-level to 6, Hide level-up graphics
              • Custom script: call DestroyTrigger(GetTriggeringTrigger())
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Do nothing
Now this one makes multiple mal'ganis's when he is replaced.
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,993
  • (Unit-type of (Triggering unit)) Equal to Kharazan
  • (Unit-type of (Triggering unit)) Equal to Shadowfang Keep
  • (Unit-type of (Triggering unit)) Equal to Westfall Lighthouse
  • (Unit-type of (Triggering unit)) Equal to World Tree
  • (Unit-type of (Triggering unit)) Equal to Control Point (5g/min)
  • (Unit-type of (Triggering unit)) Equal to Control Point (10g/min)
  • (Unit-type of (Triggering unit)) Equal to Control Point (15g/min)
  • (Unit-type of (Triggering unit)) Equal to Control Point (20g/min)
  • (Unit-type of (Triggering unit)) Equal to Control Point (25g/min)
  • (Unit-type of (Triggering unit)) Equal to Control Point (30g/min)
  • (Unit-type of (Triggering unit)) Equal to Control Point (40g/min)
  • (Unit-type of (Triggering unit)) Equal to Control Point (50g/min)
Use or-any conditions here.
 
Now this one makes multiple mal'ganis's when he is replaced.

When you turn off and destroy the trigger, it doesn't necessarily end the actions right then and there. The trigger will no longer fire on the event, but the current actions will still keep going. :( I'm assuming that is your issue.

To fix this, you would make a boolean variable to keep track of whether Barean Westwind was replaced with Mal'ganis. Let's name this variable, "BareanReplaced". By default, you should make it equal to false.

This is what the trigger would look like:
  • New Hearthglen
    • Events
      • Time - Elapsed game time is 60.00 seconds
    • Conditions
    • Actions
      • Set BareanReplaced = False
      • Unit Group - Pick every unit in (Units in New Hearthglen <gen>) and do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units in New Hearthglen <gen>) and do (Unit - Change ownership of (Picked unit) to Player 1 (Red) and Change color)
          • Unit - Make (Picked unit) Vulnerable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - Multiple Conditions
                • Risen Equal to Balzannar Unveils himself <gen>
                • BareanReplaced Equal to False
            • Then - Actions
              • Unit - Replace Barean Westwind 3520 <gen> with a Mal'Ganis using The new unit's max life and mana
              • Hero - Set (Last replaced unit) Hero-level to 6, Hide level-up graphics
              • Custom script: call DestroyTrigger(GetTriggeringTrigger())
              • Trigger - Turn off (This trigger)
              • Set BareanReplaced = True
            • Else - Actions
              • Do nothing
That way, the "Then" actions won't be executed for the rest of the units iterated. Also, there are some things you could fix, see what deathismyfriend said.

See:
http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
Or:
http://www.thehelper.net/threads/triggers-memory-leaks-and-custom-scripts.20711/
 
get rid of the and condition and the do nothing action they are both useless.

this shouldnt be in there. ur setting these units vulnerable a ton of times. which is very inefficient.
  • Unit Group - Pick every unit in (Units in New Hearthglen <gen>) and do (Unit - Change ownership of (Picked unit) to Player 1 (Red) and Change color)
@nichilus
no that wont work. when u use a unit group it calls another function. skip remaining actions skips the action that are left in that function. if u put skip remaining actions there it would do nothing.
 
Status
Not open for further replies.
Top