TheLizard Posted December 27, 2023 Posted December 27, 2023 These are probably very basic questions since I'm new to modding this game. I want to change an innate ability -- let's say kensai's Kai ability SPCL114 -- so that it has an 8-character resource name (for use with opcode 172). Other than that, I want it to be identical to the standard version -- for example, it should be granted when I gain kensai levels, cast when a script requests casting KENSAI_KIA, and so on. Can I use 8 character names in CLAB and LU files? What about spell.ids? There is a convention that the number in spell.ids corresponds to the filename, which I won't be able to follow. Will it be impossible to refer to the new resource in scripts via IDS reference? Is there any way around this? Quote
jmerry Posted December 27, 2023 Posted December 27, 2023 Shorter resource names are just fine in opcodes that use a resource reference; the remaining bytes of that field are filled out with nulls. SPLs referenced in a kit's CLAB - the GA_ and AP_ entries - can have a resource name of up to eight characters, at least in the EE. The first entry in Wilson the bear's kit CLAB, for example, is AP_OHRBEAR1. And of course, that resource name doesn't have to be of any particular form. Entries in spell.ids encode the filename, and that filename is one of exactly four thousand possibilities (SPPR###, SPWI###, SPIN###, and SPCL###, where ### are digits). That's not just a convention; it's hardcoded in how the file works. Fortunately, you can tell scripts to use spells that don't have spell.ids labels; all of the "use a spell" actions have RES versions that take the resource name as a parameter. For example, here's a block from Aerie's script in BG2EE, to give her the right holy symbol: IF HasItem("CDHLYSYM",Myself) // No such index THEN RESPONSE #100 ApplySpellRES("CDHLYSY2",Myself) ActionOverride(Myself,TransformItem("CDHLYSYM","beltbw")) END Quote
TheLizard Posted December 27, 2023 Author Posted December 27, 2023 56 minutes ago, jmerry said: Shorter resource names are just fine in opcodes that use a resource reference; the remaining bytes of that field are filled out with nulls. SPLs referenced in a kit's CLAB - the GA_ and AP_ entries - can have a resource name of up to eight characters, at least in the EE. The first entry in Wilson the bear's kit CLAB, for example, is AP_OHRBEAR1. And of course, that resource name doesn't have to be of any particular form. Entries in spell.ids encode the filename, and that filename is one of exactly four thousand possibilities (SPPR###, SPWI###, SPIN###, and SPCL###, where ### are digits). That's not just a convention; it's hardcoded in how the file works. Fortunately, you can tell scripts to use spells that don't have spell.ids labels; all of the "use a spell" actions have RES versions that take the resource name as a parameter. For example, here's a block from Aerie's script in BG2EE, to give her the right holy symbol: IF HasItem("CDHLYSYM",Myself) // No such index THEN RESPONSE #100 ApplySpellRES("CDHLYSY2",Myself) ActionOverride(Myself,TransformItem("CDHLYSYM","beltbw")) END Thank you, this is exactly what I was looking for. I guess this means if I wanted to make existing scripts compatible, I would need to do a large-scale replacement of relevant copies of ApplySpell with ApplySpellRES. I asked the part about CLAB files because it did not initially seem to work for me, but it turns out it's because I typoed the resource name. How embarrassing. Anyway, obviously it worked perfectly after fixing that, but unfortunately, I was then able to test opcode 172 with 8-char innate spells and it seems like it behaves exactly the same as it does for 7-character resources -- all the "memorized" copies disappeared. Perhaps the behavior noted in the IEDSP is only for wizard and priest spells? Anyway, unless I'm somehow screwing up again, it looks like I'll need to find another method Quote
jmerry Posted December 27, 2023 Posted December 27, 2023 Huh. So the IESDP does say that 8-character names are treated differently than shorter names in opcode 172. Actually, it says multiple things that appear to contradict each other. Looks like an issue to bring up in that project's subforum. Quote
subtledoctor Posted December 27, 2023 Posted December 27, 2023 (edited) I was going to say, don’t get your hopes up. Op172 works worse with 8-letter innates, not better. Maybe it works to decrement spellbook spells - it’s been a long time since I tried that - but spellbook spells decrement themselves already, and most of them have 7-character filenames for other reasons. With 8-character innate abilities, IIRC, op172 removes all instances but they come back the next day. So, if paired with op171 you end up with forever-increasing uses. It’s not clear from the post exactly what you are trying to do. If you want to use innate abilities like Kai with decrementing uses in more flexible ways, my ki pool function might be useful. Edited December 27, 2023 by subtledoctor Quote
Recommended Posts
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.