Jump to content
Sign in to follow this  
Gimble

Detectable Spells request (spell level immunity)

Recommended Posts

I'm not sure it belongs in this forum, but I've loaded a piece of SCS just for doing user scripting.

 

A big annoyance for user scripting is the "immunity to spell level" checks, as they require tests like the following:

!CheckStatGT(LastSeenBy(Myself),0,MINORGLOBE)
!HasItemEquiped("RAKRING",LastSeenBy(Myself)) // Immune to 8th and below
!HasItemEquiped("LICH",LastSeenBy(Myself)) //Immune to 5th and below
!HasItemEquiped("MAGEAMUL",LastSeenBy(Myself)) // Immune to 3rd and below

 

Instead, if there was a IMMUNE_TO_SPELL_LEVEL_AND_BELOW stat (and items and spells modified), it could be simplified to something much simpler, like:

 

CheckStatLT(LastSeenBy(Myself),3, IMMUNE_TO_SPELL_LEVEL_AND_BELOW )

 

... or at least, that's what I think could be done.

Share this post


Link to post

There isn't really any spare space in detectable spells, unfortunately (and in this case, the effects can perfectly well be detected as you suggest).

 

This would be doable with the extended stats in ToBEx, so you could do it that way if you wanted. There is a nice version of DS packaged by Ardanis at Spellhold Studios that semi-automates it.

Share this post


Link to post

Ah, well it was worth asking. One thought: would it make sense to change the behavior of the MINORGLOBE stat? All the script snippets I've seen to date have just checked for non-zero (a binary flag), which would still work if it were switched to mean immunity to spell level N and below.

Share this post


Link to post

Ah, well it was worth asking. One thought: would it make sense to change the behavior of the MINORGLOBE stat? All the script snippets I've seen to date have just checked for non-zero (a binary flag), which would still work if it were switched to mean immunity to spell level N and below.

 

It's hard-coded, I think.

 

Incidentally, if the issue is just that it's tedious and repetitive to write out these blocks by hand, look at SSL ("stratagems scripting language"), packaged with SCS and SCS2 - it automates most of the tedium.

Edited by DavidW

Share this post


Link to post

I didn't know that: it would have been a help a month or two ago (before I wrote my own script-helping tools based largely on the C++ preprocessor).

 

It wasn't the tedium that bothers me ( it's been "macroed" to be just a _IsImmune1() call ), but the performance hit at run time. User script check blocks are already long, and the extra string lookups and inventory checks for three items don't make things faster. I've moved them to be last in evaluation (since they rarely fail), but it's that programmer tendency to always want to optimize things that is just kicking in.

 

I appreciate the help you've provided and all the work you've done.

 

(Side question: is there a way to detect Vocalize? It dawned on me some things like Silence 15' Radius could be safely cast without range checks if Vocalize was already on the caster).

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...