need help to make my wisp wheel in jass. I used a program to make the code and this is what i got,
can someone put it together for me please and ty lol
Code:
-Initialization trigger-
function Trig_Wisp_Actions takes nothing returns nothing
local integer array n
local location array p
local rect array r
set r[0] = gg_rct_wisp_wheel
set r[1] = gg_rct_wisp_radias
set n[0] = 30
set p[0] = GetRectCenter(r[0])
set p[1] = GetRectCenter(r[1])
set n[1] = 1
loop
exitwhen n[1] > n[0]
call CreateNUnitsAtLoc( 1, 'ewsp', Player(11), GetRandomLocInRect(r[0]), 0.00 )
set udg_wisp[n[1]] = GetLastCreatedUnit()
set p[2] = PolarProjectionBJ(p[0], DistanceBetweenPoints(p[0], p[1]), ( ( I2R(( n[1] - 1 )) * 360.00 ) / I2R(n[0]) ))
call SetUnitPositionLoc( GetLastCreatedUnit(), p[2])
call RemoveLocation( p[2])
set n[1] = n[1] + 1
endloop
call RemoveLocation(p[0])
call RemoveLocation(p[1])
endfunction
function InitTrig_Wisp takes nothing returns nothing
set gg_trg_Wisp = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Wisp, 0.00 )
call TriggerAddAction( gg_trg_Wisp, function Trig_Wisp_Actions )
endfunction
Code:
-Wisp Whirl trigger-
function Trig_Wisp_Actions takes nothing returns nothing
local location array p
local integer h
local integer n
local real array v
local real tAngle
set v[2] = 0.3
set v[1] = 0.3
set p[0] = GetRectCenter(gg_rct_wisp_wheel)
set p[1] = GetRectCenter(gg_rct_wisp_radias)
set n = 30
set h = 1
loop
exitwhen h > n
set p[2] = GetUnitLoc(udg_wisp[h])
set v[0] = DistanceBetweenPoints(p[0], p[2])
if ( v[0] <= 10.00 ) then
set v[0] = ( v[0] + v[2] )
call SetUnitMoveSpeed( udg_wisp[h], 200.00 )
elseif ( v[0] >= DistanceBetweenPoints(p[0], p[1]) ) then
set v[0] = ( v[0] - v[2] )
call SetUnitMoveSpeed( udg_wisp[h], 300.00 )
else
if( GetUnitMoveSpeed(udg_wisp[h]) == 300.00) then
set v[0] = ( v[0] - v[2] )
else
set v[0] = ( v[0] + v[2] )
endif
endif
set p[3] = PolarProjectionBJ(p[0], v[0], ( AngleBetweenPoints(p[0], p[2]) - v[1] ))
call SetUnitPositionLoc( udg_wisp[h], p[3])
call RemoveLocation( p[2] )
call RemoveLocation( p[3] )
set h = h + 1
endloop
call RemoveLocation( p[0] )
call RemoveLocation( p[1] )
endfunction
function InitTrig_Wisp takes nothing returns nothing
set gg_trg_Wisp = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Wisp, 0.01 )
call TriggerAddAction( gg_trg_Wisp, function Trig_Wisp_Actions )
endfunction
can someone put it together for me please and ty lol