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
mindtakerr Posted: Friday, 28 June 07:02PM
Name: Random Conversation Creator
What it does: This is a good script to use when you don't really feel like writing a long conversation for some unimportant NPC. This will generate a random line of dialogue and/or quirk from 20 different choices.
Notes: I think this works best when you make a conversation using the conversation editor. Give the NPC a single dialogue node, but don't put any text in it. On the Actions Taken tab, insert this script. Then you can use that dialogue for any NPC you want to behave this way.

NWScript:
//::///////////////////////////////////////////////
//:: Name: Random Conversation Creator
//:: FileName: random_convo
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
*/
//:://////////////////////////////////////////////
//:: Created By: mindtakerr
//:: Created On: 06/27/02
//:://////////////////////////////////////////////
void main()
{
    int nConvoNumber = d20();
    int nD100 = d100();
    float temp;
    int temp2;
    string temp3;
    object oChair;
    switch(nConvoNumber) {
        case 1:
            AssignCommand(OBJECT_SELF, ActionSpeakString("G'day to ye, friend!"));
            break;
        case 2:
            AssignCommand(OBJECT_SELF, ActionSpeakString("Hail to you, dear friend."));
            break;
        case 3:
            if(GetIsNight())
                AssignCommand(OBJECT_SELF, ActionSpeakString("What a nice night it is tonight."));
            else
                AssignCommand(OBJECT_SELF, ActionSpeakString("You can't ask for a nicer day than today."));
            break;
        case 4:
            AssignCommand(OBJECT_SELF, ActionSpeakString("I like coconuts!"));
            break;
        case 5:
            AssignCommand(OBJECT_SELF, ActionSpeakString("Hello, my name is " + GetName(OBJECT_SELF)));
            break;
        case 6:
            AssignCommand(OBJECT_SELF, ActionSpeakString("Ohhh... I'm so tired."));
            break;
        case 7:
            ActionSpeakString("Watch this!");
            ActionCastFakeSpellAtObject(SPELL_FIREBALL, OBJECT_SELF);
            break;
        case 8:
            ActionSpeakString("I feel like walking around for a while.");
            ActionRandomWalk();
            break;
        case 9:
            ActionSpeakString("I grow tired of this body.");
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectPolymorph(POLYMORPH_TYPE_BALOR), OBJECT_SELF, 7.5);
            break;
        case 10:
            ActionSpeakString("Some day, I want to have " + IntToString(d20()) + " children!");
            break;
        case 11:
            temp = IntToFloat(nD100);
            temp2 = FloatToInt(FeetToMeters(temp));
            temp3 = IntToString(temp2);
            ActionSpeakString("Did you know that " + IntToString(nD100) + " feet is " + temp3 + " meters?");
            break;
        case 12:
            temp = IntToFloat(nD100);
            temp2 = FloatToInt(YardsToMeters(temp));
            temp3 = IntToString(temp2);
            ActionSpeakString("Did you know that " + IntToString(nD100) + " yards is " + temp3 + " meters?");
            break;
        case 13:
            ActionSpeakString("I need to sit down.");
            ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), GetLocation(OBJECT_SELF), 2.5);
            oChair = CreateObject(OBJECT_TYPE_PLACEABLE, "chair001", GetLocation(OBJECT_SELF));
            ActionSit(oChair);
            break;
        case 14:
            ActionSpeakString("How are you today, friend?");
            break;
        case 15:
            ActionSpeakString("I just heard a great joke!");
            ActionPlayAnimation(ANIMATION_LOOPING_TALK_LAUGHING, 1.0, 1.5);
            break;
        case 16:
            ActionSpeakString("It's always the same around here.");
            break;
        case 17:
            ActionSpeakString("I can count to 100.");
            ActionWait(0.7);
            for (nD100 = 1; nD100 <= 100; nD100++) {
                ActionSpeakString(IntToString(nD100));
                ActionWait(0.3);
            }
            break;
        case 18:
            nD100 = GetGender(OBJECT_SELF);
            if (nD100 == GENDER_FEMALE)
                temp3 = "woman?";
            else if (nD100 == GENDER_MALE)
                temp3 = "man?";
            ActionSpeakString("Who's the " + temp3);
            ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY1);
            break;
        case 19:
            ActionSpeakString("All in a day's work, my friend.");
            break;
        case 20:
            ActionSpeakString("Your lucky number for today is " + IntToString(nD100));
            break;
    }
}


_________________
Michael Ham
Check out The Six Realms of Bel'Abourd; a fantasy RPG work in progress.
www.bakedhamgames.com

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