- Joined
- Apr 16, 2011
- Messages
- 158
I have this code:
What it does: when the User with this buff active receives a shock.
I want to exchange it for a code where only units very close to take the shock, and I want him not to be activated by EVENT_PLAYER_UNIT_ATTACKED
but units close to the caster
I can take advantage of this code?
GetPlayableMapRect ---in--> units around
any tips on how to do?
-
edit:
I have this:
I'm not sure how to use
and
I'm not sure about X, Y goes radius
JASS:
function Trig_unit_attacked takes nothing returns boolean
if (not(GetUnitAbilityLevel(GetTriggerUnit(), 'B000') > 0))then
return false
endif
return true
endfunction
function Trig_check takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())) and GetUnitAbilityLevel(GetFilterUnit(),'Aloc') == 0
endfunction
function Trig_chainlightning takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit e = GetAttacker()
local unit d = CreateUnit(GetOwningPlayer(u),'n00Z',GetUnitX(e),GetUnitY(e),0)
call UnitAddAbility(d,'A002')
call SetUnitAbilityLevel(d,'A002',GetUnitAbilityLevel(u,'A001')+4)
call IssueTargetOrder(d,"chainlightning",e)
call UnitApplyTimedLife(d,'BTLF',3)
set e = null
set d = null
endfunction
function Trig_group takes nothing returns nothing
local unit u = GetTriggerUnit()
local group g = CreateGroup()
local boolexpr b = Condition(function Trig_check)
call GroupEnumUnitsInRect(g,GetPlayableMapRect(),b)
call ForGroup(g,function Trig_chainlightning)
call DestroyBoolExpr(b)
call DestroyGroup(g)
set u = null
set g = null
set b = null
endfunction
function InitTrig_Statick_Fild takes nothing returns nothing
set gg_trg_Statick_Fild = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_Statick_Fild, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(gg_trg_Statick_Fild, Condition(function Trig_unit_attacked))
call TriggerAddAction(gg_trg_Statick_Fild, function Trig_chainlightning)
endfunction
I want to exchange it for a code where only units very close to take the shock, and I want him not to be activated by EVENT_PLAYER_UNIT_ATTACKED
but units close to the caster
I can take advantage of this code?
JASS:
call GroupEnumUnitsInRect(g,GetPlayableMapRect(),b)
any tips on how to do?
-
edit:
I have this:
I'm not sure how to use
JASS:
constant unittype UNIT_TYPE_RANGED_ATTACKER=ConvertUnitType(8)
and
JASS:
native GroupEnumUnitsInRange takes group whichGroup, real x, real y, real radius, boolexpr filter returns nothing