Skip to content

[(BG2, BGEE) Bug] Cavalier resist fear vs. magic resistance (0813)

CamDawgCamDawg Member, Developer Posts: 3,438
edited August 2012 in Fixed
Currently the cavalier's innate resist fear ability is subject to magic resistance, causing it to occasionally fail. The magic resistance check should be removed:
// cavalier resist fear
COPY_EXISTING ~spcl222.spl~ ~override~
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_BYTE ("%abil_off%" + (0x28 * "%index%")) "type"
PATCH_IF ("%type%" = 1) BEGIN // melee
READ_SHORT ("%abil_off%" + 0x1e + (0x28 * "%abil_num%")) "abil_fx_num"
READ_SHORT ("%abil_off%" + 0x20 + (0x28 * "%abil_num%")) "abil_fx_idx"
FOR (index2 = 0 ; index2 < abil_fx_num ; index2 = index2 + 1) BEGIN
WRITE_BYTE ("%fx_off%" + 0x0d + (0x30 * ("%abil_fx_idx%" + "%index2%"))) 3 // dispel/bypass MR
END
END
END
BUT_ONLY_IF_IT_CHANGES
Post edited by Bhryaen on

Comments

  • CorianderCoriander Member Posts: 1,667
    I'll do this.
  • NathanNathan Member Posts: 1,007
    This has been integrated and should be present in the next build.
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    @CamDawg, @Coriander: Not fixed.
    This didn't make it into the update? I see some magic resistance flags set to 1 and some set to 3.
    Remove fear/morale penalties, for example.
    Some have been fixed, i don't understand the difference.
  • CorianderCoriander Member Posts: 1,667
    The code is definitely in.
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    edited August 2012
    Here is the full hexdump of spcl222, any lines with resistance = 1 would be a problem

    0000h Signature SPL V1
    0008h UnID name 00003268
    000ch ID name 0098967f
    0010h Completion CAS_P02
    0018h Attributes 00000000
    001ch Spelltype 0004
    001eh Usability 00000000
    0022h Casting glow 000c
    0024h UNKNOWN 00
    0025h School type 0001
    0027h Sec. type 0d
    0028h *Multiplier 00000000
    002ch *Modifier 00000000
    0030h UNKNOWN 00000000
    0034h Level 00000001
    0038h UNKNOWN 0001
    003ah Book icon SPCL222C
    0042h UNKNOWN 0000
    0044h UNKNOWN
    004ch UNKNOWN 00000000
    0050h UnID desc ffffffff
    0054h ID desc 0098967f
    0058h UNKNOWN
    0060h UNKNOWN 00000000
    0064h Ext. offset 00000072
    0068h Ext. count 0001
    006ah Feat. offset 0000009a
    006eh CFB offset 0000
    0070h CFB count 0000
    0072h Ext. head 1
    0072h Spelltype 01
    0073h PST Friendly 00
    0074h Use location 0004
    0076h Use icon SPCL222B
    007eh Target type 04
    007fh Target # 00
    0080h Range 001e
    0082h Level req. 0001
    0084h Speed 0001
    0086h UNKNOWN 0000
    0088h UNKNOWN 0006
    008ah UNKNOWN 0000
    008ch UNKNOWN 0000
    008eh UNKNOWN 0001
    0090h Feat. count 000f
    0092h Feat. offset 0000
    0094h UNKNOWN 0001
    0096h UNKNOWN 0001
    0098h Projectile 00a8
    009ah Feat block 1
    009ah Opcode 0017
    009ch Target type 02
    009dh Power 01
    009eh Parameter 1 00000000
    00a2h Parameter 2 00000000
    00a6h Timing method 01
    00a7h Resistance 01
    00a8h Duration 00000000
    00ach Max. prob. 64
    00adh Min. prob. 00
    00aeh Resource
    00b6h Min level 00000000
    00bah Max level 00000000
    00beh S. throw type 00000000
    00c2h S. throw bonus 00000000
    00c6h UNKNOWN 00000000
    00cah Feat block 2
    00cah Opcode 008d
    00cch Target type 02
    00cdh Power 01
    00ceh Parameter 1 00000000
    00d2h Parameter 2 0000000e
    00d6h Timing method 01
    00d7h Resistance 01
    00d8h Duration 00000000
    00dch Max. prob. 64
    00ddh Min. prob. 00
    00deh Resource
    00e6h Min level 00000000
    00eah Max level 00000000
    00eeh S. throw type 00000000
    00f2h S. throw bonus 00000000
    00f6h UNKNOWN 00000000
    00fah Feat block 3
    00fah Opcode 00a1
    00fch Target type 02
    00fdh Power 01
    00feh Parameter 1 00000000
    0102h Parameter 2 00000000
    0106h Timing method 01
    0107h Resistance 01
    0108h Duration 00000000
    010ch Max. prob. 64
    010dh Min. prob. 00
    010eh Resource
    0116h Min level 00000000
    011ah Max level 00000000
    011eh S. throw type 00000000
    0122h S. throw bonus 00000000
    0126h UNKNOWN 00000000
    012ah Feat block 4
    012ah Opcode 0065
    012ch Target type 02
    012dh Power 01
    012eh Parameter 1 00000000
    0132h Parameter 2 00000018
    0136h Timing method 00
    0137h Resistance 01
    0138h Duration 0000012c
    013ch Max. prob. 64
    013dh Min. prob. 00
    013eh Resource
    0146h Min level 00000000
    014ah Max level 00000000
    014eh S. throw type 00000000
    0152h S. throw bonus 00000000
    0156h UNKNOWN 00000000
    015ah Feat block 5
    015ah Opcode 0032
    015ch Target type 02
    015dh Power 01
    015eh Parameter 1 21600000
    0162h Parameter 2 000f0000
    0166h Timing method 00
    0167h Resistance 01
    0168h Duration 00000001
    016ch Max. prob. 64
    016dh Min. prob. 00
    016eh Resource
    0176h Min level 00000000
    017ah Max level 00000000
    017eh S. throw type 00000000
    0182h S. throw bonus 00000000
    0186h UNKNOWN 00000000
    018ah Feat block 6
    018ah Opcode 008e
    018ch Target type 02
    018dh Power 01
    018eh Parameter 1 00000000
    0192h Parameter 2 00000025
    0196h Timing method 00
    0197h Resistance 01
    0198h Duration 0000012c
    019ch Max. prob. 64
    019dh Min. prob. 00
    019eh Resource
    01a6h Min level 00000000
    01aah Max level 00000000
    01aeh S. throw type 00000000
    01b2h S. throw bonus 00000000
    01b6h UNKNOWN 00000000
    01bah Feat block 7
    01bah Opcode 00ae
    01bch Target type 02
    01bdh Power 01
    01beh Parameter 1 00000000
    01c2h Parameter 2 00000000
    01c6h Timing method 00
    01c7h Resistance 01
    01c8h Duration 00000000
    01cch Max. prob. 64
    01cdh Min. prob. 00
    01ceh Resource EFF_P01
    01d6h Min level 00000000
    01dah Max level 00000000
    01deh S. throw type 00000000
    01e2h S. throw bonus 00000000
    01e6h UNKNOWN 00000000
    01eah Feat block 8
    01eah Opcode 00ae
    01ech Target type 02
    01edh Power 01
    01eeh Parameter 1 00000000
    01f2h Parameter 2 00000000
    01f6h Timing method 04
    01f7h Resistance 01
    01f8h Duration 0000012c
    01fch Max. prob. 64
    01fdh Min. prob. 00
    01feh Resource EFF_M11A
    0206h Min level 00000000
    020ah Max level 00000000
    020eh S. throw type 00000000
    0212h S. throw bonus 00000000
    0216h UNKNOWN 00000000
    021ah Feat block 9
    021ah Opcode 010b
    021ch Target type 02
    021dh Power 01
    021eh Parameter 1 000036b7
    0222h Parameter 2 00000000
    0226h Timing method 00
    0227h Resistance 03
    0228h Duration 0000012c
    022ch Max. prob. 64
    022dh Min. prob. 00
    022eh Resource
    0236h Min level 00000000
    023ah Max level 00000000
    023eh S. throw type 00000000
    0242h S. throw bonus 00000000
    0246h UNKNOWN 00000000
    024ah Feat block 10
    024ah Opcode 010b
    024ch Target type 02
    024dh Power 01
    024eh Parameter 1 00004413
    0252h Parameter 2 00000000
    0256h Timing method 00
    0257h Resistance 03
    0258h Duration 0000012c
    025ch Max. prob. 64
    025dh Min. prob. 00
    025eh Resource
    0266h Min level 00000000
    026ah Max level 00000000
    026eh S. throw type 00000000
    0272h S. throw bonus 00000000
    0276h UNKNOWN 00000000
    027ah Feat block 11
    027ah Opcode 00f0
    027ch Target type 02
    027dh Power 01
    027eh Parameter 1 00000000
    0282h Parameter 2 00000024
    0286h Timing method 01
    0287h Resistance 03
    0288h Duration 00000000
    028ch Max. prob. 64
    028dh Min. prob. 00
    028eh Resource
    0296h Min level 00000000
    029ah Max level 00000000
    029eh S. throw type 00000000
    02a2h S. throw bonus 00000000
    02a6h UNKNOWN 00000000
    02aah Feat block 12
    02aah Opcode 00a9
    02ach Target type 02
    02adh Power 01
    02aeh Parameter 1 00000000
    02b2h Parameter 2 00000024
    02b6h Timing method 00
    02b7h Resistance 03
    02b8h Duration 0000012c
    02bch Max. prob. 64
    02bdh Min. prob. 00
    02beh Resource
    02c6h Min level 00000000
    02cah Max level 00000000
    02ceh S. throw type 00000000
    02d2h S. throw bonus 00000000
    02d6h UNKNOWN 00000000
    02dah Feat block 13
    02dah Opcode 006a
    02dch Target type 02
    02ddh Power 01
    02deh Parameter 1 00000001
    02e2h Parameter 2 00000001
    02e6h Timing method 00
    02e7h Resistance 03
    02e8h Duration 0000012c
    02ech Max. prob. 64
    02edh Min. prob. 00
    02eeh Resource
    02f6h Min level 00000000
    02fah Max level 00000000
    02feh S. throw type 00000000
    0302h S. throw bonus 00000000
    0306h UNKNOWN 00000000
    030ah Feat block 14
    030ah Opcode 0065
    030ch Target type 02
    030dh Power 01
    030eh Parameter 1 00000000
    0312h Parameter 2 0000006a
    0316h Timing method 00
    0317h Resistance 03
    0318h Duration 0000012c
    031ch Max. prob. 64
    031dh Min. prob. 00
    031eh Resource
    0326h Min level 00000000
    032ah Max level 00000000
    032eh S. throw type 00000000
    0332h S. throw bonus 00000000
    0336h UNKNOWN 00000000
    033ah Feat block 15
    033ah Opcode 0065
    033ch Target type 02
    033dh Power 01
    033eh Parameter 1 00000000
    0342h Parameter 2 00000017
    0346h Timing method 00
    0347h Resistance 03
    0348h Duration 0000012c
    034ch Max. prob. 64
    034dh Min. prob. 00
    034eh Resource
    0356h Min level 00000000
    035ah Max level 00000000
    035eh S. throw type 00000000
    0362h S. throw bonus 00000000
    0366h UNKNOWN 00000000


    Any Betazoid can check their file in an editor?
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    @CamDawg i don't like this line in the script: PATCH_IF ("%type%" = 1) BEGIN // melee
    Doesn't really make sense in a spell where you want to update all effects.
    So, i'm pretty sure @Coriander is right about the code is in their tp2 pack, but it isn't working correctly.
  • CamDawgCamDawg Member, Developer Posts: 3,438
    Nah, it's another bug--I'm using index to increment the first loop and then using the static abil_num to find the offsets within the loop. The fixed (and verified as working) code:
    // cavalier resist fear
    COPY_EXISTING ~spcl222.spl~ ~override~
    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%" + (0x28 * "%index%")) "type"
    PATCH_IF ("%type%" = 1) BEGIN // melee
    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
    WRITE_BYTE ("%fx_off%" + 0x0d + (0x30 * ("%abil_fx_idx%" + "%index2%"))) 3 // dispel/bypass MR
    END
    END
    END
    BUT_ONLY_IF_IT_CHANGES
    ...and sorry, I've really been checking this code before posting, I'm not sure how this slipped in.
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    Ahh, ok. Reading this code isn't easy. At least the problem was caught, it really needs multiple eyes to catch all bugs.
  • WispWisp Member Posts: 1,102
    Plug for GET_OFFSET_ARRAY. Abstract your problems away!
  • TanthalasTanthalas Member Posts: 6,738
    I think I'll move this to Confirmed Not Fixed and I'll drop some names so the extra code that @CamDawg provided is added.

    @Nathan, @Coriander
    Pretty please?
  • NathanNathan Member Posts: 1,007
    edited August 2012
    @Tanthalas, Thanks for name-droppin. I've replaced the code as specified and this should be in the next build. I've said it before but I'll say it again, thanks for all your hard work everyone. You guys rock.
  • TanthalasTanthalas Member Posts: 6,738
    Confirmed Fixed in Build 0815

    Recruited Tethoril and Viconia (gave her a potion of magic protection that bumped her magic resistance to 100) and cast Remove fear on them. The spell took effect.
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    Confirmed fixed, Viconia doesn't resist helpful hands, but keeps her secret.
Sign In or Register to comment.