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

Why my unit moved to center of playable map?

Status
Not open for further replies.
Level 10
Joined
Jun 17, 2014
Messages
236
I've create blink spell that gives damage to nearby enemy unit before caster is moved after the animation complete, the damage work but my caster moved to center of map, not to target point. i dont know why
  • Untitled Trigger 005
    • Events
      • Unit - A unit Finisheh casting ability
    • Conditions
      • (Ability being cast) Equal to (Boa) Poison Trail
    • Actions
      • Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
      • Unit - Move (Triggering unit) instantly to (Target point of ability being cast)
if i use start the effect of an ability, the caster will instantly moved (work to target point) but dont play the animation
and when i use finishes casting an ability or stop casting an ability the caster moved after the animation complete but it moved to center of map
dont worry about the leaks.
attachment.php
 

Attachments

  • Capture.PNG
    Capture.PNG
    12.2 KB · Views: 125
Level 37
Joined
Jul 22, 2015
Messages
3,485
There is no (Target point) if you're using the event "Finishes casting an ability". You will need to use a loop that starts on cast so that you can store the location of the targeted point and then move them after the "animation duration" is reached.


So if your animation time is 5 seconds:
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your ability
    • Actions
      • Set Caster = (Triggering unit)
      • Set Target = (Target point of ability being cast)
      • Set Counter = 0.00
      • Trigger - Turn on Loop <gen>

  • Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Counter = (Counter + 1.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Counter Greater than or equal to 5.00
        • Then - Actions
          • Unit - Move Caster instantly to Target
          • Custom script: call RemoveLocation(udg_Target)
          • Trigger - Turn off Loop <gen>
        • Else - Actions
 
Level 10
Joined
Jun 17, 2014
Messages
236
There is no (Target point) if you're using the event "Finishes casting an ability". You will need to use a loop that starts on cast so that you can store the location of the targeted point and then move them after the "animation duration" is reached.


So if your animation time is 5 seconds:
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your ability
    • Actions
      • Set Caster = (Triggering unit)
      • Set Target = (Target point of ability being cast)
      • Set Counter = 0.00
      • Trigger - Turn on Loop <gen>
  • Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Counter = (Counter + 1.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Counter Greater than or equal to 5.00
        • Then - Actions
          • Unit - Move Caster instantly to Target
          • Custom script: call RemoveLocation(udg_Target)
          • Trigger - Turn off Loop <gen>
        • Else - Actions

oh thanks it work.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
"A unit Finisheh an ability" 0.o

At least on the event that we do know (Unit - A unit Finishes casting an ability), the data of the target is lost.
So the location created from the targeted coordinates is created on (0, 0)... which is ussually the center of the map.

What you could do is add a casting time in the ability you are casting... then using another event that we know (Unit - A unit Starts the effect of an ability).
Then it would work properly.
 
There is no (Target point) if you're using the event "Finishes casting an ability". You will need to use a loop that starts on cast so that you can store the location of the targeted point and then move them after the "animation duration" is reached.


So if your animation time is 5 seconds:
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your ability
    • Actions
      • Set Caster = (Triggering unit)
      • Set Target = (Target point of ability being cast)
      • Set Counter = 0.00
      • Trigger - Turn on Loop <gen>

  • Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Counter = (Counter + 1.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Counter Greater than or equal to 5.00
        • Then - Actions
          • Unit - Move Caster instantly to Target
          • Custom script: call RemoveLocation(udg_Target)
          • Trigger - Turn off Loop <gen>
        • Else - Actions

I don't think that's MUI
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,467
Using Spell System gives you access to the target point even from a "spell finish" event.

  • Spell Config
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Set Spell__Ability = (Boa) Poison Trail
      • Set Spell__Trigger_OnFinish = Spell Cast <gen>
      • Trigger - Run Spell System <gen> (ignoring conditions)
  • Spell Finish
    • Events
    • Conditions
    • Actions
      • Set Spell__InRangePoint = Spell__CastPoint
      • Set Spell__InRange = 300.00
      • Unit Group - Pick every unit in Spell__InRangeGroup and do (Actions)
        • Loop - Actions
          • Unit - Cause Spell__Caster to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
      • Unit - Move Spell__Caster instantly to Spell__TargetPoint
MUI, has no leaks and only picks enemy vulnerable units to be damaged.

http://www.hiveworkshop.com/forums/spells-569/gui-spell-system-v1-5-0-0-a-273415/
 
Status
Not open for further replies.
Top