- Joined
- Feb 26, 2005
- Messages
- 210
So I am working on a spell that kills player units in an area. The spell isn't setting a local location to where I want it to be thus causing it not to work properly. Here's the code:
I imagine there is a simple solution to this. Please help.
JASS:
function Trig_MDR_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A007' ) ) then
return false
endif
return true
endfunction
function Group_Actions takes nothing returns nothing
call KillUnit(GetEnumUnit())
endfunction
function LivingPlayerOwnedNonHeroGround takes nothing returns boolean
return GetOwningPlayer(GetFilterUnit()) == GetOwningPlayer(GetSpellAbilityUnit()) and GetWidgetLife(GetFilterUnit()) > .405 and IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND) == true and IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == false
endfunction
function Trig_MDR_Actions takes nothing returns nothing
local location l
local group g
local integer x
set l = GetSpellTargetLoc()
set g = GetUnitsInRangeOfLocMatching(200.00, l, Condition(function LivingPlayerOwnedNonHeroGround))
set x = CountUnitsInGroup(g)
call DisplayTextToForce( GetPlayersAll(), I2S(x) )
call ForGroup(g,function Group_Actions)
call DestroyGroup(g)
endfunction
//===========================================================================
function InitTrig_MDR takes nothing returns nothing
set gg_trg_MDR = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_MDR, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_MDR, Condition( function Trig_MDR_Conditions ) )
call TriggerAddAction( gg_trg_MDR, function Trig_MDR_Actions )
endfunction
I imagine there is a simple solution to this. Please help.