Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Axis & Allies 1942 Online is now available in Early Access! Buy it on Steam. The FAQ is available.
New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

[(BGEE, BG2) bug] Free action

CamDawgCamDawg Member, Developer Posts: 3,394
edited August 2012 in Fixed
Free action was capped at level 18 and had several other errors--it inexplicably protects against charm and the hold immunity was always applied to the caster, even if targeted at another creature.
// free action misc errors and missing lev 19, 20 headers
// all supplementary effects handled in effects batches below
COPY_EXISTING ~sppr403.spl~ ~override~
READ_LONG 0x64 "abil_off"
READ_SHORT 0x68 "abil_num"
READ_LONG 0x6a "fx_off"
SET "basedur" = 96
FOR (loops = abil_num; loops > 0; loops = loops - 0x01) BEGIN
READ_SHORT ("%abil_off%" + 0x1e + (0x28 * ("%loops%" - 1))) "abil_fx_num"
READ_SHORT ("%abil_off%" + 0x20 + (0x28 * ("%loops%" - 1))) "abil_fx_idx"
WHILE ("%abil_fx_num%" > 0) BEGIN // first fix existing effects
SET "abil_fx_num" = ("%abil_fx_num%" - 1)
READ_SHORT ("%fx_off%" + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) "opcode"
READ_LONG ("%fx_off%" + 0x08 + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) "immunity"
PATCH_IF (("%opcode%" = 101) AND ("%immunity%" = 5)) BEGIN // immunity to charm
WRITE_SHORT ("%fx_off%" + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) 126 // movementrate bonus
WRITE_LONG ("%fx_off%" + 0x04 + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) 100 // percentage
WRITE_LONG ("%fx_off%" + 0x08 + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) 2 // set to %
END
PATCH_IF (("%opcode%" = 101) AND ("%immunity%" = 185)) BEGIN // immunity to hold 2 shouldn't be there, also targeted at self
WRITE_SHORT ("%fx_off%" + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) 169 // prevent portait icon
WRITE_BYTE ("%fx_off%" + 0x02 + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) 2 // target: preset target
WRITE_LONG ("%fx_off%" + 0x08 + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%"))) 145 // grease
END
END
END
// read data from last ability
READ_SHORT ("%abil_off%" + 0x10 + (0x28 * ("%abil_num%" - 1))) "min_lev"
READ_SHORT ("%abil_off%" + 0x1e + (0x28 * ("%abil_num%" - 1))) "abil_fx_num"
READ_SHORT ("%abil_off%" + 0x20 + (0x28 * ("%abil_num%" - 1))) "abil_fx_idx"
SET "abil_insert" = ("%abil_off%" + (0x28 * "%abil_num%"))
PATCH_IF ("%min_lev%" < 20) BEGIN // if abilities don't go to lev 20
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
FOR ("index" = 20; "%index%" > "%min_lev%"; "index" = ("%index%" - 1)) BEGIN // now extend headers
INSERT_BYTES ("%fx_off%" + (0x30 * "%abil_fx_idx%")) ("%abil_fx_num%" * 0x30) // inserts bytes
WRITE_EVALUATED_ASCII ("%fx_off%" + (0x30 * "%abil_fx_idx%")) "%effects%" // clones existing effects
FOR ("index2" = 0; "%index2%" < "%abil_fx_num%"; "index2" = ("%index2%" + 1)) BEGIN // loop to adjust effects by min level
READ_LONG ("%fx_off%" + 0x0e + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%" + "%index2%"))) "duration"
PATCH_IF ("%duration%" > 5) BEGIN // longer than one round
WRITE_LONG ("%fx_off%" + 0x0e + (0x30 * ("%abil_fx_idx%" + "%abil_fx_num%" + "%index2%"))) (60 + (6 * "%index%")) // corrects duration
END
END
INSERT_BYTES ("%abil_insert%" ) 0x28 // inserts bytes
WRITE_EVALUATED_ASCII ("%abil_insert%" ) "%ability%" // clones existing ability
WRITE_SHORT ("%abil_insert%" + 0x10) "%index%" // minimum level
WRITE_SHORT ("%abil_insert%" + 0x1e) "%abil_fx_num%"
WRITE_SHORT ("%abil_insert%" + 0x20) ("%abil_fx_idx%" + ("%abil_fx_num%" * ("%index%" - "%min_lev%")))
SET "fx_off" = ("%fx_off%" + 0x28)
SET "abil_num" = ("%abil_num%" + 1)
END
WRITE_LONG 0x6a "%fx_off%"
WRITE_SHORT 0x68 "%abil_num%"
END

Post edited by Bhryaen on
AndreaColombo

Comments

Sign In or Register to comment.