Jump to content

Q on opcode 146 and similar ones


Recommended Posts

Hi all,


My questions have to do with the relation between an opcode like Cast Spell (at target) [146] or Use EFF File [177] -- the "calling" opcode -- and the "child" opcodes, that is, the opcodes in the relevant .spl or .eff files.


1. If I stick a save in Cast Spell (at target) [146] will it work? Meaning, the engine makes a roll, the character makes the save and the spell (effect) is not applied. Or am I forced to stick the saves in the child opcodes? And if it does work as I naively expect it to, and if the child opcodes also have a save, possibly a different one than the calling opcode, does the engine roll again and give the victim a chance to make the save?


Same question for resists.


By the way, what exactly is the difference if any between resist 0 (non-magical) and 2 (not dispellable, bypass mr)?


2. The second question has to with the relation of timing modes between the calling opcode and the child opcodes. How does the timing mode in an opcode like Cast Spell (at target) [146] or Use EFF File [177] works?


To explain myself a little bit better, it is tiresome and error prone to implement an immunity in an item, say immunity to charm, by adding manually one by one the opcodes in dltcep. So I thought of gathering them all in a .spl file and then use Cast Spell (at target) [146] with timing mode while equipped, but never managed to make it work as the opcodes were set permanently. Is there anyway to achieve this?


The second situation where this problem arose was in reviewing some items made by item revisions (IR for short). A combat ability delivering some special effect is usually implemented by using Cast Spell (at target) [146] and then in the .spl file the first opcodes are a bunch of Use EFF File [177] that set protection from the spell opcode so that the relevant creatures are not affected by the spell. My problem is that given my experience related in the previous paragraph, I simply do not understand how IR manages to get this to work.


Thanks in advance,

G. Rodrigues

Link to comment

I'll answer what I can, at least.


For opcodes 146 and 148, the saves and magic resistance checks from the underlying spell will still apply, so leave them off the 146/148 opcode itself. If you did include a save on the 146 opcode, I'm not sure if the engine re-rolls it or if one save roll would apply for everything. Most spell scrolls (where you see these) just use 146/148 without saves and bypass magic resistance.


Saves and MR from 177s also apply, but I'm not sure about which timing and duration applies if both the 177 opcode and the actual EFF are in conflict.


It sounds like IR is using the same technique I used for elven charm/sleep resistance in Tutu and, later, Fixpack. Say you wanted to make gnomes immune to magic missile. You would add opcode 177 to the magic missile spell as the first effect (since they're processed in order) that calls an EFF for race:gnomes with as instant/limited duration of 0 seconds. The EFF itself would contain immunity to spell with the same timing; this immunity would block the rest of the spell effects (i.e. damage) from occurring.


As for avoiding tedium, you'd be better served learning some basic WeiDU. Adding something like NPP to an item is a lot easier than copying and pasting effects one at a time:


COPY ~path/to/my/item.itm~ ~override~
 LPF ADD_ITEM_EQEFFECT opcode = 101 parameter2 = 216 timing = 2 target = 1 END
 LPF ADD_ITEM_EQEFFECT opcode = 169 parameter2 = 59 timing = 2 target = 1 END
 LPF ADD_ITEM_EQEFFECT opcode = 142 parameter2 = 90 timing = 2 target = 1 END
 PATCH_FOR_EACH string IN 41495 40968 40969 40979 41616 BEGIN
LPF ADD_ITEM_EQEFFECT opcode = 267 parameter1 = string timing = 2 target = 1 END

Link to comment

I do intend to learn WeiDU, but since I am not patching up items but making new ones I figured it was best to make everything out right the first time.


Just a couple more questions to dispel some lingering doubts.


1. In your example with gnomes and magic missile, you speak about "instant/limited duration of 0 seconds." Do you mean by instantaneous the 0x01 = permanent timing mode? Is there any practical difference between permanent and duration 0?


2. I found another situation where there the timing mode is important: in summoning abilities. This is usually implemented via Use EFF File [177] with ids file 2 and entry 0 (meaning, everybody) with duration timing mode which then calls the summoning opcode. But from what I can gather the duration the summoned creature sticks around is in the calling 177 opcode. Am I correct?


3. To repeat one question of my previous post, unconnected with the previous issues, what exactly is the difference if any between resist 0 (non-magical) and 2 (not dispellable, bypass mr)?


Thanks in advance,

G. Rodrigues

Link to comment


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

  • Create New...