Jump to content
Sign in to follow this  
Reddbane

Changing Item Restrictions

Recommended Posts

I’m preparing to start editing and making custom kits of my own but one thing I have questions about is changing, adding, and removing item restrictions.


The first question is about setting up item restrictions using effects. I notice there are two entries that would seem to do this, “[180] Can’t Use Item” and “[181] Can’t Use Itemtype.” The use of “Can’t Use Item” is rather self-explanatory, you merely enter the String Reference of the desired item you want the class not to use, but “Can’t Use Itemtype”, which would seem to have broader uses, is less clear as it asks for “Item type.” Does anyone know where I can find a list of the codes for Item types as well as an identification of what they refer to?


The second question is more general: is there a easy way to alter a class’s item restrictions when creating a new kit, and moreover is there a way to ensure that it applies to new Items introduced by other mods, or do I have to recode each individual item to be usable by the specific kit? Say for example I wanted to create a mage kit that can gradually learn to wear heavier armors and cast spells; which also brings up the question as to how can I make it so that certain kit can cast spells in Heavy armors?


The third question is: is there a way to make it so that certain one-handed weapons can only be equipped in the main hand and not the offhand?


Thanks.

Share this post


Link to post

You are out of your depth with those things, they can't be done.

The games item restrictions are very .itm based, as in, all the files have their own usability flags and they are all occupied already. Then the old engine didn't use the two opcodes at all because they didn't work.

 

The new engine can use them, but I bet that you can't use them to allow use of items that you can't use already in the native class. Aka mages can't use armors(leather, chain and plate etc.), so you won't be able to do that in the new engine either. Unless you really go ham with use of those opcodes and mess up the whole usability flag system. I recommend that you won't. Cause you'll fail spectacularly in every case where the user wants to add something that you haven't ...

Share this post


Link to post

Everyone who starts making mod kits at some point thinks to themselves "I want a feature/disadvantage of this kit to be different item usability!" And they all come here and ask how it can best be done. And the answer is always the same: it can't be done well, easily. Best to come up with other features or disabilities.

 

There is a usability flag for each class in the game and a usability flag for each kit. And no extra flags for extra kits. So we are bound to have new kits mimic existing ones.

 

The usability flags restrict item use by a class or kit - they don't allow it. So you generally can't make kits with more permissive item usability than their base class.

 

The usability flags are in the item files, not in the kit characteristics. So the only way to edit them is to edit all item files... and then you mess up those items' usability for other classes/kits.

 

I believe the flag that prevents arcane spell use in armor is in the armor files, not in the class or kit characteristics. So there's no way to make it work at certain levels... and there's no way to turn it on for one kit without opening up casting in armor for all magic-users.

 

You don't see many wizard kit mods... that's because on the TOB engine there is no way to make wizard kits appear in the kit selection menus. It can be done on EE 2.0+, but even there it's not easy to do it in a way that doesn't mess up other mods.

 

Now... all that said, and contrary to Jarno's claim above, you can do some interesting stuff with usability. E.g. I've given thieves choosable abilities that, when cast, enable them to use wands or scrolls. This is only possible on the EE engine, by using a combination of opcodes 181 and 321, and a bit of clever coding to make sure it doesn't fail on kits added by other mods.

 

But it took me a long while to figure how to do that, and it involve several techniques that I learned and added to my repertoire over the last year. I advise you to set your sights a bit lower and start out making some mods with simpler techniques, and get comfortable getting to know what can and can't be done in the engine.

Edited by subtledoctor

Share this post


Link to post

ToBEx fixed Opcode 181 before the EEs even came out.

 

Even with that, kit usability is a huge pain in the ass. From a design pov, ask yourself is this really necessary to make your kit distinct. If so, it's probably a milquetoast kit and should be given a more substantial fleshing out.

Share this post


Link to post

Now... all that said, and contrary to Jarno's claim above, you can do some interesting stuff with usability. E.g. I've given thieves choosable abilities that, when cast, enable them to use wands or scrolls.

Or you could be a non hard ass and allow the the chars to use those items not based on class, but on their ability scores ... like Int and Cha, Wis etc. ...depending what the item is based on. Wis for priest scrolls, Int for mage, and Cha.

That's interesting, adding ability that allow to bypass that for a few turns is not interesting, it's annoying, for consistency. "Yeah, even though I am clever as any God, I am not suited cause I idiotically used the thing already today, I'll do it tomorrow."

 

Ouh, yeah don't mind the "friendly chatter" between the regular forum members, it's there for "acts of drama", it's not for any other purpose than to bug the other a bit. :devlook:

Share this post


Link to post

So does anyone know “[181] Can’t Use Itemtype.” refers to as itemtype? Is it the number under the category (such as "Amulets and necklaces (1)" or "Armor (2)"). If so it can work for my purposes, that is remaking rather than merely editing the Kensai kit with different item restrictions, that is to say outright deleting the old Kensai kit and creating a new kit, also called Kensai and coding its item restrictions as added effects to make it closer to PnP, that is it cannot use armor bracers but can use gauntlets, can use missile weapons but cannot specialize in them nor do they gain their Kensai bonuses with them.

 

Update: By the way I just used the “[181] Can’t Use Itemtype.” and it appears I can code item restrictions to a kit rather than by individual item, you can even do weird things like prevent the class from using potions or notes. This would to be very useful in ensuring new kits are compatible with mods that introduce new items.

 

Also I know Tome and Blood by Aquadrizzt introduced a sorcerer kit that could, gradually as it leveled up, learn to equip and cast in armor; so it can be done, I was just wondering if any of you knew how to do it.

 

Also can anyone address my question about dual wielding and weapons in the offhand?

Share this post


Link to post

So does anyone know “[181] Can’t Use Itemtype.” refers to as itemtype? Is it the number under the category (such as "Amulets and necklaces (1)" or "Armor (2)"). If so ...

Well, I haven't seen it in anywhere officially, but try to find if these are the item types.

Share this post


Link to post

That's interesting, adding ability that allow to bypass that for a few turns is not interesting, it's annoying, for consistency. "Yeah, even though I am clever as any God, I am not suited cause I idiotically used the thing already today, I'll do it tomorrow."

It's a permanent feat: e.g. at level 5 you can choose "Use Wands" or "Use Scrolls" or "Luck Bonus" or "Thac0 Bonus" etc... and after that you have the capability forever.

 

So does anyone know [181] Cant Use Itemtype. refers to as itemtype? Is it the number under the category (such as "Amulets and necklaces (1)" or "Armor (2)").

Yes, this.

Also I know Tome and Blood by Aquadrizzt introduced a sorcerer kit that could, gradually as it leveled up, learn to equip and cast in armor; so it can be done,

I'm familiar with TnB, I actually contributed several components to it. And that's not exactly what Aquadrizzt does with the "Armored Casting" component. Notice, he doesn't just make a kit that can cast in armor; for that kit to work, the player first has to install the "Armored Casting" component that makes changes to ALL armors for ALL casters.

 

Also can anyone address my question about dual wielding and weapons in the offhand?

Not possible AFAIK. The only single-handed weapons you can't equip in your off-hand are throwing weapons. But if you code a melee item as a throwing weapon then it will incur all of the thac0/AC penalties of when you use a ranged weapon against melee opponents. That stuff is hard-coded. Edited by subtledoctor

Share this post


Link to post

Someday maybe I'll make a mod that removes all the "item Unusable by" Codes attached to the items and code the restrictions into the individual classes. I wonder if I could program weidu to remove class restrictions from all items (although I'd probably have to leave some in) currently in the game, even ones the user installed by mods.

Share this post


Link to post

There are several flags in the item codes that seem to refer to off-hand use: "EE: Forbid off-hand weapon," "Off-handed," and "Left-handed." However toggling any of them individually in Near Infinity doesn't seem to do anything at the moment.

Share this post


Link to post

Someday maybe I'll make a mod that removes all the "item Unusable by" Codes attached to the items and code the restrictions into the individual classes. I wonder if I could program weidu to remove class restrictions from all items (although I'd probably have to leave some in) currently in the game, even ones the user installed by mods.

Pretty sure you have to set some of the usability flags on as that's restricting them from use which you can't then undo with the opcode(but you actually remove the non usability restrictions, which is what the .itm's have). See next.

Yes, that can be done, you just use a very simple weidu .tp2 -command that allows all item usage, something to this vain:

//items 
COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~
//class and other stuff
WRITE_BYTE 0x001e ~0b0000 0000~ //or 0x00 which ever you prefer
WRITE_BYTE 0x001f ~0b0000 0000~
WRITE_BYTE 0x0020 ~0b0000 0000~
WRITE_BYTE 0x0021 ~0b0000 0000~

//and then the kits
WRITE_BYTE 0x0029 ~0b0000 0000~
WRITE_BYTE 0x002b ~0b0000 0000~
WRITE_BYTE 0x002d ~0b0000 0000~
WRITE_BYTE 0x002f ~0b0000 0000~

And then you add what ever restrictions you wish to the kit clab....2da -files. Not that that's easy. And this doesn't touch the item descriptions either.

And then hope that munchkins don't eat all your work by installing anything that reverts this all.

Edited by Jarno Mikkola

Share this post


Link to post

Someday maybe I'll make a mod that removes all the "item Unusable by" Codes attached to the items and code the restrictions into the individual classes. I wonder if I could program weidu to remove class restrictions from all items (although I'd probably have to leave some in) currently in the game, even ones the user installed by mods.

That's an idea, but such a mod would be incompatible with almost every other mod in existence unless you take pains to include automatic alorithms to handle game assets from all other mods, and all other possible mods.

 

Which is not impossible - I've done it in a limited fashion in my NPC_EE mod, and in a much more comprehensive way for the sphere system and deity-choice dialogue in our upcoming Faiths & Powers mod. But if you take a look at the F&P code, you'll see that it is not for the faint of heart. I don't recommend something like that for your first effort with Weidu.

Edited by subtledoctor

Share this post


Link to post

Druidic Sorcerer can cast arcane spells while wearing armor because of SPDMARSC.SPL, which gives Immunity to Effect (101), the effect is Disable Spellcasting (145).

Share this post


Link to post

Druidic Sorcerer can cast arcane spells while wearing armor because of SPDMARSC.SPL, which gives Immunity to Effect (101), the effect is Disable Spellcasting (145).

Yeah, and install a Item Revisions component and you'll get slower spell casting(from opcode effect 189), chance to fail at casting(from opcode effect 60) and other fun things(like from opcode 191). This is why the "Armored Casting" needs to be installed before the kit mod that utilizes a known counter measure. Like Subtledoctor said. Edited by Jarno Mikkola

Share this post


Link to post
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×