- Joined
- Apr 7, 2007
- Messages
- 48
Ok before I post the actual code this is my absolute first time using JASS. I did this in GUI and couldnt get it to be MUI, so i decided to have a go at this. So don't bite my head off if there are a thousand things wrong with it *whimpers*
Its supposed to take a unit, charge it in a straight line at another unit ignoring collisons and stuff, be MUI, and hopefully leak free. It works perfectly fine but I want to know how to get a smoother motion for the charge and anything else horribly incorrect with my script. Also, I don't have to worry about the target unit moving, its stunned, nor do i care if it does move.
JASS:
function Charge_Move takes unit u, unit t returns nothing
local location p = GetUnitLoc(u)
local location o = GetUnitLoc(t)
local real d = DistanceBetweenPoints(p,o)
local integer i = 0
call PauseUnit(u,TRUE)
call SetUnitPathing(u,FALSE)
call SetUnitFacing(u,AngleBetweenPoints(p,o))
loop
exitwhen i==10
call SetUnitPositionLoc(u,PolarProjectionBJ(p,d/10,GetUnitFacing(u)))
set p = GetUnitLoc(u)
set i = i+1
call TriggerSleepAction(.1)
endloop
call PauseUnit(u,FALSE)
call SetUnitPathing(u,TRUE)
call IssueTargetOrder(u, "attack", t)
call RemoveLocation(p)
call RemoveLocation(o)
endfunction
Its supposed to take a unit, charge it in a straight line at another unit ignoring collisons and stuff, be MUI, and hopefully leak free. It works perfectly fine but I want to know how to get a smoother motion for the charge and anything else horribly incorrect with my script. Also, I don't have to worry about the target unit moving, its stunned, nor do i care if it does move.