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

Need help with special effect

Status
Not open for further replies.
Level 2
Joined
Feb 25, 2011
Messages
15
My problem here is that i want to do a spell in which an attacked unit gets a special effect and after 1 second it is destroyed. But the problem is that this trigger can be done more than once at the same time because the attacking unit attacks faster.... the thing is that the effect doesnt destroy if i attack another unit because the special effect is changed to the new one before it has to be destroyed... Sorry for bad english, i hope you understood me! :S
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
do it like that

  • Trigger1
    • Events
      • Unit - A unit gets attacked
    • Conditions
    • Actions
      • Set Integer1 = (Integer1 + 1)
      • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
      • Set SpecialEffect[Integer1] = (Last created special effect)
      • Set Time[Integer1] = 1.00
  • Trigger2
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to Integer1, do (Actions)
        • Loop - Actions
          • Set Time[(Integer A)] = (Time[(Integer A)] - 0.10)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • Time[(Integer A)] equal to 0.00
            • 'THEN'-Actions
              • Special Effect - Destroy SpecialEffect[(Integer A)]
            • 'ELSE'-Actions

this will work, but:

you have to do that if the animation gets destroyed: Integer1 = Integer1 - 1
and you have to add a condition: if Integer1 equal to 0, turn off Trigger2, so it wont trigger all the time --> more efficient


with the Time variable you can change the duration of the animation.

Integer1 is an Integer variable
Time is a Real variable with array
SpecialEffect is a Special Effect variable with array
 
Level 9
Joined
Dec 12, 2007
Messages
489
this will work, but:

you have to do that if the animation gets destroyed: Integer1 = Integer1 - 1
and you have to add a condition: if Integer1 equal to 0, turn off Trigger2, so it wont trigger all the time --> more efficient


with the Time variable you can change the duration of the animation.

Integer1 is an Integer variable
Time is a Real variable with array
SpecialEffect is a Special Effect variable with array

I would like to note that you need to recycle the index that has been destroyed, not just decrease the Integer1.

If you just decrease Integer1, the latest created special effect will never be destroyed.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Simple, use local variable :)
Follow this code;
  • Counter Root
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Your Condition
    • Actions
      • Custom script: local effect udg_SFX
      • Special Effect - Create a special effect attached to the YourAttachmentPoint of (Attacking unit) using YourPathSFX
      • Set SFX = (Last created special effect)
      • Wait 1.00 seconds
      • Special Effect - Destroy SFX
      • Custom script: set udg_SFX = null
1. Create a variable named "SFX", the variable type is Special Effect
2. Follow exactly the writing in the Custom script.
 
Status
Not open for further replies.
Top