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:
void destroyPlotItems(object oPC, object oInvItem)
{
string sPlotItemTagStartingKeyword = "";
if(oInvItem != OBJECT_INVALID)
{
if(GetPlotFlag(oInvItem) == TRUE &&
(sPlotItemTagStartingKeyword !=
GetStringLeft(GetTag(oInvItem),GetStringLength(sPlotItemTagStartingKeyword)) ||
sPlotItemTagStartingKeyword == ""))
{
SendMessageToPC(oPC,"Plot Object:");
SendMessageToPC(oPC,GetName(oInvItem));
SendMessageToPC(oPC,"has been removed because plot items have been known to " +
"be super/cheat weapons.");
DestroyObject(oInvItem);
}
}
}
void main()
{
object oPC = GetEnteringObject();
object oSlot;
oSlot = GetItemInSlot(INVENTORY_SLOT_ARMS,oPC);
destroyPlotItems(oPC, oSlot);
oSlot = GetItemInSlot(INVENTORY_SLOT_ARROWS,oPC);
destroyPlotItems(oPC, oSlot);
oSlot = GetItemInSlot(INVENTORY_SLOT_BELT,oPC);
destroyPlotItems(oPC, oSlot);
oSlot= GetItemInSlot(INVENTORY_SLOT_BOLTS,oPC);
destroyPlotItems(oPC, oSlot);
oSlot= GetItemInSlot(INVENTORY_SLOT_BOOTS,oPC);
destroyPlotItems(oPC, oSlot);
oSlot= GetItemInSlot(INVENTORY_SLOT_BULLETS,oPC);
destroyPlotItems(oPC, oSlot);
oSlot= GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
destroyPlotItems(oPC, oSlot);
oSlot= GetItemInSlot(INVENTORY_SLOT_CHEST,oPC);
destroyPlotItems(oPC, oSlot);
oSlot= GetItemInSlot(INVENTORY_SLOT_CLOAK,oPC);
destroyPlotItems(oPC, oSlot);
oSlot = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B,oPC);
destroyPlotItems(oPC, oSlot);
oSlot = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L,oPC);
destroyPlotItems(oPC, oSlot);
oSlot = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R,oPC);
destroyPlotItems(oPC, oSlot);
oSlot = GetItemInSlot(INVENTORY_SLOT_HEAD,oPC);
destroyPlotItems(oPC, oSlot);
oSlot = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC);
destroyPlotItems(oPC, oSlot);
oSlot = GetItemInSlot(INVENTORY_SLOT_LEFTRING,oPC);
destroyPlotItems(oPC, oSlot);
oSlot = GetItemInSlot(INVENTORY_SLOT_NECK,oPC);
destroyPlotItems(oPC, oSlot);
oSlot = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
destroyPlotItems(oPC, oSlot);
oSlot = GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oPC);
destroyPlotItems(oPC, oSlot);
object currentItemInInv;
object firstItemInInv;
firstItemInInv = GetNextItemInInventory(oPC);
currentItemInInv = firstItemInInv;
if(currentItemInInv != OBJECT_INVALID)
{
do{
destroyPlotItems(oPC, currentItemInInv);
currentItemInInv = GetNextItemInInventory(oPC);
}while(currentItemInInv != OBJECT_INVALID &&
currentItemInInv != firstItemInInv);
}
}
Let me know if you have trouble with the script.
Regards
|