- Joined
- Jul 9, 2008
- Messages
- 253
I'm making a spell called Chaos Bomb, it creates a small ball that keeps growing and eventually will explode and deal 6xint in damage to all units in 400 range. I have the growing part but the damage part doesnt work for me
This is what i have:
Can anyone help me fix it?
Thanks in advance,
Quetzalcotl
This is what i have:
JASS:
function Trig_Chaos_Bomb_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A010' ) ) then
return false
endif
return true
endfunction
function Trig_Chaos_Bomb_Actions takes nothing returns nothing
local real size = 100.00
local unit caster = GetTriggerUnit()
local unit bomb
local unit explosion
local unit u
local group g
call CreateNUnitsAtLoc( 1, 'h00B', GetOwningPlayer(caster), GetSpellTargetLoc(), bj_UNIT_FACING )
set bomb = GetLastCreatedUnit()
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 50
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set size = ( size + 10 )
call SetUnitScalePercent( bomb, size, size, size )
call TriggerSleepAction( 0.01 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveUnit(bomb)
call CreateNUnitsAtLoc( 1, 'h00C', GetOwningPlayer(caster), GetUnitLoc(bomb), bj_UNIT_FACING)
set explosion = GetLastCreatedUnit()
call TriggerSleepAction( 1.00 )
set g = CreateGroup()
call GetUnitsInRangeOfLocAll (400, GetUnitLoc (bomb) )
loop
exitwhen u == null
set u = FirstOfGroup ( g )
if IsUnitEnemy(u, GetOwningPlayer(caster)) then
call UnitDamageTargetBJ(caster, u, ( I2R(GetHeroStatBJ(bj_HEROSTAT_INT, caster, true)) * 6.00 ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
endif
call GroupRemoveUnit (g , u )
call RemoveUnit(explosion)
set bomb = null
set caster = null
endloop
endfunction
//===========================================================================
function InitTrig_Chaos_Bomb takes nothing returns nothing
set gg_trg_Chaos_Bomb = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Chaos_Bomb, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Chaos_Bomb, Condition( function Trig_Chaos_Bomb_Conditions ) )
call TriggerAddAction( gg_trg_Chaos_Bomb, function Trig_Chaos_Bomb_Actions )
endfunction
Can anyone help me fix it?
Thanks in advance,
Quetzalcotl