Jump to content

HaveSpell(0) and Spell(LastSeenBy(Myself),0)


pro5

Recommended Posts

IF
Allegiance(Myself,ENEMY)
See(ThirdNearest([ENEMY]))
HaveSpell(0)
!Range(LastSeenBy(Myself),10)
THEN
RESPONSE #100
	Spell(LastSeenBy(Myself),0)
END

BG2 fixpack changes some of such blocks in original Bioware scripts, so I assumed they were meaningless or erroneous. But now I'm looking through some scripts in other mods, and find blocks like this (so someone used them on purpose). Can anyone knowledgable explain, how it works (if it works)?

Link to comment

Let's say I write a baf file like this:

 

IF
Allegiance(Myself,ENEMY)
See(ThirdNearest([ENEMY]))
HaveSpell(SPELL_FOO)
!Range(LastSeenBy(Myself),10)
THEN
RESPONSE #100
	Spell(LastSeenBy(Myself),SPELL_FOO)
END

 

When WeiDU goes to compile this, it will look for SPELL_FOO in spell.ids. If found, it'll substitute the numerical value for it (as the engine only understands the numerical value). If not it'll simply use zero, resulting in the code you've posted. These are usually caused by typos in spell references prior to compilation.

Link to comment

Could be a myriad of reasons--they're using an entry that isn't present by default, it's just a normal typo, etc. Some of them can also be intentional:

 

IF
SpellCast([PC],0)
!GlobalTimerNotExpired("SpellsBad","GLOBAL")
Global("BribedCowled","GLOBAL",0)
GlobalLT("CowledWarning","GLOBAL",7)
THEN
RESPONSE #100
	CreateCreatureObjectDoor("COWENF2",LastTrigger,0,0,0) // Cowled Enforcer
	SetGlobalTimer("SpellsBad","GLOBAL",300)
END

 

^^ This block, present in every Athkatla (outdoor) area script, summons the Cowled Wizards when you cast spells. In his case, SpellCast([PC],0) will pick up any mage spell cast by a PC.

Link to comment

Archived

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

×
×
  • Create New...