Author Sticky: Post Working Scripts Here
Acen_LOA Posted: Wednesday, 26 June 12:06AM
My thanks to Elmer The Destroyer for the suggestion. Please posts completed scripts in the following format for ease of reading:

1. Script Name: give_ale

2. What it does: creates an item of ale and places in the user's inventory.

3. Notes: I wanted to make a tavern and have useable kegs in it. It would be cool to have people playing NPCs and be able to go to the kitchen, click on a keg, and have an ale end up in their inventory. This script does that just fine (and could work for making any item appear in the inventory but I used it for kegs and liquor )

make sure to plae in the keg's OnUsed event and make it useable.

4. The Script itself
NWScript:
/*

  An ale giving script

  Scriptor: Brandon Kassebaum

  email: bkassebaum@netscape.net

*/

void main()

{

    object oPlayer = GetLastUsedBy();

    if (oPlayer == OBJECT_INVALID)

    {

        // error message

        SpeakString("Hey I don't have a player selected!");;

    }

    else

    {

        string sName = GetPCPlayerName(oPlayer);

        SpeakString("*" + sName + " pours an Ale*");

        // create the ale

        string sItemTag = "NW_IT_MPOTION021";

        int nStackSize = 1;

        object oItem = CreateItemOnObject(sItemTag, oPlayer, nStackSize);

        if(oItem == OBJECT_INVALID)

            // error message

            SpeakString("I'm all out of ale! (and possessed too it seems)");

    }

}