• 🏆 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] Issue with missile spawning

Level 11
Joined
Aug 11, 2009
Messages
594
I have a boss that I want up to 5 boulders rolling around the room. However, only the first one spawns. The game message "Boulder spawn" shows up everytime but no missile is created other than first one. Anyone has a suggestion what could cause the issue?

  • OP2 Boss Spell
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • IsDamageAttack Equal to True
          • (Unit-type of DamageEventSource) Equal to |cffff0000Mountain Breaker|r (OP 2)
    • Actions
      • Unit - Set mana of DamageEventSource to ((Mana of DamageEventSource) + 200.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of DamageEventSource) Equal to 1000.00
        • Then - Actions
          • Unit - Order DamageEventSource to Orc Tauren Chieftain - War Stomp.
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Out2_BoulderCount Less than 5
            • Then - Actions
              • Set VariableSet Out2_BoulderCount = (Out2_BoulderCount + 1)
              • Set VariableSet Out2_Randomizer = (Random integer number between 1 and 2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Out2_Randomizer Equal to 1
                • Then - Actions
                  • Game - Display to (All players) the text: Boulder spawn
                  • Set VariableSet MissileStart = Out2_BossPoint
                  • Set VariableSet MissileStartZ = 0.00
                  • Set VariableSet MissileFinish = (Random point in OP2 Boulder West <gen>)
                  • Set VariableSet MissileFinishZ = 0.00
                  • Set VariableSet MissileModel = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
                  • Set VariableSet MissileSpeed = 200.00
                  • Set VariableSet MissileSource = Out2_Boss
                  • Set VariableSet MissileOwner = Neutral Hostile
                  • Set VariableSet MissileCollision = 200.00
                  • Set VariableSet MissileScale = 6.00
                  • Set VariableSet Missile_onHit = OP2 Boulder onHit <gen>
                  • Set VariableSet Missile_onFinish = OP2 Boulder onFinish <gen>
                  • Trigger - Run MissileCreate <gen> (ignoring conditions)
                • Else - Actions
                  • Game - Display to (All players) the text: Boulder spawn
                  • Set VariableSet MissileStart = Out2_BossPoint
                  • Set VariableSet MissileStartZ = 0.00
                  • Set VariableSet MissileFinish = (Random point in OP2 Boulder East <gen>)
                  • Set VariableSet MissileFinishZ = 0.00
                  • Set VariableSet MissileModel = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
                  • Set VariableSet MissileSpeed = 200.00
                  • Set VariableSet MissileSource = Out2_Boss
                  • Set VariableSet MissileOwner = Neutral Hostile
                  • Set VariableSet MissileCollision = 200.00
                  • Set VariableSet MissileScale = 6.00
                  • Set VariableSet Missile_onHit = OP2 Boulder onHit <gen>
                  • Set VariableSet Missile_onFinish = OP2 Boulder onFinish <gen>
                  • Trigger - Run MissileCreate <gen> (ignoring conditions)
            • Else - Actions
        • Else - Actions

EDIT: Made a region and used it instead of the pre set variable "Out2_BossPoint" as MissileStart and it solved the problem. Maybe the missile system destroy the variable or something because I used the same variable (Out2_BossPoint) to respawn the Boss, and he didnt after spawning one boulder.
But yeah, now everything works xD
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
Like you said in your edit, MissileStart is being set to Out2_BossPoint which means they're tracking the same location. When you Run MissileCreate the system does it's thing and then cleans up the memory leaks, removing the location that both MissileStart and Out2_BossPoint are keeping track of.

A simple solution would be to use a Point with Offset:
  • Set VariableSet MissileStart = (Out2_BossPoint offset by 0.00, 0.00)
This will create a unique location rather than sharing the same one.

Here's the final product with some other optimizations:
  • OP2 Boss Spell
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • IsDamageAttack Equal to True
      • (Unit-type of DamageEventSource) Equal to |cffff0000Mountain Breaker|r (OP 2)
    • Actions
      • Unit - Set mana of DamageEventSource to ((Mana of DamageEventSource) + 200.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of DamageEventSource) Equal to 1000.00
        • Then - Actions
          • Unit - Order DamageEventSource to Orc Tauren Chieftain - War Stomp.
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Out2_BoulderCount Less than 5
            • Then - Actions
              • Set VariableSet Out2_BoulderCount = (Out2_BoulderCount + 1)
              • Set VariableSet Out2_Randomizer = (Random integer number between 1 and 2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Out2_Randomizer Equal to 1
                • Then - Actions
                  • Set VariableSet MissileFinish = (Random point in OP2 Boulder West <gen>)
                • Else - Actions
                  • Set VariableSet MissileFinish = (Random point in OP2 Boulder East <gen>)
              • Game - Display to (All players) the text: Boulder spawn
              • Set VariableSet MissileStart = (Out2_BossPoint offset by 0.00, 0.00)
              • Set VariableSet MissileStartZ = 0.00
              • Set VariableSet MissileFinishZ = 0.00
              • Set VariableSet MissileModel = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
              • Set VariableSet MissileSpeed = 200.00
              • Set VariableSet MissileSource = Out2_Boss
              • Set VariableSet MissileOwner = Neutral Hostile
              • Set VariableSet MissileCollision = 200.00
              • Set VariableSet MissileScale = 6.00
              • Set VariableSet Missile_onHit = OP2 Boulder onHit <gen>
              • Set VariableSet Missile_onFinish = OP2 Boulder onFinish <gen>
              • Trigger - Run MissileCreate <gen> (ignoring conditions)
            • Else - Actions
        • Else - Actions
I removed some redundancy in your Randomizer setup since the only thing you change is the MissileFinish. I also got rid of the unnecessary And you were using:
  • And - All (Conditions) are true
That's how Conditions work by default, they all need to be true.

You will rarely need to use And - it's only necessary when you have some elaborate Condition setup that uses Or as well.
 
Last edited:
Top