Help with sharing tweaks

Can someone help me to understand what i have to do for share, in the correct way (compatibility, etc...), the changes i have maded at this game? 

Simple example of one of those, i have edited the healing value of the "potion of healing" to respect the pnp value (not a fixed 9hp restored, but a 2d4+2)
#edited the dialog.tlk

#Edited the Item Ability


If i want to share this, and i want to make these changes transferable in future installations, what is the correct procedure to do?
Can someone make a example (with my example) so i can understad the procedure and i can do it by myself in the future?

I'm trying to balance all of the overpowered things into my EET setup and making the playthrough progression more vanilla like, it's a things i make every time i update my EET setup, basically editing all the shops added by mods, removing/editing OP gears from NPC, editing the healing potions, reduce some exp rewards, correct some dialogs (like make Garrick wont leave forever the game if i don't accept into the party), reduce or increase the challenge of a encounter if it's unbalanced (like Tristan and Isolde is too high, or the Gnoll Fortress is too low) ect.


I have no problems for editing into Near Infinity, but no clues (and no time sadly) for starting from scraps with the Weidu documentations and share those edits i make)

Tks



Comments

  • Although this would be easy to do with just a simple file (and an exe to install it), my suggestion would be to start this as a proper weidu mod, in this case you can easily add on to it for further tweaks and have no need to change things around when you want to add new stuff.

    Create a folder with your mod name (best make it so unique that it does not collide with an existing mod -- for this example I call it Cere_Tweak).

    Inside the folder create a text file called cere_tweak.tp2 (this is your command file to install the mod. It may reference to other files and subfolders you may create over time...
    Also create a subfolder you call "english" (this is for text you want to add to dialog.tlk) and a file called setup.tra inside.
    To edit your file I suggest to use ConTEXT editor, which has useful plugins for the games we mod here. You may also use notepad++.

    Now fill in some necessary data for the tp2
    BACKUP ~Cere_Tweak/backup~
    AUTHOR ~Cere~

    VERSION ~v0.1~

    AUTO_TRA ~Cere_Tweak/%s~

    LANGUAGE ~English~ ~english~ ~Cere_Tweak/english/setup.tra~

    BEGIN @01

    STRING_SET
    17667 @02
    This just defines where weidu will store backups of the files you modify (they will be restored when the mod is uninstalled).

    The tra (translation) references tells weidu where the text is. You can add other subfolders for other languages and add a line LANGUAGE into tp2 to provide a choice.

    The BEGIN just defines the first component of your mod (may be the only one or one of many).

    In your case you modify a fixed string entry in BG2EE that always will be 17667 and you replace it with the entry @02 from your tra-file (see below)

    Now in setup.tra add these lines
    @01=~Fix Potions of Health~
    @02=~When wholly consumed, this potion restores 2d4+2 Hit Points to the person. The effect is instantaneous and the potion is destroyed in the process.

    STATISTICS:

    Special: Restores 2d4+2 Hit Points.

    Weight: 1~
    Now all you need is a copy of weidu.exe (or any other setup....exe file from a mod you have at hand). This copy you call setup-Cere_Tweak.exe.
    Put the exe file and the mod folder into BG2EE and start the exe to test.

    Next steps to follow...

  • edited May 31
    What is the file name of the item you tweak and which field(s) do you change exactly?
  • edited May 31
    Very very tks

    The file name of the example, if i understand exactly what you mean, is "POTN08.ITM", and the fields i change are, in the second screenshot i have posted, those 3 rows (excluded the dialog for the description):

    1) the row "Value" (from 9 to 2) (offset "ae h") (size "4 h")
    2) the row "# dice thrown/maximum level" (from 0 to 2) (c6 h) (4 h)
    3) the row "Dice size/minimum level" (from 0 to 4) (ca h) (4 h)
  • edited May 31
    There is the easy way to do this
    In your new mod make a subfolder "itm" and just export your tweaked version of the file there.
    Add to the bottom of the above tp2
    COPY ~Cere_Tweak/itm/potn08.itm~ ~override~
    This way you are save that regardless what other mods do to items, you end up with your desired version (provided you install after other mods).
    There are other ways to do it but this one probably is what you have in mind.

    So you will have
    STRING_SET
    17667 @02

    COPY ~Cere_Tweak/itm/potn08.itm~ ~override~

  • edited May 31
    Good, in that way is much fast and much simple.

    The other way is something like this?
    (if i understand correctly (but i don't know the correct sintax)).

    STRING_SET
    17667 @02 COPY_EXISTING ~potn08.itm~ ~override~ WRITE_SHORT 0xaeh 2 WRITE_SHORT 0xc6h 2 WRITE_SHORT 0xcah 4

  • edited May 31
    It would be

    STRING_SET
    17667 @02 COPY_EXISTING ~potn08.itm~ ~override~ WRITE_SHORT 0xae h 2 WRITE_SHORT 0xc6 h 2 WRITE_SHORT 0xca h 4
    (of course you would remove the h)
  • Tks Roxanne, very helpfull.
  • edited October 7
    Any way to edit a specific parto of code writed into a .bcs with Weidu?

    Example, BG2300.BCS, i want to delete only this few lines, but not overwite the entire .bcs with one provided by me.
    IF
    	Global("CMaddMerchantParty","GLOBAL",0)
    THEN
    	RESPONSE #100
    		CreateCreature("CMMERC03",[2455.2579],SWW)  // Merchant
    		CreateCreature("CMMERC04",[2658.2691],N)  // Merchant
    		CreateCreature("CMMERC05",[4511.2135],SW)  // Sintara Al-Mustafa
    		CreateCreature("CMMERC06",[4586.2204],S)  // Ms. Godfrey
    		CreateCreature("CM2300A1",[2596.2607],SWW)  // Caravan Guard
    		CreateCreature("CM2300A1",[2553.2683],W)  // Caravan Guard
    		CreateCreature("CM2300A1",[4677.2227],NNW)  // Caravan Guard
    		CreateCreature("CM2300A1",[4429.2110],NWW)  // Caravan Guard
    		CreateCreature("CM2300A2",[2670.2541],S)  // Caravan Guard
    		CreateCreature("CM2300A3",[4387.2039],SW)  // Caravan Guard
    		SetGlobal("CMaddMerchantParty","GLOBAL",1)
    		Continue()
    END

    I mean something like tue replace function, where i write that specific code i want to replace/delete, the function search into the BG2300.BCS, and if those lines of code are in, then delete, if not present then do nothing.

    I'm searching into the Weidu Bible but find nothing, maybe i need an external tool for that.


    Tks


    Edit:

    I'm actually trying with the SPRINT textToReplace and REPLACE_TEXTUALLY, but maybe there is a better way.


    EDIT2:


    Nvm, it work, just tested:


    BEGIN @1
    COPY_EXISTING_REGEXP GLOB ~BG2300.bcs~ ~override~
    	DECOMPILE_AND_PATCH BEGIN
    		REPLACE_TEXTUALLY ~CMaddMerchantParty~ ~ECCOMI~
    		END
    BUT_ONLY
    Need to do the correct regexp now.
  • edited October 7
    The above block is something added by another mod (Dark Horizons to be specific).

    It is a bit problematic to delete stuff from some other mod, it is quite different from tweaking game code.

    Can you give some justification why you would want to do it?

    The easy way to disable those spawns would be to add some code somewhere to set a global before the player will ever reach FAI, so the area script will consider them as spawned already. You would tie this to whatever condition in your mod, e.g. do not spawn them if...(something else happened before).
    SetGlobal("CMaddMerchantParty","GLOBAL",1)
    In this specific case, those are just merchants selling items, none of them or none of the items they sell are plot/quest relevant. So disabling them does not ruin some mod but just removes an overly convenient source of too powerful items. In a context of making the game harder/less cheesy this could make sense.
  • That is just an example for the function i need, i know that SetGlobal >1 work, i need to understand how to deal with the "problem" of replacing a part or one entire block of code with Weidu.

    Actually the REPLACE_TEXTUALLY work, but i have some problem with the syntax of the newline match:

    (without "")
    The "\r\n not work" (as readme say);
    The "[%newline%]*" seem not work or i'm do something wrong (i know the regular regexp, that need only the "\r\n.*", but the Gnu Emacs/Weidu is literally the first time i use it);

    Like that exact syntax not work for me:
    https://baldurs-gate.de/index.php?threads/einfügen-eines-weiteren-triggers-in-ein-bestehendes-script.44959/#post-1084516




  • edited October 7
    You can use something like that
    COPY_EXISTING ~bg2300.BCS~ ~override~
        REPLACE_BCS_BLOCK ~.../bg2300-Old.baf~ ~.../bg2300-New.baf~
    END
    BUT_ONLY
    You then create the two baf files where old.baf contains the copy of the block you want to replace and new.baf your replacement.
    This comes handy if you want to replace more than a single code line and the block you search is unique.
    You can add for test
    ON_MISMATCH PATCH_WARN ~WARNING: could not find REPLACE_BCS_BLOCK matching .../bg2300-Old.baf in %SOURCE_FILE%~
    but that is optional.
    I used this at times but have not used the code from your other example ever. I do not think you need the complication if you only target the EE version. You might need more checks if your mod is for classic and EE games as things may sometimes differ slightly. In bcs it should be clear where a new line is used, so why search for it?

    (Maybe this is my personal philosophy but I always keep it as simple as possible, the less there will be that can fail.)
  • Really good! It's seem much faster in that way, tomorrow i try. (Yes, only EE version)

    Tks as always Roxanne.


    (Just trying to learn the correct syntax for complex regexp, but i need more time, seem work differently from the normal regexp)
  • edited October 8
    Cere said:
    Really good! It's seem much faster in that way, tomorrow i try. (Yes, only EE version)

    Tks as always Roxanne.


    (Just trying to learn the correct syntax for complex regexp, but i need more time, seem work differently from the normal regexp)
    The method of old.baf to be replaced by new.baf blocks in a larger bcs file was used in the original Ascension and Wheels mods to some extend. It is very useful if you want to replace whole blocks and even more if you want to insert a larger group of new blocks at a specific point in a bcs script sequence.

    I am just saying this because you may want to look into those mods for more detail. Also, k4thos uses it in EET a lot, but you need to dig a bit into his tph-files in the EET/lib folder to find examples.
  • Tks for those added details, very appreciated.
Sign In or Register to comment.