- Joined
- Nov 13, 2006
- Messages
- 1,814
coz for me allways crash when i call this func, if i dont use 1 parameter then its dont crashing, so have any solution for this?
JASS:
function Missile takes unit launcher, unit target, string sfx1, string sfx2, string sfx3, string sfx4, real deathtime, real collision, real x1, real y1, real z1, real x2, real y2, real z2, real speed, real maxspeed, real accelerate, real arc, real arcdist, boolean parabola, real dmg1, real dmg2, real aoe, real dmg3, boolean homing, boolean suicide, boolean knockback, boolean jump, boolean fall, boolean killtree, real timeleft, integer bounceleft returns nothing
local integer i
local real dx = x2 - x1
local real dy = y2 - y1
local real r
local real dist = SquareRoot(dx * dx + dy * dy)
local real ang = Atan2(dy, dx)
local real zh1
local real zh2
call MoveLocation(udg_p, x1, y1)
set zh1 = GetLocationZ(udg_p)
call MoveLocation(udg_p, x2, y2)
set zh2 = GetLocationZ(udg_p)
set udg_MS_Index = udg_MS_Index + 1
set i = udg_MS_Index
set udg_MS_End[i] = false
set udg_MS_StartZ[i] = zh1 + z1 + GetUnitFlyHeight(launcher)
set udg_MS_X[i] = x1
set udg_MS_Y[i] = y1
set udg_MS_Z[i] = udg_MS_StartZ[i]
set udg_MS_Angle[i] = ang
set udg_MS_CurDist[i] = 0
set udg_MS_MaxDist[i] = dist
set udg_MS_Launcher[i] = launcher
set udg_MS_StartX[i] = x1
set udg_MS_StartY[i] = y1
set udg_MS_Knockback[i] = knockback
set udg_MS_Jump[i] = jump
set udg_MS_DeathTime[i] = deathtime
set udg_MS_Exp_Timer[i] = timeleft
set udg_MS_Falling[i] = fall
set udg_MS_KillTree[i] = killtree
set udg_MS_BounceLeft[i] = bounceleft
set udg_MS_Collision[i] = collision
set udg_MS_Suicide[i] = suicide
set udg_MS_Dmg_Ex[i] = dmg3
set udg_MS_Height[i] = udg_MS_Z[i]
set udg_MS_TargetX[i] = x2
set udg_MS_TargetY[i] = y2
set udg_MS_TargetZ[i] = zh2 + z2 + GetUnitFlyHeight(target)
set udg_MS_Dmg_Type[i] = 1
set udg_MS_Player[i] = GetOwningPlayer(launcher)
if arc != 0 then
set udg_MS_ArcDist[i] = arcdist
set udg_MS_ArcAngle[i] = udg_MS_Angle[i] + arc
set udg_MS_Arc[i] = true
else
set udg_MS_ArcDist[i] = 0
set udg_MS_ArcAngle[i] = 0
set udg_MS_Arc[i] = false
endif
if parabola then
set udg_MS_MaxHeight[i] = z2
set udg_MS_Parabola[i] = true
else
set udg_MS_MaxHeight[i] = 0
set udg_MS_Parabola[i] = false
endif
set udg_MS_MaxSpeed[i] = 1200
set udg_MS_MinSpeed[i] = 30
if accelerate != 0 then
if accelerate < 0 then
if maxspeed < speed and maxspeed > 30 then
set udg_MS_MinSpeed[i] = maxspeed
endif
else
if maxspeed > speed and maxspeed < 1200 then
set udg_MS_MaxSpeed[i] = maxspeed
endif
endif
set udg_MS_MaxSpeed[i] = udg_MS_MaxSpeed[i] * 0.03
set udg_MS_MinSpeed[i] = udg_MS_MinSpeed[i] * 0.03
set udg_MS_Accelerate[i] = accelerate * 0.03
set udg_MS_SpeedUp[i] = true
else
set udg_MS_SpeedUp[i] = false
// set udg_MS_MaxSpeed[i] = 0
// set udg_MS_MinSpeed[i] = 0
set udg_MS_Accelerate[i] = 0
endif
if dmg1 != 0 then
set udg_MS_Dmg_On[i] = true
set udg_MS_Dmg[i] = dmg1
else
set udg_MS_Dmg_On[i] = false
set udg_MS_Dmg[i] = 0
endif
if dmg2 != 0 then
set udg_MS_Dmg_Ex_Aoe[i] = true
set udg_MS_Aoe_Dmg[i] = dmg2
set udg_MS_Dmg_Ex_Area[i] = aoe
else
set udg_MS_Dmg_Ex_Aoe[i] = false
set udg_MS_Aoe_Dmg[i] = 0
set udg_MS_Dmg_Ex_Area[i] = 0
endif
if homing then
set udg_MS_Homing_Target[i] = target
set r = GetUnitMoveSpeed(target)
if speed < r then
set udg_MS_Speed[i] = r + 30
else
set udg_MS_Speed[i] = speed
endif
else
set udg_MS_Homing_Target[i] = null
set udg_MS_Suicide[i] = false
if speed < 100 then
set speed = 300
else
set udg_MS_Speed[i] = speed
endif
endif
set udg_MS_Homing[i] = homing
if knockback then
set udg_MS_Unit[i] = target
elseif jump then
set udg_MS_Unit[i] = launcher
call UnitAddAbility( launcher, 'Arav' )
call UnitRemoveAbility( launcher, 'Arav' )
set udg_MS_MaxHeight[i] = z2
if (zh2 - zh1) * (zh2 - zh1) * 1.5 > dist * dist then
set udg_MS_End[i] = true
call DisplayTextToForce( GetPlayersAll(), "|cffff0000Can't jump like this|r " )
endif
elseif not udg_MS_End[i] then
if fall then
if target != null then
set udg_MS_FallRate[i] = (udg_MS_TargetZ[i] - udg_MS_StartZ[i]) / udg_MS_Speed[i]
else
set udg_MS_FallRate[i] = (zh2 + z2 - zh1 - z1) / (udg_MS_Speed[i])
endif
if x2 != x1 or y2 != y1 then
set udg_MS_Speed[i] = dist / udg_MS_FallRate[i]
else
set udg_MS_Speed[i] = 0
endif
set udg_MS_Height[i] = zh1 + z1
set udg_MS_FallRate[i] = udg_MS_FallRate[i] * 3.3
endif
set udg_MS_Unit[i] = GetNewDummy(x1, y1, udg_MS_Angle[i])
set udg_MS_Height[i] = udg_MS_StartZ[i]
call SetUnitFlyHeight( udg_MS_Unit[i], udg_MS_Height[i], 0.00 )
call SetUnitFacing(udg_MS_Unit[i], ang * bj_RADTODEG)
endif
if sfx1 != null then
set udg_MS_SFX[i] = AddSpecialEffectTarget(sfx1, udg_MS_Unit[i], "origin")
endif
if sfx2 != null then
set udg_MS_SFX_Hit[i] = sfx2
endif
if sfx3 != null then
set udg_MS_SFX_Aoe[i] = sfx3
endif
if sfx4 != null then
set udg_MS_SFX_Aoe_Ex[i] = sfx4
endif
set udg_MS_Speed[i] = udg_MS_Speed[i] * 0.03
endfunction