Trigger breaking? If so, how and why?

Squishinator

New Member
Reaction score
3
I have this whole system where if u kill a specific unit you get an ability, and if you cast that ability, it will turn the timer on, change the value of an integer -1, and give you another ability. once that timer expires, it will remove that last given ability, and... this is so hard to explain... if you have ever played that weird Golden Sun game as a kid, it's supposed to be almost exactly like the djinn trading system... Probably havent played it. Here is my whole system of triggers:


---------1------------

Trigger:
  • Give Beast1
    • Events
      • Unit - A unit Dies
    • Conditions
      • |cffff7000Fire Beast|n (Level 1) Equal to (Unit-type of (Dying unit))
    • Actions
      • Set Integer_BEAST_FIREred = (Integer_BEAST_FIREred + 1)
      • Set Unit_fireBEAST1 = (Killing unit)
      • Special Effect - Create a special effect at (Position of (Killing unit)) using Abilities\Spells\Other\Doom\DoomDeath.mdl
      • Unit - Add Spark (SPELLBOOK) to (Killing unit)
      • Hero - Modify Strength of (Killing unit): Add 5
      • Hero - Modify Intelligence of (Killing unit): Add 1
      • -------- EARTH ADEPT --- ability --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Killing unit)) Equal to Earth Adept
        • Then - Actions
          • Unit - Add Growth(SPELLBOOK) to (Killing unit)
          • Set Ability_FIREBEAST_red[1] = Growth(SPELLBOOK)
        • Else - Actions
          • -------- WATER ADEPT --- ability --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Killing unit)) Equal to Water Adept
            • Then - Actions
              • Unit - Add Tide (SPELLBOOK) to (Killing unit)
              • Set Ability_FIREBEAST_red[1] = Tide (SPELLBOOK)
            • Else - Actions



Trigger:
  • Use Beast1
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Spark (BEAST)
    • Actions
      • Countdown Timer - Start Timer_FIREBEAST___RED[1] as a One-shot timer that will expire in 30.00 seconds
      • Set Integer_BEAST_FIREred = (Integer_BEAST_FIREred - 1)
      • Set Integer_FIRE_SUMMONred = (Integer_FIRE_SUMMONred + 1)
      • Hero - Modify Strength of Unit_fireBEAST1: Subtract 5
      • Hero - Modify Intelligence of Unit_fireBEAST1: Subtract 1
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_BEAST_FIREred Equal to 0
        • Then - Actions
          • Unit - Remove Ability_FIREBEAST_red[1] from Hero_RED
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 0
        • Then - Actions
          • Unit - Remove Mars (SPELLBOOK) from Hero_RED
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 1
        • Then - Actions
          • Unit - Remove Mars (SPELLBOOK) from Hero_RED
        • Else - Actions



Trigger:
  • FIREBeast1 returns
    • Events
      • Time - Timer_FIREBEAST___RED[1] expires
    • Conditions
    • Actions
      • Hero - Modify Strength of Unit_fireBEAST1: Add 5
      • Hero - Modify Intelligence of Unit_fireBEAST1: Add 1
      • Set Integer_BEAST_FIREred = (Integer_BEAST_FIREred + 1)
      • Set Integer_FIRE_SUMMONred = (Integer_FIRE_SUMMONred - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_BEAST_FIREred Greater than or equal to 1
        • Then - Actions
          • Unit - Add Ability_FIREBEAST_red[1] to Hero_RED
        • Else - Actions
      • -------- --------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 0
        • Then - Actions
          • Unit - Remove Mars (SPELLBOOK) from Hero_RED
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integer_FIRE_SUMMONred Equal to 1
            • Then - Actions
              • Unit - Remove Nova (SPELLBOOK) from Hero_RED
            • Else - Actions



Trigger:
  • FIRE1 SUMMON BEAST1 RED
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Spark (BEAST)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_BEAST_FIREred Equal to 0
        • Then - Actions
          • Unit - Remove Ability_FIREBEAST_red[1] from (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 1
        • Then - Actions
          • Unit - Add Mars (SPELLBOOK) to (Triggering unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integer_FIRE_SUMMONred Equal to 2
            • Then - Actions
              • Unit - Add Nova (SPELLBOOK) to (Triggering unit)
            • Else - Actions


----------2-----------
Trigger:
  • Give Beast2
    • Events
      • Unit - A unit Dies
    • Conditions
      • |cffff7000Fire Beast|n (Level 2) Equal to (Unit-type of (Dying unit))
    • Actions
      • Set Integer_BEAST_FIREred = (Integer_BEAST_FIREred + 1)
      • Set Unit_fireBEAST2 = (Killing unit)
      • Special Effect - Create a special effect at (Position of (Killing unit)) using Abilities\Spells\Other\Doom\DoomDeath.mdl
      • Unit - Add Cannon (SPELLBOOK) to (Killing unit)
      • Hero - Modify Strength of (Killing unit): Add 8
      • Hero - Modify Intelligence of (Killing unit): Add 2
      • -------- EARTH ADEPT --- ability --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Killing unit)) Equal to Earth Adept
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integer_BEAST_EARTHred Equal to 0
              • Integer_BEAST_WATERred Equal to 0
              • Integer_BEAST_WINDred Equal to 0
            • Then - Actions
              • Unit - Add Growth(SPELLBOOK) to (Killing unit)
              • Set Ability_FIREBEAST_red[1] = Growth(SPELLBOOK)
            • Else - Actions
        • Else - Actions
          • -------- WATER ADEPT --- ability --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Killing unit)) Equal to Water Adept
            • Then - Actions
              • Unit - Add Tide (SPELLBOOK) to (Killing unit)
              • Set Ability_FIREBEAST_red[1] = Tide (SPELLBOOK)
            • Else - Actions

Trigger:
  • Use Beast2
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Cannon (BEAST)
    • Actions
      • Countdown Timer - Start Timer_FIREBEAST___RED[2] as a One-shot timer that will expire in 30.00 seconds
      • Set Integer_BEAST_FIREred = (Integer_BEAST_FIREred - 1)
      • Set Integer_FIRE_SUMMONred = (Integer_FIRE_SUMMONred + 1)
      • Hero - Modify Strength of Unit_fireBEAST2: Subtract 8
      • Hero - Modify Intelligence of Unit_fireBEAST2: Subtract 2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_BEAST_FIREred Equal to 0
        • Then - Actions
          • Unit - Remove Ability_FIREBEAST_red[1] from Hero_RED
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 0
        • Then - Actions
          • Unit - Remove Mars (SPELLBOOK) from Hero_RED
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 1
        • Then - Actions
          • Unit - Remove Mars (SPELLBOOK) from Hero_RED
        • Else - Actions

Trigger:
  • FIREBeast2 returns
    • Events
      • Time - Timer_FIREBEAST___RED[2] expires
    • Conditions
    • Actions
      • Hero - Modify Strength of Unit_fireBEAST1: Add 8
      • Hero - Modify Intelligence of Unit_fireBEAST1: Add 2
      • Set Integer_BEAST_FIREred = (Integer_BEAST_FIREred + 1)
      • Set Integer_FIRE_SUMMONred = (Integer_FIRE_SUMMONred - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_BEAST_FIREred Greater than or equal to 1
        • Then - Actions
          • Unit - Add Ability_FIREBEAST_red[1] to Hero_RED
        • Else - Actions
      • -------- --------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 0
        • Then - Actions
          • Unit - Remove Mars (SPELLBOOK) from Hero_RED
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integer_FIRE_SUMMONred Equal to 1
            • Then - Actions
              • Unit - Remove Nova (SPELLBOOK) from Hero_RED
            • Else - Actions

Trigger:
  • FIRE1 SUMMON BEAST2 RED
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Cannon (BEAST)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_BEAST_FIREred Equal to 0
        • Then - Actions
          • Unit - Remove Ability_FIREBEAST_red[1] from (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 1
        • Then - Actions
          • Unit - Add Mars (SPELLBOOK) to (Triggering unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integer_FIRE_SUMMONred Equal to 2
            • Then - Actions
              • Unit - Add Nova (SPELLBOOK) to (Triggering unit)
            • Else - Actions



If you took the time to read all of that you should notice that the triggers are a copy of each other, just some specific values have been changed.
 

Squishinator

New Member
Reaction score
3
Trigger condition not working properly

What I am trying to do is when i cast a specific spell, it will add to a specific integer and start a timer and give another ability depending on another integers number, so no matter what, if you cast both initial abilities, you will get two different new spells. There are two triggers for it. Now this should be working because by the time the second started timer finishes (by whatever timer that is). Because when the first timer expires, it will change the integer to one. Then once the second timer expires it should remove both abilities, even though by then only one of them is left. Only one ability is removed when i do this. OK, here are my two triggers that aren't working properly:
Trigger:
  • FIREBeast1 returns
    • Events
      • Time - Timer_FIREBEAST___RED[1] expires
    • Conditions
    • Actions
      • Hero - Modify Strength of Unit_fireBEAST1: Add 5
      • Hero - Modify Intelligence of Unit_fireBEAST1: Add 1
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_BEAST_FIREred Greater than or equal to 1
        • Then - Actions
          • Unit - Add Ability_FIREBEAST_red[1] to Hero_RED
        • Else - Actions
      • -------- --------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Less than or equal to 1
        • Then - Actions
          • Unit - Remove Mars (SPELLBOOK) from Hero_RED
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Less than or equal to 2
        • Then - Actions
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
      • Set Integer_BEAST_FIREred = (Integer_BEAST_FIREred + 1)
      • Set Integer_FIRE_SUMMONred = (Integer_FIRE_SUMMONred - 1)


Trigger:
  • FIREBeast2 returns
    • Events
      • Time - Timer_FIREBEAST___RED[2] expires
    • Conditions
    • Actions
      • Hero - Modify Strength of Unit_fireBEAST1: Add 8
      • Hero - Modify Intelligence of Unit_fireBEAST1: Add 2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_BEAST_FIREred Greater than or equal to 1
        • Then - Actions
          • Unit - Add Ability_FIREBEAST_red[1] to Hero_RED
        • Else - Actions
      • -------- --------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Greater than or equal to 1
        • Then - Actions
          • Unit - Remove Mars (SPELLBOOK) from Hero_RED
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 2
        • Then - Actions
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
      • Set Integer_BEAST_FIREred = (Integer_BEAST_FIREred + 1)
      • Set Integer_FIRE_SUMMONred = (Integer_FIRE_SUMMONred - 1)
 

Zealot

Member
Reaction score
11
Abilities can't leak as far as I know, I think you mean trigger enchanced ability? If so you need custom scripts but it depends on the trigger.
 

Squishinator

New Member
Reaction score
3
here is my trigger. It doesnt work so i am assuming there is a leak.


Trigger:
  • FIREBeast2 returns
    • Events
      • Time - Timer_FIREBEAST___RED[2] expires
    • Conditions
    • Actions
      • Hero - Modify Strength of Unit_fireBEAST1: Add 8
      • Hero - Modify Intelligence of Unit_fireBEAST1: Add 2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_BEAST_FIREred Greater than or equal to 1
        • Then - Actions
          • Unit - Add Ability_FIREBEAST_red[1] to Hero_RED
        • Else - Actions
      • -------- --------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 1
        • Then - Actions
          • Unit - Remove Mars (SPELLBOOK) from Hero_RED
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 2
        • Then - Actions
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
      • Set Integer_BEAST_FIREred = (Integer_BEAST_FIREred + 1)
      • Set Integer_FIRE_SUMMONred = (Integer_FIRE_SUMMONred - 1)
 

XeNiM666

I lurk for pizza
Reaction score
138
i think this is what happens when the spell ends right? If yes then theres only 1(2) leaks i found. AT the bottom of the trigger: Do this:
Code:
    Custom Script:   set Unit_fireBEAST1 = null
 

Squishinator

New Member
Reaction score
3
countdown timer question

I HAVE POSTED THIS QUESTION ABOUT 7 TIMES AND NO ONE HAS BEEN ABLE TO ANSWER ME!!!!!!!!! PLEASE HELP!!


do countdown timers cause problems? I mean, if something gets altered while a timer is still going, will it not work properly? I have two timers, and two triggers. Each trigger is exactly the same except for the event, which in one, has "when timer1 expires" and the other "when timer2 expires". The first one works, but the other one doesnt work at all. Could things be messing the second timer up? I have integers being changed in both, so my specific question is: when the first timer expires and changes a variable, will it mess with the "if then else function" that is in the trigger? Here it is:

Trigger:
  • FIREBeast2 returns
    • Events
      • Time - Timer_FIREBEAST___RED[2] expires
    • Conditions
    • Actions
      • Hero - Modify Strength of Unit_fireBEAST1: Add 8
      • Hero - Modify Intelligence of Unit_fireBEAST1: Add 2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_BEAST_FIREred Greater than or equal to 1
        • Then - Actions
          • Unit - Add Ability_FIREBEAST_red[1] to Hero_RED
        • Else - Actions
      • -------- --------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 1
        • Then - Actions
          • Unit - Remove Mars (SPELLBOOK) from Hero_RED
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_FIRE_SUMMONred Equal to 2
        • Then - Actions
          • Unit - Remove Nova (SPELLBOOK) from Hero_RED
        • Else - Actions
      • Set Integer_BEAST_FIREred = (Integer_BEAST_FIREred + 1)
      • Set Integer_FIRE_SUMMONred = (Integer_FIRE_SUMMONred - 1)


Do you see the if then else functions? Could the mix of the timers and the integers being changed mess with it? Before any of the timers expired, the integer was 2. After timer one expires, the variable is then 1, so it should run the first "if then else function" below the line. What are all of the possible problems and solutions? Remember that this is basicly a copy of trigger1, the event is just different. Trigger1 works.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> It doesn't work so I am assuming there is a leak

That logic doesn't hold.
Besides, the trigger from #27 has no leaks.

And, setting globals to null is pointless.
 

Squishinator

New Member
Reaction score
3
plz reply! i have been posting threads galore trying to get this question answered for about a week now and no one has answered me.
 

Squishinator

New Member
Reaction score
3
simple way to substitute for multiple timers

I am trying to make a trigger where when a unit dies, it will start a timer, and once that timer finishes, another unit will be created in it's place. Is there a simpler way to do this with multiple units without having to make a countdown timer for each unit? Any shortcuts at all?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Does this need to be MPI and/or MUI?
If neither, you could use a wait.

You could try using a timer array to:
Code:
Countdown Timer - Start deathTimer[(Player number of (Owner of (Triggering unit)))] as a [...]
 

Grymlax

Probably not around
Reaction score
138
well you could always use a dummy unit as a countdown. when the first unit dies you create an invisible dummy unit which you give an expiration timer. and then when that unit dies you simply create the unit that you wanted to create in the first place.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Multi-Unit Instanceability and Multi-Player Instanceability.

MUI - Two or more units can cast the spell simultaneously and it will still work flawlessly.
MPI - Two or more players can cast the spell simultaneously and it will still work flawlessly.

Don't know why you asked about 'GUI' but that stands for Graphical User Interface ;) .
 

Squishinator

New Member
Reaction score
3
Trigger not working as an MUI...

I want these triggers to with multiple targets... i thought this should work but i guess not.

What i am trying to do is that when a unit dies, a destructable will be made in it's place and a timer will start. Once that timer ends, it will revive that unit in the same place it died and the destructible will be removed.... why isnt it working?

Here are my triggers:

Trigger:
  • Add Integers
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Skeletal Warrior
    • Actions
      • Set Integer_SkelletalWarrior = (Integer_SkelletalWarrior + 1)
      • Countdown Timer - Start Timer_Undead[Integer_SkelletalWarrior] as a One-shot timer that will expire in 10.00 seconds
      • Unit - Create 1 Pile of Bones for Player 12 (Brown) at (Position of (Dying unit)) facing Default building facing degrees
      • Set Unit_Bones[Integer_SkelletalWarrior] = (Last created unit)
      • Set Integer_Undead = (Integer_Undead + 1)



Trigger:
  • Timers Copy
    • Events
      • Time - Timer_Undead[2] expires
    • Conditions
    • Actions
      • Unit - Replace Unit_Bones[2] with a Skeletal Warrior using The new unit's max life and mana
      • Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Set Integer_SkelletalWarrior = (Integer_SkelletalWarrior - 1)
      • Set Integer_Undead = (Integer_Undead - 1)
 

Emu.Man00

New Member
Reaction score
41
Okay i see what you're doing.

Why are u looking for that specific Timer/Unit_Bones in the array? (Timer_Undead[2])
 

Strilanc

Veteran Scripter
Reaction score
42
You tried to make a queue but you made a stack instead. Suppose a player casts the spell twice, the events go like this:
set [1]
set [2]
clear [2]
clear [1]

When you clearly want:
set [1]
set [2]
clear [1]
clear [2]

The solution is to have two integer variables, one for before the wait, and one for after the wait:

Code:
start_spell:
  pre_int += 1
  if pre_int > 100 then pre_int = 0
  unit[pre_int] = created_unit
timer_expire:
  post_int += 1
  if post_int > 100 then post_int = 0
  clear unit[post_int]
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top