Raduziel Posted June 15, 2020 Author Share Posted June 15, 2020 (edited) 4 hours ago, subtledoctor said: I don’t think there even are any spells in some of those categories. Ok, I think I understand the problem now and maybe I've expressed myself poorly. Quote - one array of 1st-level cleric-only spells excluded from good casters Taking this as an example. That's not what I'm looking for what I want is, following this example, all first-level spells that are not druid exclusive and not evil exclusive. Examples of such spells: Command, Magic Stone, Sanctuary... So maybe I need to invert the zeros and ones from the BAND part of the code? Edit: Changing to: PATCH_IF (alignment BAND 0b11111011 = 0b11111011) BEGIN PATCH_IF (class BAND 0b01111111 = 0b01111111) BEGIN Also doesn't work... Edit2: Made a new test using BOR PATCH_IF (alignment BOR 0b00000100 = 0b00000100) BEGIN PATCH_IF (class BOR 0b10000000 = 0b10000000) BEGIN Doing this the spells appear in the spellbook but too many spells, as you can see in the image attached - Change Chicken, Dark Gift, Chromatic Orb (twice), Repulse X, two versions of Entangle and Bless, Spirit Ward, a nameless spell with a Detect Evil icon, etc. But that's definitely some progress, no doubt. Anyone with an insight of what I may be doing wrong? Thanks. Edited June 15, 2020 by Raduziel Quote Link to comment
subtledoctor Posted June 15, 2020 Share Posted June 15, 2020 (edited) 3 hours ago, Raduziel said: Ok, I think I understand the problem now and maybe I've expressed myself poorly. You expressed yourself fine, you only wrote the code poorly! 3 hours ago, Raduziel said: Change Chicken, Dark Gift, Chromatic Orb (twice), Repulse X, two versions of Entangle and Bless, Spirit Ward, a nameless spell with a Detect Evil icon, etc. I don't know what the heck "Change Chicken" is, but if you are adding spells, and you want it to match what the engine will automatically add at the next level-up (hint, hint), then you need to limit the spells to those with the SPPR prefix - could maybe do something like: SNPRINT 4 ~%SOURCE_RES%~ source_prefix PATCH_IF (~%source_prefix%~ STRING_EQUAL_CASE ~sppr~) BEGIN ... and, you need to make sure that the spells are not in hidespl.2da: PATCH_IF !(FILE_CONTAINS_EVALUATED (~hidespl.2da~ ~%SOURCE_RES%~)) BEGIN 3 hours ago, Raduziel said: what I want is, following this example, all first-level spells that are not druid exclusive and not evil exclusive. You were close. You need to switch to BOR and switch the 1s and 0s. Try this: COPY_EXISTING_REGEXP ~^.+\.spl$~ ~override~ PATCH_IF %SOURCE_SIZE% > 0x71 BEGIN READ_SHORT 0x1c type READ_LONG 0x34 level READ_BYTE 0x1e good_evil READ_BYTE 0x21 cleric_druid PATCH_IF (type = 2) BEGIN // priest SNPRINT 4 ~%SOURCE_RES%~ source_prefix PATCH_IF (~%source_prefix%~ STRING_EQUAL_CASE ~sppr~) BEGIN PATCH_IF !(FILE_CONTAINS_EVALUATED (~hidespl.2da~ ~%SOURCE_RES%~)) BEGIN PATCH_IF (good_evil BOR 0b11111011 = 0b11111011) BEGIN // not exclude good PATCH_IF (cleric_druid BOR 0b10111111 = 0b10111111) BEGIN // not exclude cleric SPRINT $divine_valid_good_cleric(~%SOURCE_RES%~) ~%level%~ END END END END END END END BUT_ONLY COPY_EXISTING_REGEXP ~whomever.cre~ ~override~ PHP_EACH divine_valid_good_cleric AS spl => lvl BEGIN PATCH_IF (lvl = 1) BEGIN ADD_KNOWN_SPELL ~%spl%~ #0 ~priest~ END PATCH_IF (lvl = 2) BEGIN ADD_KNOWN_SPELL ~%spl%~ #1 ~priest~ END END IF_EXISTS BUT_ONLY Edited June 15, 2020 by subtledoctor Quote Link to comment
Jarno Mikkola Posted June 15, 2020 Share Posted June 15, 2020 24 minutes ago, subtledoctor said: I don't know what the heck "Change Chicken" is, but if you are adding spells, It's a spell... to be specific: spin884.spl, it's like you know no how to use Near Infinity. Quote Link to comment
Raduziel Posted June 15, 2020 Author Share Posted June 15, 2020 Ok, now for some reason the NPC's class is not being changed (from Fighter to Cleric). I appreciate the effort but I'll give up for now and keep the original coding - it ignores mod-added spells but works as intended with both unmodded and DoF. Special thanks to @subtledoctor for sharing so much of his time. Quote Link to comment
subtledoctor Posted June 15, 2020 Share Posted June 15, 2020 7 hours ago, Jarno Mikkola said: It's a spell... to be specific: spin884.spl, it's like you know no how to use Near Infinity. lol. Get Near Infinity to run on my cell phone and I’ll look things up when I post. Quote Link to comment
Jarno Mikkola Posted June 15, 2020 Share Posted June 15, 2020 5 minutes ago, subtledoctor said: lol. Get Near Infinity to run on my cell phone and I’ll look things up when I post. K, so look it up from here. Quote Link to comment
Caedwyr Posted June 15, 2020 Share Posted June 15, 2020 Is there any particular reason for being needlessly combative, or is that just your schtick? Quote Link to comment
subtledoctor Posted June 15, 2020 Share Posted June 15, 2020 He's The Quasit. It's his schtick. Quote Link to comment
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.