Jump to content

NPC casting check for spell currently active on target?


Annie_Thorne237

Recommended Posts

Hi, got a question about AI scripting. How can you get the NPC to make a check to see if the PC or anyone else in the party already has a spell on its target. trying to get the NPC to check if "regenerate light wounds" is already cast upon it's target, so it doesn't continuously cast the druid regenerate spell.

 

Currently, the script goes: (roughly)

 

IF

HPPercentLT(MostDamagedOf([PC])

SpellCastRES("sppr117",MostDamagedOf([PC]),50)

HaveSpellRES("sppr117")

THEN

RESPONSE #100

SetInterrupt(False)

SpellRES("sppr117",MostDamagedOf([PC])

SetInterrupt(True)

END

 

 

Also...

is ([PC]) enough to get the NPC to cast on other party members?

Please please please help

Link to comment
is ([PC]) enough to get the NPC to cast on other party members?

 

Should be, although it'll only match the most damaged (is there second etc. most damaged type? I forgot...). Or you can also iterate players individually after the initial MostDamaged() target, but that'll need additional HPLT() (to not cast on healthy targets) and See() (unlike dynamic [] object types, static ones are not bound by the line of sight) checks.

 

 

trying to get the NPC to check if "regenerate light wounds" is already cast upon it's target, so it doesn't continuously cast the druid regenerate spell.

 

Spell will need to be flagged with a custom stat (ToBEx) or spellstate (BG EE), so that actor can be checked for it. Although maybe CLERIC_REGENERATION would suffice too.

As for how to add it... You'll either have to use CLONE_EFFECT function to copy an effect with matching duration into a stat, or kick me until I update the Detectable Spells lib that's in public with EE v2.0+ code and documentation...

Link to comment

Don't know how to edit posts so...

Sorry for not asking this from the beginning, not being clear and all...can't stand phones, they are soooo tiny...

 

IF
HPPercentLT(Player1,70)
HaveSpellRES("sppr117") // Regenerate Light Wounds

>>>>>"CheckStat(Player1,X,X)" <<<<< what do you have to write here to get the game to look for "Spell Revisions" druid regenerate spell currently on Player1? and only cast it on player1 if their health is below and that they don't already have it cast currently on them?

Is this even possible. Don't know how to use ToBeX... again,sorry for not being very clear at all...

!StateCheck(Player1,STATE_INVISIBLE)
!StateCheck(Player1,STATE_IMPROVEDINVISIBILITY)
CheckStatLT(Myself,25,SPELLFAILUREPRIEST)
!GlobalTimerNotExpired("u_Healing","GLOBAL")
Global("u_SpellcastingOff","LOCALS",0)
THEN
RESPONSE #100
SetInterrupt(FALSE)
SetGlobalTimer("u_Healing","GLOBAL",ONE_ROUND)
SpellRES("sppr117",Player1) // Regenerate Light Wounds
DisplayStringHead(Myself,119628) // Regenerate Light Wounds
SetInterrupt(TRUE)
END

 

?

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...