//:://///////////////////////////////////////////// //:: Custom User Defined Event //:: FileName: watchman_ud //::////////////////////////////////////////////// /* This is the userdefined script for a night watchman with his hourly calls from eight o'clock at night till five o'clock in the morning telling the citizens that "all's well". The equip torch at dusk/night i got from Brand */ //::////////////////////////////////////////////// //:: Created By: Ayath The Loafer //:: Created On: October 24th 2002 //::////////////////////////////////////////////// void main() { string S1="Hark! ye neighbors, and hear me tell:"; string S2=" now sounds on the belfry bell!"; string S3="It's "; string S4=" o'clock and all's well."; int nUser = GetUserDefinedEventNumber(); if(nUser == 1001) //HEARTBEAT { if(GetIsNight() || GetIsDusk()) { /* You need to have a torch as first item i watchman's inventory */ object oLeftHand = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, OBJECT_SELF); if (oLeftHand == OBJECT_INVALID) { object oTorch = GetFirstItemInInventory(); ActionEquipItem(oTorch, INVENTORY_SLOT_LEFTHAND); } } if(GetIsDay() || GetIsDawn()) { object oLeftHand = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, OBJECT_SELF); if (oLeftHand != OBJECT_INVALID) { ActionUnequipItem(oLeftHand); } } if (GetIsNight() || GetIsDusk()) { int nHour = GetTimeHour(); //Purely for testing purposes //SpeakString(IntToString(nHour)); if (nHour==20 && GetLocalInt(OBJECT_SELF,"Called_Time")!=nHour) { DelayCommand(0.2,SpeakString(S1)); DelayCommand(4.0,SpeakString("Eight"+S2)); DelayCommand(8.0,SpeakString(S3+"eight"+S4)); SetLocalInt(OBJECT_SELF,"Called_Time",20); } if (nHour==21 && GetLocalInt(OBJECT_SELF,"Called_Time")!=nHour) { DelayCommand(0.2,SpeakString(S1)); DelayCommand(4.0,SpeakString("Nine"+S2)); DelayCommand(8.0,SpeakString(S3+"nine"+S4)); SetLocalInt(OBJECT_SELF,"Called_Time",21); } if (nHour==22 && GetLocalInt(OBJECT_SELF,"Called_Time")!=nHour) { DelayCommand(0.2,SpeakString(S1)); DelayCommand(4.0,SpeakString("Ten"+S2)); DelayCommand(8.0,SpeakString(S3+"ten"+S4)); SetLocalInt(OBJECT_SELF,"Called_Time",22); } if (nHour==23 && GetLocalInt(OBJECT_SELF,"Called_Time")!=nHour) { DelayCommand(0.2,SpeakString(S1)); DelayCommand(4.0,SpeakString("Eleven"+S2)); DelayCommand(8.0,SpeakString(S3+"eleven"+S4)); SetLocalInt(OBJECT_SELF,"Called_Time",23); } if (nHour==0 && GetLocalInt(OBJECT_SELF,"Called_Time")!=nHour) { DelayCommand(0.2,SpeakString(S1)); DelayCommand(4.0,SpeakString("Twelve"+S2)); DelayCommand(8.0,SpeakString(S3+"twelve"+S4)); SetLocalInt(OBJECT_SELF,"Called_Time",0); } if (nHour==1 && GetLocalInt(OBJECT_SELF,"Called_Time")!=nHour) { DelayCommand(0.2,SpeakString(S1)); DelayCommand(4.0,SpeakString("One"+S2)); DelayCommand(8.0,SpeakString(S3+"one"+S4)); SetLocalInt(OBJECT_SELF,"Called_Time",1); } if (nHour==2 && GetLocalInt(OBJECT_SELF,"Called_Time")!=nHour) { DelayCommand(0.2,SpeakString(S1)); DelayCommand(4.0,SpeakString("Two"+S2)); DelayCommand(8.0,SpeakString(S3+"two"+S4)); SetLocalInt(OBJECT_SELF,"Called_Time",2); } if (nHour==3 && GetLocalInt(OBJECT_SELF,"Called_Time")!=nHour) { DelayCommand(0.2,SpeakString(S1)); DelayCommand(4.0,SpeakString("Three"+S2)); DelayCommand(8.0,SpeakString(S3+"three"+S4)); SetLocalInt(OBJECT_SELF,"Called_Time",3); } if (nHour==4 && GetLocalInt(OBJECT_SELF,"Called_Time")!=nHour) { DelayCommand(0.2,SpeakString(S1)); DelayCommand(4.0,SpeakString("Four"+S2)); DelayCommand(8.0,SpeakString(S3+"four"+S4)); SetLocalInt(OBJECT_SELF,"Called_Time",4); } if (nHour==5 && GetLocalInt(OBJECT_SELF,"Called_Time")!=nHour) { DelayCommand(0.2,SpeakString("Up now! Awake! nor slumber on; The morn approaches, night is gone.")); DelayCommand(7.0,SpeakString("Thank the mighty Gods, who have watched and kept us through the night.")); DelayCommand(15.0,SpeakString("Rouse to the duties of the day, and serve faithfully all the way.")); SetLocalInt(OBJECT_SELF,"Called_Time",5); } } } else if(nUser == 1002) // PERCEIVE { object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN); object oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC); if(oItem != OBJECT_INVALID) { SpeakString("Please sheath your weapon. You have no use of it in town."); } } else if(nUser == 1003) // END OF COMBAT { } else if(nUser == 1004) // ON DIALOGUE { } else if(nUser == 1005) // ATTACKED { } else if(nUser == 1006) // DAMAGED { } else if(nUser == 1007) // DEATH { } else if(nUser == 1008) // DISTURBED { } }