/*-------------------------------------------------------- Script Name: securedoorscript ---------------------------------------------------------- Created By: Genisys(Guile) Created On: 2/09/09 ---------------------------------------------------------- This script scans PC items for bad properties on thier rings! ----------------------------------------------------------*/ #include "x2_inc_itemprop" void RemoveDmgImm(object oItem); void main() { object oPC = GetEnteringObject(); int nInt = GetLocalInt(oPC, "SCANNED"); object oItem; int nType; object oRing1 = GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPC); object oRing2 = GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPC); int nImmune = IMMUNITY_TYPE_DAMAGE_IMMUNITY_DECREASE; //if It's a DM entering, stop here.. if (GetIsDM(oPC) || GetIsDMPossessed(oPC)) { return; } //Do this only once per PC! if(nInt >=2) {return;} else { //We will scan 2 times only! nInt +=1; SetLocalInt(oPC, "SCANNED", nInt); } //ONLY CHECK NON-GUILD MEMBERS! if(GetItemPossessedBy(oPC, "guildpass")==OBJECT_INVALID) { //FloatingTextStringOnCreature("Your item's were scanned.", oPC, FALSE); //First Remove Damage Immunity properties from rings worn.. RemoveDmgImm(oRing1); RemoveDmgImm(oRing2); oItem = GetFirstItemInInventory(oPC); while(GetIsObjectValid(oItem)) { nType =GetBaseItemType(oItem); if(nType== BASE_ITEM_RING) { RemoveDmgImm(oItem); } oItem = GetNextItemInInventory(oPC); } } //Script End } void RemoveDmgImm(object oItem) { itemproperty iProp; int iType; int nType = ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE; int nSubType1 = IP_CONST_DAMAGEIMMUNITY_5_PERCENT; int nSubType2 = IP_CONST_DAMAGEIMMUNITY_10_PERCENT; int nSubType3 = IP_CONST_DAMAGEIMMUNITY_25_PERCENT; iProp = GetFirstItemProperty(oItem); while(GetIsItemPropertyValid(iProp)) { iType = GetItemPropertyType(iProp); if(iType == nType) { RemoveItemProperty(oItem, iProp); } iProp = GetNextItemProperty(oItem); } }