Quantcast
Channel: Modding — Beamdog Forums
Viewing all articles
Browse latest Browse all 11774

Getting the most out of Opcodes 318 and 177(EFFs).

$
0
0
Apparently, Opcode 318 is able to block EFF files based on their parent resource field, which I only fully realized after suggesting using it as such here.

Easily Suppressing Arcane Spell Failure:

Patch all items to disable wizard spell casting through an external EFF:
COPY_EXISTING_REGEXP ~^.+\.itm$~ override
	LPF ALTER_EFFECT
		 INT_VAR
			match_opcode = 145
			match_parameter2 = 0
			match_timing = 2
			opcode = 177
			parameter2 = 2
		STR_VAR
			resource = (EXTEFF)
	END
BUT_ONLY
CREATE EFF ~(EXTEFF)~
	WRITE_SHORT	0x10 145
	WRITE_LONG	0x2c 100
	WRITE_EVALUATED_ASCII	~(ARCFAIL)~
Then add the following effect to any CLAB/Feat/etc... that you want to ignore arcane spell failure from armor: opcode=318, target=2, timing=9, probability1=100, resource = (ARCFAIL). Alternatively, create a separate EFF for each armor tier (ARCFAIL1, ARCFAIL2, ARCFAIL3, etc...), and grant immunity to only those tiers that you want them to ignore. Could work just as well for casting failure % instead of disabled casting.

Accurately granting immunity to just one form of an opcode:

For example: Opcode 39 (Sleep). It is used for: Sleep, Unconsciousness, Knockdown, Hopelessness, and Nausea(Poison). So:
  • Take all related effects in every sleep spell and move them to external EFF files, giving them all the same parent resource (EFFECT_SLEEP). Most of these spells could share EFF's, as the variations (saving throws, min/max hd/level, magic resistance, power, probability, etc...) would be put in opcode 177, not the EFF. The EFF file would mainly have: Opcode, parameter1/2/3(as appropriate), resource1/2/3(if necessary), special, probability1=100, parent_resource=(EFFECT_[TYPE]). All other fields would be zero/empty.
  • For creatures that should be immune to "Sleep", replace Opcode 102/Parameter2=39 (Immunity to effect: opcode 39) with the following effect: opcode=318, target=2, timing=9, probability1=100, resource = (EFFECT_SLEEP).
  • Do the same for Unconsciousness, Knockdown, Hopelessness, and Nausea(Poison). Note: Opcode 39 is still bugged some of in the v2.5 betas (and the v2.5 IWDEE release, though significantly less so), so I advise against testing this specific one in the beta patches.
  • The undead rings, for example, would end up with: opcode=318, target=2, timing=9, probability1=100, resource = (EFFECT_SLEEP). opcode=318, target=2, timing=9, probability1=100, resource = (EFFECT_UNCONSCIOUS). opcode=318, target=2, timing=9, probability1=100, resource = (EFFECT_HOPELESS). opcode=318, target=2, timing=9, probability1=100, resource = (EFFECT_POISON). This way they would remain vulnerable to knockdown, such as from Wing Buffet.
  • Similarly, the EFF's for any effects (even damage) that operate through poison (Stinking Cloud, Cloudkill, Poison) would use the (EFFECT_POISON) parent resource. While items that grant Poison Immunity would just use: opcode=318, target=2, timing=9, probability1=100, resource = (EFFECT_POISON).No complication with Disease and Poison dealing the same damage type, or needing to list every spell individually with opcode 206.
  • Most every related spell would share the same EFF files, since all variation will be in the opcode 177 effect that calls them (saving throws, min/max hd/level, magic resistance, power, probability, etc...), not in the EFF (these fields should be left blank/zero in the EFF). Two sleep spells would use mostly the same EFFs, while a color spray would use another batch of EFF's (for unconsciousness). Some effects would have extras or alternates (mostly visual/audio/lighting effects for different spells).
  • Because all "Display String" effects would use the same parent resource for a given purpose, there would be no need to look up string references for each game, or make sure every variation is blocked when granting immunity. Just select the EFF with the correct string for use in a spell, or block all appropriate variations with opcode 318 when granting immunity.
Limitations:
  • EFF's called through opcodes 248, 249, and 272 would have to remain separate from these.
  • Opcode 337 (remove effects by opcode) would falter against these, but all other effect removal would continue to work as they currently do
  • Unlike opcode 337, direct effect removal effects (cure sleep, remove paralysis) do detect those effects in external EFF files.
  • Spell school/type protection removal would still look at the school/type in opocde 177, not the EFF.
  • Opcode 321 would still remove effects based on the parent resource of opcode 177, not the custom one defined in the EFF.
  • Deflection/Reflection would not change, with the exception of opcode 198 (reflect specified effect), which was never really viable specifically because these opcodes have multiple purposes.
  • This could be a small(addition) for some effects or require complete(replacement) overhaul for others.

SPLPROT based equipped effects:

On the item:
opcode 318, target=1, parameter1/2=(SPLPROT), timing=2, resource=(CUSTOM)
opcode 177, target =1, timing=2, resource=(EXTEFF)
EXTEFF: opcode/parameters=(whatever), parent resource=(CUSTOM)
The (SPLPROT) should be a match against anyone who should not get the effect. The (SPLPROT) will only update when the item is equipped (same as opcode 177), so it would only be useful for mostly-static checks. For example, you could properly restrict the Wizard Slayer from all magical weapons, then grant them an enchantment level equal to their proficiency level with any weapon they use (with or without the bonus to hit/damage). Maybe even a THAC0 bonus for zero-proficiency weapons so to offset the non-proficiency penalty so they retain a non-magical option against PfMW.
This specific idea would take a LOT of SPLPROT entries (dual-class mechanics force using a bit-wise check for proficiency), but they are not particularly in limited supply like SPLSTATEs. When dual-wielding, it would apply to all weapons of the same category, as the relative opcode(345) can't be more selective than that, and the +hit/damage can't be selective at all.
Or, if you were doing some type of 3E conversion:
Full Plate:
opcode 318, target=1, parameter1/2=(Armor Proficiency>2), timing=2, resource=(CUSTOM)
opcode 177, target =1, timing=2, resource=(EXTEFF1)
opcode 177, target =1, timing=2, resource=(EXTEFF2)
opcode 177, target =1, timing=2, resource=(EXTEFF3)
EXTEFF1: opcode=278, parameter1=~-6~, parent resource=(CUSTOM) //THAC0
EXTEFF2: opcode=44, parameter1=~-3~, parent resource=(CUSTOM) // Strength
EXTEFF3: opcode=15, parameter1=~-3~, parent resource=(CUSTOM) // Dexterity
// Armor Check Penalty for non-proficiency with armor
// SPLPROT could either be for an actual proficiency stat, re-purposed for Armor, or SPLSTATEs for each armor tier.

Viewing all articles
Browse latest Browse all 11774

Latest Images

Trending Articles



Latest Images