From dcd76f1a3379f60d456815e3d14c51a7c59932d1 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Mon, 13 Jan 2025 18:26:50 +0000 Subject: [PATCH 1/4] potential array issue with self healing ships --- objects/obj_controller/Alarm_5.gml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index a19189865..447c46786 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -717,7 +717,8 @@ for(var c=0; c<11; c++){ // STC Bonuses if (obj_controller.stc_ships>=6){ //self healing ships logic - for(var v=0; v Date: Mon, 13 Jan 2025 18:33:33 +0000 Subject: [PATCH 2/4] missing accessor --- objects/obj_controller/Alarm_5.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index 447c46786..943666936 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -718,7 +718,7 @@ for(var c=0; c<11; c++){ if (obj_controller.stc_ships>=6){ //self healing ships logic for (var v=0; v Date: Mon, 13 Jan 2025 20:46:16 +0000 Subject: [PATCH 3/4] redundant check causing early end game --- objects/obj_ncombat/Alarm_7.gml | 6 --- scripts/scr_kill_unit/scr_kill_unit.gml | 2 +- scripts/scr_role_count/scr_role_count.gml | 48 ++++++++++++----------- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/objects/obj_ncombat/Alarm_7.gml b/objects/obj_ncombat/Alarm_7.gml index 8a0c84fee..9e5f93d19 100644 --- a/objects/obj_ncombat/Alarm_7.gml +++ b/objects/obj_ncombat/Alarm_7.gml @@ -260,12 +260,6 @@ try { instance_activate_all(); - if (scr_role_count("Chapter Master","")=0){ - obj_controller.alarm[7]=1; - if (global.defeat<=1) then global.defeat=1; - if (enemy=1) or (enemy=2) or (enemy=5) then global.defeat=3; - } - if (turn_count < 20){ if (defeat=0) and (threat>=4) then scr_recent("battle_victory", $"{battle_loc} {scr_roman(battle_id)}",enemy); diff --git a/scripts/scr_kill_unit/scr_kill_unit.gml b/scripts/scr_kill_unit/scr_kill_unit.gml index 45fcd0ec0..0d5f45cba 100644 --- a/scripts/scr_kill_unit/scr_kill_unit.gml +++ b/scripts/scr_kill_unit/scr_kill_unit.gml @@ -8,7 +8,7 @@ function scr_kill_unit(company, unit_slot){ if (obj_ini.role[company][unit_slot]="Chapter Master"){ tek="c"; alarm[7]=5; - global.defeat=3; + global.defeat=1; } _unit = fetch_unit([company, unit_slot]); if (_unit.weapon_one()=="Company Standard" || _unit.weapon_two()=="Company Standard"){ diff --git a/scripts/scr_role_count/scr_role_count.gml b/scripts/scr_role_count/scr_role_count.gml index f528c6217..a54bdbf5e 100644 --- a/scripts/scr_role_count/scr_role_count.gml +++ b/scripts/scr_role_count/scr_role_count.gml @@ -42,29 +42,31 @@ function scr_role_count(target_role, search_location="", return_type="count") { } - if (coom<0) then repeat(11){ - for (var i=0;i-1)) then match=true; - - if (search_location!="home") and (search_location!="field"){ - if (unit.role()=target_role){ - var t1=string(obj_ini.loc[com][i])+"|"+string(unit.planet_location)+"|"; - if (search_location=t1) then match=true; - } - } - if (match){ - count++; - if (return_type=="units"){ - array_push(units, unit); - } - } - } - com+=1; + if (coom<0) { + for (var com=0;com<=obj_ini.companies;com++) + { + for (var i=0;i-1)) then match=true; + + if (search_location!="home") and (search_location!="field"){ + if (unit.role()=target_role){ + var t1=string(obj_ini.loc[com][i])+"|"+string(unit.planet_location)+"|"; + if (search_location=t1) then match=true; + } + } + if (match){ + count++; + if (return_type=="units"){ + array_push(units, unit); + } + } + } + } } From 922f600c572fe7a76633d0395cabd822c3ddc9e0 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Mon, 13 Jan 2025 20:53:40 +0000 Subject: [PATCH 4/4] Revert "redundant check causing early end game" This reverts commit 5879090b6b853344991f007f3bc8a1fe0ba99a50. --- objects/obj_ncombat/Alarm_7.gml | 6 +++ scripts/scr_kill_unit/scr_kill_unit.gml | 2 +- scripts/scr_role_count/scr_role_count.gml | 48 +++++++++++------------ 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/objects/obj_ncombat/Alarm_7.gml b/objects/obj_ncombat/Alarm_7.gml index 9e5f93d19..8a0c84fee 100644 --- a/objects/obj_ncombat/Alarm_7.gml +++ b/objects/obj_ncombat/Alarm_7.gml @@ -260,6 +260,12 @@ try { instance_activate_all(); + if (scr_role_count("Chapter Master","")=0){ + obj_controller.alarm[7]=1; + if (global.defeat<=1) then global.defeat=1; + if (enemy=1) or (enemy=2) or (enemy=5) then global.defeat=3; + } + if (turn_count < 20){ if (defeat=0) and (threat>=4) then scr_recent("battle_victory", $"{battle_loc} {scr_roman(battle_id)}",enemy); diff --git a/scripts/scr_kill_unit/scr_kill_unit.gml b/scripts/scr_kill_unit/scr_kill_unit.gml index 0d5f45cba..45fcd0ec0 100644 --- a/scripts/scr_kill_unit/scr_kill_unit.gml +++ b/scripts/scr_kill_unit/scr_kill_unit.gml @@ -8,7 +8,7 @@ function scr_kill_unit(company, unit_slot){ if (obj_ini.role[company][unit_slot]="Chapter Master"){ tek="c"; alarm[7]=5; - global.defeat=1; + global.defeat=3; } _unit = fetch_unit([company, unit_slot]); if (_unit.weapon_one()=="Company Standard" || _unit.weapon_two()=="Company Standard"){ diff --git a/scripts/scr_role_count/scr_role_count.gml b/scripts/scr_role_count/scr_role_count.gml index a54bdbf5e..f528c6217 100644 --- a/scripts/scr_role_count/scr_role_count.gml +++ b/scripts/scr_role_count/scr_role_count.gml @@ -42,31 +42,29 @@ function scr_role_count(target_role, search_location="", return_type="count") { } - if (coom<0) { - for (var com=0;com<=obj_ini.companies;com++) - { - for (var i=0;i-1)) then match=true; - - if (search_location!="home") and (search_location!="field"){ - if (unit.role()=target_role){ - var t1=string(obj_ini.loc[com][i])+"|"+string(unit.planet_location)+"|"; - if (search_location=t1) then match=true; - } - } - if (match){ - count++; - if (return_type=="units"){ - array_push(units, unit); - } - } - } - } + if (coom<0) then repeat(11){ + for (var i=0;i-1)) then match=true; + + if (search_location!="home") and (search_location!="field"){ + if (unit.role()=target_role){ + var t1=string(obj_ini.loc[com][i])+"|"+string(unit.planet_location)+"|"; + if (search_location=t1) then match=true; + } + } + if (match){ + count++; + if (return_type=="units"){ + array_push(units, unit); + } + } + } + com+=1; }