- Joined
- Nov 13, 2006
- Messages
- 1,814
so question who can i do this what is on picture, because i want make a missile engine what could make many movement style, atm only parabola and arc thing work
[trigger still just on test phase, this is why dont work the deallocate part]
B. also question the best way for accelerating missile thing, atm i got only a ideea about minSpeed, MaxSpeed, AccRate, i allways add accrate to speed till it reach max speed, have better way?)
C. how can i make homing missile what follow the target and i want parabola/arc style, if distance between target and missile changed each time, then i cant set the max distance what is based in both parabola/arc calculation because when target move then max distance also changed
i am really curios how possible change the arrow faceing angle like here http://www.youtube.com/watch?v=phKhzxjLw_c&feature=player_embedded#!
[trigger still just on test phase, this is why dont work the deallocate part]
B. also question the best way for accelerating missile thing, atm i got only a ideea about minSpeed, MaxSpeed, AccRate, i allways add accrate to speed till it reach max speed, have better way?)
C. how can i make homing missile what follow the target and i want parabola/arc style, if distance between target and missile changed each time, then i cant set the max distance what is based in both parabola/arc calculation because when target move then max distance also changed
JASS:
function Missile takes unit launcher, unit target, real collision, real x1, real y1, real x2, real y2, real speed, real maxspeed, real accelerate, real arc, real arcdist, boolean parabola, real height, real dmg1, real dmg2, real aoe, real dmg3, boolean homing returns nothing
local integer i
local real dx = x2 - x1
local real dy = y2 - y1
set udg_MS_Index = udg_MS_Index + 1
set i = udg_MS_Index
set udg_MS_X[i] = x1
set udg_MS_Y[i] = y1
set udg_MS_Angle[i] = Atan2(y2 - y1, x2 - x1)
set udg_MS_MaxDist[i] = SquareRoot(dx * dx + dy * dy)
set udg_MS_Speed[i] = speed
set udg_MS_Launcher[i] = 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] = height
set udg_MS_Parabola[i] = true
else
set udg_MS_MaxHeight[i] = 0
set udg_MS_Parabola[i] = false
endif
if speed != maxspeed then
set udg_MS_MaxSpeed[i] = maxspeed
set udg_MS_Accelerate[i] = accelerate
set udg_MS_SpeedUp[i] = true
else
set udg_MS_SpeedUp[i] = false
set udg_MS_MaxSpeed[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
set udg_MS_Collision[i] = collision
else
set udg_MS_Dmg_On[i] = false
set udg_MS_Dmg[i] = 0
set udg_MS_Collision[i] = 0
endif
if dmg2 != 0 then
set udg_MS_Dmg_Ex_On[i] = true
set udg_MS_Aoe_Dmg[i] = dmg2
set udg_MS_Dmg_Area[i] = aoe
else
set udg_MS_Dmg_Ex_On[i] = false
set udg_MS_Aoe_Dmg[i] = 0
set udg_MS_Dmg_Area[i] = 0
endif
set udg_MS_Dmg_Ex[i] = dmg3
if homing then
set udg_MS_Homing_Target[i] = target
set udg_MS_Suicide[i] = true
else
set udg_MS_Homing_Target[i] = null
set udg_MS_Suicide[i] = false
endif
set udg_MS_Player[i] = GetOwningPlayer(launcher)
set udg_MS_Homing[i] = homing
set udg_MS_Unit[i] = CreateUnit(Player(15), 'ewsp', x1, y1, 0)
call UnitAddAbility( udg_MS_Unit[i], 'Arav' )
call UnitRemoveAbility( udg_MS_Unit[i], 'Arav' )
endfunction
JASS:
function Trig_Missile_Timer takes nothing returns nothing
local integer i = 1
local real x
local real y
local real nx
local real ny
local real r1
local real ang
loop
exitwhen i > udg_MS_Index
if udg_MS_CurDist[i] >= udg_MS_MaxDist[i] then
call RemoveUnit(udg_MS_Unit[i])
if i != udg_MS_Index then
set udg_MS_Unit[i] = udg_MS_Unit[udg_MS_Index]
set udg_MS_Homing_Target[i] = udg_MS_Homing_Target[udg_MS_Index]
set udg_MS_Launcher[i] = udg_MS_Launcher[udg_MS_Index]
set udg_MS_Player[i] = udg_MS_Player[udg_MS_Index]
set udg_MS_X[i] = udg_MS_X[udg_MS_Index]
set udg_MS_Y[i] = udg_MS_Y[udg_MS_Index]
set udg_MS_Homing[i] = udg_MS_Homing[udg_MS_Index]
set udg_MS_MaxHeight[i] = udg_MS_MaxHeight[udg_MS_Index]
set udg_MS_SpeedUp[i] = udg_MS_SpeedUp[udg_MS_Index]
set udg_MS_Accelerate[i] = udg_MS_Accelerate[udg_MS_Index]
set udg_MS_Speed[i] = udg_MS_Speed[udg_MS_Index]
set udg_MS_MaxSpeed[i] = udg_MS_MaxSpeed[udg_MS_Index]
set udg_MS_CurDist[i] = udg_MS_CurDist[udg_MS_Index]
set udg_MS_MaxDist[i] = udg_MS_MaxDist[udg_MS_Index]
set udg_MS_Arc[i] = udg_MS_Arc[udg_MS_Index]
set udg_MS_Parabola[i] = udg_MS_Parabola[udg_MS_Index]
set udg_MS_ArcAngle[i] = udg_MS_ArcAngle[udg_MS_Index]
set udg_MS_Angle[i] = udg_MS_Angle[udg_MS_Index]
set udg_MS_Collision[i] = udg_MS_Collision[udg_MS_Index]
set udg_MS_Suicide[i] = udg_MS_Suicide[udg_MS_Index]
set udg_MS_Dmg_Ex_On[i] = udg_MS_Dmg_Ex_On[udg_MS_Index]
set udg_MS_Dmg_On[i] = udg_MS_Dmg_On[udg_MS_Index]
set udg_MS_Dmg[i] = udg_MS_Dmg[udg_MS_Index]
set udg_MS_Dmg_Area[i] = udg_MS_Dmg_Area[udg_MS_Index]
set udg_MS_Dmg_Ex[i] = udg_MS_Dmg_Ex[udg_MS_Index]
set udg_MS_Dmg_Ex[i] = udg_MS_Dmg_Ex[udg_MS_Index]
endif
set i = i - 1
set udg_MS_Index = udg_MS_Index - 1
else
set x = GetUnitX(udg_MS_Unit[i])
set y = GetUnitY(udg_MS_Unit[i])
if udg_MS_Homing[i] then
endif
if udg_MS_SpeedUp[i] then
if udg_MS_Speed[i] < udg_MS_MaxSpeed[i] then
set udg_MS_Speed[i] = udg_MS_Speed[i] + udg_MS_Accelerate[i]
endif
endif
set udg_MS_CurDist[i] = udg_MS_CurDist[i] + udg_MS_Speed[i]
if udg_MS_Arc[i] then
set r1 = ( 4 * udg_MS_ArcDist[i] / udg_MS_MaxDist[i] ) * ( udg_MS_MaxDist[i] - udg_MS_CurDist[i] ) * ( udg_MS_CurDist[i] / udg_MS_MaxDist[i] )
set nx = udg_MS_X[i] + udg_MS_Speed[i] * Cos(udg_MS_Angle[i])
set ny = udg_MS_Y[i] + udg_MS_Speed[i] * Sin(udg_MS_Angle[i])
set nx = nx + r1 * Cos(udg_MS_ArcAngle[i])
set ny = ny + r1 * Sin(udg_MS_ArcAngle[i])
call SetUnitX(udg_MS_Unit[i], nx)
call SetUnitY(udg_MS_Unit[i], ny)
set ang = Atan2(ny - udg_MS_Y[i], nx - udg_MS_X[i])
call SetUnitFacing(udg_MS_Unit[i], ang)
set udg_MS_X[i] = udg_MS_X[i] + udg_MS_Speed[i] * Cos(udg_MS_Angle[i])
set udg_MS_Y[i] = udg_MS_Y[i] + udg_MS_Speed[i] * Sin(udg_MS_Angle[i])
else
call SetUnitX(udg_MS_Unit[i], (x + udg_MS_Speed[i] * Cos(udg_MS_Angle[i])))
call SetUnitY(udg_MS_Unit[i], (y + udg_MS_Speed[i] * Sin(udg_MS_Angle[i])))
endif
if udg_MS_Parabola[i] then
set r1 = ( 4 * udg_MS_MaxHeight[i] / udg_MS_MaxDist[i] ) * ( udg_MS_MaxDist[i] - udg_MS_CurDist[i] ) * ( udg_MS_CurDist[i] / udg_MS_MaxDist[i] )
call SetUnitFlyHeightBJ( udg_MS_Unit[i], r1, 0.00 )
endif
endif
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_Missile_Timer takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent( t, 0.03, true)
call TriggerAddAction( t, function Trig_Missile_Timer )
endfunction
i am really curios how possible change the arrow faceing angle like here http://www.youtube.com/watch?v=phKhzxjLw_c&feature=player_embedded#!
Last edited: