• 🏆 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 spell buff (newbie)

Status
Not open for further replies.
Level 2
Joined
Dec 30, 2019
Messages
3
Hi Guys,It's my first time doing a trigger spell or first time doing something on triggers, I'm still a beginner for this but I'm willing to learn.

I wanted to ask if my trigger spell are ok?.. is it what they call leakless?

  • Increase Allstats
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hero Creation
    • Actions
      • Set Merlin_Caster_Hero = (Triggering unit)
      • Set Merlin_Caster_Hero_Target = (Target unit of ability being cast)
      • Set IncreaseAllStats = (4 x (Level of Hero Creation for Merlin_Caster_Hero))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Merlin_Caster_Hero_Target has buff Hero Creation ) Equal to True
        • Then - Actions
          • Hero - Modify Strength of Merlin_Caster_Hero_Target: Add IncreaseAllStats
          • Hero - Modify Intelligence of Merlin_Caster_Hero_Target: Add IncreaseAllStats
          • Hero - Modify Agility of Merlin_Caster_Hero_Target: Add IncreaseAllStats
        • Else - Actions
          • Trigger - Run Increase Allstats Loop <gen> (checking conditions)

  • Increase Allstats Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
      • (Merlin_Caster_Hero_Target has buff Hero Creation ) Equal to False
    • Actions
      • Hero - Modify Strength of Merlin_Caster_Hero_Target: Subtract IncreaseAllStats
      • Hero - Modify Intelligence of Merlin_Caster_Hero_Target: Subtract IncreaseAllStats
      • Hero - Modify Agility of Merlin_Caster_Hero_Target: Subtract IncreaseAllStats
      • Set IncreaseAllStats = 0
      • Set Merlin_Caster_Hero = No unit
      • Set Merlin_Caster_Hero_Target = No unit
      • Trigger - Turn off (This trigger)
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
You’re not using any points, groups, or special effects, which are the most common objects to leak. Your spell therefore does not leak because it can’t. In general the triggers are fine but they could be improved:
  • Setting the variables to 0/no unit in the periodic trigger does not need to be done.
  • 0.05 is much more quickly than that trigger needs to run. I would probably use 0.2 or 0.25 and it wouldn’t be noticeably delayed.
  • The If-block in the cast trigger is pointless. The unit will always have the buff at that comparison unless there’s some way for the targeted unit to lose the buff between when the ‘spell effect’ event fires and when the if-block checks it. But it’s impossible for another trigger to interrupt the sequence of variable setting you do.
  • In fact if the unit didn’t have the buff at that check it would permanently lose 4*ability level stats. They would be increased by the cast trigger but the periodic would still reduce them.
  • If you’d like the bonus stats to be green + numbers you’ll have to give the unit a modified, hidden (via 0,-11 button position, disabled spellbook, or the ‘set ability visible’ action) version of the Attribute Bonus ability for the duration instead of increasing stats with a trigger.
  • The spell is not MUI and will break when two units cast it simultaneously.
 
Last edited:
Status
Not open for further replies.
Top