wraithseeker
Tired.
- Reaction score
- 122
How do I make a channeling spell?
I tried with this trigger of mine but had a syntax error for some reason. If you all don't get how it work, explain how to make a chaneling spell or doing it another way.
Uses PUI.
I tried with this trigger of mine but had a syntax error for some reason. If you all don't get how it work, explain how to make a chaneling spell or doing it another way.
JASS:
scope deathpact initializer Init
globals
private constant integer SPELL = 039;A00P039;
private constant string EFFECT = "MDX\\NewDarkPillar.mdx"
private integer array Index
endglobals
private struct data
//! runtextmacro PUI()
unit caster
timer t
static method create takes nothing returns data
local data d = data.allocate()
set d.caster = GetTriggerUnit()
set d = data[d.caster]
set t = NewTimer()
set data[d.caster] = d
return d
endmethod
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL
endfunction
private function Actions takes nothing returns nothing
local unit target = GetSpellTargetUnit()
local unit u = GetTriggerUnit()
local real TLife = GetWidgetLife(target) * 0.20
local real TMana = GetUnitState(target,UNIT_STATE_MANA) *0.20
local real x = GetUnitX(target)
local real y = GetUnitY(target)
call SetWidgetLife(u,GetWidgetLife(u)+ TLife)
call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA) + TMana)
call DestroyEffect(AddSpecialEffect(EFFECT,x,y))
set u = null
set target = null
endfunction
private function EndCast takes nothing returns nothing
local data d = data[d.caster]
set data[d.caster] = d
call ReleaseTimer(d.t)
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Actions )
call TriggerAddCondition(t,Condition(function Conditions))
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_ENDCAST)
call TriggerAddCondition(t,Condition(function COnditions))
call TriggerAddAction(t,function EndCast)
endfunction
endscope
Uses PUI.