• 🏆 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] MUI Issue

Status
Not open for further replies.
Level 18
Joined
Oct 17, 2012
Messages
821
Problem: When the spell is cast again before the previous instance ends, the missile stops moving before reaching its predefined distance.

Also feel free to give any suggestions on code improvement.

Check the map to see the issue firsthand.

  • Getsuga Tensho Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set GT_Distance = 4000.00
      • Set GT_DmgMultiplier = 2.00
      • Set GT_DestroyTrees = True
      • Set GT_DummyType = Getsuga Tensho ( Missile Dummy )
      • Set GT_DummyModel = Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmMissile.mdl
      • Set GT_AttackType = Chaos
      • Set GT_DamageType = Universal
      • Set GT_MissileInitalSize = 25.00
      • Set GT_MissileSizeInc = 75.00
      • Set GT_MissileColor[1] = 100.00
      • Set GT_MissileColor[2] = 100.00
      • Set GT_MissileColor[3] = 100.00
      • Set GT_MissileTransparency = 0.00
      • Set GT_AOE = 250.00
      • Set GT_MissileInitialSpeed = 18.00
      • Set GT_MissileSpeedInc = 0.50
      • Set GT_DamageInc = 0.10
      • Set GT_KB_MaxDist = 500.00
      • Set GT_KB_Speed = 0.00
      • Set GT_KB_Effect = Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • GT_DestroyTrees Equal to (==) True
          • Then - Actions
            • Custom script: set udg_GT_Harvester = CreateUnit(Player ( 15 ) , 'hpea' , 0 , 0 , 0)
            • Unit - Hide GT_Harvester
          • Else - Actions
      • Custom script: set udg_GT_MinDistY = GetRectMinY(bj_mapInitialPlayableArea)
      • Custom script: set udg_GT_MinDistX = GetRectMinX(bj_mapInitialPlayableArea)
      • Custom script: set udg_GT_MaxDistX = GetRectMaxX(bj_mapInitialPlayableArea)
      • Custom script: set udg_GT_MaxDistY = GetRectMaxY(bj_mapInitialPlayableArea)
  • Getsuga Tensho Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Getsuga Tensho
    • Actions
      • Set GT_Index = (GT_Index + 1)
      • Set GT_Caster[GT_Index] = (Triggering unit)
      • Set GT_SpeedCounter[GT_Index] = 0.00
      • Set GT_MissileSpeed[GT_Index] = GT_MissileInitialSpeed
      • Set GT_Damage[GT_Index] = (GT_DmgMultiplier x (Real((Strength of GT_Caster[GT_Index] (Exclude bonuses)))))
      • Set GT_AbilityLevel[GT_Index] = (Level of Getsuga Tensho for GT_Caster[GT_Index])
      • Set GT_CasterX = (X of GT_Caster[GT_Index])
      • Set GT_CasterY = (Y of GT_Caster[GT_Index])
      • Custom script: set udg_GT_SpellTargetX = GetSpellTargetX()
      • Custom script: set udg_GT_SpellTargetY = GetSpellTargetY()
      • Custom script: set udg_GT_MissileAngle[udg_GT_Index] = Atan2(udg_GT_SpellTargetY - udg_GT_CasterY, udg_GT_SpellTargetX - udg_GT_CasterX)
      • Custom script: set udg_GT_SpellDummy[udg_GT_Index] = CreateUnit(GetTriggerPlayer(), udg_GT_DummyType, udg_GT_CasterX, udg_GT_CasterY, 57.25982 * udg_GT_MissileAngle[udg_GT_Index])
      • Animation - Change GT_SpellDummy[GT_Index]'s size to (GT_MissileInitalSize%, 0.00%, 0.00%) of its original size
      • Animation - Change GT_SpellDummy[GT_Index]'s vertex coloring to (GT_MissileColor[1]%, GT_MissileColor[2]%, GT_MissileColor[3]%) with GT_MissileTransparency% transparency
      • Animation - Change GT_SpellDummy[GT_Index] flying height to 10.00 at 0.00
      • Custom script: set udg_GT_MissileEffect[udg_GT_Index] = AddSpecialEffectTarget(udg_GT_DummyModel, udg_GT_SpellDummy[udg_GT_Index], "origin")
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • GT_Index Equal to (==) 1
          • Then - Actions
            • Trigger - Turn on Getsuga Tensho Loop <gen>
          • Else - Actions
  • Getsuga Tensho Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer GT_LoopInt) from 1 to GT_Index, do (Actions)
        • Loop - Actions
          • Set GT_MissileX = (X of GT_SpellDummy[GT_LoopInt])
          • Set GT_MissileY = (Y of GT_SpellDummy[GT_LoopInt])
          • Custom script: set udg_GT_MissileNX = udg_GT_MissileX + udg_GT_MissileSpeed[udg_GT_LoopInt]*Cos(udg_GT_MissileAngle[udg_GT_LoopInt])
          • Custom script: set udg_GT_MissileNY = udg_GT_MissileY + udg_GT_MissileSpeed[udg_GT_LoopInt]*Sin(udg_GT_MissileAngle[udg_GT_LoopInt])
          • Custom script: call SetUnitX(udg_GT_SpellDummy[udg_GT_LoopInt], udg_GT_MissileNX)
          • Custom script: call SetUnitY(udg_GT_SpellDummy[udg_GT_LoopInt], udg_GT_MissileNY)
          • Set GT_MissilePos = (Point((X of GT_SpellDummy[GT_LoopInt]), (Y of GT_SpellDummy[GT_LoopInt])))
          • Set GT_SpeedCounter[GT_LoopInt] = (GT_SpeedCounter[GT_LoopInt] + GT_MissileSpeed[GT_LoopInt])
          • -------- . --------
          • Set GT_MissileSpeed[GT_LoopInt] = (GT_MissileSpeed[GT_LoopInt] + GT_MissileSpeedInc)
          • Set GT_KB_Speed = (GT_MissileSpeed[GT_LoopInt] + GT_MissileSpeedInc)
          • Set GT_Damage[GT_LoopInt] = ((GT_DamageInc + GT_DmgMultiplier) x (Real((Strength of GT_Caster[GT_LoopInt] (Exclude bonuses)))))
          • Animation - Change GT_SpellDummy[GT_LoopInt]'s size to ((GT_MissileInitalSize + GT_MissileSizeInc)%, 0.00%, 0.00%) of its original size
          • Game - Display to (All players) the text: (String(GT_MissileSpeed[GT_LoopInt]))
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • GT_DestroyTrees Equal to (==) True
              • Then - Actions
                • Destructible - Pick every destructible within GT_AOE of GT_MissilePos and do (Actions)
                  • Loop - Actions
                    • Set GT_Tree = (Picked destructible)
                    • Unit - Order GT_Harvester to Harvest GT_Tree
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Current order of GT_Harvester) Equal to (==) (Order(harvest))
                        • Then - Actions
                          • Destructible - Kill GT_Tree
                        • Else - Actions
                    • Unit - Order GT_Harvester to Stop
              • Else - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within GT_AOE of GT_MissilePos) and do (Actions)
            • Loop - Actions
              • Game - Display to (All players) the text: UnitGroup Enabled
              • Set GT_PickedUnit = (Picked unit)
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (GT_PickedUnit is alive) Equal to (==) True
                    • (GT_PickedUnit is Magic Immune) Equal to (==) False
                    • (GT_PickedUnit is A structure) Equal to (==) False
                    • (GT_PickedUnit is A ground unit) Equal to (==) True
                    • (GT_PickedUnit belongs to an enemy of (Owner of GT_Caster[GT_LoopInt])) Equal to (==) True
                  • Then - Actions
                    • Unit - Pause GT_PickedUnit
                    • Set GT_KB_SpeedCounter = 0.00
                    • -------- - --------
                    • Set GT_KB_X = (X of GT_PickedUnit)
                    • Set GT_KB_Y = (Y of GT_PickedUnit)
                    • Custom script: set udg_GT_MissileNX = udg_GT_KB_X + udg_GT_KB_Speed*Cos(udg_GT_MissileAngle[udg_GT_LoopInt])
                    • Custom script: set udg_GT_MissileNY = udg_GT_KB_Y + udg_GT_KB_Speed*Sin(udg_GT_MissileAngle[udg_GT_LoopInt])
                    • Set CP_Point = (Point(GT_MissileNX, GT_MissileNY))
                    • Trigger - Run Check Walkability <gen> (ignoring conditions)
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • CP_PointIsWalkable Equal to (==) True
                        • Then - Actions
                          • Custom script: call SetUnitX(udg_GT_PickedUnit, udg_GT_MissileNX)
                          • Custom script: call SetUnitY(udg_GT_PickedUnit, udg_GT_MissileNY)
                        • Else - Actions
                    • Game - Display to (All players) the text: UnitGroup Enabled 2
                    • Custom script: call RemoveLocation(udg_CP_Point)
                    • Unit - Cause GT_Caster[GT_LoopInt] to damage GT_PickedUnit, dealing GT_Damage[GT_LoopInt] damage of attack type GT_AttackType and damage type GT_DamageType
                    • Special Effect - Create a special effect attached to the origin of GT_PickedUnit using GT_KB_Effect
                    • Special Effect - Destroy (Last created special effect)
                    • Custom script: if udg_GT_MinDistX >= udg_GT_MissileNX and udg_GT_MissileNX >= udg_GT_MaxDistX and udg_GT_MinDistY >= udg_GT_MissileNY and udg_GT_MissileNY >= udg_GT_MaxDistY then
                    • Set GT_KB_SpeedCounter = GT_KB_MaxDist
                    • Custom script: endif
                    • Unit - Unpause GT_PickedUnit
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • GT_KB_SpeedCounter Greater than or equal to (>=) GT_KB_MaxDist
                        • Then - Actions
                          • Unit - Kill GT_SpellDummy[GT_LoopInt]
                          • Special Effect - Destroy GT_MissileEffect[GT_LoopInt]
                          • Set GT_Caster[GT_LoopInt] = GT_Caster[GT_Index]
                          • Set GT_MissileSpeed[GT_LoopInt] = GT_MissileSpeed[GT_Index]
                          • Set GT_Damage[GT_LoopInt] = GT_Damage[GT_Index]
                          • Set GT_SpeedCounter[GT_LoopInt] = GT_SpeedCounter[GT_Index]
                          • Set GT_AbilityLevel[GT_LoopInt] = GT_AbilityLevel[GT_Index]
                          • Set GT_Index = (GT_Index - 1)
                          • Set GT_LoopInt = (GT_LoopInt - 1)
                            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • GT_Index Equal to (==) 0
                              • Then - Actions
                                • Trigger - Turn off Getsuga Tensho Loop <gen>
                              • Else - Actions
                        • Else - Actions
                  • Else - Actions
          • Custom script: call RemoveLocation(udg_GT_MissilePos)
          • Custom script: if udg_GT_MinDistX <= udg_GT_MissileNX and udg_GT_MissileNX <= udg_GT_MaxDistX and udg_GT_MinDistY <= udg_GT_MissileNY and udg_GT_MissileNY <= udg_GT_MaxDistY then
          • Custom script: else
          • Set GT_SpeedCounter[GT_LoopInt] = GT_Distance
          • Custom script: endif
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • GT_SpeedCounter[GT_LoopInt] Greater than or equal to (>=) GT_Distance
              • Then - Actions
                • Unit - Kill GT_SpellDummy[GT_LoopInt]
                • Special Effect - Destroy GT_MissileEffect[GT_LoopInt]
                • Set GT_Caster[GT_LoopInt] = GT_Caster[GT_Index]
                • Set GT_MissileSpeed[GT_LoopInt] = GT_MissileSpeed[GT_Index]
                • Set GT_Damage[GT_LoopInt] = GT_Damage[GT_Index]
                • Set GT_SpeedCounter[GT_LoopInt] = GT_SpeedCounter[GT_Index]
                • Set GT_AbilityLevel[GT_LoopInt] = GT_AbilityLevel[GT_Index]
                • Set GT_Index = (GT_Index - 1)
                • Set GT_LoopInt = (GT_LoopInt - 1)
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • GT_Index Equal to (==) 0
                    • Then - Actions
                      • Trigger - Turn off Getsuga Tensho Loop <gen>
                    • Else - Actions
              • Else - Actions
 

Attachments

  • MySpell.w3x
    33.6 KB · Views: 29
Last edited:
Status
Not open for further replies.
Top