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

[Trigger] WE Crash when I use Lightning Array Variable?

Status
Not open for further replies.

Rheiko

Spell Reviewer
Level 25
Joined
Aug 27, 2013
Messages
4,121
Hi guys,
i'm trying to make this spell for Gimli_2 but i forgot to index the lightning
so when i change the lightning variable into an array, still nothing bad happens
when i change the custom script from
JASS:
set udg_LH_Lightning = AddLightningEx(udg_LH_Lightning_Type, true , GetLocationX(udg_TempPoint3), GetLocationY(udg_TempPoint3), GetLocationZ(udg_TempPoint3) + 70, GetLocationX(udg_TempPoint3), GetLocationY(udg_TempPoint3), GetLocationZ(udg_TempPoint3) + 70)
into
JASS:
set udg_LH_Lightning[udg_LH_Max_Index] = AddLightningEx(udg_LH_Lightning_Type, true , GetLocationX(udg_TempPoint3), GetLocationY(udg_TempPoint3), GetLocationZ(udg_TempPoint3) + 70, GetLocationX(udg_TempPoint3), GetLocationY(udg_TempPoint3), GetLocationZ(udg_TempPoint3) + 70)
World Editor Crash
maybe you can help me fixing it with your WE cuz maybe my laptop is the problem, i don't know the reason either

and also if you want the full trigger, here it is
[highlight]Note: This Trigger isn't completed yet, if i did something wrong feel free to tell me[/code]
  • Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ---------------------------------------------- --------
      • -------- GENERAL CONFIGURATION --------
      • -------- ---------------------------------------------- --------
      • -------- Store your ability here --------
      • Set LH_Ability_ID = Lightning Hook
      • -------- Store your dummy here --------
      • Set LH_Dummy_Type = Hook
      • -------- Your Ability Damage --------
      • Set LH_Damage[1] = 150.00
      • Set LH_Damage[2] = 225.00
      • Set LH_Damage[3] = 300.00
      • -------- Your Ability Damage Type --------
      • Set LH_DamageType = Lightning
      • -------- Your Ability Attack Type --------
      • Set LH_AttackType = Spells
      • -------- Your lightning type --------
      • Set LH_Lightning_Type = Chain Lightning - Primary
      • -------- Your lightning color (RGB) --------
      • Set LH_Lightning_Red = 100.00
      • Set LH_Lightning_Green = 100.00
      • Set LH_Lightning_Blue = 100.00
      • -------- Your missile speed --------
      • Set LH_Missile_Speed = 1500.00
      • -------- Area of Effect --------
      • Set LH_AoE = 150.00
      • -------- Where the hook spawn at? --------
      • Set LH_Start_Range = 100.00
      • Set LH_Special_Effect =
      • -------- You want to Destroy Tree? If yes, "True". If no, "False" --------
      • Set LH_DestroyTree = True
      • -------- ---------------------------------------------------------- --------
      • -------- CONDITION CONFIGURATION --------
      • -------- ---------------------------------------------------------- --------
      • -------- Belongs to an Ally --------
      • Set LH_Condition[1] = False
      • -------- Belongs to an Enemy --------
      • Set LH_Condition[2] = True
      • -------- Structure --------
      • Set LH_Condition[3] = False
      • -------- Magic Immune --------
      • Set LH_Condition[4] = False
      • -------- Alive --------
      • Set LH_Condition[5] = True
      • -------- Unit is in UnDamage Group (to prevent damage looping) --------
      • Set LH_Condition[6] = False
      • -------- ---------------------------------------------------------- --------
      • -------- END OF CONFIGURATION --------
      • -------- ---------------------------------------------------------- --------
      • -------- DO NOT CHANGE THIS --------
      • -------- ---------------------------------------------------------- --------
      • Set TempPoint = (Center of (Playable map area))
      • Unit - Create 1 Peasant for Neutral Passive at TempPoint facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Set LH_TreeDestroyer = (Last created unit)
      • Unit - Hide LH_TreeDestroyer
      • -------- ---------------------------------------------------------- --------
      • -------- ---------------------------------------------------------- --------
  • Lightning Hook
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to LH_Ability_ID
    • Actions
      • Set LH_Max_Index = (LH_Max_Index + 1)
      • Set LH_Owner[LH_Max_Index] = (Triggering player)
      • Set LH_Caster[LH_Max_Index] = (Triggering unit)
      • Set LH_Target[LH_Max_Index] = (Target unit of ability being cast)
      • Set LH_Ability_Level[LH_Max_Index] = (Level of LH_Ability_ID for LH_Caster[LH_Max_Index])
      • Set TempPoint = (Position of LH_Caster[LH_Max_Index])
      • Set TempPoint2 = (Position of LH_Target[LH_Max_Index])
      • Set LH_Angle[LH_Max_Index] = (Angle from TempPoint to TempPoint2)
      • Set TempPoint3 = (TempPoint offset by LH_Start_Range towards LH_Angle[LH_Max_Index] degrees)
      • Unit - Create 1 LH_Dummy_Type for LH_Owner[LH_Max_Index] at TempPoint3 facing LH_Angle[LH_Max_Index] degrees
      • Set LH_Dummy[LH_Max_Index] = (Last created unit)
      • Custom script: set udg_LH_Lightning = AddLightningEx(udg_LH_Lightning_Type, true , GetLocationX(udg_TempPoint3), GetLocationY(udg_TempPoint3), GetLocationZ(udg_TempPoint3) + 70, GetLocationX(udg_TempPoint3), GetLocationY(udg_TempPoint3), GetLocationZ(udg_TempPoint3) + 70)
      • Set LH_Stage[LH_Max_Index] = 1
      • Custom script: set udg_LH_UnDamage_Group[udg_LH_Max_Index] = CreateGroup()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LH_Max_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Loop <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call RemoveLocation(udg_TempPoint3)
  • Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer LH_Current_Index) from 1 to LH_Max_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LH_Stage[LH_Current_Index] Equal to 1
            • Then - Actions
              • Set TempPoint = (Position of LH_Caster[LH_Current_Index])
              • Set TempPoint2 = (Position of LH_Dummy[LH_Current_Index])
              • Set TempPoint3 = (Position of LH_Target[LH_Current_Index])
              • Set LH_Angle[LH_Current_Index] = (Angle from TempPoint2 to TempPoint3)
              • Set TempPoint4 = (TempPoint2 offset by (LH_Missile_Speed x 0.03) towards LH_Angle[LH_Current_Index] degrees)
              • Unit - Move LH_Dummy[LH_Current_Index] instantly to TempPoint4
              • Custom script: call MoveLightningEx(udg_LH_Lightning, true , GetLocationX(udg_TempPoint), GetLocationY(udg_TempPoint), GetLocationZ(udg_TempPoint) + 70, GetLocationX(udg_TempPoint2), GetLocationY(udg_TempPoint2), GetLocationZ(udg_TempPoint2) + 70)
              • Set LH_Damage_Group = (Units within LH_AoE of TempPoint2)
              • Unit Group - Pick every unit in LH_Damage_Group and do (Actions)
                • Loop - Actions
                  • Set TempUnit = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (TempUnit belongs to an ally of LH_Owner[LH_Current_Index]) Equal to LH_Condition[1]
                      • (TempUnit belongs to an enemy of LH_Owner[LH_Current_Index]) Equal to LH_Condition[2]
                      • (TempUnit is A structure) Equal to LH_Condition[3]
                      • (TempUnit is Magic Immune) Equal to LH_Condition[4]
                      • (TempUnit is alive) Equal to LH_Condition[5]
                      • (TempUnit is in LH_UnDamage_Group[LH_Current_Index]) Equal to LH_Condition[6]
                    • Then - Actions
                      • Unit - Cause LH_Caster[LH_Current_Index] to damage TempUnit, dealing LH_Damage[LH_Ability_Level[LH_Current_Index]] damage of attack type LH_AttackType and damage type LH_DamageType
                      • Unit Group - Add TempUnit to LH_UnDamage_Group[LH_Current_Index]
                    • Else - Actions
              • Custom script: call DestroyGroup(udg_LH_Damage_Group)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LH_DestroyTree Equal to True
                • Then - Actions
                  • Destructible - Pick every destructible within LH_AoE of TempPoint2 and do (Actions)
                    • Loop - Actions
                      • Set TempDest = (Picked destructible)
                      • Unit - Order LH_TreeDestroyer to Harvest TempDest
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Current order of LH_TreeDestroyer) Equal to (Order(harvest))
                        • Then - Actions
                          • Destructible - Kill TempDest
                        • Else - Actions
                      • Unit - Order LH_TreeDestroyer to Stop
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between TempPoint2 and TempPoint3) Less than or equal to 100.00
                • Then - Actions
                  • Set LH_Stage[LH_Current_Index] = 2
                  • Custom script: call DestroyGroup(udg_LH_UnDamage_Group[udg_LH_Current_Index])
                  • Custom script: set udg_LH_UnDamage_Group[udg_LH_Current_Index] = CreateGroup()
                • Else - Actions
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Custom script: call RemoveLocation(udg_TempPoint2)
              • Custom script: call RemoveLocation(udg_TempPoint3)
              • Custom script: call RemoveLocation(udg_TempPoint4)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LH_Stage[LH_Current_Index] Equal to 2
                • Then - Actions
                  • Set TempPoint = (Position of LH_Caster[LH_Current_Index])
                  • Set TempPoint2 = (Position of LH_Dummy[LH_Current_Index])
                  • Set TempPoint3 = (Position of LH_Target[LH_Current_Index])
                  • Set LH_Angle[LH_Current_Index] = (Angle from TempPoint3 to TempPoint)
                  • Set TempPoint4 = (TempPoint2 offset by (LH_Missile_Speed x 0.03) towards LH_Angle[LH_Current_Index] degrees)
                  • Unit - Move LH_Dummy[LH_Current_Index] instantly to TempPoint4
                  • Unit - Move LH_Target[LH_Current_Index] instantly to TempPoint2
                  • Custom script: call MoveLightningEx(udg_LH_Lightning, true , GetLocationX(udg_TempPoint), GetLocationY(udg_TempPoint), GetLocationZ(udg_TempPoint) + 70, GetLocationX(udg_TempPoint2), GetLocationY(udg_TempPoint2), GetLocationZ(udg_TempPoint2) + 70)
                  • Set LH_Damage_Group = (Units within LH_AoE of TempPoint2)
                  • Unit Group - Pick every unit in LH_Damage_Group and do (Actions)
                    • Loop - Actions
                      • Set TempUnit = (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (TempUnit belongs to an ally of LH_Owner[LH_Current_Index]) Equal to LH_Condition[1]
                          • (TempUnit belongs to an enemy of LH_Owner[LH_Current_Index]) Equal to LH_Condition[2]
                          • (TempUnit is A structure) Equal to LH_Condition[3]
                          • (TempUnit is Magic Immune) Equal to LH_Condition[4]
                          • (TempUnit is alive) Equal to LH_Condition[5]
                          • (TempUnit is in LH_UnDamage_Group[LH_Current_Index]) Equal to LH_Condition[6]
                        • Then - Actions
                          • Unit - Cause LH_Caster[LH_Current_Index] to damage TempUnit, dealing LH_Damage[LH_Ability_Level[LH_Current_Index]] damage of attack type LH_AttackType and damage type LH_DamageType
                          • Unit Group - Add TempUnit to LH_UnDamage_Group[LH_Current_Index]
                        • Else - Actions
                  • Custom script: call DestroyGroup(udg_LH_Damage_Group)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • LH_DestroyTree Equal to True
                    • Then - Actions
                      • Destructible - Pick every destructible within LH_AoE of TempPoint2 and do (Actions)
                        • Loop - Actions
                          • Set TempDest = (Picked destructible)
                          • Unit - Order LH_TreeDestroyer to Harvest TempDest
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Current order of LH_TreeDestroyer) Equal to (Order(harvest))
                            • Then - Actions
                              • Destructible - Kill TempDest
                            • Else - Actions
                          • Unit - Order LH_TreeDestroyer to Stop
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between TempPoint2 and TempPoint) Less than or equal to 100.00
                    • Then - Actions
                      • Custom script: call DestroyGroup(udg_LH_UnDamage_Group[udg_LH_Current_Index])
                      • Custom script: set udg_LH_UnDamage_Group[udg_LH_Current_Index] = CreateGroup()
                      • Lightning - Destroy LH_Lightning
                      • Unit - Remove LH_Dummy[LH_Current_Index] from the game
                      • Set LH_Ability_Level[LH_Current_Index] = LH_Ability_Level[LH_Max_Index]
                      • Set LH_Ability_Level[LH_Max_Index] = 0
                      • Set LH_Angle[LH_Current_Index] = LH_Angle[LH_Max_Index]
                      • Set LH_Angle[LH_Max_Index] = 0.00
                      • Set LH_Caster[LH_Current_Index] = LH_Caster[LH_Max_Index]
                      • Set LH_Caster[LH_Max_Index] = No unit
                      • Set LH_Dummy[LH_Current_Index] = LH_Dummy[LH_Max_Index]
                      • Set LH_Dummy[LH_Max_Index] = No unit
                      • Set LH_Target[LH_Current_Index] = LH_Target[LH_Max_Index]
                      • Set LH_Target[LH_Max_Index] = No unit
                      • Set LH_Current_Index = (LH_Current_Index - 1)
                      • Set LH_Max_Index = (LH_Max_Index - 1)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • LH_Max_Index Equal to 0
                        • Then - Actions
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
                    • Else - Actions
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Custom script: call RemoveLocation(udg_TempPoint2)
                  • Custom script: call RemoveLocation(udg_TempPoint3)
                  • Custom script: call RemoveLocation(udg_TempPoint4)
                • Else - Actions
and here's the test map
Lightning Hook
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
shorten down all names of variables used in custom script. Custom scripts just like Comments have a maximum number of letters they can contain, else they freeze and crash WE.

So instead of this:
JASS:
set udg_LH_Lightning = AddLightningEx(udg_LH_Lightning_Type, true , GetLocationX(udg_TempPoint3), GetLocationY(udg_TempPoint3), GetLocationZ(udg_TempPoint3) + 70, GetLocationX(udg_TempPoint3), GetLocationY(udg_TempPoint3), GetLocationZ(udg_TempPoint3) + 70)


Change it to for example this:
JASS:
set udg_LH_Lightning = AddLightningEx(udg_LH_L_Type, true , GetLocationX(udg_p1), GetLocationY(udg_p1), GetLocationZ(udg_p1) + 70, GetLocationX(udg_p1), GetLocationY(udg_p1), GetLocationZ(udg_p1) + 70)

You can also change the names of both LH_Lightning and LH_Lightning_Type to something shorter (like in the code above) or for example use a global lightning called simply "L", use this L variable in the custom script to shorten it and then you use this:
  • Set LH_Lightning = L
  • Custom Script: set udg_L = null
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
This is my problem too but when I shorten and I do not add an array in lightning it works fine from me.

EDIT: Your not de-indexing or recycling the stages o_O .

EDIT 2nd: I forgot to tell you this.. Custom Script's Characters must have only less than 260 characters ( so you have a chance to count character to prevent crash ^^ ) , counting characters in the custom scripts is including spaces and parenthesis.
 

Rheiko

Spell Reviewer
Level 25
Joined
Aug 27, 2013
Messages
4,121
EDIT: Your not de-indexing or recycling the stages o_O .
Note: This Trigger isn't completed yet, if i did something wrong feel free to tell me
that

jakeZinc2418979 said:
EDIT 2nd: I forgot to tell you this.. Custom Script's Characters must have only less than 260 characters ( so you have a chance to count character to prevent crash ^^ ) , counting characters in the custom scripts is including spaces and parenthesis.
thanks for the info
 
Status
Not open for further replies.
Top