Jump to content


Photo

SCS not compatible with multiclass kits...?


15 replies to this topic

#1 subtledoctor

subtledoctor
  • Modders
  • 2428 posts
  • Gender:Male

Posted 09 December 2017 - 08:51 PM

Background:

 

So, it turns out it is possible to have real kits for multiclasses - not just single-class kits 'Keepered onto multiclass characters.  There are a number of reason why the former are superior to the latter, but for now let's just take it on faith that it's a good thing.

 

One issue is, the engine is not perfectly set up for multiclass kits.  The biggest hurdle is, they use the trueclass CLAb table (clabfi01.2da, clabma01.2da, etc.) instead of the kit's table.  Aquadrizzt has written a little function that allows anyone who can make a kit mod, to make a multiclass kit mod with now extra effort.  It reads the mit's CLAB table and creates .EFF files mimicking for the various GA_ and AP_ spells, and adds those to opcode 177 effects in a spell in the trueclass CLAB, and the 177 effects are directed at the appropriate kits.  It's clever, and the result is seamless and fun.

 

The issue:

 

Problem is, the SCS General AI component breaks down when spells with these 177 effects are present in clabfi01.2da etc.  It looks like it ends up not applying the "core changes to CRE files" to any creature using the affected CLAB tables... and, since they are the trueclass tables, that means the core changes are not applied to a large number of creatures.

 

I find SCS harder to analyze than most mods.  The .tp2 files for the AI component just says

LAF run STR_VAR files=genai END

...but I have no idea where the function resides, to go inspect it.  I found it eventually, but the genai .tpa file just says:

LAM read_in_clab_spelldata
...and I have no idea where that function resides.  Anyway I found that one too, and I think that might be where SCS is choking.  But I'm having trouble parsing what's going on.  The macro in question looks like this:

DEFINE_ACTION_MACRO ~read_in_clab_spelldata~ BEGIN
   LOCAL_SET i=0
   LOCAL_SET j=0
   LOCAL_SET colcount=0
   LOCAL_SET rowcount=0
   LOCAL_SET parameter1=0
   LOCAL_SET parameter2=0
   LOCAL_SET opcode=0
   LOCAL_SET offset_base=0
   LOCAL_SPRINT resource_here ""
   LOCAL_SPRINT resource ""
   LOCAL_SPRINT tempadd ""
   LOCAL_SPRINT tempremove ""
      SILENT
   COPY_EXISTING_REGEXP GLOB "clab.*\.2da" "%workspace%"
      COUNT_2DA_COLS colcount
      COUNT_2DA_ROWS colcount rowcount
      FOR (i=0;i<rowcount;i+=1) BEGIN
         FOR (j=0;j<colcount;j+=1) BEGIN
              READ_2DA_ENTRY i j colcount resource
              PATCH_MATCH "%resource%" WITH
              "GA_.*" BEGIN
                  INNER_PATCH_SAVE resource "%resource%" BEGIN
                     DELETE_BYTES 0x0 3
                  END
                  TO_UPPER resource
                  PATCH_IF !VARIABLE_IS_SET "RESREF_%resource%_LEVEL" && FILE_EXISTS_IN_GAME "%resource%.spl" BEGIN
                      INNER_ACTION BEGIN
                         COPY_EXISTING "%resource%.spl" "%workspace%"
                               LPF SPL_read_level RET "RESREF_%resource%_LEVEL"=value END
                               LPF SPL_read_spell_type RET "RESREF_%resource%_TYPE"=value END
                         BUT_ONLY
                      END
                  END
              END
              "AP_.*" BEGIN
                  INNER_PATCH_SAVE resource "%resource%" BEGIN
                     DELETE_BYTES 0x0 3
                  END
                  TO_UPPER resource
                  PATCH_IF !VARIABLE_IS_SET "RESREF_%resource%_KIT_EFFECTS_ADD" && FILE_EXISTS_IN_GAME "%resource%.spl" BEGIN
                      INNER_ACTION BEGIN
                        ACTION_IF FILE_EXISTS_IN_GAME "%resource%.spl" BEGIN
                         COPY_EXISTING "%resource%.spl" "%workspace%"
                            SPRINT tempadd ""
                            SPRINT tempremove ""
                            LPF return_offset STR_VAR entry_type=ability file_ext=SPL RET offset_base=value END
                                    GET_OFFSET_ARRAY2 fx_arr offset_base ITM_V10_HEAD_EFFECTS
                                    PHP_EACH fx_arr AS int=>offset_secondary BEGIN
                                       READ_SHORT offset_secondary opcode
                                       READ_LONG offset_secondary+0x4 parameter1
                                       READ_LONG offset_secondary+0x8 parameter2
                                       READ_ASCII offset_secondary+0x14 resource_here
                                       PATCH_IF "%resource_here%" STRING_EQUAL "" BEGIN
                                          SPRINT resource_here null
                                       END
                                       PATCH_MATCH "%opcode%" WITH
                                       172 177 BEGIN END
                                       DEFAULT
                                          SPRINT tempadd "%tempadd% add_effect_inline=>~parameter1=>%parameter1%  parameter2=>%parameter2% resource=>%resource_here% opcode=>%opcode%~"
                                          SPRINT tempremove "%tempremove% delete_effect=>~opcode=%opcode% and parameter2=%parameter2% and resource=%resource_here%~" // parameter1 intentionally left out
                                       END
                                    END
                         BUT_ONLY
                       END
                       OUTER_SPRINT "RESREF_%resource%_KIT_EFFECTS_ADD" "%tempadd%"
                       OUTER_SPRINT "RESREF_%resource%_KIT_EFFECTS_REMOVE" "%tempremove%"
                      END
                  END
              END
              DEFAULT
              END
         END
      END
   BUT_ONLY

END

 

Then, after reading that data and a bunch of other data, SCS does this:

         PATCH_PRINT "Applying kit/proficiency/script features to %filename%"
         PATCH_TRY
               LPF genai STR_VAR filename file_ext=CRE arguments="all conditional fix_thac0" END
         WITH DEFAULT
               PATCH_WARN "Failed to apply general-AI patch to %filename% (error message %ERROR_MESSAGE%)"
               LPF warning STR_VAR warning="Failed to apply general-AI patch to %filename% (error message %ERROR_MESSAGE%)"  END
         END

That is the error message we've seen, so I think this narrows down the problem... but I still don't know what the problem is.  Jarno has suggested that SCS doesn't like that the 177 effects in the multiclass spells set parameter2 to 9.  I'm not sure if that's it... but I will note that mod kits end up with unusual values in parameter1 in that case, and the "read_in_clab_spelldata" macro specifically says "// parameter1 intentionally left out."

 

So, I have a few questions to try to nail this down, if anyone understands this code better than me.

 

1) Why is "parameter1 intentionally left out" in the "read_in_clab_spelldata" macro? 

 

2) What is this feature actually doing?  Applying CLAB effects hidden inside 177 effects to enemy creatures?  How many of these are there, really?  Maybe a brute-force temporary solution for players who want to use both mods could be simply excluding 177 effects from this process?  So, edit the SCS macro like so:

               PATCH_MATCH "%opcode%" WITH
               172 /*177*/ BEGIN END
               DEFAULT
                 SPRINT tempadd "%tempadd% add_effect_inline=>~parameter1=>%parameter1%  parameter2=>%parameter2% resource=>%resource_here% opcode=>%opcode%~"
                 SPRINT tempremove "%tempremove% delete_effect=>~opcode=%opcode% and parameter2=%parameter2% and resource=%resource_here%~" // parameter1 intentionally left out
               END

 

?

 

3) Obviously the ideal is to have all such effects applied to creatures, if possible... maybe a better solution (if still temporary and brute-force) is to try to specifically exclude only 177 effects with parameter2 = 9?  So:

               READ_SHORT offset_secondary opcode
               READ_LONG offset_secondary+0x4 parameter1
               READ_LONG offset_secondary+0x8 parameter2
               READ_ASCII offset_secondary+0x14 resource_here
               PATCH_IF "%resource_here%" STRING_EQUAL "" BEGIN
                  SPRINT resource_here null
               END
               PATCH_MATCH "%opcode%" WITH
               172 177 BEGIN END
               DEFAULT
                 PATCH_IF NOT (parameter2 = 9) BEGIN
                   SPRINT tempadd "%tempadd% add_effect_inline=>~parameter1=>%parameter1%  parameter2=>%parameter2% resource=>%resource_here% opcode=>%opcode%~"
                   SPRINT tempremove "%tempremove% delete_effect=>~opcode=%opcode% and parameter2=%parameter2% and resource=%resource_here%~" // parameter1 intentionally left out
                 END
               END

 


Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#2 subtledoctor

subtledoctor
  • Modders
  • 2428 posts
  • Gender:Male

Posted 31 December 2017 - 06:52 AM

For clarification: the edit in #2) above is in line 374 of /stratagems/sfo/general/lib_macro.tpa.


Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#3 Luke

Luke
  • Members
  • 76 posts
  • Gender:Male

Posted 10 January 2018 - 10:37 AM

Sorry to bother, but is the following 

 

"MnG had been INCLUDEing the QD_multi function in an ALWAYS block in the .tp2, so the functions would be available generally. This means CLABFI01.2da would get the QD_multi entries when any part of the mod is installed. I changed this, so that the QD_multi functions are only invoked when the "multiclass kits" component is installed" 

 

still valid as of MnG v3.7.1 (latest version)? Because SCS has just thrown at me those famous warnings even if I didn't install the multiclass kits component......



#4 subtledoctor

subtledoctor
  • Modders
  • 2428 posts
  • Gender:Male

Posted 10 January 2018 - 10:47 AM

Have you installed some other mod that uses the QDMulti functions?

Also, I have to backtrack a bit: I have recently installed the MnG multiclass kits (and everything else, as well as other similar mods like Faiths & Powers and Tome & Blood) and SCS did not throw any errors. So we might have misdiagnosed the problem.

In any event, when I could replicate the errors, I solved it by editing lib_macro.tpa as described above - just comment out "177" in line 374. Did you try that?

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#5 Roxanne

Roxanne

    Modder

  • Modders
  • 1997 posts
  • Gender:Female
  • Location:Auckland, NZ

Posted 10 January 2018 - 01:00 PM

I am sure it was mentioned in some other discussion and I have forgotten it, but what exactly is the reason for SCS - dealing with AI and scripts for enemies - to be necessarily installed after mods that add multiclass kits? Those kits are normally for PC or joinable NPCs and not for enemies.

Is it not simply possible to change install orders?


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#6 Luke

Luke
  • Members
  • 76 posts
  • Gender:Male

Posted 10 January 2018 - 01:42 PM

Have you installed some other mod that uses the QDMulti functions?

It's Faiths & Powers that is causing the issue now (I didn't install all the components, just some paladin kits....). Could you do something similar to what you did for MnG so that the QD_multi functions are only invoked when needed? Anyway, why didn't SCS throw any errors at you? This is really odd.... For the record, I'm speaking of BG:EE v2.5 beta....


Edited by Luke, 10 January 2018 - 01:46 PM.


#7 subtledoctor

subtledoctor
  • Modders
  • 2428 posts
  • Gender:Male

Posted 10 January 2018 - 10:42 PM

I just installed FnP and MnG on BGEE v2.4 and SCS gave me no errors. Tons of multiclass kits, no problem.

Re: changing the order - off the top of my head that seems too simplistic. Some mods that offer multiclass kits also offer single-class kits, in the same component. Maybe those single-class kits are not geared toward AI either... I mean, basically no kit mods are intended for the AI, so by that logic all kit mods can be installed after SCS.

BUT some rule tweak mods want to be installed after any/all kit mods. And SCS might be designed to be installed after those tweak mods. This kind of thing just seems to invite catch-22 dependencies/conflicts, like the bad old days. Better to know what one's mod does, and what it needs, and design for it to be ordered according to that. That design can then easily take into account and adjust for whatever mods are designed to be installed earlier.

And speaking of adjusting, Luke try editing lib_macro.tpa in SCS before installing. Line 374, change "177" to "/*177*/" ... worked like a charm for me the last time I replicated your issue. I didn't get through the whole game but everything seemed fine as far as the Bandit Camp.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#8 Luke

Luke
  • Members
  • 76 posts
  • Gender:Male

Posted 11 January 2018 - 02:16 AM

And speaking of adjusting, Luke try editing lib_macro.tpa in SCS before installing. Line 374, change "177" to "/*177*/" ... worked like a charm for me the last time I replicated your issue. I didn't get through the whole game but everything seemed fine as far as the Bandit Camp.

Ok, will try.... -> It's not working for me....


Edited by Luke, 11 January 2018 - 03:13 AM.


#9 subtledoctor

subtledoctor
  • Modders
  • 2428 posts
  • Gender:Male

Posted 11 January 2018 - 06:06 AM

Well then, the problem may have nothing to do with multiclass kits at all. I'm afraid this might need info from someone who understand SCS better. The fact that I can reliably install SCS with those mods without errors, but you cannot, suggests that it might be related to some other aspect of your install...

Edited by subtledoctor, 11 January 2018 - 06:07 AM.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#10 Luke

Luke
  • Members
  • 76 posts
  • Gender:Male

Posted 11 January 2018 - 08:37 AM

The fact that I can reliably install SCS with those mods without errors, but you cannot, suggests that it might be related to some other aspect of your install...

Here we go again.....


Edited by Luke, 27 January 2018 - 02:30 AM.


#11 Jarno Mikkola

Jarno Mikkola

    The Imp

  • Modders
  • 6511 posts
  • Gender:Male
  • Location:The town where the dead haven't keeled over, yet. In Finland.

Posted 11 January 2018 - 10:06 AM

Here we go again..... SETUP-STRATAGEMS.DEBUG is so filled with warnings (5.4 MB) that I can't even upload it here.....

You do know that .zip'ping it will cut a .txt file into tiny piece and allow a VERY large original file size. This is because the text encoding is removed from the file during the build of the archive. Just like that 144kb file became 5.28kb file, the further the file goes on, the better the rate in this case.
Welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand.
Here's how to install all the ... mods you ever really could want to Infinity Engine games. I removed the stable word from there as Roxanne began to add BS mods that are likely to break compatibility from the BWS.

#12 subtledoctor

subtledoctor
  • Modders
  • 2428 posts
  • Gender:Male

Posted 11 January 2018 - 10:57 AM

If you're only adding paladin kits from FnP, you can edit the main .tp2 file, near the very top, add a double slash (" // ") at the beginning of this line:
INCLUDE ~faiths_and_powers/lib/qd_multiclass.tpa~
Just to try and see if it helps. Again this is weird because I have IR, SR4b15, DR, FnP, MnG, and SCS, with no errors.

One difference I see: I didn't use the SR Mirror Image Fix or Remove Hidden Spells or Update Spellbooks of Joinable NPCs. But that's a long shot...

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#13 Luke

Luke
  • Members
  • 76 posts
  • Gender:Male

Posted 11 January 2018 - 11:10 AM

 

Here we go again..... SETUP-STRATAGEMS.DEBUG is so filled with warnings (5.4 MB) that I can't even upload it here.....

Just like that 144kb file became 5.28kb file, the further the file goes on, the better the rate in this case.

I'm terribly sorry, but if I zip that 5.4 MB file, then it becomes a 418 KB file -> still too large.....


Edited by Luke, 11 January 2018 - 11:11 AM.


#14 Jarno Mikkola

Jarno Mikkola

    The Imp

  • Modders
  • 6511 posts
  • Gender:Male
  • Location:The town where the dead haven't keeled over, yet. In Finland.

Posted 11 January 2018 - 11:19 AM

I'm terribly sorry, but if I zip that 5.4 MB file, then it becomes a 418 KB file -> still too large.....

That happens when you use too much of the forum space as a whole, for example, if you go and remove the files from this post of yours, you'll have enough space... as there's more than 416kb's in it.

@Jarno Mikkola, I've attached my WeiDU.log, Stratagems.debug and SFO_warnings.txt. Please, have a look at them....

:p

I myself have 16 Mb's still left(I think we start at 30 MB's at start), so ...
Welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand.
Here's how to install all the ... mods you ever really could want to Infinity Engine games. I removed the stable word from there as Roxanne began to add BS mods that are likely to break compatibility from the BWS.

#15 Luke

Luke
  • Members
  • 76 posts
  • Gender:Male

Posted 11 January 2018 - 12:50 PM

If you're only adding paladin kits from FnP, you can edit the main .tp2 file, near the very top, add a double slash (" // ") at the beginning of this line:

INCLUDE ~faiths_and_powers/lib/qd_multiclass.tpa~
Just to try and see if it helps.

It worked, thanks!





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users