Skip to content

General mod Questions thread

1151618202170

Comments

  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited March 2018
    Hello!

    How can I edit the base damage and description of battle axes without editing throwing axes? I should probably rely on the minimum strength required to equip these weapons....
    Post edited by _Luke_ on
  • [Deleted User][Deleted User] Posts: 0
    edited March 2018
    The user and all related content has been deleted.
  • ArunsunArunsun Member Posts: 1,592
    edited March 2018

    Luke93 said:

    How can I edit the base damage and description of battle axes without editing throwing axes?

    You can do a check to see if the header is for ranged or melee effects.

    Note: some axes have both melee and thrown attacks...
    actually I'm quite sure every ranged axe can also be used melee...
    Luke93 said:

    Hello!

    How can I edit the base damage and description of battle axes without editing throwing axes? I should probably rely on the minimum strength required to equip these weapons....

    Fortunately, it so happens that your situation exactly matches one of the examples in the WeiDu documentation:

    https://weidu.org/WeiDU/README-WeiDU.html#htoc27

    There you go, the explanation is pretty straightforwards, but should you need more details feel free to ask!

    Editing the description is trickier though. I've personnally never meddled directly with existing strings within dialog.tlk so I'll let more knowledgeable people giving you a solution. My call would be to extract the string, look for the damage part (which usually is standardized as "Damage: 1d6" for instance), replace it with what you want (say, "Damage: 1d8"), and reimplement the string, but I am not sure how to do that using WeiDU
    Post edited by Arunsun on
  • RaduzielRaduziel Member Posts: 4,714
    I think that you may combine READ_LONG 0x0050 / 0x0054 with REPLACE_TEXTUALLY, but I'm just guessing and I'm probably wrong.
  • ArunsunArunsun Member Posts: 1,592
    Raduziel said:

    I think that you may combine READ_LONG 0x0050 / 0x0054 with REPLACE_TEXTUALLY, but I'm just guessing and I'm probably wrong.

    That's what I'd do for the first and the last steps, though I'd use READ_STRREF to directly extract the string rather than its reference. What I'm stuck on is automating the text edition once the strings are extracted. I do not know how to do that using WeiDU
  • The user and all related content has been deleted.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited March 2018


    Note: some axes have both melee and thrown attacks...

    @Arunsun Exactly. I don't wanna edit the melee ability of throwing axes, just the melee ability of battle axes.
    Therefore, one possibility would be to use the minimum strength requirement (10 for battle axes):
    PATCH_IF (prof = 92) && (minimum_strength = 10) BEGIN 
    blah blah......
    END
  • ArunsunArunsun Member Posts: 1,592
    edited March 2018
    Well this would work for most axes but some mods could implement melee axes that would have a different strength requirement so it wouldn't be the cleanest solution to use strength requirement. Here a cleaner one that will include such axes and edit every melee ability (a weapon may have multiple melee abilities):

    COPY_EXISTING_REGEXP ~.*\.itm~ ~override~ READ_BYTE 0x1c "category" READ_LONG 0x64 "abilitiesoffset" READ_SHORT 0x68 "#abilities" SET "ranged"=0 READ_SHORT 0x68 "#abilities2"=0 // this one serves for the second loop WHILE ("%#abilities%" > 0) BEGIN // this loop will check every ability to see if at least one is ranged READ_BYTE ("%abilitiesoffset%" + ("%#abilities%" - 1) * 0x38) "abilitytype" SET "checkranged" = 0 WHILE ("%abilitytype%" = 2) AND ("%checkranged%" = 0) BEGIN SET "ranged"=1 SET "checkranged" = 1 END SET "#abilities" = ("%#abilities%" - 1) END PATCH_IF ("%ranged%" = 0) //this patches the axe if it is was not determined to be ranged WHILE ("%#abilities2%" > 0) BEGIN //this loop is where the modification occur READ_BYTE ("%abilitiesoffset%" + ("%#abilities2%" - 1) * 0x38) "abilitytype" SET "patchmelee" = 0 WHILE ("%abilitytype%" = 1) AND ("%patchmelee%" = 0) BEGIN //here is where you write the modification you want to make. SET "patchmelee" = 1 END SET "#abilities2" = ("%#abilities2%" - 1) END END IF_EVAL ("%category%" = 25)

    This should be functional, though possibly suboptimal as an algorithm.

  • The user and all related content has been deleted.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535

    @Luke93 you might be able to just use ALTER_ITEM_HEADER... if not, check out the bottom of this:

    https://github.com/UnearthedArcana/Scales_of_Balance/blob/master/scales_of_balance/components/102_IWO_weapons.tpa

    What do you mean? This is my code and should work fine provided that no mod adds a battle axe with a strength requirement different from vanilla one:
    PATCH_IF (prof = 92) && (minimum_strength = 10) BEGIN // battle axes -> 2d4
              LPF ALTER_ITEM_HEADER INT_VAR header_type=1 dicesize=4 dicenumber=2
    END
    I have another question: how can I patch only droppable items?
  • The user and all related content has been deleted.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited March 2018
    Is the following piece of code ok for changing the speed factor of a launcher?

    LPF ALTER_ITEM_HEADER INT_VAR header_type=4 speed=10 END

    Why is the following piece of code not working (i.e., it doesn't change the speed factor)?
    PATCH_IF (prof = 104) && (minimum_strength = 6) BEGIN // longbow
    			READ_LONG 0x64 abilities_off
    			READ_SHORT 0x68 num_abilities
    			FOR (ability = 0; ability < num_abilities; ability += 1) BEGIN
    				PATCH_IF (BYTE_AT (abilities_off + 0x38 * ability + 0x00) == 4) BEGIN // Launcher
    					READ_BYTE (abilities_off + 0x38 * ability + 0x12) speed
    					SET new_speed = speed + 2
    					WRITE_BYTE (abilities_off + 0x38 * ability + 0x12) new_speed
    				END
    			END
    END
    It shouldn't be that difficult..... Where am I doing wrong?
    Post edited by _Luke_ on
  • RaduzielRaduziel Member Posts: 4,714
    Ok, that is something I should know by now, but I don't.

    Let's say I have the following cre files:

    RAcola02.cre

    PRcola01.cre

    SPcola09.cre

    HJcola20.cre

    K!cola1.cre

    R$cola4.cre

    And so it goes...

    How can a make the game read all these files at once using only the radical "cola"?

    I'm talking about those $![..]*/^.\. shenanigans that I see on a lot of mods, but I have no idea on how it works.

    Thanks!

  • [Deleted User][Deleted User] Posts: 0
    edited March 2018
    The user and all related content has been deleted.
  • BubbBubb Member Posts: 1,000
    Regex is a somewhat acquired skill after much use... I'll try to step you through some of the basics

    "." means "match any character"
    "*" means "match zero or more of the previous character"
    "+" means "match one or more of the previous character"
    "\" means "treat the following special character as if it wasn't special"

    So, in order to match all CREs that have cola in their name, you could do this:
    .*cola.*\.cre

    the first ".*" being "match zero or more of any character"

    "cola" being "match the character sequence cola"

    the second ".*" being "match zero or more of any character"

    the "\." being "match a period", notice the "\" is used here to tell the regexp to treat the period as a literal period, and not as a wildcard character

    And the "cre" being "match the character sequence cre"
  • ArunsunArunsun Member Posts: 1,592
    I would like to prevent a kit from equipping any items with one specific opcode (189). Is there a simple way to do that? The only process I can think of is checking every effect of every item one by one, and this would probably result in a super long installation. I don't want to make the kit immune to that OPcode since I am using it in the kit, I just want to make it so there is no way of stacking the OPcode with itself using items.

    Alternatively, if an opcode is applied with permanent duration onto a target, and then the target becomes immune to that OPcode, does it dispel the previously applied effect?
  • The user and all related content has been deleted.
  • RaduzielRaduziel Member Posts: 4,714
    Ok, I know how to make an item exclusive to one kit (319 with power = 1).

    But how can I make an item exclusive to X kits, being X >= 1?

    Thanks!
  • [Deleted User][Deleted User] Posts: 0
    edited March 2018
    The user and all related content has been deleted.
  • RaduzielRaduziel Member Posts: 4,714

    Raduziel said:

    Ok, I know how to make an item exclusive to one kit (319 with power = 1).

    But how can I make an item exclusive to X kits, being X >= 1?

    Not easily. Use opcode 181 or 180 or the vanilla usability flags.

    EDIT - or use 319 to make it unusable by every other kit. But... that doesn't seem like a great solution.
    I'll just make variants of the same item, then.

    Thanks!
  • RaduzielRaduziel Member Posts: 4,714
    New question:

    At level 25, in BG2EE-ToB, Clerics automatically receive a holy symbol.

    I want to remove this from the game. How do I do it? This is not related to the Clerics CLAB, is some script that runs.

    Thanks!
  • BubbBubb Member Posts: 1,000
    edited March 2018
    This is just from a quick glance, I apologize if any of this is wrong.

    it seems like the CLABPR0(1-4).2DA files are applying the spell CDHLYSYM at level 25 for all priest classes. The CDHLYSYM spell creates a CDHLYSYM item which is used as a placeholder.

    A script in BALDUR.BCS (BALDUR25.BCS for ToB) (starts around line 1711 for SoA, 1027 for ToB) checks for the CDHLYSYM item every round for every player and then replaces it with the correct deity variant.

    In order to remove this mechanism, you should remove the CDHLYSYM entries in the CLABPR0(1-4).2DA files, and then remove the corresponding lines from Baldur.BCS.

    If you only remove the script in Baldur.BCS I'm pretty sure you will encounter the placeholder item still appearing, so make sure you remove the CLAB entries.
  • RaduzielRaduziel Member Posts: 4,714
    @Bubb

    Thanks!

    How do I remove lines from a script without allowing Satan to walk on Earth and burn us all?
  • RaduzielRaduziel Member Posts: 4,714
    @Bubb

    Just to give you a feedback, I was able to fix it using:
    //Solves the issue with the Holy Symbol for Multiclass Kits

    ACTION_IF GAME_IS ~bg2ee~ BEGIN

    DELETE ~CDHLYSYM.spl~

    COPY_EXISTING ~CLABPR01.2DA~ ~override~
    SET_2DA_ENTRY_LATER ~RACLABPR01~ 3 25 ~****~
    SET_2DA_ENTRIES_NOW ~RACLABPR01~ 1
    PRETTY_PRINT_2DA
    BUT_ONLY_IF_IT_CHANGES

    END
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    Sorry to bother again, but why the following piece of code isn't working (i.e., it doesn't update the general description of light crossbows and heavy crossbows)?
    LOAD_TRA ~Weapon_Changes/components/104_unident_desc_xbows.tra~
    
    BEGIN 
    
    STRING_SET 
    6875 @6875
    18095 @18095
    
    END
    Note that 104_unident_desc_xbows.tra is encoded as UTF-8....
  • GwendolyneGwendolyne Member Posts: 461
    edited March 2018
    You don't need the BEGIN END block:
    STRING_SET ~6875~ @6875
    STRING_SET ~18095~ @18095
    is enough.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    @Gwendolyne It worked, thanks.
  • ArunsunArunsun Member Posts: 1,592
    How am I supposed to restrain a kit from using plate armors? I thought about using OPcode 181 (Disallow item type) but actually every armor including plate and full plate have their category field set to "Armor".
  •  TheArtisan TheArtisan Member Posts: 3,277
    @Arunsun

    Barbarians are restricted from plate mail, unfortunately due to some strange design choices using 0x40000000 in your kit causes a bunch of magical items to also be unusable.
  • RaduzielRaduziel Member Posts: 4,714
    Arunsun said:

    How am I supposed to restrain a kit from using plate armors? I thought about using OPcode 181 (Disallow item type) but actually every armor including plate and full plate have their category field set to "Armor".

    @Gwendolyne taught me this trick:
    COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~
    PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
    READ_BYTE 0x18 flags1
    PATCH_IF ((flags1 & BIT3) = BIT3) BEGIN
    READ_ASCII 0x22 animation (2)
    PATCH_IF ("%animation%" STRING_EQUAL_CASE "4A") BEGIN
    LPF ~ADD_ITEM_EQEFFECT~ INT_VAR opcode = 319 target = 1 timing = 2 parameter1 = IDS_OF_SYMBOL (~Kit~ ~KitInternalName~) parameter2 = 9 special = RESOLVE_STR_REF (@Y) END
    END
    END
    END
    BUT_ONLY
    The special part is optional and just makes the kit name appear on the list of those who can't wear the armor (Y = the string with the kit's name in Mixed Cases).

    "4A" is the animation for plate/full plate.

    That should do the trick.
Sign In or Register to comment.