Author
Topic: WEIDU kit implementation problem (Read 4079 times)

Sir Kalthorine

As part of my "Chrysta" NPC mod, I have designed a custom thief kit ("Nature's Assassin") combining thief abilities and druidic powers (granting spells as innate abilities). I then used the WEIDU "ADDKIT" feature to install the kit in the game.

In the case of my clean install of SoA/ToB/latest official patch, the kit addition works just fine, and preliminary tests indicate that when Chrysta joins the party she has the correct kit, stats and abilities. Since my initial euphoria at getting something like that to work first time , I have encountered a couple of problems/difficulties.

PROBLEM 1 (possibly WEIDU related):

1) Just out of curiosity, I went back to my heavily-modded install of BG2 (I have two folders on my hard drive, one with the clean install and one with my originally mod-heavy version - I switch between them by changing the folder name when necessary!) and, after assuring myself that the game still ran normally, tried installing the kit and raw NPC. Chrysta still joined the party, but no longer with the custom kit. I then tried starting a game normally, and didn't even get the option of choosing the kit from the character creation screens. Anybody got any ideas if this is a WEIDU issue, or how I might go about linking together the NPC CRE file with a newly installed custom kit in situations where other custom kits already exist? In case it helps, these are the details of what mods I have installed in the mod-heavy folder:

What game and *exact* version number is the mod installed on?answer -] BG2 SoA + ToB with official patch 26498

Something very curious happens to the Chrysta NPC when she is dropped and rejoins the party. Basically, the way I have implemented her druidic spells is as innate abilities. The way I did this was (I thought) straightforward:- Load the relevant druidic .spl file- Change spell type and location to "Innate" (making sure I did so for all extension headers)- Saved it under a different name as another .spl file in the custom kit folder- Included "Grant ability" commands in the kit's CLAB.2da file (e.g. at level 2 "GA_SPCHR103" to give the ability to case modified spell SPCHR103 [Entangle] as an innate ability)- Included relevant copy commands in the Addkit .tp2 file to copy the spell ability files to the override directory

When first started and Chrysta joins the party, everything seems fine. However, when she is dropped and then rejoins, for some reason she is granted the ability to cast each innate ability spell AGAIN! So, for example, if at 8th level she is supposed to have the ablility to cast Entangle twice, if she is dropped and picked up again she is suddenly able to cast it FOUR times. If dropped and picked up again she is able to cast it SIX times, and so on. Strangely, this DOESN'T happen with the druidic shape change and poison weapon abilities - i.e. the ones that I DIDN'T have to tweak for the kit. Anyone got any ideas what is going on here?

Your probably is TDD, which fills up all of the kit slots. WeiDU still "adds the kit" (if you look at the 2DA files) ... but the game engine ignores it.

Currently, there is no "solution" for this. As has been remarked elsewhere, there is no substitute for mod-writer intelligence. Sigh.

None of my kits work with TDD either.

Every time a character joins your party, that character's kit abilities are applied again. In my opinion, that was an incredibly stupid (ok, I'll downgrade that, it was just mildly stupid) desgin decision. The benefit is that it allows Bioware to design their NPCs and Kits independenlty -- Korgan's CRE file does not need to explicitly say "I can rage twice per day" because when he joins your party, he will automatically get all of his kit abilities added. However, this leads itself to abuse (the most well-known one is having Yoshimo leave your party and rejoin: presto, he can set all of his traps again) *and* unforseen design problems (kitted monsters do not actually get kit abilities: if you make a CRE monster with a kit, you must add in the abilities yourself. Case in point: Koshi in the Guarded Compound is a Kensai, but does not have any of the kensai abilities unless you install the Imp GC. This problem is particularly difficult to spot because if you use Ctrl-Q to put him in the party and check for bonuses, the kit is added in, so everything looks fine!).

The short answer is use AP instead. You may have to add a level of indirection: use AP to apply some spell that has permanent duration and grants the innate ability to cast whenever you were GA'ing before. Or something.

Sir Kalthorine

Your probably is TDD, which fills up all of the kit slots. WeiDU still "adds the kit" (if you look at the 2DA files) ... but the game engine ignores it.

Currently, there is no "solution" for this. As has been remarked elsewhere, there is no substitute for mod-writer intelligence. Sigh. None of my kits work with TDD either.

*sigh* Bummer!! Ah well, I guess the only way I am going to get around this is by doing one of the following:

1) Making Chrysta incompatible with TDD (not a good choice if I want the mod to be available to as many BG2-players as possible, methinks)

2) Make a calculated choice and DELETE one of the lesser used TDD kits with Chrysta's kit. In that case, I would have to include non-WEIDU versions of the relevant kit .2da files with the redundant kit "deleted", with instructions that they be manually pasted into the override file, and then there would be room to "WEIDU-in" the new kit. Disadvantages here would be the cumbersome installation steps needed... plus the fact that there will always be someone whose favourite TDD kit has been deleted!

3) Forget implementing Chrysta as a proper "new" kit, keep her as a standard thief and just rely on giving her all her relevant new abilities via clever scripting. Although on the face of it this seems the most logical choice, I just don't like the thought of Chrysta appearing as a "normal" thief on the character record screen - it just spoils some of the "magic", doncha think?

Perhaps it would be useful to get feedback as to what people think would be my best/preferred course of action?

Quote

Every time a character joins your party, that character's kit abilities are applied again. In my opinion, that was an incredibly stupid (ok, I'll downgrade that, it was just mildly stupid) desgin decision. The benefit is that it allows Bioware to design their NPCs and Kits independenlty -- Korgan's CRE file does not need to explicitly say "I can rage twice per day" because when he joins your party, he will automatically get all of his kit abilities added. However, this leads itself to abuse (the most well-known one is having Yoshimo leave your party and rejoin: presto, he can set all of his traps again) *and* unforseen design problems (kitted monsters do not actually get kit abilities: if you make a CRE monster with a kit, you must add in the abilities yourself. Case in point: Koshi in the Guarded Compound is a Kensai, but does not have any of the kensai abilities unless you install the Imp GC. This problem is particularly difficult to spot because if you use Ctrl-Q to put him in the party and check for bonuses, the kit is added in, so everything looks fine!).

The short answer is use AP instead. You may have to add a level of indirection: use AP to apply some spell that has permanent duration and grants the innate ability to cast whenever you were GA'ing before. Or something.

LOL!! Don't I know it! I tried japheth's advice and just replaced all occurrences of "GA_" with "AP_" in the kit's CLAB file. What followed was one one the great BG2 "comedy" moments as Chrysta joined the party and was simultaneously hit by the effects of two entangles, barkskin, shillelagh, cure light wounds, resist fire, slow poison, hold animal, summon insects and call lightning!! The poor girl! :lol:

But seriously for a sec, am I right in thinking that you suggest I use AP_(ability-giving-spell) in Chrysta's script to give her her spell-casting abilities, or will it work OK if I put the relevant AP_ in the CLAB.2da file?

Anyway, thank you A LOT!! for such a comprehensive and helpful response - at least I feel I am getting somewhere... even if I don't 100% like where that "somewhere" is

Logged

hlidskialf

Scripting may be your best choice here. Hell, this way she'll be REALLY different. It would (IMO) take away a lot of her mystique if the PC happened to be exactly the same kit as she. As for your displeasure of her name appearing as a plain ol' thief, that's easily changed by applying a spell with the Change Title effect. Or perhaps would be directly changeable via weidu during the installation.

You can use WeiDU's ACTION_IF to make the "cumbersome" install part of (2) only cumbersome to you as your write it -- to the user it's still just "yes/no".

However, I recommend (3). It worked for Valen. Here's a tip: there's a special effect in BG2 called "change title" or something (look for it in NI, who knows) that is given to druids to change their title to "Great Druid" or whatever when they hit level 13 (or is it 14?).

Just start your NPC off with a permanent "change title" effect to some new string of your choice. Then you can see "Thief of Fate" or "Master of the Universe" or whatever instead of just "Thief" on the character screen.

Logged

Sir Kalthorine

The more I hear about this the more I like the scripting option!! Particularly as this "Change Title" command is an option - I suppose it would be just too much to ask for their to be a "change kit description" type command as well?!?

I take it the scripting might work something like the following, in the ChrystaJ.bcs script [I accept the syntax may not be quite right, as I am still a scriptwriting newbie], with one entry for each new level's abilities:

Sir Kalthorine

Thanks evasomuch for all your help and advice so far - just one final request and I'll leave you alone for a while!

I've found the "Change title" spell effect using IEEP's spell maker. Now, lets say I called this spell "Kit Title" and saved it in a file called SPtitle.spl, in a folder called "Chrysta" in the main BG2 directory. As far as I understand it I would normally put the following lines in my WEIDU .tp2 file to copy it over:

My one hiccup is that the blurb that comes with the "Change Title" spell effect says:

Quote

This effect will change the Title associated for an individual. The StrRef Number parameter is the string reference number from the dialog.tlk which contains the text to change the Title to, and the Position parameter sets which Title is changed. Known values of the Position parameter are 0 to change the Title on the Records Screen information section, and 1 to change Title shown on the top of the bar for the character in various of the character screens (like Inventory and Records Screen). For example the Records Screen would show for a level 8 beserker, Beserker along the top bar (changable by the value of 1) and Beserker: Level 8 on the information section (changable by the value of 0).

The problem here as I see it is that little "The StrRef Number parameter is the string reference number from the dialog.tlk which contains the text to change the Title to" comment. If I were doing it the non-WEIDU way it would be pretty straightforward - just manually edit the dialog.tlk file and make a note of the string reference number. But I DO want to use WEIDU to make the whole mod as compatible as possible, so how do I add the relevant title to the custom spell in a similar way as is done using "SAY NAME1 ~Kit Title~" to add the NAME of the custom spell to the dialog.tlk file?

SK, you have just been the beneficiary of a phenomenon that BG2 scientists will probably one day call "The Compton Ignorance Certainty Principle" (CICP). Put simply, this principle says that if I offer a piece of advice on a somewhat complex BG2 modding problem, the less I know about the technology involved, the more likely it is that I'm right.

I know nothing at all about kit design and little about scripting... but as you might recall, I suggested you use the scripting route rather than kit design in the early going.

Because I do not know what I am talking about, it turned out I was right about it.

One other thought I have is that the thief XP table is pretty generous. To balance her getting all these swanky powers, if that interests you, you might consider using her script to implement XP penalties.

Sir Kalthorine

One other thought I have is that the thief XP table is pretty generous. To balance her getting all these swanky powers, if that interests you, you might consider using her script to implement XP penalties.

Excellent idea! I take it this is another area you know nothing about then... LOL! :lol:

Quote

Because I do not know what I am talking about, it turned out I was right about it.

I've found the "Change title" spell effect using IEEP's spell maker. Now, lets say I called this spell "Kit Title" and saved it in a file called SPtitle.spl, in a folder called "Chrysta" in the main BG2 directory. As far as I understand it I would normally put the following lines in my WEIDU .tp2 file to copy it over:

My one hiccup is that the blurb that comes with the "Change Title" spell effect says:This effect will change the Title associated for an individual. The StrRef Number parameter is the string reference number from the dialog.tlk which contains the text to change the Title to, and the Position parameter sets which Title is changed. Known values of the Position parameter are 0 to change the Title on the Records Screen information section, and 1 to change Title shown on the top of the bar for the character in various of the character screens (like Inventory and Records Screen). For example the Records Screen would show for a level 8 beserker, Beserker along the top bar (changable by the value of 1) and Beserker: Level 8 on the information section (changable by the value of 0).

Actually, the way you've written the .tp2 portion would just make the spell's name "Kit Title".

[ Edit By Weimer: I am 99% certain that this is not what you want. See my next message for how to actually do this. ]

So when you cast the spell, "Kit title-change-o-matic 3000" would be displayed. If you somehow wound up with this in your spellbook, the description would be "This spell will...". What the REPLACE thing does is replace any instances of 11111 in the file to a dynamic StrRef, which WeiDU will make at the time of installation. i.e. it appends StrRef 98765 to dialog.tlk with the text "Pirate Extraordinaire" and then the spell will have 98765 instead of 11111. :D

Here's hoping the funky quoting I've done works. I'm not used to this forum.

Edit: Added tildes to REPLACE 11111, and also note that, yes, I've seen the CICP in action. Rue the day that you don't listen to Jason babbling, because the IE will make his theories true just to spite you.

First, do not use "REPLACE". REPLACE is perfect for changing ASCII base-ten numbers into string references. Imagine that you have "foo.txt" and it contains "Mary had 5 little lambs.". Then you do

COPY ~foo.txt~ ~override/result.txt~ REPLACE 5 ~Jon Irenicus~

The file "result.txt" will say "Mary had 9296 little lambs." because 9296 is the string reference for ~Jon Irenicus.~

[ By the way, it is worth noting that this syntax is both horrible and completley arbitrary. Don't sweat it if it is completely non-intuitive. ]

SPL files are not text files. The string reference associated with the change title opcode will be stored as a 32-bit integer (NOT an ascii base-ten number) somewhere in the middle of the BINARY spell file. Say, at offset 0x1EE. This is just like the way that item names and descriptions or spell names or creature names are stored. So you want this:

COPY ~newTitle.spl~ ~override/newTitle.spl~ SAY 0x1EE ~Thief of Fate~

I actually recommend against having any "name" associated with this spell -- leave it blank (= STRREF #-1). Otherwise when your NPC is first created (or when you enter the area with this NPC) you'll see something like:

"NewNPC- Title Change"

... which makes no sense in teh game. I guess if the title change happens at some momentus moment it could work, but neither Anomen's name change nor the PC-Druid's title change say "Title Change Spell" when they happen.

Use Near Infinity to determine the exact offset of the string reference for the titel change in your SPL file. It may not be 0x1EE for you.

Sir Kalthorine

First, do not use "REPLACE". REPLACE is perfect for changing ASCII base-ten numbers into string references. Imagine that you have "foo.txt" and it contains "Mary had 5 little lambs.". Then you do

COPY ~foo.txt~ ~override/result.txt~ REPLACE 5 ~Jon Irenicus~

The file "result.txt" will say "Mary had 9296 little lambs." because 9296 is the string reference for ~Jon Irenicus.~

[ By the way, it is worth noting that this syntax is both horrible and completley arbitrary. Don't sweat it if it is completely non-intuitive.]

That's OK. Makes sense so far...

Quote

SPL files are not text files. The string reference associated with the change title opcode will be stored as a 32-bit integer (NOT an ascii base-ten number) somewhere in the middle of the BINARY spell file. Say, at offset 0x1EE. This is just like the way that item names and descriptions or spell names or creature names are stored. So you want this:

COPY ~newTitle.spl~ ~override/newTitle.spl~ SAY 0x1EE ~Thief of Fate~

Right. Gotcha. So this "offset" is the location in the Binary spell file where the string reference is located, right (i.e. where it says where it is going to look in the dialog.tlk file)? Have I got that right?

Quote

Use Near Infinity to determine the exact offset of the string reference for the titel change in your SPL file. It may not be 0x1EE for you.

Ah... oh dear... now my virgin status as a modder starts to become painfully obvious! :unsure: I am sorry for being really thick but I have absolutely NO idea how I go about doing that. Where in the .spl file would I look to find that, and how would I recognise it if I did find it?

Quote

What sort of physics do you teach?

Physics to 11-18 yr olds in the UK (GCSE and 'A' level). 10 years into the job and I still enjoy it... some weirdo huh?

Now imagine that offset 0x2 is the "name offset" in our 7-byte SPL file (it's not, but imagine). Then the infinity engine will load the 7-byte SPL file, look at offset 0x2, read the byte 01, and look at entry 1 in dialog.tlk. It will then display the string "Finger of Death" as the name for that spell. This is not exactly how these things happen, but it's real close.

Download Near Infinity by following links from my website. You'll have to download some Java thing to make it work as well. Put your changeTitle.spl file in the override folder. Fire up Near Infinity. Go to the "Options" menu and turn on "Show Hex Offsets". Go to the "override" folder and click on your changeTitle spell. Click through its abilities and effects until you find the change title one. To the far right of it in a little column will be the hex offset. Write it down, then put it in your TP2 file.

High school physics, eh? Projectile motion, F=ma, angular velocity, inverse-square laws, that kind of thing? Or do you get to do E&M as well and play with static electricity and surface integrals?

Logged

Sir Kalthorine

Download Near Infinity by following links from my website. You'll have to download some Java thing to make it work as well. Put your changeTitle.spl file in the override folder. Fire up Near Infinity. Go to the "Options" menu and turn on "Show Hex Offsets". Go to the "override" folder and click on your changeTitle spell. Click through its abilities and effects until you find the change title one. To the far right of it in a little column will be the hex offset. Write it down, then put it in your TP2 file.

THANK YOU!!! Boy, do I feel foolish!! Didn't even think to check in the Near Infinity menus.... kthunk... kthunk... kthunk... (sound of head hitting wall repeatedly).

Quote

High school physics, eh? Projectile motion, F=ma, angular velocity, inverse-square laws, that kind of thing? Or do you get to do E&M as well and play with static electricity and surface integrals?

Yup, that's the sorta thing! Although we don't touch on surface integrals (no pun intended!) at least these days I get to confuse the poor little b*gg*rs with thoughts on Universe origins and basic relativity.

Logged

Sir Kalthorine

So, having got a brain implant and discovered that the offset to the "Title" entry in the relevant reads "9e h", I take it that the command I put in the .tp2 file to have the spell (called ChTitle.spl) grant title read "Nature's Assassin" be:

Sir Kalthorine

Ah, argh, sorry for the misinformation. I use the REPLACE tactic for scripts, but now that I think about it... yeah. Argh, oops. :unsure:

No apology necessary, Ghreyfain - I am grateful for any and all advice I can possibly receive. I am so woolly and imprecise with my requests for help that I am glad people are covering all the bases for me!

You can always tell if it works by installing [that part of] your mod and then pulling up the resulting spell in IEEP or NI. If the strref has changed to 72000-something and the string is ~Nature's Assassin~, it worked.

It should be noted - to anyone adding a custom kit to a full load - that the Kits are in the Kit tables by RACE, and one could, conceivably, remove a single kit from the race your charracter will be, and/or just reorder that particular race's kits (that is, put the new kit in slot 1 for the race, and move everything else down). The panel has room for 11 buttons, so one could search for the 10th kit being in place already in the appropriate K_* file.