Here's what I whipped up for the next BP-Series release in a couple days, thanks for the tip-off. Feel free to use it w/ the e-Series if you like (global names will need changing or just the important bits spliced-out). Or, just come grab the BP-Series pack from SHS now that it's fit for BG2-vanilla/BGT/(prob???) TuTu/BGEE, as well as Detectable Spells-compatible (i.e. should be no issues w/ SCS/II/etc, not that there really was before). More importantly, it's actively supported by the author these days.
IF
HaveSpell(WIZARD_SLEEP)
OR(2)
!GlobalTimerNotExpired("SPL_CAST","LOCALS")
CheckStat(Myself,1,WIZARD_IMPROVED_ALACRITY)
OR(2)
ActionListEmpty()
GlobalTimerNotExpired("INTERUPT","LOCALS")
GlobalGT("THREAT","LOCALS",0)
NumCreatureGT([EVILCUTOFF],2)
General(LastSeenBy(Myself),HUMANOID)
CheckStatLT(LastSeenBy(Myself),5,LEVEL)
!InParty(LastSeenBy(Myself))
!Allegiance(LastSeenBy(Myself),GOODCUTOFF)
!Race(LastSeenBy(Myself),ELF) // BGEE is set up to handle elf sleep resistance
CheckStatLT(Myself,75,SPELLFAILUREMAGE)
CheckStatLT(LastSeenBy(Myself),76,RESISTMAGIC)
!HasItem("RAKRING",LastSeenBy(Myself)) // No such index
!HasItem("IMMCHS",LastSeenBy(Myself)) // No such index
!HasItem("IRONGOL",LastSeenBy(Myself)) // No such index
!HasItem("MAGEAMUL",LastSeenBy(Myself)) // Necklace
THEN
RESPONSE #100
SetGlobalTimer("SPL_CAST","LOCALS",6)
Spell(LastSeenBy(Myself),WIZARD_SLEEP)
END
IF
HaveSpell(WIZARD_COLOR_SPRAY)
OR(2)
!GlobalTimerNotExpired("SPL_CAST","LOCALS")
CheckStat(Myself,1,WIZARD_IMPROVED_ALACRITY)
OR(2)
ActionListEmpty()
GlobalTimerNotExpired("INTERUPT","LOCALS")
GlobalGT("THREAT","LOCALS",0)
!General(LastSeenBy(Myself),UNDEAD)
NumCreatureGT([EVILCUTOFF],1)
HPGT(LastSeenBy(Myself),5)
CheckStatGT(LastSeenBy(Myself),10,SAVEVSSPELL)
Range(LastSeenBy(Myself),6)
!InParty(LastSeenBy(Myself))
!Allegiance(LastSeenBy(Myself),GOODCUTOFF)
OR(4)
Range(Player1,1) // I'm the caster, or right next to them
!Range(Player1,8) // Range is 15 which means about 8 in script-measure
CheckStatGT(Player1,4,LEVEL) // unconsciousness only affects up to 4 HD in spell effects
CheckStatLT(Player1,8,SAVEVSSPELL) // A -3 save, so a 50/50 chance
OR(4)
Range(Player2,1) // I'm the caster, or right next to them
!Range(Player2,8) // Range is 15 which means about 8 in script-measure
CheckStatGT(Player2,4,LEVEL) // unconsciousness only affects up to 4 HD in spell effects
CheckStatLT(Player2,8,SAVEVSSPELL) // A -3 save, so a 50/50 chance
OR(4)
Range(Player3,1) // I'm the caster, or right next to them
!Range(Player3,8) // Range is 15 which means about 8 in script-measure
CheckStatGT(Player3,4,LEVEL) // unconsciousness only affects up to 4 HD in spell effects
CheckStatLT(Player3,8,SAVEVSSPELL) // A -3 save, so a 50/50 chance
OR(4)
Range(Player4,1) // I'm the caster
!Range(Player4,8) // Range is 15 which means about 8 in script-measure
CheckStatGT(Player4,4,LEVEL) // unconsciousness only affects up to 4 HD in spell effects
CheckStatLT(Player4,8,SAVEVSSPELL) // A -3 save, so a 50/50 chance
OR(4)
Range(Player5,1) // I'm the caster, or right next to them
!Range(Player5,8) // Range is 15 which means about 8 in script-measure
CheckStatGT(Player5,4,LEVEL) // unconsciousness only affects up to 4 HD in spell effects
CheckStatLT(Player5,8,SAVEVSSPELL) // A -3 save, so a 50/50 chance
OR(4)
Range(Player6,1) // I'm the caster, or right next to them
!Range(Player6,8) // Range is 15 which means about 8 in script-measure
CheckStatGT(Player6,4,LEVEL) // unconsciousness only affects up to 4 HD in spell effects
CheckStatLT(Player6,8,SAVEVSSPELL) // A -3 save, so a 50/50 chance
CheckStatLT(Myself,75,SPELLFAILUREMAGE)
CheckStatLT(LastSeenBy(Myself),76,RESISTMAGIC)
CheckStatLT(LastSeenBy(Myself),5,LEVEL)
!HasItem("RAKRING",LastSeenBy(Myself)) // No such index
!HasItem("MAGEAMUL",LastSeenBy(Myself)) // Necklace
THEN
RESPONSE #100
SetGlobalTimer("SPL_CAST","LOCALS",6)
Spell(LastSeenBy(Myself),WIZARD_COLOR_SPRAY)
END
I did my best in IE-language to account for the 60-degree (actually 120-degree total) arc-effect of the color spray spell. Thus the Range of <= 1 OR > 8 checks. Close enough to not be in it, or far enough away not to matter. Still quite clumbsy, but you'd only expect the proper scripting functions for geometry in a 3d game (e.g., NWN has very precise cone-shaped AoE detection).