Author Sticky: Post Working Scripts Here
jamus_se Posted: Wednesday, 26 June 12:57AM
1. Script Title: Striptease!!
2. Purpose: This script is meant to be placed in the OnEnter event of a trigger. Any player who walks into the area for the first time will be robbed of all possessions, including gold, inventory, and ALL equipment currently being worn.
3. Note: Please be very careful with this script... nobody likes to get every hard earned item that they had stripped away like this. This is only meant to be used for an opening scenario where you don't want the player to have any starting equipment.

NWScript:
void main()

{

    // Get entering object

    object oEnter = GetEnteringObject();

 

    // Rob and strip the player

    if( GetIsPC(oEnter) && !(GetLocalInt(oEnter, "GotRobbed")) )

    {

        // Ensure that the robbing only happens once

        SetLocalInt(oEnter, "GotRobbed", TRUE);

        // Take away gold

        TakeGoldFromCreature(GetGold(oEnter), oEnter, TRUE);

        // Take away all inventory items

        object oNextItem = GetNextItemInInventory(oEnter);

        while(oNextItem != OBJECT_INVALID)

        {

            DestroyObject(oNextItem);

            oNextItem = GetNextItemInInventory(oEnter);

        }

        // Take away all worn equipments

        oNextItem = GetItemInSlot(INVENTORY_SLOT_ARMS, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_ARROWS, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_BOLTS, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_BELT, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_BOOTS, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_BULLETS, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_CHEST, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_CLOAK, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_HEAD, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_LEFTRING, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

        oNextItem = GetItemInSlot(INVENTORY_SLOT_NECK, oEnter);

        if(oNextItem != OBJECT_INVALID)

            DestroyObject(oNextItem);

    }

}

Reply to Jamus_se's striptease script... found one flaw in the script... it wont take the PC's gold...

from what i can tell it's because the TakeGold FromCreature (TakeGold & FromCreature is all one word.. this stupid thing says its to big a word and wont post unless I split it :/ )
command has to originate from a valid object as the caller to work...

so anyone using it and it's not taking the PC's gold place a trigger (ie. valid object for the caller) at the spawn in point and use this script in the OnEnter of the trigger... its pretty much the same as Jamus_se had it in the OnClientEnter script but it gives it a vald object for the caller and it works perfectly...


void main()
{

// Get entering object
object oTriggerer = GetEnteringObject();
// Rob and strip the player
if( GetIsPC(oTriggerer) && !(GetLocalInt (oTriggerer, "GotRobbed2")) )
{
// Ensure that the robbing only happens once
SetLocalInt(oTriggerer, "GotRobbed2", TRUE);
// Take away gold
TakeGold FromCreature(GetGold(oTriggerer), oTriggerer, TRUE);
}
}

once again (TakeGold & FromCreature is all one word.. this stupid thing says its to big a word and wont post unless I split it :/ )