Posted by: Andyr
« on: July 18, 2007, 07:28:00 PM »Added.
COPY_EXISTING ~DRSHNL01.CRE~ ~override/DRSHNL01.CRE~ /* Nilthiri */
WRITE_ASCII ~0x248~ ~DRSHNL01~ /* Assigns the appropriate script */
WRITE_LONG ~0x250~ 0x00000000
EXTEND_TOP ~DRSHNL01.bcs~ ~ub/misc/u!nilthi.baf~ /* Fixes Nilthiri's script */
COMPILE ~ub/misc/DRSHNL02.baf~
ACTION_IF NOT FILE_EXISTS_IN_GAME ~cdbehbla.pro~ THEN BEGIN // if Fixpack isn't installed
// restore Nith's attack script, pt 1: false() out stuff that'll break
COPY_EXISTING ~drshnl01.bcs~ ~override~
DECOMPILE_BCS_TO_BAF
REPLACE_TEXTUALLY ~HPLT(Myself,10)~ ~False()~
COMPILE_BAF_TO_BCS
BUT_ONLY_IF_IT_CHANGES
// new troll scripts to transform to dead versions at low HP
COPY_EXISTING ~troll01.bcs~ ~override/drshnl02.bcs~
DECOMPILE_BCS_TO_BAF
REPLACE_TEXTUALLY ~ChangeAnimationNoEffect("TROLL02")~ ~ChangeAnimationNoEffect("%DEST_RES%")~
COMPILE_BAF_TO_BCS
// new troll scripts to transform from dead to alive after time expires
COPY_EXISTING ~troll02.bcs~ ~override/drshnl03.bcs~
DECOMPILE_BCS_TO_BAF
REPLACE_TEXTUALLY ~ReallyForceSpell(Myself,TROLL_CHANGE)~ ~ReallyForceSpellRES("%DEST_RES%",Myself)~
COMPILE_BAF_TO_BCS
// create 'dead' or 'knocked down' versions of 'special' trolls
COPY_EXISTING ~drshnl01.cre~ ~override/drshnl02.cre~
WRITE_SHORT 0x24 1 // current HP
WRITE_SHORT 0x46 10 // natural AC
WRITE_SHORT 0x48 10 // effective AC
WRITE_BYTE 0x5a 100 // resist cold
WRITE_BYTE 0x5b 100 // resist electricity
WRITE_BYTE 0x5f 100 // resist magic cold
WRITE_BYTE 0x60 100 // resist slashing
WRITE_BYTE 0x61 100 // resist crushing
WRITE_BYTE 0x62 100 // resist piercing
WRITE_BYTE 0x63 100 // resist missile
WRITE_BYTE 0x23c 9 // dexterity
WRITE_BYTE 0x270 255 // enemy
WRITE_ASCII 0x248 ~drshnl03~
WRITE_ASCII 0x250 ~~ #32 // blanks all other script references
// item changes
READ_LONG 0x2bc "itm_off"
READ_LONG 0x2c0 "itm_num"
FOR (index = 0 ; index < itm_num ; index = index + 1) BEGIN
READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item"
PATCH_IF (
("%item%" STRING_COMPARE_CASE "monhp1" = 0) OR // so they can die
("%item%" STRING_COMPARE_CASE "trollreg" = 0) OR // can't regenerate
("%item%" STRING_COMPARE_CASE "trollspi" = 0) // makes dead spirit troll invisible
) BEGIN
WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) ~trolldie~
END
END
// add monhp1 item to trolls to prevent death; assign script to force transformation to dead form at low HP
COPY_EXISTING ~drshnl01.cre~ ~override~
ADD_CRE_ITEM ~monhp1~ #0 #0 #0 ~NONE~ ~AMULET~
WRITE_ASCII 0x248 ~drshnl02~
WRITE_ASCII 0x258 ~drshnl01~ // restore Nith's attack script, pt 2: assign script
// one-off change for Nilthiri to prevent repeating dialogue after regenerating
COPY_EXISTING ~drshnl01.cre~ ~override/drshnl03.cre~
WRITE_ASCII 0x250 ~~ #8 // no approach and speak script
WRITE_BYTE 0x270 255 // enemy
WRITE_ASCII 0x2cc ~~ #8 // no dialogue file
// spells to transform trolls back from dead to alive
COPY_EXISTING ~spin955.spl~ ~override/drshnl03.spl~
READ_LONG 0x64 "abil_off"
READ_SHORT 0x68 "abil_num"
READ_LONG 0x6a "fx_off"
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"
FOR (index2 = 0 ; index2 < abil_fx_num ; index2 = index2 + 1) BEGIN
READ_SHORT ("%fx_off%" + (("%abil_fx_idx%" + "%index2%") * 0x30)) "opcode"
READ_ASCII ("%fx_off%" + 0x14 + (("%abil_fx_idx%" + "%index2%") * 0x30)) "eff_file"
PATCH_IF (("%opcode%" = 151) AND ("%eff_file%" STRING_COMPARE_CASE "troll01" = 0)) BEGIN
WRITE_EVALUATED_ASCII ("%fx_off%" + 0x14 + (("%abil_fx_idx%" + "%index2%") * 0x30)) "%DEST_RES%" #8
END
END
END
END