Roku
New Member
- Reaction score
- 3
Hey, i just finished this holy nova spell of mine, wich basically has 10% chance to trigger if a unit has a specific item and takes damage. I made the trigger in JASS and i can't quite understand what's wrong. Im using ABCT by Cohadar, and PUI by Cohadar (great systems ), and as you can see i inserted a debug message, wich isnt showing at all.
Here's my trigger:
Im using another trigger, with the event "unit enters playable map" to add the event "Unit - Takes Damage" to this trigger. Would appreciate your help, +rep.
(Ignore the leaks, i'll solve them later.)
Here's my trigger:
JASS:
scope HolyNova
globals
private unit array caster
private integer pc = 0
endglobals
struct eff
unit caster
integer dummycount = 0
endstruct
private function Conds takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 039;I009039;) == true ) ) then
return false
endif
if GetRandomInt(1,10) > 1 then
return false
endif
return true
endfunction
private function Unit_Filter takes nothing returns boolean
local unit f = GetFilterUnit()
if(IsUnitType(f,UNIT_TYPE_MAGIC_IMMUNE)) then
return false
endif
if(IsUnitType(f,UNIT_TYPE_STRUCTURE))then
return false
endif
set f = null
return true
endfunction
private function Effects takes nothing returns boolean
local eff data = ABCT_GetData()
local unit u = data.caster
local location p = GetUnitLoc(u)
local unit d = CreateUnitAtLoc(GetOwningPlayer(u), 039;h005039;, p, bj_UNIT_FACING)
if data.dummycount == 3 then
call data.destroy()
set data.dummycount = 0
return true
else
call UnitAddAbility(d, 039;A033039;)
call IssuePointOrder(d, "detonate", GetLocationX(p), GetLocationY(p))
call UnitApplyTimedLife(d, 039;BTLF039;, 2.00)
set data.dummycount = data.dummycount + 1
endif
return false
endfunction
private function Heal takes nothing returns nothing
local unit u = GetEnumUnit()
local unit c = caster[pc]
local real i = I2R(GetHeroInt(c, true))
if IsUnitAlly(u, GetOwningPlayer(c)) then
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE) + i)
else
call UnitDamageTarget(c, u, i / 2, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL , WEAPON_TYPE_WHOKNOWS)
endif
set u = null
set c = null
endfunction
function Act takes nothing returns nothing
local eff data = eff.create()
local unit u = GetTriggerUnit()
local location p = GetUnitLoc(u)
local group healed
call BJDebugMsg("HOLY NOVA!")
set data.dummycount = 0
set pc = GetUnitIndex(u)
set caster[pc] = u
set data.caster = u
call ABCT_Start(function Effects, data, 0.10)
set healed = GetUnitsInRangeOfLocMatching(600, p, Condition(function Unit_Filter))
call ForGroup(healed, function Heal)
endfunction
//===========================================================================
function InitTrig_Holy_Nova takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddCondition(t, Condition(function Conds))
call TriggerAddAction( t, function Act )
endfunction
endscope
Im using another trigger, with the event "unit enters playable map" to add the event "Unit - Takes Damage" to this trigger. Would appreciate your help, +rep.
(Ignore the leaks, i'll solve them later.)