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

[Trigger] Will this break? or work?

Status
Not open for further replies.
Level 4
Joined
Jun 13, 2014
Messages
77
I'm curious if two people cause this to go off at the same time will it leak?

  • reflect dmg
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) has buff Sleep (Stun) ) Equal to (==) True
    • Actions
      • Set Reflectpoint = (Position of (Attacking unit))
      • Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) - 1000.00)
      • Special Effect - Create a special effect at Reflectpoint using Abilities\Spells\Undead\Impale\ImpaleMissTarget.mdl
      • Set Reflectsfx = (Last created special effect)
      • Wait 1.00 seconds
      • Special Effect - Destroy Reflectsfx
      • Custom script: call RemoveLocation( udg_Reflectpoint )
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
Not only leak but it will also bug because of the wait timer.
Instead, make a unit which uses the model of the effect you want to use and give it an 1s expiration timer (triggers).
Create the unit via triggers at the reflectpoint, timer expires and kills the unit off, et voilà.
 
Level 4
Joined
Jun 13, 2014
Messages
77
So with a unit creation it wont leak though? and will work with multiple people?

heres what i got now

  • reflect dmg
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) has buff Sleep (Stun) ) Equal to (==) True
    • Actions
      • Set Reflectpoint = (Position of (Attacking unit))
      • Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) - 1000.00)
      • Unit - Create 1 Reflect Impale Effect for Neutral Hostile at Reflectpoint facing Default building facing (270.0) degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation( udg_Reflectpoint )
 
Level 13
Joined
Jan 2, 2016
Messages
973
  • reflect dmg
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) has buff Sleep (Stun) ) Equal to (==) True
    • Actions
      • Custom script: local location loc
      • Custom script: local effect e
      • Set Reflectpoint = (Position of (Attacking unit))
      • Custom script: set loc = udg_Reflectpoint
      • Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) - 1000.00)
      • Special Effect - Create a special effect at Reflectpoint using Abilities\Spells\Undead\Impale\ImpaleMissTarget.mdl
      • Custom script: set e = bj_lastCreatedEffect
      • Wait 1.00 seconds
      • Custom script: call DestroyEffect( e )
      • Custom script: call RemoveLocation( loc )
 
Level 4
Joined
Jun 13, 2014
Messages
77
  • reflect dmg
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) has buff Sleep (Stun) ) Equal to (==) True
    • Actions
      • Custom script: local location loc
      • Custom script: local effect e
      • Set Reflectpoint = (Position of (Attacking unit))
      • Custom script: set loc = udg_Reflectpoint
      • Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) - 1000.00)
      • Special Effect - Create a special effect at Reflectpoint using Abilities\Spells\Undead\Impale\ImpaleMissTarget.mdl
      • Custom script: set e = bj_lastCreatedEffect
      • Wait 1.00 seconds
      • Custom script: call DestroyEffect( e )
      • Custom script: call RemoveLocation( loc )

Mind explaining the things you added and why they are necessary? it may be relevant to how i trigger in general maybe im creating leaks
 
Level 13
Joined
Jan 2, 2016
Messages
973
WereElf's solution uses a local variables. I'm not sure if the local variables can get bugged out if being run multiple times.

Local variables DON'T get overwritten.

Anyways.. there's nothing wrong with your code now.. I'm just telling you how you can do it, without having to make a special dummy (with model = the effect you want), every time you want an effect to last x seconds..
 
Status
Not open for further replies.
Top