- Joined
- Sep 9, 2009
- Messages
- 658
I made this trigger where if a unit enters a region, he gets healed to max health. The trigger checks if it's an allied unit and if it's current hp is lower than the max hp before the unit gets healed.
The problem is that he doesn't get healed. EVerything else works but he doesn't get healed.
The problem is that he doesn't get healed. EVerything else works but he doesn't get healed.
JASS:
scope Heal initializer Init
globals
private constant string sfx = "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl"
private constant string a = "origin"
endglobals
private function Heal_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call SetUnitAnimation( udg_AmalThazad, "spell" )
call DestroyEffect(AddSpecialEffectTarget(sfx, u, a))
call ForceCinematicSubtitles( true )
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), udg_AmalThazad, "TRIGSTR_050", null, "TRIGSTR_051", bj_TIMETYPE_ADD, 0, true )
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_MAX_LIFE))
call SetUnitAnimation( udg_AmalThazad, "stand" )
set u = null
endfunction
private function Heal_Conditions takes nothing returns boolean
if not IsUnitEnemy(GetTriggerUnit(), Player(0)) and GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) < GetUnitState(GetTriggerUnit(), UNIT_STATE_MAX_LIFE) then
call Heal_Actions()
endif
return false
endfunction
//===========================================================================
function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterEnterRectSimple( t, gg_rct_AmalThazad )
call TriggerAddCondition(t, Condition(function Heal_Conditions))
set t = null
endfunction
endscope