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

Mirror Image Crash

Status
Not open for further replies.
Level 8
Joined
Jul 8, 2013
Messages
249
I've recently run into a peculiar problem where my map crashes when I have a unit cast a mirror image spell.

I have narrowed the cause of the crash down to this trigger:


  • Re Order Summons
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Triggering unit)) Not equal to Grom Hellscream
    • Actions
      • Unit - Turn collision for (Summoned unit) Off
      • Set TempPoint = (Center of KodoSpawnZoneArray[(Custom value of (Summoning unit))])
      • Unit - Order (Summoning unit) to Move To TempPoint
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Set TempUnitGroup = (Units owned by (Player((Custom value of (Summoning unit)))) matching (((Matching unit) is alive) Equal to True))
      • Set TempUnit = (Random unit from TempUnitGroup)
      • For each (Integer A) from 1 to 72, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempUnit Equal to EligibleTargetsUnitArray[(Integer A)]
            • Then - Actions
              • Unit Group - Add (Summoned unit) to EnemiesTargetingEachBuildingAr[(Integer A)]
              • Set TempPoint = (Position of (Summoned unit))
              • Set TempPoint2 = (Position of EligibleTargetsUnitArray[(Integer A)])
              • Set TempPoint3 = (TempPoint offset by 200.00 towards (Angle from TempPoint to TempPoint2) degrees)
              • Unit - Order (Summoned unit) to Attack-Move To TempPoint3
              • Custom script: call RemoveLocation (udg_TempPoint)
              • Custom script: call RemoveLocation (udg_TempPoint2)
              • Custom script: call RemoveLocation (udg_TempPoint3)
            • Else - Actions
      • Custom script: call DestroyGroup (udg_TempUnitGroup)
Now the details of this trigger are entirely irrelevent as far as I'm aware, this trigger regulates the units summoned by a different spell cast by a different unit. That works fine.

The unit whose mirror image spell causes the crash has the type Grom Hellscream. If this trigger is on, the crash happens. If this trigger is off, everything works perfectly. This baffles me since the conditions should make this trigger not run when that spell is cast anyway.
 
Level 12
Joined
May 22, 2015
Messages
1,051
EligibleTargetsUnitArray[(Integer A)]

What is this array? Is it initialised to size 73? I don't know if it would cause a crash or not, but it might.

Why is it looping 72 times, anyway?

Replace this chunk:
Set TempUnit = (Random unit from TempUnitGroup)
For each (Integer A) from 1 to 72, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TempUnit Equal to EligibleTargetsUnitArray[(Integer A)]
Then - Actions
Unit Group - Add (Summoned unit) to EnemiesTargetingEachBuildingAr[(Integer A)]
Set TempPoint = (Position of (Summoned unit))
Set TempPoint2 = (Position of EligibleTargetsUnitArray[(Integer A)])
Set TempPoint3 = (TempPoint offset by 200.00 towards (Angle from TempPoint to TempPoint2) degrees)
Unit - Order (Summoned unit) to Attack-Move To TempPoint3
Custom script: call RemoveLocation (udg_TempPoint)
Custom script: call RemoveLocation (udg_TempPoint2)
Custom script: call RemoveLocation (udg_TempPoint3)
Else - Actions

with this:
Set TempUnit = (Random unit from TempUnitGroup)
Unit Group - Add (Summoned unit) to EnemiesTargetingEachBuildingAr[(Integer A)]
Set TempPoint = (Position of (Summoned unit))
Set TempPoint2 = (Position of TempUnit)
Set TempPoint3 = (TempPoint offset by 200.00 towards (Angle from TempPoint to TempPoint2) degrees)
Unit - Order (Summoned unit) to Attack-Move To TempPoint3
Custom script: call RemoveLocation (udg_TempPoint)
Custom script: call RemoveLocation (udg_TempPoint2)
Custom script: call RemoveLocation (udg_TempPoint3)
 
Status
Not open for further replies.
Top