Bienvenue sur JeuxOnLine - MMO, MMORPG et MOBA !
Les sites de JeuxOnLine...
 

Panneau de contrôle

Recherche | Retour aux forums

JOL Archives

Impossible de mettre ce script en place

Par Adau le 13/2/2003 à 20:42:15 (#3232924)

Impossible de mettre ce script en place et pourtant ca n'a pas l'air bien dur. (ne faites pas gaffe à l'allemand, j'ai pas encore traduit)

void Debug(string sMessage);
void main()
{
// ::///////////////////////////////////////////////
// :: Name: Waitress Script
// :: Version: .1
// :: FileName: _waitress
// :: Copyright (c) 2002 Lands of Kray
// :://////////////////////////////////////////////
/*
Used to have a waitress walking around the
tavern doing drink orders and the like.
Background noise so created to use as little
CPU as possible.

Requires Customers in the bar with the tag
Customer.

Requires Waypoints for Offduty and Bartender
so she/he can travel between those points between
delivery items to the customers.

*/


// Begin Customization *****************************

string CustomerTag = "Customer"; // Tag of customers in the bar
string BartenderTag = "WP_Common_Bar"; // Where we pick drinks
string OffdutyTag = "WP_Common_Rest"; // Where we go when we're not delivering

// End Customization *******************************

// :://////////////////////////////////////////////
// :: Created By: Dennis Dollins
// :: Created On: 07/05/2002
// :: Modified: 20-Sep-2002, Carsten Pluntke
// :: - Translation
// :: - Relocated customization
// :://////////////////////////////////////////////
int nUser = GetUserDefinedEventNumber();

if(nUser == 1001) // Heartbeat Event
{




/*This line is used to keep it down to 1 heartbeat
in 12 and only if we're not busy aka State = 0*/
int Counter = GetLocalInt(OBJECT_SELF,"Counter");
if (GetLocalInt(OBJECT_SELF,"State")==1)
{
Counter++;
if (Counter>=8)
{
// Debug("Count's too high, resetting");
ClearAllActions();
SetLocalInt(OBJECT_SELF,"State",0);
ActionForceMoveToObject(GetObjectByTag(OffdutyTag),FALSE,1.0,15.0);
Counter = 0;
}
SetLocalInt(OBJECT_SELF,"Counter",Counter);
}
if ((d8()==1)&&(GetLocalInt(OBJECT_SELF,"State")!=1))
{
// Debug("Starting Delivery");
ClearAllActions();
SetLocalInt(OBJECT_SELF,"State",1); // We're working over here.
// Begin Constant Declarations *********************
object Bartender = GetObjectByTag(BartenderTag);
object Offduty = GetObjectByTag(OffdutyTag);
object NPC;
object Waitress = OBJECT_SELF;
int CustomerCount=0;
int RandomCustomer;
int RandomNumber;
string Charge;
// End Declarations ********************************

// Begin code **************************************


/*Count the customers in the bar. Requires the npcs
tag to match the string CustomerTag as set in the
customization area. This is what I would call the
hard way but the most accurate.*/

NPC = GetFirstObjectInArea();//Seems to be required
do
{
if (GetTag(NPC)==CustomerTag)
{
CustomerCount++;
}
NPC = GetNextObjectInArea();
}
while (NPC!=OBJECT_INVALID);
// Debug("Customer count is "+IntToString(CustomerCount));
if (CustomerCount>=1)
{
// Pick a customer at random, avoiding the last guy we served
// do
// {
RandomCustomer = Random(CustomerCount);
RandomCustomer++; // Avoid using customer zero
// }
// while (RandomCustomer!=GetLocalInt(OBJECT_SELF,"LastCustomer"));
// SetLocalInt(OBJECT_SELF,"LastCustomer",RandomCustomer);

// Have the random customer say something. We avoid a lot of
// code by having the waitress object do everything this way.
NPC = GetNearestObjectByTag(CustomerTag,OBJECT_SELF,RandomCustomer);
// Debug ("Customer is "+IntToString(RandomCustomer)+" and his ID is "+ObjectToString(NPC));
if (NPC!=OBJECT_INVALID)
{
ActionDoCommand(AssignCommand(NPC,ActionPlayAnimation(ANIMATION_LOOPING_TALK_FORCEFUL,1.0,2.0)));

switch (d8())
{
case 1:
ActionDoCommand(AssignCommand(NPC,SpeakString("Noch'n Ale hier!")));
break;
case 2:
ActionDoCommand(AssignCommand(NPC,SpeakString("Weib, noch 'ne Runde!")));
break;
case 3:
ActionDoCommand(AssignCommand(NPC,SpeakString("Noch 'ne Runde!")));
break;
case 4:
ActionDoCommand(AssignCommand(NPC,SpeakString("Mehr Ale hier!")));
break;
case 5:
ActionDoCommand(AssignCommand(NPC,SpeakString("Noch'n Bier!")));
break;
case 6:
ActionDoCommand(AssignCommand(NPC,SpeakString("Die Kruege werden hier leer.")));
break;
case 7:
ActionDoCommand(AssignCommand(NPC,SpeakString("Wir sind bald auf'm Trocknen!")));
break;
case 8:
ActionDoCommand(AssignCommand(NPC,SpeakString("Uns noch 'ne Runde.")));
break;
}
// Let's pause a second or two to notice it.
ActionWait(4.0);
// Pick response at random
ActionDoCommand(SetFacingPoint(GetPosition(NPC)));
ActionPlayAnimation(ANIMATION_LOOPING_TALK_NORMAL,1.0,2.0);

switch (d8())
{
case 1:
ActionSpeakString("Unterwegs.");
break;
case 2:
ActionSpeakString("Macht nicht so ein Wind.");
break;
case 3:
ActionSpeakString("Bin gleich da.");
break;
case 4:
ActionSpeakString("Eine Sekunde noch.");
break;
case 5:
ActionSpeakString("Auf dem Weg.");
break;
case 6:
ActionSpeakString("Ich komme schon.");
break;
case 7:
ActionSpeakString("Ich hoere Euch!");
break;
case 8:
ActionSpeakString("Was darf's denn sein?");
PlaySound("as_pl_tavbarf2");
break;
}
ActionMoveToObject(Bartender);
ActionPlayAnimation(ANIMATION_LOOPING_TALK_NORMAL,1.0,2.0);
switch (d8())
{
case 1:
ActionSpeakString("Ein Krug Met.");
Charge = " zwei Muenzen.";
break;
case 2:
ActionSpeakString("Ale fuer Tisch "+IntToString(d6())+".");
Charge = " eine Muenze.";
break;
case 3:
ActionSpeakString("Duennbier.");
Charge = " eine Muenze.";
break;
case 4:
ActionSpeakString("Mehr Bitter.");
Charge = " zwei Muenzen.";
break;
case 5:
ActionSpeakString("Eine Flasche von dem Roten.");
Charge = " vier Muenzen.";
break;
case 6:
ActionSpeakString("Eine Karaffe von dem Goldenen.");
Charge = " acht Muenzen.";
break;
case 7:
ActionSpeakString("Eine Karaffe von dem Dunklem.");
Charge = " zwei Muenzen.";
break;
case 8:
ActionSpeakString("Den Rachenputzer Spezial.");
Charge = " sechs Muenzen.";
break;
}
ActionWait(5.0);
NPC = GetNearestObjectByTag(CustomerTag,OBJECT_SELF,RandomCustomer);
if (NPC!=OBJECT_INVALID)
{
ActionMoveToObject(NPC);
// ActionMoveToLocation(GetLocation(NPC));
// ActionMoveToObject(NPC; // Just in case they get stopped on the way
ActionPlayAnimation(ANIMATION_LOOPING_TALK_NORMAL,1.0,2.0);
switch (d6())
{
case 1:
ActionSpeakString("Das macht"+Charge);
break;
case 2:
ActionSpeakString("Ihre Drinks, bitteschoen.");
PlaySound("as_pl_tavbarf1");
ActionSpeakString("Das macht"+Charge);
break;
case 3:
ActionSpeakString("Ich brauche"+Charge);
break;
case 4:
ActionSpeakString("Kostet Euch"+Charge);
break;
case 5:
ActionSpeakString("Ich brauche"+Charge);
break;
case 6:
ActionSpeakString("Das sind"+Charge);
break;
}
ActionWait(1.0);
// ActionMoveToObject(GetWaypointByTag(Offduty));
ActionDoCommand(AssignCommand(NPC,SetFacingPoint(GetPosition(Waitress))));

switch (d6())
{
case 1:
ActionDoCommand(AssignCommand(NPC,SpeakString("Hier.")));
break;
case 2:
ActionDoCommand(AssignCommand(NPC,SpeakString("Bitte.")));
break;
case 3:
ActionDoCommand(AssignCommand(NPC,SpeakString("Rest fuer Euch.")));
break;
case 4:
ActionDoCommand(AssignCommand(NPC,SpeakString("Rest fuer Euch.")));
ActionSpeakString("Oh, vielen Dank!");
break;
case 5:
ActionDoCommand(AssignCommand(NPC,SpeakString("Da.")));
break;
case 6:
ActionDoCommand(AssignCommand(NPC,SpeakString("Da, bitte.")));
break;
}
ActionDoCommand(AssignCommand(NPC,ActionWait(4.0)));
ActionDoCommand(SetFacing(GetFacing(GetNearestObject(OBJECT_TYPE_WAYPOINT))));
ActionWait(5.0);
}
ActionMoveToObject(Offduty);
// ActionMoveToLocation(GetLocation(GetWaypointByTag(Offduty))); // Just in case they get stopped on they way.
ActionDoCommand(SetLocalInt(OBJECT_SELF,"State",0));//Okay we're ready to take orders again.

// End code ****************************************

}
}
}
}
}

/*
Debug function, used to send messages to DM's
*/

void Debug(string sMessage)
{
SendMessageToAllDMs(sMessage);
}


Script pour que la/les serveuse(s)/serveur(s) se bougent les fesses et aillent voir les clients, et leur remettant ensuite leur commande.
j'ai bien suivit ce que disait les commentaires du script (tag des clients, tag des Waypoint, et... et c'est tout, apparement y'a rien d'autre à faire)
alors je suis pas bete au point de n'avoir pas fait concorder les tags (j'ai quand meme verifié, on sait jamais:ange: ) mais rien à faire, cette serveuse ne bouge pas ses fesses !
franchement... elle voudrait en plus que je la paye tout les mois ?:rolleyes:

Par Adau le 13/2/2003 à 22:44:00 (#3233708)

*Probleme resolu... excusez-moi*

Par Cheni Poussière le 13/2/2003 à 23:05:53 (#3233814)

Bah c'est en parlant tout seul qu'on résout 97% des problèmes de scripts ;)

JOL Archives 1.0.1
@ JOL / JeuxOnLine