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

Ability deal damage on impact? with trigers

Status
Not open for further replies.
Level 5
Joined
Aug 12, 2010
Messages
87
The problem is when i use "unit begins casting ability" then add damage on "point of ability being casted" in game damage inflicts instantly the missile is still flying but damage done and that looks tragic, so any one know how to damage unit then missile reaches target? :ogre_rage:
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Generally you should use starts the effect of an ability event.

You need to use custom projectile system. Either code your own or download an existing one.

The basic idea is to create a dummy unit, attach the missile effect to the unit, and move the dummy periodically towards the targeted point. Then you check the distance to the target point of ability being cast and if it is under certain threshold, deal damage.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
The formula is Speed = Distance / Time
Therefore, you just need the Time, the formula would be Distance / Speed = Time
The only thing I can think is using Wait or TriggerSleepAction (or something like that in JASS) but this method is bugged when spam casted or used by more than one unit/player
This is the formula:
  • Wait ((Distance between (Position of *YourUnit*) and (Position of *EnemyUnit*)) / 1000.00) seconds
1000 is the speed of the projectile, usually missiles would be in that range such as Storm Bolt default ability
 
Level 13
Joined
Oct 25, 2009
Messages
995
Can you help to fix it?
  • Grenade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Grenade [G]
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) Food used) Greater than or equal to 50
        • Then - Actions
          • Player - Add -50 to (Owner of (Triggering unit)) Food used
          • Set TempPoint = (Position of (Triggering unit))
          • Set G_T = 0.20
          • Set TempPoint2 = (Target point of ability being cast)
          • Unit - Create 1 dummy unit for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Set TempUnit = (Last created unit)
          • Unit - Add grenade projectile to TempUnit
          • Unit - Add a 2.00 second Generic expiration timer to TempUnit
          • Unit - Create 1 dummy unit (vulnerable) for (Owner of (Triggering unit)) at TempPoint2 facing Default building facing degrees
          • Set TempUnit2 = (Last created unit)
          • Unit - Order TempUnit to Neutral Alchemist - Acid Bomb TempUnit2
          • Unit - Add a 2.00 second Generic expiration timer to TempUnit2
          • Wait ((Distance between TempPoint and TempPoint2) / 700.00) seconds
          • Wait 0.40 seconds
          • Set GG = (Units within 250.00 of (Position of TempUnit2) matching ((Unit-type of (Matching unit)) Equal to Soldiers))
          • Unit Group - Pick every unit in GG and do (Actions)
            • Loop - Actions
              • Unit - Cause TempUnit2 to damage (Picked unit), dealing (Random real number between 650.00 and 750.00) damage of attack type Pierce and damage type Normal
          • Custom script: call DestroyGroup(udg_GG)
          • Special Effect - Create a special effect at TempPoint2 using war3mapImported\NewDirtEXNofire.mdx
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_TempPoint2)
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
When i casted,another people also cast,the grenade wont explosion but it explosion on another people casted point. :goblin_boom:
 
Status
Not open for further replies.
Top