Faust
You can change this now in User CP.
- Reaction score
- 123
JASS:
scope StormStrike initializer I
private struct StormStrike
real damage
unit attacker
trigger t
unit target
timer clock = CreateTimer()
group damaged = CreateGroup()
method onDestroy takes nothing returns nothing
call DestroyGroup(.damaged)
call PauseTimer(.clock)
call ClearTimerStructA(.clock)
call DestroyTimer(.clock)
endmethod
endstruct
private function C takes nothing returns boolean
return GetUnitAbilityLevel(GetEventDamageSource(), 039;A01I039;) > 0
endfunction
private function H takes nothing returns nothing
local StormStrike dat = GetTimerStructA(GetExpiredTimer())
local group g = CreateGroup()
local unit u
set udg_Player = GetOwningPlayer(dat.attacker)
call GroupEnumUnitsInRange(g, GetUnitX(dat.target), GetUnitY(dat.target), 200, Condition(function IsUnitAnEnemy))
set u = FirstOfGroup(g)
if IsUnitInGroup(u, dat.damaged) != true then
call GroupAddUnit(dat.damaged, u)
call BJDebugMsg(GetUnitName(dat.target) + " is damaged for " + R2S(dat.damage))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Charm\\CharmTarget.mdl", u, "chest"))
call DisableTrigger(dat.t)
call UnitDamageTarget(dat.attacker, dat.target, dat.damage, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call EnableTrigger(dat.t)
endif
if dat.target == null then
call BJDebugMsg("ended")
call dat.destroy()
endif
set dat.target = u
call DestroyGroup(g)
set g = null
set u = null
endfunction
private function A takes nothing returns nothing
local StormStrike dat = StormStrike.create()
set dat.attacker = GetEventDamageSource()
set dat.target = GetTriggerUnit()
set dat.damage = GetEventDamage()
set dat.t = GetTriggeringTrigger()
call SetTimerStructA(dat.clock, dat)
call TimerStart(dat.clock, 0.01, true, function H)
endfunction
//===========================================================================
private function I takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitDamaged(t)
call TriggerAddCondition(t, Condition(function C))
call TriggerAddAction(t, function A)
endfunction
endscope
This I can't quite explain.
This is for a passive ability, it should act somewhat similar to any cleaving attack, except it is delayed, and only effects one unit at a time.
So you damage unit A, and there is a unit B nearby, to whom close there is unit C.
The damage is dealt to unit A again, and then to B once, and then to C once.
Like: <Damaged for 50 hp> -> A takes the 50 damage -> pause -> A takes it once again (for the total of 100) -> pause -> B takes it once (50) -> pause -> C takes it once -> if no more units nearby who have not been hit, the link breaks.
I added a pretty visible effect for testing, and I can safely say it's messed up.
There are PLENTY of units nearby, yet it always only effects the unit that was damaged by the hero's attack. It keeps up for a few minute, then I do something or noting at all, and the creeps a lot farther get the effect and damage several times (you can tell it from the thickness of the effect).
So what did I mess up and how to fix it? Thanks in advance!