Need help with this Module OnHeartbeat event script. I can’t figure out how to make it index to the next day with the check.
void rs_DoFatigue(object oTarget)
{
effect eCon = EffectAbilityDecrease(ABILITY_CONSTITUTION, 1);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
effect eLink = EffectLinkEffects(eCon, eDur);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oTarget);
}
void main()
{
object oPC = GetFirstPC();
//Check for time lapse since last rest - if more than 24 hours, fatigue them
int nLastRest = GetLocalInt(oPC, "LAST_RESTED");
if ( (GetTimeHour() - nLastRest) > 24 )
{
FloatingTextStringOnCreature("I should rest.", oPC);
rs_DoFatigue(oPC);
}
}
I know this code doesn’t work because the value of GetTimeHour() - which is stored on the PC in the OnPlayerRest script is 0-23.