Author Sticky: Post Working Scripts Here
Phydeaux Posted: Monday, 01 July 01:20AM
This script takes new characters (and new characters -only-), removes all their stuff, gives them some money, and dumps them directly into a store. Place this script in the OnClientEnter Event Handler.

STORE_NAME is the tag of the merchant to send new PCs to. STARTING_GOLD is how much gold you want PCs to begin the game with. PLAYER_STRIPS determines if the player's equipped items are removed as well as his inventory.

NWScript:
/* Inventory Setup

 * Written by Phydeaux@Ivory Tower <guy.sisalli@sunysb.edu>

 * Version 1.0

 */

void main()

{

string  STORE_NAME      = "newbie_merchant";

int     STARTING_GOLD   = 150;

int     PLAYER_STRIPS   = TRUE;

    object oPlayer = GetEnteringObject();

    if(GetIsPC(oPlayer) && !(GetXP(oPlayer)) && !(GetIsDM(oPlayer)))

    {

// Giving PC its starting gold.

        GiveGoldToCreature(oPlayer, STARTING_GOLD - GetGold(oPlayer));

        if (PLAYER_STRIPS)

        {

// Removing PC's equipment.

            object oGear = GetItemInSlot(INVENTORY_SLOT_ARMS, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

            oGear = GetItemInSlot(INVENTORY_SLOT_BELT, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

            oGear = GetItemInSlot(INVENTORY_SLOT_BOLTS, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

            oGear = GetItemInSlot(INVENTORY_SLOT_BOOTS, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

            oGear = GetItemInSlot(INVENTORY_SLOT_CHEST, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

            oGear = GetItemInSlot(INVENTORY_SLOT_CLOAK, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

            oGear = GetItemInSlot(INVENTORY_SLOT_HEAD, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

            oGear = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

            oGear = GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

            oGear = GetItemInSlot(INVENTORY_SLOT_NECK, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

            oGear = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

            oGear = GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPlayer);

            if(GetIsObjectValid(oGear))

                DestroyObject(oGear);

        }

// Removing PC's inventory.

        object oStuff = GetFirstItemInInventory(oPlayer);

        while(GetIsObjectValid(oStuff))

        {

            DestroyObject(oStuff);

            oStuff = GetNextItemInInventory(oPlayer);

        }

// Greet PC.

        DelayCommand(3.0, SendMessageToPC(oPlayer, "Welcome, " + GetPCPlayerName(oPlayer) + "! You have been stripped of all your belongings and credited with " + IntToString(STARTING_GOLD) + " gp."));

        DelayCommand(3.0, SendMessageToPC(oPlayer, "In just a moment you will be brought to the character generation store, where you can purchase your starting posessions. Take note that you will only get one chance to purchase things from this store, and then you are on your own. Good luck!"));

// Taking PC shopping.

        object oStore = GetObjectByTag(STORE_NAME);

        DelayCommand(7.0, OpenStore(oStore, oPlayer));

// Give PC 1 experience point to signify not being a new character any longer.

        SetXP(oPlayer, 1);

    }

}



_________________
Phydeaux

** Ivory Tower server