JASS:
function Trig_Mvm_Func001A takes nothing returns nothing
//local real tfrequency=0.05
local real tfrequency=t
local real g=9.8
local real cameraangle
local real heroagi
local real to
local real scale=20
local real ScaleY=scaley
local real deltatime
local real Vox
local real Voy
local real tmax
local real Sy
local real Sx
local real hprev=0
local real hnext=0
local real Zprev
local real Znext
set temp_unit_Arrow = GetEnumUnit()
set heroagi=GetUnitUserData(temp_unit_Arrow)
// set cameraangle=GetUnitState(temp_unit_Arrow, UNIT_STATE_MANA))
set cameraangle=a
set to=GetUnitState(temp_unit_Arrow, UNIT_STATE_LIFE)/100
set Vox=evaluateHeroagi(heroagi)*CosBJ(cameraangle)
set Voy=evaluateHeroagi(heroagi)*SinBJ(cameraangle)
set tmax=Voy/g
set Sx=Vox*tfrequency*scale
set deltatime=clock-to
if (GetUnitFlyHeight(temp_unit_Arrow)<=2) then
//call BJDebugMsg("to="+R2S(to)+";deltat="+R2S(deltatime))
//call BJDebugMsg("Vox="+R2S(Vox)+";Voy="+R2S(Voy))
//call BJDebugMsg("evaluateHeroagi="+R2S(evaluateHeroagi(heroagi))+";Cos="+R2S(CosBJ(cameraangle)))
//call BJDebugMsg("evaluateHeroagi="+R2S(evaluateHeroagi(heroagi))+";Sin="+R2S(SinBJ(cameraangle)))
//call BJDebugMsg("Tmax="+R2S(tmax)+";Sin="+R2S(SinBJ(cameraangle)))
//call BJDebugMsg("Sx="+R2S(Sx))
//call BJDebugMsg("A="+R2S(a))
call impact()
else
if deltatime<=tmax then
set Sy=(Voy*tfrequency-g*tfrequency*(2*deltatime-tfrequency)/2)*ScaleY
set Zprev=GetLocationZ(GetUnitLoc(temp_unit_Arrow))
set hprev=GetUnitFlyHeight(temp_unit_Arrow)+Zprev
set hnext=hprev+Sy
set temp_loc_currentpoint=GetUnitLoc(temp_unit_Arrow)
set temp_loc_destinationpoint=PolarProjectionBJ(temp_loc_currentpoint,Sx,GetUnitFacing(temp_unit_Arrow))
set Znext=GetLocationZ(temp_loc_destinationpoint)
call SetUnitFlyHeight(temp_unit_Arrow,hnext-Znext,0)
call SetUnitPositionLocFacingBJ( temp_unit_Arrow, temp_loc_destinationpoint, GetUnitFacing(temp_unit_Arrow) )
//call BJDebugMsg("up;hprev="+R2S(hprev)+";hnext="+R2S(hnext))
//call BJDebugMsg("up;fprev="+R2S(hprev-Zprev)+";fnext="+R2S(hnext-Znext))
call RemoveLocation(temp_loc_currentpoint)
call RemoveLocation(temp_loc_destinationpoint)
set temp_loc_destinationpoint=GetUnitLoc(temp_unit_Arrow) //for use in ArrowDamageUnit
set temp_group_ArrowsBowHit=GetUnitsInRangeOfLocAll(50,temp_loc_destinationpoint)
call ForGroupBJ(temp_group_ArrowsBowHit, function ArrowDamageUnit)
call DestroyGroup(temp_group_ArrowsBowHit)
else
set Sy=g*tfrequency*(2*deltatime-tfrequency)*ScaleY/2
set Zprev=GetLocationZ(GetUnitLoc(temp_unit_Arrow))
set hprev=GetUnitFlyHeight(temp_unit_Arrow)+Zprev
set hnext=hprev-Sy
set temp_loc_currentpoint=GetUnitLoc(temp_unit_Arrow)
set temp_loc_destinationpoint=PolarProjectionBJ(temp_loc_currentpoint,Sx,GetUnitFacing(temp_unit_Arrow))
set Znext=GetLocationZ(temp_loc_destinationpoint)
call SetUnitFlyHeight(temp_unit_Arrow,hnext-Znext,0)
call SetUnitPositionLocFacingBJ( temp_unit_Arrow, temp_loc_destinationpoint, GetUnitFacing(temp_unit_Arrow) )
//call BJDebugMsg("down;hprev="+R2S(hprev)+";hnext="+R2S(hnext))
//call BJDebugMsg("down;fprev="+R2S(hprev-Zprev)+";fnext="+R2S(hnext-Znext))
call RemoveLocation(temp_loc_currentpoint)
call RemoveLocation(temp_loc_destinationpoint)
set temp_loc_destinationpoint=GetUnitLoc(temp_unit_Arrow)//for use in ArrowDamageUnit
set temp_group_ArrowsBowHit=GetUnitsInRangeOfLocAll(50,temp_loc_destinationpoint)
call ForGroupBJ(temp_group_ArrowsBowHit, function ArrowDamageUnit)
call DestroyGroup(temp_group_ArrowsBowHit)
endif
endif
endfunction
I want to make arrow move like parabol with noise terrain. But it' didn't work. Can someone have solution ?
Attachments
Last edited by a moderator: