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

Not MUI

Status
Not open for further replies.

ILH

ILH

Model Reviewer
Level 26
Joined
May 8, 2012
Messages
1,246
Yet second request from me :ogre_hurrhurr:

If you test this in-game, it's not MUI

  • Meteor Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer TempInt) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set M_Aoe[TempInt] = (250.00 x (Real(TempInt)))
          • Set M_Damage[TempInt] = (250.00 x (Real(TempInt)))
      • Set M_Effect[0] = war3mapImported\ChaosMeteorV3.mdx
      • Set M_Effect[1] = war3mapImported\NuclearExplosion.mdx
  • Meteor Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Meteor
    • Actions
      • Set M_MaxIndex = (M_MaxIndex + 1)
      • Set M_Caster[M_MaxIndex] = (Triggering unit)
      • Set M_Interval[M_MaxIndex] = 2.00
      • Set M_Point[M_MaxIndex] = (Target point of ability being cast)
      • Set M_Level[M_MaxIndex] = (Level of Meteor for M_Caster[M_MaxIndex])
      • Set Point[0] = (Target point of ability being cast)
      • Special Effect - Create a special effect at Point[0] using M_Effect[0]
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Point[0])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • M_MaxIndex Equal to 1
        • Then - Actions
          • Trigger - Turn on Meteor Loop <gen>
        • Else - Actions
  • Meteor Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer M_Index) from 1 to M_MaxIndex, do (Actions)
        • Loop - Actions
          • Set M_Interval[M_Index] = (M_Interval[M_Index] - 0.03)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • M_Interval[M_Index] Less than or equal to 0.04
            • Then - Actions
              • Set M_Group = (Units within M_Aoe[M_Level[M_Index]] of M_Point[M_Index])
              • Unit Group - Pick every unit in M_Group and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A ground unit) Equal to True
                      • ((Picked unit) is alive) Equal to True
                      • ((Picked unit) belongs to an enemy of (Owner of M_Caster[M_Index])) Equal to True
                    • Then - Actions
                      • Unit - Cause M_Caster[M_Index] to damage (Picked unit), dealing M_Damage[M_Level[M_Index]] damage of attack type Spells and damage type Normal
                      • Floating Text - Create floating text that reads (String(M_Damage[M_Level[M_Index]])) above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
                      • Floating Text - Set the velocity of (Last created floating text) to 30.00 towards 90.00 degrees
                      • Floating Text - Change (Last created floating text): Disable permanence
                      • Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
                      • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
                    • Else - Actions
              • Custom script: call DestroyGroup(udg_M_Group)
              • Special Effect - Create a special effect at M_Point[M_Index] using M_Effect[1]
              • Special Effect - Destroy (Last created special effect)
              • Set M_Point[M_Index] = M_Point[M_MaxIndex]
              • Custom script: call RemoveLocation(udg_M_Point[udg_M_MaxIndex])
              • Set M_Caster[M_Index] = M_Caster[M_MaxIndex]
              • Set M_Caster[M_MaxIndex] = No unit
              • Set M_Interval[M_Index] = M_Interval[M_MaxIndex]
              • Set M_Interval[M_MaxIndex] = 0.00
              • Set M_Level[M_Index] = M_Level[M_MaxIndex]
              • Set M_Level[M_MaxIndex] = 0
              • Set M_Index = (M_Index - 1)
              • Set M_MaxIndex = (M_MaxIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • M_MaxIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
              • Floating Text - Create floating text that reads (String(M_Interval[M_Index])) at M_Point[M_Index] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 30.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
Can someone point me out what's wrong with it?
 

Attachments

  • Meteor.w3x
    22.1 KB · Views: 33
Level 25
Joined
Sep 26, 2009
Messages
2,384
First, the cast trigger - this is not really an error, but something to point out:
  • Set M_Point[M_MaxIndex] = (Target point of ability being cast)
  • Set Point[0] = (Target point of ability being cast)
  • Special Effect - Create a special effect at Point[0] using M_Effect[0]
  • Special Effect - Destroy (Last created special effect)
  • Custom script: call RemoveLocation(udg_Point[0])
There's no reason to set Point[0]. Just create the special effect at M_Point[M_MaxIndex] location and destroy the special effect. Don't destroy M_Point.
This will not leak as long as you don't lose reference to M_Point, which you do not. Thanks to this, you won't have to create new point at same [x,y] coordinates.
------------------------------------

The problem most likely lies in your deindexing in loop trigger.
  • Set M_Point[M_Index] = M_Point[M_MaxIndex]
  • Custom script: call RemoveLocation(udg_M_Point[udg_M_MaxIndex])
This is the error. To explain, let's say that you create location called Location_A. In the cast trigger, you make the M_Point[M_MaxIndex] variable point at the Location_A.
Now in the trigger above, you make M_Point[M_Index] point at what M_Point[M_MaxIndex] is pointing to -> this means that right now, both M_Point[M_Index] and M_Point[M_MaxIndex] point at the same location - at Location_A.

So when you destroy Location_A through M_Point[M_MaxIndex] variable you make that variable point at nothing or null, but you also make M_Point[M_Index] point at nothing/null, since they both pointed at the same location (which no longer exists).

So either completely remove this action:
  • Custom script: call RemoveLocation(udg_M_Point[udg_M_MaxIndex])
or change it into
  • Custom script: set udg_M_Point[udg_M_MaxIndex] = null
The action above will make M_Point[M_MaxIndex] point at nothing/null but won't destroy the location it was originally pointing to.
 
  • Like
Reactions: ILH

ILH

ILH

Model Reviewer
Level 26
Joined
May 8, 2012
Messages
1,246
First, the cast trigger - this is not really an error, but something to point out:
  • Set M_Point[M_MaxIndex] = (Target point of ability being cast)
  • Set Point[0] = (Target point of ability being cast)
  • Special Effect - Create a special effect at Point[0] using M_Effect[0]
  • Special Effect - Destroy (Last created special effect)
  • Custom script: call RemoveLocation(udg_Point[0])
There's no reason to set Point[0]. Just create the special effect at M_Point[M_MaxIndex] location and destroy the special effect. Don't destroy M_Point.
This will not leak as long as you don't lose reference to M_Point, which you do not. Thanks to this, you won't have to create new point at same [x,y] coordinates.
------------------------------------

The problem most likely lies in your deindexing in loop trigger.
  • Set M_Point[M_Index] = M_Point[M_MaxIndex]
  • Custom script: call RemoveLocation(udg_M_Point[udg_M_MaxIndex])
This is the error. To explain, let's say that you create location called Location_A. In the cast trigger, you make the M_Point[M_MaxIndex] variable point at the Location_A.
Now in the trigger above, you make M_Point[M_Index] point at what M_Point[M_MaxIndex] is pointing to -> this means that right now, both M_Point[M_Index] and M_Point[M_MaxIndex] point at the same location - at Location_A.

So when you destroy Location_A through M_Point[M_MaxIndex] variable you make that variable point at nothing or null, but you also make M_Point[M_Index] point at nothing/null, since they both pointed at the same location (which no longer exists).

So either completely remove this action:
  • Custom script: call RemoveLocation(udg_M_Point[udg_M_MaxIndex])
or change it into
  • Custom script: set udg_M_Point[udg_M_MaxIndex] = null
The action above will make M_Point[M_MaxIndex] point at nothing/null but won't destroy the location it was originally pointing to.

Whoa thanks man, it's worked! +rep :goblin_good_job:
 
Status
Not open for further replies.
Top