function Trig_Change_Data_Actions takes nothing returns nothing
local integer curData = LoadInteger(udg_HM_Hashtable,2,GetHandleId(udg_HM_Current_Unit))
//
if curData > 0 then
if udg_HM_Current_Unit != null then
if udg_HM_Change_Unit != null then
if udg_HM_Caster[curData] != udg_HM_Change_Unit then
set udg_HM_Caster[curData] = udg_HM_Change_Unit
else
debug call BJDebugMsg("Can't operate bars: Current unit fit with the unit unit want to transfer heath/mana bar >.<.")
endif
//
set udg_HM_Change_Unit = null
//
else
debug call BJDebugMsg("Can't operate bars: Did you add the unit you want to transfer heath/mana bar ?.")
endif
//
if udg_HM_Do_Changes then
//
if udg_HM_UnitSetScale > 0. then
set udg_HM_Scale[curData] = udg_HM_UnitSetScale
endif
//
set udg_HM_UnitSetScale = 0.
//
if udg_HM_ActiveHeathBar then
if udg_HM_LightningH[curData] != null then
debug call BJDebugMsg("Can't operate this action: HP bar already exist.")
else
set udg_HM_LightningH[curData] = AddLightning(udg_HP_MODEL,true,0.,0.,0.,0.)
set udg_HM_LightningFE[curData] = AddLightning(udg_HM_EMPTY_MODEL,true,0.,0.,0.,0.)
endif
elseif udg_HM_ActiveManaBar then
if udg_HM_LightningM[curData] != null then
debug call BJDebugMsg("Can't operate this action: MP bar already exist.")
else
set udg_HM_LightningM[curData] = AddLightning(udg_MN_MODEL,true,0.,0.,0.,0.)
set udg_HM_LightningSE[curData] = AddLightning(udg_HM_EMPTY_MODEL,true,0.,0.,0.,0.)
endif
endif
//
if not udg_HM_ActiveHeathBar then
if udg_HM_LightningH[curData] == null then
debug call BJDebugMsg("Can't operate this action: HP bar does not exist.")
else
call DestroyLightning(udg_HM_LightningH[curData])
call DestroyLightning(udg_HM_LightningFE[curData])
set udg_HM_LightningH[curData] = null
set udg_HM_LightningFE[curData] = null
endif
elseif not udg_HM_ActiveManaBar then
if udg_HM_LightningM[curData] == null then
debug call BJDebugMsg("Can't operate this action: MP bar does not exist.")
else
call DestroyLightning(udg_HM_LightningM[curData])
call DestroyLightning(udg_HM_LightningSE[curData])
set udg_HM_LightningM[curData] = null
set udg_HM_LightningSE[curData] = null
endif
endif
//
set udg_HM_ActiveHeathBar = false
set udg_HM_ActiveManaBar = false
endif
//
set udg_HM_Current_Unit = null
//
else
debug call BJDebugMsg("Can't operate bars: Did you add the current unit have heath/mana bar ?.")
endif
else
debug call BJDebugMsg("Can't operate bars: the unit does not exist.")
endif
//
endfunction
//===========================================================================
function InitTrig_Change_Data takes nothing returns nothing
set gg_trg_Change_Data = CreateTrigger( )
call TriggerAddAction( gg_trg_Change_Data, function Trig_Change_Data_Actions )
endfunction