1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] is there a way to remove an event?

Discussion in 'Triggers & Scripts' started by normalice, Aug 25, 2014.

  1. normalice

    normalice

    Joined:
    Mar 13, 2013
    Messages:
    267
    Resources:
    33
    Packs:
    1
    Maps:
    31
    Tutorials:
    1
    Resources:
    33
    I'm trying to change incinerate to do aoe damage on hit rather on death. Here's what I have:

    • Incinerate init
      • Events
        • Unit - A unit Is attacked
      • Conditions
        • And - All (Conditions) are true
          • Conditions
            • (Unit-type of (Attacking unit)) Equal to Firelord
            • (Level of Incinerate (Arrow) for (Attacking unit)) Greater than 0
      • Actions
        • Trigger - Add to Incinerate <gen> the event (Unit - (Attacked unit) Takes damage)


    and then:

    • Incinerate
      • Events
      • Conditions
      • Actions
        • Unit Group - Pick every unit in (Units within 200.00 of (Position of (Attacked unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True)) and do (Actions)
          • Loop - Actions
            • Unit Group - Add (Picked unit) to grp
        • Set x = (Number of units in grp)
        • Unit Group - Pick every unit in grp and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Level of Incinerate (Arrow) for (Attacking unit)) Equal to 1
              • Then - Actions
                • Set y = (Min(3.00, (45.00 / (Real(x)))))
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Level of Incinerate (Arrow) for (Attacking unit)) Equal to 2
                  • Then - Actions
                    • Set y = (Min(8.00, (45.00 / (Real(x)))))
                  • Else - Actions
                    • Set y = (Min(15.00, (45.00 / (Real(x)))))
            • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - y)
        • Unit Group - Remove all units from grp


    of course, this builds and builds so that successive attacks on a unit make the damage double/triple/quadruple and so on (since it keeps adding the same event). Is there a way to remove the event added in the first trigger? Obviously, simply using the orb of fire ability data wouldn't work since there is a damage cap (and I want it to do reduced damage to buildings, which I haven't really started working on yet..).
     
  2. jonhysone

    jonhysone

    Joined:
    Oct 29, 2012
    Messages:
    1,240
    Resources:
    1
    Maps:
    1
    Resources:
    1
    You simply can't. Why not just use 'Trigger - Turn off trigger' and 'Trigger - Turn on trigger' whenever you want the trigger to run. There is no reliable way to remove events neither in GUI nor in any type of JASS.

    So it's best to turn it on and off when you need to.
     
  3. normalice

    normalice

    Joined:
    Mar 13, 2013
    Messages:
    267
    Resources:
    33
    Packs:
    1
    Maps:
    31
    Tutorials:
    1
    Resources:
    33
    i want the trigger to run when a unit takes damage. unfortunately, there is no way to do this unless you specify the unit. And there is no way to do that unless the unit is known beforehand (impossible for this purpose) or you add the unit dynamically to a trigger.

    unless I'm missing something?
     
  4. Nichilus

    Nichilus

    Joined:
    Sep 26, 2009
    Messages:
    1,968
    Resources:
    0
    Resources:
    0
    for such things DDS has been created. Just download some.
     
  5. jonhysone

    jonhysone

    Joined:
    Oct 29, 2012
    Messages:
    1,240
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I am sure there is another way to achieve the same goal. If you explain what the trigger properly does and its goal. We'll try to investigate it and attempt to create a better form for it.
     
  6. Gismo359

    Gismo359

    Joined:
    Jul 14, 2011
    Messages:
    771
    Resources:
    44
    Packs:
    4
    Maps:
    40
    Resources:
    44
    Another solution is creating a trigger for every unit you want the event to affect, and then destroying it when you're done but that wouldn't be very practical.
    I'd recommend a damage detection system, as Nichilus suggested. There was a few, last time I checked and they were really easy to use.
     
  7. McQvaBlood

    McQvaBlood

    Joined:
    Jul 3, 2010
    Messages:
    536
    Resources:
    44
    Packs:
    4
    Maps:
    40
    Resources:
    44
    To actually answer the original question, you can't remove event. You can, however, be pro-active about not adding the event mulitple times, which achieves the same effect like this:
    • Create a global variable unit group eg. Incinerate_Group.
    • Change the Actions of the first trigger to this:
      • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacked unit) is in Incinerate_Group) Equal to False
        • Then - Actions
          • Unit Group - Add (Attacked unit) to Incinerate_Group
          • Trigger - Add to Incinerate <gen> the event (Unit - (Attacked unit) Takes damage)
        • Else - Actions
    Units should no longer get registered multiple times.
     
  8. Nichilus

    Nichilus

    Joined:
    Sep 26, 2009
    Messages:
    1,968
    Resources:
    0
    Resources:
    0
    That will still register too many units throughout the game, since the event is not removed when unit dies but stays.
    So over the course of the game, that trigger may crash.

    That's why DDS has been created - to take care of all units taking damage in the map without having to register that event for each unit.
    It will also help him with future spells when he needs to negate dmg, etc.
     
  9. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,697
    Resources:
    0
    Resources:
    0
    Yeah, just use an existing DDS instead. It's too troublesome to make one anyway.
     
  10. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,545
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    You need to destroy the trigger and then rebuild it to remove events. This works completely leak-lessly in JASS however it can introduce some instability if done incorrectly (do not ask me how to do it correctly as I do not know).
     
  11. Mythic

    Mythic

    Joined:
    Apr 24, 2012
    Messages:
    7,728
    Resources:
    102
    Models:
    87
    Icons:
    4
    Maps:
    3
    Spells:
    6
    Tutorials:
    2
    Resources:
    102
    Just use a DDS as mentioned, some offer more control over this.
     
  12. normalice

    normalice

    Joined:
    Mar 13, 2013
    Messages:
    267
    Resources:
    33
    Packs:
    1
    Maps:
    31
    Tutorials:
    1
    Resources:
    33
    alright, I'll take a crack at this DDS thing. Where do i find it?
     
  13. Gismo359

    Gismo359

    Joined:
    Jul 14, 2011
    Messages:
    771
    Resources:
    44
    Packs:
    4
    Maps:
    40
    Resources:
    44
  14. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,697
    Resources:
    0
    Resources:
    0
  15. sethmachine

    sethmachine

    Joined:
    Aug 7, 2013
    Messages:
    1,318
    Resources:
    0
    Resources:
    0
    By instability you mean it can cause the game to crash if the trigger is destroyed at an inappropriate time?
     
  16. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,545
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Yes, something like it can still have executions queued up when you destroy it resulting in bad stuff happening. No one explain to me what exactly happened because they thought I was too stupid for some silly reason.
     
  17. Gismo359

    Gismo359

    Joined:
    Jul 14, 2011
    Messages:
    771
    Resources:
    44
    Packs:
    4
    Maps:
    40
    Resources:
    44
    Do you mean this bug? As far as I know it was patched, but I dont remember where I read it. I was wrong.

    Link to thread.
    Link to the 'research' thread.
     
    Last edited: Aug 26, 2014
  18. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,545
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    There were no official patch notes regarding it. However there were patches since that time so it is quite possible it was patched at some stage (hidden change).

    Again its all so vague. There is no "chance" in computer science. Leaking is not a good alternative either.

    Why is something so easy in SC2 so hard in WC3...
     
  19. Gismo359

    Gismo359

    Joined:
    Jul 14, 2011
    Messages:
    771
    Resources:
    44
    Packs:
    4
    Maps:
    40
    Resources:
    44
    There were multiple conclusions by cohadar and masda in multiple threads, but I couldnt find them all and they werent nearly as consistent and 'logical' as Vex's, from what I remember. Anyways, if anyone has a more indepth and justified explanation to the actual cause of the problem he hasnt posted it anywhere from what I could find.
     
  20. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,697
    Resources:
    0
    Resources:
    0