Need some direction on this...
Ok so right now I'm just practicing using jass but I am kind of stuck first off here is the code I have:
All I'm trying to do is when a unit casts a custom thunderclap (A000) have it count the number of enemy units and display it to player 1.. but as of right now nothing happens, and I am unsure of what to change. Anyone have any thought as to what I should do?
Ok so right now I'm just practicing using jass but I am kind of stuck first off here is the code I have:
JASS:
function check takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
endif
return true
endfunction
function unitfilter takes nothing returns boolean
if ( not ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true ) ) then
return false
endif
return true
endfunction
function action takes nothing returns nothing
local group UIR
local location loc = GetUnitLoc(GetTriggerUnit())
local integer i
local real x
local real y
local real r =300.0
set x =GetLocationX(loc)
set y =GetLocationY(loc)
call GroupClear(UIR)
call GroupEnumUnitsInRange(UIR, x, y, r, Condition(function unitfilter))
call CountUnitsInGroupEnum()
call DisplayTextToPlayer(Player(0), 0, 0, I2S(CountUnitsInGroup(UIR)))
endfunction
function InitTrig takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function check))
call TriggerAddAction(t, function action)
endfunction
All I'm trying to do is when a unit casts a custom thunderclap (A000) have it count the number of enemy units and display it to player 1.. but as of right now nothing happens, and I am unsure of what to change. Anyone have any thought as to what I should do?
Last edited: