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

Game crash

Status
Not open for further replies.
Level 2
Joined
Jul 21, 2020
Messages
14
Hi,

when I cast this ability about 50 to 100 times the game crashes, can it be that when you save too many units in variables Warcraft is overloaded?
How can I solve this problem?

  • Alpha Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to SpAlphaStrike
    • Actions
      • -------- Set General Variables --------
      • Set VariableSet SPG_ALS_Spell = SpAlphaStrike
      • Set VariableSet SPG_ALS_DamageFlatt = SpAlphaStrikeFlatt
      • Set VariableSet SPG_ALS_DamageFlattF = SpAlphaStrikeFlattF
      • Set VariableSet SPG_ALS_DamagePercent = SpAlphaStrikePercent
      • Set VariableSet SPG_ALS_DamagePercentF = SpAlphaStrikePercentF
      • Set VariableSet SPG_ALS_DamageUnitTrigger = HeroBlademaster
      • Set VariableSet SPG_ALS_DamageAbilityLevel = (Real((Level of SPG_ALS_Spell for SPG_ALS_DamageUnitTrigger)))
      • Set VariableSet SPG_ALS_DamageStats = Hero_Damage[(Player number of (Owner of SPG_ALS_DamageUnitTrigger))]
      • -------- Calculate Damage --------
      • Set VariableSet SpAlphaStrikeDamage = (((SPG_ALS_DamageFlatt x SPG_ALS_DamageAbilityLevel) + SPG_ALS_DamageFlattF) + (SPG_ALS_DamageStats x ((SPG_ALS_DamageAbilityLevel x SPG_ALS_DamagePercent) + SPG_ALS_DamagePercentF)))
      • -------- Spell --------
      • Unit - Hide HeroBlademaster
      • Set VariableSet SpAlphaStrikeEnemis[0] = (Target unit of ability being cast)
      • Set VariableSet SpAlphaStrikePoint = (Position of SPG_ALS_DamageUnitTrigger)
      • For each (Integer A) from 0 to (((Integer(SPG_ALS_DamageAbilityLevel)) x 2) + 2), do (Actions)
        • Loop - Actions
          • Special Effect - Create a special effect attached to the origin of SpAlphaStrikeEnemis[(Integer A)] using Objects\Spawnmodels\Human\HumanBlood\HumanBloodPriest.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Create 1 AlphaStrike (Dummy) for (Owner of SPG_ALS_DamageUnitTrigger) at SpAlphaStrikePoint facing 0.00 degrees
          • Unit - Set Base Damage of (Last created unit) to (Integer(SpAlphaStrikeDamage)) for weapon index: 0
          • Unit - Order (Last created unit) to Attack SpAlphaStrikeEnemis[(Integer A)]
          • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_SpAlphaStrikePoint)
          • Set VariableSet SpAlphaStrikePoint = (Position of SpAlphaStrikeEnemis[(Integer A)])
          • Unit Group - Pick every unit in (Units within 500.00 of SpAlphaStrikePoint.) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[0]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[1]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[2]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[3]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[4]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[5]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[6]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[7]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[8]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[9]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[10]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[11]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[12]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[13]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[14]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[15]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[16]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[17]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[18]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[19]
                  • (Picked unit) Not equal to SpAlphaStrikeEnemis[20]
                  • ((Picked unit) is alive) Equal to Wahr
                  • ((Owner of (Picked unit)) is an enemy of (Owner of SPG_ALS_DamageUnitTrigger).) Equal to Wahr
                • Then - Actions
                  • Set VariableSet SpAlphaStrikeEnemis[((Integer A) + 1)] = (Picked unit)
                • Else - Actions
      • Wait 1.00 seconds
      • Unit - Move HeroBlademaster instantly to SpAlphaStrikePoint
      • Unit - Unhide HeroBlademaster
      • Selection - Select HeroBlademaster for (Owner of SPG_ALS_DamageUnitTrigger)
      • For each (Integer A) from 0 to 20, do (Actions)
        • Loop - Actions
          • Set VariableSet SpAlphaStrikeEnemis[(Integer A)] = No unit
      • Custom script: call RemoveLocation(udg_SpAlphaStrikePoint)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
I assume this is the culprit:
  • Selection - Select HeroBlademaster for (Owner of SPG_ALS_DamageUnitTrigger)

Also, you could simplify this trigger by using a Unit Group and an Integer to track the limit. Something close to this:
  • Actions
    • Set VariableSet AlphaLimit = 20
    • Set VariableSet AlphaGroup = (Units within 512.00 of (Center of (Playable map area)).)
    • Unit Group - Pick every unit in AlphaGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) is in AlphaGroup.) Equal to False
            • ((Picked unit) is invulnerable) Equal to False
            • ((Picked unit) is alive) Equal to True
            • ((Picked unit) belongs to an enemy of AlphaPlayer.) Equal to True
          • Then - Actions
            • Unit Group - Add (Picked unit) to AlphaGroup
            • Set VariableSet AlphaCounter = (AlphaCounter + 1)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • AlphaCounter Equal to AlphaLimit
              • Then - Actions
                • Skip remaining actions
              • Else - Actions
          • Else - Actions
 
Level 2
Joined
Jul 21, 2020
Messages
14
Thank you for the quick reply.
I disabled the line and tried again, but the game crashed again the 99th or 100th time the ability was cast.
I hope I counted correctly.

The idea of your simplification does not fulfil the effect of the ability, I don't want to deal damage in a certain area, but with every unit he deals damage, the area should be recalculated. So that, for example, he damages all enemies standing in a row and not just the first 3.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Yeah, you'd have to tweak my example slightly, which is why I said "close to this". I can whip up a proper example sometime soon.

But basically, you'd destroy/create the unit group/point again and again. The rest of the logic pretty much stays the same.

Oh and I just noticed you're leaking A LOT of Unit Groups. I would make sure to clean those up:
  • Unit Group - Pick every unit in (Units within 500.00 of SpAlphaStrikePoint.) and do (Actions)

Some other things to try / possible issues:
  • Change (Integer A) to a new Integer variable that you use exclusively for this spell.
  • Add Conditions to make sure the Dummy unit doesn't get created on Invulnerable units and things that can't be attacked.
  • Order the Dummy units to Attack Once / Manage what happens if the Dummy's target dies. What's stopping them from finding new targets?
  • Not sure what these SPG variables are for or where they come from but maybe they could be the source of the problem.

Edit: Actually, the more I look at your trigger the more issues I see. You're creating Dummy units regardless of whether there are targets. You should only be creating 1 Dummy unit per target as far as I understand.
 
Level 2
Joined
Jul 21, 2020
Messages
14
I have changed my trigger a little and unfortunately it still crashes when I cast the ability about 100 times.

How can I prevent my dummy from attacking more than one or a new target?

  • Alpha Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to SpAlphaStrike
    • Actions
      • -------- Set General Variables --------
      • Set VariableSet SPG_ALS_Spell = SpAlphaStrike
      • Set VariableSet SPG_ALS_DamageFlatt = SpAlphaStrikeFlatt
      • Set VariableSet SPG_ALS_DamageFlattF = SpAlphaStrikeFlattF
      • Set VariableSet SPG_ALS_DamagePercent = SpAlphaStrikePercent
      • Set VariableSet SPG_ALS_DamagePercentF = SpAlphaStrikePercentF
      • Set VariableSet SPG_ALS_DamageUnitTrigger = HeroBlademaster
      • Set VariableSet SPG_ALS_DamageAbilityLevel = (Real((Level of SPG_ALS_Spell for SPG_ALS_DamageUnitTrigger)))
      • Set VariableSet SPG_ALS_DamageStats = Hero_Damage[(Player number of (Owner of SPG_ALS_DamageUnitTrigger))]
      • -------- Calculate Damage --------
      • Set VariableSet SpAlphaStrikeDamage = (((SPG_ALS_DamageFlatt x SPG_ALS_DamageAbilityLevel) + SPG_ALS_DamageFlattF) + (SPG_ALS_DamageStats x ((SPG_ALS_DamageAbilityLevel x SPG_ALS_DamagePercent) + SPG_ALS_DamagePercentF)))
      • -------- Spell --------
      • Unit - Hide HeroBlademaster
      • Set VariableSet SpAlphaStrikeEnemy = (Target unit of ability being cast)
      • Set VariableSet SpAlphaStrikePoint = (Position of SPG_ALS_DamageUnitTrigger)
      • Set VariableSet SpAlphaStrikeJumps = (Integer(((SPG_ALS_DamageAbilityLevel x 2.00) + 2.00)))
      • For each (Integer SpAlphaStrikeInt) from 0 to SpAlphaStrikeJumps, do (Actions)
        • Loop - Actions
          • Unit Group - Add SpAlphaStrikeEnemy to SpAlphaStrikeGroupE
          • Special Effect - Create a special effect attached to the origin of SpAlphaStrikeEnemy using Objects\Spawnmodels\Human\HumanBlood\HumanBloodPriest.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Create 1 AlphaStrike (Dummy) for (Owner of SPG_ALS_DamageUnitTrigger) at SpAlphaStrikePoint facing 0.00 degrees
          • Unit - Set Base Damage of (Last created unit) to (Integer(SpAlphaStrikeDamage)) for weapon index: 0
          • Unit - Order (Last created unit) to Attack SpAlphaStrikeEnemy
          • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_SpAlphaStrikePoint)
          • Set VariableSet SpAlphaStrikePoint = (Position of SpAlphaStrikeEnemy)
          • Unit Group - Add all units of (Units within 500.00 of SpAlphaStrikePoint.) to SpAlphaStrikeGroup
          • Unit Group - Pick every unit in SpAlphaStrikeGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is in SpAlphaStrikeGroupE.) Equal to Falsch
                  • ((Picked unit) is invulnerable) Equal to Falsch
                  • ((Picked unit) is alive) Equal to Wahr
                  • ((Owner of (Picked unit)) is an enemy of (Owner of SPG_ALS_DamageUnitTrigger).) Equal to Wahr
                • Then - Actions
                  • Set VariableSet SpAlphaStrikeEnemy = (Picked unit)
                • Else - Actions
          • If ((SpAlphaStrikeEnemy is in SpAlphaStrikeGroupE.) Equal to Wahr) then do (Set VariableSet SpAlphaStrikeInt = SpAlphaStrikeJumps) else do (Do nothing)
          • Unit Group - Remove all units from SpAlphaStrikeGroup.
      • Wait 1.00 seconds
      • Unit - Move HeroBlademaster instantly to SpAlphaStrikePoint
      • Unit - Unhide HeroBlademaster
      • Selection - Select HeroBlademaster for (Owner of SPG_ALS_DamageUnitTrigger)
      • Unit Group - Remove all units from SpAlphaStrikeGroupE.
      • Set VariableSet SpAlphaStrikeInt = 0
      • Custom script: call RemoveLocation(udg_SpAlphaStrikePoint)
 
Level 2
Joined
Jul 21, 2020
Messages
14
I found the error, it was the special effect. I switched it off and now it works.
But why doesn't it work with it?
 
Status
Not open for further replies.
Top