Hi guys...
Well some time agao i had made a trigger to make a unit rotate around another unit and keep the height fixed as the center unit.
I did the same thing for another system but the problem is, the rotation has some humps. Well can any 1 check whats wrong
New 1(which doesn't work well)
In the old one the rotation will take automatically. In the new one you need to cast a spell on the skull unit(the first cripple spell in the skill tab
Map name
Rot2 = old one
rotate = new one
Old one(which works)
Well some time agao i had made a trigger to make a unit rotate around another unit and keep the height fixed as the center unit.
I did the same thing for another system but the problem is, the rotation has some humps. Well can any 1 check whats wrong
New 1(which doesn't work well)
JASS:
function Trig_KnockbackPeriodic_Actions takes nothing returns nothing
local integer n
local real z
local real z2
local real x1
local real y1
local location loc
if (rotatecount > 0) then
set n = 1
loop
exitwhen (n > rotatecount)
set loc = GetUnitLoc(rotatecenter[n])
set z = GetLocationZ(loc)
call RemoveLocation(loc)
set loc = GetUnitLoc(rotateunit[n])
set z2 = GetLocationZ(loc)
call RemoveLocation(loc)
set rotatecenterx[n] = GetUnitX(rotatecenter[n])
set rotatecentery[n] = GetUnitY(rotatecenter[n])
set x1 = (Cos(rotateangle[n] * bj_DEGTORAD)*rotateradius[n])
set y1 = (Sin(rotateangle[n] * bj_DEGTORAD)*rotateradius[n])
call SetUnitX(rotateunit[n], (rotatecenterx[n] - x1))
call SetUnitY(rotateunit[n], (rotatecentery[n] - y1))
call SetUnitFlyHeight(rotateunit[n], (50 + z) - z2, 0)
set rotateangle[n] = ( rotateangle[n] + rotatespeed[n] )
if ( rotateangle[n] >= 360.00 ) then
set rotateangle[n] = ( rotateangle[n] - 360.00 )
endif
if (rotatetimer[n] <= 0) then
if (n != rotatecount) then
set rotatecenter[n] = rotatecenter[rotatecount]
set rotateunit[n] = rotateunit[rotatecount]
set rotatecenterx[n] = rotatecenterx[rotatecount]
set rotatecentery[n] = rotatecentery[rotatecount]
set rotateangle[n] = rotateangle[rotatecount]
set rotateradius[n] = rotateradius[rotatecount]
set rotatespeed[n] = rotatespeed[rotatecount]
set rotatetimer[n] = rotatetimer[rotatecount]
endif
set rotatecount = rotatecount - 1
endif
set rotatetimer[n] = rotatetimer[n] - 1
set n = n + 1
endloop
endif
endfunction
//===========================================================================
function InitTrig_KnockbackPeriodic_Copy takes nothing returns nothing
set gg_trg_KnockbackPeriodic_Copy = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_KnockbackPeriodic_Copy, 0.05 )
call TriggerAddAction( gg_trg_KnockbackPeriodic_Copy, function Trig_KnockbackPeriodic_Actions )
endfunction
In the old one the rotation will take automatically. In the new one you need to cast a spell on the skull unit(the first cripple spell in the skill tab
Map name
Rot2 = old one
rotate = new one
Old one(which works)
JASS:
local real z2
local location loc = GetUnitLoc(udg_rotor)
local real z = GetLocationZ(loc)
local real x1 = (Cos(udg_angle * bj_DEGTORAD)*200)
local real y1 = (Sin(udg_angle * bj_DEGTORAD)*200)
local real x2 = GetUnitX(udg_rotor)
local real y2 = GetUnitY(udg_rotor)
call RemoveLocation(loc)
call SetUnitX(udg_rot, (x2-x1))
call SetUnitY(udg_rot, (y2-y1))
set loc = GetUnitLoc(udg_rot)
set z2 = GetLocationZ(loc)
call SetUnitFlyHeight(udg_rot, (50 + z) - z2, 0)
set udg_angle = ( udg_angle + 10.00 )
if ( udg_angle >= 360.00 ) then
set udg_angle = ( udg_angle - 360.00 )
endif
call RemoveLocation(loc)
set loc = null