generated from Jaysyn/ModuleTemplate
93 lines
5.1 KiB
Plaintext
93 lines
5.1 KiB
Plaintext
// Barmaid NWScript based on David Gaider of BioWare's script
|
|
void main()
|
|
{
|
|
int nUser = GetUserDefinedEventNumber();
|
|
int nPatron; //This number should be approx number of NPC patrons
|
|
object oCustomer;
|
|
object oBar = GetWaypointByTag("WP_Bar"); //This waypoint is where she gets drinks from
|
|
object oBar2 = GetWaypointByTag("WP_Bar2"); //This waypoint she returns to rest after delivering drinks
|
|
int iTimesAroundBar, iMaxTimes;
|
|
iMaxTimes=5;
|
|
|
|
//ActionSpeakString("Fire script: Barmaid State =" + IntToString(GetLocalInt(OBJECT_SELF, "BARMAID_STATE")));
|
|
|
|
if (nUser == 7000 && GetLocalInt(OBJECT_SELF, "BARMAID_STATE")==0) //
|
|
{
|
|
SetLocalInt(OBJECT_SELF,"BARMAID_STATE",1);
|
|
//ActionSpeakString("BARMAID STATE=1.. inloop");
|
|
|
|
for(iTimesAroundBar=0;iTimesAroundBar<iMaxTimes;iTimesAroundBar++) {
|
|
nPatron=d4();
|
|
//ActionSpeakString("Patron " + IntToString(nPatron));
|
|
oCustomer = GetNearestObjectByTag("CF_PATRON", OBJECT_SELF, nPatron);
|
|
|
|
if (GetIsObjectValid(oCustomer) )
|
|
{
|
|
|
|
// Move to Customer and ask what he/she wants
|
|
ActionMoveToObject(oCustomer);
|
|
switch(d4()) {
|
|
case 1:
|
|
ActionSpeakString ("Can I get you something?");
|
|
break;
|
|
case 2:
|
|
ActionSpeakString ("What'll it be?");
|
|
break;
|
|
case 3:
|
|
ActionSpeakString ("Some refreshment for you and your friends?");
|
|
break;
|
|
case 4:
|
|
ActionSpeakString ("Another round?");
|
|
break;
|
|
} //
|
|
|
|
ActionWait(5.0); //Wait 5 secs.
|
|
// Move to the Bar to get the Drinks
|
|
ActionMoveToObject(oBar);
|
|
switch(d4()) {
|
|
case 1:
|
|
ActionSpeakString ("An IronTail Ale");
|
|
break;
|
|
case 2:
|
|
ActionSpeakString ("A Bloody Bugbear.. and leave the hair on it!");
|
|
break;
|
|
case 3:
|
|
ActionSpeakString ("Two grogs.. and a... wait I can't read this");
|
|
break;
|
|
case 4:
|
|
ActionSpeakString ("3 meads..");
|
|
break;
|
|
}
|
|
ActionWait(6.0);
|
|
// Move back to the customer and give him/her the drinks
|
|
if (GetIsObjectValid(oCustomer)) {
|
|
ActionMoveToObject (oCustomer);
|
|
switch(Random(4)) {
|
|
case 0:
|
|
ActionSpeakString ("Enjoy.");
|
|
break;
|
|
case 1:
|
|
ActionSpeakString ("That'll be 5 platinum. I'm just kidding. 15 copper, please.");
|
|
break;
|
|
case 2:
|
|
ActionSpeakString ("You look like you could use this.");
|
|
break;
|
|
case 3:
|
|
ActionSpeakString ("That's 2 silvers hun");
|
|
break;
|
|
}
|
|
}
|
|
ActionWait(4.0);
|
|
} // !GetIsObject
|
|
} //forloop
|
|
SetLocalInt(OBJECT_SELF, "BARMAID_STATE",0);
|
|
}
|
|
|
|
if (nUser == 1004) // this is the OnDialogue event
|
|
{
|
|
// This is just in here so you can interrupt her if you want to talk to her
|
|
SetLocalObject (OBJECT_SELF, "CUSTOMER", OBJECT_INVALID);
|
|
SetLocalInt (OBJECT_SELF, "BARMAID_STATE", 0);
|
|
}
|
|
}
|