• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[General] Lightning doesn't move

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,614
Hey,

So I got a little problem: boss' lightnings aren't moving. I think I've run to this problem before years ago but here I am once again. Help me!

Triggers:

  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing 1 as An exact match
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Set Boss_Event = True
      • Unit - Pause EPIC_BOSS
      • Animation - Play EPIC_BOSS's stand channel animation, using only Common animations
      • Wait 1.40 seconds
      • Set TempInteger = 0
      • Set EPIC_DrainC = 0
      • Set TempLoc = (Position of EPIC_BOSS)
      • Set TempGroup = (Units within 600.00 of TempLoc matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) Equal to Player 1 (Red)) and ((Level of Invulnerable (Neutral) for (Matching unit)) Equal to 0))))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Set EPIC_DrainB[(Integer A)] = True
          • Set TempInteger = (TempInteger + 1)
          • Set EPIC_DrainC = (EPIC_DrainC + 1)
          • Set TempLoc2 = (Position of (Picked unit))
          • Set EPIC_DrainU[TempInteger] = (Picked unit)
          • Lightning - Create a Drain Life lightning effect from source TempLoc to target TempLoc2
          • Set EPIC_DrainL[TempInteger] = (Last created lightning effect)
          • Custom script: call RemoveLocation(udg_TempLoc2)
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Trigger - Turn on Epic Demon SPELLS Drain MOVE <gen>
      • Trigger - Turn on Epic Demon SPELLS Drain DAMAGE <gen>
      • Wait 10.00 seconds
      • For each (Integer A) from 1 to EPIC_DrainC, do (Actions)
        • Loop - Actions
          • Lightning - Destroy EPIC_DrainL[(Integer A)]
      • Trigger - Turn off Epic Demon SPELLS Drain DAMAGE <gen>
      • Trigger - Turn off Epic Demon SPELLS Drain MOVE <gen>
      • Animation - Reset EPIC_BOSS's animation
      • Unit - Unpause EPIC_BOSS
      • Set Boss_Event = False
      • Wait 10.00 seconds
      • Trigger - Turn on (This trigger)
  • Epic Demon SPELLS Drain DAMAGE
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set TempLoc = (Position of EPIC_BOSS)
      • For each (Integer A) from 1 to EPIC_DrainC, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • EPIC_DrainB[(Integer A)] Equal to True
            • Then - Actions
              • Set TempLoc2 = (Position of EPIC_DrainU[(Integer A)])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between TempLoc and TempLoc2) Greater than 800.00
                • Then - Actions
                  • Set EPIC_DrainB[(Integer A)] = False
                • Else - Actions
                  • Set TempReal = 25.00
                  • Unit - Set life of EPIC_BOSS to ((Life of EPIC_BOSS) + TempReal)
                  • Unit - Set life of EPIC_DrainU[(Integer A)] to ((Life of EPIC_DrainU[(Integer A)]) - TempReal)
              • Custom script: call RemoveLocation(udg_TempLoc2)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TempLoc)
  • Epic Demon SPELLS Drain MOVE
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set TempLoc = (Position of EPIC_BOSS)
      • For each (Integer A) from 1 to EPIC_DrainC, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • EPIC_DrainB[(Integer A)] Equal to True
            • Then - Actions
              • Set TempLoc2 = (Position of EPIC_DrainU[(Integer A)])
              • Lightning - Move EPIC_DrainL[(Integer A)] to source TempLoc and target TempLoc2
              • Custom script: call RemoveLocation(udg_TempLoc2)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TempLoc)
Test map attached. Rep for the helpers!
 

Attachments

  • AOE LIGHTNING.w3x
    55.8 KB · Views: 40
This is in the wrong forum. Should be in triggers and scripts.

Never use integer A / B. They are slower and less efficient than making a custom integer and using that for your looping.

In your unit group loop this is bad to have as integer A can be at any number. I believe that should be TempInteger not Integer A.
  • Set EPIC_DrainB[(Integer A)] = True
  • Set TempInteger = (TempInteger + 1)
  • Set EPIC_DrainC = (EPIC_DrainC + 1)
  • Set TempLoc2 = (Position of (Picked unit))
  • Set EPIC_DrainU[TempInteger] = (Picked unit)
  • Lightning - Create a Drain Life lightning effect from source TempLoc to target TempLoc2
  • Set EPIC_DrainL[TempInteger] = (Last created lightning effect)
  • Custom script: call RemoveLocation(udg_TempLoc2)
Waits are bad to use. You should use timers for better more accurate less buggy timing.

Put some debug messages in your trigger for moving the lightning to see if it is actually running.

You should also make sure that your units in this array are moving. EPIC_DrainU
If they aren't moving your lightning will never move.
 
Level 28
Joined
Sep 26, 2009
Messages
2,556
  • Set EPIC_DrainB[(Integer A)] = True
  • Set TempInteger = (TempInteger + 1)
  • Set EPIC_DrainC = (EPIC_DrainC + 1)
should be:
  • Set TempInteger = (TempInteger + 1)
  • Set EPIC_DrainB[TempInteger] = True
  • Set EPIC_DrainC = (EPIC_DrainC + 1)
Then it will work.

Also, I don't understand why you use both EPIC_DrainC and TempInteger instead of only using EPIC_DrainC.
 
Status
Not open for further replies.
Top