Jump to content

Trap cap removal


Ardanis

Recommended Posts

As it turned out, in order to prevent setting more than 7 snares the engine checks for amount of active trap's projectiles (trapboom, trapsnar, trapspik and traptime).

 

As for undelayed explosion of skull traps and such I always found these spells to be unsuitable for tactical use because a creature can run past them in no time and avoid triggering a trap.

 

A piece of my code

//unlimited traps

BEGIN ~Trap cap removal~

COPY_EXISTING ~trapboom.pro~ ~override/ag#boom.pro~
COPY_EXISTING ~trapsnar.pro~ ~override/ag#snar.pro~
COPY_EXISTING ~trapspik.pro~ ~override/ag#spik.pro~
COPY_EXISTING ~traptime.pro~ ~override/ag#time.pro~

ADD_PROJECTILE ~override/ag#boom.pro~
ADD_PROJECTILE ~override/ag#snar.pro~
ADD_PROJECTILE ~override/ag#spik.pro~
ADD_PROJECTILE ~override/ag#time.pro~

COPY_EXISTING ~spcl411.spl~ ~override~
		  ~spcl415.spl~ ~override~
 READ_LONG  0x64 ab_off
 READ_SHORT 0x68 ab_num
 FOR(i=0; i<ab_num; i+=1) BEGIN
WRITE_SHORT (ab_off+i*0x28+0x26) ag#snar
 END

COPY_EXISTING ~spcl910b.spl~ ~override~
 WRITE_SHORT 0x98 ag#spik

COPY_EXISTING ~spcl911b.spl~ ~override~
 WRITE_SHORT 0x98 ag#boom

COPY_EXISTING ~spcl912b.spl~ ~override~
 WRITE_SHORT 0x98 ag#time

//magical traps delay

BEGIN ~Magical traps spring without delay~

COPY_EXISTING ~dfirebl.pro~ ~override~
		  ~trapglyp.pro~ ~override~
		  ~trapskul.pro~ ~override~
WRITE_SHORT 0x210 1

Link to comment

There is a thing I've forgotten about - iceglyp.pro which is being used by Symbols (Death, Stun, Fear):

 

BEGIN ~Magical traps spring without delay~

 

COPY_EXISTING ~dfirebl.pro~ ~override~

~trapglyp.pro~ ~override~

~trapskul.pro~ ~override~

~iceglyp.pro~ ~override~

WRITE_SHORT 0x210 1

Link to comment

Provided that Tweaks is installed after RR it'll be fine. If you want to make it install-order independent, you can replace the current COPY of spcl415 in RR with this:

 

// trap cap removal from BG2 Tweaks
ACTION_IF FILE_EXISTS_IN_GAME ~cdt02320.g3~ THEN BEGIN

 // find new projectile reference
 COPY_EXISTING ~projectl.ids~ ~override~
COUNT_2DA_ROWS ~2~ "rows"
FOR ( index = (rows - 1); index > 0; index = index - 1 ) BEGIN
  READ_2DA_ENTRY "%index%" 1 2 "proj"
  PATCH_IF ("%proj%" STRING_COMPARE_CASE "ag#snar" = 0) BEGIN
	READ_2DA_ENTRY "%index%" 0 2 "cdt"
	SET "ag#snar" = "%cdt%" + 1
	SET "index" = 0 // kills loop
  END
END
BUT_ONLY_IF_IT_CHANGES

 COPY ~RR/RR_CORE/Spells/SPCL415.SPL~ ~override~
READ_LONG  0x64 ab_off
READ_SHORT 0x68 ab_num
FOR(i=0; i<ab_num; i+=1) BEGIN
  WRITE_SHORT (ab_off+i*0x28+0x26) ag#snar
END
BUT_ONLY_IF_IT_CHANGES

END ELSE BEGIN

 COPY ~RR/RR_CORE/Spells/SPCL415.SPL~ ~override~

END

Link to comment

Archived

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

×
×
  • Create New...