Rainther
I guess I should write something of value here...
- Reaction score
- 61
Hi all. I've started working on a map and have hit a dead end. This JASS-based trigger is supposed to get triggered when a custom polymorph ability is being cast. It's supposed to remove the Polymorph-buff upon received damage on target at level 1 damage, and on level 2 and 3 when some damagin has occured. However the UnitRemoveBuffBJ(PolyBuff, target) doesn't work on removing the Sheep-buff, but it works on other buffs. The script however works from other triggers (removing Polymorph, that is) that I've tried, but not in this one.
Anybuddy who happends to posses a though in why this aint working?
Feel free to comment if I should do any ways to prevent leaks while at it.
This trigger is in vJASS and is using ABC -- STRUCT ATTACHMENT SYSTEM BY COHADAR -- v6.0 as help.
Anybuddy who happends to posses a though in why this aint working?
Feel free to comment if I should do any ways to prevent leaks while at it.
This trigger is in vJASS and is using ABC -- STRUCT ATTACHMENT SYSTEM BY COHADAR -- v6.0 as help.
JASS:
scope Polymorph initializer Init
globals
private constant integer SPELL_ID = 039;Poly039;
private constant integer BUFF = 039;B000039;
endglobals
private struct Data
unit cast
unit taru
integer abiLvL
real dmg
endstruct
private function Act2 takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local Data d = GetTriggerStructA(t)
local real dmg = GetEventDamage()
if GetTriggerEventId()==EVENT_UNIT_DAMAGED then
set d.dmg = d.dmg + dmg
if d.abiLvL == 1 then
call UnitRemoveBuffBJ( BUFF, d.taru )
call ClearTriggerStructA(t)
call d.destroy()
call DisableTrigger(t)
call DestroyTrigger(t)
elseif d.abiLvL == 2 and d.dmg >= 200 then
call UnitRemoveBuffBJ( BUFF, d.taru )
call ClearTriggerStructA(t)
call d.destroy()
call DisableTrigger(t)
call DestroyTrigger(t)
elseif d.abiLvL == 3 and d.dmg >= 500 then
call UnitRemoveBuffBJ( BUFF, d.taru )
call ClearTriggerStructA(t)
call d.destroy()
call DisableTrigger(t)
call DestroyTrigger(t)
endif
elseif GetSpellAbilityId() == SPELL_ID or UnitHasBuffBJ(d.taru, BUFF) != true then
call ClearTriggerStructA(t)
call d.destroy()
call DisableTrigger(t)
call DestroyTrigger(t)
endif
set t = null
endfunction
private function Act takes nothing returns nothing
local trigger t = CreateTrigger()
local unit cast = GetTriggerUnit()
local unit taru = GetSpellTargetUnit()
local integer abiLvL = GetUnitAbilityLevel(cast, SPELL_ID)
local Data d = Data.create()
set d.cast = cast
set d.taru = taru
set d.abiLvL = abiLvL
set d.dmg = 0
call SetTriggerStructA(t, d)
call TriggerRegisterUnitEvent(t, taru, EVENT_UNIT_DAMAGED)
call TriggerRegisterUnitEvent(t, cast, EVENT_UNIT_SPELL_CAST)
call TriggerRegisterTimerEvent(t, 0.25, true)
call TriggerAddAction(t, function Act2)
set t = null
endfunction
private function Cons takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t,Filter(function Cons) )
call TriggerAddAction( t, function Act )
endfunction
endscope