Jump to content

Is it possible to make certain weapons usable ONLY if the character has profiency points in it?


Recommended Posts

Short answer: no.

There are a lot interesting ways that you can gate spells with various conditions that can be changed during the game: you could apply a “turned evil” spellstate during the game and then make paladins’ Lay On Hands ability fail. Or make it operate like Cause Wounds. Lots of stuff like that. 

But item usability is severely restricted. It can only be done by 1. class/kit exclusion flags (which can’t reasonably be changed in-game); 2. opcode 180 and 181 (restrict individual weapons, and restrict weapon types); 3. opcode 319 (a conditional restriction on the weapon itself, but it can only be conditioned on the same stuff as op177 - nothing that can be changed during the game). 

I guess you could apply opcode 181 to restrict the ‘Axe’ item type, and then when you get proficiency with axes use opcode 321 to cancel the op181 effect. Problem is, proficiencies do not map 1:1 to item types (item type basically maps to the BG1 proficiency system). So it would take lot of effort to make it work properly, and possibly mess up compatibility with several mods. 

Ultimately, you might notice that fighters have less of a nonproficiency penalty than other classes. The design intent is for fighters to actually use nonproficient weapons - it’s basically a class feature. 

Link to comment

Not directly, but there's still something.

The tools available for specifying item usability restrictions:

- The item's own usability flags and minimum stat requirements. Only allows for class/race/attribute/alignment limits, so it's not useful here.

- itemuse.2DA. Restricts an item to only be used by a specific NPC; the character-specific gear in BG2 like Jan's gloves are restricted this way. Not useful here.

- Opcode 180/181. Apply this to a character to forbid them from using the specified item or item type.

- Opcode 319. Apply this to an item to restrict its use based on one of a variety of conditions; allegiance, general type (i.e humanoid, undead, etc.), race, class, specific type (a bunch of one-offs like SPECTACLES_QUEST), gender, alignment, kit, name, and script name.

I see two ways to restrict an item based on proficiencies.

- The opcode 319 method: Create a new entry in specific.IDS, then have a global script apply the ChangeSpecifics() script action to characters with the specified proficiency. Give the item you want to restrict an opcode 319 effect tied to that new entry. Unfortunately, a creature can only have one specific type. This is only viable for tracking one proficiency, globally. If you add a second item which wants to track a different proficiency, it all breaks down.

- The opcode 180 method: Create a spell that applies an opcode 180 effect tied to the item you want to restrict (or opcode 181 for the type), and a counter for it. Have a global script apply that spell to characters that don't have the proficiency, and the counter to characters that do.

And as a matter of design intent, I agree with subtledoctor. Being able to use non-proficient weapons at a penalty (which varies based on class) is absolutely part of the system. Applying something like this to broad categories is a bad idea. You might be able to get away with "this particular axe can only be used in combat by those who have mastered the use of axes", but not "you can't use an axe at all unless you've trained with the weapon".

Link to comment
2 hours ago, jmerry said:

The opcode 319 method: Create a new entry in specific.IDS, then have a global script apply the ChangeSpecifics() script action to characters with the specified proficiency. Give the item you want to restrict an opcode 319 effect tied to that new entry. Unfortunately, a creature can only have one specific type

This is where I landed when remaking Refinements’ Use Scrolls code. Refinements addressed basically this exact situation, and the old solution was to add potentially hundreds of extra kits to the game, and do a kit-change to enable usability. I tried many variations of op180 and op181 before landing on op319 and SPECIFIC values. You don’t even need scripts - Refinements sets the SPECIFIC value restricting use with a spell, and then enables use by canceling that spell with op321. It works great but it’s not ideal, it needs special handling for SoD and any other mod using SPECIFIC will potentially be incompatible  with Refinements.

I petitioned Beamdog to liberalize op319 to work with stats and spellstates etc. back in ~2015. Naturally, they ignored me. :(

Opcode 180 could actually get this done, BUT: the UX is not great because it doesn’t show red borders when an item is not usable, and it makes install order very important since it would not apply to any items added after this mod. 

Link to comment

@subtledoctor @jmerry, I understand in terms of the design of the system that characters suffer penalties when using non-proficient weapons. Interesting to see other ways to restrict characters from using certain weapons, I'll investigate further what would be ideal for my mod. I'll also take a look at these "Refinements’ Use Scrolls code".

Thanks again!

54 minutes ago, subtledoctor said:

I petitioned Beamdog to liberalize op319 to work with stats and spellstates etc. back in ~2015. Naturally, they ignored me. :(

It's a shame there doesn't seem to be a lot of collaboration between Beamdog and Gibberlings3, I think the potential is massive for such a company to work directly with the community in improving the game engine instead of as bug testers...

Link to comment
3 hours ago, subtledoctor said:

... on op319 and SPECIFIC values. ... it needs special handling for SoD ...

What's this ... oh. Search scripts for the ChangeSpecifics action, find lots of entries. The Specifics field gets used as a marker for faction allegiance, and SoD companions get theirs set to ALLIES every time they're moved to a new camp. Yeah, that would require special handling. I'd definitely have to look up what actually checks those values before I did anything with the field on party members in that campaign.

Link to comment
38 minutes ago, jmerry said:

Yeah, that would require special handling. I'd definitely have to look up what actually checks those values before I did anything with the field on party members in that campaign

IIRC Ardanis coded that in SoD, and he gave me some code to make them witk together. I’m not entirely sure how it works, but it does, so I don’t ask questions. 

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
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.

×
×
  • Create New...