Jump to content
subtledoctor

Unearthed Arcana presents Might & Guile: tweaks and kits for warriors and rogues

Recommended Posts

Posted (edited)

I've updated the mod to v4.4.3.  Mostly quality-of-life changes:

  • learned bard songs should appear immediately
  • the Maze Aura HLA should be learned properly
  • Great Shout has a proper name & description
  • the Blur Aura description should now be accurate
  • the Stop Bard Song ability now has a name in-game (appropriately enough, "Stop Bard Song")
  • install time for the Revised Bards component has been reduced from several minutes, to about ten seconds   :O

That last one makes me reeeeally happy.  (Especially since I have to install and uninstall the damn thing so many times to test it.)  Limit your use of CLONE_EFFECT, modders!  Cheers.

Edited by subtledoctor

Share this post


Link to post
Posted (edited)
On 1/2/2020 at 7:02 PM, subtledoctor said:

you start to see a bit of the complexity involved here...

I'll work on it when I can.

Yeah I do, I just asked because it was an unexplained change in behaviour, and because I tend to be overzealous sometimes, but it works very fine as it is.

 

On 1/2/2020 at 7:02 PM, subtledoctor said:

I think this is a simple text error: the change from Blur to II actually happens at 13th level, not 15th.

Actually, I wasn't very specific there; yes, the description needs to be upgraded for the 13th lv change, but the real bug here is the AC bonus: the regular blur aura works fine, but the upgraded version has +4 to ST only, no AC bonus at all.

 

On 1/2/2020 at 7:02 PM, subtledoctor said:

I think you can fix this by finding your kit's HLA table (look at LUABBR.2da) and changing "GA_D5BD61A" to "AP_D5UB61" ... but that still requires you to load a save from before you chose that HLA.

Just did that. It worked. (There's no need for after-the-fact changes, I still jave to start a proper run, been busy with stuff and also with testing kits... by the way, I'll have a small list of things to report for FnP). The only thing that's missing now, is the spell icon in the special abilities menu, which is still black.

Looking at the HLA selection menu, I noticed another thing: the 'critical strike' '+' and '-' buttons are greyed out, even after selecting power attack. This happens for the mage/thief bard, the gallant, and the jinxer.  EDIT this is also fixed by editing the HLA tables.

 

On 1/2/2020 at 7:02 PM, subtledoctor said:

you should use Tome & Blood if you want such bonus spells.

I am using TnB v0.8sd45. Also installed the TA PnP spell tables right before it. All the other ability score bonuses (at least those i checked) work like described in the SoB readme, so I thought I could use that as a reference. Maybe the real problem here is TnB needs a fully detailed readme? 😛

Edited by Gwaihir

Share this post


Link to post
On 1/3/2020 at 3:33 PM, Gwaihir said:

Actually, I wasn't very specific there; yes, the description needs to be upgraded for the 13th lv change, but the real bug here is the AC bonus: the regular blur aura works fine, but the upgraded version has +4 to ST only, no AC bonus at all.

Hmm... the aura mimics the Improved Invisibility spell, which does not contain any AC bonus except the hard-coded one from the invisibility effect.  Are you sure the bonus is not there, or maybe just not displayed?  (Beamdog's methods of displaying bonuses is... quite imperfect.)  Have you compared someone with this bard aura to somone under the effect of the Improved Invisibility spell?  It's should be identical.

7 hours ago, Endarire said:

Is M&G compatible with Epic Thieving?  If so, what's the best install order?

Dunno.  The MnG feat system replaces all thief traps with new and different ones, so any "epic traps" stuff from that mod might not work.  Otherwise it should be fine, I think.

Share this post


Link to post
2 hours ago, subtledoctor said:

Are you sure the bonus is not there, or maybe just not displayed?  (Beamdog's methods of displaying bonuses is... quite imperfect.)  Have you compared someone with this bard aura to somone under the effect of the Improved Invisibility spell?  It's should be identical.

Huh. Just checked the improved invisibility spell with a few kits (including a vanilla fighter/mage) and it is indeed identical to the Improved Blur Aura, as in, it doesn't have the +4 AC bonus either. Of course, I'm only talking about the numbers you see on the character menus, is there another way to check the effects?

Anyway, the filechangelog report(assuming it's the right file, i looked it up on IESDP):

Spoiler

Mods affecting SPWI405.SPL:
00000: /* created or unbiffed */ ~TOMEANDBLOOD/TOMEANDBLOOD.TP2~ 0 11 // Rebalanced Spell Schools0.8.44
00001:  ~TOMEANDBLOOD/TOMEANDBLOOD.TP2~ 0 14 // Revised Invisibility and True Seeing0.8.44
00002:  ~TOMEANDBLOOD/TOMEANDBLOOD.TP2~ 0 40 // Revised Specialists0.8.44
00003:  ~STRATAGEMS/SETUP-STRATAGEMS.TP2~ 0 5900 // Initialise AI components (required for all tactical and AI components)v32.7

I also included the file itself, in case it helps.

SPWI405.SPL

Share this post


Link to post

I have to assume the bonus is there, just not displayed.  If Improved Invisibility were so nerfed in the EEs for all these years somebody would have noticed and vociferously complained.  I think it's just a quirk of Beamdog's attempts to present all these bonuses, which can be quite inconsistent.  (Recall the original engine, wisely, only showed your basic AC/thac0/etc. and let the player figure out what bonuses are applied.) 

This is a bit of an edge case, because it is really a penalty to the opponent's to-hit rolls, not a bonus to your AC.  Enemies who can see through invisibility don't have the penalty; the engine can't really update your character display depending on which enemy is attacking.  (I think other such situational bonuses and penalties are also not displayed - think about when you have a Protection from Evil spell active, or when a hidden thief attempts a backstab, or when you attack at melee range with bare hands or a missile weapon.  IIRC none of those to-hit modifications show up in the character display.  I would guess that the AC bonus with Improved Invisibility is similar.

Admittedly this opens up an edge case where you might rather have the Blur effect than the II effect, since the former will work against enemies who can see through invisibility.  But 1) this is probably pretty rare; 2) overall, not being targeted by spells is probably way more valuable than that AC bonus; and 3) realistically, those enemies should see through Blur as well, it should probably be considered a bug that they don't.  Unfortunately I cannot off the top of my head figure out a way to fix that from the modding side.  The AC bonus opcode should probably have a flag to make it ignored by anyone with invisibility detection by script active.

Share this post


Link to post

That all makes sense. It's pretty confusing when only half of the spell effects are displayed (ST bonuses); protection from evil at least has two icons... you still don't know if the spell is working correctly, but the visual cue is reassuring 😆

Anyway, it's always worth checking when there are dozens of mods installed. If you say eveything is in its place, I'm good. Thank you Doc.

Share this post


Link to post

Hello @subtledoctor

There is one duplicated strref in a tra file:

duplicate @20309 in might_and_guile\language\english\setup.tra

Looking at the file, the first one should probably be @20109.

Share this post


Link to post
On 1/3/2020 at 9:19 PM, subtledoctor said:

  Limit your use of CLONE_EFFECT, modders!  Cheers.

@subtledoctor Sorry for off-topic but what was your other code choice then ?

Edited by ptifab
typos

Share this post


Link to post
1 hour ago, ptifab said:

@subtledoctor Sorry for off-topic but what was your other code choice then ?

If you have lots of changes to make, do them all at once with manual checks/writes/inserts, so you only iterate over every file/effect once (or as few times as possible).

Share this post


Link to post
10 hours ago, lefreut said:

Hello @subtledoctor

There is one duplicated strref in a tra file:


duplicate @20309 in might_and_guile\language\english\setup.tra

Looking at the file, the first one should probably be @20109.

Thanks!

2 hours ago, ptifab said:

"Limit your use of CLONE_EFFECT, modders!"

@subtledoctor Sorry for off-topic but what was your other code choice then ?

No problem.  Happy to discuss it, and this is a really good example because the improvement in handling CLONE_EFFECT made this component roughly two orders of magnitude faster to install.

CLONE_EFFECT has matching conditions so that it can be selective about which effects get duplicated.  It is tempting to use this conditionality as an easy way to determine which spells/items are affected by the command.  In this case, my spontaneous casting system tracks spell slots with an unused proficiency; so I wanted to patch the Ring of Wizardry and any similar items: any time an item uses opcode 42 to increase wizard spell slots, I want to add another effect, using opcode 177with a "while equipped" .EFF file that modifies the proficiency.  The code looks like this:

COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~
  PATCH_IF (%SOURCE_SIZE% > 0x71) BEGIN
    LPF CLONE_EFFECT INT_VAR silent = 1 multi_match = 1 match_opcode = 42 match_parameter1 = 1 match_parameter2 = 1 opcode = 177 parameter1 = 0 parameter2 = 2 timing = 2 STR_VAR resource = ~d5src1e~ insert = ~first~ END
    LPF CLONE_EFFECT INT_VAR silent = 1 multi_match = 1 match_opcode = 42 match_parameter1 = 1 match_parameter2 = 2 opcode = 177 parameter1 = 0 parameter2 = 2 timing = 2 STR_VAR resource = ~d5src2e~ insert = ~first~ END
    LPF CLONE_EFFECT INT_VAR silent = 1 multi_match = 1 match_opcode = 42 match_parameter1 = 1 match_parameter2 = 4 opcode = 177 parameter1 = 0 parameter2 = 2 timing = 2 STR_VAR resource = ~d5src3e~ insert = ~first~ END
    [etc.]
  END
BUT_ONLY

There were a couple dozen such CLONE_EFFECT commands, because it needs to be done for every spell level, and for every amount of bonus spell slots there are in that level (within reason - I basically looking for matching conditions of "plus 1 spell slot," "plus 2 spell slots," and "plus more than 2 spell slots" so 27 CLONE_EFFECT commands in total).

Thing is, CLONE_EFFECT is really slow.  That's not a knock; it wasn't designed to be fast, it was designed to be effective at duplicating selective effects within spells and items.  And it does that very well and is super useful.  Just, slow.  This component checked for the CLONE_EFFECT matching conditions in every item in the game; especially on a modded install, that was taking ~5 minutes.

The easiest way I could think to reduce that time was to simply limit CLONE_EFFECT to running on items where it would actually potentially do something, i.e. only on items that have opcode 42 effects.  So I made a list of those items:

OUTER_SET mageslot_item_ind = 0
OUTER_SPRINT $mage_slot_items(~%mageslot_item_ind%~) ~mage_slot_item~
COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~
  PATCH_IF (%SOURCE_SIZE% > 0x71) BEGIN
    SET plus_slots = 0
    READ_LONG 0x64 headoffset  ELSE 0
    READ_SHORT 0x68 headcount  ELSE 0
    READ_LONG 0x6a effectsoffset  ELSE 0
    FOR (headcyc = 0; headcyc < headcount ; headcyc = headcyc + 1) BEGIN
      this_head = 0
      READ_SHORT (headoffset + (headcyc * 0x38) + 0x1e) effcount  ELSE 0
      READ_SHORT (headoffset + (headcyc * 0x38) + 0x20) effectsindex  ELSE 0
      FOR (effcyc = 0; effcyc < effcount; effcyc = effcyc + 1) BEGIN
        READ_SHORT (effectsoffset + (effectsindex + effcyc)* 0x30) opcode ELSE 0
        PATCH_IF (opcode = 42) AND (this_head = 0) BEGIN
          SET plus_slots = 1
          SET this_head = 1
        END
      END
    END
    PATCH_IF (plus_slots = 1)BEGIN
      SPRINT $mage_slot_items(~%mageslot_item_ind%~) ~%SOURCE_RES%~
      SET ++mageslot_item_ind
    END
  END
BUT_ONLY

That creates an associative array called "mage_slot_items;" then checks every item in the game to find ones with opcode 42, and adds those items to the array.  The result is an array with probably 10-20 items, again depending on other mods having been installed.  I don't really know or care how many items are in the array, or which ones; I just know that the total number is very likely a tiny fraction of the total number of .ITM files in the game.

Then I apply the CLONE_EFFECT commands only to the items in the array:

ACTION_PHP_EACH mage_slot_items AS ind => slot_item BEGIN
  COPY_EXISTING ~%slot_item%.itm~ ~override~
    LPF CLONE_EFFECT INT_VAR silent = 1 multi_match = 1 match_opcode = 42 match_parameter1 = 1 match_parameter2 = 1 opcode = 177 parameter1 = 0 parameter2 = 2 timing = 2 STR_VAR resource = ~d5src1e~ insert = ~first~ END
    LPF CLONE_EFFECT INT_VAR silent = 1 multi_match = 1 match_opcode = 42 match_parameter1 = 1 match_parameter2 = 2 opcode = 177 parameter1 = 0 parameter2 = 2 timing = 2 STR_VAR resource = ~d5src2e~ insert = ~first~ END
    LPF CLONE_EFFECT INT_VAR silent = 1 multi_match = 1 match_opcode = 42 match_parameter1 = 1 match_parameter2 = 4 opcode = 177 parameter1 = 0 parameter2 = 2 timing = 2 STR_VAR resource = ~d5src3e~ insert = ~first~ END
    [etc.]
BUT_ONLY
END

Creating the array, identifying the relevant items for it, and applying CLONE_EFFECT to those items now takes a grand total of 10-20 seconds

Edited by subtledoctor

Share this post


Link to post

@subtledoctor how about writing this in an own thread in Modding Tutorial section? It's gems like these that make it so much easier for later folks.

Share this post


Link to post
4 hours ago, kjeron said:

If you have lots of changes to make, do them all at once with manual checks/writes/inserts, so you only iterate over every file/effect once (or as few times as possible).

That was my basic way of doing, but as @jastey says, it's always useful to get the genius of other coders, as i am really far from doing as effective as you ol' modders (no offense ^^)

@subtledoctor thanks doc' for taking time to explain your routine, that was really entertaining !

Share this post


Link to post
On 1/25/2020 at 2:49 PM, jastey said:

@subtledoctor how about writing this in an own thread in Modding Tutorial section? It's gems like these that make it so much easier for later folks.

Hah!  Probably because that code is terrible and it doesn't work!  :laugh:

Actually the code is fine enough - it is the nth iteration of something borrowed a loooong time ago from... Ardanis maybe, or aVENGER.  But it looks through item ability headers to find opcode 42 effects, when it should really be looking through global equipping effects.  I'll update the mod soon; but in the meantime, anybody actually playing with the Revised Bards, if you want them to benefit from Rings of Wizardry, Wondrous Gloves, etc., you can apply the hotfix mod attached over in the Tome & Blood thread.  It can be applied to games in progress.

Share this post


Link to post
On 1/25/2020 at 11:49 AM, jastey said:

@subtledoctor how about writing this in an own thread in Modding Tutorial section? It's gems like these that make it so much easier for later folks.

Many of the changes made with standard functions could be executed more efficiently if they were done using custom patching code, especially when performing multiple alterations together.  However, doing it that way requires much more effort and is more error-prone, so I would only recommend it if performance becomes a concern, or if the standard functions cannot accomplish your goal.

I found a couple of my posts with custom patches and some explanations that you can take a look at here and here.

Share this post


Link to post
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...