• 🏆 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] Why does this lag like hell?

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

I have a spell in the campaign in campaign called Glacial Ball. It's a hero spell with five levels. When the spell is cast the game start to lag like hell. Even after the spell is cast the game still lags. I really wonder why and how this can be solved. Otherwise I have to remove this spell sooner or later.

Here is the trigger of the spell.

  • Glacial Ball AS
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Glacial Ball (G, B, 2, U)
    • Actions
      • Set TempLoc = (Position of AAAGaleoth)
      • Set TempLoc2 = (TempLoc offset by 100.00 towards (Facing of (Casting unit)) degrees)
      • Set TempLoc3 = ((Target point of ability being cast) offset by 1500.00 towards (Facing of (Casting unit)) degrees)
      • Unit - Create 1 Glacial Orb Dummy 1 for (Owner of (Casting unit)) at TempLoc2 facing Default building facing degrees
      • Set Glacial_Orb_Unit = (Last created unit)
      • Unit - Order (Last created unit) to Move To TempLoc3
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: call RemoveLocation(udg_TempLoc2)
      • Custom script: call RemoveLocation(udg_TempLoc3)
      • For each (Integer Glacial_Orb_Integer_1) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set TempLoc4 = (Position of Glacial_Orb_Unit)
          • Set TempGroup2 = (Units owned by Neutral Hostile)
          • Set TempGroup = (Units within 250.00 of TempLoc4 matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is in TempGroup2) Equal to True) and (((Matching unit) has buff Invulnerable) Equal to False))))
          • Set Damage_AAA_Spell = (((Real((Level of Glacial Ball (G, B, 2, U) for (Casting unit)))) x 30.00) + (((Real((Intelligence of (Casting unit) (Include bonuses)))) x 3.00) + (((Real((Charges remaining in (Item carried by (Casting unit) of type Low Magic Ball)))) x 10.00) + (((Real((Ch
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Unit - Cause (Casting unit) to damage (Picked unit), dealing Damage_AAA_Spell damage of attack type Spells and damage type Normal
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using war3campImported\Shiva'sWrath.mdx
              • Set Glacial_Orb_SE[Glacial_Orb_Integer] = (Last created special effect)
          • Custom script: call RemoveLocation(udg_TempLoc3)
          • Custom script: call DestroyGroup(udg_TempGroup2)
          • Custom script: call DestroyGroup(udg_TempGroup)
          • Wait 1.00 seconds
          • Special Effect - Destroy Glacial_Orb_SE[Glacial_Orb_Integer]
Spell uses this model as missile:

Frozen Orb - The Hive Workshop - A Warcraft III Modding Site
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
  • Set TempLoc3 = ((Target point of ability being cast) offset by 1500.00 towards (Facing of (Casting unit)) degrees)
Location leak.

  • Special Effect - Create a special effect attached to the origin of (Picked unit) using war3campImported\Shiva'sWrath.mdx
((Number of units in your group)-1) leaks.
 
Level 20
Joined
Apr 22, 2007
Messages
1,960
Wouldn't an infinite loop just thread crash?

Fix your code and THEN ask again because it's way too hard to go through this pile of shit.
Also, don't put waits inside loops. These loops are handled with global integer iterators, so if someone else casts it in the meantime, the whole thing will fuck up. And I really don't know what this spell is supposed to accomplish either so if you could give more light on that it would help.
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
HINDYhat said:
Wouldn't an infinite loop just thread crash?
I think so. The game only lags in the game while doing/after spell is cast.

HINDYhat said:
Fix your code and THEN ask again because it's way too hard to go through this pile of shit.
Why? It works perfectly in the campaign and it only gives this horrible lag.

HINDYhat said:
Also, don't put waits inside loops. These loops are handled with global integer iterators, so if someone else casts it in the meantime, the whole thing will fuck up.
No problem with that, this can be cast only once / time.


EDIT: It's like this now:

  • Glacial Ball AS
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Glacial Ball (G, B, 2, U)
    • Actions
      • Set TempLoc = (Position of AAAGaleoth)
      • Set TempLoc2 = (TempLoc offset by 100.00 towards (Facing of (Casting unit)) degrees)
      • Set TempLoc3 = ((Target point of ability being cast) offset by 1500.00 towards (Facing of (Casting unit)) degrees)
      • Unit - Create 1 Glacial Orb Dummy 1 for (Owner of (Casting unit)) at TempLoc2 facing Default building facing degrees
      • Set Glacial_Orb_Unit = (Last created unit)
      • Unit - Order (Last created unit) to Move To TempLoc3
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: call RemoveLocation(udg_TempLoc2)
      • Custom script: call RemoveLocation(udg_TempLoc3)
      • For each (Integer Glacial_Orb_Integer_1) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set TempLoc4 = (Position of Glacial_Orb_Unit)
          • Set TempGroup2 = (Units owned by Neutral Hostile)
          • Set TempGroup = (Units within 250.00 of TempLoc4 matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is in TempGroup2) Equal to True) and (((Matching unit) has buff Invulnerable) Equal to False))))
          • Set Damage_AAA_Spell = (((Real((Level of Glacial Ball (G, B, 2, U) for (Casting unit)))) x 30.00) + (((Real((Intelligence of (Casting unit) (Include bonuses)))) x 3.00) + (((Real((Charges remaining in (Item carried by (Casting unit) of type Low Magic Ball)))) x 10.00) + (((Real((Ch
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Unit - Cause (Casting unit) to damage (Picked unit), dealing Damage_AAA_Spell damage of attack type Spells and damage type Normal
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using war3campImported\Shiva'sWrath.mdx
              • Set Glacial_Orb_SE[Glacial_Orb_Integer_2] = (Last created special effect)
          • Custom script: call RemoveLocation(udg_TempLoc4)
          • Custom script: call DestroyGroup(udg_TempGroup2)
          • Custom script: call DestroyGroup(udg_TempGroup)
          • Wait 1.00 seconds
          • Special Effect - Destroy Glacial_Orb_SE[Glacial_Orb_Integer_2]
 
Level 15
Joined
Dec 18, 2007
Messages
1,098
It still leaks. Only 1 specal effect is destroyed everytime the loop is runned.
Actually, you could just ask the creator to edit the model so the first 1 second of its death animation shows the model itself, then you can just destroy the effect right after you create it.
Other than that, I dunno what's the problem.
 
Status
Not open for further replies.
Top