Skip to content

[Request] Detectable Spells

CuvCuv Member, Developer Posts: 2,535
Alright, I will be honest and say that I have not read everything here yet, so this request may be covered in the G3 Fixpack somethere. But if not, I will elaborate.

Detectable Spells is a terribly useful feature for all modders where combat scripting is concerned. It allows enemies and allies, alike, to recognize and defend/respond to spells and tactics which give the appearance of much smarter AI.

Detectable Spells was developed at IEEAIS by Kenasai Ryu and Vulgar Zildrah as a special request by David Gaider for our work on Ascension... and then later further enhanced by Cirerrek with some tweaks and bugfixes for missing flags and modifiers.

Certain combat related spells have modifiers added that can be detected via a modified STATS.ids through scripting. These modifiers do nothing by themselves, but rather allow combat scripts to make use of them. Most combat mods already require a version of Detectable Spells to be installed prior to installation of the mod. Ascension for example. If the spells simply ship with these additions, then there should be need to include them in your mod. And having a mod install them over-top into the override should also cause no conflicts. It is my belief that this would be a worthy addition to BGEE.

Others may know the current state of DS better as I have been out-of-the-loop for a few years. So feel free to comment and discuss. Hope I formatted this request correctly.

Example:
Current Behavior - Your mage is protected against normal missiles. High level foe shoots ranged arrows at you anyway even though they should recognize your protection.

Desired Behavior- Your mage is protected against normal missiles. High level foe discovers first shot cannot hit you, so switches tactics; loads magical arrows, switches to melee, casts a spell or uses a wand.

Comments

  • HeroicSpurHeroicSpur Member Posts: 907
    Definately, there are a few enemies who will keep trying to attack you in a form which you're immune to, rather than trying a different option which they may have available to them.
  • ElectricMonkElectricMonk Member Posts: 599
    I second this request, and welcome any feature that could make the game more moddable.
    agreed, would be great if this got corrected.
  • AlejandroAlejandro Member Posts: 201
    Overall a pretty balanced idea that, while not changing the game entirely, improves it quite a bit. That`s certainly a great request. All my support towards this concept.
  • AzL0nAzL0n Member Posts: 126
    Really good suggestion and no, I don't believe this specific request had been posted before. Personally I'm all for a smarter AI. The smarter the AI the better.
  • AntonAnton Member, Moderator, Mobile Tester Posts: 513
    I may be wrong but this AI improvement may be already included in one of the mods mentioned here:
    Advanced Option: Checkboxes for Enemy AI Enhancements
  • CuvCuv Member, Developer Posts: 2,535
    @Anton
    Those are actual AI scripts. While they may indeed include DS or aspects of it, the Enhancements is a mod rather than a modding asset. Detectable Spells does not change gameplay or difficulty by itself, scripts must be added to utilize the features... and that is a players choice whether to add those game changing mods.

    Thanks for looking though, dont want there to be request duplication.
  • trinittrinit Member Posts: 705
    great concept. as long as AI changes tactics AFTER it establishes it's attacks are ineffective and not knowing all your buffs prior entering the battle, i'm all up for it! :D
  • AndreaColomboAndreaColombo Member Posts: 5,530
    @trinit

    I would like to clarify that what @Cuv has asked is not an actual AI improvement the effects of which would be seen immediately in BG:EE. That would be, I think, out of the dev's reach due to their contractual obligations anyway. Cuv is merely asking that the feature "Detectable spells", which requires specific scripts to be written in order to be used, is included in vanilla BG:EE so that modders can take advantage of it when scripting their mods.

    I fully support this request as a ton of mods can benefit from it and get better with less hack and coding if it is implemented.
  • CuvCuv Member, Developer Posts: 2,535
    Yes, thanks @AndreaColombo. What I propose are just the spell and STAT.ids changes to allow for mods to utilize the new scripting states and modifiers. If you play vanilla BGEE, you wont even notice those changes are there. But if you were to load up a script that does make use of them, then you will see changes and enhancements which the scripts themselves enable.

    I would also like to point out that if the developers have time, they can certainly add modifiers to more of the spells in the game. The ones included in DS were only what was needed at that time. Does anyone know if there has been any further work on Detectable Spells beyond v1.2.1? I could not find any in my searches. @Ascension64 or @aVenger might know if they have seen this thread. As would @Miloch if he were around here.
  • AndreaColomboAndreaColombo Member Posts: 5,530
    Hi @Cuv,

    Miloch is not a member of this forum, and the last time I exchanged PMs with him (a couple weeks ago) he was quite busy with RL. @Ascension64 is a member but he's also quite busy with RL, so your best bet to reach him is to PM him over the SHS forums and direct his attention this thread. It worked when I did it ;-) @aVENGER is quite active here (but I had to mention him 'cause I'm unsure whether the name drop feature on this forum is case sensitive).

    Other modders who might be interested in your proposal and have an account here are @devSin, @CamDawg, @GrimSqueaker and @Demivrgvs.
  • AlexTAlexT Member Posts: 760
    edited June 2012
    AFAIK, the latest "official" version of Detectable Spells is the one included in SCSII/RR/aTweaks. For reference, it was last revised by DavidW.

    I don't think there have been any official updates since then, but I seem to recall that @Ardanis was working on expanding it and had some suggestions in this regard for @Ascension64 concerning TobEx.
  • devSindevSin Member Posts: 32
    edited June 2012
    Yeah, it turns out you can't actually use stats, because nearly all of them are filled and have actual in-game effects when the stat is nonzero. I don't think we ever found a replacement that was truly universal (it's always been very hack-ish, and that hasn't changed with time, unfortunately).

    I suppose that they can add a long list of "open" stats that would allow mods to use the current functionality, or maybe a new trigger that can check if a particular object is under effects originating from a specific resource key (e.g., you could have something like AffectedBySpell("SPWI102",Player1) to see if they have any effects that claim the Armor spell as their parent resource) since the EFF structure already stores that information.

    Somebody more familiar with the needs of detecting specific effects and spells would probably have better feedback to give, though.
  • Ascension64Ascension64 Member Posts: 560
    By expanding stats to essentially INT_MAX, TobEx allows modders to implement a form of Detectable Stats that does not use the 'unused' weapon proficiency slots. However, since so many old and new mods rely on existing Detectable Stats (and don't want to use TobEx, fair enough), DS hasn't seen much update or improvement.
  • AndreaColomboAndreaColombo Member Posts: 5,530
    If that ToBEx feature were implemented in BG:EE, modders could start using it instead of relying on existing Detectable Stats, perhaps?
  • CuvCuv Member, Developer Posts: 2,535
    Thanks for the input @aVENGER, @devSin and @Ascension64. Suppose I could go through and make an updated version of the Ascension mod (which is what I had in mind) and use the ToBEx features you are alluding to. It's a lot of code-monkey work, but I do know those scripts intimately and there aren't that many spells to mess with. Ascension does work with the current DS tho, hmmm. And there is my own RtW mod that I must finish someday which relies heavily on DS and Xyx's work:-)

    @AndreaColombo Yeah, that would work too. But as @Ascension64 pointed out, there are tons of older mods that still rely on the old DS. Not that they could'nt be updated... but who would do that for all of them???? The ones that don't will still have all that junk in your override to get lost with everything else, heh.

    Either way.... perhaps a developer can settle this. I would be happy with a whole new set of scripting states that we could work with for combat/behavior.
  • AndreaColomboAndreaColombo Member Posts: 5,530
    @Cuv - well, at this point I believe it all comes down to which one is the more efficient script (i.e. which one works better and/or does the same with less coding or effort on the modder's part). Being no modder myself, I have no idea, and for what I'm concerned they may as well be equally efficient. If not, the more efficient script should be implemented in BG:EE, and as many mods as possible should rely on it. Older mods that don't get updated could still install the older version of DS and use it - subpar, perhaps, but better than nothing.
  • ArdanisArdanis Member Posts: 1,736
    The easiest and cleanest solution is to expand the current limit of 200 stats and let modders do the rest.

    Besides detecting spells, DS also can be accustomed to detect other effects - like the enchantment level of equipped weapons.
    AffectedBySpell() trigger won't suffice for mods - it will not work with complex 146th opcode shell spells, nor will it understand if a spell has been changed.
    Suppose I could go through and make an updated version of the Ascension mod (which is what I had in mind) and use the ToBEx features you are alluding to. It's a lot of code-monkey work, but I do know those scripts intimately and there aren't that many spells to mess with. Ascension does work with the current DS tho, hmmm.
    @Miloch is working on updating Ascension, and afaik it is mostly done. I advise to contact him first.
    Also keep in mind, that SCS2 offers it's own AI for Ascension creatures, and it is much more... modern, shall we say, at least compatibility wise.

    Basically, you've been left far behind the train :)
    Does anyone know if there has been any further work on Detectable Spells beyond v1.2.1? I could not find any in my searches.
    The thread is here http://www.shsforums.net/topic/53579-detectable-spells/
    I don't think there have been any official updates since then, but I seem to recall that @Ardanis was working on expanding it and had some suggestions in this regard for @Ascension64 concerning TobEx.
    I have updated several parts of DavidW's version, mainly to retain compatibility with spell-altering mods (Spell Revisions in particular). Currently this version is used in beta updates for Ascension and Big Picture, and we'll add it into future releases of IR and SR. I suggest you also update RR and aTweaks to it.

    I did found another compatibility issue barely a week ago, though - ToBEx is vulnerable to SCS'/RR's version of DS, which irreversibly destroys any existing 200+ stat labels in STATS.IDS. It makes dynamic addition of new stats impossible, forcing either to use hardcoded values (where clashes are possible) or a new IDS file. I'm working on the latter.
  • CuvCuv Member, Developer Posts: 2,535
    The easiest and cleanest solution is to expand the current limit of 200 stats and let modders do the rest.
    - snip -
    I did found another compatibility issue barely a week ago, though - ToBEx is vulnerable to SCS'/RR's version of DS, which irreversibly destroys any existing 200+ stat labels in STATS.IDS. It makes dynamic addition of new stats impossible, forcing either to use hardcoded values (where clashes are possible) or a new IDS file. I'm working on the latter.
    Ah excellent @Ardanis !!! I agree with you with this new information, modders would love a new fully extended IDS. I will contact @Miloch and see what's what. I've been out of the loop too long.
  • RazorRazor Member Posts: 436
    Very interesting thread! The community is slowly regrouping and now we have this new forum to serve as a beacon for all BG players. As such I think a similar place should be created to host all the (best) mods in one place (When BGEE is released of course) to make it easier keeping track.
  • AndreaColomboAndreaColombo Member Posts: 5,530
    It's awesome and topical at the same time that @Miloch has in fact just registered to this forum. Oh, the joy!! :D
  • CuvCuv Member, Developer Posts: 2,535
    Ah nice! If he can just answer this, then I will be happy.
  • MilochMiloch Member Posts: 863
    Heya, sorry for the late response (and what probably qualifies as a necropost here :D). I haven't had much internet access in the last couple months. I don't have much to add to what @Ardanis said and the thread he posted above. I have been using his version in an update to David Gaider's Ascension (as later revised by Wes Weimer and erebusant) and got as far as the main component of that (the subcomponents require quite a bit of revision for modern script-patching methods). Anyway, the recommended solution is probably the best - simply expand the available entries in stats.ids. However, I think the solution would also need to account for any existing spell/item opcodes #233 (proficiency/stat modifier) and #282 (scripting state modifier) that are designed to be "detectable." Thus, it should probably also implement most recent and comprehensive DS stats as well, which as far as I know have been essentially agreed upon and used by the community for years starting with the history that @Cuv mentioned above.

    So in short, I agree this should be implemented if it hasn't. It's worth mentioning that it did exist even in BG1 (for example you have 64 MINORGLOBE etc. in stats.ids, clearly designed to be detectable), was expanded in BG2, much more so in Gaider's Ascension, so the next logical step would be to implement it fully or at least enable it so that it can be so implemented.
  • AndreaColomboAndreaColombo Member Posts: 5,530
    Hey @Miloch! Great to see you over here! You never got back to my email, you know :P LOL
  • CuvCuv Member, Developer Posts: 2,535
    @Miloch You are not too late:D Thank you for those suggestions and for stopping by. The devs haven't said they 'won't' add DS yet, heh. so that is good news!
  • BerconBercon Member Posts: 485
    While the devs couldn't improve AI of the original game, they can do that with any added content. For example The Black Pits would most likely benefit from this.
  • CuvCuv Member, Developer Posts: 2,535
    @Bercon Good point there!
  • RazorRazor Member Posts: 436
    This is basically a beter AI and therefore a harder mode. I mean if the AI know exactly what we are/will cast(ing) we'll be fighting genious all the way... and not every opponent is that smart! AI should make mistakes too, anyway just my opinion.

    As you say Black pits can benefit from this and thats good enough for me.
  • MilochMiloch Member Posts: 863
    To clarify further, the fact that something like Detectable Spells might be implemented and available does not mean it will change vanilla game behaviour at all. It requires specific scripting to be available, that is, from mods and perhaps add-ons. To give an example:
    IF
    HaveSpell(WIZARD_CHARM_PERSON) //If caster has Charm Person memorised
    !StateCheck(LastSeenBy(),STATE_CHARMED) //And target isn't already charmed
    General(LastSeenBy(),HUMANOID) //And is a humanoid
    !Race(LastSeenBy(),ELF) //And ain't pointy-eared
    CheckStatLT(LastSeenBy(),50,RESISTMAGIC) //Is at least somewhat susceptible to magic
    !CheckStatGT(LastSeenBy(),0,MINORGLOBE) //Isn't surrounded by an anti-magic globe
    THEN
    RESPONSE #100
    Spell(LastSeenBy(),WIZARD_CHARM_PERSON) //Then cast Charm Person on target
    END
    As you see from the comments (everything after the // on each line), there are a bunch of conditions to this spellcasting script block. That last one is a "detectable spell" or stat - MINORGLOBE detection. This is where we get arguable when it comes to modding. It should be clear to any caster that the target has an anti-magic globe, because it's quite visible. What might not be is whether the target is an elf (could have long hair covering the ears) or whether she's affected by magic resistance (probably *not* visible, but could be known if the target is a drow, for example). But anyway, none of that is really here nor there - the vanilla game will not be affected by this implementation, unless the developers overhaul all the scripts (could be done as an option actually - would be *somewhat* tougher than vanilla but not nearly as tough as say SCS). On the other hand, it really should be done for any add-ons, because any spellcasters are intellligent enough not to ignore the majority of those conditions before wasting a spell.
Sign In or Register to comment.