NetherHawk
New Member
- Reaction score
- 26
I have tried making an ability called Overload.
what it does: everytime the hero damages(via attacks) a unit, it stores lightning charges which after reaching limit, the charge is unleashed dealing damage to the attacked unit and surrounding others, slowing them down as well.
what i have tried to do: every time a hero learns this skill(a001), if a001 = 1
, create a trigger which registers when a unit is attacked.
from there, i have a filter that registers the attacking unit as this learning hero.
if it is the learning hero, i create another trigger to register when the attacked unit is damaged and subtract from the counter.
when the counter reaches 0 , i create a dummy to thunderclap(a000).
the problem im having is that nothing is happening in the game.
this is the trigger:
what it does: everytime the hero damages(via attacks) a unit, it stores lightning charges which after reaching limit, the charge is unleashed dealing damage to the attacked unit and surrounding others, slowing them down as well.
what i have tried to do: every time a hero learns this skill(a001), if a001 = 1
, create a trigger which registers when a unit is attacked.
from there, i have a filter that registers the attacking unit as this learning hero.
if it is the learning hero, i create another trigger to register when the attacked unit is damaged and subtract from the counter.
when the counter reaches 0 , i create a dummy to thunderclap(a000).
the problem im having is that nothing is happening in the game.
this is the trigger:
JASS:
function Overload_Jass_Conditions takes nothing returns boolean
return GetLearnedSkill() == 039;A001039;
endfunction
function Overload_Filter takes nothing returns boolean
local trigger tr = GetTriggeringTrigger()
local unit u = GetHandleUnit(tr,"caster")
return GetAttacker() == u and IsUnitEnemy(GetTriggerUnit(),GetOwningPlayer(u)) == true
endfunction
function Overload_Check takes nothing returns boolean
local trigger tx = GetTriggeringTrigger()
local unit u = GetHandleUnit(tx,"caster")
return GetEventDamageSource() == u
endfunction
function Overload_Recount takes nothing returns nothing
local trigger tx = GetTriggeringTrigger()
local unit ux = GetTriggerUnit()
local unit u = GetEventDamageSource()
local integer i = GetUnitAbilityLevel(u,039;A001039;)
local integer c = GetHandleInt(tx,"counter")
local effect fx = GetHandleFX(tx,"effectx")
local effect fy = GetHandleFX(tx,"effecty")
local unit d
set c = c - 1
if c == 1 then
set fx = AddSpecialEffectTarget("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl" ,u,"right + hand")
set fy = AddSpecialEffectTarget("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl" ,u,"left + hand")
call SetHandleHandle(tx,"effectx",fx)
call SetHandleHandle(tx,"effecty",fy)
else
if c == 0 then
call DestroyEffect(fx)
call DestroyEffect(fy)
set d = CreateUnit(GetOwningPlayer(u),039;h000039;,GetUnitX(ux),GetUnitY(ux),bj_UNIT_FACING)
call SetUnitAbilityLevel(d,039;A000039;,i)
call UnitApplyTimedLife(d,039;BTLF039;,1)
call IssueImmediateOrder(d,"thunderclap")
set fx = null
set fy = null
set d = null
endif
endif
set u = null
set ux = null
call DisableTrigger(tx)
call DestroyTrigger(tx)
set tx = null
endfunction
function Overload_Charge takes nothing returns nothing
local trigger tr = GetTriggeringTrigger()
local unit u = GetAttacker()
local integer i = GetUnitAbilityLevel(u,039;A001039;)
local unit ux = GetTriggerUnit()
local integer cx = 9 - i
local trigger tx = CreateTrigger()
local integer c = GetHandleInt(tx,"counter")
if c == 0 then
set c = cx
else
call SetHandleInt(tx,"counter",c)
endif
call SetHandleHandle(tx,"caster",u)
call TriggerRegisterUnitEvent(tx,ux,EVENT_UNIT_DAMAGED)
call TriggerAddCondition(tx, Condition(function Overload_Check))
call TriggerAddAction(tx, function Overload_Recount)
set u = null
set ux = null
endfunction
function Overload_Jass_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer i = GetUnitAbilityLevel(u,039;A001039;)
local trigger tr
if i == 1 then
set tr = CreateTrigger()
call SetHandleHandle(tr,"caster",u)
call TriggerRegisterAnyUnitEventBJ(tr,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(tr, Condition(function Overload_Filter))
call TriggerAddAction(tr, function Overload_Charge)
set tr = null
endif
set u = null
endfunction
//===========================================================================
function InitTrig_Overload_Jass takes nothing returns nothing
set gg_trg_Overload_Jass = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Overload_Jass, EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition( gg_trg_Overload_Jass, Condition( function Overload_Jass_Conditions ) )
call TriggerAddAction( gg_trg_Overload_Jass, function Overload_Jass_Actions )
endfunction