- Joined
- Aug 21, 2008
- Messages
- 533
i begunn learning vjass some time ago and i just dont get this running proerply...
This i made just learning and it should damage all nearby unit nearby a diyng unit...
JASS:
struct UnitExplode
real d
real r
real x
real y
unit u
unit u2 //killing unit
method UnitDead takes nothing returns nothing
local group g
set .x=GetUnitX(.u)
set .y=GetUnitY(.u)
call GroupEnumUnitsInRange(g,.x,.y,.r,null)
loop
set .u = FirstOfGroup(g)
exitwhen .u == null
call UnitDamageTarget(.u2,.u,.d,true,false,ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endloop
call DestroyGroup(g)
endmethod
endstruct
function Explode takes nothing returns nothing
local unit u= GetTriggerUnit()
local unit u2= GetKillingUnit()
local UnitExplode ue = UnitExplode.create()
set ue.u=u
set ue.u2=u2
set ue.r=300
set ue.d=500
call ue.UnitDead()
call ue.destroy()
endfunction
//===========================================================================
function InitTrig_Explodespell takes nothing returns nothing
local integer index
set gg_trg_Explodespell = CreateTrigger( )
set index = 0
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Explodespell, Player(index), EVENT_PLAYER_UNIT_DEATH, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddAction( gg_trg_Explodespell, function Explode)
endfunction
This i made just learning and it should damage all nearby unit nearby a diyng unit...