- Joined
- Sep 9, 2006
- Messages
- 92
so heres a bit of my code, i was just wondering if i can just somehow use a dummy array for the 3 dummy units i use, and if so, what the variable would look like
something like
so then i can run a loop for the latter 2 (because they are both firing shockwaves, just at different angles)
edit: gah figured it out.. however if someone could help me with another problem that woudl be great.. i want to find 45 degrees either way from a given travel angle, will the code automatically adjust the angle if its off by 360 degrees or do i do that manually?
JASS:
private struct data
static hashtable h = InitHashtable()
unit c
integer lvl
timer tim = CreateTimer()
real Fx //final position
real Fy
unit dummyO //dummy orb unit
real Dx //dummy's position
real Dy
integer PT = PULSE_TIMER
unit dummy1
unit dummy2
static method periodic takes nothing returns nothing
local integer id = GetHandleId(GetExpiredTimer())
local data this = LoadInteger(.h,id,0)
local real angle = bj_RADTODEG * Atan2(.Fy - .Dy, .Fx - .Dx)
local real Tx = (.Dx + DUMMY_OFFSET * Cos(angle * bj_DEGTORAD))
local real Ty = (.Dy + DUMMY_OFFSET * Sin(angle * bj_DEGTORAD))
call SetUnitPosition(.dummyO, Tx, Ty)
if .PT > 0 then
set .PT = .PT - 1
else
set
//send pulse
set .PT = PULSE_TIMER
endif
if SquareRoot((Tx-.Fx)*(Tx-.Fx)+(Ty-.Fy)*(Ty-.Fy)) < 2. then
call DestroyTimer(.tim)
call FlushChildHashtable(.h,id)
call .destroy(id)
//end spell
endif
endmethod
something like
JASS:
unit dummy[0]
unit dummy[1]
unit dummy[2]
edit: gah figured it out.. however if someone could help me with another problem that woudl be great.. i want to find 45 degrees either way from a given travel angle, will the code automatically adjust the angle if its off by 360 degrees or do i do that manually?
Last edited: