- Joined
- Feb 4, 2008
- Messages
- 3,511
I'm shifting from loops to timers. Something I should have done a long time ago really.
Anyhow, I want to pass two units and four reals to the timer; the caster, a spawned missile unit, it's x position, y position, direction and the remaining duration of the timer. Basically it is a line spell. (projectile moves in direction)
I uses Bribe's Unit Indexer, since another system uses it anyway.
Basically, I just want to know what to do exactly to pass the information.
Anyhow, I want to pass two units and four reals to the timer; the caster, a spawned missile unit, it's x position, y position, direction and the remaining duration of the timer. Basically it is a line spell. (projectile moves in direction)
I uses Bribe's Unit Indexer, since another system uses it anyway.
Basically, I just want to know what to do exactly to pass the information.
JASS:
function FiSp_Loop takes nothing returns nothing
endfunction
function FiSp_Init takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local integer level = GetUnitAbilityLevel(caster, 'A000')
local real casterX = GetUnitX(caster)
local real casterY = GetUnitY(caster)
local location ta = GetSpellTargetLoc()
local real targetX = GetLocationX(ta)
local real targetY = GetLocationY(ta)
local timer t = CreateTimer()
local integer t_id = GetHandleId(t)
local integer u_id = GetUnitUserData(caster)
local real duration = 1.5
if (GetSpellAbilityId() != 'A000') then
set ta = null
set t = null
return
endif
call DisplayTextToPlayer(Player(0), 0., 0., I2S(u_id))
call TimerStart (t, duration, false, function FiSp_Loop)
set ta = null
set t = null
endfunction
[VJass]