This script uses valuebased ILR checking (which takes into account prc items), that can be overridden by usage of the 'ilr_custom_override' variable (integer) on an item. Additionally it allows for you to set a deity variable called 'ilr_deity' (string) so that only if the player has that Deity name in his deity field will he be able to equip the item. And lastly you can forbid by type of item versus deity as well (which you will need to script by hand) and i have included an example of forbidding short swords to akadi worshippers Note: you do NOT need to set the module to item level restrictions on, you just have to put this script in the onequip script event under module properties. Note: Version 0.6 available here now, please use this version over any older ones!
Hello, this script work in the world of lodor case of where ilr must be turn off?. Greetings.
Posted by Shadow_Avenger at 2005-03-0300:55:00
Nice, using a modified earlier version. The delay command on the unequip was missing before, but i sorted that. One note, it is still exploitable. There is no way round this that I have found atm. I would not expect many to findout how it is done, but some will. I don't want to post the exploit for obvious reasons. I would suggest you add script to onclient enter the runs the ilr based on client enter aswell, Then if a play has exploited, when they relogg, items are auto unequiped.
Posted by Anonymous at 2005-02-2817:57:00
//EDITED TO CORRECT OVER RUNNING SCRIPT ON AMUNITION //Also edited to make it work right // BY:SCHWAGMASTER 02-23-05 const string ILR_VARIABLE_NAME = "ilr_custom_override"; const string ITEM_DEITY_NAME = "ilr_deity"; // A structure for passing data around the functions here. struct itemRestriction{ // This determines whether the wielder is allowed to wield the item // Values to use: // -1 Item use forbidden by this test, stop further testing. // 0 Item use allowed by this test, pass to next test. // 1 Item use allowed by this test, stop further testing. int nAllow; // Message to send to the equipping PC. This is ignored if nAllow is 0. string sMessage; }; void actionForceUnequipItem(object oItem, object oPC, string sMessage); int GetIsInstanceOfPRCItem(string sResRef); struct itemRestriction GetDeityRestriction(string sDeity, object oItem, object oPC); struct itemRestriction GetItemLevelRestriction(object oItem, object oPC); void main() { object oPC = GetPCItemLastEquippedBy(); object oItem = GetPCItemLastEquipped(); int iTyp = GetBaseItemType(oItem); // Handle special PRC class items string sResRef = GetResRef(oItem); if(GetIsInstanceOfPRCItem(sResRef)) return; if(iTyp == BASE_ITEM_ARROW)return; if(iTyp == BASE_ITEM_BOLT)return; if(iTyp == BASE_ITEM_BULLET)return; if(iTyp == BASE_ITEM_DART)return; if(iTyp == BASE_ITEM_SHURIKEN)return; if(iTyp == BASE_ITEM_THROWINGAXE)return; // DMs get to equip whatever they like if(!GetIsDM(oPC) GetIsPC(oPC)) { struct itemRestriction Result; // Example restriction block /* dataType Foo = GetData(oPC); Result = GetSomeRestriction(foo, oItem, oPC); switch(Result.nAllow){ case -1: actionForceUnequipItem(oItem, oPC, Result.sMessage); case 0: break; case 1: if(Result.sMessage != "") SendMessageToPC(oPC, Result.sMessage); return; } */ // Handle deity restriction string sDeity = GetDeity(oPC); Result = GetDeityRestriction(sDeity, oItem, oPC); switch(Result.nAllow){ case -1: actionForceUnequipItem(oItem, oPC, (Result.sMessage != "" ? Result.sMessage : sDeity + " does not allow you to wield " + GetName(oItem))); case 0: break; case 1: if(Result.sMessage != "") SendMessageToPC(oPC, Result.sMessage); return; } // Handle restriction by item level Result = GetItemLevelRestriction(oItem, oPC); switch(Result.nAllow){ case -1: actionForceUnequipItem(oItem, oPC, Result.sMessage); case 0: break; case 1: if(Result.sMessage != "") SendMessageToPC(oPC, Result.sMessage); return; } } } void actionForceUnequipItem(object oItem, object oPC, string sMessage = "") { if(sMessage != "") SendMessageToPC(oPC, sMessage); SetCommandable(FALSE, oPC); DelayCommand(0.3, SetCommandable(TRUE, oPC)); AssignCommand(oPC, ClearAllActions(TRUE)); AssignCommand(oPC, ActionUnequipItem(oItem)); } int GetIsInstanceOfPRCItem(string sResRef) { if(sResRef == "base_prc_skin") return TRUE; if(sResRef == "pnp_shft_tstpkup") return TRUE; if(sResRef == "listenerhide") return TRUE; if(sResRef == "shifterhide") return TRUE; if(sResRef == "lichamulet") return TRUE; if(sResRef == "soul_gem") return TRUE; if(sResRef == "platinumarmor4") return TRUE; if(sResRef == "platinumarmor6") return TRUE; if(sResRef == "platinumarmor8") return TRUE; if(sResRef == "wp_arr_imbue_1") return TRUE; if(sResRef == "runescarreddagge") return TRUE; if(sResRef == "codi_mw_katana") return TRUE; if(sResRef == "codi_mw_short") return TRUE; return FALSE; } struct itemRestriction GetDeityRestriction(string sDeity, object oItem, object oPC) { struct itemRestriction Result; Result.nAllow = 0; Result.sMessage = ""; sDeity = GetStringLowerCase(sDeity); string sItemDeity = GetStringLowerCase(GetLocalString(oItem, ITEM_DEITY_NAME)); if(sItemDeity != "") { if(sItemDeity != sDeity) { Result.nAllow = -1; Result.sMessage = "This item is restricted to followers of " + sItemDeity + "."; } } return Result; } struct itemRestriction GetItemLevelRestriction(object oItem, object oPC) { struct itemRestriction Result; Result.nAllow = 0; Result.sMessage = ""; int iItemLevel = 1; int iClassLevel = GetLevelByPosition(1,oPC) + GetLevelByPosition(2, oPC) + GetLevelByPosition(3, oPC); if(GetLocalInt(oItem, ILR_VARIABLE_NAME)) { iItemLevel = GetLocalInt(oItem, ILR_VARIABLE_NAME); } else { int iGPValue = GetGoldPieceValue(oItem); if (iGPValue > 4000000) iItemLevel = 40; else if (iGPValue > 3800000) iItemLevel = 39; else if (iGPValue > 3600000) iItemLevel = 38; else if (iGPValue > 3400000) iItemLevel = 37; else if (iGPValue > 3200000) iItemLevel = 36; else if (iGPValue > 3000000) iItemLevel = 35; else if (iGPValue > 2800000) iItemLevel = 34; else if (iGPValue > 2600000) iItemLevel = 33; else if (iGPValue > 2400000) iItemLevel = 32; else if (iGPValue > 2200000) iItemLevel = 31; else if (iGPValue > 2000000) iItemLevel = 30; else if (iGPValue > 1800000) iItemLevel = 29; else if (iGPValue > 1600000) iItemLevel = 28; else if (iGPValue > 1400000) iItemLevel = 27; else if (iGPValue > 1200000) iItemLevel = 26; else if (iGPValue > 1000000) iItemLevel = 25; else if (iGPValue > 750000) iItemLevel = 24; else if (iGPValue > 500000) iItemLevel = 23; else if (iGPValue > 250000) iItemLevel = 22; else if (iGPValue > 130000) iItemLevel = 21; else if (iGPValue > 109999) iItemLevel = 20; else if (iGPValue > 89999) iItemLevel = 19; else if (iGPValue > 74999) iItemLevel = 18; else if (iGPValue > 64999) iItemLevel = 17; else if (iGPValue > 49999) iItemLevel = 16; else if (iGPValue > 39999) iItemLevel = 15; else if (iGPValue > 34999) iItemLevel = 14; else if (iGPValue > 29999) iItemLevel = 13; else if (iGPValue > 24999) iItemLevel = 12; else if (iGPValue > 18499) iItemLevel = 11; else if (iGPValue > 14999) iItemLevel = 10; else if (iGPValue > 11999) iItemLevel = 9; else if (iGPValue > 8999) iItemLevel = 8; else if (iGPValue > 6499) iItemLevel = 7; else if (iGPValue > 4999) iItemLevel = 6; else if (iGPValue > 3499) iItemLevel = 5; else if (iGPValue > 2499) iItemLevel = 4; else if (iGPValue > 1499) iItemLevel = 3; else if (iGPValue > 999) iItemLevel = 2; } if (iItemLevel > iClassLevel) { Result.nAllow = -1; Result.sMessage = "You are not high enough level to equip " + GetName(oItem) + ", you must be at least level: " + IntToString(iItemLevel) + "."; SetCommandable(FALSE, oPC); DelayCommand(0.3, SetCommandable(TRUE, oPC)); DelayCommand(0.7, AssignCommand(oPC, ClearAllActions(TRUE))); DelayCommand(1.0,AssignCommand(oPC, ActionUnequipItem(oItem))); } return Result; }
Posted by Anonymous at 2005-02-2817:52:00
hi , I've been using your script. You may want to put if(basitemarrow)return; or something and just let bolts arrows and bullets go past the irl.. If not, your script gets called many times when the archers or slingers start running out of ammunition, and , when bio execute starts look thru inventory to equip them. A lot of people will go thru and stack their arrows in stacks of 10 or so, heh amazing the holes people find. So they can bypass the irl. So I figured, they have to have passed ilr to use their weapon such as bow, xbow, sling etc. Just let the ammo go thru until a better fix is around.
Posted by silvercloud at 2005-02-2616:48:00
You're right, you can send me the updated script if you want to contribute. I'm willing to put the bioware values back into the script and make an update.
Posted by Rusty_Dunestalker at 2005-02-2114:16:00
I used the script, and one of my players noticed something odd. One piece of armour (which I had labelled as a level 10 item) was telling him he had to be level 11 to wear it. I checked the code, and the value was wrong. In fact, all of the values before level 21 are wrong. The value for level 11 should be 19500, not 18499. Here's what I posted to him on my forums in response to his irritation: I didn't type in the number wrong. Apparently the script I got to replace Bioware's ILR has an error in it. I will check it out, and see what's going on. I went through all of the values up to 21st level items, and I figured out what the script did wrong. There are two things, really. 1- Bioware's system works off odd values to start a new level for ILR. So, to be a 2nd level item, it needs to have a value of 1001 gp. The script looks for a value of > 999, which would include 1000, which is wrong. That, however, was not the problem for the +3 studded leather with bull strength. What happened there was they simply put in a very wrong value. I figure they just simply made a typo, or got sloppy in checking ILR levels. The STRANGEST part of the script is that they got the first 20 levels wrong, and then did it right for levels 21+. Not that I've checked the values, but that they set it so 21st level is > 130000, instead of 129999. It's like 2 completely different people wrote the script, and didn't bother to check each other's values... or someone realized their mistake half way through, and was too lazy to go back and fix it (it only took me a minute or two to go through and retype the values... so they're even lazier programmers than I am, and that's saying something...) ;)
Posted by silvercloud at 2005-02-1011:25:00
0.5 now added here, it prevents cheating, in the fact that it wont allow the bug by evergrey to work, but you can still equip an item visually, even though its abilities and properties do not affect the creature.
Posted by Evergrey at 2005-02-1010:02:00
Nice script here, but you have the same problem that the one i sue for my module, players can cheat with this script... I'll mail you the problem, maybe you will be able to find an issue.
Posted by silvercloud at 2005-01-3116:04:00
0.4 sorry about the bug in 0.3 that didnt allow it to unequip
Posted by silvercloud at 2005-01-2303:14:00
I updated both files, just make sure it says 0.3 beta on the top