- Joined
- Aug 21, 2008
- Messages
- 533
i m new to jass and this one of my first spells. Till now it only shoots a projectile to a target location, unfortuenly instaed of the targetet location it always shoots to the middle of the map.
i used Kattana’s Local Handle Vars.(they work properly)
JASS:
function Trig_Granateint_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return true
endif
return true
endfunction
function w8st takes nothing returns nothing
local location l
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t,"u")
local real angle =GetHandleReal(t,"angle")
local real fd =GetHandleReal(t,"flydown")
set l = GetUnitLoc(u)
set l =PolarProjectionBJ(l, 30, angle)
call SetUnitPositionLoc(u,l)
call SetUnitFlyHeightBJ( u, (GetUnitFlyHeight(u))-fd, 0.00 )
set t = null
set u = null
set l = null
endfunction
function Trig_Granateint_Actions takes nothing returns nothing
local location array l
local real angle
local integer dist
local real flydown
local timer waitp = CreateTimer()
local unit u = GetTriggerUnit()
set l[1]= GetUnitLoc(u)
//i think here is the mistake
set l[2]= GetSpellTargetLoc()
//I think here is the mistake
set angle = AngleBetweenPoints(l[1],l[2])
set dist = (R2I(DistanceBetweenPoints(l[1],l[2]))/30)
set flydown = 80/dist
call CreateNUnitsAtLoc(1, 'u000', Player(0), l[1], 1 )
set u = GetLastCreatedUnit()
call SetHandleHandle(waitp,"u",u)
call SetHandleReal(waitp,"angle",angle)
call SetHandleReal(waitp,"flydown",flydown)
call TimerStart(waitp,0.03,true,function w8st)
call TriggerSleepAction(0.03*dist)
call FlushHandleLocals(waitp)
call DestroyTimer(waitp)
set l[1] = null
set l[2] = null
set waitp = null
set u = null
endfunction
//===========================================================================
function InitTrig_Granateint takes nothing returns nothing
set gg_trg_Granateint = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Granateint, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Granateint, Condition( function Trig_Granateint_Conditions ) )
call TriggerAddAction( gg_trg_Granateint, function Trig_Granateint_Actions )
endfunction
i used Kattana’s Local Handle Vars.(they work properly)