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

Need help with spell - Custom script crashes WE

Status
Not open for further replies.
Level 9
Joined
Apr 19, 2011
Messages
447
Hi.

I need you to help me find out why a custom script in my spell is constantly crashing WE whenever I try to fix it.

Here is the trigger. The conflictive custom script is surrounded with XXXXXXXXXXX.
Note: I'm still a bit noob with custom scripts and spell-making, so please don't kill me if you see some incoherent or incorrect things. XD

  • Lightning Vortex LOOP
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Lightning_Vortex_Casters and do (Actions)
        • Loop - Actions
          • Set Key = (Key (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 7 of Key from Lightning_Vortex) Lesser than LV_T
            • Then - Actions
              • -------- Moving the central dummy with the caster --------
              • Set TempUnit = (Load 3 of Key in Lightning_Vortex)
              • Custom script: call SetUnitX(udg_TempUnit, GetUnitX(GetEnumUnit()))
              • Custom script: call SetUnitY(udg_TempUnit, GetUnitY(GetEnumUnit()))
              • -------- Moving the first secondary DUMMY --------
              • Set TempReal = (Load 2 of Key from Lightning_Vortex)
              • Set TempUnit = (Load 4 of Key in Lightning_Vortex)
              • Custom script: call SetUnitX(udg_TempUnit, GetUnitX(GetEnumUnit()) + udg_LV_L * Cos(udg_TempReal * bj_DEGTORAD))
              • Custom script: call SetUnitY(udg_TempUnit, GetUnitY(GetEnumUnit()) + udg_LV_L * Sin(udg_TempReal * bj_DEGTORAD))
              • Set TempReal = (((LV_H x (Power((Sin(((Load 6 of Key from Lightning_Vortex) / LV_Sp[((Level of Lightning Vortex for (Picked unit)) - 1)]))), 2.00))) x (Real(LV_Osc[((Level of Lightning Vortex for (Picked unit)) - 1)]))) x (100.00 x (1.00 - (Real(LV_Osc[((Level of Lightnin
              • Animation - Change TempUnit flying height to TempReal at 1000000000.00
              • -------- Moving the first LIGHTNING --------
              • Set TempReal_02 = (Load 2 of Key from Lightning_Vortex)
              • Set TempLight = (Load 0 of Key in Lightning_Vortex)
              • Custom script: call MoveLightningEx(udg_TempLight, true, GetUnitX(GetEnumUnit()), GetUnitY(GetEnumUnit()), 100, GetUnitX(GetEnumUnit()) + udg_LV_L * Cos(udg_TempReal_02 * bj_DEGTORAD), GetUnitY(GetEnumUnit()) + udg_LV_L * Sin(udg_TempReal_02 * bj_DEGTORAD), udg_TempReal)
              • -------- Moving the second secondary DUMMY --------
              • Set TempReal = (Load 2 of Key from Lightning_Vortex)
              • Set TempUnit = (Load 5 of Key in Lightning_Vortex)
              • Custom script: call SetUnitX(udg_TempUnit, GetUnitX(GetEnumUnit()) + udg_LV_L * Cos((180 + udg_TempReal) * bj_DEGTORAD))
              • Custom script: call SetUnitY(udg_TempUnit, GetUnitY(GetEnumUnit()) + udg_LV_L * Sin((180 + udg_TempReal) * bj_DEGTORAD))
              • Set TempReal = (((LV_H x (Power((Sin(((Load 6 of Key from Lightning_Vortex) / LV_Sp[((Level of Lightning Vortex for (Picked unit)) - 1)]))), 2.00))) x (Real(LV_Osc[((Level of Lightning Vortex for (Picked unit)) - 1)]))) x (100.00 x (1.00 - (Real(LV_Osc[((Level of Lightnin
              • Animation - Change TempUnit flying height to TempReal at 1000000000.00
              • -------- Moving the second LIGHTNING --------
              • Set TempReal_02 = (Load 2 of Key from Lightning_Vortex)
              • Set TempLight = (Load 1 of Key in Lightning_Vortex)
              • -------- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --------
              • Custom script: call MoveLightningEx(udg_TempLight, true, GetUnitX(GetEnumUnit()), GetUnitY(GetEnumUnit()), 100, GetUnitX(GetEnumUnit()) + udg_LV_L * Cos((180 + udg_TempReal) * bj_DEGTORAD), GetUnitY(GetEnumUnit()) + udg_LV_L * Sin((180 + udg_TempReal) * bj_DEGTORAD), 100)
              • -------- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --------
              • -------- Updating new angle for rotation --------
              • Hashtable - Save ((Load 2 of Key from Lightning_Vortex) + (LV_R x 0.03)) as 2 of Key in Lightning_Vortex
              • -------- Updating new angle for sinusoidal trayectory --------
              • Hashtable - Save ((Load 6 of Key from Lightning_Vortex) + 25.00) as 6 of (Key (Picked unit)) in Lightning_Vortex
            • Other - Actions
              • -------- Removing dummies and lightnings --------
              • Unit - Remove (Load 3 of (Key (Picked unit)) in Lightning_Vortex) from the game
              • Unit - Remove (Load 4 of (Key (Picked unit)) in Lightning_Vortex) from the game
              • Unit - Remove (Load 5 of (Key (Picked unit)) in Lightning_Vortex) from the game
              • Lightning - Destroy (Load 0 of (Key (Picked unit)) in Lightning_Vortex)
              • Lightning - Destroy (Load 1 of (Key (Picked unit)) in Lightning_Vortex)
              • Unit Group - Remove (Picked unit) from Lightning_Vortex_Casters
Well, I need to change that custom script with this one:

  • Custom script: call MoveLightningEx(udg_TempLight, true, GetUnitX(GetEnumUnit()), GetUnitY(GetEnumUnit()), 100, GetUnitX(GetEnumUnit()) + udg_LV_L * Cos((180 + udg_TempReal_02) * bj_DEGTORAD), GetUnitY(GetEnumUnit()) + udg_LV_L * Sin((180 + udg_TempReal_02) * bj_DEGTORAD), udg_TempReal)
But whenever I make this change, WE crashes.
:goblin_wtf:

Someone knows what could be the reason? I don't even know if this trigger works in-game, because I can't finish it without crashing WE.
If you nedd to see the main trigger where the spell starts, or the setup trigger where the used variables are defined, just ask for it, I'll post it.

Regards
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Had problems with long custom scripts as well.. Try saving some stuff in variables to shorten the code. I experienced that too long custom scripts crash WE..

Edit:

Looking at the code that should be replaced, and the code that should replace it: It is abit longer, which might thus be the problem..
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
It crashes WE, not the game. Thus it cannot be because of moving a non-existent lightning, because WE doesnt care whether it exists or not, only when playing the game this matters..
 
Status
Not open for further replies.
Top