| Author: | Archeious |
| Author Website: | n/a |
| Script Name: | NPC Cook |
| Description: | This script drives a cook. |
| Instructions on Use: | You need a few things.
The Cook will wander the kitchen doing various tasks until the INN_Cook_Job variable is set then she will start that task. In the example you could have the Bartender's conversation script ask what the player wants to eat. Then SetLocalInt( GetObjectByTag( "INN_Cook" ),"INN_Cook_Job,3); and SetLocalString( GetObjectByTag( "INN_Cook" ),"INN_Cook_Job_Name,"Blue Plate Special"); on the next OnHeartbeat she starts making it. |
Script 1:
| void main() { int nCurrentJob=GetLocalInt(OBJECT_SELF,"INN_Cook_Job"); object oWaypoint; object oChair; if ( (GetLocalInt(OBJECT_SELF,"INN_Cook_Busy") > 1) && (GetLocalInt(OBJECT_SELF,"INN_Cook_Job") != 0) ) { SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",0); } if (GetLocalInt(OBJECT_SELF,"INN_Cook_Busy") == 0) { switch (nCurrentJob) { case 1: break; case 2: break; case 3: SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",1); ClearAllActions(); ActionSpeakString("One " + GetLocalString(OBJECT_SELF,"INN_Cook_Job_Name") + " coming up."); ActionMoveToObject(GetWaypointByTag("INN_KitchenPrepTable")); ActionWait(2.0); ActionSpeakString("I need some flour...."); ActionMoveToObject(GetWaypointByTag("INN_KitchenItems3")); ActionWait(1.0); ActionMoveToObject(GetWaypointByTag("INN_KitchenPrepTable")); ActionWait(3.0); ActionSpeakString("and some eggs..."); ActionMoveToObject(GetWaypointByTag("INN_KitchenItems1")); ActionWait(1.0); ActionMoveToObject(GetWaypointByTag("INN_KitchenPrepTable")); ActionWait(2.0); ActionSpeakString("can't foget the main item..."); ActionMoveToObject(GetWaypointByTag("INN_KitchenItems2")); ActionWait(1.0); ActionMoveToObject(GetWaypointByTag("INN_KitchenPrepTable")); ActionWait(5.0); ActionSpeakString("now for the oven..."); ActionMoveToObject(GetWaypointByTag("INN_KitchenOven")); ActionWait(1.0); ActionMoveToObject(GetWaypointByTag("INN_KitchenPickup")); ActionSpeakString(GetLocalString(OBJECT_SELF,"INN_Cook_Job_Name") + " is done"); ActionDoCommand(SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",0)); ActionDoCommand(SetLocalInt(OBJECT_SELF,"INN_Cook_Job",0)); break; default: switch (d6()) { case 1: SpeakString("I hate clean up this dump."); break; case 2: SpeakString("la de da, la de do..."); break; case 3: SpeakString("All " + GetName(GetObjectByTag("INN_Bartender")) + " ever wants me to do is cook, cook, cook!"); break; default: break; } switch (d6()) { case 1: ClearAllActions(); SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",2); if (d4() == 1) { ActionSpeakString("I think I will take a break"); } oChair = GetObjectByTag("INN_KitchenChair"); ActionSit(oChair); ActionWait(5+IntToFloat(d4())); ActionDoCommand(SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",0)); ClearAllActions(); break; case 2: ClearAllActions(); SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",2); oWaypoint= GetWaypointByTag("INN_KitchenItems1"); ActionMoveToObject(oWaypoint); ActionWait(IntToFloat(d4())); ActionDoCommand(SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",0)); break; case 3: ClearAllActions(); SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",2); oWaypoint= GetWaypointByTag("INN_KitchenItems2"); ActionMoveToObject(oWaypoint); ActionWait(IntToFloat(d4())); ActionDoCommand(SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",0)); break; case 4: ClearAllActions(); SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",2); oWaypoint= GetWaypointByTag("INN_KitchenItems3"); ActionMoveToObject(oWaypoint); ActionWait(IntToFloat(d4())); ActionDoCommand(SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",0)); break; case 5: ClearAllActions(); SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",2); oWaypoint= GetWaypointByTag("INN_KitchenOven"); ActionMoveToObject(oWaypoint); ActionWait(IntToFloat(d4())); ActionDoCommand(SetLocalInt(OBJECT_SELF,"INN_Cook_Busy",0)); break; } break; } } } |