Hooking into failure to rest?
GTB
Member Posts: 2
Is there a way to run a script on failure to rest? I'd like to explain to the player -why- there is no rest allowed in specific areas when they hit the rest button and find out they can't, either with a speak string or via an npc.
0
Comments
void main(){
object oPC = GetLastPCRested();
if (!GetIsPC(oPC)) return;
object oArea = GetArea(oPC);
switch(GetLastRestEventType())
{case REST_EVENTTYPE_REST_STARTED:
// Put your norest condition here ie
{int iNOREST = GetLocalInt(oArea, "NOREST");
// or whatever you are using to determine resting condition
if (iNOREST == TRUE) AssignCommand(oPC, ClearAllActions());
break;}
case REST_EVENTTYPE_REST_CANCELLED:
{SendMessageToPC(oPC, "No rest explanation.");
// or - FloatingTextStringOnCreature("No rest explanation.", oPC);
break;}
}
}
Best to ya,
DJ_WoW
Edit: Yep, that works perfectly. Thanks!