Skip to content

[(BG2, BGEE) bug] Spell Shield duration (0824)

CamDawgCamDawg Member, Developer Posts: 3,438
edited September 2012 in Fixed
Spell Shield lacks headers, so it always lasted a static 48 rounds instead of 3 rds/level per its description:
// spell shield does not have listed durations due to missing ability headers
COPY_EXISTING ~spwi519.spl~ ~override~
READ_LONG 0x64 "abil_off"
READ_SHORT 0x68 "abil_num"
READ_LONG 0x6a "fx_off"
READ_SHORT 0x70 "fx_num"
FOR (index = 0 ; index < abil_num ; index = index + 1) BEGIN // first fix existing effects
READ_SHORT ("%abil_off%" + 0x10 + ("%index%" * 0x28)) "min_lev"
PATCH_IF ("%min_lev%" = 1) BEGIN
SET "min_lev" = 11
END
READ_SHORT ("%abil_off%" + 0x1e + ("%index%" * 0x28)) "abil_fx_num"
READ_SHORT ("%abil_off%" + 0x20 + ("%index%" * 0x28)) "abil_fx_idx"
FOR (index2 = 0 ; index2 < abil_fx_num ; index2 = index2 + 1) BEGIN
READ_LONG ("%fx_off%" + 0x0e + (0x30 * ("%abil_fx_idx%" + "%index2%"))) "duration"
PATCH_IF ("%duration%" > 5) BEGIN // longer than one round
WRITE_LONG ("%fx_off%" + 0x0d + (0x30 * ("%abil_fx_idx%" + "%index2%"))) 0 // no dispel/bypass resistance
WRITE_LONG ("%fx_off%" + 0x0e + (0x30 * ("%abil_fx_idx%" + "%index2%"))) (18 * "%min_lev%") // corrects duration
END
END
END
FOR (index3 = min_lev + 1 ; index3 < 21 ; index3 = index3 + 1) BEGIN
READ_ASCII ("%fx_off%" + (0x30 * "%abil_fx_idx%")) "effects" ("%abil_fx_num%" * 0x30) // reads whole block of effects from last ability
READ_ASCII ("%abil_off%" + (0x28 * ("%abil_num%" - 1))) "ability" (0x28) // reads last ability
SET "abil_fx_idx" = "%abil_fx_idx%" + "%abil_fx_num%"
INSERT_BYTES ("%fx_off%" + (0x30 * "%abil_fx_idx%")) ("%abil_fx_num%" * 0x30) // inserts bytes
WRITE_ASCIIE ("%fx_off%" + (0x30 * "%abil_fx_idx%")) "%effects%" // clones existing effects
FOR (index4 = 0 ; index4 < abil_fx_num ; index4 = index4 + 1) BEGIN // loop to adjust effects by min level
READ_LONG ("%fx_off%" + 0x0e + (0x30 * ("%abil_fx_idx%" + "%index4%"))) "duration"
PATCH_IF ("%duration%" > 5) BEGIN // longer than one round
WRITE_LONG ("%fx_off%" + 0x0e + (0x30 * ("%abil_fx_idx%" + "%index4%"))) (18 * "%index3%") // corrects duration
END
END
INSERT_BYTES ("%abil_off%" + ("%abil_num%" * 0x28)) 0x28 // inserts bytes
WRITE_ASCIIE ("%abil_off%" + ("%abil_num%" * 0x28)) "%ability%" // clones existing ability
WRITE_SHORT ("%abil_off%" + 0x10 + ("%abil_num%" * 0x28)) ("%index3%") // minimum level
WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_num%" * 0x28)) "%abil_fx_idx%"
SET "fx_off" = ("%fx_off%" + 0x28)
SET "abil_num" = ("%abil_num%" + 1)
END
WRITE_LONG 0x6a "%fx_off%"
WRITE_SHORT 0x68 "%abil_num%"
BUT_ONLY_IF_IT_CHANGES
Post edited by Bhryaen on

Comments

  • SethDavisSethDavis Member Posts: 1,812
    Potentially fixed - @CamDawg's fix has been applied
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    Confirmed fixed
  • BhryaenBhryaen Member Posts: 2,874
    Confirmed fixed:

    SPWI519's duration for Spell type deflection and Play sound (Effects #4,5) are as follows:
    SPWI519   Calculation          Duration
    LEVEL 1 3rd X 6sec X 11lvl = 198 sec
    LEVEL12 3rd X 6sec X 12lvl = 216 sec
    LEVEL13 3rd X 6sec X 13lvl = 234 sec
    LEVEL14 3rd X 6sec X 14lvl = 252 sec
    LEVEL15 3rd X 6sec X 15lvl = 270 sec
    LEVEL16 3rd X 6sec X 16lvl = 288 sec
    LEVEL17 3rd X 6sec X 17lvl = 306 sec
    LEVEL18 3rd X 6sec X 18lvl = 324 sec
    LEVEL19 3rd X 6sec X 19lvl = 342 sec
    LEVEL20 3rd X 6sec X 20lvl = 360 sec
Sign In or Register to comment.