Jump to content

Imprisoned Summons Bug


CamDawg

Recommended Posts

If summons are imprisoned, they count against the summoning cap forever. Fixed by changing the gender of imprisoned summons to a new value, IMPRISONED_SUMMONED (66), when imprisoned and then back to SUMMONED (6) when freed.

 

APPEND ~gender.ids~ ~66 IMPRISONED_SUMMONED~ UNLESS ~^66 ~
COPY ~bg2fixpack/copy/cdwi917a.spl~ ~override~
 ~bg2fixpack/copy/cdwi910.eff~  ~override~
COPY_EXISTING ~cdwi910.eff~ ~override/cdwi917a.eff~
 WRITE_LONG 0x1c 6 //summoned

COPY_EXISTING ~spin580.spl~ ~override~
		  ~spin626.spl~ ~override~
		  ~spin788.spl~ ~override~
		  ~spwi910.spl~ ~override~
 READ_LONG  0x64 "abil_off" ELSE 0
 READ_SHORT 0x68 "abil_num" ELSE 0
 READ_LONG  0x6a "fx_off"   ELSE 0
 SET "delta" = 0
 FOR (index = 0; index < abil_num; index = index + 1) BEGIN
READ_SHORT ("%abil_off%" + 0x1e + (0x28 * "%index%")) "abil_fx_num"
READ_SHORT ("%abil_off%" + 0x20 + (0x28 * "%index%")) "abil_fx_idx"
SET "abil_fx_idx" = ("%abil_fx_idx%" + "%delta%")
WRITE_SHORT ("%abil_off%" + 0x20 + (0x28 * "%index%")) "%abil_fx_idx%"
FOR (index2 = 0; index2 < abil_fx_num; index2 = index2 + 1) BEGIN
  READ_SHORT ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) "opcode"
  PATCH_IF ("%opcode%" = 211) BEGIN // imprisonment
	READ_ASCII ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) "clone" (48) // grab entire fx
	INSERT_BYTES			("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) 0x30		  // new effect
	  WRITE_EVALUATED_ASCII ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) "%clone%" #48 // clones imprisonment effect
	  WRITE_SHORT		   ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) 177		   // use eff file
	  WRITE_LONG			("%fx_off%" + 0x04 + (0x30 * ("%abil_fx_idx%" + "%index2%")))   6		   // summoned (6)...
	  WRITE_LONG			("%fx_off%" + 0x08 + (0x30 * ("%abil_fx_idx%" + "%index2%")))   7		   // from gender.ids
	  WRITE_ASCII		   ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_idx%" + "%index2%"))) ~cdwi910~ #8  // eff resref
	SET "delta" = "%delta%" + 1
	SET "abil_fx_num" = "%abil_fx_num%" + 1
	SET "index2" = "%index2%" + 1
  END
END
WRITE_SHORT ("%abil_off%" + 0x1e + (0x28 * "%index%")) "%abil_fx_num%"
 END
 BUT_ONLY_IF_IT_CHANGES

COPY_EXISTING ~spwi917.spl~ ~override~
 READ_LONG  0x64 "abil_off" ELSE 0
 READ_SHORT 0x68 "abil_num" ELSE 0
 READ_LONG  0x6a "fx_off"   ELSE 0
 SET "delta" = 0
 FOR (index = 0; index < abil_num; index = index + 1) BEGIN
READ_SHORT ("%abil_off%" + 0x1e + (0x28 * "%index%")) "abil_fx_num"
READ_SHORT ("%abil_off%" + 0x20 + (0x28 * "%index%")) "abil_fx_idx"
SET "abil_fx_idx" = ("%abil_fx_idx%" + "%delta%")
WRITE_SHORT ("%abil_off%" + 0x20 + (0x28 * "%index%")) "%abil_fx_idx%"
FOR (index2 = 0; index2 < abil_fx_num; index2 = index2 + 1) BEGIN
  READ_SHORT ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) "opcode"
  PATCH_IF ("%opcode%" = 212) BEGIN // imprisonment
	SET "index2" = "%index2%" + 1 // make extra spellcast after freedom effect
	INSERT_BYTES  ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) 0x30 // new effect
	  WRITE_SHORT ("%fx_off%" +		(0x30 * ("%abil_fx_idx%" + "%index2%"))) 146 // cast spell
	  WRITE_BYTE  ("%fx_off%" + 0x02 + (0x30 * ("%abil_fx_idx%" + "%index2%")))   1 // target self
	  WRITE_LONG  ("%fx_off%" + 0x04 + (0x30 * ("%abil_fx_idx%" + "%index2%")))   0 // cast at level
	  WRITE_LONG  ("%fx_off%" + 0x08 + (0x30 * ("%abil_fx_idx%" + "%index2%")))   1 // cast instantly
	  WRITE_BYTE  ("%fx_off%" + 0x0c + (0x30 * ("%abil_fx_idx%" + "%index2%")))   4 // delay/permanent
	  WRITE_LONG  ("%fx_off%" + 0x0e + (0x30 * ("%abil_fx_idx%" + "%index2%")))   2 // 2 second delay
	  WRITE_BYTE  ("%fx_off%" + 0x12 + (0x30 * ("%abil_fx_idx%" + "%index2%"))) 100 // probability
	  WRITE_ASCII ("%fx_off%" + 0x14 + (0x30 * ("%abil_fx_idx%" + "%index2%"))) ~cdwi917a~ #8 // spell
	SET "delta" = "%delta%" + 1
	SET "abil_fx_num" = "%abil_fx_num%" + 1
  END
END
WRITE_SHORT ("%abil_off%" + 0x1e + (0x28 * "%index%")) "%abil_fx_num%"
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment

Archived

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

×
×
  • Create New...