Jump to content

Modders' use of limited resources


Recommended Posts

3 hours ago, CamDawg said:

For the EEs, you can just apply 319s to the relevant items

...

180 is a questionable tradeoff--it's inferior for a number of reasons (e.g. the item doesn't get tinted red, no description update) which makes your stuff stick out as mod content, but the alternative is monopolizing a limited resource.

A bit inside baseball, but: the abandoned "Faiths of Faerun" used opcode 180.  The more recent "Deities of Faerun" mod used opcode 319.  Application of 319 is very simple, but at the time I was worried about this stuff the EE engine was suffering from some nasty stutters in the inventory screen, and there was some anecdotal evidence that opcode 319 might have contributed to it.  In "Faiths and Powers" we add something like 200+ kits, and the thought of adding that many 319 effects to every weapon, which would have to be evaluated every time you go to the inventory screen, scared me away. It turns out it would have been fine, but we had to make a decision based on the infor available to us at the time.

So we use opcode 181, which IMHO is working pretty great:

  • You get red borders and the like, so it's better than opcode 180
  • It doesn't litter every weapon with dozens or hundreds of opcode 319 effects
  • We are talking about kit-based usability, so applying this sort of thing in the CLAB kit tables makes a lot of sense

The only hitch is that opcode 181 operates via item type, so it was necessary to swap or separate out the members of various "item type" categories (e.g. "large swords"). Getting it such that there is a 1:1 correspondence between item types and weapon proficiencies allowed us to create a functionally unlimited kit-based weapon usability system. It's very nice.  We could have done the same with armors, by breaking out leather/chain/plate armors from item type 2 into their own category types, which IIRC already exist but are currently unused. But there are three varieties of armor and three cleric kit flags, so it was simpler to use the traditional usability flags for armor.

Link to comment
44 minutes ago, suy said:

OK, so seems one of the proficiencies is free. But say that I need two, so let's look at the previous one (133). Looking at the spell I find that it has this two effects

...

The one that modifies proficiencies was expected, of course, but I'm confused by the fact that two effects are needed, and using a different approach

Spellstates are an EE innovation. There are 256 available in the game, which can simply be set to 1 or 0. This can handle a lot of the load that DS stats do; all of the spellstates and DS uses for them take up less space (bits) than one quarter of one single proficiency stat; it is very efficient, and very handy when paired with something like opcode 318 or 326. However spellstates didn't exist in the pre-EE engine, so DS used proficiencies instead, which were the best thing available. (IIRC there was not much sense back then of just how useful those proficiencies could be for other purposes; and anyway, a good portion of that utility was only exposed by advances in the EE engine.)

So long story short I believe SCS currently applies both a spellstate and a prof.  IIRC SCS when installed on the EE engine will use the spellstates... but other mods might look for an use the prof. They can work together interchangeably, but for that to happen both need to be applied, so you can free up a prof. BUT

50 minutes ago, suy said:

found very few occurrences on the AI scripts of CLERIC_DEFENSIVE_HARMONY, and all seem to be triggers of enemy scripts on enemies themselves of only two kinds: green dragon and priest. If I were to use this proficiency to allow some incompatible class like Sorcerer or Monk (which can't be dual/multi with Priests), initially this would not collide

Yes. If you do it carefully, you can use some of these proficiencies in ways that don't interfere with DS. As an example, I think I recall using the "WIZARD_KHELBENS_WARDING_WHIP" proficiency (stat 132) with a feat for some kind of martial class that could not multi- or dual-class with wizard. You need to be careful, but you can find ways in which the current DS profs are circumscribed, and use one in your own way which is itself circumscribed such that they never interfere.

Also, note that it is hard to give good advice without knowing details of your specific desired implementation. If you just want to add another proficency - give wakizashi its own, or something - then you can do that pretty simply with stat 134. But if you don't need an actual proficiency that is just like the other weapon proficiencies - chosen using your normal weapon proficiency points, appearing on the record screen as a weapon proficiency, etc. - then there may be solutions. Especially if you are targeting the EEs.

And of course another option is to collapse existing proficiencies to free up a few. Various mods do this (CDTweaks can give the the BG1 or IWD system, SoB creates a custom one).  You could use stat 89, bastard sword proficiency, for your new thing; you would check whether one of those mods is installed; if so, great, stat 89 is unused; if not, then you would yourself change all bastard swords from 89 to 90 (long sword proficiency). Something like that.

Link to comment
1 hour ago, subtledoctor said:

So long story short I believe SCS currently applies both a spellstate and a prof.  IIRC SCS when installed on the EE engine will use the spellstates... but other mods might look for an use the prof.

Not quite. SCS assumes either EE or ToBEx, which has extended stats. Anything SCS uses as a spellstate on EE is used on oBG2 as a ToBEx extended stat. (And SCS's spellstates are mostly (not entirely) the ones introduced by the EEs. (My 'notes on current usage.txt' is the pre-SCS usage.)

Of the proficiencies that are still used, a few of them need to have multiple values (WIZARD_SPELL_DEFLECTION, CLERIC_INSECT_PLAGUE, WIZARD_SPELL_TURNING). A few of them are redundant given spellstates/extended stats: CLERIC_CHAOTIC_COMMANDS, WIZARD_FIRE_SHIELD, WIZARD_PROTECTION_FROM_MAGIC_WEAPONS. The rest could be, but so far haven't been, replaced with spellstates. 

Of course, the problem is backwards compatibility, since plenty of older mods use the old proficiencies. In principle one could write auto-clearout code that mapped an existing installation onto a new system, but I think it would cause as much trouble as it solved (use it too early, and it'll get overwritten by new mods; use it too late, and it might overwrite intentional uses of the new proficiencies).

I am in any case *somewhat* inclined to map SCS, at least, over to a new system when I next release it. That would free up 11 proficiencies. Of course, splstate isn't an infinite resource either, but there are about 120 slots spare (of which SCS uses about 30, I think) so that's not too demanding a constraint.

Link to comment

Thanks the clarification, David. In my case, I'm thankfully not too concerned with other mods (for now at least), as I think SCS is the only one that has complex spell/scripting that requires Detectable Spells (of the ones that I use and could actually support if I publish a mod, I mean). If eventually your copy of Detectable Spells gets changed to free more proficiencies, better yet.

About my mod/use case: I did some experiment a while ago (without even WeiDU, just manual changes with NearInfinity), where I granted the Monk class some special bonuses/abilities based on proficiency points. E.g., given that they can't (normally) use 2 handed weapons, I enabled that proficiency for the class, and then made them gain bonuses with the fists when had a certain amount of points. I think those usual fighting style proficiencies are fine enough to make a decent mod (even more now that I recently learnt thanks to OlvynTweaks that one can expand fighting styles to 5 points instead of just 2/3). But I wanted to know if the limits could be pushed a bit more, and GrammarSalad paved the way for me. :)

Thank you again, I've learnt a lot, and hopefully I've clarified this for less experienced people like me. This topic is very interesting.

Link to comment
On 8/30/2021 at 10:43 AM, CamDawg said:

For the originals, 180 is a questionable tradeoff--it's inferior for a number of reasons (e.g. the item doesn't get tinted red, no description update) which makes your stuff stick out as mod content, but the alternative is monopolizing a limited resource.

Yup, definitely. No argument here.

On 8/30/2021 at 12:15 PM, suy said:

The one that modifies proficiencies was expected, of course, but I'm confused by the fact that two effects are needed, and using a different approach.

Yeah, not sure why...my hope was that the update would stop using detectable spells completely and just add new spells states, but alas. My best guess is for compatibility (especially with those mods that will never see updates...)

On 8/30/2021 at 12:15 PM, suy said:

Can Detectable Spells be changed to only use spell states? Should it? Or is it needed for compatibility with pre-EE games or older Detectable Spell versions?

I don't know the answer but I really want it to be yes.

 

Link to comment
On 8/30/2021 at 4:41 PM, suy said:

Thanks the clarification, David. In my case, I'm thankfully not too concerned with other mods (for now at least), as I think SCS is the only one that has complex spell/scripting that requires Detectable Spells (of the ones that I use and could actually support if I publish a mod, I mean). If eventually your copy of Detectable Spells gets changed to free more proficiencies, better yet.

About my mod/use case: I did some experiment a while ago (without even WeiDU, just manual changes with NearInfinity), where I granted the Monk class some special bonuses/abilities based on proficiency points. E.g., given that they can't (normally) use 2 handed weapons, I enabled that proficiency for the class, and then made them gain bonuses with the fists when had a certain amount of points. I think those usual fighting style proficiencies are fine enough to make a decent mod (even more now that I recently learnt thanks to OlvynTweaks that one can expand fighting styles to 5 points instead of just 2/3). But I wanted to know if the limits could be pushed a bit more, and GrammarSalad paved the way for me. :)

Thank you again, I've learnt a lot, and hopefully I've clarified this for less experienced people like me. This topic is very interesting.

Edit: I see we've had some activity since last I was here. Ah good! I'm glad to have helped, if inadvertently! You just made my day! 

 

Link to comment

As discussed in another thread starting here, it has become apparent that a number of different mods check for whether the party has rested by checking for Fatigue = 0, and then setting Fatigue to 1 after the check returns true, to prevent repeated application of whatever the mods do. This problematic, because these can all interfere with each other. As I stated there,

Quote

As I've been thinking about this, I realized that ANY mod that changes Fatigue from 0 to another value can potentially interfere with any other mod that needs to check for when the party goes to sleep for eight hours. (And it seems that we have both independently determined that checking for Fatigue = 0 is the only reliable way to keep track of that.) So for best results, no mod can lay claim to being able to change the Fatigue stat; we all should leave it alone.

Simple enough principle.

...

Also, if any moderators are around, this thread might perhaps be better off in the 'Modding How-Tos' forum. (It's where I went to look for it, and I got momentarily confused when I couldn't find it there.)

Link to comment
13 hours ago, subtledoctor said:

Also, if any moderators are around, this thread might perhaps be better off in the 'Modding How-Tos' forum. (It's where I went to look for it, and I got momentarily confused when I couldn't find it there.)

Or you could make your own thread there, and clean it up ALOT. This is a discussion thread. You could give a link to a community tool for example in file naming chart. You edited the first post year and a half ago last. You realize how old that is, right ? Aka, it has none of the 2021 ideas etc.

Edited by Jarno Mikkola
Link to comment

While we're thinking about this, a number of mods have 'I need to add a bit of scripting to every creature' too. Rather than having 17 different scripts trying to crowd into five slots, I propose we settle on a file name--say, 'everyone' (or 'cdevery1' if we want to prefix)--and use that instead.

Link to comment

For my own AI scripts I'm currently using opcode 268 to set stat 148 (EXPLORE), and 293 to set stat 183, in order to keep track of certain buffs.

These two were chosen as being among the least likely for any other modder to set as timed effects on player characters, as well as the least visible in game. I'd prefer not to either interfere with or require detectable spells.

Party members naturally clear fog of war, enemies only trigger their buffs if aggroed, hence it shouldn't matter that they subsequently get a short duration 293 applied.

Link to comment

@jastey After testing, it looks like I'm going to have to increase Fatigue, the added spellstate alone is not protecting from all cases to protect things from going wrong with my spellcasting system.

However, I can set it such that Fatigue is only increased when the player uses certain abilities, and those abilities can only appear 7 seconds or so  after the mod initially detected Fatigue = 0, which happens between 1 and 6 seconds after you rest. So there would be a minimum 8 seconds after resting, plus the player casting a spell, before the value changes. I imagine that is more than enough time for any scripts to detect it...?

Incidentally a similar issue could affect the variable-based code example I posted in the other thread, if the player rests, and the 7th party member uses some spells, and then the player immediately rests while fatigue is still 0. I think you could add an effect increasing fatigue on top of the variable, and as long as the fatigue increase is delayed by ~8-15 seconds, other mods like mine would have plenty of time to detect rest. The variable is still useful in this case, as it prevent the script from returning rested=true during those 8-15 seconds. This is to cover what is fairly described as an edge case (the player resting again within a few minutes before Fatigue naturally advances from 0 to 1) but it would turn that edge case into a nearly impossible case (the player resting again within 15 seconds of having rested).

Edited by subtledoctor
Link to comment

@subtledoctor Thanks for the note, I would say the mods are compatible with this 6 s and regarding resting soon after another I will ponder whether this would be a real problem in my case. Thing is: resting via rest button is no problem for the 7th party member. What I am trying to detectis a Rest() action in a script that specifically addresses Player1-6, as some romance mods do after a rest encounter (to prevent another encounter to happen in the same night). It's really only a service to players so that my mage NPC also has refreshed spells and all NPCs their abilities after such a scripted rest (which the player can't detect as such), nothing more.

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