• 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.

How to delate lightning effects?

Status
Not open for further replies.
Level 5
Joined
May 27, 2007
Messages
144
Hello I just made a new passive spell and got spell problem with it. The effect of this passiv skill uses a lightning. The problem is sometimes when few units attacks my unit with this passive skill it creats few lightning effects but not delates all. Hero is my trigger maybe you can find a mistake pls help!
  • BloodLust
    • Events
      • Unit - A unit is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Level of BloodSuck for (Attacking unit)) bigger than als 0
          • ((Level of BloodSuck for (Attacked unit)) equal not to 0) and ((Random integer number between 1 and 12) equal to 1)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacking unit) has buff BloodLust ) Equal to True
        • Then - Actions
          • Set BL_Caster = (Attacking unit)
          • Set BL_Target = (Attacked unit)
        • Else - Actions
          • Set BL_Caster = (Attacked unit)
          • Set BL_Target = (Attacking unit)
      • Unit - Set life of BL_Caster to ((life of BL_Caster) + (6.50 x (Real((Level of BloodSuck for BL_Caster)))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BL_Caster Equal to (Attacking unit)
        • Then - Actions
          • Special Effect - Create a special effect attached to the overhead of BL_Target using war3mapImported\VampiricAuraTarget.mdx
          • Special Effect - Destroy (Last created special effect)
          • Skip remaining actions
        • Else - Aktionen
      • Unit - Cause BL_Caster to damage BL_Target, dealing (6.50 x (Real((Level of BloodSuck for BL_Caster)))) damage of attack type Normal and damage type Normal
      • Set BL_Point[1] = (Position of BL_Caster)
      • Set BL_Point[2] = (Position of BL_Target)
      • Lightning - Create a Life drain lightning effect from source BL_Point[1] to target BL_Point[2]
      • Lightning - Change color of (Last created lightning effect) to (3.00 1.00 1.00) with 2.00 alpha
      • Special Effect - Create a special effect attached to the overhead of BL_Target using war3mapImported\VampiricAuraTarget.mdx
      • Special Effect - Destroy (Last created special effect)
      • Wait - 1.00 seconds
      • Lightning - Destroy (Last created lightning effect)
      • Custom script: call RemoveLocation(udg_BL_Point[1])
      • Custom script: call RemoveLocation(udg_BL_Point[2])
 
Level 27
Joined
Feb 22, 2006
Messages
3,052
It doesn't delete all because of this:
  • Lightning - Destroy (Last created lightning effect)
This will only create the last lightning effect created. Since you have a one second wait, if anything attacks in that one second between the lightning being created and the lightning being destroyed, the new lightning will take the new place of the "Last created lightning effect", and therefore be destroyed twice.
The best way to bypass this is to use local variables, which will require JASS knowledge.
--donut3.5--
 
Level 5
Joined
May 27, 2007
Messages
144
ooh is there a way without a jass because Im not skilled at using jass. Btw would it work without wait ? or with wait equal to 0.25 sec or sth like this ?
 
Level 27
Joined
Feb 22, 2006
Messages
3,052
Level 5
Joined
May 27, 2007
Messages
144
thx well i added
  • Custom script: local lightning BL_Lightning
at the 1st position in actions and I also added
  • Set BL_Lightning - last created lightning effect
after the line
  • Lightning - Create a Life drain lightning effect from source BL_Point[1] to target BL_Point[2]
BUT it still sometimes doesnt delate lightning effect. What is still wrong ?
 
Store the last created lightning effect into a variable(with array)
So it would look like:

  • Lightning - Create a Life drain lightning effect from source BL_Point[1] to target BL_Point[2]
  • Set LightningEffect[1] = last created lightning effect
  • Lightning - Change color of (Last created lightning effect) to (3.00 1.00 1.00) with 2.00 alpha
  • Wait 15 gametime seconds
  • Lightning - Destroy LightningEffect[1]
 
Level 5
Joined
May 27, 2007
Messages
144
thank you all Now it works i just forgotten to change this line
  • Lightning - Destroy (Last created lightning effect)
into
  • Lightning - Destroy BL_Lightning
Now MUI is working fine! Btw. -BerZeKeR- I cant change it to array without turning off this line
  • Custom script: local lightning BL_Lightning
else the map will not start! Thx all again + rep
 
Status
Not open for further replies.
Top