Jass Slide Trigger Help

warden13

New Member
Reaction score
32
Hi, I have a spell that pulls target enemy unit as sliding. It works but not as I wanted. (For example) It must pull 10 range then 20 then 30 each loop. I mean starts slow and ends fast. And it will look like a magnet. My trigger is completely reverse of this.. :D Starts fast and ends slow. First 100 then 90 then 80 til the target comes near caster. Here is my triggers, what is wrong?

JASS:
set x=GetUnitX(GetSpellAbilityUnit())
set y=GetUnitY(GetSpellAbilityUnit())
set ex=GetUnitX(enum)
set ey=GetUnitY(enum)
set dx=ex-x
set dy=ey-y
call SetUnitX(enum,ex-dx/20)
call SetUnitY(enum,ey-dy/20)
 

Jesus4Lyf

Good Idea™
Reaction score
397
Simple solution:
JASS:
set x=GetUnitX(GetSpellAbilityUnit())
set y=GetUnitY(GetSpellAbilityUnit())
set ex=GetUnitX(enum)
set ey=GetUnitY(enum)
set dx=ex-x
set dy=ey-y
// I only changed below here
call SetUnitX(enum,ex-300/dx)
call SetUnitY(enum,ey-300/dy)

Before edit suggestion that still kind of applies:
You may want to divide it by SquareRoot(dx*dx+dy*dy) and multiply by a constant instead of divide by 20. The constant will be the total distance/period increase per tick. ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top