Jump to content

[bug?] Some spells lack the 'hostile' flag


DavidW

Recommended Posts

Posted

Actually, looking more generally maybe this is a broader issue - the game's conventions as to what counts as hostile are seriously weird.

Posted (edited)

Having looked into this to try to make SR spells align with those conventions, my recollection is that they are indeed quite weird and often inconsistent. 

But to the immediate point, don’t direct damage spells automatically cause the hostile reaction? I figured the flag is unnecessary for Acid Arrow, and really there for spells like Greater Malison or the like where the effect is obviously hostile, but the engine needs a kick in the pants to induce that reaction in the target(s).

Edited by subtledoctor
Posted
6 hours ago, subtledoctor said:

But to the immediate point, don’t direct damage spells automatically cause the hostile reaction?

Correct. Opcode #12 acts as "Hostile".

6 hours ago, DavidW said:

A specific reason is that non-hostile spells bypass 102 immunity to spell level, so they have to be manually 206d in MGI.

This is hopefully not an issue. Quoting the IESDP:

Opcode #102 CANNOT block non-hostile effects from self.

So basically it cannot block Melf's Acid Arrow and the like if you cast it at yourself (but why should you do that to begin with...?)

The only things that should be manually 206d in MGI are spells such as "spwi304.spl" (Fireball), i.e.: non-hostile AoE spells.

In so doing, creatures protected by MGI can safely cast such spells at their feet without taking damage (and hopefully hit nearby enemies).

Posted
58 minutes ago, Luke said:

This is hopefully not an issue. Quoting the IESDP:

Opcode #102 CANNOT block non-hostile effects from self.

So basically it cannot block Melf's Acid Arrow and the like if you cast it at yourself (but why should you do that to begin with...?)

The only things that should be manually 206d in MGI are spells such as "spwi304.spl" (Fireball), i.e.: non-hostile AoE spells.

In so doing, creatures protected by MGI can safely cast such spells at their feet without taking damage (and hopefully hit nearby enemies).

You miss the point. Most AoE spells (including Fireball) are flagged as 'hostile', at least in BG2EE, and so are stopped by your own MGI without having to be explicitly called out via 206. The exceptions, like Skull Trap and Holy Smite, are 206d in the MGI spell effects precisely because (I assume) they lack the 'hostile' flag. I'm interested in why they lack it. (For Holy Smite, it's probably because it is sort-of party-friendly, but Skull Trap?) 

As for why you might cast Melf's Acid Arrow at yourself: because you cast it at an opponent with Spell Turning. (Though to be fair I'm not 100% sure whether spell turning resets the designated caster to the turner.)

Posted (edited)
10 hours ago, DavidW said:

(Though to be fair I'm not 100% sure whether spell turning resets the designated caster to the turner.)

Ugh, this kind of minutiae of the engine's workings are so hard to keep track of. I vaguely vaguely recall some odd rule that, with spells cast directly and via op146, the caster is reset when it is turned; but when cast via 326, the caster is not reset. Or something like that.

10 hours ago, DavidW said:

The exceptions, like Skull Trap and Holy Smite, are 206d in the MGI spell effects precisely because (I assume) they lack the 'hostile' flag. I'm interested in why they lack it. (For Holy Smite, it's probably because it is sort-of party-friendly, but Skull Trap?)

Maybe just the opposite - the fact that Skull trap is not party-friendly (and, in the good old days, did not have visual radius indicators) means there is a high likelihood of friendly fire, either by players at summons or by enemies at their own team. So maybe removing the 'hostile' flag is to prevent team members turning against each other over a small mistake?

That's a wild guess at best.

Edited by subtledoctor
Posted (edited)
3 hours ago, DavidW said:

The exceptions, like Skull Trap and Holy Smite, are 206d in the MGI spell effects precisely because (I assume) they lack the 'hostile' flag.

I talked about Fireball because on IWDEE it is not flagged as hostile, so that's why is 206d in MGI spell effects...

3 hours ago, DavidW said:

I'm interested in why they lack it

Probably because they apply the Damage opcode, which in turn triggers `AttackedBy()`...

In particular, note that `AttackedBy()` will always trigger because these op12 effects are coded as "Save for Half", so they'll always hit (and civilians and the like will turn hostile if not immediately killed...)

However, those effects are also flagged as "Do not bypass MR", so those spells should probably be flagged as "Hostile" (otherwise `AttackedBy()` will not trigger in case of "Magic Resistance"... Unless that is intended of course...)

3 hours ago, DavidW said:

As for why you might cast Melf's Acid Arrow at yourself: because you cast it at an opponent with Spell Turning. (Though to be fair I'm not 100% sure whether spell turning resets the designated caster to the turner.)

Yes, this is an interesting case. I think that @Bubb and @kjeron know the answer...

Anyway, upon closer examination, Melf's Acid Arrow is 206d in MGI spell effects on BG(2)EE, but not on IWDEE 🤔...

Edited by Luke
Posted
1 hour ago, Luke said:
4 hours ago, DavidW said:

As for why you might cast Melf's Acid Arrow at yourself: because you cast it at an opponent with Spell Turning. (Though to be fair I'm not 100% sure whether spell turning resets the designated caster to the turner.)

Yes, this is an interesting case. I think that @Bubb and @kjeron know the answer...

Bounce effects correctly change the reflected effects' m_sourceId to that of the reflecting creature. So Minor Globe will catch a reflected Melf's Acid Arrow but not one cast at self. Another oddity: In BG2:EE Globe of Invulnerability has an op206 against Melf's, but not Minor Globe 🤔

Posted
3 hours ago, Luke said:
6 hours ago, DavidW said:

The exceptions, like Skull Trap and Holy Smite, are 206d in the MGI spell effects precisely because (I assume) they lack the 'hostile' flag.

I talked about Fireball because on IWDEE it is not flagged as hostile, so that's why is 206d in MGI spell effects...

6 hours ago, DavidW said:

I'm interested in why they lack it

Probably because they apply the Damage opcode, which in turn triggers `AttackedBy()`..

So I'm talking about BG2EE. And in BG2EE most AoE spells, including Fireball, are marked as 'hostile' and not manually 206d in MGI. There are a small number of exceptions of which Skull Trap is one; the EE developers clearly did this deliberately (in at least some sense!)  because they have manually added these non-hostile AoEs to MGI. I am asking if anyone knows why those specific ones were treated in this way.

Posted

There's only one difference between op12's "hostile" response and the "hostile" flag: the flag starts the combat song when its effects are applied, (which prevents saving).

Given the list of spells op206'd by Minor Globe of Invulnerability (in BG2:EE v2.6.6.0):

Trap-like:
SPWI313 - Skull Trap
SPPR304 - Glyph of Warding - (flagged as Hostile)

Damaging:
SPPR302 - Call Lightning
SPPR314 - Unholy Blight
SPPR313 - Holy Smite

Crowd Control:
SPPR105 - Entangle
SPWI215 - Web
SPWI213 - Stinking Cloud
SPPR211 - Silence, 15' Radius

Reasons why the above spells aren't flagged as hostile might be:

* Maybe they didn't want friendly fire from trap-like spells to be enough to enter combat? As they are now, the response from an enemy script reacting to HitBy() and AttackedBy() would start combat. Note: I have no idea why Glyph of Warding is op206'd and has the hostile flag, (which is redundant), or why Call Lightning wouldn't be considered hostile.

* Unholy Blight / Holy Smite use op177 to determine whether creatures should be hit. If these spells were flagged as hostile casting them on non-affected creatures would aggro / start combat. As they are now, the response from an enemy script reacting to HitBy() and AttackedBy() would start combat.

* A good number of them are crowd control and shouldn't aggro / start combat if they snag a neutral creature, (Entangle, Web, Stinking Cloud, Silence 15' Radius).

Honestly, I don't think there's an overarching pattern here, at least mechanically.

Posted
1 hour ago, Bubb said:

Maybe they didn't want friendly fire from trap-like spells to be enough to enter combat? As they are now, the response from an enemy script reacting to HitBy() and AttackedBy() would start combat.

My thinking was: this, plus there exists a mage somewhere with a script that calls for casting Skull Trap and targeting him/herself. In such a case GOI would need the 206 to perform as intended. 

1 hour ago, Bubb said:

A good number of them are crowd control and shouldn't aggro / start combat if they snag a neutral creature, (Entangle, Web, Stinking Cloud

Ditto. Devs don’t want a stray villager to turn the whole town against Charname for a bit of web brushing their ankle; but they want mages with GOI to be able to cast it at themselves. 

Of course that raises the question whether any spells don’t fit this mold... I’m AFK so can’t look right now. 

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...