DMH-Online

Dungeon Masters Helper · Est. 2005

Npcs Scripts

NWN Script: barmaid002.htm

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.

⌂ All Scripts ← PreviousNext → 👁 Category List

All Npcs Scripts

📄 ambient_animations 📄 barmaid 📄 barmaid002 📄 barmaid003 📄 barmaid003a 📄 barmaid004 📄 bitch_slap 📄 blacksmith 📄 blacksmith_001 📄 blacksmith_002 📄 blacksmith_003 📄 bounty_hunter 📄 check 📄 check_pc_item 📄 check_pc_item_002 📄 cheer_pcs 📄 cook 📄 daily_activity 📄 day_merchant 📄 determine_armed 📄 drunk 📄 equip_dequip 📄 equip_dequip_002 📄 escort 📄 flee 📄 flee_001 📄 force_pc_sit 📄 gate_guard 📄 get_nearest 📄 guard_dog_002 📄 guard_patrol 📄 healer 📄 impersonation 📄 item_guardian 📄 item_guardian_002 📄 jail_cell 📄 janitor 📄 janitor_002 📄 living_statues 📄 misc_activity 📄 monolouge 📄 multi_converse 📄 night_watch 📄 npc_brawls 📄 npc_pick_pocket 📄 npc_speak_onperception 📄 npc_start_conv 📄 npc_start_conv_002 📄 npc_start_conv_003 📄 npc_start_conv_004 📄 npc_start_conv_005 📄 open_door 📄 polymorph 📄 prostitute 📄 protect_items 📄 protect_items_002 📄 random_speak 📄 random_speak_002 📄 random_speak_003 📄 random_speak_004 📄 random_speak_005 📄 random_walk2 📄 reinforcements 📄 reinforcements_002 📄 remember_conv 📄 rowdy 📄 sheath_weapons 📄 sit_and_talk 📄 sit_and_talk_002 📄 sit_in_nearest_chair 📄 smart_npc 📄 smart_sitting 📄 streetfight 📄 tag 📄 tag_001a 📄 teleport_away 📄 teleport_away_002 📄 teleport_away_003 📄 town_crier 📄 trivia_bot 📄 walk_after 📄 woodcutter 📄 worker 📄 worker_002 📄 workstation 📄 wrestling_game