Need help fast with some triggering!

Level 18
Joined
Oct 18, 2007
Messages
931
Ok im trying to make a spell that "shoots" or moves the caster quickly to the targeted spell point, but i got a major bug. When i cast it the first time it does nothing. I walk a little bit away from the first cast point, cast the spell again at some random point and i get draged to the first point :S
The spell
  • Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shockwave
    • Actions
      • Set MovingUnit = (Casting unit)
      • Set Point1 = (Target point of ability being cast)
      • Set Point2 = (Position of MovingUnit)
      • Set Facing = (Angle from Point2 to Point1)
      • Set Distance = (Distance between Point1 and Point2)
      • Countdown Timer - Start Timer as a Repeating timer that will expire in 0.01 seconds
The loop
  • Loop
    • Events
      • Time - Timer expires
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Distance Greater than 100.00
        • Then - Actions
          • Special Effect - Create a special effect at Point2 using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
          • Set Effect = (Last created special effect)
          • Special Effect - Destroy Effect
          • Set MovePoint = (Point2 offset by 5.00 towards Facing degrees)
          • Custom script: call RemoveLocation(udg_Point2)
          • Unit - Move MovingUnit instantly to MovePoint
          • Custom script: call RemoveLocation(udg_MovePoint)
          • Custom script: call RemoveLocation(udg_Point1)
          • Set Point2 = (Position of MovingUnit)
          • Set Point1 = (Target point of ability being cast)
          • Set Facing = (Angle from Point2 to Point1)
          • Set Distance = (Distance between Point1 and Point2)
        • Else - Actions
          • Custom script: call RemoveLocation(udg_Point2)
          • Custom script: call RemoveLocation(udg_MovePoint)
          • Custom script: call RemoveLocation(udg_Point1)
          • Countdown Timer - Pause Timer
          • Set MovingUnit = No unit
The Variables

Code:
Distance - Real - 0 (Default)
Effect - Special Effect
End Point - Point
Facing - Real - 0 (Default)
Move Point - Point
Moving Unit - Unit
Point1 - point
Point2 - point
Timer - timer

If someone know how to fix this, just write anything :p
 

Attachments

  • Shoot.w3x
    18.4 KB · Views: 36
Level 6
Joined
Jul 22, 2008
Messages
243
This should do it i think


  • Loop
  • Events
    • Time - Timer expires
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
  • Distance Greater than 100.00
    • Then - Actions
  • Special Effect - Create a special effect at Point2 using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
  • Set Effect = (Last created special effect)
  • Special Effect - Destroy Effect
  • Set MovePoint = (Point2 offset by 5.00 towards Facing degrees)
  • Custom script: call RemoveLocation(udg_Point2)
  • Unit - Move MovingUnit instantly to MovePoint
  • Custom script: call RemoveLocation(udg_MovePoint)
  • Set Point2 = (Position of MovingUnit)
  • Set Distance = (Distance between Point1 and Point2)
    • Else - Actions
  • Custom script: call RemoveLocation(udg_Point2)
  • Custom script: call RemoveLocation(udg_MovePoint)
  • Custom script: call RemoveLocation(udg_Point1)
  • Countdown Timer - Pause Timer
  • Set MovingUnit = No unit
 
Top