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

Why does it crash

Status
Not open for further replies.
Level 4
Joined
Aug 22, 2008
Messages
100
Why does it crash?

This is a spell creating a ring of lightning balls pushing enemies away from the field when they come near (they are pushed out when trying to enter and pushed in when trying to leave) this ring also follows the casting unit.

This spell sometimes make the game crash. Can anyone detect why?

  • Energy Field
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Energy Field
    • Actions
      • Set EnergyFieldCaster = (Triggering unit)
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Set PositionSpawnEnergyField1 = (Position of EnergyFieldCaster)
          • Set PositionSpawnEnergyField2[(Integer A)] = (PositionSpawnEnergyField1 offset by 525.00 towards ((Real((Integer A))) x 22.50) degrees)
          • Unit - Create 1 Energy Field for (Owner of EnergyFieldCaster) at PositionSpawnEnergyField2[(Integer A)] facing Default building facing degrees
          • Set EnergyFieldDummy[(Integer A)] = (Last created unit)
      • Trigger - Turn on Energy Field Loop <gen>
      • Wait (5.00 + (3.00 x (Real((Level of Energy Field for EnergyFieldCaster))))) seconds
      • Trigger - Turn off Energy Field Loop <gen>
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Unit - Remove EnergyFieldDummy[(Integer A)] from the game
      • For each (Integer A) from 1 to EnergyFieldLightningCount, do (Actions)
        • Loop - Actions
          • Lightning - Destroy EnergyFieldLightningEffects[(Integer A)]
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[1])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[2])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[3])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[4])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[5])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[6])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[7])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[8])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[9])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[10])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[11])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[12])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[13])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[14])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[15])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[16])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField1)
  • Energy Field Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to EnergyFieldLightningCount, do (Actions)
        • Loop - Actions
          • Lightning - Destroy EnergyFieldLightningEffects[(Integer A)]
      • Set EnergyFieldLightningCount = 0
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Set EnergyFieldDummyPosition = (Position of EnergyFieldDummy[(Integer A)])
          • Set EnergyFieldPushedUnits = (Units within 175.00 of EnergyFieldDummyPosition matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of EnergyFieldCaster)) Equal to True) and (((Matching unit) is A structure) Not equal to True))))
          • Unit Group - Pick every unit in EnergyFieldPushedUnits and do (Actions)
            • Loop - Actions
              • Set EnergyFieldPushedFrom = (Position of (Picked unit))
              • Set EnergyFieldPushedTo = (EnergyFieldPushedFrom offset by 35.00 towards (Angle from EnergyFieldDummyPosition to EnergyFieldPushedFrom) degrees)
              • Unit - Move (Picked unit) instantly to EnergyFieldPushedTo
              • Lightning - Create a Chain Lightning - Primary lightning effect from source EnergyFieldDummyPosition to target EnergyFieldPushedFrom
              • Set EnergyFieldLightningCount = (EnergyFieldLightningCount + 1)
              • Set EnergyFieldLightningEffects[EnergyFieldLightningCount] = (Last created lightning effect)
      • Set PositionSpawnEnergyField1 = (Position of EnergyFieldCaster)
      • Unit Group - Remove all units of EnergyFieldPushedUnits from EnergyFieldPushedUnits
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Set PositionSpawnEnergyField2[(Integer A)] = (PositionSpawnEnergyField1 offset by 475.00 towards ((Real((Integer A))) x 22.50) degrees)
          • Unit - Move EnergyFieldDummy[(Integer A)] instantly to PositionSpawnEnergyField2[(Integer A)]
      • Custom script: call DestroyGroup (udg_EnergyFieldPushedUnits)
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[1])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[2])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[3])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[4])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[5])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[6])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[7])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[8])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[9])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[10])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[11])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[12])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[13])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[14])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[15])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField2[16])
      • Custom script: call RemoveLocation (udg_PositionSpawnEnergyField1)
      • Custom script: call RemoveLocation (udg_EnergyFieldPushedFrom)
      • Custom script: call RemoveLocation (udg_EnergyFieldPushedTo)
      • Custom script: call RemoveLocation (udg_EnergyFieldDummyPosition)
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
1. Don't use wait.
2. What's with all these custom scripts? If you want to remove this much of locations you just have to make a loop, insert the custom script here and change the index to the loop's integer.
3. To make such a spell, all you have to do is to make a unit group, store the units in the circle then check their distances from the center. If it's bigger than e.g.500 units then you move the unit closer to the circle, if it's lower than 100 units then you just move the unit further.
 
Status
Not open for further replies.
Top