Heloes Hive Workshop
I have a problem with my code:
The upper function is no matter, it works. But about the middle one - the DestroyTrigger causes the upper function to not work (as the trigger is destroyed). When I tried TriggerSleepAction, it simply turned wc3 off for some reason.
Any ideas how to make it work?
(The "tak" massages are debug massages)
I have a problem with my code:
JASS:
function dostal_f takes nothing returns nothing
local unit cel = GetTriggerUnit()
local unit atak = GetEventDamageSource()
local integer nr = GetConvertedPlayerId(GetOwningPlayer(atak))
call DisplayTextToForce(GetPlayersAll(), "ta")
if (GetUnitAbilityLevel(atak, 'A020') == 1) and (UnitHasBuffBJ(cel, 'B001') and GetUnitAbilityLevel(atak, 'A000') == 1) then
call UnitRemoveAbility(atak, 'A020')
endif
if IsUnitType(atak, UNIT_TYPE_SUMMONED) then
call DisplayTextToForce(GetPlayersAll(), "tak")
if GetUnitAbilityLevel(udg_Bohater_gracza[nr], 'A024') == 1 then
call DisplayTextToForce(GetPlayersAll(), "takk")
call UnitDamageTargetBJ(atak, cel, obrmag(nr, udg_Bohater_gracza[nr], 0.3), ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL)
endif
endif
set cel = null
set atak = null
endfunction
function Trig_Strzal_Actions takes nothing returns nothing
local trigger dostal = CreateTrigger()
local unit cel = GetTriggerUnit()
call DisplayTextToForce(GetPlayersAll(), "t")
call TriggerRegisterUnitEvent(dostal, cel, EVENT_UNIT_DAMAGED)
call TriggerAddAction(dostal, function dostal_f)
call DestroyTrigger(dostal)
set cel = null
set dostal = null
endfunction
//===========================================================================
function InitTrig_DMG takes nothing returns nothing
set gg_trg_DMG = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_DMG, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( gg_trg_DMG, function Trig_Strzal_Actions )
endfunction
The upper function is no matter, it works. But about the middle one - the DestroyTrigger causes the upper function to not work (as the trigger is destroyed). When I tried TriggerSleepAction, it simply turned wc3 off for some reason.
Any ideas how to make it work?
(The "tak" massages are debug massages)