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

Dummy missile problem

Status
Not open for further replies.
Level 3
Joined
Mar 26, 2019
Messages
54
Here is my trigger
  • Hollow Cannon Damage
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set temp_group[0] = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Hollow Cannon Missle))
      • Unit Group - Pick every unit in temp_group[0] and do (Actions)
        • Loop - Actions
          • Set temp_point[0] = (Position of (Picked unit))
          • Set temp_group[1] = (Units within 200.00 of temp_point[0] matching (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True))
          • Set temp_hero = Hero[(Player number of (Owner of (Picked unit)))]
          • Set temp_real = ((20.00 x (Real((Level of Hollow Cannon for temp_hero)))) + ((Real((Intelligence of temp_hero (Include bonuses)))) x (0.05 x (2.00 + (Real((Level of Hollow Cannon for temp_hero)))))))
          • Special Effect - Create a special effect at temp_point[0] using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit Group - Pick every unit in temp_group[1] and do (Actions)
            • Loop - Actions
              • Unit - Cause temp_hero to damage (Picked unit), dealing temp_real damage of attack type Spells and damage type Cold
              • Floating Text - Create floating text that reads (String(temp_real)) 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 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 2.00 seconds
          • Custom script: call DestroyGroup(udg_temp_group[1])
          • Custom script: call RemoveLocation(udg_temp_point[1])
          • Custom script: set udg_temp_hero = null
      • Custom script: call DestroyGroup(udg_temp_group[0])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in temp_group[0]) Greater than or equal to 1
        • Then - Actions
        • Else - Actions
          • Trigger - Turn off (This trigger)
  • Hollow Cannon
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Ability being cast) Equal to Hollow Cannon
    • Actions
      • Set temp_point[0] = (Position of (Triggering unit))
      • Set temp_point[1] = (Target point of ability being cast)
      • Unit - Create 1 Hollow Cannon Missle for (Owner of (Triggering unit)) at temp_point[0] facing temp_point[1]
      • Unit - Add a ((Distance between temp_point[0] and temp_point[1]) / 325.00) second Water Elemental expiration timer to (Last created unit)
      • Unit - Make (Last created unit) Explode on death
      • Trigger - Turn on Hollow Cannon Damage <gen>
      • Unit - Order (Last created unit) to Move To temp_point[1]
      • Custom script: call RemoveLocation(udg_temp_point[0])
      • Custom script: call RemoveLocation(udg_temp_point[1])
For some reason, the first trigger doesn't work at all. When I remove the 'turn off trigger" action, the first trigger only apply damage when the missile die. So can anyone help me with this? How to detect a dummy missile that are alive with a timer? Thank in advance.
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
If the Hollow Cannon Missile units have locust they will NOT be found by “units in region” search.

Picking all units on the map (even with a filter) every 0.10 seconds is a particularly performance intensive action. Many different triggers doing that will absolutely cause performance issues. Instead it’s better to use a global group (that you never destroy) for all the appropriate units; add them to the group when you create them and remove them when they die. If you insist on not using a global group instead there is the “units of type” action.

You are destroying TempGroup[0] right before checking how many units are in it. It will always think there are 0 units because the group no longer exists. Also JASS seems to have some problems with If-blocks that have empty Then sections. Instead, invert the condition (number in group = 0) and move the else action to the then section.

In general, creating dummy missiles and ordering them to move to a location is not an ideal solution. You’re limited on projectile speed to the max movement speed, units may path in unpredictable ways depending on the exact location you order them to move to, and the timing to remove them with expiration timers may not be precise. It’s better to move them with triggers, though it should functionally work using the move-order method.
 
Level 3
Joined
Mar 26, 2019
Messages
54
If the Hollow Cannon Missile units have locust they will NOT be found by “units in region” search.

Picking all units on the map (even with a filter) every 0.10 seconds is a particularly performance intensive action. Many different triggers doing that will absolutely cause performance issues. Instead it’s better to use a global group (that you never destroy) for all the appropriate units; add them to the group when you create them and remove them when they die. If you insist on not using a global group instead there is the “units of type” action.

You are destroying TempGroup[0] right before checking how many units are in it. It will always think there are 0 units because the group no longer exists. Also JASS seems to have some problems with If-blocks that have empty Then sections. Instead, invert the condition (number in group = 0) and move the else action to the then section.

In general, creating dummy missiles and ordering them to move to a location is not an ideal solution. You’re limited on projectile speed to the max movement speed, units may path in unpredictable ways depending on the exact location you order them to move to, and the timing to remove them with expiration timers may not be precise. It’s better to move them with triggers, though it should functionally work using the move-order method.
Thank you. But in my case, dummy missile is good enough, since the ability target ground. And, how can I make the missile lose health bar, since locust is not possible?
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
You can give them locust... you just can't give them locust and also use "units in region". You can (as I specifically said in the post you quoted) use "Units of Type" (which can find locust units) or create a global group variable and put the missile units into that group when they are created (best solution).
 
Level 3
Joined
Mar 26, 2019
Messages
54
You can give them locust... you just can't give them locust and also use "units in region". You can (as I specifically said in the post you quoted) use "Units of Type" (which can find locust units) or create a global group variable and put the missile units into that group when they are created (best solution).
Well, thank you really much.
 
Status
Not open for further replies.
Top