• 🏆 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 with destroying multiple lightning effects

Status
Not open for further replies.
Level 7
Joined
Oct 8, 2005
Messages
298
Ok so heres the way this works. Im making an ability were when the hero starts casting "Combustion" it will create a blue lightning effect that travels to all surronding units with mana and will destroy some of there mana then after 2 seconds (if the heros still alive) of channeling the spell there will be an explosion that deals damage to all nearby enemy land units that also stuns thbem. I have the entire ability working perfectly except for 1 small detail; i cant destroy the lightning effects that travel out to the enemy units. Heres my trigger so far:

Code:
Combustion
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Combustion 
    Actions
        Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (800.00, 800.00)) matching ((Integer((Mana of (Matching unit)))) Greater than or equal to 1)) and do (Actions)
            Loop - Actions
                Set CombustionCaster = (Casting unit)
                Lightning - Create a Drain Mana lightning effect from source (Position of (Casting unit)) to target (Position of (Picked unit))
                Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - (15.00 + ((35.00 + (0.20 x (Real((Intelligence of CombustionCaster (Include bonuses)))))) + (Real((Level of Combustion  for (Casting unit)))))))
        Unit - Pause (Casting unit)
        Animation - Play (Casting unit)'s spell channel animation
        Unit - Create 1 Footman for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
        Set CombustionDamager = (Last created unit)
        Unit - Add Combustion Damage  to (Last created unit)
        Unit - Set level of Combustion Damage  for (Casting unit) to (Level of Combustion  for (Casting unit))
        Wait 2.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (CombustionCaster is alive) Equal to True
            Then - Actions
                Unit - Order CombustionDamager to Orc Tauren Chieftain - War Stomp
                Animation - Reset CombustionCaster's animation
                Unit - Unpause CombustionCaster
            Else - Actions
                Unit - Unpause CombustionCaster

Here is also the in game description of the ability:

The hero channels a magic of ancient evil. Upon activation the hero saps mana from all nearby enemy units regenerating his mana supply. He then will channel magical energies for 2 seconds wherein he will be vunerable to enemy attack and be uncontrollable. After he has completed channeling he will let loose a powerful combustion of the enemy's mana dealing damage to enemy land units.

So all i need to do is destroy all the lightning effects that are created. This would be simple enough by just setting the lightning effect to a variable then calling the variable to destroy the lightning effects after the 2 second wait period, but it wont store multiple lightning effects in the same variable. Also i tried destroying the Last Create Lightning Effect to see if that would call all the lightining effects, but it only destroys one of them. I appreciate any and all help guys. Thanks! :D

oh and btw i have a BASIC understanding of JASS coding so if u display something in JASS i should be able to figure it out. In other words if u have a way to do this dont think it has to be in GUI.
 
Level 16
Joined
Oct 30, 2004
Messages
1,277
Make a variable type "lightning" array ,lets say, 20, name it "lightning". Also make variable type "integer", set it to be "1" as default, name it "light_number".

Then add this these actions after you create the lightning effect:

-Set variable "lightning [light_number]" = Last created lightning effect
-Set variable "light_number" = ("light_number" + 1)


This will allow you to store max of 20 lightnings, then simply kill them all after the trigger.

Also if you go this way you should make your map that only one person can pick the hero who can cast this spell because if two people cast it at the same time, the variables will get confused.

Hope this helped.
 
Status
Not open for further replies.
Top