Jump to content

guyudennis’ random questions


Recommended Posts

Hi community,

Asking some seemly unrelated questions I encountered along the way:

* Why some opcodes (ie #0, #54) simply refuse to be ALTER_SPELL_EFFECT’ed if parameter1 is to be changed to a negative value? Yet positive value changes always work; or if I delete it first then ADD_SPELL_EFFECT it back, it will now accept negative values without any issue. WTF?

* Why does op73 (extra damage modifier) bonus show up fine on character screen (ie the inventory screen’s damage portion) but op285 (melee weapon damage modifier) simply won’t show its bonus on the same screen (obviously with a melee weapon equipped)? IESDP does not mention this difference in “behavior”.

* I am proficient with using Weidu to create spells/effects/items from scratch and then add ability headers (with IR’s macro) & extended effects; but I cannot seem to find any mentioning of a way to use Weidu to create projectiles from scratch?

* Does op206-self have to be the last in the effect chain? If it were stuffed in the middle, would it prevent the effects after it from being executed?

* While it’s quite intuitive to me to understand for items how global effects (conveniently named “equipped effects”) and extended effects (wrapped around similarly convenient headers named “melee” or “range”), I have a much harder time distinguishing between global and extended effects for spells, especially since most of spells will simply use melee headers anyways. Take an example for a spell/ability that removes itself when cast then gives itself back after a certain period: I’ve seen this done both as global effects or in the extended effects, and both works… So what’s the difference between global and extended effects for spells? Is there a good tutorial somewhere for a good explanation of how spells work structurally? IESDP shows me the skeleton of a spell file but not much about its inner workings.

* With the addition of the “break sanctuary” flag (BIT9 if memory serves) in 2.6, for an ability to break invisibility when used, do I still need to apply op136 (force visible) if I already set BIT9?

So much for now. And as always, thanks for helping!

Link to comment
53 minutes ago, guyudennis said:

* Why some opcodes (ie #0, #54) simply refuse to be ALTER_SPELL_EFFECT’ed if parameter1 is to be changed to a negative value? Yet positive value changes always work; or if I delete it first then ADD_SPELL_EFFECT it back, it will now accept negative values without any issue. WTF?

Quote

ALTER_SPELL_EFFECT: patch effects on spells. This is a PATCH function. All integer variables except    check_globals, check_headers, header and savebonus default to -1 and negative values result in no change to the corresponding field.

53 minutes ago, guyudennis said:

* Why does op73 (extra damage modifier) bonus show up fine on character screen (ie the inventory screen’s damage portion) but op285 (melee weapon damage modifier) simply won’t show its bonus on the same screen (obviously with a melee weapon equipped)? IESDP does not mention this difference in “behavior”.

It was not used by the unmodded game, so it's display was never implemented.

53 minutes ago, guyudennis said:

* I am proficient with using Weidu to create spells/effects/items from scratch and then add ability headers (with IR’s macro) & extended effects; but I cannot seem to find any mentioning of a way to use Weidu to create projectiles from scratch?

Weidu doesn't have one.  Type1 (non-impact) are 0x100 bytes, Type2 (single-target) are 0x200 bytes, Type3 (area-effect) are 0x300 bytes.

53 minutes ago, guyudennis said:

* Does op206-self have to be the last in the effect chain? If it were stuffed in the middle, would it prevent the effects after it from being executed?

Yes it would.

53 minutes ago, guyudennis said:

* While it’s quite intuitive to me to understand for items how global effects (conveniently named “equipped effects”) and extended effects (wrapped around similarly convenient headers named “melee” or “range”), I have a much harder time distinguishing between global and extended effects for spells, especially since most of spells will simply use melee headers anyways. Take an example for a spell/ability that removes itself when cast then gives itself back after a certain period: I’ve seen this done both as global effects or in the extended effects, and both works… So what’s the difference between global and extended effects for spells? Is there a good tutorial somewhere for a good explanation of how spells work structurally? IESDP shows me the skeleton of a spell file but not much about its inner workings.

A spells global effects:

  • Are applied as soon as casting begins, and thus ignore whether or not the spell gets interrupted.
  • Ignore immunity to the spell (as they are not sourced to it).
  • Cannot use "Preset Target" or "Original Caster" targeting, generally restricting them to targeting "Self".
53 minutes ago, guyudennis said:

* With the addition of the “break sanctuary” flag (BIT9 if memory serves) in 2.6, for an ability to break invisibility when used, do I still need to apply op136 (force visible) if I already set BIT9?

Yes.  BIT9 is not respected when the spell is forcibly instant-cast (such as by other spells, certain script actions, etc...).

Link to comment
4 hours ago, guyudennis said:

Why some opcodes (ie #0, #54) simply refuse to be ALTER_SPELL_EFFECT’ed if parameter1 is to be changed to a negative value?

Because the ALTER_SPELL_EFFECT doesn’t support the use of negative values. It’s just how the function works. 

I believe DavidW made variant versions of ALTER_EFFECT and CLONE_EFFECT that support negative values. 

4 hours ago, guyudennis said:

Why does op73 (extra damage modifier) bonus show up fine on character screen (ie the inventory screen’s damage portion) but op285 (melee weapon damage modifier) simply won’t show its bonus on the same screen (obviously with a melee weapon equipped)? IESDP does not mention this difference in “behavior”

It’s nothing to do with the opcodes themselves, so there’s nothing to mention in the IESDP. Beamdog made the game UI react to one, but not the other. It’s just how Beamdog decided to do it. 

4 hours ago, guyudennis said:

Does op206-self have to be the last in the effect chain?

Yes. 

4 hours ago, guyudennis said:

While it’s quite intuitive to me to understand for items how global effects (conveniently named “equipped effects”) and extended effects (wrapped around similarly convenient headers named “melee” or “range”), I have a much harder time distinguishing between global and extended effects for spells

Global effects in spells happen immediately, therefore they ignore casting time and cannot be interrupted. 

EDIT - ninja’d!

Link to comment
2 hours ago, lynx said:

There's ADD_PROJECTILE for new projectiles, but projectiles in general are quite complicated beasts.

ADD_PROJECTILE is for registering a new projectile to the the missile/projectl IDS files; I believe guyudennis is asking if there's a function to create the projectile file itself. WeiDU's CREATE command only does a limited number of file types.

You could make a null inline file and then do some INSERT_BYTE shenanigans, or grab an existing one and overwrite/trim as needed, but either way you're likely better served shipping a pro file.

Link to comment

Hi everyone,

Thank you all for the answers, and quick ones!

I am truly embarrassed to have missed the documented negative value does nothing bit for ALTER_SPELL_EFFECT. I consulted Weidu readme at least a couple of times for this function, but somehow still missed that sentence.

Regarding projectile, yes I meant something like CREATE to make one from scratch rather than having an already made binary pro file. But I am perfectly ok with having it as binary, now that I know there’s no existing function/macro to create one and creating from an inlined file then editing byte by byte is probably not worth the hussle considering how infrequently I come across them. Might as well just copy and alter an existing one.

 Looks like learning how to mod also involves getting to know all the quirks here and there, like this melee damage modifier not showing up. Oh, good fun!

Link to comment

Say we have an ability which has op248 (melee hit effect) + actual EFF, like in the case of SPCL902. I've seen mods alter the EFF from type op55 to op146 another SPL, with the SPL invoking the op55 instead.

My question is: why the hassle of adding another "layer" to achieve the same end? What is the advantage of an EFF#146+SPL#whatever combo over a direct EFF#whatever? Is it done so that it can be easily neutralized by some op206 later? Other than that, any other reason for this combo?

Link to comment
1 hour ago, guyudennis said:

Say we have an ability which has op248 (melee hit effect) + actual EFF, like in the case of SPCL902. I've seen mods alter the EFF from type op55 to op146 another SPL, with the SPL invoking the op55 instead.

My question is: why the hassle of adding another "layer" to achieve the same end? What is the advantage of an EFF#146+SPL#whatever combo over a direct EFF#whatever? Is it done so that it can be easily neutralized by some op206 later? Other than that, any other reason for this combo?

Op206 can actually block EFFs so that's not a good reason. Lacking more specific information, the most obvious reason I can think of to cast a spell through the EFF instead of applying an effect through the EFF directly is that a spell can have several (or dozens, or hundreds) effects, while an  EFF can only apply one. So this is a simple way to deliver more complicated combinations of effects to the target.

Link to comment

Thank you.

But I could add a hundred op248 directly as extended effects in the ability header to achieve the same thing. So that doesn’t look like a good reason either.

The only plausible reason I see at the moment is still with 206: say you have a hundred extended effects in the ability, and you somehow want to be able to neutralize a subset of them, then maybe it’s cleaner to externalize this subset all into a spell and then you can utilize a single instance of 206 to block them…

I’m not arguing; I’m just trying to understand so I can be smarter with my code in the future. And I do appropriate your answers and help.

As for an example, I was looking KR’s version of SPCL902. Demi’s method of dealing with it did not make sense to me. But in recollection, it seems that’s his standard way to doing things…maybe just personal preference at the end of the day.

Link to comment
27 minutes ago, guyudennis said:

But I could add a hundred op248 directly as extended effects in the ability header

Yeah but that would be terrible?

27 minutes ago, guyudennis said:

The only plausible reason I see at the moment is still with 206: say you have a hundred extended effects in the ability, and you somehow want to be able to neutralize a subset of them, then maybe it’s cleaner to externalize this subset all into a spell and then you can utilize a single instance of 206 to block them

Actually no - you can give all your disparate .EFF files the same parent resource name, and block them all with a single 206 effect. 

(Of course, at the time people made the mods you’re looking at, like KR, they probably didn’t know that was possible…)

Honestly, there may not be a great answer. People are comfortable dealing with .SPL files, their structure and effects and interactions, so they use opcode 248 to deliver .SPLs via weapon hits. It’s not necessary, but it probably helped modders wrap their heads around what exactly they were coding. 

For me, I use it to add a 326 effect in the subspell with target mode 9 “original caster,” so that I can deliver spell effect conditioned on whether the attacker has a certain spellstate. There may be a way to do this without the subspell, but I’m not sure; I know the code works and seems fairly bulletproof with the subspell so… I use the subspell.  Sometimes the occurrence of less-efficient methods boils down to “that’s how I got it to work,” and “if it ain’t broke, don’t fix it.”

Edited by subtledoctor
Link to comment
1 hour ago, subtledoctor said:

For me, I use it to add a 326 effect in the subspell with target mode 9 “original caster,” 

This is one unavoidable reason.  The EFF applied by op248/249 ignores it's target field, applying a subspell with further targeting is the only way to get around this.

If the effect needs any manner of projectile or area-effect, it will require being put in a SPL.

Some opcodes require either being in an EFF or a SPL/ITM for certain functionality.  (This goes either way, though IMO more in favor of the EFF.)

If nothing else, it's wasteful use of the namespace.  100 EFF files with a different name, or 1 EFF and 1 SPL file.  EFF are also more versatile the fewer fields they utilize.

 

Edited by kjeron
Link to comment
On 1/29/2023 at 7:58 PM, jmerry said:

The one possible "fix" I can think of is to create a new innate spell (which is then granted by the HLA) that casts the original spell using opcode 146/148 in mode 1. The original spell is still a mage or priest spell, so it uses the mage or priest caster level.

 

On 1/30/2023 at 12:28 PM, subtledoctor said:

This is actually a perfectly reasonable solution and probably worth doing. I would only caution DavidW if he decides to do this, that op148 has weird issues with spell range, so the innate ability should have a range 3 less than the underlying wizard or priest spell it casts. 

Not to hijack the SCS thread, so I ask my questions here.

@jmerry by “mode 1” you meant timing mode = 1 or para2 = 1?

@subtledoctor I don’t really catch what you meant here?

Within the scope of what we were talking about, making innate wrappers to cast the original HLA spells, I would guess the target of 146/148 would always be Self? If that’s correct, then what’s the difference between those Opcodes, again within the scope as mentioned above?

And what about para1 and para2? My guess is para1 = 0 and para2 = 0, no matter what opcode (146/148) we use or if the actual HLA is self-targeting or AoE, correct?

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...