This is the projectile missile movement system that I'm going to implement soon in CC, replacing the GUI one which is inefficient.
But I don't know how to re-setup the homing system yet in JASS more effectively.
Because I don't want to use SetUnitPositionLocFacingBJ but SetUnitPosition (or something better) and I don't know how to use it to home using the projectiles UNIT level as turn rate factor. So how do I do it? (I'm very fresh in JASS)
JASS:
// Every 0.02 sec
function Trig_Unit_Move_Missile takes nothing returns nothing
local unit u = GetEnumUnit()
call SetUnitPosition(u, GetUnitX(u)+GetUnitPointValue(GetEnumUnit())*Cos(GetUnitFacing(u)*0.01745), GetUnitY(u)+GetUnitPointValue(GetEnumUnit())*Sin(GetUnitFacing(u)*0.01745))
set u = null
endfunction
function Trig_Unit_Move_Code_Actions takes nothing returns nothing
call ForGroup(udg_MoveMissile, function Trig_Unit_Move_Missile)
endfunction
But I don't know how to re-setup the homing system yet in JASS more effectively.
JASS:
// Only a part , Every 0.50 sec
// When the missile is in certain range of enemy target
// This laggs with 25+ projectiles so I need a better way, sucks cruiser laggs
function Trig_Home_Actions takes nothing returns nothing
set udg_HomingPoint[0] = PolarProjectionBJ(udg_Temp_Point, 50.00, ( GetUnitFacing(GetEnumUnit()) + 90.00 ))
set udg_HomingPoint[1] = PolarProjectionBJ(udg_Temp_Point, 50.00, ( GetUnitFacing(GetEnumUnit()) - 90.00 ))
if ( Trig_Homing() ) then
call SetUnitPositionLocFacingBJ( GetEnumUnit(), udg_Temp_Point, ( GetUnitFacing(GetEnumUnit()) + I2R(GetUnitLevel(GetEnumUnit())) ) )
else
call SetUnitPositionLocFacingBJ( GetEnumUnit(), udg_Temp_Point, ( GetUnitFacing(GetEnumUnit()) - I2R(GetUnitLevel(GetEnumUnit())) ) )
endif
call RemoveLocation(udg_HomingPoint[0])
call RemoveLocation(udg_HomingPoint[1])
endfunction
call SetUnitPosition(u... // So I wanna use this instead of SetUnitPositionLocFacingBJ
Because I don't want to use SetUnitPositionLocFacingBJ but SetUnitPosition (or something better) and I don't know how to use it to home using the projectiles UNIT level as turn rate factor. So how do I do it? (I'm very fresh in JASS)