Jump to content

Gaining extra points in proficiencies via op233 works initially, then breaks the level up


suy

Recommended Posts

I would like a specific kit to get some extra proficiencies. Since the 2DA tables only allow for the classes to be changed, and don't distinguish by kit, I thought I could work it around by adding at level 1 an extra proficiency point to all the weapons via op233. That is, increase everything from 0 to 1 if the user did not put points, or from 1 to 2 if did. This is not the initial design that I wanted, but seems a good workaround.

The thing is, I've been able to get the in-game visible outcome that I sort of wanted after character generation, but it breaks after level up because it seems to confuse the game a ton.

I've used this function:

DEFINE_PATCH_FUNCTION add_effect_add_proficiency
    INT_VAR proficiency=0
    STR_VAR resource=""
BEGIN
    LPF ADD_SPELL_EFFECT
    INT_VAR opcode=233 // proficiency modifier
            target=1 // self, but the game seems to use 0 on the gained on chargen
            // target=0 // None
            power=0
            // NI: "# stars", and divided between active and original class.
            // Since it's 4 bytes, it's on the position of "parameter1". IESDP
            // says that the high word (2 bytes) has to be 1 to be "increment".
            // The amount to increase is still on parameter 1.
            // parameter1=0x00010000
            parameter1=1 // proficiency points in "active"
            parameter2=(0x00010000 | %proficiency%)
            timing=9 // Instant/Permanent
    STR_VAR resource
    END // LPF
END // function

And I call it one time for each proficiency (89 to 107, skipping 99 because it's halberd, and makes the game crash, as IESDP says). This is added to one SPL that I add to the 1st level column of a CLAB file. I can provide a trimmed down version of the mod if anyone wants to try, it's fairly small.

As you can see by the comments, I've been trying different combinations till something seemed to work. The normal way in which the game assigns the effects in the saved game is with target=None0, but when I used that, it doesn't work (no visible effect). It has to be target=Self(1), then it shows and applies.

This does work in that the character ends up at level 1 with one point in everything, but if the character chose one extra point in some weapon, then it can start the game with two. Awesome. The bonuses work, the UI shows it... great!

But then the level up screen at level 4 goes crazy. See the video, but as you will see, just adding the extra proficiency point in any weapon makes it jump from 1 to 3, and then subtracting it to set it somewhere else increases the number of remaining points to allocate without subtracting from where you clicked. It's pretty crazy.

I saved the game by just increasing from 1 to 2 in short sword (even though it shows 3 points, like in the video, but it allows to accept), and the saved game has an op233 with a "set if higher" to 2. With the "Increment by one" set by the CLAB it totals 3. So seems that roughly the engine calculates well the totals, but the level up screen does not. 😞

I've found some other threads about using op233, but seemed that the issues were more with items and non-permanent timings.

 

2022-11-07 21-52-16.mkv

Link to comment

@subtledoctorcomponent in npc_ee with the kit books seems like a similar behavior to what you want?  (the ability to set/gain proficiencies outside the normal UI screen) - no clue if that reference or his input (if pending) would be useful (I assume those are mostly staying in the proficiency bounds of the class and not going beyond, but sometimes I've ended up with "extra" pips between these npc_ee tomes and other mods that redid kits/classes).

Link to comment

The previous NPC_EE (4.x) versions had innates for this which spawned an invisible creature and granted the proficiency via thee dialog action (in a similar vein to for example how Tweaks Anthology's Avatar Change works).

I'm not sure what's going on there, but the innate is def. more reliable.

Link to comment
1 hour ago, suy said:

would like a specific kit to get some extra proficiencies. Since the 2DA tables only allow for the classes to be changed, and don't distinguish by kit

Have you tried actually adding the kit to this table? It seems out of place but there are several 2da tables for which this actually works. Worth trying as it would be by far the simplest solution if it works.   

I have also unified the way my several different mods create dialogues to increase proficiencies, into a single portable function. Set some variables, run the macro, and it spits out an innate ability that lets you choose one extra proficiency, or as many proficiencies as your character should have at a given level. So, Scales of Balance uses this to give a single extra prof for having high INT; and NPC_EE uses it to zero out all of an NPC’s profs and let them choose all new ones instead. It has other uses - Might & Guile uses it to allow one kit to advance a single weapon from proficiency straight to grandmastery. The function is responsive to whatever proficiency system is in place at install time. 

It has some limits still - I ought to add variable checks to allow restricting the weapon choice if desired. Right now, to restrict the function to melee weapons, Might & Guile has to directly patch the .DLG file after creating it. Not ideal, but it works well enough. 

24 minutes ago, Graion Dilach said:

not sure what's going on there, but the innate is def. more reliable

How so? The .ITM just uses op146 to cast the innate .SPL…

Edited by subtledoctor
Link to comment

Thanks. I'm not familiar with using mods like NPC_EE, but I think I've read about them using dialogs. In my case, since it's not something "conditional" (I mean, it's always bumping the same proficiencies by the same amount), I thought it would not be needed.

I'm looking at the source to see exactly which effect is used, but it seems a ton of conditionals that check if the stat is a certain value, then apply a 233 that seems it uses the "set is higher", instead of the "increase". Seems beyond what I can do on WeiDU right now, but I'll give it a shot.

Link to comment
5 minutes ago, subtledoctor said:

Have you tried actually adding the kit to this table? It seems out of place but there are several 2da tables for which this actually works. Worth trying as it would be by far the simplest solution if it works.

I think I've tried it some time ago, and I also think that Morpheus562 asked Bubb if this could be added to EEex, so that would be the confirmation. But I'll try it again...

5 minutes ago, subtledoctor said:

I have also unified the way my several different mods create dialogues to increase proficiencies, into a single portable function. Set some variables, run the macro, and it spits out an innate ability that lets you choose one extra proficiency, or as many proficiencies as your character should have at a given level. So, Scales of Balance uses this to give a single extra prof for having high INT; and NPC_EE uses it to zero out all of an NPC’s profs and let them choose all new ones instead. It has other uses - Might & Guile uses it to allow one kit to advance a single weapon from proficiency straight to grandmastery. The function is responsive to whatever proficiency system is in place at install time. 

It has some limits still - I ought to add variable checks to allow restricting the weapon choice if desired. Right now, to restrict the function to melee weapons, Might & Guile has to directly patch the .DLG file after creating it. Not ideal, but it works well enough. 

Thank you. That's a lot to unpack for me, as I always struggle with WeiDU, but I'll check it out. I think what I've found in NPC_EE is reasonably understandable, if I got it right. It's "just" d5_1prf.spl being altered to bump proficiencies conditionally. That seems it could work in my case.

5 minutes ago, subtledoctor said:

How so? The .ITM just uses op146 to cast the innate .SPL…

I suppose it looks more reliable given that it runs after the character generation, already in game. What I've noticed, is that the CLAB spells seems to be applied just after the user chooses proficiencies. So it might almost the same reliability. But of course your method works, so I'll have to replicate it properly.

Thank you all!

 

Link to comment

I’m confused now. Looking back, I think I misunderstood what Graion meant, snd I think he in turn misunderstood what ahungry meant. 

To the point at hand: @suy if you want you can copy the “dialprof.tpa” file and “dialprof” folder from the recent pre-release versions of SoB or MnG, drop them into your mod, and then use it just like in the linked examples above. Note that actually using the function does not involve very much weidu: INCLUDE the .tpa file, OUTER_SET and OUTER_SPRINT about four variables, and then LAM PROF_DIALOGUE.  Done. It spits out an innate ability, as well as a second ability that uses op171 to give you the first ability. (The first ability uses your chosen prefix and ends in “…a.spl,” while the second ability ends in “…1.spl.” You can put this second ability in a kit clab table with AP_. Add to the first spell an op206 effect against the second spell to make sure it is only used once. 

Link to comment

Thank you, @subtledoctor. I've imitated your approach, and I think I got it right.

OUTER_SET bastardSwordProficiencyId = 89
OUTER_SET slingProficiencyId = 107

OUTER_FOR (proficiency = bastardSwordProficiencyId; proficiency <= slingProficiencyId; ++proficiency) BEGIN
    OUTER_FOR (value = 1; value <= 3; ++value) BEGIN
        // Set the file name to S_SxyzTv.SPL ("set xyz to v"). Make all
        // proficiencies have 3 digits.
        OUTER_TEXT_SPRINT fileName "S_S0%proficiency%T%value%.SPL"
        ACTION_IF (proficiency >= 100) BEGIN
            OUTER_TEXT_SPRINT fileName "S_S%proficiency%T%value%.SPL"
        END

        // Copy from the template, and change the values.
        COPY "glass-cannon/set-proficiency-if-higher-template.spl" "override/%fileName%"
        LPF ALTER_EFFECT INT_VAR match_opcode = 233
            parameter1 = %value% parameter2 = %proficiency%
        END
    END
END

This generates all the spells with the effect that "set to X if higher". Now, I did some quick test, and while I need to generate the full SPL with weidu, a manually created one that uses an op326 to conditionally apply those helper spells works. The user sees 0 proficiencies in character generation, but after selecting some, the ones that I've increased, appear increased in the final screen and in game. The level up seems not to be confused like that.

I'm still scared that there might be hidden issues because the saved game doesn't look entirely "right": the effects from chargen or level up seem different from the ones added by the CLAB spell. But I guess if you've been using it this time it's a very good sign that the engine can handle it! :)

Link to comment

Oh, sorry, I misunderstood. I was suggesting you simply take my whole function and run it to create like 4 extra proficiency choices for you kit. So instead of getting 4 prof points at level 1 CharGen your kit would get 8. Instead of an 8th level fighter starting SoA with 6 points to spend, they would get 10. Etc.

I’ve had success increasing proficiencies after CharGen - I give a bonus in Slings to halflings, for example. But I have had lots of trouble setting proficiencies, for the simple reason that different games start at different levels. Say “this warrior begins the game with proficiency in all weapons” and it works great when you test in BG1, but if you start a BG2 or SoD or ToB game the player cannot reproduce what they could have if they had started from BG1 and built up their proficiencies organically.

The exception is if you set a proficiency to the max value. This works great with weapon styles: you could say “Barbarians begin the game with 2 pips in two-handed style,” and set that proficiency to its max (2 pips) and don’t let players put any pips into it (because they don’t need to).

This is probably not what you want to hear, but I just want to give fair warning about complications I’ve already run into. If you get this working to your satisfaction then that’s great.

Edited by subtledoctor
Link to comment
7 hours ago, subtledoctor said:

Oh, sorry, I misunderstood. I was suggesting you simply take my whole function and run it to create like 4 extra proficiency choices for you kit. So instead of getting 4 prof points at level 1 CharGen your kit would get 8. Instead of an 8th level fighter starting SoA with 6 points to spend, they would get 10. Etc.

But, it's possible to do that, at CharGen? Or you mean at the start of the game via the in-game dialog with an invisible creature?

The latter method is very nice to do exactly what I wanted initially, balance wise (e.g. give more initial points to a Kensai compared to a Fighter). But I think I'm settling now for the trick of bumping all proficiencies by one. On one hand, because as powerful as it is, it breaks a bit the 4th wall to me (I use the customization component of SCS, and it's great, but thankfully is kinda optional for most NPCs because I'm find with how they are set). On the other, because for the experiment I'm doing, this also seems balanced to me.

7 hours ago, subtledoctor said:

I’ve had success increasing proficiencies after CharGen - I give a bonus in Slings to halflings, for example. But I have had lots of trouble setting proficiencies, for the simple reason that different games start at different levels. Say “this warrior begins the game with proficiency in all weapons” and it works great when you test in BG1, but if you start a BG2 or SoD or ToB game the player cannot reproduce what they could have if they had started from BG1 and built up their proficiencies organically.

The exception is if you set a proficiency to the max value. This works great with weapon styles: you could say “Barbarians begin the game with 2 pips in two-handed style,” and set that proficiency to its max (2 pips) and don’t let players put any pips into it (because they don’t need to).

This is probably not what you want to hear, but I just want to give fair warning about complications I’ve already run into. If you get this working to your satisfaction then that’s great.

Thank you for the warning. In some simple tests with leveling up and all, it seems to work. Since I'm setting the proficiency to a certain level (but conditionally to simulate bumping it by one), I might have some luck here. But I'll need to try importing the character through campaigns and all that.

Thank you everyone again!

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