• 🏆 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!

Help In Trigger

Status
Not open for further replies.
Level 5
Joined
Mar 30, 2010
Messages
75
hey guys just asking is this trigger correct generally not considering leaks
  • Sheer Cold Init
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Sheer Cold
    • Actions
      • Set SC_Caster = (Casting unit)
      • Set SC_Target = (Target unit of ability being cast)
      • Trigger - Turn on Sheer Cold Attack <gen>
  • Sheer Cold Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has buff Sheer Cold ) Equal to True
      • (Attacking unit) Equal to SC_Target
    • Actions
      • Set SC_Attacks = (SC_Attacks + 1.00)
  • Sheer Cold Freeze
    • Events
      • Game - SC_Attacks becomes Equal to 5.00
    • Conditions
    • Actions
      • Unit - Create 1 SC_Dummy for (Owner of SC_Caster) at (Position of (Casting unit)) facing Default building facing degrees
      • Set SC_Dummy = (Last created unit)
      • Unit - Order SC_Dummy to Human Mountain King - Storm Bolt SC_Target
      • Unit - Add a 2.00 second Generic expiration timer to SC_Dummy
      • Set SC_Attacks = 0.00
      • Trigger - Turn off Sheer Cold Attack <gen>
      • Trigger - Turn on Sheer Cold Damage <gen>
  • Sheer Cold Damage
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Cause SC_Caster to damage SC_Target, dealing 10.00 damage of attack type Spells and damage type Normal
      • Wait 5.00 seconds
      • Trigger - Turn off (This trigger)
Will this work not cosidering leaks yet my goal was an ability that after casted on an enemy and the enemy attacks 5 timed after he got hit by the ability he will freeze and damage by 10 every second so will it work?
 
Last edited:
Level 11
Joined
Dec 5, 2009
Messages
846
hey guys just asking is this trigger correct generally not considering leaks

  • Sheer Cold Freeze
    • Actions
      • Unit - Create 1 SC_Dummy for (Owner of SC_Caster) at (Position of (Casting unit)) facing Default building facing degrees

The position will leak. to fix it create point variable and set it to position of casting unit or your casting unit variable Like this:
  • Set Sc_Loc = (Position of (Casting unit))
And ofc set the location before the dummy spawns

Then At the end of Sheer Cold Freeze Do like this:

  • Custom script: call RemoveLocation(udg_Sc_Loc)
There you removed the leak.


And another thing.In The Sc damage trigger remove the wait and the turn off trigger action in it. And put the wait after the turn off trigger actions in Sheer Cold Freeze. After the wait create turn off trigger action that the trigger will turn off damage trigger.
Like this:

  • Sheer Cold Freeze
    • Trigger - Turn off Sheer Cold Attack <gen>
    • Trigger - Turn on Sheer Cold Damage <gen>
    • Wait - Wait 5 seconds
    • Trigger - Turn off Sheer Cold Damage <gen>
  • Sheer Cold Damage
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Cause SC_Caster to damage SC_Target, dealing 10.00 damage of attack type Spells and damage type Normal
 
One out of the four triggers is redundant. It could be:
  • Sheer Cold Attack
  • Events
    • Unit - A unit Is attacked
  • Conditions
    • ((Attacking unit) has buff Sheer Cold ) Equal to True
    • (Attacking unit) Equal to SC_Target
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • SC_Attacks Less than or Equal to 5
      • Then - Actions
        • Set SC_Attacks = (SC_Attacks + 1.00)
      • Else - Actions
        • Set Point1 = (Position of (Attacked unit))
        • Unit - Create 1 SC_Dummy for (Owner of SC_Caster) at (Posint1) facing Default building facing degrees
        • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt SC_Target
        • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        • Set SC_Attacks = 0.00
        • Trigger - Turn off (This trigger)
        • Trigger - Turn on Sheer Cold Damage <gen>
        • Custom script: call RemoveLocation (udg_Point1)
• You used Position of (Casting unit). Casting unit must have an event for example "Unit starts the effect of an ability" to refer to, but the event here is different, so it will refer to no position. Instead, I used Attacked unit, which is the unit you actually want.
• Prefer Triggering unit over Casting Unit.
• Use If/Then/Else, it's faster than the equivalent event, which counts the value of a variable (e.g. Game - SC_Attacks becomes Equal to 5.00)
• You can use Trigger - Turn off (This trigger), instead of Trigger - Turn off Sheer Cold Attack <gen>, which is the same thing.
 
Status
Not open for further replies.
Top