BioWare Forums: View Post For Code Display


You are viewing a single post. Please do not take this post out of context.
Read the full topic: Post Working Scripts Here

Author Sticky: Post Working Scripts Here
FiannaTiger Posted: Wednesday, 26 June 02:46AM
Working Barmaid... can even be talked to and will resume with the code. This is for 5 Patrons. Just change the Rand from d4() to whatever and make sure to always keep the +1 or you will do a repeat customer like the origional one did in the world builders guide. (I.E. d6()+1 will work for 7 customers..)

void main()
{
// Set the variables
SetLocalInt(OBJECT_SELF, "PC_BOTHERED", 1);

}
In the last line of conversation.
NWScript:
void DrinkOrder();
void main()
{
    int nUser = GetUserDefinedEventNumber();
    object oBar = GetWaypointByTag("WG_Inn_Bartender_WP");
    object oPatron = GetLocalObject(OBJECT_SELF, "WG_Inn_Patron");
    object oBartender = GetObjectByTag("WG_Inn_Bartender");
    if(nUser == 1001) //HEARTBEAT
    {
        int nRand = d4()+1;
        if (GetLocalInt(OBJECT_SELF, "LASTCUST") == 1)
        {
            nRand = d4()+1;
            SetLocalInt(OBJECT_SELF, "LASTCUST", 0);
        }
        if(!GetIsObjectValid(oPatron) || GetLocalInt(OBJECT_SELF,"PC_BOTHERED") == 1)
        {
            if(GetLocalInt(OBJECT_SELF,"PC_BOTHERED") != 1)
                oPatron = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_NOT_PC, OBJECT_SELF, nRand);
            if(GetIsObjectValid(oPatron) && oPatron != OBJECT_SELF && oPatron != oBartender && !GetIsObjectValid(GetMaster(oPatron)))
            {
                switch(GetLocalInt(OBJECT_SELF, "BARMAID_STATE"))
                {
                case 0:
                case 1:
                    SetLocalInt(OBJECT_SELF, "LASTCUST", 1);
                    SetLocalInt(OBJECT_SELF, "BARMAID_STATE", 1);
                    SetLocalObject(OBJECT_SELF, "WG_Inn_Patron", oPatron);
                    ActionMoveToObject(oPatron);
                    ActionSpeakString("What's your poison?");
                    ActionWait(2.0);
                    DrinkOrder();
                    ActionDoCommand(SetLocalInt(OBJECT_SELF, "BARMAID_STATE", 2));
                case 2:
                    ActionMoveToObject(oBar);
                    ActionSpeakString(GetLocalString(OBJECT_SELF, "WG_ORDER"));
                    ActionWait(2.0);
                    ActionDoCommand(SetLocalInt(OBJECT_SELF, "BARMAID_STATE", 3));
                case 3:
                    ActionMoveToObject(oPatron);
                    ActionSpeakString(GetLocalString(OBJECT_SELF, "WG_AMOUNT"));
                    ActionWait(1.0);
                    ActionDoCommand(SetLocalObject(OBJECT_SELF, "WG_Inn_Patron", OBJECT_INVALID));
                    ActionDoCommand(SetLocalInt(OBJECT_SELF, "BARMAID_STATE", 0));
                    ActionDoCommand(SetLocalInt(OBJECT_SELF, "PC_BOTHERED", 0));
                    break;
                }
            }
        }
    }
}


and then the drink order function

NWScript:
void DrinkOrder()
{
    int nOrder= -1;
    string sOrder;
    string sAmount;
    nOrder= d8();
    switch(nOrder)
    {
    case 1:
        sOrder = "Ollof, one ale if you'd please.";
        sAmount = "Two copper for the ale.";
        break;
    case 2:
        sOrder = "A pint of rott gut.";
        sAmount = "Only one copper...";
        break;
    case 3:
        sOrder = "A bottle of wine for the foof in the corner.";
        sAmount = "Two Silver, Thank you.";
        break;
    case 4:
        sOrder = "A tankard of Dragon's Breath.";
        sAmount = "Three copper, and good luck to ye.";
        break;
    case 5:
        sOrder = "A tankard of our finest.";
        sAmount = "Five coppers aught to do it.";
        break;
    case 6:
        sOrder = "They want a pitcher of ale.";
        sAmount = "One silver will cover it.";
        break;
    case 7:
        sOrder = "Ollof, they just asked how much for me!";
        sAmount = "*SMACK*";
        break;
    case 8:
        sOrder = "Do we have 'Unicorn's Mane?";
        sAmount = "Sorry we don't carry that.";
        break;
    }
SetLocalString(OBJECT_SELF, "WG_ORDER", sOrder);
SetLocalString(OBJECT_SELF, "WG_AMOUNT", sAmount);
}


_________________
Fianna Tiger - And the tigers come at night, their voice as soft as thunder. They tear your dreams apart they turn your life to shame.

[ Edited By FiannaTiger: Wednesday, 26 June 02:47AM (GMT) ]

[ Edited By FiannaTiger: Wednesday, 26 June 02:49AM (GMT) ]

This post taken from the BioWare Forums
Powered by BioBoards Version 2.05.006
Please read our Copyright and Trademark Information