1. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  2. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  6. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  7. 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] Dispell Magic

Discussion in 'Triggers & Scripts' started by Watcher, Feb 12, 2018.

  1. Watcher

    Watcher

    Joined:
    Aug 31, 2011
    Messages:
    87
    Resources:
    0
    Resources:
    0
    Hi, guys I need a help with this trigger.

    So what a trigger does:

    If a unit has a specific buff in this case "Wild Growth" this spells will consume this buff and heal a unit for 100 hp, while also removing all other buffs/debuffs.

    If a unit doesn't have the buff it will function as normal dispell magic spell.

    Trigger

    • Revitalize
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Cleanse
      • Actions
        • Unit Group - Pick every unit in (Units within 200.00 of (Target point of ability being cast)) and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Target unit of ability being cast) has buff Wild Growth ) Equal to True
              • Then - Actions
                • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
                • Unit - Remove All buffs from (Target unit of ability being cast)
              • Else - Actions
                • Unit - Remove All buffs from (Target unit of ability being cast)



    The problem is, that this trigger in game does absolutely nothing. -.-"

    Any help?
     
  2. Dark_Axl

    Dark_Axl

    Joined:
    Dec 12, 2007
    Messages:
    472
    Resources:
    2
    Maps:
    1
    Spells:
    1
    Resources:
    2
    change all of "Target unit of ability being cast" below the loop - actions to "Picked unit"

    so that it looks like:

    Pick every unit in (Units within 200.00 of Target point of ability being cast) then
    - Loop actions
    - - If
    - - - Picked unit has buff "X" equal to true
    - - then
    - - - Set life of picked unit to (life of picked unit) + 100.
    - - - Remove all buffs from picked unit
    - - else
    - - - Remove all buffs from picked unit

    you can move the remove all buffs before "if" as it will be executed regardless the if output.
    and your trigger leaks location, you should store that "Target point of ability being cast to variable first then remove it after use.
     
    Last edited: Feb 12, 2018
  3. MasterBlaster

    MasterBlaster

    Joined:
    Feb 23, 2014
    Messages:
    1,035
    Resources:
    0
    Resources:
    0
    Basically this.

    The reason why your trigger doesn't work is because "Target unit of ability being cast" refers to a unit that was specifically targeted by an ability - in your case it appears that you are targeting an area instead.

    Another thing is, your trigger leaks both a unit group and a location. You should remove that.

    This will help you:
    Things That Leak

    Overall, I'd do something like this:
    • Set PointTemp = (Target point of ability being cast)
    • Set UnitGroupTemp = Units within 200.00 of PointTemp
    • Custom script: call RemoveLocation (udg_PointTemp)
    • Unit Group - Pick every unit in UnitGroupTemp and do Actions
      • <your actions>
    • Custom script: call DestroyGroup (udg_UnitGroupTemp)
     
  4. Watcher

    Watcher

    Joined:
    Aug 31, 2011
    Messages:
    87
    Resources:
    0
    Resources:
    0
    Oh thank you guys!

    Now it works +rep for both ;)