• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Removing leaks is causing problems

Status
Not open for further replies.
Level 13
Joined
Oct 25, 2009
Messages
995
Does the trigger has problem?If i remove the leaks,the missle won't move anymore,and sometimes if i cast the spell,the missle will keep going until it move to the map bounds and dissappear?
EDIT: And the special effect doesn't show up?
EDIT 2: +REP and is it MUI?If not MUI can tell me how can i change it into MUI?
  • MW Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Missle Wave
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MW_Index1 Equal to 0
        • Then - Actions
          • Trigger - Turn on MW Loop <gen>
        • Else - Actions
      • Set MW_Index1 = (MW_Index1 + 1)
      • Set MW_Boolean[MW_Index1] = True
      • Set MW_Casting[MW_Index1] = (Triggering unit)
      • Set MW_TargetPoint[MW_Index1] = (Target point of ability being cast)
      • Unit - Create 1 Missle for (Owner of MW_Casting[MW_Index1]) at (Position of MW_Casting[MW_Index1]) facing (Facing of MW_Casting[MW_Index1]) degrees
      • Set MW_Missle[MW_Index1] = (Last created unit)
  • MW Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer MW_IndexLoop) from 1 to MW_Index1, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MW_Boolean[MW_IndexLoop] Equal to True
            • Then - Actions
              • Unit - Move MW_Missle[MW_IndexLoop] instantly to ((Position of MW_Missle[MW_IndexLoop]) offset by 20.00 towards (Facing of MW_Missle[MW_IndexLoop]) degrees)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between (Position of MW_Missle[MW_IndexLoop]) and MW_TargetPoint[MW_IndexLoop]) Less than or equal to 100.00
                • Then - Actions
                  • Special Effect - Create a special effect attached to the origin of MW_Missle[MW_IndexLoop] using Abilities\Spells\Human\FlameStrike\FlameStrike1.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Cause MW_Missle[MW_IndexLoop] to damage circular area after 0.00 seconds of radius 300.00 at (Position of MW_Missle[MW_IndexLoop]), dealing 200.00 damage of attack type Spells and damage type Normal
                  • Unit - Kill MW_Missle[MW_IndexLoop]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MW_Index1 Equal to 0
                    • Then - Actions
                      • Set MW_Index1 = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                  • Set MW_Boolean[MW_Index1] = False
                  • Set MW_Index1 = (MW_Index1 - 1)
                • Else - Actions
            • Else - Actions
 
Last edited:
Level 29
Joined
Mar 10, 2009
Messages
5,016
That's not a proper way of indexing, you must have at least 2 integers to reference the indexed *something* like...

Set MW_Index1 = (MW_Index1 + 1)
Set MW_Index2 = (MW_Index2 + 2)

Then reference MW_Index2 like this...
Set MW_Boolean[MW_Index2] = True
And so on...

Then in the loop, do like this...
For each (Integer MW_IndexLoop) from 1 to MW_Index2, do (Actions)
Then reference all of it using MW_IndexLoop...

Btw, you dont need to index ALL in the MW Cast just like Set MW_TargetPoint[MW_Index2], simply create a point then destroy it...
 
Level 13
Joined
Oct 25, 2009
Messages
995
I changed the trigger same with Homing Missle(DotA spell,but different abit).
  • MW Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Missle Wave
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MW_Index1 Equal to 0
        • Then - Actions
          • Trigger - Turn on MW Loop <gen>
        • Else - Actions
      • Set MW_Index1 = (MW_Index1 + 1)
      • Set MW_Index2 = (MW_Index2 + 1)
      • Set MW_Boolean[MW_Index2] = True
      • Set MW_Casting[MW_Index1] = (Triggering unit)
      • Set MW_Target[MW_Index1] = (Target unit of ability being cast)
      • Set MW_Damage = (100.00 x (Real((Level of Missle Wave for MW_Casting[MW_Index1]))))
      • Unit - Create 1 Missle for (Owner of MW_Casting[MW_Index1]) at (Position of MW_Casting[MW_Index1]) facing (Facing of MW_Casting[MW_Index1]) degrees
      • Set MW_Missle[MW_Index1] = (Last created unit)
  • MW Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer MW_IndexLoop) from 1 to MW_Index2, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MW_Boolean[MW_IndexLoop] Equal to True
            • Then - Actions
              • Set HM_Speed[MW_IndexLoop] = (HM_Speed[MW_IndexLoop] + 0.05)
              • Set HM_Damage[MW_IndexLoop] = (HM_Damage[MW_IndexLoop] + 2.00)
              • Set HM_Angle[MW_IndexLoop] = (Distance between (Position of MW_Missle[MW_IndexLoop]) and (Position of MW_Target[MW_IndexLoop]))
              • Unit - Move MW_Missle[MW_IndexLoop] instantly to ((Position of MW_Missle[MW_IndexLoop]) offset by (5.00 + HM_Speed[MW_IndexLoop]) towards (Facing of MW_Missle[MW_IndexLoop]) degrees), facing (Position of MW_Target[MW_IndexLoop])
              • Floating Text - Create floating text that reads (|cffff0000 + ((String(HM_Damage[MW_IndexLoop])) + |r)) at (Position of MW_Missle[MW_IndexLoop]) 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 64.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 0.50 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (MW_Target[MW_IndexLoop] is alive) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HM_Angle[MW_IndexLoop] Less than or equal to 50.00
                    • Then - Actions
                      • Special Effect - Create a special effect at (Position of MW_Missle[MW_IndexLoop]) using war3mapImported\NuclearExplosion.mdx
                      • Special Effect - Destroy (Last created special effect)
                      • Unit - Cause MW_Missle[MW_IndexLoop] to damage circular area after 0.00 seconds of radius 150.00 at (Position of MW_Missle[MW_IndexLoop]), dealing (HM_Damage[MW_IndexLoop] + MW_Damage) damage of attack type Spells and damage type Normal
                      • Unit - Kill MW_Missle[MW_IndexLoop]
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • MW_Index1 Equal to 0
                        • Then - Actions
                          • Set MW_Index1 = 0
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
                      • Set HM_Damage[MW_IndexLoop] = 0.00
                      • Set HM_Speed[MW_IndexLoop] = 0.00
                      • Set MW_Boolean[MW_IndexLoop] = False
                      • Set MW_Index1 = (MW_Index1 - 1)
                    • Else - Actions
                • Else - Actions
                  • Special Effect - Create a special effect at (Position of MW_Missle[MW_IndexLoop]) using war3mapImported\NuclearExplosion.mdx
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Cause MW_Missle[MW_IndexLoop] to damage circular area after 0.00 seconds of radius 150.00 at (Position of MW_Missle[MW_IndexLoop]), dealing (HM_Damage[MW_IndexLoop] + MW_Damage) damage of attack type Spells and damage type Normal
                  • Unit - Kill MW_Missle[MW_IndexLoop]
                  • Set HM_Damage[MW_IndexLoop] = 0.00
                  • Set HM_Speed[MW_IndexLoop] = 0.00
                  • Set MW_Boolean[MW_IndexLoop] = False
                  • Set MW_Index1 = (MW_Index1 - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MW_Index1 Equal to 0
                    • Then - Actions
                      • Set MW_Index1 = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
            • Else - Actions
Sometimes,if 2 unit cast the same spell,the first missle will be paused.
 
Last edited:
Actually, your recycling is not right, you decrease the main index.
MW_Index1 Equal to 0
Set MW_Index1 = (MW_Index1 - 1)
Should be:
MW_Index2 Equal to 0
Set MW_Index2 = (MW_Index2 - 1)

You don't need two different if/then/else to check stuff; just use (MW_Target[MW_IndexLoop] is alive) Equal to True and HM_Angle[MW_IndexLoop] Less than or equal to 50.00 under the same if. Like I said, change the MW_Boolean to MW_Boolean[MW_Index1].
 
Level 13
Joined
Oct 25, 2009
Messages
995
hmm,like this?It isn't work.
EDIT: If i decrease HM_Index1,the bug is if i casted 2 time spell on the same unit(The first missle is still moving,2nd missle also moving),the first missle reach,the 2nd missle will stop moving.
But if i use HM_Index2,the missle doesn't move,stopped at the caster.
  • HM Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Homing Missle
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HM_Index1 Equal to 0
        • Then - Actions
          • Trigger - Turn on HM Loop <gen>
        • Else - Actions
      • Set HM_Index1 = (HM_Index1 + 1)
      • Set HM_Index2 = (HM_Index2 + 1)
      • Set HM_Caster[HM_Index1] = (Triggering unit)
      • Set HM_Target[HM_Index1] = (Target unit of ability being cast)
      • Set HM_Boolean[HM_Index1] = True
      • Set HM_Damage = (100.00 x (Real((Level of Homing Missle for HM_Caster[HM_Index1]))))
      • Unit - Create 1 Missle for (Owner of HM_Caster[HM_Index1]) at (Position of HM_Caster[HM_Index1]) facing (Facing of HM_Caster[HM_Index1]) degrees
      • Set HM_Missle[HM_Index1] = (Last created unit)
  • HM Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer HM_IndexLoop) from 1 to HM_Index2, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HM_Boolean[HM_IndexLoop] Equal to True
            • Then - Actions
              • Set HM_Speed[HM_IndexLoop] = (HM_Speed[HM_IndexLoop] + 0.10)
              • Set HM_SpeedDamage[HM_IndexLoop] = (HM_SpeedDamage[HM_IndexLoop] + 2.00)
              • Set HM_Angle[HM_IndexLoop] = (Distance between (Position of HM_Missle[HM_IndexLoop]) and (Position of HM_Target[HM_IndexLoop]))
              • Unit - Move HM_Missle[HM_IndexLoop] instantly to ((Position of HM_Missle[HM_IndexLoop]) offset by (10.00 + HM_Speed[HM_IndexLoop]) towards (Facing of HM_Missle[HM_IndexLoop]) degrees), facing (Position of HM_Target[HM_IndexLoop])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • (HM_Target[HM_IndexLoop] is alive) Equal to True
                  • HM_Angle[HM_IndexLoop] Less than or equal to 50.00
                • Then - Actions
                  • Special Effect - Create a special effect at (Position of HM_Missle[HM_IndexLoop]) using war3mapImported\NuclearExplosion.mdx
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Cause HM_Missle[HM_IndexLoop] to damage circular area after 0.00 seconds of radius 400.00 at (Position of HM_Missle[HM_IndexLoop]), dealing (HM_Damage + HM_SpeedDamage[HM_IndexLoop]) damage of attack type Spells and damage type Normal
                  • Unit - Kill HM_Missle[HM_IndexLoop]
                  • Set HM_Index2 = (HM_Index2 - 1)
                  • Set HM_Boolean[HM_IndexLoop] = False
                  • Set HM_Speed[HM_IndexLoop] = 0.00
                  • Set HM_SpeedDamage[HM_IndexLoop] = 0.00
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HM_Index2 Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
                  • Special Effect - Create a special effect at (Position of HM_Missle[HM_IndexLoop]) using war3mapImported\NuclearExplosion.mdx
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Cause HM_Missle[HM_IndexLoop] to damage circular area after 0.00 seconds of radius 400.00 at (Position of HM_Missle[HM_IndexLoop]), dealing (HM_Damage + HM_SpeedDamage[HM_IndexLoop]) damage of attack type Spells and damage type Normal
                  • Unit - Kill HM_Missle[HM_IndexLoop]
                  • Set HM_Index2 = (HM_Index2 - 1)
                  • Set HM_Boolean[HM_IndexLoop] = False
                  • Set HM_Speed[HM_IndexLoop] = 0.00
                  • Set HM_SpeedDamage[HM_IndexLoop] = 0.00
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HM_Index2 Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
            • Else - Actions
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
I told you to follow my example...

http://www.hiveworkshop.com/forums/1939738-post5.html

ALL the indexed variable during the CASTING TIME, should be referenced as "HM_Index2"...

And In the loop when you reduce the instances using a boolean setup/when the spell is finished...use like this...

if Set HM_Boolean[HM_IndexLoop] = false then
Set HM_Index1 = (HM_Index1 - 1)
Set HM_Boolean[HM_IndexLoop] = true

do not reduce this >>> HM_Index2, but set it to zero when the trigger is off...
 
Level 13
Joined
Oct 25, 2009
Messages
995
I told you to follow my example...

http://www.hiveworkshop.com/forums/1939738-post5.html

ALL the indexed variable during the CASTING TIME, should be referenced as "HM_Index2"...

And In the loop when you reduce the instances using a boolean setup/when the spell is finished...use like this...

if Set HM_Boolean[HM_IndexLoop] = false then
Set HM_Index1 = (HM_Index1 - 1)
Set HM_Boolean[HM_IndexLoop] = true

do not reduce this >>> HM_Index2, but set it to zero when the trigger is off...

Could you give the full trigger?=.=
 
Status
Not open for further replies.
Top