Jump to content

[BG2:ToB] - HaveSpell(), HaveSpellParty() and Spell()


aVENGER_(RR)

Recommended Posts

The current IESDP documentation states that the HaveSpell() and HaveSpellParty() triggers work only if the spell in question is listed in SPELL.IDS. However, I've noticed that these two triggers can accept numerical values just fine and compile them properly even if the spell itself isn't listed in SPELL.IDS as long as Bioware's numerical designation scheme is followed. For example, in the unmodded game, there is no entry for SPIN101.SPL in SPELL.IDS. However, this block still compiles and runs properly if the protagonist has the Cure Light Wounds Bhaalpower:

 

IF
HaveSpellParty(3101)
THEN
RESPONSE #100
	DisplayStringHead(Myself,6620) // Cure Light Wounds
END

 

HaveSpell() works too, if the protagonist is the one running the script:

 

IF
HaveSpell(3101)
THEN
RESPONSE #100
	DisplayStringHead(Myself,6620) // Cure Light Wounds
END

 

Apparently, the Spell() action can accept numerical values in the same way. For example, this block will make the protagonist use the Cure Light Wounds Bhaalpower on himself even if the appropriate entry is not found in SPELL.IDS:

 

IF
HaveSpell(3101)
THEN
RESPONSE #100
	Spell(Myself,3101)
END

 

Not sure whether this is widely known or not, but I thought it might be useful.

Link to comment

You can always replace the symbolic constants listed in the *.ids with a literal number.

That's not new.

The symbols are replaced by the external script compiler (weidu mostly) in case of .bcs files.

But the builtin compiler (for dialogue scripting) also copes with the numbers.

Link to comment

Heh, I knew about that, but what intrigued me was the possibility of using numerical values even if they are not present in the IDS files, as is the case in the abovementioned example.

 

To clarify, in the unmodded game there is no entry 3101 in SPELL.IDS yet the code I posted still works properly. :)

Link to comment

You never need IDS files outside compiling actions/triggers. The only use they have is for dialogues and some special rules (INSTANT.IDS and maybe ACTSLEEP.IDS) that the engine does something with. Everything else is designer convenience (WIZARD_MAGIC_MISSILE instead of 2112).

 

The engine knows how to handle the numbers (and really only cares about the numbers). If you have SPIN286.SPL in the override folder, 3286 will always work without ever requiring an update to SPELL.IDS (indeed, in the script, it will exist only as 3286 and the IDS file shouldn't ever be consulted by the game).

Link to comment

Archived

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

×
×
  • Create New...