Ok here is my triggers:
Well it seems that isn't working any idea why ?
(I am sure that are the local trigger things but it's the first time that i use them so i don't know if it is..)
I use Kattana Handle Vars. All Constant are fine....
hmm maybe target can't be used like a Handle ?.. And i have to add a condition that check if the unit has the buff but i deleted it for test the spell.
JASS:
constant function NTDummyID takes nothing returns integer
return 039;h001039;
endfunction
constant function NTDummyAbID takes nothing returns integer
return 039;A006039;
endfunction
constant function NTAbID takes nothing returns integer
return 039;A004039;
endfunction
function GetDuration takes unit Hero returns real
local integer Level=GetUnitAbilityLevel(Hero,NTAbID())
if Level==1 then
return 20.00
elseif Level==2 then
return 30.00
elseif Level==3 then
return 40.00
elseif Level==4 then
return 50.00
endif
return 20.00
endfunction
function Trig_Natures_Shield_Conditions takes nothing returns boolean
return GetSpellAbilityId() == NTAbID()
endfunction
function NatureShieldDummyCast takes nothing returns nothing
local unit Target=GetTriggerUnit()
local unit Caster=GetHandleUnit(Target,"Caster")
local real x=GetUnitX(Target)
local real y=GetUnitY(Target)
local integer level=GetUnitAbilityLevel(Caster,NTAbID())
local integer Chances=5*level
if GetRandomInt(1,100)<=Chances then
call CreateUnit(GetOwningPlayer(Caster),NTDummyID(),x,y,bj_UNIT_FACING)
call SetUnitAbilityLevel(GetLastCreatedUnit(),NTDummyAbID(),GetUnitAbilityLevel(Caster,NTAbID()))
call IssueTargetOrder(GetLastCreatedUnit(),"entanglingroots",GetAttacker())
endif
set Target=null
set Caster=null
endfunction
function Trig_Natures_Shield_Actions takes nothing returns nothing
local unit Caster=GetSpellAbilityUnit()
local unit Target=GetSpellTargetUnit()
local player Owner=GetOwningPlayer(Caster)
local trigger t=CreateTrigger()
call SetHandleHandle(Target,"Caster",Caster)
call TriggerRegisterUnitEvent(t,Target,EVENT_UNIT_ATTACKED)
call TriggerAddAction(t,function NatureShieldDummyCast)
call TriggerSleepAction(GetDuration(Caster))
call FlushHandleLocals(Target)
set Caster=null
set Target=null
set t=null
call DestroyTrigger(t)
endfunction
//===========================================================================
function InitTrig_Natures_Shield takes nothing returns nothing
set gg_trg_Natures_Shield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Natures_Shield, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Natures_Shield, Condition( function Trig_Natures_Shield_Conditions ) )
call TriggerAddAction( gg_trg_Natures_Shield, function Trig_Natures_Shield_Actions )
endfunction
Well it seems that isn't working any idea why ?
(I am sure that are the local trigger things but it's the first time that i use them so i don't know if it is..)
I use Kattana Handle Vars. All Constant are fine....
hmm maybe target can't be used like a Handle ?.. And i have to add a condition that check if the unit has the buff but i deleted it for test the spell.