Initial upload
Initial upload
This commit is contained in:
53
_module/nss/removeonhitslay.nss
Normal file
53
_module/nss/removeonhitslay.nss
Normal file
@@ -0,0 +1,53 @@
|
||||
//Created by Guile 4/10/07
|
||||
//Put this on enter to remove slay from all items in the inventory
|
||||
//This will not remove it from items in hand.
|
||||
|
||||
void MakeItemSafe(object oItem)
|
||||
{
|
||||
if (GetLocalInt(oItem, "ITEM_ACCEPTABLE")) return;
|
||||
itemproperty ipProperty = GetFirstItemProperty(oItem);
|
||||
while (GetIsItemPropertyValid(ipProperty))
|
||||
{
|
||||
if (GetItemPropertyDurationType(ipProperty) == DURATION_TYPE_PERMANENT)
|
||||
{
|
||||
int nItemPropertyType = GetItemPropertyType(ipProperty);
|
||||
switch (nItemPropertyType)
|
||||
{
|
||||
case ITEM_PROPERTY_ON_HIT_PROPERTIES:
|
||||
{
|
||||
int nSubtype = GetItemPropertySubType(ipProperty);
|
||||
if ((nSubtype>=21) && (nSubtype<=23))
|
||||
{
|
||||
RemoveItemProperty(oItem, ipProperty);
|
||||
WriteTimestampedLogEntry("Removing OnHit " + GetName(oItem));
|
||||
}
|
||||
break;
|
||||
}
|
||||
// default, just let it ride
|
||||
}
|
||||
}
|
||||
ipProperty = GetNextItemProperty(oItem);
|
||||
}
|
||||
SetLocalInt(oItem, "ITEM_ACCEPTABLE", TRUE);
|
||||
}
|
||||
//This is an example how to USE the above function.
|
||||
//Safest to add the above bit to Module OnAcquire event however, as it will perma-<span class="highlight">remove</span> it, from ANYTHING the PC's get.
|
||||
//Note: this removes slay by alignment, alignment group, and racial group.
|
||||
//if you handed out onhit vorpal swords, your <span class="highlight">on</span> your own.
|
||||
void main()
|
||||
{
|
||||
object oPC= GetEnteringObject();
|
||||
object oItem = GetFirstItemInInventory(oPC);
|
||||
while(GetIsObjectValid(oItem))
|
||||
{
|
||||
MakeItemSafe(oItem);
|
||||
oItem = GetNextItemInInventory(oPC);
|
||||
}
|
||||
int nItem;
|
||||
for( nItem = 0; nItem < 14; nItem++ )
|
||||
{
|
||||
oItem = GetItemInSlot( nItem, oPC );
|
||||
MakeItemSafe( oItem );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user