Jump to content

Detecting/guessing spells & reacting to them as they're being cast


Recommended Posts

11 minutes ago, DavidW said:

Jarno: it's not that you couldn't have blocks that reacted to PC casting, it's that (in my judgement, which is fallible but based on quite a lot of scripting experience) the combinatorics to have spellcasters do it intelligently, and avoid doing it in situations where it's obviously silly, are prohibitively long and cumbersome. 

Which is why I proposed the light fixtures -idea above. So it's rather the anti-magic rules of the city that do this rather than anyone of the opposing mages that does this, and can be build-on to say a quest, to get rid of some/all of them.

So one can make a creature that does a lot of this kinda work if it can mostly see the player trying to cast spells in the streets, or already has casted summons. Place those creatures to the BG2's public areas, mostly the Temple, Bridge, Gate and Government District's. And make them not have the foot circle, until you get a quest to get rid of some of them that allows you to see their foot cirles, after which you can kill/break them, which could alert the Wizards.

So no longer are there skeletons roaming the streets, cause it was a cleric that casted the thing.

"No, no unlawful magic use here... look a mouse." -stealths the cheese out of there, knowing things weren't looking like they should.

Link to comment
21 hours ago, Jarno Mikkola said:
22 hours ago, Istfemer said:

Same goes for disabling casting sounds for casters affected by silencing spells AND/OR Vocalize. In the latter case Silence does this by default. I don't quite remember how Vocalize deals with various 'shut up' effects.

2

These effects are reverse ones, so if you do this, they get their VOCALS BACK. As you can't cast without vocals. Which is by-the-by the same effect that reverses the invisibility during casting.

Isn't Opcode #47 (0x2F) Cure: Invisibility the one that specifically reverses (non-improved) invisibility during casting? Vocalize is #48. Or did you mean something else?

Link to comment
22 hours ago, Istfemer said:

Now, disabling some casting animations (just those displayed during a spell's "charging up" phase) for improved-invisible/sanctuaried casters is an interesting approach. Same goes for disabling casting sounds for casters affected by silencing spells AND/OR Vocalize. In the latter case Silence does this by default. I don't quite remember how Vocalize deals with various 'shut up' effects. Vocalize appears to only override opcode 0x26 (State: Silence) with opcode 0x30 (Cure: Silence), so it looks like we require a separate opcode that would only block the casting sounds and nothing more. Were these tweaks actually implemented as a "simpler solution", Improved Invisibility/Sanctuary + Vocalize (+ SI:Divination/SR's Non-Detection) combo would only gain in value for enemy casters. It would give most of them a special advantage of surprise in spell combat that they never had before, and thus make life harder for player's casters.

I forgot to account for Blindness & Deafness in the above paragraph.
Opcode #74 (0x4A) State: Blindness

Spoiler

Parameter #1: Irrelevant
Parameter #2: Irrelevant

Description:
Applies the blindness effect to the targeted creature(s). This sets VISUALRANGE to 2, sets STATE_BLIND to true and incurs a cummulative 10 point base THAC0 penalty (unverified in PST).
 
Opcode #80 (0x50) State: Deafness
Spoiler

Parameter #1: Irrelevant
Parameter #2: Irrelevant

Description:
Applies the Deafness effect on the targeted creature(s) - creatures suffer a casting failure rate of 50% (20% in bg1, unknown in iwd1). This is cumulative with Miscast Magic.

---

I can't recall offhand the names of mods that tackled the (many) issues with visibility & audibility in BG games. Major issues like 'Casting animations/sounds giving away positions of casters deep within the fog of war' (ubiquitous in vanilla) and 'Lingering/permanent spell/item animations/sounds giving away positions of invisible creatures' (vanilla PfNM & Spell Trap were the most glaring offenders; there were probably others). IIRC, TOBex provided the means to block some (instances) of these issues but not others and some mods (SCS?, SR?, IR?) took advantage of that.

I'm afraid it would be too much work for little gain to consistently block non-static animations and sounds (including casting ones) depending on whether creatures are able to see/hear things or not. One has to deal with mass vision & hearing somehow. It's the same problem that party infravision presents: some creatures in a group may not have it but others may have and, presumably, be able to convey what they see to the former, unless they're incapacitated themselves. I think not even Silence should prevent them from doing so. Same logic applies to calls for help. Yes, they're called 'shouts' but they don't have to be 'spoken' or even audible to attract attention. Sign languages exist after all.

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

Isn't Opcode #47 (0x2F) Cure: Invisibility the one that specifically reverses (non-improved) invisibility during casting? Vocalize is #48. Or did you mean something else?

 

Well else... the fact that you become visible by casting a spell has nothing to do with opcodes, but rather the effect of you actually being vocal and start making visible magical symbols with your hands to gather the magical essence needed in the casting.

Did doctorstrange ever cast things while being invisible ? And yes, you can hide yourself behind a cupboard to cast a spell, but that's not invisibility.

1 hour ago, Istfemer said:

Sign languages exist after all.

 
 

Yes, but do people just intuitively understand exactly what the other person, that has suddenly become silent, tries to sign to them ? Cause I use signs in my work, being behind a window and heavy sound of manufacturing goods, and even though it should be very simple communication, it's definitely not always, and it leaves a lot to be desired from. ..which is why other means to communicate, has been supplied in there.

Link to comment
On 7/7/2019 at 11:09 PM, DavidW said:

There’s no great difficulty in letting the AI detect that a spell is being cast, but as for doing something clever with that information... let’s just say you might be overestimating what the IE scripting system is capable of. 

There is no need to use scripts with this. Effects are enough. And it is true that for counterspelling opposing a spell of one caster with another spell or the same spell of a different caster (depending on the system one has in mind) would be both difficult to implement and not useful. Characters memorize spells for a reason, to achieve something with them, and expending one's Mirror Image to prevent somebody else's Mirror Image is a dubious proposition in most situations, to say nothing of less common spells. I have, however, sketched a counterspell system myself some time ago, and while I'm not going to finish it as a mod, I can tell the curious how to implement counterspelling without much hassle and with use.

1. The basic principle: opposition schools cancel each other. Never mind particular spells and text information. Casting glows are sufficient. To stop a starting spell of Alteration, cast anything from Abjuration on anyone. This will, among other things, make low-level spells useful even at high levels. Carry around Friends to cancel Fireball, for instance. On the other hand, long and unwieldy high-level spells may be useful for quick counterspelling, and a limited assortment of powerful spells would find more application. 9th an 8th wizard spells are not numerous to begin with and one comes by them slowly, so it is quite possible to go around with just Wish on page 9 and no desire to summon that stupid pseudo-genie. Or with Incendiary Cloud and no opportunity for wholesale destruction. If Incendiary Cloud could counter any Enchantment/Charm spell instantly and if Wish could counter any spell at all, players would get a bit more breathing space.

2. Implementation: patch all spells that are not from the GENERALIST school with two global effects, applied during casting. The first is a combination of rare spell states unique for every school. Let all Abjuration spells put the caster under EYE OF STONE, HOPELESSNESS and ARMOR OF FAITH. Duration should be the same as the spell's casting time, and here a good specialist on Weidu would come in handy to automate this, fetching casting times and changing the spell states' durations to match, perhaps. This prepares the caster for being countered. The second global effect is for countering: "Apply Effects List" - > Everybody - > Enemies -> (Spell) "Apply Effects List" - > Preset target - > Spell state 1 of the combination for Abjuration - > (Spell) "Apply Effects List" - > Preset target - > Spell state 2 and so on. Now casting the spell will break Alteration for all enemies. The last spell in the chain should include a "Damage" to Original caster, 0 points, or another interrupting effect so that the Abjuration spell ends on distupting someone.

For limitations one can introduce some range limits in one of these spells. If breaking all Alteration spells that might be going by one casting of Abjuration is too much, insert another subspell in the beginning of the chain. Instead of "Apply Effects List" - > Everybody use "Cast spell at Point" - > Self, and here put an area of effect, for example, equal to sight range. That's about 550 Explosion size in the PRO. Or limit countering in another way: in the final spell put effect 206 or 318, targeted Everybody, blocking this spell. Now only one enemy caster who might be in the middle of an alteration will be distrupted (the nearest one).

This system's flaw is obviously that counterspelling is not optional but happens between any opponents casting from different schools. Characters would have to be aware that their spells may cause other ongoing spells to fizzle instead of achieving the end result. No trying Finger of Death when someone is in the middle of Illusion/Phantasm unless you are prepared to expend a high-level spell to terminate what may just be Reflected Image (if you can beat casting time 1). And enemies may accidentally disrupt the party's spells by casting their own. But this, on the whole, should end up adding to excitement rather than detract from it. What are the enemies casting? Do I agree to adapt and choose a different spell from the one I wanted or should I try to be quicker the next time and whip out the essentials before the other side does? Is this spell being cast worth disrupting or should I let it happen and then bring my own spells into play as I wanted? Mages, too, would finally get a boost over specialists because of their wide spell selection and therefore broader counterspelling options. Curiously, in this system specialists have no way to break the spells of their school - necromancers get no Illusion/Phantasm access to disrupt somebody else's necromancy. I think that is a fair description of a narrow specialist, though. 

Besides, one can role-play the situation easily. Who is to say the enemy mage did not mean to break the coming Alteration threat with his flash of Abjuration? What was going on in that duel? And these are, may I remind everyone, role-playing games. But if a modder absolutely wants counterspelling optional, he can go ahead and give a Special Ability to all spellcasters, target "Caster (keep spell, no animation)". This would simply block or unblock the first of the linked subspells for Everybody, turning the counterspelling mode on or off. I think the system is better without, though. NPC get no such controls, so giving them to the player to be even more clever with his tactics while NPC stumble around on scripts tips the balance in the party's favor another step.

Edited by temnix
the moon is made of blue cheese
Link to comment
2 hours ago, temnix said:

I have, however, sketched a counterspell system myself some time ago, and while I'm not going to finish it as a mod, I can tell the curious how to implement counterspelling without much hassle and with use.

1. The basic principle: opposition schools cancel each other. Never mind particular spells and text information. Casting glows are sufficient. To stop a starting spell of Alteration, cast anything from Abjuration on anyone. This will, among other things, make low-level spells useful even at high levels. Carry around Friends to cancel Fireball, for instance. On the other hand, long and unwieldy high-level spells may be useful for quick counterspelling, and a limited assortment of powerful spells would find more application. 9th an 8th wizard spells are not numerous to begin with and one comes by them slowly, so it is quite possible to go around with just Wish on page 9 and no desire to summon that stupid pseudo-genie. Or with Incendiary Cloud and no opportunity for wholesale destruction. If Incendiary Cloud could counter any Enchantment/Charm spell instantly and if Wish could counter any spell at all, players would get a bit more breathing space.

...

This system's flaw is obviously that counterspelling is not optional but happens between any opponents casting from different schools. Characters would have to be aware that their spells may cause other ongoing spells to fizzle instead of achieving the end result. No trying Finger of Death when someone is in the middle of Illusion/Phantasm unless you are prepared to expend a high-level spell to terminate what may just be Reflected Image (if you can beat casting time 1). And enemies may accidentally disrupt the party's spells by casting their own. But this, on the whole, should end up adding to excitement rather than detract from it. What are the enemies casting? Do I agree to adapt and choose a different spell from the one I wanted or should I try to be quicker the next time and whip out the essentials before the other side does? Is this spell being cast worth disrupting or should I let it happen and then bring my own spells into play as I wanted? Mages, too, would finally get a boost over specialists because of their wide spell selection and therefore broader counterspelling options. Curiously, in this system specialists have no way to break the spells of their school - necromancers get no Illusion/Phantasm access to disrupt somebody else's necromancy. I think that is a fair description of a narrow specialist, though.

Besides, one can role-play the situation easily. Who is to say the enemy mage did not mean to break the coming Alteration threat with his flash of Abjuration? What was going on in that duel? And these are, may I remind everyone, role-playing games. But if a modder absolutely wants counterspelling optional, he can go ahead and give a Special Ability to all spellcasters, target "Caster (keep spell, no animation)". This would simply block or unblock the first of the linked subspells for Everybody, turning the counterspelling mode on or off. I think the system is better without, though. NPC get no such controls, so giving them to the player to be even more clever with his tactics while NPC stumble around on scripts tips the balance in the party's favor another step.

The big problem with this approach is that it doesn't make much sense. It is too far removed from P&P (in general, not just 2E/2.5E). I *could* see it work but only in some bizarre 'homeruled' equivalent of a 'wild magic zone', and even then probably not in the Prime Material plane of Toril. I mean, WHY should my single casting of Friends cancel out *all* enemy Fireballs being cast in my vicinity in that particular moment? What's the justification here?

Link to comment

I guess it would be cool if enemy casters could decide whether to shut you up with power word silence, for example, based on what school you are casting from... so illusion - no (rather, dispel the illusion afterwards and do something more damaging to the player right away), but necromancy or alteration - yes

or: untargetable enemy mage, you start casting a divination spell - he immediately casts SI:divination (especially if he has a casting speed bonus); but if you cast a necromancy spell, he doesn't waste time and casts something offensive, because he likely won't be targetable by your spell

it's a little bit "combinatorial", but not really. it would only go to the effect of speeding up reactions a little bit I guess

Link to comment

Doesn't seem like any of this would work well in this engine.

- It all depends on casting times - and only human players have the ability to lower their casting speed.

- It all depends on being able to wait - to not cast anything when your 6-second timer is up and instead wait a split-second to see what the enemy does. But only human players can do that. 

- Or you could get yourself into a rhythm, to be half a second behind the enemy every round, and thus able to consistently stymie them. Or to be 1.3+ seconds ahead of the enemy every round, and inly cast very quick-casting spells, so the enemy can never stymie you. Again, only humans have the ability to do this sort of thing. 

It boils down to manufacturing ways to abuse the fact that the game isn't turn-based - exploiting systems for an unfair advantage, instead of playing and winning within the system. That doesn't seem like a mod I'd want to use. 

Link to comment
13 hours ago, Jarno Mikkola said:

Well else... the fact that you become visible by casting a spell has nothing to do with opcodes, but rather the effect of you actually being vocal and start making visible magical symbols with your hands to gather the magical essence needed in the casting.

Did doctorstrange ever cast things while being invisible ? And yes, you can hide yourself behind a cupboard to cast a spell, but that's not invisibility.

So you're arguing that the magical symbols that casters draw in the air as they cast their spells shouldn't be affected by invisibility because those are external to casters. Is that right?

---

'As you can't cast without vocals'

And that's a problem. I hold that you should be able to if you're affected by Vocalize.

---

I'm not familiar with Doctor Strange, only with Doctor Strangelove.

13 hours ago, Jarno Mikkola said:

Yes, but do people just intuitively understand exactly what the other person, that has suddenly become silent, tries to sign to them ? Cause I use signs in my work, being behind a window and heavy sound of manufacturing goods, and even though it should be very simple communication, it's definitely not always, and it leaves a lot to be desired from. ..which is why other means to communicate, has been supplied in there.

Fair enough. I think simple gestures/actions would suffice for calls for help, as it should be relatively easy to get your buddy's attention in a threat-rich environment, which a great part of BG1/2-era West Faerun is. Advanced information transfer is tougher to justify, but we can assume that the group in question uses a robust, pre-agreed sign system (like military squads & SWAT teams do). And if they aren't ('cause they're too green/careless), they can be expected to learn to use one after they stumble upon an encounter that is specifically designed to test their cooperation skills and it ends in disaster for them. Yeah, yeah, that encounter doesn't have to be specifically designed to test anything. It could be totally random and totally not a DM's decision. Yep.

Link to comment
8 hours ago, Istfemer said:

So you're arguing that the magical symbols that casters draw in the air as they cast their spells shouldn't be affected by invisibility because those are external to casters. Is that right?

---

'As you can't cast without vocals'

And that's a problem. I hold that you should be able to if you're affected by Vocalize.

 

Well, they are external light sources directly next to the magic user... so yeah, you become visible. Unless I am blind, or I am behind a wall, and unable to see them... and that's only in regards to me.

---

You can hold that, but then, don't be silent about it. Ouh, I heard uttered words, there you are. As in, you can't stack vocalize and silence. And silence is technically only a hostile spell... so you can't silence your ranger and make him ultra stealthy. They still make sounds, just nothing comes out of their mouth. Or if it does, no one will understand. .. well, unless the other is psy-capable.

Edited by Jarno Mikkola
Link to comment

I had a long nice answer written here, addressing some of the objections, but the fucking editor of this board went and deleted the text. Hooray! DavidW is right, though, this is not about SCS. Keep calm and carry on, as they say.

Link to comment

Original BG used to try to detect Fireball casting (via variable set in global effects) and react to it with, I think, Potion of Icedust. Personally, I wouldn't care. The scripting language is limiting enough, that some players have been confusing SoD AI with SCS', despite the former's being about tenfold smaller in size and complexity. Returns diminish exponentially.

Link to comment
On 7/9/2019 at 6:25 PM, subtledoctor said:

Doesn't seem like any of this would work well in this engine.

...

It boils down to manufacturing ways to abuse the fact that the game isn't turn-based - exploiting systems for an unfair advantage, instead of playing and winning within the system. That doesn't seem like a mod I'd want to use. 

I sort of agree with the first quoted sentence, but the last two somehow make no sense to me. Huh? What do you actually mean? Whose 'unfair advantage' are you referring to? That of the human player or that of the AI? Who'd be doing the exploiting job in a hypothetical mod according to you? The human player or the AI? As for me, I think none of them would be as they both would be on even footing then.

Don't you get the same kind of instant intel as I do when AI wizards/priests begin casting their spells? Don't you consider it an unfair advantage to the human player that the AI cannot benefit from the same kind of instant intel when it's the player's wizards/priests who do the casting? You realize you can't simply erase this knowledge from your memory once you've received it, don't you? The game *forces* it on you; forces you to exploit it whether you like it or not. As long as you are the sole recipient of the aforementioned instant intel, you are definitely NOT 'playing and winning within the system'. My goal is to close exploits, not introduce them and that's what my suggestions are meant to be a guide for.

Yes, BG games are 'realtime with pause' games. I'm not convinced that rebuilding IE as a true realtime/turn based hybrid would necessarily improve gameplay or, say, make the system any closer to P&P.

On 7/9/2019 at 6:25 PM, subtledoctor said:

- It all depends on casting times - and only human players have the ability to lower their casting speed.

Aren't there a few enemies in SCS (Vongoethe?) who can be given items granting casting time reduction at install time? Anyway, it shouldn't take long (no more than a round) for an experienced enemy caster/wise non-caster to figure out that a PC has such items, which are very rare by the way, and make adjustments. (I liked how IR nerfed Robe of Vecna/Robe of Larloch or whatever it's called these days.) Casting times *are* a concern, but they aren't a showstopper.

On 7/9/2019 at 6:25 PM, subtledoctor said:

- It all depends on being able to wait - to not cast anything when your 6-second timer is up and instead wait a split-second to see what the enemy does. But only human players can do that. 

For pure casters? Yes, pretty much. And in my view, choosing to wait with spells (and do something else useful in the meantime, e.g. switch to ranged weapons instead, even for just half a round or change position on the battlefield) is a legitimate tactic that ought to be extended to the AI. It's not an exploit. Not even close.

Pure warriors & rogues usually don't need to wait for anything as they seldom have & use (non-prebuff) spells. They only need to know such things like whom to engage in melee, whom to avoid in melee, on whom to focus ranged fire, when to retreat and whether to use certain potions/wands/scrolls/thief skills/special abilities when they see a spell of a certain school being cast by the enemy. (yeah, I'm probably oversimplifying here but not by much)

Multi-classed casters (except wizard/priest multis) are the most versatile when it comes to reacting. They may cycle between either approach quite freely depending on how the battle goes.

On 7/9/2019 at 6:25 PM, subtledoctor said:

- Or you could get yourself into a rhythm, to be half a second behind the enemy every round, and thus able to consistently stymie them. Or to be 1.3+ seconds ahead of the enemy every round, and inly cast very quick-casting spells, so the enemy can never stymie you. Again, only humans have the ability to do this sort of thing.

No need for enemy spellcasters to use this tactic every round. Make it so they have a random chance of using it every round and vary the length of the "waiting window". It may be a good idea to force spellcasters to use this tactic more often and wait longer if they can detect that their human opponent spams this tactic constantly, trying to outwait them all the time. Unfortunately, it's probably very difficult to write code that properly detects whether such abuse has, in fact, occurred.

As I said before, it's not *only* about countering the slow-casting spells of your enemy with the quick-casting spells of your own (offensive, defensive or otherwise). Other actions can and should be taken if the situation at hand calls for it.

Link to comment

I repeat my statement that, in my judgement, it would not be realistic to implement this inside the game's scripting engine, at least without a totally prohibitive increase in script length. Feel free to prove me wrong by writing AI that does it.

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