Jump to content

Remove Spell (172) and spells inside the spell book


critto

Recommended Posts

So, this have been discussed in the past before, like here, for instance. I'm running into the same problem.

Situation: I want to remove a normal spell from spell book for specific kits/classes. I prep an ability that applies a permanent 172 opcode with the necessary spell and put it into a CLAB 2da as "AP_*" at the appropriate level. Everything works initially during character creation. The spell is gone. After a level up, it keeps coming back. I've tried adding the AP_* ability at every level up, and it gets applied (judging by the debug Display String opcode I've added to it) but the spell keeps sitting in the spell book nonetheless.

What's up with that? Is it fundamentally impossible to achieve because the game processes the CLAB file first, after a level up (and the 172 opcode gets applied, but there's nothing to remove yet), and then re-populates the spell book? Or am I missing something?

Cheers

Link to post

I tried to apply the same AP_* ability I use in CLAB but via a script block upon hitting XP threshold. The spell gets removed from the spell book correctly. So something is definitely wrong with the order of application when it happens automatically via CLAB during the level up.

Link to post

I assume you’re talking about divine spells? All spells with the filename “SPPR[1-7][01-49]” are automatically added to the spellbook upon every level-up, as long as they are not precluded by an exclusion flag. 

This happens a split second after CLAB effects are processed. I don’t think that means “something is wrong” with the order of events... that’s just the way the engine works. Scripted triggers probably happen later because they require the game clock to be running for a second or so before they are recognized and acted upon. (Try your XP script trigger and level up with the game paused.)

Your options are:

1) Use timing mode 4 with a duration (delay) of 1 second on your 172 effects, and apply it every level... I do this sometimes, like to make multiclass druids as multiclass cleric kits. It works tolerably well, the only hitch is that it requires the game clock to run, so if someone levels up and looks at their spellbook while the game is paused, they can see the ‘bad’ spells there.

2) On the latest EE engine, you can use a kit exclusion flag on the spells, and add that flag to your kit. Should be a kit that normally doesn’t interact with divine spells, (so nothing that can multi/dual with cleric) and any item exclusions with the same flag will be unusable by your kit - so e.g. the Cavalier flag might be bad if your kit wants to use missile weapons. In this case, a bard or paladin flag might work best. This can work very well, you just need to be very careful with the use of such flags, and consider what other mods might do with them. Also some flags may or may not be functional with some spells on the pre-EE engine. 

Link to post
Quote

I assume you’re talking about divine spells? All spells with the filename “SPPR[1-7][01-49]” are automatically added to the spellbook upon every level-up, as long as they are not precluded by an exclusion flag.


Yes, about divine spells, exactly. Yes, I figured that they are added upon every level-up.

Quote

This happens a split second after CLAB effects are processed. I don’t think that means “something is wrong” with the order of events... that’s just the way the engine works. Scripted triggers probably happen later because they require the game clock to be running for a second or so before they are recognized and acted upon. (Try your XP script trigger and level up with the game paused.)


This is sort of makes sense. I used the DPLAYER3 script trigger and activated it on demand by turning the party AI on and off, so there's obviously more lag between the events.

Quote

1) Use timing mode 4 with a duration (delay) of 1 second on your 172 effects, and apply it every level... I do this sometimes, like to make multiclass druids as multiclass cleric kits. It works tolerably well, the only hitch is that it requires the game clock to run, so if someone levels up and looks at their spellbook while the game is paused, they can see the ‘bad’ spells there.


It didn't occur to me to delay the application of effect. While reading the old threads I got the idea that the 172 opcode is kind of permanent no matter what kind of timing mode you choose. I resorted to adding an ability to every level in CLAB too, but I'll have to play around with the delay as well. It might be good enough solution.

As for seeing the 'bad' spells on pause, I am afraid these are just limitations the players will have to accept. There isn't any way to hide the 'bad' spells during the char creation either. They go away only after you're done with the "skills" section of character generation.

Quote

2) On the latest EE engine, you can use a kit exclusion flag on the spells, and add that flag to your kit. Should be a kit that normally doesn’t interact with divine spells, (so nothing that can multi/dual with cleric) and any item exclusions with the same flag will be unusable by your kit - so e.g. the Cavalier flag might be bad if your kit wants to use missile weapons. In this case, a bard or paladin flag might work best. This can work very well, you just need to be very careful with the use of such flags, and consider what other mods might do with them. Also some flags may or may not be functional with some spells on the pre-EE engine.


Could you clarify a bit more on the flags, please? Or point me at the example of implementation to study in greater detail. Looking at the documentation of the SPL format, I'm not entirely sure which field is responsible for these flags. I assume it is not the default 0x001e? Generally speaking, bard/paladin kit should be ok since I'm modifying the shaman class (unless I misunderstood your comment about divine spells: it's ok for my class/kit to use divine spells, but not for the provider of the supposed exclusion flag?). Conflicts between mods aren't really a problem, since my mod is completely stand-alone and it is EE-only.

Edited by critto
Link to post
4 hours ago, critto said:

I got the idea that the 172 opcode is kind of permanent no matter what kind of timing mode you choose

Yes, the removal is permanent, which is good; but the SPPR spells get added every level so a 172 effect would have to be applied at every level-up.  A 1-second delay works fine.  Note one issue here: spells with timing mode 4 do NOT get applied when you "pre-generate" a character and then import it into a game.  So if someone pre-generated a character with this mod, they would have the spells you want to remove, until their first level-up.

4 hours ago, critto said:

I'm modifying the shaman class

Ah.  Doing this with the base Shaman is not great, since that is a class and AFAIK it uses the trueclass exclusion flag, and there is  no way to give it a different one.  Shamans are hard-coded to get the same spells as druids and rangers: every SPPR spell that does not have the druid exclusion flag set in byte 0x21 (i.e. the 4th byte of the field at 0x1e, as you said).  Differentiating between druids and shamans probably requires using 172.

If this was a shaman kit, on the other hand, you could use exclusion flags pretty easily.  Whereas normally when adding a kit you will probably give it the trueclass exclusion flag: 0x00004000, in this case you could give this shaman kit the Jester flag: 0x00400000.  Then, when installing with Weidu you could gather up all the spells you don't want this kit to have access to, and set the Jester exclusion flag on them:

WRITE_BYTE 0x20 (THIS BOR 0x01000000)

(In Near Infinity, change one of the spells from divine to arcane in the field at 0x1c, and then the bard kits will be visible in the field at 0x1e. You can check the Jester flag, and then change the spell back to divine.)

Now those spells will not be added automatically at level-up (no need for 172), and they will not be shown during character generation.  This would be perfect for you... but again, I don't think it can be done with a class - only with kits.

Edited by subtledoctor
Link to post

Yes, the removal is permanent, which is good; but the SPPR spells get added every level so a 172 effect would have to be applied at every level-up.  A 1-second delay works fine.  Note one issue here: spells with timing mode 4 do NOT get applied when you "pre-generate" a character and then import it into a game.  So if someone pre-generated a character with this mod, they would have the spells you want to remove, until their first level-up.


Interesting. I haven't thought about this scenario at all. So many gotchas.

Ah.  Doing this with the base Shaman is not great, since that is a class and AFAIK it uses the trueclass exclusion flag, and there is  no way to give it a different one.  Shamans are hard-coded to get the same spells as druids and rangers: every SPPR spell that does not have the druid exclusion flag set in byte 0x21 (i.e. the 4th byte of the field at 0x1e, as you said).  Differentiating between druids and shamans probably requires using 172.


Yes. I did some searching on the forum for the exclusion flag and figured that might be an issue. It's a shame, this is a much cleaner solution, overall.

(In Near Infinity, change one of the spells from divine to arcane in the field at 0x1c, and then the bard kits will be visible in the field at 0x1e. You can check the Jester flag, and then change the spell back to divine.)


Yeah, I finally found those earlier when I was checking out different spells in NI. These aren't listed in IEDSP, so I was clueless at first. Just to be clear, there's no correlation between the exclusion flags and the type of spell? I.e. if the type is set to divine and the exclusion flag is checked for the Jester kit, this would still work? The game does not make any extra checks to make sure that the jester kit should be taken into account only if the type of spell is set to wizard?

Now those spells will not be added automatically at level-up (no need for 172), and they will not be shown during character generation.  This would be perfect for you... but again, I don't think it can be done with a class - only with kits.


I guess I'll have to resort to the first solution. The delayed application works well enough, but there are still some funny things. For example, when there's no delay on the application of 172, you can see the effect immediately during character creation. Once you're done with the "skills" section, there's an information screen, and the spells being removed aren't present on it. But if you use timing mode 4, spells would still be listed. The 172 code gets applied only after you actually start the game. Which kind of makes sense, I guess, because the game is probably "on pause" during character creation.

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.

×
×
  • Create New...