Iam creating an custom aura, that this make invulnerable to units near of 500 AOE of loc of the spell, only to allies of caster. but, this not work, here is the code:
someone can help me please!
P.S: i will remove leaks when it will be finished
ty community
JASS:
function CdI_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A001'
endfunction
function CdI_2_1 takes nothing returns boolean // agrega a todas
local timer t = GetExpiredTimer()
//local unit pick = GetFilterUnit()
local unit caster = GetHandleUnit(t,"caster")
local unit dummy = GetHandleUnit(t,"dummy")
call BJDebugMsg("hola mundo cruel")
if DistanceBetweenPoints(GetUnitLoc(GetFilterUnit()),GetUnitLoc(dummy)) < 750 and IsUnitAlly(GetFilterUnit(),GetOwningPlayer(caster)) == true then
call BJDebugMsg("eres invul " + GetUnitName(GetFilterUnit()))
call UnitAddAbility(GetFilterUnit(),'ACmi')
call SetUnitInvulnerable(GetFilterUnit(),true)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Brilliance\\Brilliance.mdl",GetFilterUnit(),"origin"))
//call GroupRemoveUnit(udg_gg,pick)
//call KillUnit(pick)
endif
if DistanceBetweenPoints(GetUnitLoc(GetFilterUnit()),GetUnitLoc(dummy)) > 755 and GetUnitAbilityLevel(GetFilterUnit(),'ACmi')>0 then
call SetUnitInvulnerable(GetFilterUnit(),false)
call UnitRemoveAbility(GetFilterUnit(),'ACmi')
call BJDebugMsg("ya no eres invul " + GetUnitName(GetFilterUnit()))
call SetUnitInvulnerable(GetFilterUnit(),false)
//call KillUnit(pick)
endif
return false
endfunction
function CdI_2 takes nothing returns nothing // agrega a todas
local timer t = GetExpiredTimer()
local unit caster = GetHandleUnit(t,"caster")
local unit dummy = GetHandleUnit(t,"dummy")
local group g = GetHandleGroup(t,"g")
local real locx = GetHandleReal(t,"locx")
local real locy = GetHandleReal(t,"locy")
call SetHandleHandle(t,"dummy",dummy)
call SetHandleHandle(t,"caster",caster)
call GroupEnumUnitsInRange(g,locx,locy,750,Filter( function CdI_2_1))
//call GroupEnumUnitsInRangeOfLoc(g,GetUnitLoc(dummy),750,Filter( function CdI_2_1))
endfunction
function CdI_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local group g = CreateGroup()
local timer t = CreateTimer()
local unit dummy = CreateUnit(GetTriggerPlayer(),'hsor',GetLocationX(GetSpellTargetLoc()),GetLocationY(GetSpellTargetLoc()),0)
call SetHandleHandle(t, "caster",caster)
call SetHandleHandle(t, "dummy",dummy)
call SetHandleHandle(t, "g",g)
call SetHandleReal(t, "locx",GetLocationX(GetSpellTargetLoc()))
call SetHandleReal(t, "locy",GetLocationY(GetSpellTargetLoc()))
call TimerStart(t,.05,true,function CdI_2)
//set caster = null
//set t = null
endfunction
//===========================================================================
function InitTrig_Campo_de_Inmunidad takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function CdI_Conditions ) )
call TriggerAddAction( t, function CdI_Actions )
endfunction
someone can help me please!
P.S: i will remove leaks when it will be finished
ty community