Dummy Caster Problem?

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
Warning: Terrible JASS coding ahead. Tips on how to improve this in general would be good too, but unecessary at the moment.

So I have this spell. The idea is that you cast it and it launches Storm Bolts out to every enemy unit within 600 range. If one of the units struck by the bolt has the ability "Mark of the Storm" (ability ID 'A005') then this effect will launch once more, occuring from the position of the unit with the ability, rather than the casting unit. I've done this across two triggers, and this is what it looks like:

JASS:
scope Stormhammers1

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00H'
endfunction

private function GroupAct takes nothing returns nothing
    local location l = GetUnitLoc(GetTriggerUnit())
    local unit u = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()), 'n007', l, 270)
    call UnitAddAbility(u, 'A00I')
    call IssueTargetOrder(u, "thunderbolt", GetEnumUnit())
    set u = null
    call RemoveLocation(l)
endfunction

private function Actions takes nothing returns nothing
    local location l = GetUnitLoc(GetTriggerUnit())
    local group ug = GetUnitsInRangeOfLocAll(600.00, l)
    call ForGroup(ug, function GroupAct)
    call DestroyGroup(ug)
    call RemoveLocation(l)
endfunction

//===========================================================================
function InitTrig_Stormhammers1 takes nothing returns nothing
    set gg_trg_Stormhammers1 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Stormhammers1, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Stormhammers1, Condition( function Conditions ) )
    call TriggerAddAction( gg_trg_Stormhammers1, function Actions )
endfunction

endscope


JASS:
scope Stormhammers2

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00I'
endfunction

private function GroupAct takes nothing returns nothing
    local location l = GetUnitLoc(GetSpellTargetUnit())
    local unit u = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()), 'n007', l, 270)
    call UnitAddAbility(u, 'A00J')
    call IssueTargetOrder(u, "thunderbolt", GetEnumUnit())
    call UnitDamageTarget(u, GetEnumUnit(), I2R(GetHeroInt(udg_Hero[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))], true) + GetHeroStr(udg_Hero[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))], true)), true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS )
    set u = null
    call RemoveLocation(l)
endfunction

private function Actions takes nothing returns nothing
    local location l = GetUnitLoc(GetSpellTargetUnit())
    local group ug = GetUnitsInRangeOfLocAll(600.00, l)
    call UnitDamageTarget(GetTriggerUnit(), GetSpellTargetUnit(), I2R(GetHeroInt(udg_Hero[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))], true) + GetHeroStr(udg_Hero[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))], true)), true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS )
    if GetUnitAbilityLevel(GetSpellTargetUnit(), 'A005') >= 1 then
        call ForGroup(ug, function GroupAct)
    endif
    call DestroyGroup(ug)
    call RemoveLocation(l)
endfunction

//===========================================================================
function InitTrig_Stormhammers2 takes nothing returns nothing
    set gg_trg_Stormhammers2 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Stormhammers2, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Stormhammers2, Condition( function Conditions ) )
    call TriggerAddAction( gg_trg_Stormhammers2, function Actions )
endfunction

endscope


So what should be happening is that the unit with Mark of the Storm launches a second wave of Storm Bolts off, hitting more targets and then stopping (which is why I've used two different abilities - so the second one doesn't trigger the first trigger's actions). However, what's happening is that the first wave of storm bolts is launching off fine, but the second isn't. The units are being created and the ability is being given to them, but they are not casting it and not dealing any damage.

Anyone know what the hell is going on? :p

Sorry for my phail JASSage.
 

Tom Jones

N/A
Reaction score
437
Make sure to null all locals that are not of the following type:
integer, real, string, boolean, code, player.

As to why the spell isn't cast, have a look at your dummy ability (A00J) and make sure everything is as it should be.
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
The dummy ability is literally identical to the one that works, but with a different raw code. =\

Thanks for the local advice :p.
 
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