Technomancer
New Member
- Reaction score
- 14
I'm trying to make 8 summomable wisps rotate at fixed angles around a unit as I summon them, which works fine, except somewhere in there I lose some data and the angle gets set to the angle of the first wisp :x. Basically, all of the wisps are created correctly (tested this out plenty), but then jump to the same spot as wisp[0] on the first tick of the timer.
Wisp creation function:
wispcreate method referenced above
and the applicable part of the timer loop.
I'm stumped... I can't figure out at what point the angle changes.
also lol at my new kitten trying to attack my monitor while I type, it's so funny
nevermind, I got it, I was double multiplying the angle by bj_DEGTORAD
Wisp creation function:
JASS:
set angle = (bj_DEGTORAD * (360) / MAX_ORBS) * i + (bj_DEGTORAD * rkData.wispangle)
// REF: //wispcreate takes unit wisp, unit source, real initangle returns nothing
call wData.wispcreate(CreateUnit(GetOwningPlayer(u), ORB_ID, GetUnitX(u) + Cos(angle) * WISP_DIST, GetUnitY(u) + Sin(angle) * WISP_DIST, bj_UNIT_FACING ), u, angle)
call SetUnitUserData(wData.myWisp, wData)
set rkData.Orbs<i> = wData.myWisp
set rkData.Num_Orbs = rkData.Num_Orbs + 1
</i>
wispcreate method referenced above
JASS:
method wispcreate takes unit wisp, unit source, real initangle returns nothing
set this.myTrigger = CreateTrigger()
call TriggerRegisterUnitInRange(this.myTrigger, wisp, COL_DET_RANGE, null)
call TriggerAddAction(this.myTrigger, function Collision_Detected)
set this.myWisp = wisp
set this.rk = source
set this.angle = initangle
set source = null
set wisp = null
endmethod
and the applicable part of the timer loop.
JASS:
loop
exitwhen i >= MAX_ORBS
if rkData.Orbs<i> != null then
set wData = GetUnitUserData(rkData.Orbs<i>)
set wData.angle = wData.angle + WISP_ROTATE_RATE
call SetUnitPosition(wData.myWisp, GetUnitX(rk) + Cos( bj_DEGTORAD * wData.angle ) * WISP_DIST, GetUnitY(rk) + Sin( bj_DEGTORAD * wData.angle ) * WISP_DIST )
set rkData.wispangle = rkData.wispangle + WISP_ROTATE_RATE //modifies this value for wisp creation
endif
set i = i + 1
endloop
</i></i>
I'm stumped... I can't figure out at what point the angle changes.
also lol at my new kitten trying to attack my monitor while I type, it's so funny
nevermind, I got it, I was double multiplying the angle by bj_DEGTORAD