For my game, I made this script. I hope you go well.
1 minutes of play is equal to 1 hour of real time.
At hours 2 if hunger is equal to 5, the player loses 50 of health.
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Time of day/food/hunger
function miotimer_init(e)
hours=0;
food=0;
hunger=5; --if 5, is hungry
control=0;
StartTimer(e);--I reset the timer
end
function miotimer_main(e)
if GetTimer(e) > 60000 then
hours=hours+1;
StartTimer(e);--I reset the timer
end
if hours == 24 then
hours=1;
end
--Hunger
if hunger==5 and hours==2 then
if control==0 then
SetPlayerHealth(g_PlayerHealth-50);
control=1;
end
end
if hours==3 then
control=0;
end
Prompt("Are the "..hours.. " hours");
end
sorry for my bad English, I write from Italy.