//////////////////////////////////// //Created by Genisys / Guile 7/01/08 //////////////////////////////////// /* This script scans ALL Of the PC's items to see if they have any bad item properties you don't want on items, if so it removes it. There are Options for item value, Max # of Item properties on an item, & What item properties are allowed on items. This script is fired from the script: "unequipallnscan" script. Please read that script for more information. I designed this script for a few different reasons: (See below) Servers which allow local characters. (obviously not wanting uber items on thier server!) Servers which have a forge, and want greater control over the items created.. (As players are good at finding bugs or exploiting!) Servers who want to get rid of a particular item property on items that are in their server without removing the item all together. (Which is usually makes people real unhappy!) (I have used this script before to remove stuff I created on weapons) (As a builder we all make mistakes, this is just a way to clean it up!) IMPORTANT: This is a pretty intensive scan, it's NOT recommended that you scan all PCs when they enter the module, rather place the trigger somewhere just past where all the PCs enter the module or in a place where all PCs MUST pass over, or you may cause a server crash! NOTE: This script only runs one time / PC / Restart.. */ //////////////////////////////////// ///////////OPTIONS SETTINGS///////////////////////////////////// //NOTE: I'm not positive on how much gold = what level //you will have to research this yourself, sorry. //The int nVMax = Max Gold Piece Value an Item can Have.. const int nVMax = 6500001; //(Kill all level 60+ Items) //The # below represents the MAX # of properties allowed //on all items which are scanned, if it's too many the item is lost! const int nIp = 20; //Range = 2 - 30 (do not set this to 1 or 0!) //////SEE BELOW FOR MORE OPTIONS (Scroll Down)//////// //////////////////////////////////////////////////////////////////////////////// //PROTOTYPE DECLARED void RemoveAllBadItems(object oPC); //PROTOTYPE DECLARED void RemoveBadIP(object oItem, int nItemPropertyType, int nItemPropertyDuration = DURATION_TYPE_TEMPORARY, int nItemPropertySubType = -1); //PROTOTYPE DECLARED void CheckItemStacking(object oPC); ////////////////////////////////////////////////////////////////////////////// /////////////ITEM PROPERTIES OPTIONS///////////(GO TO THE ****)////////////// ///////////////////////////////////////////////////////////////////////////// //Prototype (Defined) void RemoveAllBadIP(object oPC) { object oItem; //Then cycle through all the items in thier inventory oItem = GetFirstItemInInventory(oPC); while(GetIsObjectValid(oItem)) { //*********OPTIONS BEGIN********** /* If you don't want items to have a certain Item property see if it's listed below, if it's not you will need to create it! If an item property is allowed or not it's commented below. Type // at the start of the function which reads RemoveBadIP for the Item Property you wish to ALLOW. Delete the // before the RemoveBadIP if you wish to DISALLOW an item proerty. (Below are 2 examples of how to allow / disallow an item property.. (Do not delete the // on a line with just text on it!) */ //It's important to use IP_CONST_**** to identify the subtype //after nDur (duration), here.. if you want to remove //a specific type of ITEM_PROPERTY_TYPE (See immunity to crits.) //Redundant variable.. int nDur = DURATION_TYPE_PERMANENT; //(Misc. Immunities) if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS)) { //Immunity to Critical Hits (Currently NOT Allowed) //EXAMPLE - To ALLOW this property on items type // at the start of the line below RemoveBadIP(oItem, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, nDur, IP_CONST_IMMUNITYMISC_CRITICAL_HITS); //Immunity to Sneak Attacks (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, nDur, IP_CONST_IMMUNITYMISC_BACKSTAB); } //Bonus Feat / Weapon Proficiency - Creature Weapons //Bonus Fets if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_BONUS_FEAT)) { //Hide in Plain Sight (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_BONUS_FEAT, nDur, IP_CONST_FEAT_HIDE_IN_PLAIN_SIGHT); //Weapon Proficiency Creature (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_BONUS_FEAT, nDur, IP_CONST_FEAT_WEAPON_PROF_CREATURE); } //Improved Evasion (Permanent Item Property) if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMPROVED_EVASION)) { //Improved Evasion (Currently allowed) //EXAMPLE - If you wish to NOT Allow this item property delete the // below //RemoveBadIP(oItem, ITEM_PROPERTY_IMPROVED_EVASION, nDur, -1); } //Freedom of Movement (Permanent Item Property) if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_FREEDOM_OF_MOVEMENT)) { //Freedom of Movement (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_FREEDOM_OF_MOVEMENT, nDur, -1); } //True Seeing(Permanent Item Property) if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_TRUE_SEEING)) { //True Seeing (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_TRUE_SEEING, nDur, -1); } //These item properties should never be on a weapon (Trust me!) //On-Hit Slay (Sub Type must be defined) if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ON_HIT_PROPERTIES)) { //On-Hit Slay (These are the god powers of weapons, it's way too Uber) //Slay Specific Alignment (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_ON_HIT_PROPERTIES, nDur, IP_CONST_ONHIT_SLAYALIGNMENT); //Slay Alignment Group (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_ON_HIT_PROPERTIES, nDur, IP_CONST_ONHIT_SLAYALIGNMENTGROUP); //Slay Racial Group (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_ON_HIT_PROPERTIES, nDur, IP_CONST_ONHIT_SLAYRACE); //On-Hit Mordenkainen's Disjunction..(Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_ON_HIT_PROPERTIES, nDur, IP_CONST_ONHIT_MORDSDISJUNCTION); //On-Hit Dispel Magic (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_ON_HIT_PROPERTIES, nDur, IP_CONST_ONHIT_DISPELMAGIC); //On-Hit Vorpal Weapon Properties (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_ON_HIT_PROPERTIES, nDur, IP_CONST_ONHIT_VORPAL); //Feel free to add more On-Hit Proeprties here.. } //Spells I felt were too uber for most modules. //On-Hit Cast Spell (Removes a specific On-Hit Cast "thisspell" //NOTE: You must enter the IP_CONST to determine which on-hit_castspell to remove! if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ONHITCASTSPELL)) { //On-Hit Cast Destructions (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_ONHITCASTSPELL, nDur, IP_CONST_ONHIT_CASTSPELL_DESTRUCTION); //On-Hit Cast Chain Lightning (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_ONHITCASTSPELL, nDur, IP_CONST_ONHIT_CASTSPELL_CHAIN_LIGHTNING); //On-Hit Cast Ice Storm (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_ONHITCASTSPELL, nDur, IP_CONST_ONHIT_CASTSPELL_ICE_STORM); //On-Hit Cast Harm (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_ONHITCASTSPELL, nDur, IP_CONST_ONHIT_CASTSPELL_HARM); //Feel free to add more On-Hit Cast Spell Properties here! } //Item Cast Spell Properties (Removes Spells that can be cast from an item) //NOTE: You must define which spell you wish to remove, or all will be removed! if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_CAST_SPELL)) { //Time Stop (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_CAST_SPELL, nDur, IP_CONST_CASTSPELL_TIME_STOP_17); //Harm (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_CAST_SPELL, nDur, IP_CONST_CASTSPELL_HARM_11); //Drown (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_CAST_SPELL, nDur, IP_CONST_CASTSPELL_DROWN_15); //Flesh to Stone (Currently NOT Allowed) RemoveBadIP(oItem, ITEM_PROPERTY_CAST_SPELL, nDur, IP_CONST_CASTSPELL_FLESH_TO_STONE_5); //Feel free to add more Item - Cast Spell - Item Properties here.. //NOTE: There may be multiple examples for the spell (level dependent!) //Copy / paste one of the above functions but change the IP_CONST part only } //Remove Damage Resistance Type (removes all resistance for that type) //I only put in HOU Damages (you can add more) if(GetItemHasItemProperty(oItem, EFFECT_TYPE_DAMAGE_RESISTANCE)) { RemoveBadIP(oItem, EFFECT_TYPE_DAMAGE_RESISTANCE, nDur, IP_CONST_DAMAGETYPE_DIVINE); RemoveBadIP(oItem, EFFECT_TYPE_DAMAGE_RESISTANCE, nDur, IP_CONST_DAMAGETYPE_MAGICAL); RemoveBadIP(oItem, EFFECT_TYPE_DAMAGE_RESISTANCE, nDur, IP_CONST_DAMAGETYPE_NEGATIVE); RemoveBadIP(oItem, EFFECT_TYPE_DAMAGE_RESISTANCE, nDur, IP_CONST_DAMAGETYPE_POSITIVE); //Feel free to add more Resistance to Damage Types below //Example (Copy & Paste Below for more Types) ****>>>>> (Change only the XXXXXX) //RemoveBadIP(oItem, EFFECT_TYPE_DAMAGE_RESISTANCE, nDur, IP_CONST_DAMAGETYPE_XXXXXX); } //Remove Damage Reduction (Only the + Power is checked not the amount!) //Remove all +20 DR //NOTE: This removes all +20 / 5 to +20 / 50 Damage Reducitons on items if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_REDUCTION)) { //Remove +20 Damage Reduction (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_DAMAGE_REDUCTION, nDur, IP_CONST_DAMAGEREDUCTION_20); //You can add more +X Damage Reductions Item Properties below //Just copy/paste the example.. //EXAMPLE: (Copy / Paste Below & Change the X Amount) //Remove +X Damage Reduction (Currently Allowed) (CHANGE THIS PART ONLY: _X) //RemoveBadIP(oItem, ITEM_PROPERTY_DAMAGE_REDUCTION, nDur, IP_CONST_DAMAGEREDUCTION_X); } //Spell Resistance (You Can only Remove ALL Spell Resistance!) if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_SPELL_RESISTANCE)) { //Currently Disabled (delete the // below to NOT Allow Spell Resistance) //RemoveBadIP(oItem, ITEM_PROPERTY_SPELL_RESISTANCE, nDur, -1); } //Remove Immunity To Damage Type (Removes all immunity of That Type) if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE)) { //Divine (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE, nDur, IP_CONST_DAMAGETYPE_DIVINE); //Magical (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE, nDur, IP_CONST_DAMAGETYPE_MAGICAL); //Negative (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE, nDur, IP_CONST_DAMAGETYPE_NEGATIVE); //Positive (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE, nDur, IP_CONST_DAMAGETYPE_POSITIVE); //Feel Free to add more Immunity To Damage Types here... //EXAMPLE (Currently Allowed) ****>>>>>>>> (CHANGE THIS TO THE DAMAGE TYPE) //RemoveBadIP(oItem, ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE, nDur, IP_CONST_DAMAGETYPE_POSITIVE); } //If you wish to Allow any of these Item Properties //Simply type // before RemoveBadIP for the defined Item Property //ALL Immunity to a Spell School - (This only removes ALL School Immunities) if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_SPELL_SCHOOL)) { //(Currently NOT Allowed) Type // AT the start of the next line to ALLOW RemoveBadIP(oItem, ITEM_PROPERTY_IMMUNITY_SPELL_SCHOOL, nDur, -1); } //ALL Immunity to Spells By Level if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL)) { //(Currently NOT Allowed) Type // AT the start of the next line to ALLOW RemoveBadIP(oItem, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL, nDur, -1); } //Other Properties (Bonuses Vs Alignment or Race) //If you wish to Disallow any of these... //Simply delete the // before RemoveBadIP for the defined Item Property if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS_VS_ALIGNMENT_GROUP)) { //AC Bonus vs Alignment Group (Currently Allowed) //EXAMPLE: Delete the // below to NOT Allow this item property.. //RemoveBadIP(oItem, ITEM_PROPERTY_AC_BONUS_VS_ALIGNMENT_GROUP, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS_VS_RACIAL_GROUP)) { //AC Bonus vs Racial Group (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_AC_BONUS_VS_RACIAL_GROUP, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS_VS_SPECIFIC_ALIGNMENT)) { //AC Bonus vs A Specific Alignment (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_AC_BONUS_VS_SPECIFIC_ALIGNMENT, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ATTACK_BONUS_VS_ALIGNMENT_GROUP)) { //Attack Bonus vs An Alignment Group (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_ATTACK_BONUS_VS_ALIGNMENT_GROUP, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ATTACK_BONUS_VS_RACIAL_GROUP)) { //Attack Bonus vs A Racial Group (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_ATTACK_BONUS_VS_RACIAL_GROUP, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ATTACK_BONUS_VS_SPECIFIC_ALIGNMENT)) { //Attack Bonus vs A Specific Alignment (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_ATTACK_BONUS_VS_SPECIFIC_ALIGNMENT, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_ALIGNMENT_GROUP)) { //Enchantment Bonus vs An Alginment Group (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_ALIGNMENT_GROUP, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_RACIAL_GROUP)) { //Enchantment Bonus vs An Racial Group (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_RACIAL_GROUP, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_SPECIFIC_ALIGNEMENT)) { //Enchantment Bonus vs a Specific Alginment (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_SPECIFIC_ALIGNEMENT, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_ALIGNMENT_GROUP)) { //Damage bonus vs An Alignment Group (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_ALIGNMENT_GROUP, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_RACIAL_GROUP)) { //Damage Bonus vs A Racial Group (Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_RACIAL_GROUP, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_SPECIFIC_ALIGNMENT)) { //Damage Bonus vs A Specific Alignment(Currently Allowed) //RemoveBadIP(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_SPECIFIC_ALIGNMENT, -1); } //Damage Vulnerability if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_VULNERABILITY)) { //Damage Vulnerability (Currently ALLOWED) //RemoveBadIP(oItem, ITEM_PROPERTY_DAMAGE_VULNERABILITY, -1); } //DECREASED MODIFIERS (These are often used to cheat / exploit a bug!) //If you wish to allow these properties... //Type // before the RemoveBadIP if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ABILITY_SCORE)) { //Decreased Ability Score //EXAMPLE: Type // At the start of the next line to ALLOW This property.. RemoveBadIP(oItem, ITEM_PROPERTY_DECREASED_ABILITY_SCORE, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_AC)) { //Decreased AC RemoveBadIP(oItem, ITEM_PROPERTY_DECREASED_AC, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ATTACK_MODIFIER)) { //Decreased Attack Bonus RemoveBadIP(oItem, ITEM_PROPERTY_DECREASED_ATTACK_MODIFIER, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ENHANCEMENT_MODIFIER)) { //Decreased Enchantment Bonus RemoveBadIP(oItem, ITEM_PROPERTY_DECREASED_ENHANCEMENT_MODIFIER, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_DAMAGE)) { //Decreased Damage RemoveBadIP(oItem, ITEM_PROPERTY_DECREASED_DAMAGE, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SAVING_THROWS)) { //Decreased Saving Throw RemoveBadIP(oItem, ITEM_PROPERTY_DECREASED_SAVING_THROWS, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SAVING_THROWS_SPECIFIC)) { //Decreased Saving Throw (Specific) RemoveBadIP(oItem, ITEM_PROPERTY_DECREASED_SAVING_THROWS_SPECIFIC, -1); } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SKILL_MODIFIER)) { //Decreased Skill Modifier RemoveBadIP(oItem, ITEM_PROPERTY_DECREASED_SKILL_MODIFIER, -1); } //*********Options END**************** oItem = GetNextItemInInventory(oPC); //End Loop } //End Prototype } /////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // MAIN SCRIPT (DO NOT TOUCH!!!) ////////////////////////////////////////////////////////////////////// //Main Script.. void main() { object oPC = OBJECT_SELF; if(!GetIsPC(oPC))return; //First remove all items that are too valuable //OR have too many item properties //NOTE: This function identifies ALL ITEMS and //& Sets all Item's Plot Flag to Fase (Temporarially) RemoveAllBadItems(oPC); //Next cycle through the remaining items, and find all the items //with bad item properties and remove them! DelayCommand(0.2, RemoveAllBadIP(oPC)); //End Script.. } //PROTOTYPE (Defined) (Taken from the "x2_itemprop" Bioware Script) void RemoveBadIP(object oItem, int nItemPropertyType, int nItemPropertyDuration = DURATION_TYPE_TEMPORARY, int nItemPropertySubType = -1) { itemproperty ip = GetFirstItemProperty(oItem); // valid ip? while (GetIsItemPropertyValid(ip)) { // same property type? if((GetItemPropertyType(ip) == nItemPropertyType)) { // same duration or duration ignored? if(GetItemPropertyDurationType(ip) == nItemPropertyDuration || nItemPropertyDuration == -1) { // same subtype or subtype ignored if(GetItemPropertySubType(ip) == nItemPropertySubType || nItemPropertySubType == -1) { RemoveItemProperty(oItem, ip); } } } ip = GetNextItemProperty(oItem); } //End Prototype } /////////////////////////////////////////////////////////////////////////////// //PROTOTYPE (Defined) void RemoveAllBadItems(object oPC) { //Then cycle through all the items in thier inventory object oItem = GetFirstItemInInventory(oPC); while(GetIsObjectValid(oItem)) { if(GetIdentified(oItem)==FALSE) { //FIRST: Id All of the items in the inventory. SetIdentified(oItem, TRUE); } //SECOND: If it's a plot item, set it non-plot for a second if(GetPlotFlag(oItem)==TRUE) { SetPlotFlag(oItem, FALSE); DelayCommand(2.0, SetPlotFlag(oItem, TRUE)); } //NOTE: nMax must be set at the top of this script!!! if(GetGoldPieceValue(oItem)>nVMax) { //Destroy the item if it's too valuable DestroyObject(oItem, 0.0f); } int nInt = 0; itemproperty iProp = GetFirstItemProperty(oItem); while(GetIsItemPropertyValid(iProp)) { nInt++; if(nInt>nIp) { DestroyObject(oItem); } iProp = GetNextItemProperty(oItem); } oItem = GetNextItemInInventory(oPC); } //End Prototype } //PROTOTYPE DEFINED void CheckItemStacking(object oPC) { object oItem = GetFirstItemInInventory(oPC); itemproperty iProp = GetFirstItemProperty(oItem); int nInt = 0; while(GetIsObjectValid(oItem)==TRUE) { while(GetIsItemPropertyValid(iProp)) { nInt++; iProp = GetNextItemProperty(oItem); } //Zero out the intergal again! nInt=0; //Let's go onto the next item.. oItem = GetNextItemInInventory(oPC); } //Prototype End }