Jump to content


Photo

Detectable Spells


  • Please log in to reply
22 replies to this topic

#1 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 12 January 2012 - 10:05 AM

Old thread

// Detectable Spells v3
//
// Assembled by Ardanis/GeN1e, using DavidW's version (SCS) as a base
//
// Changes from previous version (SCS):
// - if Khelben's Warding Whip is broken, we first will attempt to repair it
// - removing older Ascension version of DS is less destructive
// - patching STATS.IDS is compatible with ToBEx
// - scripts from Kiara-Zaiya mod are also being updated to use new DS
// - core code is more compatibility-friendly with spell-altering mods
// - removed EFF-patching, it is not being used anywhere anyway
// - removed ~134 LEVELDRAIN~ stat, until somebody shows me a live example of the 200th stat NOT working
// - new ToBEx stats may be added on the fly, similar to how ADD_SPELL WeiDU command works (suggested by i30817 and aigleborgne)
//
// Contents (don't change any, unless you're the next update maintainer!!!):
// ds.tph
// spwi705.spl
// stats.2da
// fix_old_ds.2da
// old_ds_swap.2da
//
// Usage (basic):
// copypaste code below into your TP2, and set the path to match the directory
/*
OUTER_SPRINT path ~mymod/ds_folder~ // change it to your mod folder
INCLUDE ~%path%/ds.tph~
LAF detectable_spells_setup STR_VAR path END
LAF detectable_spells STR_VAR table=~%path%/cddetect.2da~ END
*/
//
// Advanced options:
// 1) table's format is:
// FILE - which file (SPL or ITM) you want patched
// OPCODE - which opcode will be added to the FILE (233 is proficiency, 282 is scripting state)
// PAR_1 - the first parameter of OPCODE (stat value for 233/282 opcodes)
// PAR_2 - the second paramater of OPCODE (stat's index in STATS.IDS, substract 156 for scripting states);
// if set to a string, it will be looked up in STATS.IDS and the corresponding index will be used instead
// CLONE - the opcode used as a marker (duration, etc.) for generating OPCODE; if CLONE is not found, OPCODE will not be added
// TICK - see the 4th option (below) for detailed explanation
// PATCH_WHAT - the location within FILE where OPCODE should be added to (and where CLONE is looked up):
// "g" - global (equipped) effects
// "a" - all ability headers
// if you want only specific header patched, set PATCH_WHAT to that header's index (starting from 0)
//
// 2) you can launch the second macro multiple times with different tables (change path, if required)
//
// 3) you can use stats' ID names in your table instead of fixed values; to avoid compatibility issues with other ToBEx-using mods,
// consider using only strings (with your personal modder's prefix) for ToBEx stats, rather than values - DS then will find the
// lowerest unclaimed 400+ slot in STATS.IDS and use it for further patching
//
// 4) you can update painlessly spells with ticking effects (Khelben's Whip, clouds) - change the letter in "tick" column to a value;
// DS will find the effect with the longest delay and use it for the cloning purpose, your value will be added to the total duration;
// non-zero values may be required in cases when the spell only has one effect in header and relies on the projectile to apply it
// multiple times (clouds)
//
// 5) if you have altered some spells, so that their duration can no longer be correctly detected by the opcode in "clone" column, you
// must update the "ag#dsalt.2da" table in the "override" folder, to let other mods know of your changes; if you don't, those mods will
// erroneously assume that the spell's detection is invalid and delete it; this is how we'd proceed with the Spell Shield fix (SCS):
/*
LAF ds_altered_spell INT_VAR old_clone=226 new_clone=142 STR_VAR file=~spwi519.spl~ END
*/
// 6) you can install detectable weapon enchantment, as per SCS:
/*
LAF detectable_weapon_enchantment END
*/
//

Attached Files


Edited by GeN1e, 12 January 2012 - 11:11 AM.

Retired from modding.


#2 DavidWallace

DavidWallace
  • Validating
  • 337 posts

Posted 12 January 2012 - 10:28 AM

Looks great, congratulations. (I assume it plays nice with the existing SCS(II) versions?)

EDIT: come to think of it (probably more importantly) is this version of label_weapons happy to be installed multiple times? (I don't recall if my original one was.)

Edited by DavidWallace, 12 January 2012 - 10:30 AM.


#3 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 12 January 2012 - 11:23 AM

I assume it plays nice with the existing SCS(II) versions?)

I've tested it over pre-installed SCS, found no issues. The main reason for updating was to allow spells from table to have been changed - currently, if the "clone" opcode isn't found in file, the proficientcy will be added nonetheless, using the last found "clone" from previous file entries in table.

is this version of label_weapons happy to be installed multiple times? (I don't recall if my original one was.)

Fixed. Weapon enchantment now can be safely changed between consequent installs.

Retired from modding.


#4 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 17 February 2012 - 06:07 PM

I had to modify your syntax a bit to get this installed in a new version of Ascension. Something like STR_VAR path = EVALUATE_BUFFER ~%path%~ and (in the 2nd LAF) STR_VAR table = ~cddetect.2da~ - no path there since it was taking a double path otherwise. Feel free to look at it in the BP Workroom (see PM) and see if it needs anything else; I haven't tested it other than making sure it installed without error. Also, I am not sure what we would need to do to implement this in BP core; it changes a whole lot of stats.ids and state.ids entries and other stuff; maybe some of it is redundant to this code.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#5 WVN777

WVN777
  • Member
  • 5 posts

Posted 21 November 2013 - 02:40 AM

Apologies if this isn't the right place to ask this. (I'm no modder, just a player.) I encountered a problem upon installing aTweaks, which installs Detectable Spells, which apparently removes all the higher opcodes added by TobEx, which presumably will impact anything new that depends on those opcodes. I've posted a question about that on the aTweaks forum here (http://www.shsforums...ounds/?p=564427).

 

So you're working on a TobEx friendly version of DS! Any chance of getting that out to the authors of aTweaks, SCS, Oversight, and anyone else who is using an older DS with their mods? Lastly, should I download ds_v3 above and install it on my game now, or is there a more recent version somewhere?  I'm presuming it should go last, i.e. over anything that messed with STATS.IDS previously?

 

Thanks!  ~ WVN777 ~



#6 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 27 April 2014 - 04:12 AM

As reported here, this:

COPY_EXISTING ~misc01.itm~ ~override/cddetect.spl~

is causing problems for any mod which assumes spells are spells.



#7 Belanos

Belanos
  • Member
  • 8 posts

Posted 04 November 2014 - 05:49 PM

Could someone make this work with IWD:EE please? I can't get it to install.


Edited by Belanos, 04 November 2014 - 05:50 PM.


#8 Mad Mate

Mad Mate
  • Member
  • 191 posts

Posted 03 December 2014 - 03:10 PM

Possible bug:
http://forums.gibber...e=6#entry229469

#9 -qwerty1234567-

-qwerty1234567-
  • Guest

Posted 18 September 2015 - 03:30 PM

Is this the current version?

What do I do if I want to detect a specific spell (Find Traps), which is not in the list?



#10 -LemonGraham-

-LemonGraham-
  • Guest

Posted 30 October 2015 - 04:03 PM

I would set a global timer for when someone casts Find Traps, that way only one party member is searching for traps at a time



#11 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 15 March 2016 - 07:44 AM

// - removed ~134 LEVELDRAIN~ stat,

Request: if a proficiency is freed up in recent versions of DS, can you guys leave it freed up? Please? It would be super super super useful if there was one single lonely itsy-bitsy proficiency available for use by other modders.

#12 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 15 March 2016 - 10:34 AM

// - removed ~134 LEVELDRAIN~ stat,

Request: if a proficiency is freed up in recent versions of DS, can you guys leave it freed up? Please? It would be super super super useful if there was one single lonely itsy-bitsy proficiency available for use by other modders.

Already answered on G3, but yes, it should be free unless another mod makes a use of it for some other purpose.


Retired from modding.


#13 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 21 March 2018 - 06:50 AM

Presto Revive-O!

 

Can anyone tell me what is the point of stat 132 "Khelben's Warding Whip" in Detectable Spells?

 

I did a basic EET install and searched every BCS script for references to it, and it came up blank.  (Specifically, I'm looking for which stats are associated with CheckStatGT and similar triggers.  SpellCastOnMe and that kind of thing is compatible with my purposes.)

 

Unlike most of the stuff I see in STATS.IDS, Khelben's is an offensive ability, not an ongoing buff.  So I'm not surprised that it doesn't show up in CheckStat triggers.  But then, out of curiosity, how is it used in DS??

 

I could see, maybe, if an enemy mage finds they have been hit by Khelben's, they might want to check whether the caster still has the effect active, so they know not to raise a new spell defense that would be destroyed a round later.  (Though, I would argue that this is actually bad tactics - the appropriate thing to do in that circumctance would be to raise another Spell Shield or something like that.)

 

Is it something like that?  What am I missing?  It seems like an odd duck.



#14 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5148 posts

Posted 21 March 2018 - 07:48 AM

  But then, out of curiosity, how is it used in DS??
You forgot a thing. The DS doesn't use a thing, it's installed as a part of an AI mod so the AI mod can use them. Such as SCS installs the DS in the base component so it can use them. So make a SCS install on your EET and find out that way. And while at it, you can install the Big Picture mod, and Atweaks/Rogue Revision and then search those games what the additional AI aspect are actually used for.
Aka it's a standard ... so the 5" monitors all actually have 5 inches diagonally, not vertically or horizontally. As those would produce very different dimensionally variable sized monitors.

Edited by The Imp, 21 March 2018 - 07:54 AM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#15 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 21 March 2018 - 08:59 PM

Ya but maybe someone who knows about DS could describe the dedign and intent behind it? Khelben's Warding Whip wasn't assigned tk a stat by accident...

#16 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5148 posts

Posted 21 March 2018 - 09:25 PM

Ya but maybe someone who knows about DS could describe the dedign and intent behind it? Khelben's Warding Whip wasn't assigned tk a stat by accident...
Spell description= "When this spell is cast, it dispels one spell protection of up to 8th level affecting the target creature. Every round thereafter till the duration of the spell expire" ... you do undestand what that means for the AI ? Yeah, let's cast a 8th level spell protection in the next 4 round and so actually do nothing. Though, that's not the dedign. :D

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#17 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 22 March 2018 - 08:49 AM

I personally am unaware if it's used somewhere or not. The idea behind a dedicated stat, however, seems very obvious to me - if I was hit by KWW, I should avoid re-casting spell protections, because they'll be dispelled the next round and I'll just waste both spell and a round.

 

FWIW, True Sight has been assigned the CANNOT_TURN_INVISIBLE spellstate for this very reason - to not waste potions of invisibility if someone nearby is spamming true sight every round.

 

PS Same goes for Insect Plague too (although it probably could've been substituted with spell failure check - I'm pretty sure I used the latter in SoD... if I did at all).


Edited by GeN1e, 22 March 2018 - 09:02 AM.

Retired from modding.


#18 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 22 March 2018 - 12:14 PM

So more or less what I thought - and i guess it's the <i>target</i> of the spell that gets the stat.

Shouldn't interfere with my using it for a thief kit, then! ;)

I'm not sure those tactics are in fact ideal, however. If you are tagged with KWW you'll lose your spell shield on the first round and your trap/deflection/turning on the 2nd round... if the KWW caster is very clever they can pause and hit you with a spell late in the 2nd round.

This stat is basically throwing up your hands and saying "welp, I guess I'm going to be hit by Disintegrate(/Finger of Death/Feeblemind/Acid Arrow/etc) in two rounds."

If you raise more defenses only to have them knocked down each round, you can probably stay ahead of the game and come out the other side of the KWW with (the ragged shreds of) your spell defenses intact. You'll lose some spell slots but you have a chance of avoiding a major disabling spell, which is the most important thing in BG2 wizard chess.

But sure I still see the stat's utility, a better AI script could do something more interesting when staring down the barrel of a Warding Whip...

#19 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 22 March 2018 - 01:35 PM

You ask too much of IE, I'm afraid :rolleyes:

The so-called smart AI is really quite simple if you look at the actual scripts (which is especially visible in their source, e.g. .SSL). A bit of randomness, some basic sanity checks, and a few simple tactics is usually enough to create the appearance of intelligence. And this is the upper limit of how much you can improve it before hitting diminishing returns from ever-bloating size - I know because this is how SoD AI was designed, yet players still called it smart and SCS-like, despite it being 5-10 times smaller and not even checking for protections/immunities when selecting targets for spells.


Edited by GeN1e, 22 March 2018 - 01:35 PM.

Retired from modding.


#20 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 12 May 2018 - 08:37 AM

DS can corrupt spells, notably ones from the upcoming 2.5 EE patch. This is because it uses a single tracking variable for both deleting and inserting effects while doing all deletes in a separate block from the inserts, and you can only use a single tracking variable if you do each operation in order. The specific issue in the EE spells is that DS deletes effects located after the effects to be cloned, so delta is incorrectly applied and the effects are inserted in the ability structure.

 

I decided the easiest way to correct this was by sorting the auxil array beforehand, so each deletion/insertion is performed in index-order. However, this requires a pre-release version of WeiDU (which I hope to get out this weekend; version 245, for posterity). Additionally, all mods that use an affected version of DS will need to be updated to be compatible with the 2.5 patch.

 

I have an updated version of DS here. It contains some other changes as well, but nothing big (see history). If someone is still maintaining DS, feel free to let me know how you want to do this.