- Joined
- Mar 9, 2023
- Messages
- 75
[SOLVED]
Hi! I dip my toes more in jass but I can't put all my thoughts into action. How can I save the triggering unit across all functions of the trigger? Hashtable? Save as a global? Take UnitId? What and how? It's triggered by an item (event is elsewhere). Local for the functions triggered by the timers obviously don't work.
Edit: it's for an item in a hero-map, so each hero is able to buy this item. Each hero is saved in a unit array.
Hi! I dip my toes more in jass but I can't put all my thoughts into action. How can I save the triggering unit across all functions of the trigger? Hashtable? Save as a global? Take UnitId? What and how? It's triggered by an item (event is elsewhere). Local for the functions triggered by the timers obviously don't work.
JASS:
function Trig_Heartmender_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call SetUnitLifePercentBJ( u, 30.00 )
call AddSpecialEffectTargetUnitBJ( "origin", u, "Holy Light.mdx" )
call SetUnitInvulnerable( u, true )
call UnitAddAbility(u,'A09C')
call UnitMakeAbilityPermanent(u, true, 'A09C')
set u = null
endfunction
function Invu takes nothing returns nothing ///It cant find trigger unit
local unit u = GetTriggerUnit()
call SetUnitInvulnerable(u, false )
set u = null
endfunction
function CooldownOver takes nothing returns nothing ///It cant find trigger unit
local unit u = GetTriggerUnit()
call UnitMakeAbilityPermanent(u, false, 'A09C')
call UnitRemoveAbility(u,'A09C')
set u = null
endfunction
function Heartmender_Timer takes nothing returns nothing
local timer a = CreateTimer()
local timer b = CreateTimer()
call TimerStart(a, 2.00, false, function Invu)
call TimerStart(b, 180.00, false, function CooldownOver)
set a = null
set b = null
endfunction
//===========================================================================
function InitTrig_Heartmender takes nothing returns nothing
set gg_trg_Heartmender = CreateTrigger( )
call TriggerAddAction( gg_trg_Heartmender, function Trig_Heartmender_Actions )
call TriggerAddAction( gg_trg_Heartmender, function Heartmender_Timer )
endfunction
Edit: it's for an item in a hero-map, so each hero is able to buy this item. Each hero is saved in a unit array.
Last edited: