Jump to content

HaveSpell() crashes


Recommended Posts

Finally got around to testing some of devSin's speculation regarding HaveSpell() crashes:


It is hard to tell because no information is dumped to the Text Box before the crash. I think when HaveSpell() or HaveSpellRES() go looking for a spell and find an innate reference with the incorrect level, the game first freezes as it tries to digest this inconsistency, and then the games CtDs when it can't resolve the issue internally.
If you ever look at a stack trace, you'll notice it running through trigger evaluation in the AI thread. Since the hard crash is so inconsistent here, my guess was that the crash occurs when the engine goes to walk through the memorized spells in the creature definition (I guess it would end up walking out in the weeds if it tried to read innate spell levels > 1 from the memorization table). It may be interesting to someday have somebody try patching in a table that has all 9 levels (0-8) for innate spells, but this might cause general crashes with normal spellcasting (if it works at all).


So, the basic idea was that if we add memorized information blocks for innates of levels 2-9, HaveSpell could work for innate spells whose level was not set to 1.


Sorry: with this modification, HaveSpell() still crashes.

Link to comment

Messed around with this a little :)


I think the spell memorization table itself crashes if the entry count isn't zero or seventeen -

COPY_EXISTING ~aerie7.cre~ ~override~
READ_LONG 0x02a8 "smo"
READ_LONG 0x02ac "smc"
PATCH_IF (("smo" > 0x2d3) AND ("smc" = 0x11)) THEN BEGIN
  PATCH_FOR_EACH "of1" IN 0x02a0 0x02b0 0x02b8 0x02bc 0x02c4 BEGIN
	READ_LONG "of1" "of2"
	WRITE_LONG "of1" (("of2" > "smo") ? ("of2" + 0xd0) : "of2")
  WRITE_LONG	0x02ac		 0x1e
  READ_LONG	("smo" + 0x068) "i2"
  INSERT_BYTES ("smo" + 0x070) 0x30 
  FOR ("i1" = 0x0; "i1" < 0x3; "i1" += 0x1) BEGIN
	WRITE_SHORT ("smo" + 0x070 + ("i1" * 0x10)) ("i1" + 0x7)
	WRITE_LONG  ("smo" + 0x078 + ("i1" * 0x10)) "i2"
  READ_LONG	("smo" + 0x128) "i2"
  INSERT_BYTES ("smo" + 0x130) 0x10
  WRITE_SHORT  ("smo" + 0x130) 0x9
  WRITE_SHORT  ("smo" + 0x136) 0x1
  WRITE_LONG   ("smo" + 0x138) "i2"
  READ_LONG	("smo" + 0x148) "i2"
  INSERT_BYTES ("smo" + 0x150) 0x90
  FOR ("i1" = 0x0; "i1" < 0x9; "i1" += 0x1) BEGIN
	WRITE_SHORT ("smo" + 0x150 + ("i1" * 0x10)) ("i1" + 0x1)
	WRITE_SHORT ("smo" + 0x156 + ("i1" * 0x10)) 0x2
	WRITE_LONG  ("smo" + 0x158 + ("i1" * 0x10)) "i2"


locked up bgmain on summoning.

Link to comment


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

  • Create New...