tuantai120
Cool Member
- Reaction score
- 1
JASS:
scope Ice initializer Init
globals
private constant integer Spell_ID = 039;A000039;
private constant integer Dummy_ID = 039;h000039;
private constant string SFX = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
private constant real dist = 800.
endglobals
struct Ice
unit caster
unit dummy
real x
real y
real facing
integer ticks
endstruct
private function GetX takes real x , real facing , real dist returns real
return x + dist * Cos ( facing * bj_DEGTORAD )
endfunction
private function GetY takes real y , real facing , real dist returns real
return y + dist * Sin ( facing * bj_DEGTORAD )
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == Spell_ID
endfunction
function callback takes nothing returns nothing
local Ice data = GetCSData (GetExpiredTimer())
call data.destroy()
endfunction
function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit d
local integer tick
local timer t = CreateTimer()
local Ice data = Ice.create()
set data.ticks = tick
set data.caster = u
set data.facing = GetUnitFacing(u)
set data.x = GetUnitX(u)
set data.y = GetUnitY(u)
set data.dummy = d
call SetCSData (t,data)
call TimerStart ( t, 10. , false , function callback)
call CreateUnit(GetOwningPlayer(u),Dummy_ID,data.x,data.y,data.facing)
call DestroyEffect(AddSpecialEffect(SFX,GetUnitX(d),GetUnitY(d)))
call UnitApplyTimedLife(d,039;BLTF039;,5.0)
call SetUnitX(d,GetX)
call SetUnitY(d,GetY)
set tick = tick -1
if (tick == 0) then
set t = null
call DestroyTimer(t)
endif
set t = null
set u = null
set d = null
call BJDebugMsg( " actions done ")
endfunction
//===========================================================================
function Init takes nothing returns nothing
local trigger ice = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( ice , EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( ice , function Actions )
call TriggerAddCondition ( ice , Condition ( function Conditions ) )
endfunction
endscope
why dont have unit , effect , text ????
i use CSData