Grammarsalad / EE_Crafting

0 stars 0 forks source link

Using the upper bytes of prof stats #23

Open Grammarsalad opened 2 years ago

Grammarsalad commented 2 years ago

In an opcode 233 effect:

If I understand correctly, "parameter2 = (115 + (0x10000 * 1))" increments the proficiency (by 1?)

Yes, this means we are incrementing stat 115. But it doesn't sp[ecify by how much. Just which stat (115), and incrementing (0x10000*1).

Does "parameter1 = (32 << 24)" specify just the bits in the 4th byte?

Parameter1 specifies the amount by which we are incrementing the stat. In this case we increase the value by 32<<24, which is (looking in NI) 536870912. Or something like that. <<24 means we are shifting the value up to the 4th byte, and 32 is the 6th bit in that byte. Now we can check bit-equality against that bit. If we incremented it by 33<<24, that would encompass the 1st (1) and 6th (32) bits, and we could check bit-equality against either of those. But in general, to simulate a spellstate, you just want to increment by one

(An aside, I found a clever use of this: if all 1-handed weapons have an equipping effect that increase a stat by, say, 2<<24, then we can check for bit equality against 4<<24 and it will show us that the character is currently dual-wielding.)

I also see that you have (e.g.):

LPF ADD_ITEM_EQEFFECT INT_VAR opcode = 326 target = 1 parameter1 = (64 << 24) parameter2 = %115_style% timing = 1 STR_VAR resource = ~d5_twf4~ END

This checks for bit-equality with the 7th bit of the 4th byte (64<<24) but paremeter2 needs to be a reference to splprot.2da. So in this case %115_style% is the row of splprot.2da defined there. And that row of splprot specifies a stat with relation 8, i.e. bit equality.

So, could I do something like have an item that sets (idk) the second byte of 99 (wp halbard) to 1

You only want to increment, because setting the stat would screw up lower values, i.e. the actual proficiency values.

where "%splprot_row%" specifies a value equal to 1 in stat 99?

Like I say, you want that to specify bit quality (relation 8 ), not equality (relation 1). This way you can check a particular value by which the stat was incremented, and ignore any other values at which the stat is set or incremented. As long as you are incrementing the stat and each source that does so increments it by the value of a particular bit, you can have 31* different effects suitable for op318 or op326 effects, and none of them will interfere with each other.