Jump to content

SPLPROT with combined conditions


temnix

Recommended Posts

I would like to have a complicated filter in SPLPROT.2DA for effect 321, applying a spell. The filter should only let the spell through to thieves with at least 5000 gold in their private purse (stat) and a backstab multiplier not exceeding 4 - not maximum. I'm using this code:

COPY_EXISTING ~SPLPROT.2DA~    override    COUNT_2DA_ROWS 4 backstab BUT_ONLY
APPEND ~SPLPROT.2DA~ ~%backstab% 56 4 3~ OUTER_SET thief = backstab + 1
APPEND ~SPLPROT.2DA~ ~%thief% 0x10d 205 5~ OUTER_SET combined-thief = thief + 1
APPEND ~SPLPROT.2DA~ ~%combined-thief% 260 %backstab% %thief%~ OUTER_SET final = combined-thief + 1
APPEND ~SPLPROT.2DA~ ~%final% 260 %5K% %combined-thief%~

- Writing %final% into the spell's offset. %5K% here is from a line added earlier, I didn't want to duplicate it. After installation the filter selection shows:

STAT GOLD < 5000 (146) - above
STAT BACKSTABDAMAGEMULTIPLIER  > 4 (151)
CLASS != THIEF_ALL (152)
Not match entries 151 or 152 (153)
Not match entries 146 or 153 (154)

The last line represents the final filter, and everything seems to be in order. But the filter doesn't work. It lets through the spell for all my party members and anyone outside, if they just have enough gold. Ideas? Could this be because the backstab check doesn't consider the existence of the backstabbing ability, only its strength, so characters without one still count as being under backstab 5? This would mean the condition in 151 would be true for anyone. But the THIEF_ALL requirement would still stop the spell, wouldn't it? The "or" here is really "nor," isn't it? Neither this nor that must be true, then go ahead. Isn't that the meaning of it?

Link to comment

Too many negations:

You have: NOT ( [<5000 Gold] OR NOT ([>4 Backstab] OR [NOT THIEF]) )

With 5000+ gold and ("not a thief" or >4 Backstab) :

= NOT (FALSE OR NOT (FALSE OR TRUE) )

= NOT (FALSE OR NOT (TRUE) ) = NOT (FALSE OR FALSE) = NOT (FALSE) = TRUE (incorrect, as they were "not a thief")

You want: NOT ([<5000 Gold] OR ([>4 Backstab] OR [NOT THIEF]) )

146: <5000 Gold

151: >4 Backstab

152: NOT THIEF

153: (151 OR 152) - remove the negation on this one (use relation 0x103/259)

154: NOT (146 OR 153)

Link to comment

Why do the mental gymnastics?  Several 318 effects with one condition each should do the trick.  Or maybe one positive check for thieves.  So:

Main spell:

  • 318 if gold <5000
  • 318 if backstab > 4
  • 326 -> cast subspell if class = thief_all

Subspell:

  • Actual subspell effects.
Edited by subtledoctor
Link to comment

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.

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...