HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Problems with a spell, expansive wave not working with pathing blockers

03-04-2007, 05:20 PM#1
grupoapunte
Hey, im having problems making a spell, the spell is realy simple this is the main function:

Collapse JASS:
function Trig_Nuke_Effect_Actions takes nothing returns nothing
    local unit u
    local integer i = 1
    local location l
    local player p = Player((udg_NukeAttacker - 1))
    
    call DisableTrigger( gg_trg_Ping_Target )
    
    set u = CreateUnitAtLoc(p, rcBoom1FX(), udg_NukeTargetPos, bj_UNIT_FACING)
    call UnitApplyTimedLife(u, 'BTLF', 1.00)
    set u = CreateUnitAtLoc(p, rcBoom2FX(), udg_NukeTargetPos, bj_UNIT_FACING)
    call UnitApplyTimedLife(u, 'BTLF', 1.00)
    set u = CreateUnitAtLoc(p, rcBoom3FX(), udg_NukeTargetPos, bj_UNIT_FACING)
    call UnitApplyTimedLife(u, 'BTLF', 1.00)
    set u = CreateUnitAtLoc(p, rcBoom4FX(), udg_NukeTargetPos, bj_UNIT_FACING)
    call UnitApplyTimedLife(u, 'BTLF', 1.00)
    
    loop
        exitwhen i > 50
        set u = CreateUnitAtLoc(p, rcFireFX(), udg_NukeTargetPos, (I2R(i) * 7.20))
        set l = PolarProjectionBJ(udg_NukeTargetPos, 1000.00, (I2R(i) * 7.20))
        call IssuePointOrderLoc(u, "move", l)
        call UnitApplyTimedLife(u, 'BTLF', 3.10)
        call RemoveLocation(l)
        set i = i + 1
    endloop
    
    call UnitUseItemPointLoc(udg_NukePlatform, UnitItemInSlotBJ(udg_NukePlatform, 1), udg_NukeTargetPos)
    call RemoveLocation(udg_NukeTargetPos)
    set udg_NukeAttacker = 0
    
    set l = null
    set p = null
    set u = null
endfunction

OK ill explain, this is a nuclear explosion, this fuction takes place when the nuke impacts the ground and an invisible unit dies (i made it this way so its more simple, a building has a dummy skill that targets a location and the invisible unit is created, and then i simply order the missile silo to attack that unit...) ok, what hapends is this, when that unit dies i create 50 units that move as growing a circle around the impact area, this units have inmolation so they act as an expansive wave killing at contact.

The skill works great, in my initial map, but now i imported it to another map that has pathing blocking for air in some places, and since the units that has the inmolation have to be air units to make the perfect circle effect, they go around the blocks, and it looks crapy and unreal.

So the big question after all this explanation, how can i fix this? i thought of remaking the spell, pick the units around the impact area and deal dmg when the "expansive wave" reaches them and instead of units with inmolation for the wave, just make special effects, the thing is how to make this effects move naturaly. Maybe this is the worst way, im new to spell making, im good with triggers so ill take any suggestions.

Thanks a lot!

PS: by the way, is it posible to order a unit to cast a custom spell? i been unsing items and ordering them to use the item in X location.
03-04-2007, 07:49 PM#2
Fireeye
There are 2 solutions.
1. don't use moving units, use dummy caster with e.g. shockwave or something similiar and order them to cast on the target points.
2. use a timer + gamecache or any handle system and use instead of move instantly (or order to move) SetUnitX and SetUnitY, as much as i know these 2 commands let your moved units ignore any blockage.
03-04-2007, 07:51 PM#3
WNxCryptic
Collapse JASS:
function Trig_Nuke_EnumKill takes nothing returns nothing
    call KillUnit( GetEnumUnit() )
endfunction

function Trig_Nuke takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local location loc = GetUnitLoc( u )
    local group g
    local integer MAX_RANGE = 700
    local integer rangecount = 0

    loop
    exitwhen rangecount >= MAX_RANGE
    set g = GetUnitsInRangeOfLocAll( rangecount, loc )

    call ForGroup( g, function Trig_Nuke_EnumKill)

    set rangecount = rangecount + 40
    endloop

    call DestroyGroup( g )
    call RemoveLocation( loc )
    call RemoveUnit( u )

    set u = null
    set g = null
    set loc = null
endfunction


This will progressively pick all units in range of the position of the nuke-unit (the dummy one) in a progressive movement outwards. You could add a TSA to it to make it more realistic if its executing too quickly or whatever...

Also, as a side note, try to avoid using PolarProjectionBJ in any code..its a horrible BJ function. Work with reals whenever you can...I can recode what I put above to use reals if you would prefer.

---------------

And yes, you can order a unit to use a custom spell from a trigger by using IssuePointOrder or IssueTargetOrder and the orderstring of the spell it was based off of. So say you had an ability "Frost cone" based off of carrion swarm, you would use:

IssuePointOrder( casterunit, "carrionswarm", targetx, targety )
03-04-2007, 08:06 PM#4
grupoapunte
thanks both! i think ill make the shockwave thing, i hope it don't lagg if i cast the same skill 50 times without waits
03-04-2007, 09:13 PM#5
Pyrogasm
Be forewarned: shockwaves overlap. Impale does not.

Say, for instance, that each shockwave did 400 damage. If you cast them at repeating angles of 7.2 degrees, a unit standing near the center of the nuke area, maybe at 10.4 degrees 20 units away from the center, would take roughly 800 damage instead of 400 because the shockwaves overlap.

Impale does not work this way, but you'll have to set the stun time to 0.01 seconds, and it will interrupt casting.
03-04-2007, 09:22 PM#6
WNxCryptic
I think he intends to kill EVERYTHING in the nuke radius...I doubt it'll be a big deal.
03-04-2007, 09:28 PM#7
Pyrogasm
Meh.

Just warning the general populace, in case they happen to not kill everything in the radius using the same method.