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

Missile won't die

Status
Not open for further replies.
Hey people
I made a missile system for my map but I've found that the missile doesn't die when it kills the target :( Please see if you can help me find the problem


  • GravitonCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Graviton
    • Actions
      • Trigger - Run Missile Indexer <gen> (ignoring conditions)
      • Set MissileTarget[MissileIndex] = (Target unit of ability being cast)
      • Set Temp_Point2 = (Position of MissileTarget[MissileIndex])
      • Unit - Create 1 Graviton for (Owner of MissileCaster[MissileIndex]) at Temp_Point facing Temp_Point2
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call RemoveLocation(udg_Temp_Point2)
      • Set Missile[MissileIndex] = (Last created unit)
      • Set MissileSpeed[MissileIndex] = 5.00
      • Set MissileDamage[MissileIndex] = 200.00
      • Set MissileValue[MissileIndex] = 0.00
      • Set MissileKill[MissileIndex] = True
  • Missile Indexer
    • Events
    • Conditions
    • Actions
      • If (MissileIndex Equal to 0) then do (Trigger - Turn on Missile loop <gen>) else do (-------- 0 --------)
      • Set MissileIndex = (MissileIndex + 1)
      • Set MissileCaster[MissileIndex] = (Triggering unit)
      • Set Temp_Point = (Position of MissileCaster[MissileIndex])
  • Missile loop
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to MissileIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Missile[Temp_Int] is paused) Equal to False
            • Then - Actions
              • Set Temp_Point = (Position of Missile[Temp_Int])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • MissileTarget[Temp_Int] Equal to No unit
                • Then - Actions
                  • Set Temp_Enemies = (Units within 70.00 of Temp_Point matching (((Owner of (Matching unit)) is an ally of (Owner of Missile[Temp_Int])) Equal to False))
                  • If ((Temp_Enemies is empty) Equal to False) then do (Set MissileTarget[Temp_Int] = (Random unit from Temp_Enemies)) else do (-------- 0 --------)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Temp_Enemies is empty) Equal to False
                    • Then - Actions
                      • Set MissileTarget[Temp_Int] = (Random unit from Temp_Enemies)
                      • Trigger - Run Missile Event <gen> (ignoring conditions)
                    • Else - Actions
                      • Set Temp_Point2 = (Temp_Point offset by MissileSpeed[Temp_Int] towards (Facing of Missile[Temp_Int]) degrees)
                      • Unit - Move Missile[Temp_Int] instantly to Temp_Point2
                      • Custom script: call RemoveLocation(udg_Temp_Point2)
                  • Custom script: call DestroyGroup(udg_Temp_Enemies)
                • Else - Actions
                  • Set Temp_Point2 = (Position of MissileTarget[Temp_Int])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between Temp_Point and Temp_Point2) Greater than (10.00 + MissileSpeed[Temp_Int])
                    • Then - Actions
                      • Set Temp_Real = (Angle from Temp_Point to Temp_Point2)
                      • Set Temp_Point3 = (Temp_Point offset by MissileSpeed[Temp_Int] towards Temp_Real degrees)
                      • Unit - Move Missile[Temp_Int] instantly to Temp_Point3, facing Temp_Real degrees
                      • Custom script: call RemoveLocation(udg_Temp_Point3)
                    • Else - Actions
                      • Trigger - Run Missile Event <gen> (ignoring conditions)
                  • Custom script: call RemoveLocation(udg_Temp_Point2)
              • Custom script: call RemoveLocation(udg_Temp_Point)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Missile[Temp_Int] is dead) Equal to True
            • Then - Actions
              • Set MissileCaster[Temp_Int] = MissileCaster[MissileIndex]
              • Set MissileCaster[MissileIndex] = No unit
              • Set MissileTarget[Temp_Int] = MissileTarget[MissileIndex]
              • Set MissileTarget[MissileIndex] = No unit
              • Set Missile[Temp_Int] = Missile[MissileIndex]
              • Set Missile[MissileIndex] = No unit
              • Set MissileSpeed[Temp_Int] = MissileSpeed[MissileIndex]
              • Set MissileSpeed[MissileIndex] = 0.00
              • Set MissileDamage[Temp_Int] = MissileDamage[MissileIndex]
              • Set MissileDamage[MissileIndex] = 0.00
              • Set MissileValue[Temp_Int] = MissileValue[MissileIndex]
              • Set MissileValue[MissileIndex] = 0.00
              • Set MissileKill[Temp_Int] = MissileKill[MissileIndex]
              • Set MissileKill[MissileIndex] = False
              • Set MissileIndex = (MissileIndex - 1)
              • Set Temp_Int = (Temp_Int - 1)
              • If (MissileIndex Equal to 0) then do (Trigger - Turn off (This trigger)) else do (-------- 0 --------)
            • Else - Actions
  • Missile Event
    • Events
    • Conditions
    • Actions
      • Set QMissileCaster = MissileCaster[Temp_Int]
      • Set QMissileTarget = MissileTarget[Temp_Int]
      • Set QMissileDamage = MissileDamage[Temp_Int]
      • Set QMissile = Missile[Temp_Int]
      • Set QMissileValue = MissileValue[Temp_Int]
      • Set MissileImpact = 1.00
      • Set MissileImpact = 0.00
      • If (MissileKill[Temp_Int] Equal to True) then do (Unit - Kill Missile[Temp_Int]) else do (-------- 0 --------)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MissileKill[Temp_Int] Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: true
        • Else - Actions
          • Game - Display to (All players) the text: false
  • GravitonEnd
    • Events
      • Game - MissileImpact becomes Equal to 1.00
    • Conditions
      • (Unit-type of QMissile) Equal to Graviton
    • Actions
      • Set Temp_Point = (Position of QMissileTarget)
      • Unit - Cause QMissileCaster to damage QMissileTarget, dealing QMissileDamage damage of attack type Hero and damage type Sonic
      • Special Effect - Create a special effect at Temp_Point using war3mapImported\Arcane Nova.mdx
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Temp_Point)


Sorry I know it's a lot of triggers for a simple spell but once it works then I can make missile spells with minimum effort.

Thanks for your help.
 
Level 22
Joined
Aug 27, 2013
Messages
3,973
You can merge Missile Indexer with GravitonCast
Seriously, you can simplify the triggers. This is just inefficient, isn't it?
You can also merge Missile Event and Missile Loop

about your problem, i'm not really sure (well, it's because your triggers aren't organized properly) but i think it's because you divided it to different parts and you do it in inefficient way
 
Level 22
Joined
Aug 27, 2013
Messages
3,973
I'll try to simplify it for you but what is (Missile[Temp_Int] is paused) Equal to False for?
It's not like you pause it or anything, right?

Edit:

Let's see, your Gravitational cast can be optimized like this. I guess
  • Graviton Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Graviton
    • Actions
      • Set MissileIndex = (MissileIndex + 1)
      • Set MissileCaster[MissileIndex] = (Triggering unit)
      • Set MissileTarget[MissileIndex] = (Target unit of ability being cast)
      • Set Temp_Point = (Position of MissileCaster[MissileIndex])
      • Set Temp_Point2 = (Position of MissileTarget[MissileIndex])
      • Unit - Create 1 Graviton for (Owner of MissileCaster[MissileIndex]) at Temp_Point facing (Angle from Temp_Point to Temp_Point2) degrees
      • Set Missile[MissileIndex] = (Last created unit)
      • Set MissileSpeed[MissileIndex] = 5.00
      • Set MissileDamage[MissileIndex] = 200.00
      • Set MissileValue[MissileIndex] = 0.00
      • Set MissileKill[MissileIndex] = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MissileIndex Equal to 1
        • Then - Actions
          • Trigger - Turn on Missile loop <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call RemoveLocation(udg_Temp_Point2)
i haven't done with the loop one though
 
Last edited:
Allright thanks for your help :). I still don't know if I should write the Missile Event out in the loop trigger twice

Edit: Ok I got a new approach but the effect won't show at Temp_Point T_T


  • Missile loop
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Temp_Int) from 1 to MissileIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Missile[Temp_Int] is paused) Equal to False
            • Then - Actions
              • Set Temp_Point = (Position of Missile[Temp_Int])
              • Set Temp_Point2 = (Position of MissileTarget[Temp_Int])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between Temp_Point and Temp_Point2) Greater than (10.00 + MissileSpeed[Temp_Int])
                • Then - Actions
                  • Set Temp_Real = (Angle from Temp_Point to Temp_Point2)
                  • Set Temp_Point3 = (Temp_Point offset by MissileSpeed[Temp_Int] towards Temp_Real degrees)
                  • Unit - Move Missile[Temp_Int] instantly to Temp_Point3, facing Temp_Real degrees
                  • Custom script: call RemoveLocation(udg_Temp_Point3)
                • Else - Actions
                  • Unit - Kill Missile[Temp_Int]
                  • Unit - Cause MissileCaster[Temp_Int] to damage MissileTarget[Temp_Int], dealing MissileDamage[Temp_Int] damage of attack type Hero and damage type Sonic
                  • Special Effect - Create a special effect at Temp_Point using war3mapImported\Arcane Nova.mdx
                  • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation(udg_Temp_Point)
              • Custom script: call RemoveLocation(udg_Temp_Point2)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Missile[Temp_Int] is dead) Equal to True
            • Then - Actions
              • Set MissileCaster[Temp_Int] = MissileCaster[MissileIndex]
              • Set MissileCaster[MissileIndex] = No unit
              • Set MissileTarget[Temp_Int] = MissileTarget[MissileIndex]
              • Set MissileTarget[MissileIndex] = No unit
              • Set Missile[Temp_Int] = Missile[MissileIndex]
              • Set Missile[MissileIndex] = No unit
              • Set MissileSpeed[Temp_Int] = MissileSpeed[MissileIndex]
              • Set MissileSpeed[MissileIndex] = 0.00
              • Set MissileDamage[Temp_Int] = MissileDamage[MissileIndex]
              • Set MissileDamage[MissileIndex] = 0.00
              • Set MissileValue[Temp_Int] = MissileValue[MissileIndex]
              • Set MissileValue[MissileIndex] = 0.00
              • Set MissileTrigger[Temp_Int] = MissileTrigger[MissileIndex]
              • Custom script: set udg_MissileTrigger[udg_MissileIndex] = null
              • Set MissileIndex = (MissileIndex - 1)
              • Set Temp_Int = (Temp_Int - 1)
              • If (MissileIndex Equal to 0) then do (Trigger - Turn off (This trigger)) else do (-------- 0 --------)
            • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top