// Script Name: _rem_slay_oe
/////////////////////////////////////////////////////////////////
// Created By Genisys / Guile
// Created On 3/15/2014
/////////////////////////////////////////////////////////////////
// This Script goes in an Area's or Trigger's OneEnter Event
/////////////////////////////////////////////////////////////////
// Declare Custom Prototypes..
int IsSlayWeapon(int nType);
void RemoveSlay(object oItem);
/////////////////////////////////////////////////////////////////
// Main Script
void main()
{
object oPC = GetEnteringObject();
if(!GetIsPC(oPC)) { return; }
int iEntered = GetLocalInt(oPC, "SLAY_REMOVED");
if(iEntered) { return; }
else
{ SetLocalInt(oPC, "SLAY_REMOVED", TRUE); }
int i, nBase;
object oSlot;
oSlot = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
if(oSlot != OBJECT_INVALID){
nBase = GetBaseItemType(oSlot);
if(IsSlayWeapon(nBase))
{ RemoveSlay(oSlot); } }
oSlot = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
if(oSlot != OBJECT_INVALID){
nBase = GetBaseItemType(oSlot);
if(IsSlayWeapon(nBase))
{ RemoveSlay(oSlot); } }
oSlot = GetItemInSlot(INVENTORY_SLOT_BULLET, oPC);
if(oSlot != OBJECT_INVALID){
{ RemoveSlay(oSlot); }
oSlot = GetItemInSlot(INVENTORY_SLOT_ARROW, oPC);
if(oSlot != OBJECT_INVALID){
{ RemoveSlay(oSlot); }
oSlot = GetItemInSlot(INVENTORY_SLOT_BOLT, oPC);
if(oSlot != OBJECT_INVALID){
{ RemoveSlay(oSlot); }
oSlot = GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oSlot))
{
nBase = GetBaseItemType(oSlot);
if(IsSlayWeapon(nBase))
{
DelayCommand(0.5, RemoveSlay(oSlot));
}
oSlot = GetNextItemInInventory(oPC);
}
// End Main Script
}
/////////////////////////////////////////////////////////////////
// Define Custom Prototypes
int IsSlayWeapon(int nType)
{
switch(nType)
{
case BASE_ITEM_ARROW: { return TRUE; } break;
case BASE_ITEM_BASTARDSWORD: { return TRUE; } break;
case BASE_ITEM_BATTLEAXE: { return TRUE; } break;
case BASE_ITEM_BOLT: { return TRUE; } break;
case BASE_ITEM_BULLET: { return TRUE; } break;
case BASE_ITEM_CLUB: { return TRUE; } break;
case BASE_ITEM_DAGGER: { return TRUE; } break;
case BASE_ITEM_DART: { return TRUE; } break;
case BASE_ITEM_DIREMACE: { return TRUE; } break;
case BASE_ITEM_DOUBLEAXE: { return TRUE; } break;
case BASE_ITEM_DWARVENWARAXE: { return TRUE; } break;
case BASE_ITEM_GLOVES: { return TRUE; } break;
case BASE_ITEM_GREATAXE: { return TRUE; } break;
case BASE_ITEM_GREATSWORD: { return TRUE; } break;
case BASE_ITEM_HALBERD: { return TRUE; } break;
case BASE_ITEM_HANDAXE: { return TRUE; } break;
case BASE_ITEM_HEAVYCROSSBOW: { return TRUE; } break;
case BASE_ITEM_HEAVYFLAIL: { return TRUE; } break;
case BASE_ITEM_KAMA: { return TRUE; } break;
case BASE_ITEM_KATANA: { return TRUE; } break;
case BASE_ITEM_KUKRI: { return TRUE; } break;
case BASE_ITEM_LIGHTCROSSBOW: { return TRUE; } break;
case BASE_ITEM_LIGHTFLAIL: { return TRUE; } break;
case BASE_ITEM_LIGHTHAMMER: { return TRUE; } break;
case BASE_ITEM_LIGHTMACE: { return TRUE; } break;
case BASE_ITEM_LONGBOW: { return TRUE; } break;
case BASE_ITEM_LONGSWORD: { return TRUE; } break;
case BASE_ITEM_MORNINGSTAR: { return TRUE; } break;
case BASE_ITEM_QUARTERSTAFF: { return TRUE; } break;
case BASE_ITEM_RAPIER: { return TRUE; } break;
case BASE_ITEM_SCIMITAR: { return TRUE; } break;
case BASE_ITEM_SCYTHE: { return TRUE; } break;
case BASE_ITEM_SHORTBOW: { return TRUE; } break;
case BASE_ITEM_SHORTSPEAR: { return TRUE; } break;
case BASE_ITEM_SHORTSWORD: { return TRUE; } break;
case BASE_ITEM_SHURIKEN: { return TRUE; } break;
case BASE_ITEM_SICKLE: { return TRUE; } break;
case BASE_ITEM_SLING: { return TRUE; } break;
case BASE_ITEM_THROWINGAXE: { return TRUE; } break;
case BASE_ITEM_TRIDENT: { return TRUE; } break;
case BASE_ITEM_TWOBLADEDSWORD: { return TRUE; } break;
case BASE_ITEM_WARHAMMER: { return TRUE; } break;
case BASE_ITEM_WHIP: { return TRUE; } break;
}
return FALSE;
}
void RemoveSlay(object oItem) // OnHit Slay Alignment Group ONLY!
{
int nType, nSub;
itemproperty iProp = GetFirstItemProperty(oItem);
while(GetIsItemPropertyValid(iProp))
{
nType = GetItemPropertyType(iProp);
nSub = GetItemPropertySubType(iProp);
if(nType == ITEM_PROPERTY_ON_HIT_PROPERTIES){
if(nSub == IP_CONST_ONHIT_SLAYALIGNMENTGROUP)
{ RemoveItemProperty(oItem, iProp); } }
iProp = GetNextItemProperty(oItem);
}
}
I tested it & it works perfectly, however, you should only use this in a trigger that the PC will only ever pass by one time / entrance into the module, and NOT in the OnClientEnter event, as it can be rather intensive cycling through a players inventory & properties...