jastey Posted February 25, 2019 Share Posted February 25, 2019 ==>Link to the cre-File Patching List with Mod Names<== This is a list with all cre-file names that are patched by mods with regards to: death variable/script name; one of the creature scripts slots, and the creature's dialogue. For now, the cre names are shown in alphabetical order with their BG1 / BG:EE file names. The second column displays the file name in unified OUTER_SPRINT variable naming as described in cmorgan's tutorial "Crossing the Great Divide" and defined in the relevant cpmvars.tpa. The assumption is that you are familiar with the concept of crossplatform coding for BG1. The idea is, that if you are working on a mod and want to give an existing game creature a script name /death variable (DV), have a look here whether another mod already uses one and use this, too, for compatibility reasons. If you add a script name (DV) to a cre-file that is not on the list yet, please post here so that it can be added. My suggestion for new cases not on the list yet would be to use the file name for the DV, not the ingame character name. It is the safest way with BGT and EET around, not to end in incompatibilities between the game ressources of the two games If you need to patch a creature with a custom script, have a look here whether there is still a free script slot or whether it might be overwritten by another mod. Please note: mods patching scripts usually override any other script that might have been there (even if it had the same name). If you need to patch a creature with a script and see from the list that no slot is available, please post here so we can sort out the incompatibility. The so far considered mods are not all BG1 mods available, and I didn't look at any BGII mods yet. There is no specific reason why I didn't look at the mods that are not considered yet other than that I started with the ones I deal with more often and it took several days until the list was finished the way it is now already. Feel free to provide info of mods that are not considered yet. Considered mods: Ascalon's Breagar v7.0.6 (Breagar) [Tutu/BGT/BG:EE/SoD/BGII/BGII:EE/EET] Ascalon's Questpack v2.05 (no cre patching) Baldur's Gate Romantic Encounters (bg1re) v2.7 [BG1:TotSC/Tutu/BGT/BG:EE/SoD/EET] BG1NPC Project (bg1npc) v24 beta [Tutu/BGT/BG:EE/SoD] BG1 Unfinished Business (bg1ub) v16 [BG1:TotSC/Tutu/BGT/BG:EE/SoD] Baldur's Gate Mini Quests and Encounters (bgqe) v18 [BG1:TotSC/Tutu/BGT/BG:EE/SoD/EET] Brandock the Mage NPC vBeta6 [BGT/BG:EE/EET] Dark Side of the Sword Coast (DSotSC) (EET/BGT) v3.0 beta [BGT/EET] Drake NPC v1.21 (no cre patching) Gavin BG1 v14 [Tutu/BGT/BG:EE/SoD/EET] Grey the Dog NPC v5.1 [BGT/BG:EE/EET] Isra v2.3 (no cre patching) Lure of Sirine's Call v15 (LotSC) [BG1:TotSC/Tutu/BGT/BG:EE/SoD/EET] Norther Tales of the Sword Coast (NTotSC) v3.1.0 [BGT/BG:EE/SoD/EET] Verr'Sza v5.2 [BG:EE/EET] Vynd v2 [Tutu/BGT/BG:EE/SoD/EET] Not considered, because these mods also replace existing cres (so I didn't want to go there): Jarl's Adventure Pack (BGT) DSotSC (BG:EE version) So far, all death variables (script names) are in accordance to what is already given in BG:EE, as far as I could see. Some nomenclature that might not be obvious: TotSC - original BG1 with TotSC SoD - a game with BG:EE and SoD BG:EE - BG:EE game without SoD ==>Link to the cre-File Patching List with Mod Names<== Quote Link to comment
subtledoctor Posted February 25, 2019 Share Posted February 25, 2019 I don't quite know the utility of this since I haven't done NPC mods. But, any idea if this (adding death variables to NPCs) might interfere with this method of distinguishing joinable vs. non-joinable NPCs? Quote Link to comment
Mike1072 Posted February 26, 2019 Share Posted February 26, 2019 I mean, if a mod changed the DV of a joinable NPC, yes. But I don't see any instances of that here. Quote Link to comment
jastey Posted February 26, 2019 Author Share Posted February 26, 2019 @subtledoctor The list is relevant to all mods, not just NPC mods. Any time a mod touches an original game cre, for example to make them a questgiver, check for their death etcpp and therefore patches a script name (DV) or a script to a cre that doesn't have this in the original game, it is a possibility for incompatibilities with other mods that might use that exact cre for own purposes and - as an example - patches a different DV, breaking the first mod. The list deals with changes to original game cres by mods, only. As far as I am aware, there is no instance of a mod patching other mod's cre files (except for adding dialogues or script blocks to an existing script, but that's not patching as I am referring to here). EDIT: I'm going to stress this in case it's not clear: the list is a summary of what is already done by the existing mods listed above. It's not suggesting anything new. It is a modders' ressource for compatibility between mods. Quote Link to comment
subtledoctor Posted February 26, 2019 Share Posted February 26, 2019 (edited) Got it, sorry. My concern wasn't whether this modder's resource would affect the macro, but rather, given the implication that people may change NPCs' DV in general, whether the macro is robust enough. But now I see that is a separate and unrelated question. Carry on! Edited February 26, 2019 by subtledoctor Quote Link to comment
CamDawg Posted February 26, 2019 Share Posted February 26, 2019 FWIW The Calling also assigns 'taerom' as Taerom's DV. It's the only original NPC DV assigned by it. Quote Link to comment
jastey Posted February 26, 2019 Author Share Posted February 26, 2019 7 hours ago, CamDawg said: FWIW The Calling also assigns 'taerom' as Taerom's DV. It's the only original NPC DV assigned by it. Thanks! Will add it to the list for the next update. EDIT: Done Quote Link to comment
jastey Posted March 24, 2019 Author Share Posted March 24, 2019 There are more compatible ways to patch a creature of course, death variable/script name (DV) as an example: Let's say we want to give the cre file Exampe.cre a new DV which matches the file name, but only if there isn't another DV already present. If there is another one present, we want to use that instead. We could use this (suggestions for code optimization welcome): /* Patch Exampe.cre with DV */ COPY_EXISTING ~Exampe.CRE~ ~OVERRIDE~ READ_ASCII 0x280 ~DV~ PATCH_IF ((~%DV%~ STRING_EQUAL ~~) OR (~%DV%~STRING_EQUAL_CASE ~none~)) BEGIN WRITE_ASCIIE DEATHVAR ~%SOURCE_RES%~ #32 // ~Exampe~ END /* Load the cre again and read the current DV */ COPY_EXISTING ~Exampe.CRE~ ~OVERRIDE~ READ_ASCII 0x280 ~DV~ OUTER_SPRINT ~Exampe_dv~ ~%DV%~ Inside your mod, use "%Exampe_dv%" as the DV and compile any file using it with EVALUATE_BUFFER. Then the current DV is used independent on how it is actually called without screwing an existing mod. Only problem with this: If the player changes the install midgame, the cre might have another DV after reinstalling your mod which would be then used in your dialogues and scripts, but not for the actual cre since the player already visited the area and the old cre with the former DV is already in the savefile. But deinstalling mods midgame is a Bad Idea, anyhow. Also, script patching is still another problem, as mods that introduce custom scripts to creatures usually compile the script in a way that it will replace any existing ones. Quote Link to comment
Mike1072 Posted March 24, 2019 Share Posted March 24, 2019 11 hours ago, jastey said: We could use this (suggestions for code optimization welcome): /* Patch Exampe.cre with DV */ COPY_EXISTING ~Exampe.CRE~ ~OVERRIDE~ READ_ASCII 0x280 ~DV~ PATCH_IF ((~%DV%~ STRING_EQUAL ~~) OR (~%DV%~STRING_EQUAL_CASE ~none~)) BEGIN WRITE_ASCIIE DEATHVAR ~%SOURCE_RES%~ #32 // ~Exampe~ END /* Load the cre again and read the current DV */ COPY_EXISTING ~Exampe.CRE~ ~OVERRIDE~ READ_ASCII 0x280 ~DV~ OUTER_SPRINT ~Exampe_dv~ ~%DV%~ /* fetch DV for exampe.cre */ COPY_EXISTING ~exampe.cre~ ~override~ READ_ASCII 0x280 exampe_dv PATCH_IF ((~%exampe_dv%~ STRING_EQUAL ~~) OR (~%exampe_dv%~ STRING_EQUAL_CASE ~none~)) BEGIN TEXT_SPRINT exampe_dv ~%SOURCE_RES%~ WRITE_ASCIIE DEATHVAR ~%exampe_dv%~ #32 END BUT_ONLY This also could/should be rewritten into a function. I'm on mobile right now which makes writing code painful so I'm not going to do that now. Quote Link to comment
DavidW Posted March 25, 2019 Share Posted March 25, 2019 Try this: DEFINE_ACTION_FUNCTION resolve_deathvar STR_VAR creature="" default="" RET deathvar BEGIN ACTION_IF "%default%" STRING_EQUAL "" BEGIN OUTER_SPRINT default "%creature%" END ACTION_IF FILE_EXISTS_IN_GAME "%creature%.cre" BEGIN COPY_EXISTING "%creature%.cre" override READ_ASCII DEATHVAR deathvar PATCH_MATCH "%deathvar%" WITH none "" BEGIN SPRINT deathvar "%default%" WRITE_ASCIIE DEATHVAR "%default%" (0x20) END DEFAULT END BUT_ONLY END ELSE BEGIN WARN "function resolve_deathvar attempted to find a death variable for %creature%.cre, but it doesn't exist" END END Quote Link to comment
DavidW Posted March 25, 2019 Share Posted March 25, 2019 (Incidentally, it needs to be an action rather than a patch function because as far as I'm aware there's no totally reliable way of finding the resref of the file being patched.) Quote Link to comment
Jarno Mikkola Posted March 26, 2019 Share Posted March 26, 2019 22 hours ago, DavidW said: (Incidentally, it needs to be an action rather than a patch function because as far as I'm aware there's no totally reliable way of finding the resref of the file being patched.) Here's one... the file is copied into the override folder. Or in the destination folder of once choosing. But yes, that doesn't define the files already in there, nor that the files in there that don't consist of only of the current patched files, nor all of the desired files that should be there but aren't... but that's not the point, really. Quote Link to comment
DavidW Posted March 26, 2019 Share Posted March 26, 2019 You misunderstand: there’s no reliable way *within the function* to know what the resref is. The whole idea of a function is that it reliably does what it says it does. That’s functional programming 101. Quote Link to comment
jastey Posted March 26, 2019 Author Share Posted March 26, 2019 @Mike1072 In your example, is "exampe_dv" a variable I can use with OUTER_SPRINT for the rest of the mod? @DavidW In your function, I do not see where it gives me the actual DV (after need of patching of the cre was checked) to be used as OUTER_SPRINT variable? Quote Link to comment
DavidW Posted March 26, 2019 Share Posted March 26, 2019 It’s a return value for the function. Example of use: LAUNCH_ACTION_FUNCTION resolve_deathvar STR_VAR creature=exampe RET deathvar END After you run it, ‘deathvar’ is set to the creature’s dv. Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.