- Joined
- Jun 26, 2020
- Messages
- 1,928
I made an ability called "Command" that when the hero damages a unit it gives an aura that increase %5 damage with each attack and desapear after 10 seconds of not attacking.
To do that I have a base ability and a ability to the aura (I use the trick of puting Y position -11, because I'm using 1.26) and add it that ability when is the first charge and remove it when there are not more charges, but for some reason when the hero dies with at least 1 charge the game crashes I think when passes the 10 seconds, but I wanna know if there is an special reason to that, I know the problem is related to the Aura ability because the ID apeared in the crashlog, here is the spell:
To do that I have a base ability and a ability to the aura (I use the trick of puting Y position -11, because I'm using 1.26) and add it that ability when is the first charge and remove it when there are not more charges, but for some reason when the hero dies with at least 1 charge the game crashes I think when passes the 10 seconds, but I wanna know if there is an special reason to that, I know the problem is related to the Aura ability because the ID apeared in the crashlog, here is the spell:
vJASS:
//'A08F' Base ability
//'A07W' Damage aura
function Trig_Command_Hero_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(udg_DamageEventSource,'A08F')>0
endfunction
function Trig_Command_Hero_Actions2 takes nothing returns nothing
local integer i=GetTimerData(GetExpiredTimer())
if udg_Command_descarga[i]>0 then
set udg_Command_descarga[i]=udg_Command_descarga[i]-1
else
if GetUnitAbilityLevel(udg_UDexUnits[i],'A07W')>1 then
call DecUnitAbilityLevel(udg_UDexUnits[i],'A07W')
else
call UnitRemoveAbility(udg_UDexUnits[i],'A07W')
call ReleaseTimer(GetExpiredTimer())
endif
endif
endfunction
function Trig_Command_Hero_Actions takes nothing returns nothing
local integer i=GetUnitUserData(udg_DamageEventSource)
set udg_Command_descarga[i]=10
if GetUnitAbilityLevel(udg_DamageEventSource,'A07W')==0 then
call UnitAddAbility(udg_DamageEventSource,'A07W')
call TimerStart(NewTimerEx(i),1.00,true,function Trig_Command_Hero_Actions2)
else
if GetUnitAbilityLevel(udg_DamageEventSource,'A07W')<4*GetUnitAbilityLevel(udg_DamageEventSource,'A08F') then
call IncUnitAbilityLevel(udg_DamageEventSource,'A07W')
endif
endif
endfunction
//===========================================================================
function InitTrig_Command_Hero takes nothing returns nothing
set gg_trg_Command_Hero=CreateTrigger()
call TriggerRegisterVariableEvent(gg_trg_Command_Hero,"udg_DamageEvent",EQUAL,1.00)
call TriggerAddCondition(gg_trg_Command_Hero,Condition(function Trig_Command_Hero_Conditions))
call TriggerAddAction(gg_trg_Command_Hero,function Trig_Command_Hero_Actions)
endfunction