From 4b3a695b1d709c8517c5b6decb518ed60430b774 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 16 Jun 2026 19:59:14 +0100 Subject: [PATCH 1/3] refactor disposition alter functions to return strings --- .../scr_ChapterTraits/scr_ChapterTraits.gml | 9 +++++++- .../scr_diplomacy_helpers.gml | 21 +++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml index 60bee65601..e536eaa1ad 100644 --- a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml +++ b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml @@ -334,7 +334,7 @@ function setup_chapter_traits() { function ChapterGameData(data = {}) constructor { chapter_suspicion = 0; - faction_disp_mods = array_create(14, {"int_mod": 0, "mult": 1}); + faction_disp_mods = array_create(14, {"int_mod": 0, "mult": 1, "strings" : []}); equipment_tag_mods = {}; @@ -420,6 +420,13 @@ function ChapterGameData(data = {}) constructor { alter_value = floor(alter_value * _mods.mult); } + //ensure alter value never brings disposition higher thann 100 or lower than 0 + var _final_disp_val = alter_value + obj_controller.disposition[faction]; + if (_final_disp_val > 100){ + alter_value -= _final_disp_val - 100; + } else if (_final_disp_val < 0){ + alter_value += (_final_disp_val * -1); + } return alter_value; }; diff --git a/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml b/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml index 01ba720870..74aeb78686 100644 --- a/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml +++ b/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml @@ -42,17 +42,30 @@ function relationship_hostility_matrix(faction) { return _rela; } -function alter_disposition(faction, alter_value) { +function alter_disposition(faction, alter_value, return_string = false) { chap_data = obj_ini.chapter_data; alter_value = chap_data.calc_final_disp_value(faction, alter_value); - obj_controller.disposition[faction] = clamp(obj_controller.disposition[faction] + alter_value, -100, 100); + obj_controller.disposition[faction] += alter_value; + + if (return_string){ + return "{global.faction_names[faction]} : {string_plus_minus(alter_value)}{alter_value}"; + } } -function alter_dispositions(alterations) { +function alter_dispositions(alterations, return_strings) { + var _string; + var _strings = []; for (var i = 0; i < array_length(alterations); i++) { - alter_disposition(alterations[i][0], alterations[i][1]); + _string = alter_disposition(alterations[i][0], alterations[i][1], return_strings); + if (return_strings){ + array_push(_strings, _string); + } + } + + if (return_strings){ + return _strings; } } From 17a24987fd2d9df102b151a7846151de201f471e Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Wed, 17 Jun 2026 19:50:13 +0100 Subject: [PATCH 2/3] Update scripts/scr_ChapterTraits/scr_ChapterTraits.gml Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- scripts/scr_ChapterTraits/scr_ChapterTraits.gml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml index e536eaa1ad..edb89aa093 100644 --- a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml +++ b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml @@ -334,7 +334,10 @@ function setup_chapter_traits() { function ChapterGameData(data = {}) constructor { chapter_suspicion = 0; - faction_disp_mods = array_create(14, {"int_mod": 0, "mult": 1, "strings" : []}); + faction_disp_mods = []; + for (var _i = 0; _i < 14; _i++) { + faction_disp_mods[_i] = {"int_mod": 0, "mult": 1, "strings": []}; + } equipment_tag_mods = {}; From 60558ab81a60901bef97ff36003c920dfc2cad2b Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Wed, 17 Jun 2026 19:50:22 +0100 Subject: [PATCH 3/3] Update scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml b/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml index 74aeb78686..b4f89da4f1 100644 --- a/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml +++ b/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml @@ -50,7 +50,7 @@ function alter_disposition(faction, alter_value, return_string = false) { obj_controller.disposition[faction] += alter_value; if (return_string){ - return "{global.faction_names[faction]} : {string_plus_minus(alter_value)}{alter_value}"; + return $"{global.faction_names[faction]} : {string_plus_minus(alter_value)}{alter_value}"; } }