Jump to content

[BUG] - Triggering an Incendiary Cloud trap crashes the game


aVENGER_(RR)

Recommended Posts

Basically, every time an Incendiary Cloud is triggered by a trap (GT016.BCS) it crashes the game. The problem seems to be caused by a small modification which SCSII makes to this spell in order to improve the AI's cloud detection capabilities (Use EFF file: DW#INCEN.EFF). As soon as this effect is removed from the SPL file, the trap functions normally once again.

 

BTW, this bug is easily reproducible on a clean install + G3 BG2 Fixpack 6.1 + SCSII v8. For a quick demonstration, go to the top level of the Guarded Compound (AR0907), unlock Container 6 at [450.1260] and then open it without disarming the trap.

Link to comment

.spl files behave wierdly if the caster is not a .cre. That is, some opcodes crash because the caster is not a .cre. I have written a workaround macro that patches traps so they create an invisible .cre ("LC_GT001.cre") that triggers the spell onto the nearest living actor.

 

The only downside is the nearest living actor not always being the LastTrigger() if there are a lot of actors near the container (ie animated skeletons guarding Edwin). But I would not lose sleep over this, and would give bodyguards a new twist.

 

-Galactygon

 

// This action macro changes the way traps function by summoning an external creature to cast the trapped spell instead
// of the trap itself casting the spell. This serves to fix the crash that is caused when many of the new spells are cast
// by something else than a .cre. Many of the spells in SpellPack are assembled using subspells and invisible creatures,
// and many of those opcodes simply crash when something else other than a .cre casts it.

DEFINE_ACTION_MACRO ~FIX_TRAPS~ BEGIN

// adding all ToB actions to action.ids unless already present
APPEND ~ACTION.IDS~ ~31 SpellRES(S:RES*,O:Target*)~
		 UNLESS ~31 SpellRES(S:RES\*,O:Target\*)~
APPEND ~ACTION.IDS~ ~95 SpellPointRES(S:RES*,P:Target*)~
		 UNLESS ~95 SpellPointRES(S:RES\*,P:Target\*)~
APPEND ~ACTION.IDS~ ~113 ForceSpellRES(S:RES*,O:Target)~
		 UNLESS ~113 ForceSpellRES(S:RES\*,O:Target)~
APPEND ~ACTION.IDS~ ~114 ForceSpellPointRES(S:RES*,P:Target)~
		 UNLESS ~114 ForceSpellPointRES(S:RES\*,P:Target)~
APPEND ~ACTION.IDS~ ~147 RemoveSpellRES(S:Spell*)~
		 UNLESS ~147 RemoveSpellRES(S:Spell\*)~
APPEND ~ACTION.IDS~ ~160 ApplySpellRES(S:RES*,O:Target)~
		 UNLESS ~160 ApplySpellRES(S:RES\*,O:Target)~
APPEND ~ACTION.IDS~ ~181 ReallyForceSpellRES(S:RES*,O:Target)~
		 UNLESS ~181 ReallyForceSpellRES(S:RES\*,O:Target)~
APPEND ~ACTION.IDS~ ~191 SpellNoDecRES(S:RES*,O:Target*)~
		 UNLESS ~191 SpellNoDecRES(S:RES\*,O:Target\*)~
APPEND ~ACTION.IDS~ ~192 SpellPointNoDecRES(S:RES*,P:Target*)~
		 UNLESS ~192 SpellPointNoDecRES(S:RES\*,P:Target\*)~
APPEND ~ACTION.IDS~ ~240 ReallyForceSpellDeadRES(S:RES*,O:Target)~
		 UNLESS ~240 ReallyForceSpellDeadRES(S:RES\*,O:Target)~
APPEND ~ACTION.IDS~ ~318 ForceSpellRangeRES(S:RES*,O:Target)~
		 UNLESS ~318 ForceSpellRangeRES(S:RES\*,O:Target)~
APPEND ~ACTION.IDS~ ~319 ForceSpellPointRangeRES(S:RES*,P:Target)~
		 UNLESS ~319 ForceSpellPointRangeRES(S:RES\*,P:Target)~
APPEND ~ACTION.IDS~ ~337 ReallyForceSpellPointRES(S:RES*,P:Target*)~
		 UNLESS ~337 ReallyForceSpellPointRES(S:RES\*,P:Target\*)~

// additional ToB triggers for SoA
APPEND ~TRIGGER.IDS~ ~0x00A1 SpellCastOnMeRES(S:Spell*,O:Caster*)~
		  UNLESS ~0x00A1 SpellCastOnMeRES(S:Spell\*,O:Caster\*)~
APPEND ~TRIGGER.IDS~ ~0x0091 SpellCastRES(S:Spell*,O:Object*)~
		  UNLESS ~0x0091 SpellCastRES(S:Spell\*,O:Object\*)~
APPEND ~TRIGGER.IDS~ ~0x00A6 SpellCastPriestRES(S:Spell*,O:Object*)~
		  UNLESS ~0x00A6 SpellCastPriestRES(S:Spell\*,O:Object\*)~
APPEND ~TRIGGER.IDS~ ~0x00A7 SpellCastInnateRES(S:Spell*,O:Object*)~
		  UNLESS ~0x00A7 SpellCastInnateRES(S:Spell\*,O:Object\*)~
APPEND ~TRIGGER.IDS~ ~0x4031 HaveSpellRES(S:Spell*)~
		  UNLESS ~0x4031 HaveSpellRES(S:Spell\*)~
APPEND ~TRIGGER.IDS~ ~0x40D5 ActuallyInCombat()~
		  UNLESS ~0x40D5 ActuallyInCombat()~

COPY_EXISTING_REGEXP GLOB ~^.+\.bcs$~ ~override~
PATCH_SILENT // Some of the scripts might be bugged, but the scripts we are looking for are not.
PATCH_IF (SOURCE_SIZE > 0) THEN BEGIN // protects against invalid files
	DECOMPILE_BCS_TO_BAF
REPLACE_TEXTUALLY ~Displaystring(Lasttrigger,14381)
Forcespell(Lasttrigger,\(.*\))~
~Displaystring(Lasttrigger,14381)
CreateCreatureObject("LC_GT001",Myself,0,0,0)
ActionOverride("LC_GT001",ReallyForcespell(SecondNearest,\1))~
	REPLACE_TEXTUALLY
  ~Displaystring(Lasttrigger,14381)
Forcespell(Lasttrigger,\(.*\))~
				~Displaystring(Lasttrigger,14381)
				 CreateCreatureObject("LC_GT001",Myself,0,0,0)
				 ActionOverride("LC_GT001",ReallyForcespell(SecondNearest,\1))~
	REPLACE_TEXTUALLY
  ~Displaystring(Lasttrigger,14381)
ReallyForcespell(Lasttrigger,\(.*\))~
				~Displaystring(Lasttrigger,14381)
				 CreateCreatureObject("LC_GT001",Myself,0,0,0)
				 ActionOverride("LC_GT001",ReallyForcespell(SecondNearest,\1))~
	REPLACE_TEXTUALLY
  ~Displaystring(Lasttrigger,14381)
Forcespellres(\(.*\),Lasttrigger)~
				~Displaystring(Lasttrigger,14381)
				 CreateCreatureObject("LC_GT001",Myself,0,0,0)
				 ActionOverride("LC_GT001",ReallyForcespellRES(\1,SecondNearest)~
	REPLACE_TEXTUALLY
  ~Displaystring(Lasttrigger,14381)
ReallyForcespellres(\(.*\),Lasttrigger)~
				~Displaystring(Lasttrigger,14381)
				 CreateCreatureObject("LC_GT001",Myself,0,0,0)
				 ActionOverride("LC_GT001",ReallyForcespellRES(\1,SecondNearest)~
	COMPILE_BAF_TO_BCS
END
PATCH_VERBOSE
BUT_ONLY_IF_IT_CHANGES

END

Link to comment

Archived

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

×
×
  • Create New...