- Joined
- Jul 14, 2011
- Messages
- 3,213
<< EDIT >>
Sorry, wrong place to post. This should be in trigger section.
Hi!
I'm rmking my bomberman map (Signature) and I'm improving the way the bomb explodes. In the past 4 dummies were being created and moved in each direction, but handling so many units is slow, so, I decided to do it with a Group
Every point of STR increases the explotion range in each direction by 128.00, so I loop from 1 to current str of the unit, and increase/reduce the X/Y based on the direction (using 4 loops, one for each direction) and checking if the point is pathable and else.
This is what I have so far.
Is there a way to improve it?
<< EDIT >>
Updated the Script several times.
Sorry, wrong place to post. This should be in trigger section.
Hi!
I'm rmking my bomberman map (Signature) and I'm improving the way the bomb explodes. In the past 4 dummies were being created and moved in each direction, but handling so many units is slow, so, I decided to do it with a Group
Every point of STR increases the explotion range in each direction by 128.00, so I loop from 1 to current str of the unit, and increase/reduce the X/Y based on the direction (using 4 loops, one for each direction) and checking if the point is pathable and else.
This is what I have so far.
JASS:
// Unit Kill
function GroupKill takes unit u returns nothing
local unit a
loop
set a = FirstOfGroup(udg_TGroup)
call UnitDamageTarget(u, a, 5000, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(udg_TGroup, a)
exitwhen a == null
endloop
endfunction
// Up
set bj_forLoopAIndex = 0
loop
exitwhen bj_forLoopAIndex > str
set y = y + 128
if IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) == false then
call DestroyEffect(AddSpecialEffect("FireLordDeathExplode.mdl", x, y))
call GroupEnumUnitsInRange(udg_TGroup, x, y, 128, null)
call GroupKill(udg_Bomber[pi])
else
set bj_forLoopAIndex = str
endif
set bj_forLoopAIndex = bj_forLoopAIndex+1
endloop
set y = GetUnitY(u)
// Down
set bj_forLoopAIndex = 0
loop
exitwhen bj_forLoopAIndex > str
set y = y - 128
if IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) == false then
call DestroyEffect(AddSpecialEffect("FireLordDeathExplode.mdl", x, y))
call GroupEnumUnitsInRange(udg_TGroup, x, y, 128, null)
call GroupKill(udg_Bomber[pi])
else
set bj_forLoopAIndex = str
endif
set bj_forLoopAIndex = bj_forLoopAIndex+1
endloop
set y = GetUnitY(u)
// Right
set bj_forLoopAIndex = 0
loop
exitwhen bj_forLoopAIndex > str
set x = x + 128
if IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) == false then
call DestroyEffect(AddSpecialEffect("FireLordDeathExplode.mdl", x, y))
call GroupEnumUnitsInRange(udg_TGroup, x, y, 128, null)
call GroupKill(udg_Bomber[pi])
else
set bj_forLoopAIndex = str
endif
set bj_forLoopAIndex = bj_forLoopAIndex+1
endloop
set x = GetUnitX(u)
// Left
set bj_forLoopAIndex = 0
loop
exitwhen bj_forLoopAIndex > str
set x = x - 128
if IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) == false then
call DestroyEffect(AddSpecialEffect("FireLordDeathExplode.mdl", x, y))
call GroupEnumUnitsInRange(udg_TGroup, x, y, 128, null)
call GroupKill(udg_Bomber[pi])
else
set bj_forLoopAIndex = str
endif
set bj_forLoopAIndex = bj_forLoopAIndex+1
endloop
Is there a way to improve it?
<< EDIT >>
Updated the Script several times.
Last edited: