One other possible option woud be to do a recursive script that adds time to an int variable on the PC until they move (location changes). Might not be the best solution but it works:
void ActionTimerCheck(object oPC, location lCheck)
{
int iMedTime = GetLocalInt(oPC, "MEDITATE_TIME");
SetLocalInt(oPC, "MEDITATE_TIME", iMedTime + 1);
//SendMessageToPC(oPC, "1 second meditation time has been added.");
location lCurrent = GetLocation(oPC);
if (lCurrent == lCheck)
DelayCommand(1.0, ActionTimerCheck(oPC, lCheck));
}
void main()
{
object oPC = GetLastUsedBy();
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_MEDITATE, 1.0, 10000.0));
DelayCommand(3.0, ActionTimerCheck(oPC, GetLocation(oPC)));
}
P.S. This script would be for the OnUsed event of an object. Then later when you need to check how long they were meditating you would just do a: GetLocalInt(oPC, "MEDITATE_TIME");
Modifié par GhostOfGod, 16 avril 2012 - 09:39 .