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

Destroy a dummy unit for a Shockwave based ability

Status
Not open for further replies.
Level 6
Joined
Apr 5, 2013
Messages
154
  • Chaos Font
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chaos Font
    • Actions
      • Set ChaosFontCaster = (Triggering unit)
      • Sound - Play AncestralSpirit <gen> at 100.00% volume, located at (Position of ChaosFontCaster) with Z offset 0.00
      • Sound - Play FireBallMissileLaunch1 <gen> at 100.00% volume, located at (Position of ChaosFontCaster) with Z offset 0.00
      • Set ChaosFontLocation = (Target point of ability being cast)
      • Set ChaosFontCasterLocation = (Position of (Triggering unit))
      • Unit - Create 1 Flameroc for Neutral Passive at ((Position of ChaosFontCaster) offset by 25.00 towards (Facing of ChaosFontCaster) degrees) facing ChaosFontLocation
      • Set ChaosFontBolt = (Last created unit)
      • Trigger - Turn on Chaos Font Moving <gen>
      • Wait ((Distance between ChaosFontCasterLocation and ChaosFontLocation) - 1998.00) seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ChaosFontBolt is alive) Equal to True
        • Then - Actions
          • Unit - Kill ChaosFontBolt
          • Special Effect - Create a special effect at (Position of ChaosFontBolt) using Abilities\Spells\Items\AIam\AIamTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Trigger - Turn off Chaos Font Damage <gen>
          • Trigger - Turn off Chaos Font Moving <gen>
        • Else - Actions
So, im trying to make it so that the ChaosFontBolt dummy unit dies when it reaches the target point of ability being cast. Me being shitty at math, i have no idea of doing that. Any help here? The ability is based off Shockwave, and the maximum distance of it is 2000 units, and the ChaosFontBolt moves 40 units every 0.03 second.
 
Last edited by a moderator:
Level 15
Joined
Sep 29, 2008
Messages
362
  • Chaos Font
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chaos Font
    • Actions
      • Set ChaosFontCaster = (Triggering unit)
      • Sound - Play AncestralSpirit <gen> at 100.00% volume, located at (Position of ChaosFontCaster) with Z offset 0.00
      • Sound - Play FireBallMissileLaunch1 <gen> at 100.00% volume, located at (Position of ChaosFontCaster) with Z offset 0.00
      • Set ChaosFontLocation = (Target point of ability being cast)
      • Set ChaosFontCasterLocation = (Position of (Triggering unit))
      • Unit - Create 1 Flameroc for Neutral Passive at ((Position of ChaosFontCaster) offset by 25.00 towards (Facing of ChaosFontCaster) degrees) facing ChaosFontLocation
      • Set ChaosFontBolt = (Last created unit)
      • Trigger - Turn on Chaos Font Moving <gen>
      • Wait ((Distance between ChaosFontCasterLocation and ChaosFontLocation) - 1998.00) seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ChaosFontBolt is alive) Equal to True
        • Then - Actions
          • Unit - Kill ChaosFontBolt
          • Special Effect - Create a special effect at (Position of ChaosFontBolt) using Abilities\Spells\Items\AIam\AIamTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Trigger - Turn off Chaos Font Damage <gen>
          • Trigger - Turn off Chaos Font Moving <gen>
        • Else - Actions
So, im trying to make it so that the ChaosFontBolt dummy unit dies when it reaches the target point of ability being cast. Me being shitty at math, i have no idea of doing that. Any help here? The ability is based off Shockwave, and the maximum distance of it is 2000 units, and the ChaosFontBolt moves 40 units every 0.03 second. I posted this to the Trigger Help forum, but no luck there, so i thought of asking for help here too.

As I can see, u have another trigger that is runing in periodic time to move the ChaosFonBolt dummy.
If I'm right you can solve your question just counting times that are necessary to displace the distance between your caster and the target location.
You can store the distance into a global real variable and divide that by 40.
then make your distance var decrease 1 unit on each periodic trigger execution. When the var reaches zero just kill the dummy.

Graphic sample (not exactly code)
Code:
yourpastedtrigger
 Event
     Caster blah blah
 actions
    set tempPoint1 = Position of Casting Unit
    set tempPoint2 = target location of ability being cast
    set DistanceVar = Distance between tempPoint1 and tempPoint2
    set DistanceVar = DistanceVar / 40
    ....
    blah blah
    ....
   custom script "call RemoveLocation(udg_tempPoint1)"
   custom script "call RemoveLocation(udg_tempPoint2)"

Put this code into your periodic trigger

Code:
 Event
actions
   ....
   set   DistanceVar = DistanceVar - 1
   If (DistanceVar < 1) then
       kill ChaosFontBolt 
       turn off thistrigger
   endif
   ....


you can parse DistanceVar Into an integer var using converter real to integer to make clean decreases

Note: in other aspect your trigger has several location leaks
just move this instruction "Set ChaosFontCasterLocation = (Position of (Triggering unit))" to the beginning of the trigger and replace with it all expresions like "(Position of ChaosFontCaster)" then clear the leaks using: custom script "call RemoveLocation(udg_ChaosFontCasterLocation)", at the end of the trigger.
 
Level 10
Joined
Apr 4, 2010
Messages
509
2000 / 40 = 50
0.03 x 50 = 1.5
It takes 1.5 seconds for ChaosFontBolt to travel 2000 units.

You can go (Custom Value of ChaosFontBolt + 1) every 0.03 seconds and when it's custom value reaches 50, you kill it.

OR

You can go (Custom Value of ChaosFontBolt + 40) every 0.03 seconds and when it's custom value reaches 2000, you kill it.

OR

Just add a 1.5sec Expiry timer.
 
Status
Not open for further replies.
Top