Jump to content
Sign in to follow this  
Galactygon

SPELLS.2da

Recommended Posts

According to the IESDP, SPELLS.2da

defines which spells are given to priest-types on level-up. Priests gain spells SPPR[1-9][**] where ** is the column from this file, i.e. with the default file, priests will gain all SPPRxYY spells, where x is 1-7 and YY is 50 or below.

 

But this isn't true. I had a spell named SPPR459.spl, and it was not given to the priest at level up, while all the other spells that were less than SPPR450 were. This happened even when I changed the values of SPELLS.2da from 50 to 70.

 

I am assuming this behaviour hardcoded in the .exe.

 

-Galactygon

Share this post


Link to post
According to the IESDP, SPELLS.2da
defines which spells are given to priest-types on level-up. Priests gain spells SPPR[1-9][**] where ** is the column from this file, i.e. with the default file, priests will gain all SPPRxYY spells, where x is 1-7 and YY is 50 or below.

 

But this isn't true. I had a spell named SPPR459.spl, and it was not given to the priest at level up, while all the other spells that were less than SPPR450 were. This happened even when I changed the values of SPELLS.2da from 50 to 70.

 

I am assuming this behaviour hardcoded in the .exe.

 

-Galactygon

I know that for mage spell selection, the engine hard-codes a limit of 50. SPELLS.2DA is not used. I imagine this is the same for priest spells.

Share this post


Link to post
I vote for a ToBEx fix, which you can never have too many.

 

-Galactygon

Easily done. Looking closer, 'generic' priest spell addition (i.e. not associated with class ability table) does look at SPELLS.2DA, so that needs to be changed as well.

 

The way vanilla works is:

1. Check SPELLS.2DA for count of spells to look for

2. Build a file-name based on SPPR<level><index> for each index, up to a maximum of 50

3. Check exclusion flags and alignment

4. If OK, add the spell.

 

Mage spell selection does not check SPELLS.2DA. Ths specific function is actually present in the exe but is never called.

Edited by Ascension64

Share this post


Link to post
I vote for a ToBEx fix, which you can never have too many.
Wait, this "fix" could potentially create some havoc because there are tons of vanilla's spells with sppr/spwiXYZ where YZ > 50 that shouldn't appear in priest/mage spellbooks.

 

And even if you can counter it (e.g. with a hidespell.2da), do we really need more than 50 spell slots per level? :blush:

Share this post


Link to post
do we really need more than 50 spell slots per level? :laugh:
Yeah...

 

Wait, this "fix" could potentially create some havoc because there are tons of vanilla's spells with sppr/spwiXYZ where YZ > 50 that shouldn't appear in priest/mage spellbooks.
Well, time to correct that then ? Like actually putting the MI -prefix to the files, or go and register your own... unless you are Devlinor. :blush:

Share this post


Link to post
do we really need more than 50 spell slots per level? :laugh:
Yeah...
50 spells per spell level? ahahahah

 

Wait, this "fix" could potentially create some havoc because there are tons of vanilla's spells with sppr/spwiXYZ where YZ > 50 that shouldn't appear in priest/mage spellbooks.
Well, time to correct that then ? Like actually putting the MI -prefix to the files, or go and register your own... unless you are Devlinor. :blush:

Actually I'm talking about tons of vanilla's spells, not only SR ones. There are plenty spwi4XY for example, and all vanilla's HLAs too should be "corrected". All of this for what?

 

Anyway, I was only saying that if someone want to go that way he/she has to take into account that.

Share this post


Link to post
Wait, this "fix" could potentially create some havoc because there are tons of vanilla's spells with sppr/spwiXYZ where YZ > 50 that shouldn't appear in priest/mage spellbooks.
Well, time to correct that then ? Like actually putting the MI -prefix to the files, or go and register your own... unless you are Devlinor. :blush:

Actually I'm talking about tons of vanilla's spells, not only SR ones. There are plenty spwi4XY for example, and all vanilla's HLAs too should be "corrected". All of this for what?

 

Anyway, I was only saying that if someone want to go that way he/she has to take into account that.

It can be accounted for.

 

For SPWI, modifying HIDESPL.2DA can prevent HLAs and other unwanted spells from appearing in mage spell selection. However, I have not added a hack to change the limit on this for TobEx. The biggest issue I had was SPWI853, which really is a copy of the innate spell SPIN853.

 

For SPPR, there are only issues associated with levels 4 and 5. In the hack that I made, I recommend setting SPELLS.2DA to 98 and 97 for these levels to make sure that these spells do not get added to priest spells. Note that priest HLAs are excluded by hard code in the EXE. Theoretically, this can be externalised like the mage spells.

 

The final thing to remember is that hacks can be turned off. Therefore, if you don't want 99 spells per level, turn off the hack!

Share this post


Link to post

The best thing really is a reverse of HIDESPL.2da - a SHOWSPL.2da that allows prefixed spells to appear in spell selection/are added automatically to priests without the need to go into CLABs.

 

This debate would be over if certain opcodes (like RemoveSpell)/triggers/actions could handle prefixed spells.

 

-Galactygon

Edited by Galactygon

Share this post


Link to post

Ascension64: Do you know which offset in the .exe handles the maximum number at which spells are given to priests/sorcerers? I'm interested in raising the limit without relying on ToBEx. This problem of spell slots is very real for SPWI9xx spells - almost all empty slots are above SPWI950.

 

-Galactygon

Share this post


Link to post

006336BF  |> \837D 10 00	CMP DWORD PTR SS:[EBP+10],0
006336C3  |.  7C 06		 JL SHORT bgmain.006336CB
006336C5  |.  837D 10 31	CMP DWORD PTR SS:[EBP+10],31
006336C9  |.  7E 12		 JLE SHORT bgmain.006336DD

 

Translates to if (nIndex >= 0 && nIndex <= 49)

You will want to change the 0x31 @ exe offset 0x2336C8 (the above offsets are memory addresses, so subtract 0x400000)

Not that you can go above 99 (0x63) without making the filename 8 characters instead of 7, but this is a signed byte so don't go above 127 (0x7F) or you'll wrap on negative numbers.

 

Also, there are quite a few stock ToB spells in the 50-99 group, so please make sure you exclude all these in HIDESPL.2DA as necessary.

Share this post


Link to post

Many thanks, Ascension64.

 

Translates to if (nIndex >= 0 && nIndex <= 49)

You will want to change the 0x31 @ exe offset 0x2336C8 (the above offsets are memory addresses, so subtract 0x400000)

Not that you can go above 99 (0x63) without making the filename 8 characters instead of 7, but this is a signed byte so don't go above 127 (0x7F) or you'll wrap on negative numbers.

 

So that's a (can't test this right now) :

PATCH_IF (SHORT_AT 0x2336C8 >= 0 && SHORT_AT 0x2336C8 <= 89) BEGIN
WRITE_SHORT 0x2336C8 89 // Setting the max to SPWI/SPPRx89
END

?

 

Also, there are quite a few stock ToB spells in the 50-99 group, so please make sure you exclude all these in HIDESPL.2DA as necessary.

 

Without touching anything or resorting to HIDESPL.2da, I can go up to 89 since most of the junk have either a different spell level or a different spell type assigned. The problem only starts at SI Abjuration (SPWI590) which is assigned as a level 5 wizard spell. I'm interested in the SPWI966-SPWI978 slots, which is within 89.

 

-Galactygon

Share this post


Link to post
So that's a (can't test this right now) :

PATCH_IF (SHORT_AT 0x2336C8 >= 0 && SHORT_AT 0x2336C8 <= 89) BEGIN
WRITE_SHORT 0x2336C8 89 // Setting the max to SPWI/SPPRx89
END

?

WRITE_BYTE (and BYTE_AT), not WRITE_SHORT.

Share this post


Link to post

It looks like SHORT from my POV

006336BF  |> \837D 10 00	CMP DWORD PTR SS:[EBP+10],0
006336C3  |.  7C 06		 JL SHORT bgmain.006336CB
006336C5  |.  837D 10 31	CMP DWORD PTR SS:[EBP+10],31
006336C9  |.  7E 12		 JLE SHORT bgmain.006336DD

 

But I can't confirm or deny anything, as (i) most of this is above me, and (ii) I haven't tested anything.

 

-Galactygon

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.

Sign in to follow this  

×
×
  • Create New...