From 3081ce1cb4f7edb15ea1b0763220da1be67b59d0 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Fri, 4 Sep 2026 14:52:15 +0100 Subject: [PATCH 01/22] Remove all big mofo refs --- objects/obj_ncombat/Alarm_1.gml | 108 ++++++++++-------- objects/obj_ncombat/Create_0.gml | 4 +- scripts/scr_civil_roster/scr_civil_roster.gml | 16 +-- scripts/scr_roster/scr_roster.gml | 30 ----- scripts/scr_ship_battle/scr_ship_battle.gml | 28 +---- 5 files changed, 66 insertions(+), 120 deletions(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 56bfaf50c5..7b2fab85d4 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -589,8 +589,25 @@ if ((fortified > 1) && !dropping && !(enemy == eFACTION.CHAOS && threat == 7)) { combat_log.push(_newline, _newline_color); } +var _roles = active_roles(); +var _speech_giver_role_priority = [ + _roles[eROLE.CHAPTER_MASTER], + "Master of Sanctity", + "Chief " + _roles[eROLE.LIBRARIAN], + _roles[eROLE.CAPTAIN], + _roles[eROLE.CHAPLAIN], +] + +var _speech_giver_role = -1; +var for ( var i = 0; i < array_length(_speech_giver_role_priority); i++){ + if (player_unit_index.has_role(_speech_giver_role_priority[i])){ + _speech_giver_role = i; + break; + } +} + // Check for battlecry here -if ((temp >= 100) && (threat > 1) && (big_mofo > 0) && (big_mofo < 10) && !dropping) { +if ((temp >= 100) && (threat > 1) && _speech_giver_role > -1 && !dropping) { p1 = ""; p2 = ""; p3 = ""; @@ -600,54 +617,49 @@ if ((temp >= 100) && (threat > 1) && (big_mofo > 0) && (big_mofo < 10) && !dropp temp4 = 0; temp5 = 0; - if (big_mofo == 1) { + var _r_name = _speech_giver_role_priority[_speech_giver_role]; + var _index = player_unit_index.role_index; + var _speech_giver = _index[$ _r_name][0]; + + var _cm_giving_speech = _speech_giver_role == 0; + if (_cm_giving_speech) { p1 = "You "; - } - if (big_mofo == 2) { - p1 = "The Master of Sanctity "; - } - if (big_mofo == 3) { - p1 = "Chief " + string(obj_ini.player_role_data[eROLE.LIBRARIAN].role) + " "; - } - if (big_mofo == 5) { - p1 = "A Captain "; - } - if (big_mofo == 8) { - p1 = "A Chaplain "; + } else { + p1 = _speech_giver.name_role(); } var standard_cry = 0; if (global.chapter_name == "Salamanders") { standard_cry = 1; rand = choose(1, 2, 3, 4, 5); - if ((rand == 1) && (big_mofo != 1)) { + if ((rand == 1) && (_cm_giving_speech != 1)) { p2 = "breaks the silence, begining the Chapter Battlecry-"; } - if ((rand == 1) && (big_mofo == 1)) { + if ((rand == 1) && (_cm_giving_speech == 1)) { p2 = "break the silence, begining the Chapter Battlecry-"; } - if ((rand == 2) && (big_mofo != 1)) { + if ((rand == 2) && (_cm_giving_speech != 1)) { p2 = "roars the first half of the Chapter Battlecry-"; } - if ((rand == 2) && (big_mofo == 1)) { + if ((rand == 2) && (_cm_giving_speech == 1)) { p2 = "roar the first half of the Chapter Battlecry-"; } - if ((rand == 3) && (big_mofo != 1)) { + if ((rand == 3) && (_cm_giving_speech != 1)) { p2 = "shouts the start of the Chapter Battlecry-"; } - if ((rand == 3) && (big_mofo == 1)) { + if ((rand == 3) && (_cm_giving_speech == 1)) { p2 = "shout the start of the Chapter Battlecry-"; } - if ((rand == 4) && (big_mofo != 1)) { + if ((rand == 4) && (_cm_giving_speech != 1)) { p2 = "calls out to your marines-"; } - if ((rand == 4) && (big_mofo == 1)) { + if ((rand == 4) && (_cm_giving_speech == 1)) { p2 = "call out to your marines-"; } - if ((rand == 5) && (big_mofo != 1)) { + if ((rand == 5) && (_cm_giving_speech != 1)) { p2 = "roars to your marines-"; } - if ((rand == 5) && (big_mofo == 1)) { + if ((rand == 5) && (_cm_giving_speech == 1)) { p2 = "roar to your marines-"; } p3 = "''Into the fires of battle!''"; @@ -676,22 +688,22 @@ if ((temp >= 100) && (threat > 1) && (big_mofo > 0) && (big_mofo < 10) && !dropp if (obj_ini.battle_cry == "...") { standard_cry = 1; rand = choose(1, 2, 3); - if ((rand == 1) && (big_mofo != 1)) { + if ((rand == 1) && (_cm_giving_speech != 1)) { p2 = "remains silent as the Chapter forms for battle-"; } - if ((rand == 1) && (big_mofo == 1)) { + if ((rand == 1) && (_cm_giving_speech == 1)) { p2 = "remain silent as the Chapter forms for battle-"; } - if ((rand == 2) && (big_mofo != 1)) { + if ((rand == 2) && (_cm_giving_speech != 1)) { p2 = "remains silent and issues orders to the Chapter for battle-"; } - if ((rand == 2) && (big_mofo == 1)) { + if ((rand == 2) && (_cm_giving_speech == 1)) { p2 = "remain silent and issues orders to the Chapter for battle-"; } - if ((rand == 3) && (big_mofo != 1)) { + if ((rand == 3) && (_cm_giving_speech != 1)) { p2 = "issues orders to the Chapter over Vox-"; } - if ((rand == 3) && (big_mofo == 1)) { + if ((rand == 3) && (_cm_giving_speech == 1)) { p2 = "whisper to your brothers the plans for initial deployment over vox-"; } p3 = "''Sharp gestures and handsigns from officers direct the Marines''"; @@ -721,34 +733,34 @@ if ((temp >= 100) && (threat > 1) && (big_mofo > 0) && (big_mofo < 10) && !dropp if ((global.chapter_name == "Iron Warriors") && (global.custom == eCHAPTER_TYPE.PREMADE)) { standard_cry = 1; rand = choose(1, 2, 3, 4, 5); - if ((rand == 1) && (big_mofo != 1)) { + if ((rand == 1) && (_cm_giving_speech != 1)) { p2 = "breaks the silence, begining the Chapter Battlecry-"; } - if ((rand == 1) && (big_mofo == 1)) { + if ((rand == 1) && (_cm_giving_speech == 1)) { p2 = "break the silence, begining the Chapter Battlecry-"; } - if ((rand == 2) && (big_mofo != 1)) { + if ((rand == 2) && (_cm_giving_speech != 1)) { p2 = "roars the first half of the Chapter Battlecry-"; } - if ((rand == 2) && (big_mofo == 1)) { + if ((rand == 2) && (_cm_giving_speech == 1)) { p2 = "roar the first half of the Chapter Battlecry-"; } - if ((rand == 3) && (big_mofo != 1)) { + if ((rand == 3) && (_cm_giving_speech != 1)) { p2 = "shouts the start of the Chapter Battlecry-"; } - if ((rand == 3) && (big_mofo == 1)) { + if ((rand == 3) && (_cm_giving_speech == 1)) { p2 = "shout the start of the Chapter Battlecry-"; } - if ((rand == 4) && (big_mofo != 1)) { + if ((rand == 4) && (_cm_giving_speech != 1)) { p2 = "calls out to your marines-"; } - if ((rand == 4) && (big_mofo == 1)) { + if ((rand == 4) && (_cm_giving_speech == 1)) { p2 = "call out to your marines-"; } - if ((rand == 5) && (big_mofo != 1)) { + if ((rand == 5) && (_cm_giving_speech != 1)) { p2 = "roars to your marines-"; } - if ((rand == 5) && (big_mofo == 1)) { + if ((rand == 5) && (_cm_giving_speech == 1)) { p2 = "roar to your marines-"; } p3 = "''Iron within!''"; @@ -779,37 +791,37 @@ if ((temp >= 100) && (threat > 1) && (big_mofo > 0) && (big_mofo < 10) && !dropp standard_cry = 1; rand = choose(1, 2, 3, 4); if (rand == 1) { - if (big_mofo != 1) { + if (_cm_giving_speech != 1) { p2 = "breaks "; } - if (big_mofo == 1) { + if (_cm_giving_speech == 1) { p2 = "break "; } p2 += "the silence, calling out the Chapter Battlecry-"; } if (rand == 2) { - if (big_mofo != 1) { + if (_cm_giving_speech != 1) { p2 = "roars "; } - if (big_mofo == 1) { + if (_cm_giving_speech == 1) { p2 = "roar "; } p2 += "the Chapter Battlecry-"; } if (rand == 3) { - if (big_mofo != 1) { + if (_cm_giving_speech != 1) { p2 = "shouts "; } - if (big_mofo == 1) { + if (_cm_giving_speech == 1) { p2 = "shout "; } p2 += "the Chapter Battlecry-"; } if (rand == 4) { - if (big_mofo != 1) { + if (_cm_giving_speech != 1) { p2 = "roars "; } - if (big_mofo == 1) { + if (_cm_giving_speech == 1) { p2 = "roar "; } p2 += "to your marines-"; diff --git a/objects/obj_ncombat/Create_0.gml b/objects/obj_ncombat/Create_0.gml index a5facdb1f3..28f1a078d8 100644 --- a/objects/obj_ncombat/Create_0.gml +++ b/objects/obj_ncombat/Create_0.gml @@ -188,6 +188,8 @@ timer_maxspeed = 1; timer_pause = -1; turns = 1; + +player_unit_index = new UnitIndex([]); scouts = 0; tacticals = 0; veterans = 0; @@ -213,8 +215,6 @@ land_raiders = 0; land_speeders = 0; whirlwinds = 0; -big_mofo = 10; - enemy_dudes = ""; en_scouts = 0; diff --git a/scripts/scr_civil_roster/scr_civil_roster.gml b/scripts/scr_civil_roster/scr_civil_roster.gml index 9f8139ecec..188b5df66b 100644 --- a/scripts/scr_civil_roster/scr_civil_roster.gml +++ b/scripts/scr_civil_roster/scr_civil_roster.gml @@ -595,9 +595,7 @@ function scr_civil_roster(_unit_location, _target_location, _is_planet) { } if (_unit.role() == obj_ini.player_role_data[eROLE.CHAPLAIN].role) { new_combat.chaplains += 1; - if (new_combat.big_mofo > 5) { - new_combat.big_mofo = 5; - } + } col = obj_controller.bat_tactical_column; @@ -617,9 +615,7 @@ function scr_civil_roster(_unit_location, _target_location, _is_planet) { if ((_unit.role() == obj_ini.player_role_data[eROLE.CAPTAIN].role) || (_unit.role() == obj_ini.player_role_data[eROLE.ANCIENT].role) || (_unit.role() == obj_ini.player_role_data[eROLE.CHAMPION].role)) { if (_unit.role() == obj_ini.player_role_data[eROLE.CAPTAIN].role) { new_combat.captains += 1; - if (new_combat.big_mofo > 5) { - new_combat.big_mofo = 5; - } + } if (_unit.role() == obj_ini.player_role_data[eROLE.ANCIENT].role) { new_combat.standard_bearers += 1; @@ -652,7 +648,6 @@ function scr_civil_roster(_unit_location, _target_location, _is_planet) { if (_unit.role() == obj_ini.player_role_data[eROLE.CHAPTERMASTER].role) { col = obj_controller.bat_command_column; new_combat.important_dudes += 1; - new_combat.big_mofo = 1; if (string_count("0", _unit.specials) > 0) { new_combat.chapter_master_psyker = 1; } else { @@ -666,9 +661,7 @@ function scr_civil_roster(_unit_location, _target_location, _is_planet) { if (_unit.role() == "Master of Sanctity") { col = obj_controller.bat_command_column; new_combat.important_dudes += 1; - if (new_combat.big_mofo > 2) { - new_combat.big_mofo = 2; - } + } if (_unit.role() == "Master of the Apothecarion") { col = obj_controller.bat_command_column; @@ -677,9 +670,6 @@ function scr_civil_roster(_unit_location, _target_location, _is_planet) { if (_unit.role() == "Chief " + string(obj_ini.player_role_data[eROLE.LIBRARIAN].role)) { col = obj_controller.bat_command_column; new_combat.important_dudes += 1; - if (new_combat.big_mofo > 3) { - new_combat.big_mofo = 3; - } } if (col == 0) { diff --git a/scripts/scr_roster/scr_roster.gml b/scripts/scr_roster/scr_roster.gml index 82cc40d474..d88f9876b4 100644 --- a/scripts/scr_roster/scr_roster.gml +++ b/scripts/scr_roster/scr_roster.gml @@ -613,17 +613,6 @@ function add_unit_to_battle(unit, meeting, is_local) { if ((_unit_role == _role[15]) || (_unit_role == _role[14]) || unit.IsSpecialist(SPECIALISTS_TRAINEES)) { if (_unit_role == string(_role[14]) + " Aspirant") { col = obj_controller.bat_tactical_column; - new_combat.tacticals++; - } - - if (_unit_role == _role[15]) { - new_combat.apothecaries++; - } - if (_unit_role == _role[14]) { - new_combat.chaplains++; - if (new_combat.big_mofo > 5) { - new_combat.big_mofo = 5; - } } col = obj_controller.bat_tactical_column; @@ -638,18 +627,6 @@ function add_unit_to_battle(unit, meeting, is_local) { } if ((_unit_role == _role[5]) || (_unit_role == _role[11]) || (_unit_role == _role[7])) { - if (_unit_role == _role[5]) { - new_combat.captains++; - if (new_combat.big_mofo > 5) { - new_combat.big_mofo = 5; - } - } - if (_unit_role == _role[11]) { - new_combat.standard_bearers++; - } - if (_unit_role == _role[7]) { - new_combat.champions++; - } if (company >= 2) { col = obj_controller.bat_tactical_column; } @@ -664,7 +641,6 @@ function add_unit_to_battle(unit, meeting, is_local) { if (_unit_role == obj_ini.player_role_data[eROLE.CHAPTERMASTER].role) { col = obj_controller.bat_command_column; new_combat.important_dudes++; - new_combat.big_mofo = 1; if (string_count("0", unit.specials) > 0) { new_combat.chapter_master_psyker = 1; } else { @@ -675,12 +651,6 @@ function add_unit_to_battle(unit, meeting, is_local) { col = obj_controller.bat_command_column; new_combat.important_dudes++; } - if (new_combat.big_mofo > 2) { - new_combat.big_mofo = 2; - } - if (new_combat.big_mofo > 3) { - new_combat.big_mofo = 3; - } if (unit.squad != "none") { var squad = unit.get_squad(); switch (squad.formation_place) { diff --git a/scripts/scr_ship_battle/scr_ship_battle.gml b/scripts/scr_ship_battle/scr_ship_battle.gml index 5ea6960c0a..cd26e04585 100644 --- a/scripts/scr_ship_battle/scr_ship_battle.gml +++ b/scripts/scr_ship_battle/scr_ship_battle.gml @@ -47,62 +47,49 @@ function scr_ship_battle(target_ship_id, cooridor_width) { sofar += 1; var col = 0, targ = 0; + obj_ncombat.player_unit_index.add_to_index([_unit]); if (_unit.role() == obj_ini.player_role_data[eROLE.SCOUT].role) { col = obj_controller.bat_scout_column; - obj_ncombat.scouts += 1; } if (_unit.role() == obj_ini.player_role_data[eROLE.TACTICAL].role) { col = obj_controller.bat_tactical_column; - obj_ncombat.tacticals += 1; } if (_unit.role() == obj_ini.player_role_data[eROLE.VETERAN].role) { col = obj_controller.bat_veteran_column; - obj_ncombat.veterans += 1; } if (_unit.role() == obj_ini.player_role_data[eROLE.DEVASTATOR].role) { col = obj_controller.bat_devastator_column; - obj_ncombat.devastators += 1; } if (_unit.role() == obj_ini.player_role_data[eROLE.ASSAULT].role) { col = obj_controller.bat_assault_column; - obj_ncombat.assaults += 1; } if (_unit.role() == obj_ini.player_role_data[eROLE.LIBRARIAN].role) { col = obj_controller.bat_librarian_column; - obj_ncombat.librarians += 1; } if (_unit.role() == "Codiciery") { col = obj_controller.bat_librarian_column; - obj_ncombat.librarians += 1; } if (_unit.role() == "Epistolary") { col = obj_controller.bat_librarian_column; - obj_ncombat.librarians += 1; } if (_unit.role() == "Lexicanum") { col = obj_controller.bat_librarian_column; - obj_ncombat.librarians += 1; } if (_unit.role() == obj_ini.player_role_data[eROLE.TECHMARINE].role) { col = obj_controller.bat_techmarine_column; - obj_ncombat.techmarines += 1; } if (_unit.role() == obj_ini.player_role_data[eROLE.HONOURGUARD].role) { col = obj_controller.bat_honor_column; - obj_ncombat.honors += 1; } if (_unit.role() == obj_ini.player_role_data[eROLE.DREADNOUGHT].role) { col = obj_controller.bat_dreadnought_column; - obj_ncombat.dreadnoughts += 1; } if (_unit.role() == "Venerable " + string(obj_ini.player_role_data[eROLE.DREADNOUGHT].role)) { col = obj_controller.bat_dreadnought_column; - obj_ncombat.dreadnoughts += 1; } if (_unit.role() == obj_ini.player_role_data[eROLE.TERMINATOR].role) { col = obj_controller.bat_terminator_column; - obj_ncombat.terminators += 1; } if ((_unit.role() == obj_ini.player_role_data[eROLE.APOTHECARY].role) || (_unit.role() == obj_ini.player_role_data[eROLE.CHAPLAIN].role)) { @@ -111,9 +98,6 @@ function scr_ship_battle(target_ship_id, cooridor_width) { } if (_unit.role() == obj_ini.player_role_data[eROLE.CHAPLAIN].role) { obj_ncombat.chaplains += 1; - if (obj_ncombat.big_mofo > 5) { - obj_ncombat.big_mofo = 5; - } } col = obj_controller.bat_tactical_column; @@ -131,9 +115,6 @@ function scr_ship_battle(target_ship_id, cooridor_width) { if ((_unit.role() == obj_ini.player_role_data[eROLE.CAPTAIN].role) || (_unit.role() == obj_ini.player_role_data[eROLE.ANCIENT].role) || (_unit.role() == obj_ini.player_role_data[eROLE.CHAMPION].role)) { if (_unit.role() == obj_ini.player_role_data[eROLE.CAPTAIN].role) { obj_ncombat.captains += 1; - if (obj_ncombat.big_mofo > 5) { - obj_ncombat.big_mofo = 5; - } } if (_unit.role() == obj_ini.player_role_data[eROLE.ANCIENT].role) { obj_ncombat.standard_bearers += 1; @@ -165,7 +146,6 @@ function scr_ship_battle(target_ship_id, cooridor_width) { if (_unit.role() == obj_ini.player_role_data[eROLE.CHAPTERMASTER].role) { col = obj_controller.bat_command_column; obj_ncombat.important_dudes += 1; - obj_ncombat.big_mofo = 1; } if (_unit.role() == "Forge Master") { col = obj_controller.bat_command_column; @@ -174,9 +154,6 @@ function scr_ship_battle(target_ship_id, cooridor_width) { if (_unit.role() == "Master of Sanctity") { col = obj_controller.bat_command_column; obj_ncombat.important_dudes += 1; - if (obj_ncombat.big_mofo > 2) { - obj_ncombat.big_mofo = 2; - } } if (_unit.role() == "Master of the Apothecarion") { col = obj_controller.bat_command_column; @@ -185,9 +162,6 @@ function scr_ship_battle(target_ship_id, cooridor_width) { if (_unit.role() == "Chief " + string(obj_ini.player_role_data[eROLE.LIBRARIAN].role)) { col = obj_controller.bat_command_column; obj_ncombat.important_dudes += 1; - if (obj_ncombat.big_mofo > 3) { - obj_ncombat.big_mofo = 3; - } } if (_unit.role() == "Death Company") { From 5c18d3a73caaadd05c8f1cb403fd0f58dc966fd6 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Fri, 4 Sep 2026 15:08:32 +0100 Subject: [PATCH 02/22] remove redundant ship battle script --- ChapterMaster.yyp | 3 +- scripts/ArtifactStruct/ArtifactStruct.gml | 4 +- scripts/scr_roster/scr_roster.gml | 1 + scripts/scr_ship_battle/scr_ship_battle.gml | 185 -------------------- scripts/scr_ship_battle/scr_ship_battle.yy | 13 -- 5 files changed, 5 insertions(+), 201 deletions(-) delete mode 100644 scripts/scr_ship_battle/scr_ship_battle.gml delete mode 100644 scripts/scr_ship_battle/scr_ship_battle.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index e58c0a1a9b..c0ee777976 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -606,7 +606,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2026.100.0.1110", + "IDEVersion":"2026.100.0.1083", }, "name":"ChapterMaster", "resources":[ @@ -942,7 +942,6 @@ {"id":{"name":"scr_secret_lair_view","path":"scripts/scr_secret_lair_view/scr_secret_lair_view.yy",},}, {"id":{"name":"scr_serialization_functions","path":"scripts/scr_serialization_functions/scr_serialization_functions.yy",},}, {"id":{"name":"scr_shader_initialize","path":"scripts/scr_shader_initialize/scr_shader_initialize.yy",},}, - {"id":{"name":"scr_ship_battle","path":"scripts/scr_ship_battle/scr_ship_battle.yy",},}, {"id":{"name":"scr_ship_count","path":"scripts/scr_ship_count/scr_ship_count.yy",},}, {"id":{"name":"scr_ship_functions","path":"scripts/scr_ship_functions/scr_ship_functions.yy",},}, {"id":{"name":"scr_ship_occupants","path":"scripts/scr_ship_occupants/scr_ship_occupants.yy",},}, diff --git a/scripts/ArtifactStruct/ArtifactStruct.gml b/scripts/ArtifactStruct/ArtifactStruct.gml index a584cd8fd7..863aef044d 100644 --- a/scripts/ArtifactStruct/ArtifactStruct.gml +++ b/scripts/ArtifactStruct/ArtifactStruct.gml @@ -223,7 +223,9 @@ function ArtifactStruct(_type_name = "", _tags = [], _identification_timer = 0, instance_deactivate_object(obj_star); setup_battle_formations(); - scr_ship_battle(_resolved.ship_id, 999); + var _roster = new Roster(); + _roster.selected_units = collect_role_group("all", ["", 0, _resolved.ship_id], false, {}, false); + _roster.add_to_battle(); main_map_defaults(); } } diff --git a/scripts/scr_roster/scr_roster.gml b/scripts/scr_roster/scr_roster.gml index d88f9876b4..5c3d3a4bd1 100644 --- a/scripts/scr_roster/scr_roster.gml +++ b/scripts/scr_roster/scr_roster.gml @@ -694,6 +694,7 @@ function add_unit_to_battle(unit, meeting, is_local) { targ = instance_nearest(col * 10, 240, obj_pnunit); + obj_ncombat.player_unit_index.add_to_index([unit]); with (targ) { scr_add_unit_to_roster(unit, is_local); } diff --git a/scripts/scr_ship_battle/scr_ship_battle.gml b/scripts/scr_ship_battle/scr_ship_battle.gml deleted file mode 100644 index cd26e04585..0000000000 --- a/scripts/scr_ship_battle/scr_ship_battle.gml +++ /dev/null @@ -1,185 +0,0 @@ -/// @desc Builds the player roster for a boarding battle aboard the target ship. -/// @param {Real} target_ship_id Index into obj_ini.ship of the ship the battle is fought over. -/// @param {Real} cooridor_width Second ship index whose occupants also count as present. -/// @returns {Undefined} -function scr_ship_battle(target_ship_id, cooridor_width) { - // determine occupants - // determine who is fighting - // set maximum attacks due to hallway? - // set battle special - - // if (argument2=true){ - var sofar = 0; - - for (var co = 0; co < array_length(obj_ini.TTRPG); co++) { - var _company_length = company_length(co); - - for (var v = 0; v < _company_length; v++) { - var okay = 0; - var _unit = fetch_unit([co, v]); - if (!is_struct(_unit)) { - continue; - } - if ((_unit.ship_location == target_ship_id) && _unit.hp()) { - okay = 1; - } - if ((_unit.ship_location == cooridor_width) && (cooridor_width == cooridor_width) && _unit.hp()) { - okay = 1; - } - - if ((string_count("spyrer", obj_ncombat.battle_special) > 0) && _unit.is_dreadnought()) { - okay = 0; - } - if (string_count("spyrer", obj_ncombat.battle_special) > 0) { - if ((okay == 1) && (sofar > 2)) { - okay = 0; - } - } - if (string_count("Aspirant", _unit.role()) > 0) { - okay = 0; - } - - if (okay == 0) { - obj_ncombat.fighting[co][v] = 0; - } - if (okay == 1) { - obj_ncombat.fighting[co][v] = 1; - sofar += 1; - - var col = 0, targ = 0; - obj_ncombat.player_unit_index.add_to_index([_unit]); - - if (_unit.role() == obj_ini.player_role_data[eROLE.SCOUT].role) { - col = obj_controller.bat_scout_column; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.TACTICAL].role) { - col = obj_controller.bat_tactical_column; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.VETERAN].role) { - col = obj_controller.bat_veteran_column; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.DEVASTATOR].role) { - col = obj_controller.bat_devastator_column; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.ASSAULT].role) { - col = obj_controller.bat_assault_column; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.LIBRARIAN].role) { - col = obj_controller.bat_librarian_column; - } - if (_unit.role() == "Codiciery") { - col = obj_controller.bat_librarian_column; - } - if (_unit.role() == "Epistolary") { - col = obj_controller.bat_librarian_column; - } - if (_unit.role() == "Lexicanum") { - col = obj_controller.bat_librarian_column; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.TECHMARINE].role) { - col = obj_controller.bat_techmarine_column; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.HONOURGUARD].role) { - col = obj_controller.bat_honor_column; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.DREADNOUGHT].role) { - col = obj_controller.bat_dreadnought_column; - } - if (_unit.role() == "Venerable " + string(obj_ini.player_role_data[eROLE.DREADNOUGHT].role)) { - col = obj_controller.bat_dreadnought_column; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.TERMINATOR].role) { - col = obj_controller.bat_terminator_column; - } - - if ((_unit.role() == obj_ini.player_role_data[eROLE.APOTHECARY].role) || (_unit.role() == obj_ini.player_role_data[eROLE.CHAPLAIN].role)) { - if (_unit.role() == obj_ini.player_role_data[eROLE.APOTHECARY].role) { - obj_ncombat.apothecaries += 1; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.CHAPLAIN].role) { - obj_ncombat.chaplains += 1; - } - - col = obj_controller.bat_tactical_column; - if (_unit.armour() == "Terminator Armour") { - col = obj_controller.bat_terminator_column; - } - if (_unit.armour() == "Tartaros Armour") { - col = obj_controller.bat_terminator_column; - } - if (co == 10) { - col = obj_controller.bat_scout_column; - } - } - - if ((_unit.role() == obj_ini.player_role_data[eROLE.CAPTAIN].role) || (_unit.role() == obj_ini.player_role_data[eROLE.ANCIENT].role) || (_unit.role() == obj_ini.player_role_data[eROLE.CHAMPION].role)) { - if (_unit.role() == obj_ini.player_role_data[eROLE.CAPTAIN].role) { - obj_ncombat.captains += 1; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.ANCIENT].role) { - obj_ncombat.standard_bearers += 1; - } - if (_unit.role() == obj_ini.player_role_data[eROLE.CHAMPION].role) { - obj_ncombat.champions += 1; - } - - if (co == 1) { - col = obj_controller.bat_veteran_column; - if (_unit.armour() == "Terminator Armour") { - col = obj_controller.bat_terminator_column; - } - if (_unit.armour() == "Tartaros Armour") { - col = obj_controller.bat_terminator_column; - } - } - if (co >= 2) { - col = obj_controller.bat_tactical_column; - } - if (co == 10) { - col = obj_controller.bat_scout_column; - } - if (_unit.mobility_item() == "Jump Pack") { - col = obj_controller.bat_assault_column; - } - } - - if (_unit.role() == obj_ini.player_role_data[eROLE.CHAPTERMASTER].role) { - col = obj_controller.bat_command_column; - obj_ncombat.important_dudes += 1; - } - if (_unit.role() == "Forge Master") { - col = obj_controller.bat_command_column; - obj_ncombat.important_dudes += 1; - } - if (_unit.role() == "Master of Sanctity") { - col = obj_controller.bat_command_column; - obj_ncombat.important_dudes += 1; - } - if (_unit.role() == "Master of the Apothecarion") { - col = obj_controller.bat_command_column; - obj_ncombat.important_dudes += 1; - } - if (_unit.role() == "Chief " + string(obj_ini.player_role_data[eROLE.LIBRARIAN].role)) { - col = obj_controller.bat_command_column; - obj_ncombat.important_dudes += 1; - } - - if (_unit.role() == "Death Company") { - // Ahahahahah - col = max(obj_controller.bat_assault_column, obj_controller.bat_command_column, obj_controller.bat_honor_column, obj_controller.bat_dreadnought_column, obj_controller.bat_veteran_column); - } - - if (col == 0) { - col = obj_controller.bat_hire_column; - } - - targ = instance_nearest(col * 10, 240, obj_pnunit); - with (targ) { - scr_add_unit_to_roster(_unit); - } - } - } - } - - // } -} diff --git a/scripts/scr_ship_battle/scr_ship_battle.yy b/scripts/scr_ship_battle/scr_ship_battle.yy deleted file mode 100644 index b48ea0e572..0000000000 --- a/scripts/scr_ship_battle/scr_ship_battle.yy +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$GMScript":"v1", - "%Name":"scr_ship_battle", - "isCompatibility":false, - "isDnD":false, - "name":"scr_ship_battle", - "parent":{ - "name":"Combat", - "path":"folders/Scripts/Combat.yy", - }, - "resourceType":"GMScript", - "resourceVersion":"2.0", -} \ No newline at end of file From e7664b8b2063129cecf1a66cd4a4fc2bf9d4e963 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Fri, 4 Sep 2026 15:46:47 +0100 Subject: [PATCH 03/22] assivly reduce bloat using unitindex --- objects/obj_ncombat/Alarm_1.gml | 255 +++++++--------------- scripts/ArtifactStruct/ArtifactStruct.gml | 53 +++-- scripts/scr_UnitGroup/scr_UnitGroup.gml | 16 +- 3 files changed, 120 insertions(+), 204 deletions(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 7b2fab85d4..d02ec59842 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -32,10 +32,13 @@ var d7 = ""; var _newline = ""; var _newline_color = eMSG_COLOR.DEFAULT; -var temp = scouts + tacticals + veterans + devastators + assaults + librarians; -temp += techmarines + honors + dreadnoughts + terminators + captains; -temp += standard_bearers + champions + important_dudes + chaplains + apothecaries; -temp += sgts + vet_sgts; +var _marine_roles = active_roles(); +array_push(_marine_roles, "Forge Master"); +array_push(_marine_roles, "Master of Sanctity"); +array_push(_marine_roles, "Master of the Apothecarion"); +array_push(_marine_roles, $"Chief {obj_ini.player_role_data[eROLE.LIBRARIAN].role}"); + +_marine_count = player_unit_index.sum_roles(_marine_roles); // Random variations; dark out, rain pooling down, dawn shining off of the armour, etc. var variation = choose("", "dawn", "rain"); @@ -75,22 +78,22 @@ if (battle_special == "space_hulk") { if (battle_special == "") { if (!dropping) { - if (temp - dreadnoughts > 0) { + if (_marine_count - dreadnoughts > 0) { if (variation == "") { - p1 = "Dirt crunches beneath the soles of " + string(temp) + " " + string(global.chapter_name) + " as they form up. Your ranks are made up of "; + p1 = "Dirt crunches beneath the soles of " + string(_marine_count) + " " + string(global.chapter_name) + " as they form up. Your ranks are made up of "; } if (variation == "rain") { - p1 = "Rain pelts the ground and fogs the air, partly veiling the " + string(temp) + " " + string(global.chapter_name) + ". Your ranks are made up of "; + p1 = "Rain pelts the ground and fogs the air, partly veiling the " + string(_marine_count) + " " + string(global.chapter_name) + ". Your ranks are made up of "; } if (variation == "dawn") { - p1 = "The bright light of dawn reflects off the " + string_lower(color_descr) + " ceremite of " + string(temp) + " " + string(global.chapter_name) + ". Your ranks are made up of "; + p1 = "The bright light of dawn reflects off the " + string_lower(color_descr) + " ceremite of " + string(_marine_count) + " " + string(global.chapter_name) + ". Your ranks are made up of "; } } } if (dropping) { - if (temp - dreadnoughts > 0) { + if (_marine_count - dreadnoughts > 0) { // lyman - p1 = "The air rumbles and quakes as " + string(temp) + " " + string(global.chapter_name) + " descend in drop-pods. "; + p1 = "The air rumbles and quakes as " + string(_marine_count) + " " + string(global.chapter_name) + " descend in drop-pods. "; } } } @@ -162,131 +165,45 @@ if (string_count("_attack", battle_special) > 0) { exit; } -if ((tacticals > 0) && (veterans > 0)) { - p2 = string(tacticals + veterans) + " " + string(obj_ini.player_role_data[eROLE.TACTICAL].role) + "s, "; -} -if ((tacticals > 0) && (veterans == 0)) { - if (tacticals == 1) { - p2 = string(tacticals) + " " + string(obj_ini.player_role_data[eROLE.TACTICAL].role) + ", "; - } - if (tacticals > 1) { - p2 = string(tacticals) + " " + string(obj_ini.player_role_data[eROLE.TACTICAL].role) + "s, "; - } -} -if ((tacticals == 0) && (veterans > 0)) { - if (veterans == 1) { - p2 = string(veterans) + " " + string(obj_ini.player_role_data[eROLE.VETERAN].role) + ", "; - } - if (veterans > 1) { - p2 = string(veterans) + " " + string(obj_ini.player_role_data[eROLE.VETERAN].role) + "s, "; - } -} - -if (assaults > 0) { - if (assaults == 1) { - p2 += string(assaults) + " " + string(obj_ini.player_role_data[eROLE.ASSAULT].role) + ", "; - } - if (assaults > 1) { - p2 += string(assaults) + " " + string(obj_ini.player_role_data[eROLE.ASSAULT].role) + "s, "; - } -} -if (devastators > 0) { - if (devastators == 1) { - p2 += string(devastators) + " " + string(obj_ini.player_role_data[eROLE.DEVASTATOR].role) + ", "; - } - if (devastators > 1) { - p2 += string(devastators) + " " + string(obj_ini.player_role_data[eROLE.DEVASTATOR].role) + "s, "; - } -} - -if ((temp < 200) && (terminators > 0)) { - if (terminators == 1) { - p2 += string(terminators) + " Terminator, "; - } - if (terminators > 1) { - p2 += string(terminators) + " Terminators, "; - } -} - -if ((temp < 200) && (chaplains > 0)) { - if (chaplains == 1) { - p2 += string(chaplains) + " " + string(obj_ini.player_role_data[eROLE.CHAPLAIN].role) + ", "; - } - if (chaplains > 1) { - p2 += string(chaplains) + " " + string(obj_ini.player_role_data[eROLE.CHAPLAIN].role) + ", "; - } -} -if ((temp < 200) && (apothecaries > 0)) { - if (apothecaries == 1) { - p2 += string(apothecaries) + " " + string(obj_ini.player_role_data[eROLE.APOTHECARY].role) + ", "; - } - if (apothecaries > 1) { - p2 += string(apothecaries) + " " + string(obj_ini.player_role_data[eROLE.APOTHECARY].role) + ", "; - } -} -if ((temp < 200) && (librarians > 0)) { - if (librarians == 1) { - p2 += string(librarians) + " " + string(obj_ini.player_role_data[eROLE.LIBRARIAN].role) + ", "; - } - if (librarians > 1) { - p2 += string(librarians) + " " + string(obj_ini.player_role_data[eROLE.LIBRARIAN].role) + ", "; - } -} +p2 = ""; +var _auto_include = [ + _marine_roles[eROLE.TACTICAL], + _marine_roles[eROLE.VETERAN], + _marine_roles[eROLE.ASSAULT], + _marine_roles[eROLE.DEVASTATOR], +] -if ((temp < 200) && (techmarines > 0)) { - if (techmarines == 1) { - p2 += string(techmarines) + " " + string(obj_ini.player_role_data[eROLE.TECHMARINE].role) + ", "; - } - if (techmarines > 1) { - p2 += string(techmarines) + " " + string(obj_ini.player_role_data[eROLE.TECHMARINE].role) + ", "; - } -} -if ((temp < 200) && (sgts > 0)) { - if (techmarines == 1) { - p2 += string(techmarines) + " " + string(obj_ini.player_role_data[eROLE.SERGEANT].role) + ", "; - } - if (techmarines > 1) { - p2 += string(techmarines) + " " + string(obj_ini.player_role_data[eROLE.SERGEANT].role) + ", "; - } -} -if ((temp < 200) && (vet_sgts > 0)) { - if (techmarines == 1) { - p2 += string(techmarines) + " " + string(obj_ini.player_role_data[eROLE.VETERANSERGEANT].role) + ", "; - } - if (techmarines > 1) { - p2 += string(techmarines) + " " + string(obj_ini.player_role_data[eROLE.VETERANSERGEANT].role) + ", "; +for (var i = 0; i < array_length(_auto_include); i++){ + var _role = _auto_include[i]; + if (player_unit_index.role_count(_role) > 0){ + p2 += player_unit_index.plural_string_role(_role); } } -if (scouts > 0) { - if (scouts == 1) { - p2 += string(scouts) + " " + string(obj_ini.player_role_data[eROLE.SCOUT].role) + ", "; - } - if (scouts > 1) { - p2 += string(scouts) + " " + string(obj_ini.player_role_data[eROLE.SCOUT].role) + "s, "; +var _small_include = [ + _marine_roles[eROLE.TERINATOR], + _marine_roles[eROLE.CHAPLAIN], + _marine_roles[eROLE.APOTHECARY], + _marine_roles[eROLE.LIBRARIAN], + _marine_roles[eROLE.TECHMARINE], + _marine_roles[eROLE.SERGEANT], + _marine_roles[eROLE.VETERANSERGEANT], + _marine_roles[eROLE.SCOUT], +] +var _dread_count = player_unit_index.role_count(_marine_roles[eROLE.DREADNOUGHT]); +if (_marine_count < 200) { + for (var i = 0; i < array_length(_small_include); i++){ + var _role = _small_include[i]; + if (player_unit_index.role_count(_role) > 0){ + p2 += player_unit_index.plural_string_role(_role); + } } -} - -temp6 = honors + captains + important_dudes + standard_bearers; -if (temp >= 200) { - temp6 += terminators; -} -if (temp >= 200) { - temp6 += chaplains; -} -if (temp >= 200) { - temp6 += apothecaries; -} -if (temp >= 200) { - temp6 += techmarines; -} -if (temp >= 200) { - temp6 += librarians; -} -if (temp6 > 0) { - p2 += string(temp6) + " other various Astartes, "; +} else { + var _others = _marine_count - player_unit_index.sum_roles(_auto_include); + _others -= _dread_count; + p2 += string(_others) + " other various Astartes, "; } var woo = string_length(p2); @@ -303,52 +220,34 @@ if (string_count(", ", p2) == 1) { } p2 += "."; -if ((standard_bearers > 1) && (!dropping)) { +if ((player_unit_index.role_count(_marine_roles[eROLE.ANCIENT]) > 1) && (!dropping)) { p5 = " Chapter Ancients hold your Chapter heraldry high and proud."; } if (dreadnoughts + predators + land_raiders > 3) { p6 = " Forming up the armoured division is "; - if (dreadnoughts == 1) { - p6 += string(dreadnoughts) + " " + string(obj_ini.player_role_data[eROLE.DREADNOUGHT].role) + ", "; - } - if (dreadnoughts > 1) { - p6 += string(dreadnoughts) + " " + string(obj_ini.player_role_data[eROLE.DREADNOUGHT].role) + "s, "; + if (_dread_count > 0) { + p6 += player_unit_index.plural_string_role(_marine_roles[eROLE.DREADNOUGHT]); } - if (rhinos == 1) { - p6 += string(rhinos) + " Rhino, "; + if (rhinos > 0) { + string_plural_count("Rhino", rhinos); } - if (rhinos > 1) { - p6 += string(rhinos) + " Rhinos, "; + + if (predators > 0) { + string_plural_count("Predator", predators); } - if (predators == 1) { - p6 += string(predators) + " Predator, "; - } - if (predators > 1) { - p6 += string(predators) + " Predators, "; - } - - if (land_raiders == 1) { - p6 += string(land_raiders) + " Land Raider, "; - } - if (land_raiders > 1) { - p6 += string(land_raiders) + " Land Raiders, "; + if (land_raiders > 0) { + string_plural_count("Land Raider", land_raiders); } - if (land_speeders == 1) { - p6 += string(land_speeders) + " Land Speeder, "; - } - if (land_speeders > 1) { - p6 += string(land_speeders) + " Land Speeders, "; + if (land_speeders > 0) { + string_plural_count("Land Speeder", land_speeders); } - if (whirlwinds == 1) { - p6 += string(whirlwinds) + " Whirlwind, "; - } - if (whirlwinds > 1) { - p6 += string(whirlwinds) + " Whirlwinds, "; + if (whirlwinds > 0) { + string_plural_count("Whirlwind", whirlwinds); } // Other vehicles here? @@ -607,7 +506,7 @@ var for ( var i = 0; i < array_length(_speech_giver_role_priority); i++){ } // Check for battlecry here -if ((temp >= 100) && (threat > 1) && _speech_giver_role > -1 && !dropping) { +if ((_marine_count >= 100) && (threat > 1) && _speech_giver_role > -1 && !dropping) { p1 = ""; p2 = ""; p3 = ""; @@ -663,16 +562,16 @@ if ((temp >= 100) && (threat > 1) && _speech_giver_role > -1 && !dropping) { p2 = "roar to your marines-"; } p3 = "''Into the fires of battle!''"; - if ((temp >= 100) && (temp < 200)) { + if ((_marine_count >= 100) && (_marine_count < 200)) { p4 = "Over a hundred Astartes roar in return, their voice one-"; } - if ((temp >= 200) && (temp < 400)) { + if ((_marine_count >= 200) && (_marine_count < 400)) { p4 = "Several hundred Astartes roar in return, their voice one-"; } - if ((temp >= 500) && (temp < 800)) { + if ((_marine_count >= 500) && (_marine_count < 800)) { p4 = "Your battle brothers echoe the cry, a massive sound felt more than heard-"; } - if (temp > 800) { + if (_marine_count > 800) { p4 = "The sound is deafening as the " + string(global.chapter_name) + " shout in unison-"; } p5 = "''UNTO THE ANVIL OF WAR!''"; @@ -707,16 +606,16 @@ if ((temp >= 100) && (threat > 1) && _speech_giver_role > -1 && !dropping) { p2 = "whisper to your brothers the plans for initial deployment over vox-"; } p3 = "''Sharp gestures and handsigns from officers direct the Marines''"; - if ((temp >= 100) && (temp < 200)) { + if ((_marine_count >= 100) && (_marine_count < 200)) { p4 = "Over a hundred Astartes nod in acknowledgement and move quickly-"; } - if ((temp >= 200) && (temp < 400)) { + if ((_marine_count >= 200) && (_marine_count < 400)) { p4 = "Several hundred Astartes nod in acknowledgement and move swiftly-"; } - if ((temp >= 500) && (temp < 800)) { + if ((_marine_count >= 500) && (_marine_count < 800)) { p4 = "Your battle brothers all nod in acknowledgement and move hastily-"; } - if (temp > 800) { + if (_marine_count > 800) { p4 = "The fluidity is astounding as the " + string(global.chapter_name) + " move seamlessly into position ready for battle-"; } p5 = "''They stand ready to engage the enemy''"; @@ -764,16 +663,16 @@ if ((temp >= 100) && (threat > 1) && _speech_giver_role > -1 && !dropping) { p2 = "roar to your marines-"; } p3 = "''Iron within!''"; - if ((temp >= 100) && (temp < 200)) { + if ((_marine_count >= 100) && (_marine_count < 200)) { p4 = "Over a hundred Astartes roar in return, their voice one-"; } - if ((temp >= 200) && (temp < 400)) { + if ((_marine_count >= 200) && (_marine_count < 400)) { p4 = "Several hundred Astartes roar in return, their voice one-"; } - if ((temp >= 500) && (temp < 800)) { + if ((_marine_count >= 500) && (_marine_count < 800)) { p4 = "Your battle brothers echoe the cry, a massive sound felt more than heard-"; } - if (temp > 800) { + if (_marine_count > 800) { p4 = "The sound is deafening as the " + string(global.chapter_name) + " shout in unison-"; } p5 = "''IRON WITHOUT!''"; @@ -827,19 +726,19 @@ if ((temp >= 100) && (threat > 1) && _speech_giver_role > -1 && !dropping) { p2 += "to your marines-"; } p3 = "''" + string(obj_ini.battle_cry) + "!''"; - if ((temp >= 100) && (temp < 200)) { + if ((_marine_count >= 100) && (_marine_count < 200)) { p4 = "Over a hundred Astartes echoe the cry or let out shouts of their own."; } - if ((temp >= 200) && (temp < 400)) { + if ((_marine_count >= 200) && (_marine_count < 400)) { p4 = "Several hundred Astartes roar in return, echoing the cry."; } - if ((temp >= 500) && (temp < 800)) { + if ((_marine_count >= 500) && (_marine_count < 800)) { p4 = "Your battle brothers echoe the cry, a massive sound felt more than heard."; } - if ((temp > 800) && (rand >= 3)) { + if ((_marine_count > 800) && (rand >= 3)) { p4 = "The sound is deafening as the " + string(global.chapter_name) + " add their voices."; } - if ((temp > 800) && (rand <= 2)) { + if ((_marine_count > 800) && (rand <= 2)) { p4 = "The sound is deafening as the " + string(global.chapter_name) + " return the cry and magnify it a thousand times."; } _newline = p1 + p2; diff --git a/scripts/ArtifactStruct/ArtifactStruct.gml b/scripts/ArtifactStruct/ArtifactStruct.gml index 863aef044d..4171ed036e 100644 --- a/scripts/ArtifactStruct/ArtifactStruct.gml +++ b/scripts/ArtifactStruct/ArtifactStruct.gml @@ -205,31 +205,36 @@ function ArtifactStruct(_type_name = "", _tags = [], _identification_timer = 0, /// @desc Destroys the artifact. Daemonic artifacts destroyed while on a ship may trigger a demon summoning battle. /// @returns {Undefined} static destroy_artifact = function() { - if (has_tag("daemonic")) { - var _resolved = __resolve_location(); - if (_resolved.ship_id > -1) { - var demonSummonChance = roll_dice_chapter(1, 100, "high"); - - if ((demonSummonChance <= DEMON_SUMMON_THRESHOLD) && (obj_ini.ship_carrying[_resolved.ship_id] > 0)) { - instance_deactivate_all_safe(); - instance_activate_object(obj_star); - - /// @type {Asset.GMObject.obj_ncombat} - var _combat = instance_create_depth(0, 0, 0, obj_ncombat); - _combat.battle_special = "ship_demon"; - _combat.formation_set = 1; - _combat.enemy = DEMON_SUMMON_ENEMIES; - _combat.battle_id = _resolved.ship_id; - - instance_deactivate_object(obj_star); - setup_battle_formations(); - var _roster = new Roster(); - _roster.selected_units = collect_role_group("all", ["", 0, _resolved.ship_id], false, {}, false); - _roster.add_to_battle(); - main_map_defaults(); - } - } + if (!has_tag("daemonic")) { + return; + } + var _resolved = __resolve_location(); + + if (_resolved.ship_id == -1) { + return; } + + var _demonSummonChance = roll_dice_chapter(1, 100, "high"); + + if ((_demonSummonChance <= DEMON_SUMMON_THRESHOLD) && (obj_ini.ship_carrying[_resolved.ship_id] > 0)) { + instance_deactivate_all_safe(); + instance_activate_object(obj_star); + + /// @type {Asset.GMObject.obj_ncombat} + var _combat = instance_create_depth(0, 0, 0, obj_ncombat); + _combat.battle_special = "ship_demon"; + _combat.formation_set = 1; + _combat.enemy = DEMON_SUMMON_ENEMIES; + _combat.battle_id = _resolved.ship_id; + + instance_deactivate_object(obj_star); + setup_battle_formations(); + var _roster = new Roster(); + _roster.selected_units = collect_role_group("all", ["", 0, _resolved.ship_id], false, {}, false); + _roster.add_to_battle(); + main_map_defaults(); + } + }; /// @desc Unequips this artifact from its bearer, clearing the appropriate equipment slot. diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.gml b/scripts/scr_UnitGroup/scr_UnitGroup.gml index 0e80db3ed3..baac460790 100644 --- a/scripts/scr_UnitGroup/scr_UnitGroup.gml +++ b/scripts/scr_UnitGroup/scr_UnitGroup.gml @@ -541,9 +541,21 @@ function UnitIndex(units) constructor { add_to_index(units); static role_count = function(role) { - return array_length(role_index[$ role]); + return struct_exists(role_index, role) ? array_length(role_index[$ role]) : 0; }; + static plural_string_role(role,use_x = false) = function{ + return string_plural_count(role, role_count(role), false); + } + + static sum_roles = function(roles){ + var _sum = 0 + for (var i = 0; i < array_length(roles); i++){ + _sum += role_count(roles[i]); + } + return _sum; + } + static has_role = function(role) { return struct_exists(role_index, role) && array_length(role_index[$ role]) > 0; }; @@ -606,7 +618,7 @@ function UnitIndex(units) constructor { array_push(_strings_array, string(_keys[i])); } } else { - array_push(_strings_array, string_plural_count(_keys[i], role_count(_keys[i]), false)); + array_push(_strings_array, plural_string_role(_keys[i])); } } From 65301fb08c8fa4a68f013aceeada7f56e0408475 Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Fri, 4 Sep 2026 16:03:01 +0100 Subject: [PATCH 04/22] Update objects/obj_ncombat/Alarm_1.gml Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- objects/obj_ncombat/Alarm_1.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index d02ec59842..7644b17cfd 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -183,7 +183,7 @@ for (var i = 0; i < array_length(_auto_include); i++){ } var _small_include = [ - _marine_roles[eROLE.TERINATOR], + _marine_roles[eROLE.TERMINATOR], _marine_roles[eROLE.CHAPLAIN], _marine_roles[eROLE.APOTHECARY], _marine_roles[eROLE.LIBRARIAN], From 4875b633807a9feb9bf0e02a681b30cef7a17641 Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Fri, 4 Sep 2026 16:03:11 +0100 Subject: [PATCH 05/22] Update objects/obj_ncombat/Alarm_1.gml Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- objects/obj_ncombat/Alarm_1.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 7644b17cfd..5708d6aaa1 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -490,7 +490,7 @@ if ((fortified > 1) && !dropping && !(enemy == eFACTION.CHAOS && threat == 7)) { var _roles = active_roles(); var _speech_giver_role_priority = [ - _roles[eROLE.CHAPTER_MASTER], + _roles[eROLE.CHAPTERMASTER], "Master of Sanctity", "Chief " + _roles[eROLE.LIBRARIAN], _roles[eROLE.CAPTAIN], From 70f20ecfda8f9e3171f0631e8b7900dbcb2eca95 Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Fri, 4 Sep 2026 16:03:19 +0100 Subject: [PATCH 06/22] Update objects/obj_ncombat/Alarm_1.gml Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- objects/obj_ncombat/Alarm_1.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 5708d6aaa1..2af7a175cd 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -498,7 +498,7 @@ var _speech_giver_role_priority = [ ] var _speech_giver_role = -1; -var for ( var i = 0; i < array_length(_speech_giver_role_priority); i++){ +for (var i = 0; i < array_length(_speech_giver_role_priority); i++){ if (player_unit_index.has_role(_speech_giver_role_priority[i])){ _speech_giver_role = i; break; From 7107dc57cdd82754083908d397464900b6e75cdb Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Fri, 4 Sep 2026 16:03:41 +0100 Subject: [PATCH 07/22] Update scripts/scr_UnitGroup/scr_UnitGroup.gml Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- scripts/scr_UnitGroup/scr_UnitGroup.gml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.gml b/scripts/scr_UnitGroup/scr_UnitGroup.gml index baac460790..35929af58f 100644 --- a/scripts/scr_UnitGroup/scr_UnitGroup.gml +++ b/scripts/scr_UnitGroup/scr_UnitGroup.gml @@ -544,8 +544,8 @@ function UnitIndex(units) constructor { return struct_exists(role_index, role) ? array_length(role_index[$ role]) : 0; }; - static plural_string_role(role,use_x = false) = function{ - return string_plural_count(role, role_count(role), false); + static plural_string_role = function(role, use_x = false) { + return string_plural_count(role, role_count(role), use_x); } static sum_roles = function(roles){ From 7c80f5d2a79e1ab1dac4794fc032b19b376907ed Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Fri, 4 Sep 2026 16:04:03 +0100 Subject: [PATCH 08/22] Update objects/obj_ncombat/Alarm_1.gml Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- objects/obj_ncombat/Alarm_1.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 2af7a175cd..a8304c3705 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -38,7 +38,7 @@ array_push(_marine_roles, "Master of Sanctity"); array_push(_marine_roles, "Master of the Apothecarion"); array_push(_marine_roles, $"Chief {obj_ini.player_role_data[eROLE.LIBRARIAN].role}"); -_marine_count = player_unit_index.sum_roles(_marine_roles); +var _marine_count = player_unit_index.sum_roles(_marine_roles); // Random variations; dark out, rain pooling down, dawn shining off of the armour, etc. var variation = choose("", "dawn", "rain"); From 03f47c8bf8cb9d6b7b00c017493305906903e533 Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Fri, 4 Sep 2026 16:04:12 +0100 Subject: [PATCH 09/22] Update scripts/scr_UnitGroup/scr_UnitGroup.gml Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- scripts/scr_UnitGroup/scr_UnitGroup.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.gml b/scripts/scr_UnitGroup/scr_UnitGroup.gml index 35929af58f..789f521c88 100644 --- a/scripts/scr_UnitGroup/scr_UnitGroup.gml +++ b/scripts/scr_UnitGroup/scr_UnitGroup.gml @@ -549,7 +549,7 @@ function UnitIndex(units) constructor { } static sum_roles = function(roles){ - var _sum = 0 + var _sum = 0; for (var i = 0; i < array_length(roles); i++){ _sum += role_count(roles[i]); } From 2c6e9f77bc4333f7387bfdba145d11f2ec9a01bb Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Fri, 4 Sep 2026 16:04:23 +0100 Subject: [PATCH 10/22] Update scripts/ArtifactStruct/ArtifactStruct.gml Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- scripts/ArtifactStruct/ArtifactStruct.gml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ArtifactStruct/ArtifactStruct.gml b/scripts/ArtifactStruct/ArtifactStruct.gml index 4171ed036e..4ca10f31df 100644 --- a/scripts/ArtifactStruct/ArtifactStruct.gml +++ b/scripts/ArtifactStruct/ArtifactStruct.gml @@ -214,9 +214,9 @@ function ArtifactStruct(_type_name = "", _tags = [], _identification_timer = 0, return; } - var _demonSummonChance = roll_dice_chapter(1, 100, "high"); + var _demon_summon_chance = roll_dice_chapter(1, 100, "high"); - if ((_demonSummonChance <= DEMON_SUMMON_THRESHOLD) && (obj_ini.ship_carrying[_resolved.ship_id] > 0)) { + if ((_demon_summon_chance <= DEMON_SUMMON_THRESHOLD) && (obj_ini.ship_carrying[_resolved.ship_id] > 0)) { instance_deactivate_all_safe(); instance_activate_object(obj_star); From f01772fad8d6f8688c9bbffb7a95cee3c81aca11 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Fri, 4 Sep 2026 16:05:21 +0100 Subject: [PATCH 11/22] remove iportnatn dude references --- scripts/scr_civil_roster/scr_civil_roster.gml | 9 --------- scripts/scr_roster/scr_roster.gml | 2 -- 2 files changed, 11 deletions(-) diff --git a/scripts/scr_civil_roster/scr_civil_roster.gml b/scripts/scr_civil_roster/scr_civil_roster.gml index 188b5df66b..35d91ae2d3 100644 --- a/scripts/scr_civil_roster/scr_civil_roster.gml +++ b/scripts/scr_civil_roster/scr_civil_roster.gml @@ -316,22 +316,18 @@ function scr_civil_roster(_unit_location, _target_location, _is_planet) { if (_unit.role() == "Forge Master") { col = 22 - obj_controller.bat_command_column; - new_combat.en_important_dudes += 1; } if (_unit.role() == "Master of Sanctity") { col = 22 - obj_controller.bat_command_column; - new_combat.en_important_dudes += 1; if (new_combat.en_big_mofo > 2) { new_combat.en_big_mofo = 2; } } if (_unit.role() == "Master of the Apothecarion") { col = 22 - obj_controller.bat_command_column; - new_combat.en_important_dudes += 1; } if (_unit.role() == "Chief " + string(obj_ini.player_role_data[eROLE.LIBRARIAN].role)) { col = 22 - obj_controller.bat_command_column; - new_combat.en_important_dudes += 1; if (new_combat.en_big_mofo > 3) { new_combat.en_big_mofo = 3; } @@ -647,7 +643,6 @@ function scr_civil_roster(_unit_location, _target_location, _is_planet) { if (_unit.role() == obj_ini.player_role_data[eROLE.CHAPTERMASTER].role) { col = obj_controller.bat_command_column; - new_combat.important_dudes += 1; if (string_count("0", _unit.specials) > 0) { new_combat.chapter_master_psyker = 1; } else { @@ -656,20 +651,16 @@ function scr_civil_roster(_unit_location, _target_location, _is_planet) { } if (_unit.role() == "Forge Master") { col = obj_controller.bat_command_column; - new_combat.important_dudes += 1; } if (_unit.role() == "Master of Sanctity") { col = obj_controller.bat_command_column; - new_combat.important_dudes += 1; } if (_unit.role() == "Master of the Apothecarion") { col = obj_controller.bat_command_column; - new_combat.important_dudes += 1; } if (_unit.role() == "Chief " + string(obj_ini.player_role_data[eROLE.LIBRARIAN].role)) { col = obj_controller.bat_command_column; - new_combat.important_dudes += 1; } if (col == 0) { diff --git a/scripts/scr_roster/scr_roster.gml b/scripts/scr_roster/scr_roster.gml index 5c3d3a4bd1..3769ec7f17 100644 --- a/scripts/scr_roster/scr_roster.gml +++ b/scripts/scr_roster/scr_roster.gml @@ -640,7 +640,6 @@ function add_unit_to_battle(unit, meeting, is_local) { if (_unit_role == obj_ini.player_role_data[eROLE.CHAPTERMASTER].role) { col = obj_controller.bat_command_column; - new_combat.important_dudes++; if (string_count("0", unit.specials) > 0) { new_combat.chapter_master_psyker = 1; } else { @@ -649,7 +648,6 @@ function add_unit_to_battle(unit, meeting, is_local) { } if (unit.IsSpecialist(SPECIALISTS_HEADS)) { col = obj_controller.bat_command_column; - new_combat.important_dudes++; } if (unit.squad != "none") { var squad = unit.get_squad(); From e409c13f8001f3b571f8e41ad6d88d1a691752b0 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Fri, 4 Sep 2026 16:08:07 +0100 Subject: [PATCH 12/22] style changes --- objects/obj_ncombat/Alarm_1.gml | 4 ++-- scripts/ArtifactStruct/ArtifactStruct.gml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index a8304c3705..885b909c12 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -178,7 +178,7 @@ var _auto_include = [ for (var i = 0; i < array_length(_auto_include); i++){ var _role = _auto_include[i]; if (player_unit_index.role_count(_role) > 0){ - p2 += player_unit_index.plural_string_role(_role); + p2 += player_unit_index.plural_string_role(_role) + ", "; } } @@ -197,7 +197,7 @@ if (_marine_count < 200) { for (var i = 0; i < array_length(_small_include); i++){ var _role = _small_include[i]; if (player_unit_index.role_count(_role) > 0){ - p2 += player_unit_index.plural_string_role(_role); + p2 += player_unit_index.plural_string_role(_role) + ", "; } } } else { diff --git a/scripts/ArtifactStruct/ArtifactStruct.gml b/scripts/ArtifactStruct/ArtifactStruct.gml index 4ca10f31df..967510f57f 100644 --- a/scripts/ArtifactStruct/ArtifactStruct.gml +++ b/scripts/ArtifactStruct/ArtifactStruct.gml @@ -216,7 +216,7 @@ function ArtifactStruct(_type_name = "", _tags = [], _identification_timer = 0, var _demon_summon_chance = roll_dice_chapter(1, 100, "high"); - if ((_demon_summon_chance <= DEMON_SUMMON_THRESHOLD) && (obj_ini.ship_carrying[_resolved.ship_id] > 0)) { + if (_demon_summon_chance <= DEMON_SUMMON_THRESHOLD && obj_ini.ship_carrying[_resolved.ship_id] > 0) { instance_deactivate_all_safe(); instance_activate_object(obj_star); From 77036a4e3ca32b0fd5a296db6ea5f64c3b0101f2 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Fri, 4 Sep 2026 16:15:13 +0100 Subject: [PATCH 13/22] remove more legacy count variables --- objects/obj_ncombat/Alarm_1.gml | 9 +++++---- objects/obj_ncombat/Create_0.gml | 2 -- scripts/scr_roster/scr_roster.gml | 12 ------------ 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 885b909c12..42f5cdc68f 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -76,9 +76,11 @@ if (battle_special == "space_hulk") { } } +var _dread_count = player_unit_index.role_count(_marine_roles[eROLE.DREADNOUGHT]); + if (battle_special == "") { if (!dropping) { - if (_marine_count - dreadnoughts > 0) { + if (_marine_count - _dread_count > 0) { if (variation == "") { p1 = "Dirt crunches beneath the soles of " + string(_marine_count) + " " + string(global.chapter_name) + " as they form up. Your ranks are made up of "; } @@ -91,7 +93,7 @@ if (battle_special == "") { } } if (dropping) { - if (_marine_count - dreadnoughts > 0) { + if (_marine_count - _dread_count > 0) { // lyman p1 = "The air rumbles and quakes as " + string(_marine_count) + " " + string(global.chapter_name) + " descend in drop-pods. "; } @@ -192,7 +194,6 @@ var _small_include = [ _marine_roles[eROLE.VETERANSERGEANT], _marine_roles[eROLE.SCOUT], ] -var _dread_count = player_unit_index.role_count(_marine_roles[eROLE.DREADNOUGHT]); if (_marine_count < 200) { for (var i = 0; i < array_length(_small_include); i++){ var _role = _small_include[i]; @@ -224,7 +225,7 @@ if ((player_unit_index.role_count(_marine_roles[eROLE.ANCIENT]) > 1) && (!droppi p5 = " Chapter Ancients hold your Chapter heraldry high and proud."; } -if (dreadnoughts + predators + land_raiders > 3) { +if (_dread_count + predators + land_raiders > 3) { p6 = " Forming up the armoured division is "; if (_dread_count > 0) { p6 += player_unit_index.plural_string_role(_marine_roles[eROLE.DREADNOUGHT]); diff --git a/objects/obj_ncombat/Create_0.gml b/objects/obj_ncombat/Create_0.gml index 28f1a078d8..3cd7ddc0e1 100644 --- a/objects/obj_ncombat/Create_0.gml +++ b/objects/obj_ncombat/Create_0.gml @@ -206,8 +206,6 @@ champions = 0; important_dudes = 0; chaplains = 0; apothecaries = 0; -sgts = 0; -vet_sgts = 0; rhinos = 0; predators = 0; diff --git a/scripts/scr_roster/scr_roster.gml b/scripts/scr_roster/scr_roster.gml index 3769ec7f17..57093cbf0b 100644 --- a/scripts/scr_roster/scr_roster.gml +++ b/scripts/scr_roster/scr_roster.gml @@ -546,52 +546,40 @@ function add_unit_to_battle(unit, meeting, is_local) { if (_unit_role == obj_ini.player_role_data[eROLE.SERGEANT].role) { col = obj_controller.bat_tactical_column; //sergeants - new_combat.sgts++; } else if (_unit_role == _role[19]) { col = obj_controller.bat_veteran_column; - new_combat.vet_sgts++; } if (_unit_role == _role[12]) { //scouts col = obj_controller.bat_scout_column; - new_combat.scouts++; } else if (array_contains([obj_ini.player_role_data[eROLE.TACTICAL].role, $"{_role[15]} Aspirant", $"{_role[14]} Aspirant"], _unit_role)) { col = obj_controller.bat_tactical_column; //tactical_marines - new_combat.tacticals++; } else if (_unit_role == _role[3]) { //veterans and veteran sergeants col = obj_controller.bat_veteran_column; - new_combat.veterans++; } else if (_unit_role == _role[9]) { //devastators col = obj_controller.bat_devastator_column; - new_combat.devastators++; } else if (_unit_role == _role[10]) { //assualt marines col = obj_controller.bat_assault_column; - new_combat.assaults++; //librarium roles } else if (unit.IsSpecialist(SPECIALISTS_LIBRARIANS, true)) { col = obj_controller.bat_librarian_column; //librarium - new_combat.librarians++; moov = 1; } else if (_unit_role == _role[16]) { //techmarines col = obj_controller.bat_techmarine_column; - new_combat.techmarines++; moov = 2; } else if (_unit_role == _role[2]) { //honour guard col = obj_controller.bat_honor_column; - new_combat.honors++; } else if (unit.IsSpecialist(SPECIALISTS_DREADNOUGHTS)) { col = obj_controller.bat_dreadnought_column; //dreadnoughts - new_combat.dreadnoughts++; } else if (_unit_role == obj_ini.player_role_data[eROLE.TERMINATOR].role) { //terminators col = obj_controller.bat_terminator_column; - new_combat.terminators++; } if (moov > 0) { From bcb156aee944be5cba5f086266f8944162ad1a56 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Fri, 4 Sep 2026 16:51:07 +0100 Subject: [PATCH 14/22] support for ven dreads --- objects/obj_ncombat/Alarm_1.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 42f5cdc68f..99eb0e41ea 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -76,7 +76,7 @@ if (battle_special == "space_hulk") { } } -var _dread_count = player_unit_index.role_count(_marine_roles[eROLE.DREADNOUGHT]); +var _dread_count = player_unit_index.sum_roles([_marine_roles[eROLE.DREADNOUGHT], "Venerable" + _marine_roles[eROLE.DREADNOUGHT]]); if (battle_special == "") { if (!dropping) { From 7239d408623a7fb7a0a5c9c2e11c2cb154880e4b Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Fri, 4 Sep 2026 17:05:53 +0100 Subject: [PATCH 15/22] Update objects/obj_ncombat/Alarm_1.gml Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- objects/obj_ncombat/Alarm_1.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 99eb0e41ea..a0fb40ea7f 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -76,7 +76,7 @@ if (battle_special == "space_hulk") { } } -var _dread_count = player_unit_index.sum_roles([_marine_roles[eROLE.DREADNOUGHT], "Venerable" + _marine_roles[eROLE.DREADNOUGHT]]); +var _dread_count = player_unit_index.sum_roles([_marine_roles[eROLE.DREADNOUGHT], "Venerable " + _marine_roles[eROLE.DREADNOUGHT]]); if (battle_special == "") { if (!dropping) { From 927e3de43f87b340742b18daf63782fe2243be3c Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Fri, 4 Sep 2026 17:22:37 +0100 Subject: [PATCH 16/22] Apply suggestion from @cubic-dev-ai[bot] Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- scripts/ArtifactStruct/ArtifactStruct.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ArtifactStruct/ArtifactStruct.gml b/scripts/ArtifactStruct/ArtifactStruct.gml index 967510f57f..bc1081ed3d 100644 --- a/scripts/ArtifactStruct/ArtifactStruct.gml +++ b/scripts/ArtifactStruct/ArtifactStruct.gml @@ -210,7 +210,7 @@ function ArtifactStruct(_type_name = "", _tags = [], _identification_timer = 0, } var _resolved = __resolve_location(); - if (_resolved.ship_id == -1) { + if (_resolved.ship_id < 0) { return; } From 6f2b0f9fed8420d09620a764bb2e67e06503c66d Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Fri, 4 Sep 2026 21:59:33 +0100 Subject: [PATCH 17/22] Update ChapterMaster.yyp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- ChapterMaster.yyp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index c0ee777976..ea784310f0 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -606,7 +606,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2026.100.0.1083", + "IDEVersion":"2026.100.0.1110", }, "name":"ChapterMaster", "resources":[ From 3f7cff21b0b2ec2d697f02f17fc2f7ed3fc3e10b Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Fri, 4 Sep 2026 22:06:56 +0100 Subject: [PATCH 18/22] text formatting changes --- objects/obj_ncombat/Alarm_1.gml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index a0fb40ea7f..044d3948be 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -232,23 +232,23 @@ if (_dread_count + predators + land_raiders > 3) { } if (rhinos > 0) { - string_plural_count("Rhino", rhinos); + p6 += string_plural_count("Rhino", rhinos) + ", "; } if (predators > 0) { - string_plural_count("Predator", predators); + p6 += string_plural_count("Predator", predators) + ", "; } if (land_raiders > 0) { - string_plural_count("Land Raider", land_raiders); + p6 += string_plural_count("Land Raider", land_raiders) + ", "; } if (land_speeders > 0) { - string_plural_count("Land Speeder", land_speeders); + p6 += string_plural_count("Land Speeder", land_speeders) + ", "; } if (whirlwinds > 0) { - string_plural_count("Whirlwind", whirlwinds); + p6 += string_plural_count("Whirlwind", whirlwinds) + ", "; } // Other vehicles here? @@ -525,7 +525,7 @@ if ((_marine_count >= 100) && (threat > 1) && _speech_giver_role > -1 && !droppi if (_cm_giving_speech) { p1 = "You "; } else { - p1 = _speech_giver.name_role(); + p1 = _speech_giver.name_role() + " "; } var standard_cry = 0; From 90ab4d02996d03537aaf9aaf4bfef117ca1ec725 Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Sat, 5 Sep 2026 22:39:27 +0100 Subject: [PATCH 19/22] Update objects/obj_ncombat/Alarm_1.gml Co-authored-by: Nyx <80511023+The-Real-Nyx@users.noreply.github.com> --- objects/obj_ncombat/Alarm_1.gml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 044d3948be..f801627087 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -227,8 +227,12 @@ if ((player_unit_index.role_count(_marine_roles[eROLE.ANCIENT]) > 1) && (!droppi if (_dread_count + predators + land_raiders > 3) { p6 = " Forming up the armoured division is "; - if (_dread_count > 0) { - p6 += player_unit_index.plural_string_role(_marine_roles[eROLE.DREADNOUGHT]); +if (_dread_count > 0) { + p6 += string_plural_count( + _marine_roles[eROLE.DREADNOUGHT], + _dread_count, + false + ) + ", "; } if (rhinos > 0) { From 69fda5c39f78985592ac0ae007026c1aa3dae8ec Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Sat, 5 Sep 2026 22:40:31 +0100 Subject: [PATCH 20/22] Update objects/obj_ncombat/Alarm_1.gml Co-authored-by: Nyx <80511023+The-Real-Nyx@users.noreply.github.com> --- objects/obj_ncombat/Alarm_1.gml | 45 ++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index f801627087..75320c2b24 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -204,7 +204,50 @@ if (_marine_count < 200) { } else { var _others = _marine_count - player_unit_index.sum_roles(_auto_include); _others -= _dread_count; - p2 += string(_others) + " other various Astartes, "; +p2 = ""; + +var _auto_include = [ + _marine_roles[eROLE.TACTICAL], + _marine_roles[eROLE.VETERAN], + _marine_roles[eROLE.ASSAULT], + _marine_roles[eROLE.DEVASTATOR], +]; + +for (var i = 0; i < array_length(_auto_include); i++) { + var _role = _auto_include[i]; + if (player_unit_index.role_count(_role) > 0) { + p2 += player_unit_index.plural_string_role(_role) + ", "; + } +} + +var _small_include = [ + _marine_roles[eROLE.TERMINATOR], + _marine_roles[eROLE.CHAPLAIN], + _marine_roles[eROLE.APOTHECARY], + _marine_roles[eROLE.LIBRARIAN], + _marine_roles[eROLE.TECHMARINE], + _marine_roles[eROLE.SERGEANT], + _marine_roles[eROLE.VETERANSERGEANT], + _marine_roles[eROLE.SCOUT], +]; + +var _other_count = _marine_count + - player_unit_index.sum_roles(_auto_include) + - _dread_count; + +if (_marine_count < 200) { + for (var i = 0; i < array_length(_small_include); i++) { + var _role = _small_include[i]; + if (player_unit_index.role_count(_role) > 0) { + p2 += player_unit_index.plural_string_role(_role) + ", "; + } + } + + _other_count -= player_unit_index.sum_roles(_small_include); +} + +if (_other_count > 0) { + p2 += $"{_other_count} other various Astartes, "; } var woo = string_length(p2); From 485c54deedb6bee578e031123351349bdd01540f Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Mon, 7 Sep 2026 12:46:44 +0100 Subject: [PATCH 21/22] review points --- objects/obj_ncombat/Alarm_1.gml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 75320c2b24..b09edf6422 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -33,10 +33,6 @@ var _newline = ""; var _newline_color = eMSG_COLOR.DEFAULT; var _marine_roles = active_roles(); -array_push(_marine_roles, "Forge Master"); -array_push(_marine_roles, "Master of Sanctity"); -array_push(_marine_roles, "Master of the Apothecarion"); -array_push(_marine_roles, $"Chief {obj_ini.player_role_data[eROLE.LIBRARIAN].role}"); var _marine_count = player_unit_index.sum_roles(_marine_roles); @@ -76,7 +72,7 @@ if (battle_special == "space_hulk") { } } -var _dread_count = player_unit_index.sum_roles([_marine_roles[eROLE.DREADNOUGHT], "Venerable " + _marine_roles[eROLE.DREADNOUGHT]]); +var _dread_count = player_unit_index.sum_roles([_marine_roles[eROLE.DREADNOUGHT]]); if (battle_special == "") { if (!dropping) { @@ -268,15 +264,17 @@ if ((player_unit_index.role_count(_marine_roles[eROLE.ANCIENT]) > 1) && (!droppi p5 = " Chapter Ancients hold your Chapter heraldry high and proud."; } -if (_dread_count + predators + land_raiders > 3) { - p6 = " Forming up the armoured division is "; if (_dread_count > 0) { + p6 = " Venerably inspiring the chapter stand " p6 += string_plural_count( _marine_roles[eROLE.DREADNOUGHT], _dread_count, false ) + ", "; - } +} + +if (predators + land_raiders > 3) { + p6 += " Forming up the armoured division is "; if (rhinos > 0) { p6 += string_plural_count("Rhino", rhinos) + ", "; From 2c3e3b5997d127521eb4c226496aac149457016b Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Mon, 7 Sep 2026 13:11:32 +0100 Subject: [PATCH 22/22] merge errors --- objects/obj_ncombat/Alarm_1.gml | 56 ++++++--------------------------- 1 file changed, 9 insertions(+), 47 deletions(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index b09edf6422..df6984930b 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -198,54 +198,16 @@ if (_marine_count < 200) { } } } else { - var _others = _marine_count - player_unit_index.sum_roles(_auto_include); - _others -= _dread_count; -p2 = ""; -var _auto_include = [ - _marine_roles[eROLE.TACTICAL], - _marine_roles[eROLE.VETERAN], - _marine_roles[eROLE.ASSAULT], - _marine_roles[eROLE.DEVASTATOR], -]; + var _other_count = _marine_count + - player_unit_index.sum_roles(_auto_include) + - _dread_count; -for (var i = 0; i < array_length(_auto_include); i++) { - var _role = _auto_include[i]; - if (player_unit_index.role_count(_role) > 0) { - p2 += player_unit_index.plural_string_role(_role) + ", "; + if (_other_count > 0) { + p2 += $"{_other_count} other various Astartes, "; } } -var _small_include = [ - _marine_roles[eROLE.TERMINATOR], - _marine_roles[eROLE.CHAPLAIN], - _marine_roles[eROLE.APOTHECARY], - _marine_roles[eROLE.LIBRARIAN], - _marine_roles[eROLE.TECHMARINE], - _marine_roles[eROLE.SERGEANT], - _marine_roles[eROLE.VETERANSERGEANT], - _marine_roles[eROLE.SCOUT], -]; - -var _other_count = _marine_count - - player_unit_index.sum_roles(_auto_include) - - _dread_count; - -if (_marine_count < 200) { - for (var i = 0; i < array_length(_small_include); i++) { - var _role = _small_include[i]; - if (player_unit_index.role_count(_role) > 0) { - p2 += player_unit_index.plural_string_role(_role) + ", "; - } - } - - _other_count -= player_unit_index.sum_roles(_small_include); -} - -if (_other_count > 0) { - p2 += $"{_other_count} other various Astartes, "; -} - var woo = string_length(p2); p2 = string_delete(p2, woo - 1, 2); @@ -265,12 +227,12 @@ if ((player_unit_index.role_count(_marine_roles[eROLE.ANCIENT]) > 1) && (!droppi } if (_dread_count > 0) { - p6 = " Venerably inspiring the chapter stand " + p6 = " Venerably inspiring the chapter stand "; p6 += string_plural_count( _marine_roles[eROLE.DREADNOUGHT], _dread_count, false - ) + ", "; + ) + "."; } if (predators + land_raiders > 3) { @@ -537,8 +499,8 @@ if ((fortified > 1) && !dropping && !(enemy == eFACTION.CHAOS && threat == 7)) { var _roles = active_roles(); var _speech_giver_role_priority = [ _roles[eROLE.CHAPTERMASTER], - "Master of Sanctity", - "Chief " + _roles[eROLE.LIBRARIAN], + _roles[eROLE.MASTERCHAPLAIN], + _roles[eROLE.CHIEFLIBRARIAN], _roles[eROLE.CAPTAIN], _roles[eROLE.CHAPLAIN], ]