Author Sticky: Post Working Scripts Here
Nos-NR Posted: Thursday, 25 July 10:53PM
Woa, worlds fastest reply. Ok thanks. Here goes

1. Script Name: Rowdy Drinking Friends

2. What it does: Makes 2 characters drink and act merry, one is abusive, and a drunkard, e.g. waves his sword around, gets leery, the other will apolagise for his friend and drink etc...

3. Notes: Right, create 2 characters, give them defined tags, such as "smallDwarf", and "smallHalfling", then stick this in the UserDefined Script. So that on heartbeat this script is called. Enjoy. They are quite amusing to watch.

4. The Script itself

NWScript:
//::///////////////////////////////////////////////

//:: Name       Rowdy Drinking Friends

//:: FileName

//:: Copyright (c) 2001 Bioware Corp.

//:://////////////////////////////////////////////

/*

*/

//:://////////////////////////////////////////////

//:: Created By:    Sebastian Patten (s.patten@uea.ac.uk)

//:: Created On:    25/07/2002

//:://////////////////////////////////////////////

void main()

{

    int nUser = GetUserDefinedEventNumber();

    int randomNumber1 = Random(10);

    int randomNumber2 = Random(6);

    int booleanFlag;

    // Defines the 2 created characters

    object oDwarf = GetObjectByTag("smallDwarf");

    object oHalfling = GetObjectByTag("smallHalfling");

    // User defined Event On Heartbeat

    if(nUser == 1001)

    {

        // Turns the flag on if both the object

        // is alive and valid

        if(GetIsObjectValid(oHalfling) == TRUE)

        {

             if(GetIsDead(oHalfling) == FALSE)

             {

                booleanFlag = TRUE;

             }

        }

        if(GetIsObjectValid(oDwarf) == TRUE)

        {

            if(GetIsDead(oDwarf) == FALSE)

            {

                switch(randomNumber1)

                {

                    case 1:

                    {

                        switch(Random(5))

                        {

                            case 0:

                            {

                                AssignCommand(oDwarf, ActionSpeakString("What are you looking at?", 5));

                                break;

                            }

                            case 1:

                            {

                                AssignCommand(oDwarf, ActionSpeakString("You and whos army?", 5));

                                break;

                            }

                            case 2:

                            {

                                AssignCommand(oDwarf, ActionSpeakString("Who you calling shorty?", 5));

                                break;

                            }

                            case 3:

                            {

                                AssignCommand(oDwarf, ActionSpeakString("I outa whoop your sorry behind.", 5));

                                break;

                            }

                            case 4:

                            {

                                AssignCommand(oDwarf, ActionSpeakString("Come get some!", 5));

                                break;

                            }

                        }

                        AssignCommand(oDwarf, ActionPlayAnimation(ANIMATION_FIREFORGET_TAUNT, 1.0, 3.0));

                        if(booleanFlag == TRUE)

                        {

                            switch(randomNumber2)

                            {

                                case 0:

                                {

                                    AssignCommand(oHalfling, ActionSpeakString("Please excuse my friend. He is... a little drunk"));

                                    break;

                                }

                                case 1:

                                {

                                    string tempString = ("Gee " + GetName(oDwarf) + ". You really shouldn't say those things.");

                                    AssignCommand(oHalfling, ActionSpeakString(tempString));

                                    break;

                                }

                                case 2:

                                {

                                    AssignCommand(oHalfling, ActionSpeakString("I'm really sorry about this I will take him home real soon!"));

                                    break;

                                }

                            }

                        }

                        break;

                    }

                    case 2:

                    {

                        AssignCommand(oDwarf, ActionSpeakString("Yea!", 5));

                        AssignCommand(oDwarf, ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY1, 1.0, 2.0));

                        if(booleanFlag == TRUE)

                        {

                            switch(Random(4))

                            {

                                case 2:

                                {

                                    AssignCommand(oHalfling, ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY1, 1.0, 2.0));

                                    break;

                                }

                                case 3:

                                {

                                    AssignCommand(oHalfling, ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY2, 1.0, 2.0));

                                    break;

                                }

                                case 4:

                                {

                                    AssignCommand(oHalfling, ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY3, 1.0, 2.0));

                                    break;

                                }

                            }

                        }

                        break;

                    }

                    case 3:

                    {

                        AssignCommand(oDwarf, ActionPlayAnimation(ANIMATION_LOOPING_PAUSE_DRUNK, 1.0, 6.0));

                        if(booleanFlag == TRUE)

                        {

                            switch(Random(2))

                            {

                                case 0:

                                {

                                    AssignCommand(oHalfling, ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK, 1.0, 2.0));

                                    break;

                                }

                            }

                        }

                        break;

                    }

                    case 4:

                    {

                        AssignCommand(oDwarf, ActionPlayAnimation(ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD));

                        break;

                    }

                    case 5:

                    {

                        AssignCommand(oDwarf, ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK, 1.0, 3.0));

                        break;

                    }

                    case 6:

                    {

                        // Stick a sword in his inventory and hell wave it about

                        object oInventoryItem = GetFirstItemInInventory(oDwarf);

                        AssignCommand(oDwarf, ActionEquipItem(oInventoryItem, INVENTORY_SLOT_RIGHTHAND));

                        AssignCommand(oDwarf, ActionSpeakString("I outa run... you through with this here blade.", 5));

                        if(booleanFlag == TRUE)

                        {

                            AssignCommand(oHalfling, ActionPlayAnimation(ANIMATION_FIREFORGET_STEAL));

                            AssignCommand(oHalfling, ActionSpeakString("Don't get that thing out here, it'l get you hurt.", 5));

                        }

                        AssignCommand(oDwarf, ActionPlayAnimation(ANIMATION_LOOPING_PAUSE_DRUNK, 2.0, 6.0));

                        AssignCommand(oDwarf, ActionUnequipItem(oInventoryItem));

                        break;

                    }

                }

            }

        }

    }

}