Author Sticky: Post Working Scripts Here
ForgottenSoul Posted: Wednesday, 10 July 01:43AM
Quote: Posted 07/09/02 23:49:39 (GMT) by Invizible420

-- DESTROY EQUIPED AND INVENTORY PLOT ITEMS ONLY / RID US OF THE LAMENESS OF SUPER CHARACTERS

I can't believe no one posted this script yet.
Mad props to Forgotten Soul for the code to destroy inventory plot items.

I'm not much of a 'scripter' so if you want to edit or make it more efficient; feel free. Just give credit where it is due. If you do make it better POST IT here, please!

What it does: You may or may not know that PLOT items can be used to make hacked/toolset/twinkted/cheat/level 61/uber (whatever u call it) weapons, armor, and items. This greatly compromises the gameplay of your module, allowing twinkies (uber) characters to come in and pummel everone else. Well no longer, this script will go through a player's equiped items and inventory and look for any plot items; send a message to the player, then destroy the items. If they have no plot items, it does nothing. Oh yeah, this also means NO INFINITE TIMESTOPPING/SPELLCASTING!! YEA!

At last we can play mods with our own local characters and not have to deal with any super cheated players. Anyways, heres the script. Put it in the MODULE'S ON CLIENT ENTER:

If they don't cheat then they have nothing to worry about.

.. code deleted
Unfortunetly, if a plot item is required for specific module; it also will be destroyed when the player re-enters. Stick with vaulted chars

[ Edited By Invizible420: Tuesday, 09 July 11:52PM (GMT) ]


Here is my enhancement. It allows for plot items that start with a particular keyword to pass the function of destruction. Its pretty easy to alter it to whatever you want. (Also if the keyword is left as default ("") then all plot items are destroyed)

NWScript:
//::///////////////////////////////////////////////
//:: Name destoryPlotItems
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
  Description:
   This function destroys all of the objects passed
   that are plot items and that do not start with
   the key word defined in var "sPlotItemTagStartingKeyword"
   Change "sPlotItemTagStartingKeyword" to whatever keyword
   you wish to start your plot items with. If left blank ""
   all items defined as plot items will be destroyed.

*/
//:://////////////////////////////////////////////
//:: Created By: ForgottenSoul
//:: Created On: July 9, 2002
//:://////////////////////////////////////////////

void destroyPlotItems(object oPC, object oInvItem)
{
    //////////////////////////////////////////////////////////////////////////
    //
    // sPlotItemTagStartingKeyword
    //  Set this var to the starting characters you want all your plot
    //  items to start with. It is case sensitive. Any other plot items
    //  that do not start with  sPlotItemTagStartingKeyword will be destroyed
    //  example:
    //    if:
    //      sPlotItemTagStartingKeyword = "ForgottenSoul"
    //    Then the following items would be kept.
    //      ForgottenSoul's Wicked Ale
    //      ForgottenSoul
    //      ForgottenSoul Ring of the Maji
    //
    //    Then the following items would be deleted (note its case sensitive)
    //       forgottenSoul's Wicked Ale
    //       My super Powerful Cheat weapon
    //       Forgotten Soul Ring of the Maji
    //
    // If this var is left blank, then all plot items are detroyed.
    //
    string sPlotItemTagStartingKeyword = "";
    // Check to see if a valid object was passed
    if(oInvItem != OBJECT_INVALID)
    {
        //
        // Destroy object if:
        //   It is a plot item AND Either of the following is true:
        //     The item DOEST NOT start with the text defined in var
        //     sPlotItemTagStartingKeyword
        //   OR
        //     sPlotItemTagStartingKeyword equals ""
        //
        if(GetPlotFlag(oInvItem) == TRUE &&
           (sPlotItemTagStartingKeyword !=
           GetStringLeft(GetTag(oInvItem),GetStringLength(sPlotItemTagStartingKeyword)) ||
           sPlotItemTagStartingKeyword == ""))
         {
            // Be nice an inform player why items is gone
            SendMessageToPC(oPC,"Plot Object:");
            SendMessageToPC(oPC,GetName(oInvItem));
            SendMessageToPC(oPC,"has been removed because plot items have been known to " +
                                "be super/cheat weapons.");
            // it is a plot item. Destroy it.
            DestroyObject(oInvItem);
        }
    }
}

///////////////////////
// ANTI-TWINK SCRIPT //
///////////////////////
void main()
{
    object oPC = GetEnteringObject();
    object oSlot;
    oSlot = GetItemInSlot(INVENTORY_SLOT_ARMS,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot = GetItemInSlot(INVENTORY_SLOT_ARROWS,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot = GetItemInSlot(INVENTORY_SLOT_BELT,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot= GetItemInSlot(INVENTORY_SLOT_BOLTS,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot= GetItemInSlot(INVENTORY_SLOT_BOOTS,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot= GetItemInSlot(INVENTORY_SLOT_BULLETS,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot= GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot= GetItemInSlot(INVENTORY_SLOT_CHEST,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot= GetItemInSlot(INVENTORY_SLOT_CLOAK,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot = GetItemInSlot(INVENTORY_SLOT_HEAD,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot = GetItemInSlot(INVENTORY_SLOT_LEFTRING,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot = GetItemInSlot(INVENTORY_SLOT_NECK,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    oSlot = GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oPC);
    // Destroy the equiped plot item
    destroyPlotItems(oPC, oSlot);
    object currentItemInInv;
    //////////////////////////////////////////////////////////////////////
    // Now loop through everything in the Inventory.
    //
    //////////////////////////////////////////////////////////////////////
    object firstItemInInv;
    firstItemInInv = GetNextItemInInventory(oPC);
    currentItemInInv = firstItemInInv;
    // Insure they have at least one object
    if(currentItemInInv != OBJECT_INVALID)
    {
        do{
            // Check for destrtoying plot items.
            destroyPlotItems(oPC, currentItemInInv);
            // get next item
            currentItemInInv = GetNextItemInInventory(oPC);
        // loop while we have a new item to check
        }while(currentItemInInv != OBJECT_INVALID &&
               currentItemInInv != firstItemInInv);
    }
}



Let me know if you have trouble with the script.

Regards