• 🏆 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] Help with a trigger and with wait command

Status
Not open for further replies.
Level 6
Joined
Jul 17, 2008
Messages
185
Hi

this trigger doesnt work as it was suposed to:
  • Untitled Trigger 001 Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Plague
    • Actions
      • Unit - Add Plague (Abomination) to (Target unit of ability being cast)
      • Unit Group - Add (Target unit of ability being cast) to Diseased
      • Wait 2.00 seconds
      • Unit - Remove Plague (Abomination) from (Target unit of ability being cast)
this trigger was suposed to add the ability plague and then remove it after 2 seconds, but it only adds the ability and it doesnt remove it. what am i doing wrong and how am i suposed to do it??? help pls:confused:
 
Level 9
Joined
Dec 6, 2007
Messages
233
1. If more than one unit is casting this at once, plague won't be removed from all of the units, just the last one who casted it.
2. For triggers with waits involved, things like "target unit of ability being cast" can sometimes be lost. assign "target unit of ability being cast to a variable at the beginning of the trigger, than use that variable in the place of "target unit of ability being cast" throughout the rest of the trigger.
 
Level 6
Joined
Jul 17, 2008
Messages
185
1. If more than one unit is casting this at once, plague won't be removed from all of the units, just the last one who casted it.
2. For triggers with waits involved, things like "target unit of ability being cast" can sometimes be lost. assign "target unit of ability being cast to a variable at the beginning of the trigger, than use that variable in the place of "target unit of ability being cast" throughout the rest of the trigger.

Ok...

I have this now:
  • Untitled Trigger 001 Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Plague
    • Actions
      • Unit - Add Plague (Abomination) to (Target unit of ability being cast)
      • Unit Group - Add (Target unit of ability being cast) to Diseased
      • Wait 15.00 seconds
      • Unit Group - Pick every unit in Diseased and do (Actions)
        • Loop - Actions
          • Unit - Remove Plague (Abomination) from (Picked unit)
But i still have the first problem that u mentioned :S
1. If more than one unit is casting this at once, plague won't be removed from all of the units, just the last one who casted it.

Can someone tell me how to fixx this??
 
Level 9
Joined
Dec 6, 2007
Messages
233
things with timers are beyond me for making mui with gui. You might only be able to mui this with Jass. The trigger you up there works for one instance, however (but it leaks =D).
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set My_hash = (Last created hashtable)
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Unit - Add Acid Bomb to (Target unit of ability being cast)
      • Unit Group - Add (Target unit of ability being cast) to Unit_Group
      • Hashtable - Save 15 as (Key timer) of (Key (Target unit of ability being cast)) in My_hash
      • Trigger - Turn on Untitled Trigger 002 <gen>
  • Untitled Trigger 002
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Unit_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Integer_1 = (Load (Key timer) of (Key (Picked unit)) from My_hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Integer_1 Greater than 0
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Hashtable - Save (Temp_Integer_1 - 1) as (Key timer) of (Key (Picked unit)) in My_hash
            • Else - Actions
              • Unit - Remove Acid Bomb from (Picked unit)
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in My_hash
              • Unit Group - Remove (Picked unit) from Unit_Group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit_Group is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Level 6
Joined
Jul 17, 2008
Messages
185
Ok people ive fixed the problem in a simple way.

Heres the trigger now:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Plague
    • Actions
      • Unit - Add Plague (Abomination) to (Target unit of ability being cast)
      • Unit Group - Add (Target unit of ability being cast) to Diseased
      • Wait 15.00 seconds
      • Unit Group - Pick every unit in Diseased and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Plagued ) Equal to True
            • Then - Actions
              • Do nothing
            • Else - Actions
              • Unit - Remove Plague (Abomination) from (Picked unit)
              • Unit Group - Remove (Picked unit) from Diseased
and heres my Dispell trigger for if someone dispells the triggering ability:
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Target unit of ability being cast) is in Diseased) Equal to True
    • Actions
      • Wait 0.10 seconds
      • Unit Group - Pick every unit in Diseased and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Plagued ) Equal to True
            • Then - Actions
              • Do nothing
            • Else - Actions
              • Unit - Remove Plague (Abomination) from (Picked unit)
              • Unit Group - Remove (Picked unit) from Diseased
Tks spencenator u really teached me something about the wait command lol
 
Level 9
Joined
Dec 6, 2007
Messages
233
Your trigger is now MUI, good job on that, but what if:

Unit casts plague

5 sec later, another unit casts plague

The trigger's 15sec wait would start over, wouldn't it?

The problem is, the wait is in the trigger, not the unit, so although it would work, the wait will not always be the correct 15sec. If you wan't everything to work flawlessly, use maker's triggers. He stored a separate timer for every unit in a hashtable. He knows his stuff (he's helping me with some of my triggers right now).

Otherwise, glad i could help
 
Level 9
Joined
Dec 6, 2007
Messages
233
I was telling him he had the right idea, but still had some problems, then suggested he use makers version. And it's not about coding MUI that gets people at first, it's the whole mindset of it. People have to learn to think like the trigger, and present every kind of circumstance to it to see if it will always work. That isn't something that can be taught. So please don't go off on newbies, we were all one once.
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
I was telling him he had the right idea, but still had some problems, then suggested he use makers version. And it's not about coding MUI that gets people at first, it's the whole mindset of it. People have to learn to think like the trigger, and present every kind of circumstance to it to see if it will always work. That isn't something that can be taught. So please don't go off on newbies, we were all one once.

the only thing is that he can copy the triggers right ahead of maker and just make some small changes and credit him ...
 
Level 6
Joined
Jul 17, 2008
Messages
185
K tks everyone

The problem is, the wait is in the trigger, not the unit, so although it would work, the wait will not always be the correct 15sec. If you wan't everything to work flawlessly, use maker's triggers. He stored a separate timer for every unit in a hashtable. He knows his stuff (he's helping me with some of my triggers right now).

Dude... i tryed it several times and it works fine with my trigger... always 15 secs
 
Last edited:
Status
Not open for further replies.
Top