Skip to content

[SoD] Patching BDLEAT05.ITM

AndreaColomboAndreaColombo Member Posts: 5,524
I'm trying to patch BDLEAT05.ITM (the Dragonscale Armor in Siege of Dragonspear) to make its in-game colors better match its icon. The code I'm using is part of a much broader mod component that changes color offsets for most items in the game; every other item I'm patching is changing accordingly except BDLEAT05.ITM, which remains systematically untouched for reasons I cannot fathom.

My code:

ACTION_IF (FILE_EXISTS_IN_GAME ~bdleat05.itm~) THEN BEGIN COPY_EXISTING ~bdleat05.itm~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN LAUNCH_PATCH_MACRO ~clear~ SET gradient = 142 // colour index SET location = ablue // location LAUNCH_PATCH_MACRO ~colour~ SET gradient = 142 // colour index SET location = ared // location LAUNCH_PATCH_MACRO ~colour~ END BUT_ONLY END


The macros I'm using (which work flawlessly with all other items) were gently provided by Erephine (I have her written permission to use them):

DEFINE_ACTION_MACRO ~Locations~ BEGIN OUTER_SET agrey = 0 OUTER_SET ateal = 1 OUTER_SET apink = 2 OUTER_SET ayellow = 3 OUTER_SET ared = 4 OUTER_SET ablue = 5 OUTER_SET agreen = 6 END DEFINE_PATCH_MACRO ~clear~ BEGIN SET opcode_to_delete = 7 LAUNCH_PATCH_MACRO DELETE_ITEM_EQEFFECT SET opcode_to_delete = 8 LAUNCH_PATCH_MACRO DELETE_ITEM_EQEFFECT SET opcode_to_delete = 9 LAUNCH_PATCH_MACRO DELETE_ITEM_EQEFFECT END DEFINE_PATCH_MACRO ~colour~ BEGIN SET opcode = 7 // Set opcode SET target = 1 // target type SET timing = 2 // timing type SET power = 0 // power SET resist_dispel = 0 // dispel/resitance SET duration = 0 // duration SET probability1 = 100 // probability 1 SET probability2 = 0 // probability 2 SPRINT "resource" "" // resource SET dicenumber = 0 // dice number SET dicesize = 0 // dice size SET savingthrow = 0 // saving throw SET savebonus = 0 // saving throw bonus SET parameter1 = gradient // set colour gradient SET parameter2 = location // set location LAUNCH_PATCH_MACRO ADD_ITEM_EQEFFECT END


Any help would be appreciated; I just can't wrap my head around the reason why this particular item fails.
JuliusBorisov

Comments

  • ArdanisArdanis Member Posts: 1,736
    edited May 2017
    Worked fine for me, on a clean BGEE+SoD install. I don't see any caveats in code either, so it's probably something local on your end?
    Assuming you've already checked the filename is correct in case some mod renamed it, and that the file doesn't somehow get overwritten with old version, your best bet is probably to inject it with PATCH_PRINTs to determine where exactly the code stops.
    AndreaColomboJuliusBorisov
  • AndreaColomboAndreaColombo Member Posts: 5,524
    Hi @Ardanis,

    thank you for testing this.

    It looks like my patching routine works for helmets and shields, but as we get onto armors it doesn't do anything—as though the component was over after the helmets and shields.

    Quick question: If I start a block with

    ACTION_IF (GAME_IS ~bgee sod~) THEN BEGIN

    do I need to close this out with an END as soon as I want to move on to

    ACTION_IF (GAME_IS ~bg2ee~) THEN BEGIN

    ?

    I'm asking because my component starts with a general patching routine for helmets that doesn't differentiate between games, then applies the GAME_IS token from shields on. I do the ~bgee sod~ shields, close out with an END, and do the ~bg2ee~ shields which are also closed out with an END.

    After that, I jump onto Leather Armors—except the installer doesn't really recognize that.

    Perhaps I shouldn't put END after the ACTION_IF (GAME_IS)?
  • ArdanisArdanis Member Posts: 1,736
    Those should be separate blocks, because bgee & sod doesn't include bg2ee and the latter would never return true inside of the first condition.
  • AndreaColomboAndreaColombo Member Posts: 5,524
    So using the END tokens was the right thing to do.

    Here's my tp2.

    The component in question starts at line 861; anything after line 2944 doesn't seem to have any effect. Honestly the code looks sound to me. Can you see anything that would make the installer stop at that point?
  • badungubadungu Member Posts: 53
    I think there is an end missing at line 2899 for the "ACTION_IF (FILE_EXISTS_IN_GAME ~shld26A.itm~) THEN BEGIN" block... ;)
    AndreaColombo
  • AndreaColomboAndreaColombo Member Posts: 5,524
    Indeed!

    Thank you very much, @badungu !!
  • AstroBryGuyAstroBryGuy Member Posts: 3,437
    @AndreaColombo - GAME_IS ~bgee sod~ is unnecesary. GAME_IS ~bgee~ will return true for BGEE with or without SoD installed. See this discussion at PPG.

    http://forums.pocketplane.net/index.php/topic,29502.msg337857.html#msg337857

    Also, if you need to detect SoD distinct from BGEE without SoD, use GAME_INCLUDES ~sod~.
    AndreaColombo
Sign In or Register to comment.