Hi all. A while ago I used this script Tchos provided me.
#include "ginc_param_const"
int CSLTimeStamp()
{
int iYear = GetCalendarYear();
int iMonth = GetCalendarMonth();
int iDay = GetCalendarDay();
int iHour = GetTimeHour();
return (iYear)*12*28*24 + (iMonth-1)*28*24 + (iDay-1)*24 + iHour;
}
void main(string sTimerName, string sTarget)
{
object oTarg = GetTarget(sTarget, TARGET_OBJECT_SELF);
int iHour = CSLTimeStamp();
SetLocalInt(oTarg, sTimerName, iHour);
}
Well, I understand the logic of what the script does. But here’s what I want to do.
Node 1: NPC
PC answers, timer starts with the above script.
If 7 days have not gone by, the NPC will have nothing to say to the PC. After 7 days, he will talk Node 1 again. So basically I want a re-occuring dialogue every 7 days. Question is, would I be able to do this with one NPC node and PC responses?
So far I have the above script on the PC responses, and the below one on the NPC node with a NOT, where the NPC says sorry, not enough time has gone by.
///////////////////////////////////////////////////////////////////////////////////////////
//
// gc_timer_check
// by Tchos, 2013-07
//
// Use this in a conversation to check how many hours have passed since you marked
// the beginning using ga_timer_begin. You can use the same <, >, and ! comparison
// symbols in the sCheck field, as in the gc_local_int or gc_journal_entry scripts.
//
///////////////////////////////////////////////////////////////////////////////////////////
#include "ginc_var_ops"
#include "ginc_param_const"
int CSLTimeStamp()
{
int iYear = GetCalendarYear();
int iMonth = GetCalendarMonth();
int iDay = GetCalendarDay();
int iHour = GetTimeHour();
return (iYear)*12*28*24 + (iMonth-1)*28*24 + (iDay-1)*24 + iHour;
}
int StartingConditional(string sTimerName, string sCheck, string sTarget)
{
object oTarg = GetTarget(sTarget, TARGET_OBJECT_SELF);
int iStartHour = GetLocalInt(oTarg, sTimerName);
int iCurrentHour = CSLTimeStamp();
int iHoursPassed = iCurrentHour-iStartHour;
int iRet = CompareInts(iHoursPassed, sCheck);
return (iRet);
}
I hope the question makes sense .
edit:
The simplified question would be, if 7 days have already gone by, how would one reset it to 0? Does it suffice to just use the first script above?