Jump to content

Opcode 326 for Kits


Aquadrizzt

Recommended Posts

Posted

So I'm curious how the functionality of Opcode 326 (Apply Effects List) interacts with parameter 2 = 109 (Kit bit eq param1).

 

I added an effect to a shared clab file, with the Opcode 326 targeting one of the kits using the clab file. Curiously, I found that the effect (an armor class bonus effect) was applied to both the targeted kit and the untargeted kit.

 

I'm wondering if there was something special about how the "bit eq" (as opposed to regular equality) affects the ability to recognize specific kits.

Posted

This post provides a description how to interpret spell protection codes used by opcode 326. "bit eq" is described as follows:

 

8 - binary match (at least one bit is common)

Posted

Thanks argent77! It looks like I can't use 326 for what I'm trying to do, but fortunately 177 still can accomplish what I want (albeit with an extra layer of application effects.)

Posted

I won't pretend to fully understand everything in the linked post. I will muse, however: what possible use is there for having a "kit" parameter option in opcode 326 if it doesn't return false for kits other than the one specified??

Posted

The good thing is that you can define your own checks simply by adding a new line to SPLPROT.2DA.

If you want to compare the KIT value on numeric level you can simply duplicate the respective line in SPLPROT.2DA with a new operator:

            STAT  VALUE   RELATION
KIT_EQ      152   -1      1         <- Translation: STAT KIT = Parameter 1

 

You can also create new and creative target checks. Let's say you only want to affect targets with a certain proficiency level in Katanas? Then add the following line to SPLPROT.2DA:

            STAT  VALUE   RELATION
PROFKATANA  94    -1      4         <- Translation: STAT PROFICIENCYKATANA >= Parameter 1

and set the minimum proficiency value in Parameter 1 of opcode 326. (You may have to use a binary operator to consider dual classed characters as well.)

(The tricky part is to determine the index of the added line so you can update Parameter 2 of opcode 326 accordingly.)

Posted

Off-topic, it seems we could use this to make checks for "stat = X" instead of "stat >= X"... that way for something like monks' WIS-based AC bonus, it would only ever have to cast one spell per round, regardless of your WIS score.

 

(The tricky part is to determine the index of the added line so you can update Parameter 2 of opcode 326 accordingly.)

That should be a simple matter of COUNT_2DA_ROWS at the time you append your new line to splprot.2da... no?
Posted

You can even group entries by using stat 0x103 (match x and y) or negate the group with stat 0x104 (match all except x and y). Or combine several 0x103 or 0x104 entries to create even more complex groups. This feature is very powerful if used right.

(The tricky part is to determine the index of the added line so you can update Parameter 2 of opcode 326 accordingly.)

That should be a simple matter of COUNT_2DA_ROWS at the time you append your new line to splprot.2da... no?

Yes, and for existing entries scanning the table for regular expression matches should work.

Posted

Wow, I didn't realize how flexible and powerful Opcode 326 was until now. I figured out a solution to the problem that prompted me to ask already, but I'm definitely already contemplating ways I can use stat checks in my various mods.

Posted

Another question tangentially related to this: can 326 check local variables? Or do something that allows emulation of a local variable system?

Posted

The spell protection system cannot use local variables. It can use ALL stats and spell states. Splprot.2da has no string fields to give the variable name and this didn't seem to be important with all the stats/states already available.

Posted

Would it be possible to add a new stat that 326 can check then?

You cannot add a new stat in EE. But you can define/set a new spell state.

Posted

I'm finding that using this opcode for auras is very sketchy. When the ability kicks in it does not discriminate - if I have it require CHR >= 18, it get applied regardless of the character's CHR stat. And on a save/load, the effect goes away and never comes back.

Posted

I'm pretty sure you can set it up for a chr >=18 safely. Also, obviously none of the spell protection checks are 'permanent' since they are checked once, when the effect is being applied.

If you want a condition to be continuously checked, you need to run periodic applies with each effect's duration the same as the checking periods (much like bard songs work).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...