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:
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?
Sorry for my phail JASSage.
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() == 039;A00H039;
endfunction
private function GroupAct takes nothing returns nothing
local location l = GetUnitLoc(GetTriggerUnit())
local unit u = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()), 039;n007039;, l, 270)
call UnitAddAbility(u, 039;A00I039;)
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() == 039;A00I039;
endfunction
private function GroupAct takes nothing returns nothing
local location l = GetUnitLoc(GetSpellTargetUnit())
local unit u = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()), 039;n007039;, l, 270)
call UnitAddAbility(u, 039;A00J039;)
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(), 039;A005039;) >= 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?
Sorry for my phail JASSage.