+rep for little job

jnZ

I
Reaction score
64
thanks, you are really an angle of helper >.< (iam bad @ english and dont know if this sentence makes sense but iam shure you know what i mean)

EDIT: its kinda funny because if i use 64 instead of 70 the explosion still hits the buildings but they are obviously not in the square that should be affected
 
M

Morfina

Guest
Revision 3(or 4, or.. I forget). Now blocks if it encounters an undead in a given direction. I've also tidied it up a bit to be more friendly to tweaking.

The global variables at the top allow you to define explosion graphic, tile size used in game, explosion radius (TileSize/2 by default), and modify the filter for unit type that blocks as well as the bomb's ID integer.

This spell now requires Jass NewGen, as it has been encapsulated in a scope to prevent function names from interfering and similar. I've replaced your GUI variable (udg_PowerupFire) with a declared global called PowerupFire - Simply add udg_ before that to make it work for your version. The spell expects PowerupFire to contain a number between 1 and 12 per player.
Code:
(Removed - See 'latest' reply with the code in. No need to keep faulty code hanging around)
 

jnZ

I
Reaction score
64
JASS:
scope BombExplosion

globals
    private constant string ExplosionGraphic = &quot;Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl&quot;
    private constant real TileSize = 128.
    private constant real ExplosionRadius = TileSize / 2
    private constant real DamageAmount = 10.
    private integer array udg_PowerupFire
endglobals

function BombUnitFilter takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_UNDEAD) == true)
endfunction

constant function BombUnitID takes nothing returns integer
    return &#039;h001&#039;
endfunction

function Bomb_Explosion_Actions takes nothing returns nothing
    local unit U = GetTriggerUnit()
    local integer i = 1
    local integer max = udg_PowerupFire[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]
    local boolean north_blocked = false
    local boolean south_blocked = false
    local boolean east_blocked = false
    local boolean west_blocked = false
    local location C = GetUnitLoc(U)
    local location array BombExplosionPoint
    local real loc_x = GetLocationX(C)
    local real loc_y = GetLocationY(C)
    local group g
    
    set BombExplosionPoint[0] = C
    call DestroyEffect(AddSpecialEffect(ExplosionGraphic, GetLocationX(BombExplosionPoint[0]), GetLocationY(BombExplosionPoint[0])))
    call UnitDamagePoint(U, 0.00, ExplosionRadius, loc_x, loc_y, DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
    
    // Set bomb explosion points
    loop 
        exitwhen (i == max)
        // North
        if(north_blocked == false) then
            set C = Location(loc_x, loc_y + (TileSize * i))
            set g = CreateGroup()
            call GroupEnumUnitsInRangeOfLoc(g, C, 64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPoint<i> = C
            else
                set BombExplosionPoint<i> = null
                set north_blocked = true
            endif
            call DestroyGroup(g)
        endif
        // South
        if(south_blocked == false) then
            set C = Location(loc_x, loc_y - (TileSize * i))
            set g = CreateGroup()
            call GroupEnumUnitsInRangeOfLoc(g, C, 64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPoint[i + 13] = C
            else
                set BombExplosionPoint[i + 13] = null
                set south_blocked = true
            endif
            call DestroyGroup(g)
        endif

        // East
        if(east_blocked == false) then
            set C = Location(loc_x + (TileSize * i), loc_y)
            set g = CreateGroup()
            call GroupEnumUnitsInRangeOfLoc(g, C, 64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPoint[i + 25] = C
            else
                set BombExplosionPoint[i + 25] = null
                set east_blocked = true
            endif
            call DestroyGroup(g)
        endif
        // West
        if(west_blocked == false) then
            set C = Location(loc_x - (TileSize * i), loc_y)
            set g = CreateGroup()
            call GroupEnumUnitsInRangeOfLoc(g, C, 64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPoint[i + 37] = C
            else
                set BombExplosionPoint[i + 37] = null
                set west_blocked = true
            endif
            call DestroyGroup(g)
        endif

        set i = i + 1
    endloop


    set i = 1
    loop
        exitwhen (i == max)
        if(BombExplosionPoint<i> != null) then // north
            call UnitDamagePoint(U, 0.00, ExplosionRadius, GetLocationX(BombExplosionPoint<i>), GetLocationY(BombExplosionPoint<i>), DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, GetLocationX(BombExplosionPoint<i>), GetLocationY(BombExplosionPoint<i>)))
            call RemoveLocation(BombExplosionPoint<i>)
        endif
        
        if(BombExplosionPoint[i + 13] != null) then
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, GetLocationX(BombExplosionPoint[i + 13]), GetLocationY(BombExplosionPoint[i + 13])))
            call UnitDamagePoint(U, 0.00, ExplosionRadius, GetLocationX(BombExplosionPoint[i + 13]), GetLocationY(BombExplosionPoint[i + 13]), DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
            call RemoveLocation(BombExplosionPoint[i + 13])
        endif
        
        if(BombExplosionPoint[i + 25] != null) then
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, GetLocationX(BombExplosionPoint[i + 25]), GetLocationY(BombExplosionPoint[i + 25])))
            call UnitDamagePoint(U, 0.00, ExplosionRadius, GetLocationX(BombExplosionPoint[i + 25]), GetLocationY(BombExplosionPoint[i + 25]), DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
            call RemoveLocation(BombExplosionPoint[i + 25])
        endif
        
        if(BombExplosionPoint[i + 37] != null) then
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, GetLocationX(BombExplosionPoint[i + 37]), GetLocationY(BombExplosionPoint[i + 37])))
            call UnitDamagePoint(U, 0.00, ExplosionRadius, GetLocationX(BombExplosionPoint[i + 37]), GetLocationY(BombExplosionPoint[i + 37]), DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
            call RemoveLocation(BombExplosionPoint[i + 37])
        endif
        set i = i + 1
    endloop
    
    call RemoveLocation(C)
    set U = null
endfunction

function Bomb_Explosion_Conditions takes nothing returns boolean
    return (GetUnitTypeId(GetTriggerUnit()) == BombUnitID()) == true
endfunction

function InitTrig_Bomb_Explosion takes nothing returns nothing
    set gg_trg_Bomb_Explosion = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Bomb_Explosion, EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(gg_trg_Bomb_Explosion, Condition( function Bomb_Explosion_Conditions ))
    call TriggerAddAction( gg_trg_Bomb_Explosion, function Bomb_Explosion_Actions )
endfunction

endscope</i></i></i></i></i></i></i></i>


changed it like this (added udg_ to both) but if i test and type in "3" sometimes to increase the firepower it doesnt effect the explosion

EDIT: removed your comments for my version because i thought they slow down the trigger (it already causes laggs and i dont know why and its really annoying)
 
M

Morfina

Guest
Completely remove my declaration of PowerupFire (the line private integer array PowerupFire).

As for lag, I'm currently reworking the function to use coordinates instead of locations. That should significantly speed up the spell.
 

jnZ

I
Reaction score
64
omg you really help me here and still work to improve it, and dude you dont have to mention me it already your system feel free to upload it here and dont mention my name, ill credit you for the whole thing in my map 2

EDIT: if i remove the line you mentioned NO effect appears

EDIT2: nvm just noticed that a error disabled the trigger, everything works fine if i remove the line
 
M

Morfina

Guest
No problem ;)

As for having no effect; hmm. If you keep my variable as-is (without your modifications), simply go into your trigger for writing '3' into chat and add a custom script line that looks as follows:

set Powerup[GetPlayerId(GetTriggeringPlayer())] = Powerup[GetPlayerId(GetTriggeringPlayer())] + 1

Here is a new version of the trigger. I can't really be arsed to make it follow JESP standards right now and create a stand-alone demo map for it, but maybe I'll do that some other time. Please note that comments don't slow anything down. Make sure you read the ones at the top. This version supports any number of Firepower (i.e. numbers greater than 12 as well), as long as theres at least 1.

JASS:
/////////////
// Bomberman style explosion by Martin &quot;Morfina&quot; Grünbaum
// Made for jnZ on <a href="http://www.thehelper.net" class="link link--internal">www.thehelper.net</a>, credit to him for the
// general idea.
////////////

scope BombExplosion

// Modify these to define explosion radius
// TileSize is 128.00 by default (Medium size tile), and ExplosionRadius will automatically assume to cover
// 1 whole tile per explosion (TileSize / 2).

// The filter uses UNIT_TYPE_UNDEAD. Any undead discovered in a direction will stop explosions from that unit and onward
// in the direction it is found.

// The amount of tiles the bomb travels is defined in GetFirepower(PlayerID)
// If DEMO_MODE_DEFINED is set to true, the InitTrig will automatically set a
// random value between 1 and 6 for every entry in Firepower. Disable DEMO_MODE_DEFINED
// if/when you develop a method to set/modify the Firepower array yourself.
globals
    private constant boolean DEMO_MODE_DEFINED = true
    private constant string ExplosionGraphic = &quot;Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl&quot;
    private constant real TileSize = 128.
    private constant real ExplosionRadius = TileSize / 2
    private constant real DamageAmount = 10.
    private constant integer Firepower_Max = 12
    public integer array Firepower[12]
endglobals

// Return true for a unit that blocks explosions.
function BombUnitFilter takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_UNDEAD) == true)
endfunction

// Set this to the ID of your &#039;bomb&#039; unit
constant function BombUnitID takes nothing returns integer
    return &#039;h001&#039;
endfunction

// By default, returns the value of the player&#039;s ID in the Firepower array.
private function GetFirepower takes integer ID returns integer
    return Firepower[ID]
endfunction

// DONT TOUCH ANYTHING BELOW HERE
function Bomb_Explosion_Actions takes nothing returns nothing
    local unit U = GetTriggerUnit()
    local integer i = 1
    local integer max = GetFirepower(GetPlayerId(GetOwningPlayer(GetTriggerUnit())))

    local boolean north_blocked = false
    local boolean south_blocked = false
    local boolean east_blocked = false
    local boolean west_blocked = false

    local integer SouthIndex
    local integer EastIndex
    local integer WestIndex
    local real array BombExplosionPointX
    local real array BombExplosionPointY
    local real loc_x = GetUnitX(U)
    local real loc_y = GetUnitY(U)
    local real TileSizeMulti

    local group g
    
    set BombExplosionPointX[0] = loc_x
    set BombExplosionPointY[0] = loc_y

    call DestroyEffect(AddSpecialEffect(ExplosionGraphic, loc_x, loc_y))
    call UnitDamagePoint(U, 0.00, ExplosionRadius, loc_x, loc_y, DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
    
    // Set bomb explosion points
    loop 
        exitwhen (i == max)
        // Attempt to speed up by reducing amount of math required.
        set TileSizeMulti = TileSize * i 
        set SouthIndex = i + Firepower_Max + 1
        set EastIndex = i + (Firepower_Max * 2) + 1
        set WestIndex = i + (Firepower_Max * 3) + 1

        // North
        if(north_blocked == false) then
            set g = CreateGroup()
            call GroupEnumUnitsInRange(g, loc_x, loc_y + TileSizeMulti, 64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPointX<i> = loc_x
                set BombExplosionPointY<i> = loc_y + TileSizeMulti
            else
                set north_blocked = true
            endif
            call DestroyGroup(g)
        endif

        // South
        if(south_blocked == false) then
            set g = CreateGroup()
            call GroupEnumUnitsInRange(g, loc_x, loc_y - TileSizeMulti, 64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPointX[SouthIndex] = loc_x
                set BombExplosionPointY[SouthIndex] = loc_y - TileSizeMulti
            else
                set south_blocked = true
            endif
            call DestroyGroup(g)
        endif

        // East
        if(east_blocked == false) then
            set g = CreateGroup()
            call GroupEnumUnitsInRange(g, loc_x + TileSizeMulti, loc_y,  64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPointX[EastIndex] = loc_x + TileSizeMulti
                set BombExplosionPointY[EastIndex] = loc_y
            else
                set east_blocked = true
            endif
            call DestroyGroup(g)
        endif
        // West
        if(west_blocked == false) then
            set g = CreateGroup()
            call GroupEnumUnitsInRange(g, loc_x - TileSizeMulti, loc_y, 64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPointX[WestIndex] = loc_x - TileSizeMulti
                set BombExplosionPointY[WestIndex] = loc_y
            else
                set west_blocked = true
            endif
            call DestroyGroup(g)
        endif

        set i = i + 1
    endloop

    set i = 1
    loop
        exitwhen (i == max)
        set SouthIndex = i + Firepower_Max + 1
        set EastIndex = i + (Firepower_Max * 2) + 1
        set WestIndex = i + (Firepower_Max * 3) + 1
        if(BombExplosionPointX<i> != null) then // north
            call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX<i>, BombExplosionPointY<i>, DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, BombExplosionPointX<i>, BombExplosionPointY<i>))
        endif
        
        if(BombExplosionPointX[SouthIndex] != null) then
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, BombExplosionPointX[SouthIndex], BombExplosionPointY[SouthIndex]))
            call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX[SouthIndex], BombExplosionPointY[SouthIndex], DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
        endif
        
        if(BombExplosionPointX[EastIndex] != null) then
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, BombExplosionPointX[EastIndex], BombExplosionPointY[EastIndex]))
            call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX[EastIndex], BombExplosionPointY[EastIndex], DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
        endif
        
        if(BombExplosionPointX[WestIndex] != null) then
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, BombExplosionPointX[WestIndex], BombExplosionPointY[WestIndex]))
            call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX[WestIndex], BombExplosionPointY[WestIndex], DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
        endif
        set i = i + 1
    endloop

    set U = null
    set g = null
endfunction

function Bomb_Explosion_Conditions takes nothing returns boolean
    return (GetUnitTypeId(GetTriggerUnit()) == BombUnitID()) == true
endfunction

function InitTrig_Bomb_Explosion takes nothing returns nothing
    set gg_trg_Bomb_Explosion = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Bomb_Explosion, EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(gg_trg_Bomb_Explosion, Condition( function Bomb_Explosion_Conditions ))
    call TriggerAddAction( gg_trg_Bomb_Explosion, function Bomb_Explosion_Actions )
    if(DEMO_MODE_DEFINED == true) then
        set Firepower[0] = GetRandomInt(1,  6)
        set Firepower[1] = GetRandomInt(1, 6)
        set Firepower[2] = GetRandomInt(1,  6)
        set Firepower[3] = GetRandomInt(1,  6)
        set Firepower[4] = GetRandomInt(1,  6)
        set Firepower[5] = GetRandomInt(1,  6)
        set Firepower[6] = GetRandomInt(1,  6)
        set Firepower[7] = GetRandomInt(1,  6)
        set Firepower[8] = GetRandomInt(1,  6)
        set Firepower[9] = GetRandomInt(1,  6)
        set Firepower[10] = GetRandomInt(1, 6)
        set Firepower[11] = GetRandomInt(1, 6)
    endif
endfunction

endscope
</i></i></i></i></i></i></i>
 

jnZ

I
Reaction score
64
i also noticed that but
Code:
COMMAND 3
    Events
        Player - Player 1 (Red) types a chat message containing 3 as An exact match
    Conditions
    Actions
        Custom script:   set Firepower[GetPlayerId(GetTriggeringPlayer())] = Firepower[GetPlayerId(GetTriggeringPlayer())] + 1

still causes errors
 
M

Morfina

Guest
i also noticed that but
Code:
COMMAND 3
    Events
        Player - Player 1 (Red) types a chat message containing 3 as An exact match
    Conditions
    Actions
        Custom script:   set Firepower[GetPlayerId(GetTriggeringPlayer())] = Firepower[GetPlayerId(GetTriggeringPlayer())] + 1

still causes errors

Change GetTriggeringPlayer() to GetTriggerPlayer() in both the spots it appears.
 

jnZ

I
Reaction score
64
it still lags but it still lags. seem that you cant fix it but i dont think/hope its not a problem

thanks 4 all your help you were awesome

btw are you german? thought because of your name

EDIT: could you tell me the line i had to add (and tell me where) if i want to add 1 more damage area/effect thing (basicly at the position of the "undead" so the block gets killed
 

jnZ

I
Reaction score
64
JASS:
scope BombExplosion
globals
    private constant string ExplosionGraphic = &quot;Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl&quot;
    private constant real TileSize = 128.
    private constant real ExplosionRadius = TileSize / 2
    private constant real DamageAmount = 10.
    private constant integer Firepower_Max = 12
    public integer array Firepower[12]
endglobals

function BombUnitFilter takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_ANCIENT) == true)
endfunction

constant function BombUnitID takes nothing returns integer
    return &#039;h001&#039;
endfunction

private function GetFirepower takes integer ID returns integer
    return Firepower[ID]
endfunction

function Bomb_Explosion_Actions takes nothing returns nothing
    local unit U = GetTriggerUnit()
    local integer i = 1
    local integer max = GetFirepower(GetPlayerId(GetOwningPlayer(GetTriggerUnit())))

    local boolean north_blocked = false
    local boolean south_blocked = false
    local boolean east_blocked = false
    local boolean west_blocked = false

    local integer SouthIndex
    local integer EastIndex
    local integer WestIndex
    local real array BombExplosionPointX
    local real array BombExplosionPointY
    local real loc_x = GetUnitX(U)
    local real loc_y = GetUnitY(U)
    local real TileSizeMulti

    local group g
    
    set BombExplosionPointX[0] = loc_x
    set BombExplosionPointY[0] = loc_y

    call DestroyEffect(AddSpecialEffect(ExplosionGraphic, loc_x, loc_y))
    call UnitDamagePoint(U, 0.00, ExplosionRadius, loc_x, loc_y, DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
    
    loop 
        exitwhen (i == max)
        set TileSizeMulti = TileSize * i 
        set SouthIndex = i + Firepower_Max + 1
        set EastIndex = i + (Firepower_Max * 2) + 1
        set WestIndex = i + (Firepower_Max * 3) + 1

        if(north_blocked == false) then
            set g = CreateGroup()
            call GroupEnumUnitsInRange(g, loc_x, loc_y + TileSizeMulti, 64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPointX<i> = loc_x
                set BombExplosionPointY<i> = loc_y + TileSizeMulti
            else
                <span style="color: Sienna">set BombExplosionPointX<i> = loc_x
                set BombExplosionPointY<i> = loc_y + TileSizeMulti
                call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX<i>, BombExplosionPointY<i>, DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
                set BombExplosionPointX<i> = 0
                set north_blocked = true</i></i></i></i></i></span><i><i><i><i><i>
            endif
            call DestroyGroup(g)
        endif

        if(south_blocked == false) then
            set g = CreateGroup()
            call GroupEnumUnitsInRange(g, loc_x, loc_y - TileSizeMulti, 64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPointX[SouthIndex] = loc_x
                set BombExplosionPointY[SouthIndex] = loc_y - TileSizeMulti
            else
                <span style="color: Sienna">set south_blocked = true
                set BombExplosionPointX[SouthIndex] = loc_x
                set BombExplosionPointY[SouthIndex] = loc_y - TileSizeMulti
                call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX[SouthIndex], BombExplosionPointY[SouthIndex], DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
                set BombExplosionPointX[SouthIndex] = 0</span>
            endif
            call DestroyGroup(g)
        endif

        if(east_blocked == false) then
            set g = CreateGroup()
            call GroupEnumUnitsInRange(g, loc_x + TileSizeMulti, loc_y,  64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPointX[EastIndex] = loc_x + TileSizeMulti
                set BombExplosionPointY[EastIndex] = loc_y
            else
                <span style="color: Sienna">set east_blocked = true
                set BombExplosionPointX[EastIndex] = loc_x + TileSizeMulti
                set BombExplosionPointY[EastIndex] = loc_y
                call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX[EastIndex], BombExplosionPointY[EastIndex], DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
                set BombExplosionPointX[EastIndex] = 0</span>
            endif
            call DestroyGroup(g)
        endif
        
        if(west_blocked == false) then
            set g = CreateGroup()
            call GroupEnumUnitsInRange(g, loc_x - TileSizeMulti, loc_y, 64, Condition( function BombUnitFilter))
            set bj_isUnitGroupEmptyResult = true
            call ForGroup(g, function IsUnitGroupEmptyBJEnum)
            if(bj_isUnitGroupEmptyResult == true) then
                set BombExplosionPointX[WestIndex] = loc_x - TileSizeMulti
                set BombExplosionPointY[WestIndex] = loc_y
            else
                <span style="color: Sienna">set west_blocked = true
                set BombExplosionPointX[WestIndex] = loc_x - TileSizeMulti
                set BombExplosionPointY[WestIndex] = loc_y
                call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX[WestIndex], BombExplosionPointY[WestIndex], DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
                set BombExplosionPointX[WestIndex] = 0</span>
            endif
            call DestroyGroup(g)
        endif

        set i = i + 1
    endloop

    set i = 1
    loop
        exitwhen (i == max)
        set SouthIndex = i + Firepower_Max + 1
        set EastIndex = i + (Firepower_Max * 2) + 1
        set WestIndex = i + (Firepower_Max * 3) + 1
        if(BombExplosionPointX<i> != null) then
            call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX<i>, BombExplosionPointY<i>, DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, BombExplosionPointX<i>, BombExplosionPointY<i>))
        endif
        
        if(BombExplosionPointX[SouthIndex] != null) then
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, BombExplosionPointX[SouthIndex], BombExplosionPointY[SouthIndex]))
            call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX[SouthIndex], BombExplosionPointY[SouthIndex], DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
        endif
        
        if(BombExplosionPointX[EastIndex] != null) then
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, BombExplosionPointX[EastIndex], BombExplosionPointY[EastIndex]))
            call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX[EastIndex], BombExplosionPointY[EastIndex], DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
        endif
        
        if(BombExplosionPointX[WestIndex] != null) then
            call DestroyEffect(AddSpecialEffect(ExplosionGraphic, BombExplosionPointX[WestIndex], BombExplosionPointY[WestIndex]))
            call UnitDamagePoint(U, 0.00, ExplosionRadius, BombExplosionPointX[WestIndex], BombExplosionPointY[WestIndex], DamageAmount, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
        endif
        set i = i + 1
    endloop

    set U = null
    set g = null
endfunction

function Bomb_Explosion_Conditions takes nothing returns boolean
    return (GetUnitTypeId(GetTriggerUnit()) == BombUnitID()) == true
endfunction

function InitTrig_Bomb_Explosion takes nothing returns nothing
    set gg_trg_Bomb_Explosion = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Bomb_Explosion, EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(gg_trg_Bomb_Explosion, Condition( function Bomb_Explosion_Conditions ))
    call TriggerAddAction( gg_trg_Bomb_Explosion, function Bomb_Explosion_Actions )
endfunction
</i></i></i></i></i></i></i></i></i></i></i></i>


this is how i tried to edit your code so it works like i want it to (if an ancient "block" is detected damage the area but dont show the effect) it seemed to work fine but when i tested the map again, didnt edit the firepoer (only 1 suqare should be affected) a wierd problem appeard. cant describe it, test it yourself. i think you know what i tried to do

<3

EDIT: sry for the double post but i still dont know how to attatch files if i edit a post
 

Attachments

  • BOMB(2).w3x
    515 KB · Views: 207

jnZ

I
Reaction score
64
*bump* need helpz here xD

sry for 18h bump but iam out for the weekend now
 

Kenny

Back for now.
Reaction score
202
Why is there this in your script:

JASS:
<span style="color: Sienna">set BombExplosionPointX<i> = loc_x // Why is <span style="color: Sienna"> here.
</span></i></span>


Im not sure whats wrong because i havent really read the thread and im tired but just something to point out... UnitDamagePoint() is unsafe, well, more so for Mac users as it causes desyncs for them, but ive been told to stay away from it for good.

You could use a damage area loop. PurgeAndFire made a good one, which is now in the systems section or waiting to be approved.

It just groups unit in range of a point and loops through and damages them one by one.

That may also clear a few things up.
 

jnZ

I
Reaction score
64
those color thing are my fault i tried to highlight them here because i changed them but in jass code it didnt work i think.


i dont understand a single bit of jass so whoever know how to improve this code or sees some other major mistakes or inefficient part pls tell me/us and maybe post the improvement ^^
 
M

Morfina

Guest
Just a note: I'm away for a bit to take care of some RL issues, don't have time to look the more recent posts over.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top