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

[Trigger] Removing multiple lightnings at once

Status
Not open for further replies.
Level 8
Joined
Jun 13, 2008
Messages
346
hi community...I had a problem about deleting lightnings which created for multiple units in a certain area, the thing is, removing is only happening for just one lightning effect...I know i should use array or something but I don't know jass that well. But if someone can do that for me or tells me step by step how to do it, I'd be appreciated.

  • Untitled Trigger 004
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Raise Dead
    • Actions
      • Set RD_Point = (Position of (Casting unit))
      • Set RD_Group = (Units within 1000.00 of RD_Point)
      • Unit Group - Pick every unit in RD_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to True
            • Then - Actions
              • Lightning - Create a Finger of Death lightning effect from source (Position of (Triggering unit)) to target (Position of (Picked unit))
              • Set HS_effect = (Last created lightning effect)
            • Else - Actions
  • Untitled Trigger 004 Copy
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Raise Dead
    • Actions
      • Unit Group - Pick every unit in RD_Group and do (Actions)
        • Loop - Actions
          • Custom script: call DestroyLightning(udg_HS_effect)
so yeah, this basic approach didn't work...only one lightning is deleted not all of them.
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
There are couple tricks you can do even via GUI, you don't actually need to enter script code-version of your trigger.

  • Random Trig
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Raise Dead
    • Actions
      • Set RD_Point = (Position of (Triggering Unit))
      • Set RD_Group = (Units within 1000.00 of RD_Point)
      • Unit Group - Pick every unit in RD_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to True
            • Then - Actions
              • Set RD_Point2 = (Position of (Picked unit))
              • Lightning - Create a Finger of Death lightning effect from source RD_Point to target RD_Point2
              • Set HS_effect = (Last created lightning effect)
              • Custom script: call RemoveLocation(RD_Point2)
              • Trigger - Run SFX Destroy <gen> (ignore conditions)
            • Else - Actions
      • Custom script: call RemoveLocation(RD_Point)
      • Custom script: call DestroyGroup(RD_Group)
  • SFX Destroy
    • Events
    • Conditions
    • Actions
      • Custom script: local lightning e = udg_HS_effect
      • Wait 1.00 second
      • Custom script: set udg_HS_effect = e
      • Lightning - Destroy HS_effect
You can set wait timer to cast time of your spell. If you really do want to keep the removal on "finishing casting an ability" that indeed you need an array of effects.
 
Last edited:
Level 8
Joined
Jun 13, 2008
Messages
346
vjass compiler gives error when trying to save the map with these codes...it says it cannot convert lightning to effect and then effect to lightning in sfx destroy trigger..but I got this trick...we make the lightning to look like as if its a special effect and then destroy it this way?
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Try this:
  • SFX Destroy
    • Events
    • Conditions
    • Actions
      • Custom script: local lightning e = udg_HS_effect
      • Wait 1.00 second
      • Custom script: set udg_HS_effect = e
      • Lightning - Destroy HS_effect
Oh, already answered.
 
Status
Not open for further replies.
Top