private function periodic takes nothing returns boolean
local integer i = 0
local real hp
local real mana
loop
if menu[i].c != 0 and city[menu[i].c].p == Player(i) then
set hp = GetUnitState(city[menu[i].c].u, UNIT_STATE_LIFE)
set mana = GetUnitState(city[menu[i].c].u, UNIT_STATE_MANA)
if hp != menu[i].hp_cur then
call SetUnitState(menu[i].control, UNIT_STATE_LIFE, hp)
set menu[i].hp_cur = hp
endif
if mana != menu[i].mana_cur then
call SetUnitState(menu[i].control, UNIT_STATE_MANA, mana)
set menu[i].mana_cur = mana
endif
endif
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
return false
endfunction