Author Topic: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee  (Read 555 times)

Offline Argent77

  • Planewalker
  • *****
  • Posts: 173
Some time ago I started a project which aims to unify (and eventually replace) WeiDU's built-in functions ADD_KIT and COPY_KIT as well as the complementary function fl#add_kit_ee.

By now the project is more or less feature-complete and should already cover the majority of potential use cases. It includes an example mod which demonstrates how to add new kits, clone existing kits or retrieve kit information.

I invite everyone to test this function and post your feedback, bug reports, questions, suggestions or feature requests.

Links:

Offline subtledoctor

  • Planewalker
  • *****
  • Posts: 113
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #1 on: September 20, 2019, 06:38:14 PM »
Would it make sense to incorporate the QDMulti code in this, so it handles multiclass kits as well?

Offline Argent77

  • Planewalker
  • *****
  • Posts: 173
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #2 on: September 21, 2019, 07:36:32 AM »
I haven't looked into the QDMulti code yet. What does it do differently? Is there some example code I could try out?

Offline subtledoctor

  • Planewalker
  • *****
  • Posts: 113
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #3 on: September 21, 2019, 12:45:07 PM »
Itís basically a separate function written by Aquadrizzt.  It works a lot like fl#_add_kit_ee, you run it after ADD_KIT. An example of it in use is here (see e.g. lines 196-201):
https://github.com/UnearthedArcana/Might_and_Guile/blob/master/might_and_guile/components/220_multiclass_kits.tpa

The way it works, in a nutshell, is you specify the (multi)class number of the kit and which base single-class you want to use for level-up abilities. The function then:
1) creates multiclass K_FM_H.2da etc. files, if they donít already exist, and adds the new kit to the relevant menus
2) creates clabma01.2da, if it doesnít already exist
3) creates an empty spell and associated AP_ entry at every level in the base single-class unkitted clab tables
4) creates .EFF files for the kit abilities in your new kitís clab table, and adds associated 177 effects to the spells in the unkitted clab tables (since multiclass kits get their abilities from the unkitted clab tables instead if from their own)

Here, I guess it could be included as a conditional, like ACTION_IF (game_is ~ee~) AND (class = 7 | 8 |9 | 13 | 14 | 15 | 16 | 17 | 18) BEGIN and then run the whole QDMulti subroutine.  It would require the use of an additional variable, which would only be relevant if the new kit is a multiclass.

My most recent update of the code is here:
https://github.com/subtledoctor/QDMULTI/blob/master/qd_multiclass.tpa

It should pretty much be able to be dropped right into your function - you can forego the FJ_SPL_ITM_REINDEX stuff, see here:
https://www.gibberlings3.net/forums/topic/28835-toss-your-semi-useful-weidu-macros-here/?do=findComment&comment=266521

There is a yet-unaddressed bug, which should be easy to fix.  It is described over a few posts here:
https://forums.beamdog.com/discussion/comment/1082891/#Comment_1082891
« Last Edit: September 23, 2019, 12:46:34 PM by subtledoctor »

Offline subtledoctor

  • Planewalker
  • *****
  • Posts: 113
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #4 on: September 24, 2019, 01:01:14 PM »
I've forked the project to see whether I can save you some effort by integrating them myself, so you can just review a pull request.  Don't have a ton of time these days but it's roughly working already.  I just need to:
- fix the aforementioned 206 bug
- fix another little bug so it reads all rows of the clab file
- figure out how your function populate the K_x_y.2da menu tables, to integrate the (possibly not-yet-existing) multiclass ones
- I suppose, add a fail warning if the modder neglects to specify the new single-class variable

Offline Argent77

  • Planewalker
  • *****
  • Posts: 173
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #5 on: September 24, 2019, 01:16:18 PM »
I think QDMulti should continue as a separate project (at least for the time being). Incorporating all of it into ADD_KIT_EX would make development of both projects needlessly complicated.

QDMulti is still actively developed. Bugs should be fixed in a timely manner, which may not be possible if this code is included in WeiDU. It would also prevent mods still using original ADD_KIT from using the library, unless you want to maintain two code branches.

I can make sure the necessary groundwork is properly laid when ADD_KIT_EX is called (creating or normalizing required 2DA files, etc.), but I'll leave the spell logic to QDMulti.

Offline Argent77

  • Planewalker
  • *****
  • Posts: 173
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #6 on: September 30, 2019, 10:45:03 AM »
A new beta is available: Version 0.2

Changelog:
  • Fixed kit limit check
  • Improved GemRB and TobEx checks
  • Made more parameters optional
  • Missing kit-related tables are provided if needed
  • Function autogenerates class ability tables for multiclass kits if needed

Offline Gwendolyne_FP

  • Planewalker
  • *****
  • Posts: 49
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #7 on: September 30, 2019, 04:29:56 PM »
Great. I really like the "invisible feature" that will solve one of my mod issue. ;)

Offline Argent77

  • Planewalker
  • *****
  • Posts: 173
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #8 on: October 06, 2019, 05:51:41 AM »
I've forked the project to see whether I can save you some effort by integrating them myself, so you can just review a pull request.  Don't have a ton of time these days but it's roughly working already.  I just need to:
- fix the aforementioned 206 bug
- fix another little bug so it reads all rows of the clab file
- figure out how your function populate the K_x_y.2da menu tables, to integrate the (possibly not-yet-existing) multiclass ones
- I suppose, add a fail warning if the modder neglects to specify the new single-class variable
I've taken a closer look at QDMULTI and there seems to be a lot of potential for optimizing the code. With a bit of restructuring and fixing the aforementioned bugs I may be able to add most if not all of the functionality into ADD_KIT_EX.

@subtledoctor: Btw, I've done a bit of cleaning and optimizing already (Project). I can create a PR if you want to use it as a basis for further bugfixing.

Offline subtledoctor

  • Planewalker
  • *****
  • Posts: 113
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #9 on: October 09, 2019, 07:42:38 PM »
@subtledoctor: Btw, I've done a bit of cleaning and optimizing already (Project). I can create a PR if you want to use it as a basis for further bugfixing.

Let me take a look.  I've got an internal version 0.7 which fixes a couple bugs and optimizes a few things (not that much though) I don't want us to be working at cross-pruposes.  I only haven't had enough time to test it. 

Check that - I've uploaded it to my branch, just haven't made a release yet, until it gets tested.  Feel free to kick the tires if you like - you may have time to compare them before I do, given my current RL circumstances.

EDIT - looks very nice.  I incorporated both of our changes to create version 0.8.  Thanks!  (Still needs testing though, to make sure my opcode 206 subspells are working.)
« Last Edit: October 09, 2019, 08:40:16 PM by subtledoctor »

Offline subtledoctor

  • Planewalker
  • *****
  • Posts: 113
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #10 on: October 09, 2019, 07:56:48 PM »
Incidentally, if you are going to include multiclass kits in this function, there is no real need to glue QDMulti into it - you could of course also simply implement your own solution to achieve the same results - specifically, the creation of kit menu tables, and the use of .eff files or something similar to apply multiclass kit abilities via the single-class unkitted CLAB tables.

I suggest this simply because that would really make ADD_KIT_EX a true one-stop-shop for installing kits of every stripe.  There need be no conflict; even within the some mod, some kits could be installed with ADD_KIT_EX and other with ADD_KIT + fl#add_kit_ee + QDMulti.  The two methods could coexist perfectly well.

But, another suggestion, echoing one I already made to Wisp: if you do incorporate multiclass kits into this, I would put a check somewhere relatively early in the code looking at 1) is ToBEx present; and 2) is the kit single-class or multiclass... and if the answer to 1) is no, then only allow the kit installation to proceed if the answer to 2) is "multiclass."  (As discussed elsewhere, the EE engine is limited to 255 single-class kits, but multiclass kits added via a QDMulti-like fashion can exceed that limit.)

Offline Argent77

  • Planewalker
  • *****
  • Posts: 173
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #11 on: October 12, 2019, 01:54:50 PM »
Incidentally, if you are going to include multiclass kits in this function, there is no real need to glue QDMulti into it - you could of course also simply implement your own solution to achieve the same results - specifically, the creation of kit menu tables, and the use of .eff files or something similar to apply multiclass kit abilities via the single-class unkitted CLAB tables.
It would still make sense to use the same naming scheme for game resources to prevent compatibility issues if multiclass kits are installed by ADD_KIT_EX or the conventional way.

Further testing with multiclass kits reveals that maximum number of kits is virtually unlimited (possibly only restricted by the CRE's kit field size or by secondary tables).

@Wisp: To fully utilize the single-class kit limit without restricting multiclass kits I think it is possible to fill kitlist.2da with placeholders up to row 255 and continue with multiclass kit definitions at row 256 and up. However, that would require ADD_KIT and COPY_KIT to detect and use these placeholders correctly as well. Would it be possible or feasible to update WeiDU accordingly?

Offline Argent77

  • Planewalker
  • *****
  • Posts: 173
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #12 on: October 13, 2019, 12:17:34 PM »
Another beta is available: Version 0.3

Changelog:
  • Added full multiclass kit support for Enhanced Edition 2.0+ games (based on QDMULTI plus various improvements)
@subtledoctor: I have also updated my fork of QDMULTI, so that both libraries are on the same feature level.

Offline The Imp

  • Planewalker
  • *****
  • Posts: 282
  • Gender: Male
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #13 on: October 16, 2019, 12:07:58 AM »
This is nice:
Quote
Example of a minimalistic kit definition:
Could you also show a kit definition without any omitted variables ? Similar like this.

It just helps a bit more, in the transition.

Offline Argent77

  • Planewalker
  • *****
  • Posts: 173
Re: ADD_KIT_EX: An attempt to unify ADD_KIT, COPY_KIT and fl#add_kit_ee
« Reply #14 on: October 16, 2019, 10:16:06 AM »
This is nice:
Quote
Example of a minimalistic kit definition:
Could you also show a kit definition without any omitted variables ? Similar like this.

It just helps a bit more, in the transition.

The project contains an example mod that shows several use cases in more detail. There are components for:
« Last Edit: October 16, 2019, 12:43:52 PM by Argent77 »

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: