Jump to content

Photo

help with SPLPROT.2da and bit-equality


3 replies to this topic

#1 subtledoctor

subtledoctor
  • Modders
  • 2741 posts
  • Gender:Male

Posted 23 May 2018 - 11:51 AM

I'm trying to reproduce the APR effects of WSPATCK as weapon equipping effects - my modified version in which each proficiency point gets you an extra 1/2 APR bonus (including mastery and high mastery):

Spoiler

 

I used RELATION = 11 in SPLPROT because it says over here: "11 - binary less (stat doesn't contain all the bits of value)"

 

In a nutshell, what this does is apply effects that say "set APR to 3/2," "set APR to 2," and "set SPR to 5/2." But before those effects there are effects that say "if you don't have exactly 2 proficiency points, then you are immune to the 3/2 APR effect; if you don't have 3 points, you are immune to the 2 APR effect; and if you don't have 4 points, you are immune to the 5/2 APR effect."  The jump from 2 prof points to 3 should make APR go from 3/2 to 2... the 318 effect that checks for 2 points should return false, and thus make you immune to the 3/2 APR setting.  I guess because 3 is bit-equal to 2, it is returning true.  But I though using RELATION 11 would prevent that.

 

I know the quickest and dirtiest way to fix this would be to simply have the higher APR effect come later, so it supersedes the earlier one.  But that's pretty dirty.  I'd prefer to make sure the equipping effect accurately assesses your proficiency. 

 

(Using bit-equality here... I don't want to use simple equality because I want to make sure that some mod using the upper bytes of the proficiency stats doesn't screw this up.)


Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#2 Avenger

Avenger
  • Modders
  • 3803 posts
  • Gender:Male
  • Location:Hungary

Posted 23 May 2018 - 02:45 PM

The formula for 11 is this: if  (stat&value) != value then effects are resisted

 

If you need something else, write it here :)


Edited by Avenger, 23 May 2018 - 02:47 PM.


#3 subtledoctor

subtledoctor
  • Modders
  • 2741 posts
  • Gender:Male

Posted 23 May 2018 - 03:38 PM

I need this:
- If stat != 2 (bit2), then resist effect A
- If stat != 3 (bit2 + bit1), resist effect B
- If stat != 4 (bit3), resist effect C

What I'm really trying to achieve is much simpler in concept:
- If stat = 2, apply effect A
- If stat = 3, apply effect B
- If stat = 4, apply effect C

...but unfortunately there's no way to do that with timing mode 2, so we need to resort to double negatives instead.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#4 Avenger

Avenger
  • Modders
  • 3803 posts
  • Gender:Male
  • Location:Hungary

Posted 30 May 2018 - 07:44 AM

I guess you need (stat & 15) == 2 or (stat & 15) == 3 or (stat & 15) == 4  ?

Otherwise you wouldn't have to use bit operators


Edited by Avenger, 30 May 2018 - 07:44 AM.




Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users