Initial upload
Initial upload.
This commit is contained in:
73
_module/nss/clearinv.nss
Normal file
73
_module/nss/clearinv.nss
Normal file
@@ -0,0 +1,73 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Created By: Astaroth
|
||||
* Created On: 6/22/2002
|
||||
* Clears a PC's inventory when he/she first enters the trigger.
|
||||
* Only runs once, when CLEAR_INV_SCENE variable equals 0.
|
||||
* After running, CLEAR_INV_SCENE is set to 1 so PC's
|
||||
* inventory isn't cleared again should he/she walk back into
|
||||
* the trigger for whatever reason.
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
void main()
|
||||
{
|
||||
object oEnteringPC;
|
||||
object oInvItem;
|
||||
// Get the object that last entered this area
|
||||
oEnteringPC = GetEnteringObject();
|
||||
// Make sure the object is a PC
|
||||
if (GetIsPC(oEnteringPC))
|
||||
{
|
||||
// Only clear inventory if we haven't already done it before
|
||||
if (GetLocalInt(oEnteringPC, "CLEAR_INV_SCENE1") == 0)
|
||||
{
|
||||
oInvItem = GetFirstItemInInventory(oEnteringPC);
|
||||
while (oInvItem != OBJECT_INVALID)
|
||||
{
|
||||
//ActionTakeItem(oInvItem, oEnteringPC);
|
||||
DestroyObject(oInvItem);
|
||||
oInvItem = GetNextItemInInventory(oEnteringPC);
|
||||
}
|
||||
// Since GetNextItemInInvetory() seems to not return equipped items,
|
||||
// we need to manually remove them one by one.
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_ARMS, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_ARROWS, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_BELT, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_BOLTS, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_BOOTS, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_BULLETS, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_CHEST, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_CLOAK, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_HEAD, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_LEFTRING, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_NECK, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
if ( OBJECT_INVALID != (oInvItem = GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oEnteringPC)) )
|
||||
DestroyObject(oInvItem);
|
||||
// Make sure this script doesn't run anymore for the current PC
|
||||
SetLocalInt(oEnteringPC, "CLEAR_INV_SCENE1", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user