• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Special effect problems

Status
Not open for further replies.
Level 2
Joined
Apr 6, 2011
Messages
13
Hello.I've got little problem.I want to create 9 special effects but not sure how to delete them after.If I'll add variables they only working as "last created special effect" but I need to delete all 9 of them.Some help would be great ^^
 
Level 7
Joined
May 11, 2010
Messages
278
you can add the destroy special effect directly after creating it, it will be destroyed after "playing". at least i think so.
so:
play special effect
destroy last created special effect
play special effect
destroy last created special effect

and repeat
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Allocate some storage space (like 9 indicies in an effect array) and then place a reference to each special effect into one of those indicies. After you are done with the special effects you can then itterate through all 9 special effects removing them one at a time.

A system using a hashtable for the memory allocation is also viable although slower and more coplicated than the array method.

you can add the destroy special effect directly after creating it, it will be destroyed after "playing". at least i think so.
so:
Not entirly true. You can only destroy special effects if the model the effect uses has no death animation. An example is an explosion where the animation will still finish even after the effect is destroyed. However destroying effects will run the model's death animation which may not produce the desired visual effects. Some WC3 models even have 0 length death animations meaning that destroying them immediatly causes them to never visually appear.

Creating an effect plays the effect model's birth animation.
After the virth animation completes, effects will play a variety of stand animation.
Destroying an effect will immediatly inturrpt any animation it is currently playing with the death animation.

Animations are skipped (and thus do not interupt) if the model lacks such an animation string.
A model with no birth animation will go immediatly into its stand animation.
A model with no stand animation will hang on the last frame of the birth animation.
A model with no death animation will dissapear completly once the current animation ends.

Effects only play animations when near the current projection matrix position (close to your view port).
 
For instant deastroy action:
  • For each (Integer i) from 1 to 9 do Actions
    • Loop - Actions
      • Special Effect - Create special effect (...)
      • Special Effect - Destroy (Last created special effect)
Or for delayed leakfree way, use similar method as one below:
  • For each (Integer i) from 1 to 9 do Actions
    • Loop - Actions
      • Special Effect - Create special effect (...)
      • Set Effect = (Last created special effect)
      • Trigger - Run delay <gen> (Ignoring conditions)
  • delay
    • Events
    • Conditions
    • Actions
      • Custom script: local effect e = udg_Effect
      • Wait X seconds
      • Custom script: set udg_Effect = e
      • Special Effect - Destroy Effect
      • Custom script: e = null
Where: "Effect" is global variable created with use of GUI variable editor of type "Special Effect". The 'udg_' prefix in custom script comes from jass representation from GUI globals. "i" is integer-type variable.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
This could work for you. It uses a simple indexing.

  • Untitled Trigger 040
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Custom script: local integer c = udg_scount
      • Set point = (Center of (Playable map area))
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set point2 = (point offset by 256.00 towards (Random real number between 0.00 and 360.00) degrees)
          • Special Effect - Create a special effect at point2 using Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
          • Set ear[(scount + (Integer A))] = (Last created special effect)
          • Custom script: call RemoveLocation(udg_point2)
      • Custom script: call RemoveLocation(udg_point)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • scount Greater than 8000
        • Then - Actions
          • Set scount = 0
        • Else - Actions
          • Set scount = (scount + 9)
      • Wait 2.00 seconds
      • Custom script: set udg_i1 = c
      • For each (Integer A) from i1 to (i1 + 9), do (Special Effect - Destroy ear[(Integer A)])
scount = integer, don't use it for anything else
udg_i1 = integer, you can share it with other triggers
 
Status
Not open for further replies.
Top