From 099a82efd387115941414823ec80e58a0054704f Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 7 Dec 2025 20:20:57 +0000 Subject: [PATCH 01/93] multipart questing --- objects/obj_en_fleet/Create_0.gml | 1 + .../scr_fleet_functions.gml | 2 +- .../scr_forge_world_functions.gml | 24 ++++--- .../scr_imperial_navy_functions.gml | 14 +++++ .../scr_marine_struct/scr_marine_struct.gml | 31 +++++++-- .../scr_mission_functions.gml | 63 ++++++++++++++++--- .../scr_roman_numerals/scr_roman_numerals.gml | 7 ++- 7 files changed, 119 insertions(+), 23 deletions(-) diff --git a/objects/obj_en_fleet/Create_0.gml b/objects/obj_en_fleet/Create_0.gml index 9d4dedc716..1fa49d218f 100644 --- a/objects/obj_en_fleet/Create_0.gml +++ b/objects/obj_en_fleet/Create_0.gml @@ -22,6 +22,7 @@ ii_check=floor(random(5))+1; etah=0; safe=0; last_turn_check = 0; +uid = scr_uuid_generate(); //TODO set up special save method for faction specific fleet variables inquisitor=-1; diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index ee1e9f941a..e12876aad0 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -49,7 +49,7 @@ function fleets_next_location(fleet = "none", visited = []) { array_push(visited, fleet.id); // Check if the fleet has a 'target' variable - if (variable_instance_exists(fleet, "target")) { + if (action != "" && variable_instance_exists(fleet, "target")) { // If the target is valid and not already in the visited list, proceed recursively var fleet_target_valid = scr_valid_fleet_target(fleet.target); if (!fleet_target_valid) { diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index cb8caf3b9e..34e2b21182 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -3,12 +3,7 @@ function imperial_navy_fleet_construction(){ // ** Check number of navy fleets ** - var new_navy_fleets = []; - with(obj_en_fleet){ - if (owner==eFACTION.Imperium) and (navy==1) { - array_push(new_navy_fleets, id); - } - } + var new_navy_fleets = get_imperial_navy_fleets(); //delete navy fleets if more than required var navy_fleet_count = array_length(new_navy_fleets); var cur_fleet; @@ -22,12 +17,16 @@ function imperial_navy_fleet_construction(){ navy_fleet_count--; array_delete(new_navy_fleets, i, 1); i--; - if (navy_fleet_count<=target_navy_number) then break; + if (navy_fleet_count<=target_navy_number){ + break; + } } } //if system needs more navy fleets get forge world to make some } else if (navy_fleet_count 15 && array_length(_navy_fleets)){ + _pop_data = { + trophy_owner : array_random_element(_successful_hunters), + system: self.name, + planet : targ_planet, + target_fleet : array_random_element(_navy_fleets) + }; + + var _options = { + choice_func : init_deliver_trophy_mission, + str1 : "Continue", + } + } if (_success){ _mission_string = $"The mission was a success and a great number of beasts rounded up and slain, your marines were able to gain great skills and the prestige of your chapter has increased greatly across the planets populace." if (_deaths){ @@ -532,13 +549,45 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ _mission_string = $"The mission was a failiure. The governor is disapointed and the legend of your chapter has undoubtedly been diminished"; _mission_string += $"\n{_unit_report_string}"; } - scr_popup($"Beast Hunt on {planet_numeral_name(i)}",_mission_string,"",""); + scr_popup($"Beast Hunt on {planet_numeral_name(i)}",_mission_string,"",_pop_data); remove_planet_problem(targ_planet, "hunt_beast"); + } else { remove_planet_problem(targ_planet, "hunt_beast"); } } +function init_deliver_trophy_mission(){ + text = $"After your marines return there is a great feast to honour them. Much fanfare is made of the great trophy {_pop_data.trophy_owner.name_role()} bears, a great monstrous head as tall as he is that the governor proclaims must be the largest of it's kind and the momst fearsome beast in the sector."; + + text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {_pop_data.system} Regiments and pleads that the trophy be delivered to his fleet in order to boost the moral of the regiments and fleet in general"; + + replace_options([ + { + str1 : "Refuse and place the trophy into the Librarium", + choice_func : function(){ + + } + + }, + { + str1 : "Accept", + choice_func : function(){ + text = $"You Send a reply to tell the commander you accept and will ensure the trophy is delivered in person by the marine that slew the beast"; + var _targ_fleet = pop_data.target_fleet; + + var _targ_fleet_intercept = fleets_next_location(_targ_fleet); + if (_targ_fleet.action==""){ + text += $"\n\n the fleet in question is currently active around the {_targ_fleet_intercept.name} system"; + } else { + text += $"\n\n the fleet will next be accessible around the {_targ_fleet_intercept.name} system"; + } + reset_popup_options(); + } + } + ]) + +} //TODO allow most of these functions to be condensed and allow arrays of problems or planets and maybe increase filtering options //filtering options could be done via universal methods that all the filters to be passed to many other game systems function has_any_problem_planet(planet, star="none"){ diff --git a/scripts/scr_roman_numerals/scr_roman_numerals.gml b/scripts/scr_roman_numerals/scr_roman_numerals.gml index 203470c107..2850803ae0 100644 --- a/scripts/scr_roman_numerals/scr_roman_numerals.gml +++ b/scripts/scr_roman_numerals/scr_roman_numerals.gml @@ -20,7 +20,7 @@ function int_to_roman(_num) { return ""; } - var _roman_numerals = [ + static _roman_numerals = [ 100, "C", 90, "XC", 50, "L", 40, "XL", 10, "X", 9, "IX", 5, "V", 4, "IV", 1, "I" ]; @@ -39,3 +39,8 @@ function int_to_roman(_num) { return _result; } + + +function irandom_numeral(max_val){ + return int_to_roman(irandom_range(1, max_val)); +} \ No newline at end of file From f16c6867d782252ed99e3d07820934d7c71df07d Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 9 Dec 2025 21:22:54 +0000 Subject: [PATCH 02/93] create FleetEvent constructor --- ChapterMaster.yyp | 1 + objects/obj_controller/Alarm_5.gml | 8 ++ objects/obj_en_fleet/Create_0.gml | 43 ++++++++++- objects/obj_en_fleet/Destroy_0.gml | 2 + scripts/instance_create/instance_create.gml | 5 ++ scripts/scr_fleet_events/scr_fleet_events.gml | 59 ++++++++++++++ scripts/scr_fleet_events/scr_fleet_events.yy | 13 ++++ .../scr_fleet_functions.gml | 12 +++ .../scr_load_controller.gml | 7 -- .../scr_mission_functions.gml | 76 ++++++++++++++++++- .../scr_save_controller.gml | 6 -- 11 files changed, 216 insertions(+), 16 deletions(-) create mode 100644 scripts/scr_fleet_events/scr_fleet_events.gml create mode 100644 scripts/scr_fleet_events/scr_fleet_events.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index 9ab5a14aed..71eb64e857 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -819,6 +819,7 @@ {"id":{"name":"scr_flavor","path":"scripts/scr_flavor/scr_flavor.yy",},}, {"id":{"name":"scr_flavor2","path":"scripts/scr_flavor2/scr_flavor2.yy",},}, {"id":{"name":"scr_fleet_advisor","path":"scripts/scr_fleet_advisor/scr_fleet_advisor.yy",},}, + {"id":{"name":"scr_fleet_events","path":"scripts/scr_fleet_events/scr_fleet_events.yy",},}, {"id":{"name":"scr_fleet_functions","path":"scripts/scr_fleet_functions/scr_fleet_functions.yy",},}, {"id":{"name":"scr_forge_world_functions","path":"scripts/scr_forge_world_functions/scr_forge_world_functions.yy",},}, {"id":{"name":"scr_garrison","path":"scripts/scr_garrison/scr_garrison.yy",},}, diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index 2dc4e54fd1..c676504a97 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -549,12 +549,20 @@ location_viewer.update_mission_log(); init_ork_waagh(); return_lost_ships_chance(); //complex route plotting for player fleets + +with (obj_en_fleet){ + if (array_length(events)){ + check_events(); + } +} + with (obj_p_fleet){ if (array_length(complex_route)>0 && action == ""){ set_new_player_fleet_course(complex_route); } } + }); if (helpful_places != false){ diff --git a/objects/obj_en_fleet/Create_0.gml b/objects/obj_en_fleet/Create_0.gml index 1fa49d218f..24b35af45d 100644 --- a/objects/obj_en_fleet/Create_0.gml +++ b/objects/obj_en_fleet/Create_0.gml @@ -23,6 +23,36 @@ etah=0; safe=0; last_turn_check = 0; uid = scr_uuid_generate(); + +events = []; + +add_event = function(event){ + event.fleet_uid = uid; + array_push(events, event); +} + +check_events = function(){ + for (var i=array_length(events)-1;i>=0;i--){ + var _event = events[i]; + + _event.turn_sequence(); + + if (_event.state == "destroy"){ + array_delete(events,i,1); + } + + } +} + +check_events_destructions = function(){ + for (var i=array_length(events)-1;i>=0;i--){ + var _event = events[i]; + + _event.destroy_sequence(); + + array_delete(events,i,1); + } +} //TODO set up special save method for faction specific fleet variables inquisitor=-1; @@ -103,7 +133,7 @@ serialize = function(){ return save_data; } deserialize = function(save_data){ - var exclusions = ["id","cargo_data"]; // skip automatic setting of certain vars, handle explicitly later + var exclusions = ["id","cargo_data","events"]; // skip automatic setting of certain vars, handle explicitly later // Automatic var setting var all_names = struct_get_names(save_data); @@ -132,6 +162,17 @@ deserialize = function(save_data){ } } + if (save_data, "events"){ + for (var i=0;i 0){ + timer--; + + if (timer == 0 ){ + if (struct_exists(self,"timer_end")){ + call_fleet_event_function(timer_end); + } + state = "destroy"; + } + } + } + + static destroy_sequence = function(){ + if (struct_exists(self , "destroy")){ + call_fleet_event_function(destroy); + } + } + + static call_fleet_event_function = function(_func_name){ + if (struct_exists(fleet_event_functions,_func_name)){ + fleet_event_functions[$ _func_name](); + } + } + + static fleet_event_functions = { + "deliver_trophy_mission_timed_out" : deliver_trophy_mission_timed_out, + "deliver_trophy_mission_fleet_destroyed" : deliver_trophy_mission_fleet_destroyed, + "deliver_trophy_end_turn_check" :deliver_trophy_end_turn_check, + } + + +} \ No newline at end of file diff --git a/scripts/scr_fleet_events/scr_fleet_events.yy b/scripts/scr_fleet_events/scr_fleet_events.yy new file mode 100644 index 0000000000..9ab241e722 --- /dev/null +++ b/scripts/scr_fleet_events/scr_fleet_events.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"scr_fleet_events", + "isCompatibility":false, + "isDnD":false, + "name":"scr_fleet_events", + "parent":{ + "name":"fleet", + "path":"folders/Scripts/fleet.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index e12876aad0..633f22b598 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -37,6 +37,18 @@ function scr_valid_fleet_target(target) { return valid; } +function get_fleet_uid = function(search_uid){ + var _fleet = -1; + with (obj_en_fleet){ + if (uid == search_uid){ + _fleet =id; + break; + } + } + + return _fleet; +} + function fleets_next_location(fleet = "none", visited = []) { var targ_location = "none"; diff --git a/scripts/scr_load_controller/scr_load_controller.gml b/scripts/scr_load_controller/scr_load_controller.gml index f20fc9877e..bbfaa523cf 100644 --- a/scripts/scr_load_controller/scr_load_controller.gml +++ b/scripts/scr_load_controller/scr_load_controller.gml @@ -325,13 +325,6 @@ function scr_load_controller(save_id){ obj_controller.turns_ignored[g]=ini_read_real("Factions","turns_ignored"+string(g),0); } // - var g;g=0; - repeat(50){g+=1; - obj_controller.quest[g]=ini_read_string("Ongoing","quest"+string(g),""); - obj_controller.quest_faction[g]=ini_read_real("Ongoing","quest_faction"+string(g),0); - obj_controller.quest_end[g]=ini_read_real("Ongoing","quest_end"+string(g),0); - } - // obj_controller.justmet=0; obj_controller.check_number=ini_read_real("Controller","check_number",0); obj_controller.year_fraction=ini_read_real("Controller","year_fraction",0); diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 23759c67a2..f09a9f95e6 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -559,7 +559,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ function init_deliver_trophy_mission(){ text = $"After your marines return there is a great feast to honour them. Much fanfare is made of the great trophy {_pop_data.trophy_owner.name_role()} bears, a great monstrous head as tall as he is that the governor proclaims must be the largest of it's kind and the momst fearsome beast in the sector."; - text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {_pop_data.system} Regiments and pleads that the trophy be delivered to his fleet in order to boost the moral of the regiments and fleet in general"; + text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {_pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; replace_options([ { @@ -582,12 +582,84 @@ function init_deliver_trophy_mission(){ text += $"\n\n the fleet will next be accessible around the {_targ_fleet_intercept.name} system"; } + pop_data.target_fleet = target_fleet.uid; + + var _fleet_event = new FleetEvent(pop_data); + + _fleet_event.turn_end = "deliver_trophy_end_turn_check"; + _fleet_event.destroy = "deliver_trophy_mission_fleet_destroyed"; + _fleet_event.timer_end = "deliver_trophy_mission_timed_out"; + + _fleet_event.timer = 120; + + _targ_fleet.add_event(_fleet_event); + + reset_popup_options(); } } - ]) + ]); + +} + + +///@mixin FleetEvent +function deliver_trophy_mission_timed_out(){ + scr_popup( + "Objective Forgotten", + $"It has been so long in the life of a mortal that the commanders that once saught your delivery of the trophy from the hunt on {event_data.system} have now all either died or moved to greener pastures. The trophy will instead remain in the chapters possession", + ); +} + +///@mixin FleetEvent +function deliver_trophy_mission_fleet_destroyed(){ + scr_popup( + "Fleet Destroyed", + $"With the Imperial Navy fleet containing the regiments from {event_data.system} destroyed there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", + ); +} + +///@mixin FleetEvent +function deliver_trophy_end_turn_check(){ + var _navy_fleet = get_fleet_uid(fleet_uid); + if (!instance_exists(_navy_fleet)){ + deliver_trophy_mission_fleet_destroyed(); + return; + } + + var _ratio =0; + with (_navy_fleet){ + _ratio = fleet_remaining_guard_ratio(); + } + + if (_ratio<=0){ + scr_popup( + "Regiments Destroyed ", + $"The guard Regiments from {event_data.system} serving in the imperial navy fleet have been annihilated wholesale there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", + ); + return; + } + if (is_orbiting(_navy_fleet)){ + var _nearest_player = instance_at_location(_navy_fleet.x,_navy_fleet.y,obj_p_fleet); + if (instance_exists(_nearest_player)){ + var _ships = fleet_full_ship_array(_nearest_player); + var _marine = get_unit_uid(event_data.trophy_owner); + var _present = _marine.is_at_location("", 0, _ships); + var _meet_point = _navy_fleet.orbiting; + if (_present){ + var _text = "{_marine.role(name)} is able to rendevous with the imperial navy at {_meet_point.name}." + _text += $" The guard regiments of {event_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns tmany of the regiments banners"; + scr_popup( + "Trophy Delivered ", + _text, + ); + } + } + } } + + //TODO allow most of these functions to be condensed and allow arrays of problems or planets and maybe increase filtering options //filtering options could be done via universal methods that all the filters to be passed to many other game systems function has_any_problem_planet(planet, star="none"){ diff --git a/scripts/scr_save_controller/scr_save_controller.gml b/scripts/scr_save_controller/scr_save_controller.gml index 787a93951b..d843523f49 100644 --- a/scripts/scr_save_controller/scr_save_controller.gml +++ b/scripts/scr_save_controller/scr_save_controller.gml @@ -219,12 +219,6 @@ function scr_save_controller(save_id){ } // var g;g=0; - repeat(50){g+=1; - ini_write_string("Ongoing","quest"+string(g),obj_controller.quest[g]); - ini_write_real("Ongoing","quest_faction"+string(g),obj_controller.quest_faction[g]); - ini_write_real("Ongoing","quest_end"+string(g),obj_controller.quest_end[g]); - } - var g;g=0; // ini_write_real("Controller","justmet",obj_controller.faction_justmet); ini_write_real("Controller","check_number",obj_controller.check_number); From 07a18967a50b0e919361a820b216a5bd29584e5e Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 10 Dec 2025 00:55:48 +0000 Subject: [PATCH 03/93] most of new mission --- .../scr_mission_functions.gml | 14 ++++++++++++-- .../scr_system_search_helpers.gml | 9 +++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index f09a9f95e6..c44ca82c7a 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -496,7 +496,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ _unit = _hunters[i]; _unit_pass = _tester.standard_test(_unit, "weapon_skill",10, ["beast"]); if (_unit_pass[0]){ - if (!_success) then _success=true; + _success=true; _largest_pass = max(_largest_pass,_unit_pass[1]); } if (_unit_pass[0]){ @@ -649,7 +649,17 @@ function deliver_trophy_end_turn_check(){ var _meet_point = _navy_fleet.orbiting; if (_present){ var _text = "{_marine.role(name)} is able to rendevous with the imperial navy at {_meet_point.name}." - _text += $" The guard regiments of {event_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns tmany of the regiments banners"; + _text += $" The guard regiments of {event_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns many of the regiments banners."; + _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.role(name)} spreading far and wide amoung guard regiments."; + var _roll = roll_dice_chapter(1, 100, "high"); + if (_roll>30 && _roll<70){ + //TODO would be cool to have this changed tobe a guard specific piece of equipment + _text += "In return for your labour and in honour of your chapter the commander of the guard division has a brand new Land Raider destined for the army diverted to your chapter"; + scr_add_vehicle("Land Raider"); + } else if (_roll>=70){ + scr_get_stars(true) + _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on " + } scr_popup( "Trophy Delivered ", _text, diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index c7d3ad3fee..8a29b737e4 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -172,14 +172,15 @@ function scr_get_stars(shuffled=false, ownership=[], types = []) { if (!_owner_sort && !_types_sort){ var _add = true; } else { - var _add = true + var _add = true; if (_owner_sort && !array_contains(ownership,owner)){ - _add = false + _add = false; } if (_add && _types_sort){ + _add = false; for (var i=1;i<=planets;i++){ - types = array_delete_value(types, p_type[i]); - if (!array_length(types)){ + if (array_contains(types,p_type[i])){ + _add = true; break; } } From 89b12727497110d2ce87f2a3eeff6af64a617094 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 10 Dec 2025 16:31:49 +0000 Subject: [PATCH 04/93] saving and loading and rest of mission --- objects/obj_en_fleet/Create_0.gml | 2 +- objects/obj_en_fleet/Destroy_0.gml | 3 +-- objects/obj_star/Create_0.gml | 5 ++++ scripts/scr_cheatcode/scr_cheatcode.gml | 6 ++++- .../scr_fleet_functions.gml | 4 +-- .../scr_marine_struct/scr_marine_struct.gml | 2 +- .../scr_mission_functions.gml | 27 ++++++++++++++----- .../scr_planetary_feature.gml | 12 ++++++--- .../scr_popup_functions.gml | 3 +++ .../scr_system_search_helpers.gml | 11 ++++++-- 10 files changed, 55 insertions(+), 20 deletions(-) diff --git a/objects/obj_en_fleet/Create_0.gml b/objects/obj_en_fleet/Create_0.gml index 24b35af45d..024096527a 100644 --- a/objects/obj_en_fleet/Create_0.gml +++ b/objects/obj_en_fleet/Create_0.gml @@ -162,7 +162,7 @@ deserialize = function(save_data){ } } - if (save_data, "events"){ + if (struct_exists(save_data, "events")){ for (var i=0;i1){ for (var i=1;i<=planets;i++){ - if(i=planet) then continue; + if (i=planet) then continue; if (p_owner[i]==eFACTION.Imperium){ enemy=i; break; @@ -167,7 +169,9 @@ function init_beast_hunt_mission(planet, star, mission_slot){ gar_pop.title=$"Marines assigned to hunt beasts around {numeral_name}"; gar_pop.text=$"The govornor of {numeral_name} Thanks you for the participation of your elite warriors in your execution of such a menial task.\n It would be best to send at least one amrine that has experience with such tasks"; //pip.image="event_march" - gar_pop.add_option("Happy Hunting"); + gar_pop.add_option({ + str1: "Happy Hunting" + }); gar_pop.image=""; gar_pop.cooldown=8; obj_controller.cooldown=20; @@ -501,7 +505,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ } if (_unit_pass[0]){ - var _unit_report_string += _unit.add_trait("beast_slayer",true, true); + _unit_report_string += _unit.add_trait("beast_slayer",true, true); array_push(_successful_hunters, _unit); } else { var _tough_check = _tester.standard_test(_unit, "constitution",_unit.luck); @@ -653,12 +657,21 @@ function deliver_trophy_end_turn_check(){ _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.role(name)} spreading far and wide amoung guard regiments."; var _roll = roll_dice_chapter(1, 100, "high"); if (_roll>30 && _roll<70){ - //TODO would be cool to have this changed tobe a guard specific piece of equipment + //TODO would be cool to have this changed to be a guard specific piece of equipment _text += "In return for your labour and in honour of your chapter the commander of the guard division has a brand new Land Raider destined for the army diverted to your chapter"; scr_add_vehicle("Land Raider"); } else if (_roll>=70){ - scr_get_stars(true) - _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on " + var _wanted_types = ["Ice","Desert","Agri","Lava","Death"]; + var _star = scr_get_stars(true,[],_wanted_types)[0]; + _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on {_star.name}."; + _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it befre you do"; + + var _planet = scr_get_planet_with_type(_wanted_types); + var _battle_ground = new NewPlanetFeature(P_features.AstartesBattleGround); + + _battle_ground.player_hidden = false; + + _star.add_feature(_planet,_battle_ground); } scr_popup( "Trophy Delivered ", diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index a793501f93..8df59e2640 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -26,7 +26,8 @@ enum P_features { Forge, Gene_Stealer_Cult, Mission, - OrkStronghold + OrkStronghold, + AstartesBattleGround }; @@ -60,13 +61,16 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{ hiding=true; name = global.name_generator.generate_genestealer_cult_name(); break; - case P_features.Necron_Tomb: + case P_features.Necron_Tomb: awake = 0; sealed = 0; - player_hidden = 1 + player_hidden = 1; planet_display = "Dormant Necron Tomb"; break; - + case P_features.AstartesBattleGround: + player_hidden = 1; + explored = 0; + break; case P_features.Secret_Base: base_type = base_types.Lair; inquis_hidden =1; diff --git a/scripts/scr_popup_functions/scr_popup_functions.gml b/scripts/scr_popup_functions/scr_popup_functions.gml index 51e9d9566c..8a2c3c2069 100644 --- a/scripts/scr_popup_functions/scr_popup_functions.gml +++ b/scripts/scr_popup_functions/scr_popup_functions.gml @@ -118,6 +118,9 @@ function add_option(option, if_empty = false,use_default_option = true){ return; } } + if (is_string(option)){ + option = {st1:option} + } if (is_array(option)){ for (var i=0;i Date: Thu, 11 Dec 2025 05:48:08 +0000 Subject: [PATCH 05/93] data mutation issues --- objects/obj_controller/Draw_0.gml | 2 +- objects/obj_timer/Create_0.gml | 2 - objects/obj_turn_end/Alarm_1.gml | 2 - scripts/instance_create/instance_create.gml | 6 +- scripts/is_specialist/is_specialist.gml | 4 +- .../scr_ChapterTraits/scr_ChapterTraits.gml | 4 - scripts/scr_Table/scr_Table.gml | 17 ++- scripts/scr_cheatcode/scr_cheatcode.gml | 20 ++- .../scr_draw_planet_features.gml | 5 +- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 5 - .../scr_fleet_functions.gml | 4 +- scripts/scr_hit/scr_hit.gml | 14 +- .../scr_inquisition_mission.gml | 1 - .../scr_marine_struct/scr_marine_struct.gml | 4 +- .../scr_mission_functions.gml | 114 ++++++++------- scripts/scr_recruit_data/scr_recruit_data.gml | 1 - scripts/scr_shoot/scr_shoot.gml | 1 - .../scr_string_functions.gml | 2 - .../scr_struct_functions.gml | 2 +- .../scr_system_search_helpers.gml | 2 - scripts/scr_trade/scr_trade.gml | 5 +- scripts/scr_trade_dep/scr_trade_dep.gml | 1 - scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml | 1 - .../scr_unit_quick_find_pane.gml | 132 +++++++++++------- 24 files changed, 206 insertions(+), 145 deletions(-) diff --git a/objects/obj_controller/Draw_0.gml b/objects/obj_controller/Draw_0.gml index c162cbd167..a95a526b23 100644 --- a/objects/obj_controller/Draw_0.gml +++ b/objects/obj_controller/Draw_0.gml @@ -35,7 +35,7 @@ try{ //star fleet edbug options spawn if (global.cheat_debug == true && mouse_check_button_pressed(mb_right)){ - if (!instances_exist_any([obj_turn_end,obj_ncombat,obj_fleet,obj_fleet_select,obj_popup,obj_star_select])){ + if (!instances_exist_any([obj_turn_end,obj_ncombat,obj_fleet,obj_fleet_select,obj_popup,obj_star_select]) && !scr_void_click()){ new_system_debug_popup(); } } \ No newline at end of file diff --git a/objects/obj_timer/Create_0.gml b/objects/obj_timer/Create_0.gml index c7bccb95c0..82763a34d9 100644 --- a/objects/obj_timer/Create_0.gml +++ b/objects/obj_timer/Create_0.gml @@ -5,9 +5,7 @@ end_function_args = []; execute_end_function = function() { if (is_method(end_function)) { - // show_debug_message("Executing Method!"); method_call(end_function, end_function_args); } - // show_debug_message("Killing Myself!"); instance_destroy(self); } diff --git a/objects/obj_turn_end/Alarm_1.gml b/objects/obj_turn_end/Alarm_1.gml index e8d9b3a34e..d0e3f25d14 100644 --- a/objects/obj_turn_end/Alarm_1.gml +++ b/objects/obj_turn_end/Alarm_1.gml @@ -13,7 +13,6 @@ if (_is_audience){ } } - show_debug_message(current_audience); if (obj_controller.menu != MENU.Diplomacy){ scr_toggle_diplomacy(); @@ -35,7 +34,6 @@ if (_is_audience){ } if (obj_controller.diplomacy!=6){ - //show_debug_message("new_intro"); scr_dialogue("intro"); } diff --git a/scripts/instance_create/instance_create.gml b/scripts/instance_create/instance_create.gml index 9b63e0a16b..cdeaa079f5 100644 --- a/scripts/instance_create/instance_create.gml +++ b/scripts/instance_create/instance_create.gml @@ -24,7 +24,7 @@ function instances_exist_any(instance_set = []){ return _exists; } -function instance_at_location(xx,yy,obj){ - var _nearest = instance_nearest(xx, yy, obj); - return (_nearest.x == xx && _nearest.y == yy) ? _nearest : -1; +function instance_at_location(xx,yy,obj_type){ + var _nearest = instance_nearest(xx, yy, obj_type); + return (_nearest.x == xx && _nearest.y == yy) ? _nearest : noone; } diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index d6718e8274..26ec8f1be5 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -405,6 +405,9 @@ function group_selection(group, selection_data={}) { unit = group[i]; add_man_to_manage_arrays(unit); + if (!struct_exists(selection_data , "purpose_code")){ + selection_data.purpose_code = "manage"; + } if (selection_data.purpose_code == "forge_assignment") { if (unit.job != "none") { if (unit.job.type == "forge" && unit.job.planet == selection_data.planet) { @@ -434,7 +437,6 @@ function group_selection(group, selection_data={}) { managing = -1; } } - show_debug_message($"manage_success {obj_controller.menu}"); } catch (_exception) { //handle and send player back to map handle_exception(_exception); diff --git a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml index 2e6e435f4d..b2bc7b9ca9 100644 --- a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml +++ b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml @@ -41,14 +41,12 @@ function ChapterTrait(_id, _name, _description, _points_cost, _meta = []) constr function Advantage(_id, _name, _description, _points_cost) : ChapterTrait(_id, _name, _description, _points_cost) constructor { static add = function(slot){ - show_debug_message($"Adding adv {name} to slot {slot} for points {points}"); obj_creation.adv[slot] = name; obj_creation.adv_num[slot] = id; obj_creation.points+=points; add_meta(); } static remove = function(slot){ - show_debug_message($"removing adv {name} from slot {slot} for points {points}"); obj_creation.adv[slot] = ""; obj_creation.points-=points; obj_creation.adv_num[slot]=0; @@ -72,7 +70,6 @@ function Advantage(_id, _name, _description, _points_cost) : ChapterTrait(_id, _ function Disadvantage(_id, _name, _description, _points_cost) : ChapterTrait(_id, _name, _description, _points_cost) constructor { static add = function(slot){ - show_debug_message($"Adding disadv {name} to slot {slot} for points {points}"); obj_creation.dis[slot] = name; obj_creation.dis_num[slot] = id; obj_creation.points-=points; @@ -80,7 +77,6 @@ function Disadvantage(_id, _name, _description, _points_cost) : ChapterTrait(_id } static remove = function(slot){ - show_debug_message($"Removing disadv {name} from slot {slot} for points {points}"); obj_creation.dis[slot] = ""; obj_creation.points+=points; obj_creation.dis_num[slot]=0; diff --git a/scripts/scr_Table/scr_Table.gml b/scripts/scr_Table/scr_Table.gml index 9bf8884c25..c30799a6d6 100644 --- a/scripts/scr_Table/scr_Table.gml +++ b/scripts/scr_Table/scr_Table.gml @@ -99,9 +99,20 @@ function Table(data) constructor{ //show_debug_message($"click : {struct_exists(_row,"click_left")}"); _row.hover(); } - if (_row_entered && struct_exists(_row,"click_left")){ - if (scr_click_left()){ - _row.click_left(); + if (_row_entered){ + if (struct_exists(_row,"hover")){ + //show_debug_message($"click : {struct_exists(_row,"click_left")}"); + _row.hover(); + } + if (struct_exists(_row,"click_left")){ + if (scr_click_left()){ + _row.click_left(); + } + } + if (struct_exists(_row,"click_right")){ + if (scr_click_right()){ + _row.click_right(); + } } } } diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 6875e53827..7a1d6c21a9 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -519,7 +519,25 @@ function draw_planet_debug_problems(){ with (target){ scr_new_governor_mission(obj_controller.selecting_planet,"hunt_beast"); } - break; + break; + case "deliver_trophy": + var _unit = fetch_unit(scr_random_marine("",0)); + var _navy_fleets = get_imperial_navy_fleets(); + var _pop_data = { + trophy_owner : _unit, + system: target.name, + planet : obj_controller.selecting_planet, + target_fleet : array_random_element(_navy_fleets) + } + + var _pop = instance_create(0,0,obj_popup); + + _pop.pop_data = _pop_data; + + with (_pop){ + init_deliver_trophy_mission(); + } + break; default: scr_popup("error","no specific debug action created please consider helping to make one",""); break; diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index 32ea1b2f2d..b4a2f3ba91 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -31,9 +31,11 @@ function FeatureSelected(Feature, system, planet) constructor{ } draw_planet_features = function(xx,yy){ + add_draw_return_values(); draw_set_halign(fa_center); + draw_set_valign(fa_top); draw_set_font(fnt_40k_14); - //draw_sprite(spr_planet_screen,0,xx,yy); + //draw_sprite(spr_planset_screen,0,xx,yy); if (exit_sequence){ xx-=(25*exit_count); main_slate.draw(xx,yy, 1.38,1.38); @@ -338,6 +340,7 @@ function FeatureSelected(Feature, system, planet) constructor{ draw_set_color(c_gray); draw_text_ext(xx+10, yy+40,body,-1,area_width-20); } + pop_draw_return_values(); return "done"; } } diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 1a05acc620..f3b4a3e6bd 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -10,7 +10,6 @@ function scr_enemy_ai_a() { // guardsmen hop from planet to planet //not sure we really need this as it's handled with tht navy fleet functions but fuck it updated it and leaving it fot the sec if (system_guard_total()>0 && present_fleet[eFACTION.Imperium]){ - show_debug_message($"system_has_guard {p_guardsmen}"); var cur_planet=0,most_enemies_found=0,current_guard_planet=0,most_enemies_planet=0; var _guard_planets = guard_find_planet_with_most_enemy_forces(self); @@ -22,7 +21,6 @@ function scr_enemy_ai_a() { p_guardsmen[_current] = 0; } - show_debug_message($"system_has_guard {p_guardsmen}"); } if (obj_controller.faction_defeated[10]>0) and (obj_controller.faction_gender[10]=2){ @@ -288,7 +286,6 @@ function scr_enemy_ai_a() { var _active_garrison = pdf_with_player && garrison.viable_garrison>0; // Guard attack if (guard_score>0) and (guard_attack!="") and (guard_score>0.5){ - show_debug_message($"{name}:{guard_attack}") if (guard_attack="ork") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork]; if (guard_attack="tau") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Tau]; if (guard_attack="traitors") then tempor=choose(1,2,3,4,5,6)*traitors_score; @@ -311,7 +308,6 @@ function scr_enemy_ai_a() { } rand1=(choose(3,4,5,6)*guard_score)*choose(1,1.25,1.25); rand2=(pdf_mod*pdf_score)*choose(1,1.25); - show_debug_message($"{name} guard attack guard_Win:{rand1>rand2}"); if (rand1>rand2){ var _pdf_before = p_pdf[_run]; if (guard_score<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.7+pdf_loss_reduction))); @@ -379,7 +375,6 @@ function scr_enemy_ai_a() { if (pdf_attack=="guard"){ rand2=(choose(1,2,3,4,5,6)*guard_score)*choose(1,1.25,2); - show_debug_message($"{name} : pdf attack ,pdf win {rand1>rand2}"); if (rand1>rand2){ if (pdf_score<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.7); if (pdf_score>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 5940e5e1c8..398de98533 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -19,7 +19,7 @@ function set_fleet_target(targ_x, targ_y, final_target){ action_x = targ_x; action_y = targ_y; target = final_target; - action_eta=floor(point_distance(x,y,targ_x,targ_y)/128)+1; + action_eta = floor(point_distance(x,y,targ_x,targ_y)/128)+1; } function scr_valid_fleet_target(target) { @@ -61,7 +61,7 @@ function fleets_next_location(fleet = "none", visited = []) { array_push(visited, fleet.id); // Check if the fleet has a 'target' variable - if (action != "" && variable_instance_exists(fleet, "target")) { + if (fleet.action != "" && variable_instance_exists(fleet, "target")) { // If the target is valid and not already in the visited list, proceed recursively var fleet_target_valid = scr_valid_fleet_target(fleet.target); if (!fleet_target_valid) { diff --git a/scripts/scr_hit/scr_hit.gml b/scripts/scr_hit/scr_hit.gml index b1c4ea0724..57a708c558 100644 --- a/scripts/scr_hit/scr_hit.gml +++ b/scripts/scr_hit/scr_hit.gml @@ -100,11 +100,21 @@ function point_and_click_sprite(x1, y1, sprite, x_scale = 1, y_scale = 1){ } function scr_click_left(cooldown = 60, lock_bypass = false){ + + return click_controller(cooldown,lock_bypass); +} + +function scr_click_right(cooldown = 60, lock_bypass = false){ + + return click_controller(cooldown,lock_bypass ,mb_right); +} + +function click_controller(cooldown = 60, lock_bypass = false, mouse_button_lr=mb_left){ if (lock_bypass == false && global.ui_click_lock == true) { return false; } - var mouse_clicked = event_number==ev_gui ? device_mouse_check_button_pressed(0,mb_left) : mouse_check_button_pressed(mb_left); + var mouse_clicked = event_number==ev_gui ? device_mouse_check_button_pressed(0,mouse_button_lr) : mouse_check_button_pressed(mouse_button_lr); if (!mouse_clicked) { return false; } @@ -153,7 +163,7 @@ function scr_click_left(cooldown = 60, lock_bypass = false){ show_debug_message($"Mouse Clicked! {array_to_string_list(debug_get_callstack(), true)}"); } - return mouse_clicked; + return mouse_clicked; } function mouse_button_held(_button = mb_left) { diff --git a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml index b333eba560..5c203eff9c 100644 --- a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml +++ b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml @@ -526,7 +526,6 @@ function mission_hunt_inquisitor_show_mercy(){ function mission_hunt_inquisitor_destroy_inquisitor_ship(){ - show_debug_message("mission_hunt_inquisitor_destroy_inquisitor_ship"); var _final_disp_mod = 0; if (obj_controller.demanding == 0) { diff --git a/scripts/scr_marine_struct/scr_marine_struct.gml b/scripts/scr_marine_struct/scr_marine_struct.gml index 134d3b433a..9308991eb6 100644 --- a/scripts/scr_marine_struct/scr_marine_struct.gml +++ b/scripts/scr_marine_struct/scr_marine_struct.gml @@ -788,7 +788,7 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} static add_trait = function(trait,return_stat_diff = false, return_description = false) { if (return_stat_diff){ - var _start_stats = _unit.get_stat_line(); + var _start_stats = get_stat_line(); } if (struct_exists(global.trait_list, trait)) { if (!array_contains(traits, trait)) { @@ -799,7 +799,7 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} array_push(traits, trait); if (return_stat_diff){ - var _end_stats = _unit.get_stat_line(); + var _end_stats = get_stat_line(); var _stat_diff = compare_stats(_end_stats,_start_stats); } diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index e3ee0a15b9..8cab6b95f2 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -12,7 +12,7 @@ function location_out_of_player_control(unit_loc){ return (array_contains(_locs,unit_loc )); } -#macro planet_problem_keys ["meeting_trap","meeting","succession","mech_raider","mech_bionics","mech_mars","mech_tomb1","fallen","great_crusade","harlequins","fund_elder","provide_garrison","hunt_beast","protect_raiders","join_communion","join_parade","recover_artifacts","train_forces","spyrer","inquisitor","recon","cleanse","purge","tyranid_org","artifact_loan","necron","ethereal","demon_world"] +#macro planet_problem_keys ["meeting_trap","meeting","succession","mech_raider","mech_bionics","mech_mars","mech_tomb1","fallen","great_crusade","harlequins","fund_elder","provide_garrison","hunt_beast","protect_raiders","join_communion","join_parade","recover_artifacts","train_forces","spyrer","inquisitor","recon","cleanse","purge","tyranid_org","artifact_loan","necron","ethereal","demon_world","deliver_trophy"] function mission_name_key(mission){ var mission_key = { @@ -153,32 +153,6 @@ function init_garrison_mission(planet, star, mission_slot){ } - - -function init_beast_hunt_mission(planet, star, mission_slot){ - var problems_data = star.p_problem_other_data[planet] - var mission_data = problems_data[mission_slot]; - if (mission_data.stage == "preliminary"){ - var numeral_name = planet_numeral_name(planet, star); - mission_data.stage = "active"; - var _mission_length=(irandom_range(2,5)); - star.p_timer[planet][mission_slot] = _mission_length; - //pop.image="ancient_ruins"; - var gar_pop=instance_create(0,0,obj_popup); - //TODO some new universal methods for popups - gar_pop.title=$"Marines assigned to hunt beasts around {numeral_name}"; - gar_pop.text=$"The govornor of {numeral_name} Thanks you for the participation of your elite warriors in your execution of such a menial task.\n It would be best to send at least one amrine that has experience with such tasks"; - //pip.image="event_march" - gar_pop.add_option({ - str1: "Happy Hunting" - }); - gar_pop.image=""; - gar_pop.cooldown=8; - obj_controller.cooldown=20; - scr_event_log("",$"Beast hunters deployed to {numeral_name} for {_mission_length} months.", star.name); - } -} - function role_compare(unit, role){ return unit.role() == obj_ini.role[100][role]; } @@ -475,6 +449,32 @@ function complete_train_forces_mission(targ_planet, problem_index){ } } } + +function init_beast_hunt_mission(planet, star, mission_slot){ + var problems_data = star.p_problem_other_data[planet] + var mission_data = problems_data[mission_slot]; + if (mission_data.stage == "preliminary"){ + var numeral_name = planet_numeral_name(planet, star); + mission_data.stage = "active"; + var _mission_length=(irandom_range(2,5)); + star.p_timer[planet][mission_slot] = _mission_length; + //pop.image="ancient_ruins"; + var gar_pop=instance_create(0,0,obj_popup); + //TODO some new universal methods for popups + gar_pop.title=$"Marines assigned to hunt beasts around {numeral_name}"; + gar_pop.text=$"The govornor of {numeral_name} Thanks you for the participation of your elite warriors in your execution of such a menial task."; + //pip.image="event_march" + gar_pop.add_option({ + str1: "Happy Hunting" + }); + gar_pop.image=""; + gar_pop.cooldown=8; + obj_controller.cooldown=20; + scr_event_log("",$"Beast hunters deployed to {numeral_name} for {_mission_length} months.", star.name); + } +} + + function complete_beast_hunt_mission(targ_planet, problem_index){ var planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage","active")){ @@ -530,7 +530,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ var _pop_data = ""; var _navy_fleets = get_imperial_navy_fleets(); - if (array_length(_successful_hunters) && _largest_pass > 15 && array_length(_navy_fleets)){ + if (array_length(_successful_hunters) && _largest_pass > 20 && array_length(_navy_fleets)){ _pop_data = { trophy_owner : array_random_element(_successful_hunters), system: self.name, @@ -542,6 +542,8 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ choice_func : init_deliver_trophy_mission, str1 : "Continue", } + + _pop_data.options = _options; } if (_success){ _mission_string = $"The mission was a success and a great number of beasts rounded up and slain, your marines were able to gain great skills and the prestige of your chapter has increased greatly across the planets populace." @@ -561,49 +563,56 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ } } function init_deliver_trophy_mission(){ - text = $"After your marines return there is a great feast to honour them. Much fanfare is made of the great trophy {_pop_data.trophy_owner.name_role()} bears, a great monstrous head as tall as he is that the governor proclaims must be the largest of it's kind and the momst fearsome beast in the sector."; + text = $"After your marines return there is a great feast to honour them. Much fanfare is made of the great trophy {pop_data.trophy_owner.name_role()} bears, a great monstrous head as tall as he is that the governor proclaims must be the largest of it's kind and the momst fearsome beast in the sector."; - text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {_pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; + text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; replace_options([ { str1 : "Refuse and place the trophy into the Librarium", choice_func : function(){ - + scr_add_artifact(); } }, { str1 : "Accept", - choice_func : function(){ - text = $"You Send a reply to tell the commander you accept and will ensure the trophy is delivered in person by the marine that slew the beast"; - var _targ_fleet = pop_data.target_fleet; - - var _targ_fleet_intercept = fleets_next_location(_targ_fleet); - if (_targ_fleet.action==""){ - text += $"\n\n the fleet in question is currently active around the {_targ_fleet_intercept.name} system"; - } else { - text += $"\n\n the fleet will next be accessible around the {_targ_fleet_intercept.name} system"; - } + choice_func : accept_deliver_trophy_mission + } + ]); + +} - pop_data.target_fleet = target_fleet.uid; - var _fleet_event = new FleetEvent(pop_data); - _fleet_event.turn_end = "deliver_trophy_end_turn_check"; - _fleet_event.destroy = "deliver_trophy_mission_fleet_destroyed"; - _fleet_event.timer_end = "deliver_trophy_mission_timed_out"; +function accept_deliver_trophy_mission(){ + text = $"You Send a reply to tell the commander you accept and will ensure the trophy is delivered in person by the marine that slew the beast"; + var _targ_fleet = pop_data.target_fleet; - _fleet_event.timer = 120; + var _targ_fleet_intercept = fleets_next_location(_targ_fleet); + if (_targ_fleet.action==""){ + text += $"\n\n the fleet in question is currently active around the {_targ_fleet_intercept.name} system"; + } else { + text += $"\n\n the fleet will next be accessible around the {_targ_fleet_intercept.name} system"; + } - _targ_fleet.add_event(_fleet_event); + pop_data.target_fleet = _targ_fleet.uid; + pop_data.delivering_marine = pop_data.trophy_owner.name_role(); + var _t_owner = pop_data.trophy_owner; + pop_data.trophy_owner = _t_owner.uid; - reset_popup_options(); - } - } - ]); + var _fleet_event = new FleetEvent(pop_data); + + _fleet_event.turn_end = "deliver_trophy_end_turn_check"; + _fleet_event.destroy = "deliver_trophy_mission_fleet_destroyed"; + _fleet_event.timer_end = "deliver_trophy_mission_timed_out"; + + _fleet_event.timer = 120; + + _targ_fleet.add_event(_fleet_event); + reset_popup_options(); } @@ -625,6 +634,7 @@ function deliver_trophy_mission_fleet_destroyed(){ ///@mixin FleetEvent function deliver_trophy_end_turn_check(){ + show_debug_message($"evetn_Data = {event_data}"); var _navy_fleet = get_fleet_uid(fleet_uid); if (!instance_exists(_navy_fleet)){ deliver_trophy_mission_fleet_destroyed(); diff --git a/scripts/scr_recruit_data/scr_recruit_data.gml b/scripts/scr_recruit_data/scr_recruit_data.gml index e926978a58..c817a9dc30 100644 --- a/scripts/scr_recruit_data/scr_recruit_data.gml +++ b/scripts/scr_recruit_data/scr_recruit_data.gml @@ -192,7 +192,6 @@ function planet_training_sequence(local_apothecary_points) { var recruit_chance = 999; var aspirant = 0; var new_recruit_corruption = find_recruit_corruption(planet_type); - show_debug_message($"new_recruit_corruption: {new_recruit_corruption}"); var months_to_neo = 72; var dista = 0; var onceh = 0; diff --git a/scripts/scr_shoot/scr_shoot.gml b/scripts/scr_shoot/scr_shoot.gml index f77b7b4ab0..492cdc13a7 100644 --- a/scripts/scr_shoot/scr_shoot.gml +++ b/scripts/scr_shoot/scr_shoot.gml @@ -198,7 +198,6 @@ function scr_shoot(weapon_index_position, target_object, target_type, damage_dat } if (instance_exists(target_object) && (owner == eFACTION.Player)) { - // show_debug_message("{0}, {1}, {2}, {3}, {4}", wep_num[weapon_index_position], wep[weapon_index_position], splash[weapon_index_position], range[weapon_index_position], att[weapon_index_position]) var shots_fired = 0; var stop = 0; var damage_type = ""; diff --git a/scripts/scr_string_functions/scr_string_functions.gml b/scripts/scr_string_functions/scr_string_functions.gml index be4a53485c..4cb0f3584f 100644 --- a/scripts/scr_string_functions/scr_string_functions.gml +++ b/scripts/scr_string_functions/scr_string_functions.gml @@ -363,11 +363,9 @@ function string_starts_with_any(_str, _prefixes) { function string_interpolate_from_struct(interpolate_string,data){ var _names=struct_get_names(data); var _name_length = array_length(_names); - show_debug_message(_names); for (var i=0;i<_name_length;i++){ var _name=_names[i]; var _replace_string = "{" + $"{_name}" + "}"; - show_debug_message(_replace_string); interpolate_string = string_replace_all(interpolate_string, _replace_string, data[$_name]); } diff --git a/scripts/scr_struct_functions/scr_struct_functions.gml b/scripts/scr_struct_functions/scr_struct_functions.gml index fc5856cb58..9e44f3694c 100644 --- a/scripts/scr_struct_functions/scr_struct_functions.gml +++ b/scripts/scr_struct_functions/scr_struct_functions.gml @@ -10,7 +10,7 @@ function DeepCloneStruct(clone_struct) { function move_data_to_current_scope(move_struct, overide=true){ if (!is_struct(move_struct)){ - show_debug_message(move_struct); + //show_debug_message(move_struct); } else { try{ var _data_names = struct_get_names(move_struct); diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index b1a6f8a4e0..de0ed76ec0 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -377,11 +377,9 @@ function find_population_doners(doner_to=0){ function planet_numeral_name(planet, star="none"){ if (star=="none"){ - //show_debug_message($"{planet}, numeral name") return $"{name} {int_to_roman(planet)}"; } else { with (star){ - //show_debug_message($"{planet}, numeral name") return $"{name} {int_to_roman(planet)}"; } } diff --git a/scripts/scr_trade/scr_trade.gml b/scripts/scr_trade/scr_trade.gml index 09975ba533..3406e0561f 100644 --- a/scripts/scr_trade/scr_trade.gml +++ b/scripts/scr_trade/scr_trade.gml @@ -268,7 +268,6 @@ function TradeAttempt(diplomacy) constructor{ var _success = attempt_rand <= deal_chance; if (_success){ _success = find_trade_locations(); - show_debug_message("trade_success"); if (_success){ successful_trade_attempt(); scr_dialogue("agree",{prepend:"[[Trade Accepted. Shipment initialized.]]"}); @@ -278,7 +277,7 @@ function TradeAttempt(diplomacy) constructor{ scr_loyalty("Xeno Trade","+"); } } else { - show_debug_message("no trade locations"); + //show_debug_message("no trade locations"); } } else { var _dip = diplomacy_faction; @@ -312,7 +311,6 @@ function TradeAttempt(diplomacy) constructor{ exit; } } - show_debug_message("trade_fail"); clear_options(); } @@ -679,7 +677,6 @@ function TradeAttempt(diplomacy) constructor{ } deal_chance=(100-penalty)-(((their_worth-(my_worth*dif_penalty)))); - //show_debug_message($"{their_worth},{my_worth},{deal_chance}"); var _chance = clamp(floor((deal_chance/20)), 0, 6); trade_likely = chance_chart[_chance]; diff --git a/scripts/scr_trade_dep/scr_trade_dep.gml b/scripts/scr_trade_dep/scr_trade_dep.gml index b8b4e28bbb..5aeb0c9526 100644 --- a/scripts/scr_trade_dep/scr_trade_dep.gml +++ b/scripts/scr_trade_dep/scr_trade_dep.gml @@ -2,7 +2,6 @@ function scr_trade_dep() { var _goods = cargo_data.player_goods; - //show_debug_message($"trade goods : {_goods}"); if (struct_exists(_goods, "mercenaries")){ var _mercs = struct_get_names(_goods.mercenaries); for (var m=0;m Date: Thu, 11 Dec 2025 06:03:14 +0000 Subject: [PATCH 06/93] event_data is a reserved name --- scripts/scr_fleet_events/scr_fleet_events.gml | 4 ++-- .../scr_mission_functions.gml | 18 +++++++++--------- .../scr_unit_quick_find_pane.gml | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/scr_fleet_events/scr_fleet_events.gml b/scripts/scr_fleet_events/scr_fleet_events.gml index 0bb74461ea..6152d5e692 100644 --- a/scripts/scr_fleet_events/scr_fleet_events.gml +++ b/scripts/scr_fleet_events/scr_fleet_events.gml @@ -5,9 +5,9 @@ function add_event_to_fleet(event , fleet){ -function FleetEvent(event_data) constructor{ +function FleetEvent(_event_data) constructor{ - self.event_data = event_data; + self.fleetevent_data = _event_data; static load_json_data = function(data){ var names = variable_struct_get_names(data); diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 8cab6b95f2..2019372c7a 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -620,7 +620,7 @@ function accept_deliver_trophy_mission(){ function deliver_trophy_mission_timed_out(){ scr_popup( "Objective Forgotten", - $"It has been so long in the life of a mortal that the commanders that once saught your delivery of the trophy from the hunt on {event_data.system} have now all either died or moved to greener pastures. The trophy will instead remain in the chapters possession", + $"It has been so long in the life of a mortal that the commanders that once saught your delivery of the trophy from the hunt on {fleetevent_data.system} have now all either died or moved to greener pastures. The trophy will instead remain in the chapters possession", ); } @@ -628,13 +628,13 @@ function deliver_trophy_mission_timed_out(){ function deliver_trophy_mission_fleet_destroyed(){ scr_popup( "Fleet Destroyed", - $"With the Imperial Navy fleet containing the regiments from {event_data.system} destroyed there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", + $"With the Imperial Navy fleet containing the regiments from {fleetevent_data.system} destroyed there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", ); } ///@mixin FleetEvent function deliver_trophy_end_turn_check(){ - show_debug_message($"evetn_Data = {event_data}"); + show_debug_message($"evetn_Data = {fleetevent_data}"); var _navy_fleet = get_fleet_uid(fleet_uid); if (!instance_exists(_navy_fleet)){ deliver_trophy_mission_fleet_destroyed(); @@ -649,7 +649,7 @@ function deliver_trophy_end_turn_check(){ if (_ratio<=0){ scr_popup( "Regiments Destroyed ", - $"The guard Regiments from {event_data.system} serving in the imperial navy fleet have been annihilated wholesale there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", + $"The guard Regiments from {fleetevent_data.system} serving in the imperial navy fleet have been annihilated wholesale there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", ); return; } @@ -658,19 +658,19 @@ function deliver_trophy_end_turn_check(){ var _nearest_player = instance_at_location(_navy_fleet.x,_navy_fleet.y,obj_p_fleet); if (instance_exists(_nearest_player)){ var _ships = fleet_full_ship_array(_nearest_player); - var _marine = get_unit_uid(event_data.trophy_owner); + var _marine = fetch_unit_uid(fleetevent_data.trophy_owner); var _present = _marine.is_at_location("", 0, _ships); var _meet_point = _navy_fleet.orbiting; if (_present){ var _text = "{_marine.role(name)} is able to rendevous with the imperial navy at {_meet_point.name}." - _text += $" The guard regiments of {event_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns many of the regiments banners."; + _text += $" The guard regiments of {fleetevent_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns many of the regiments banners."; _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.role(name)} spreading far and wide amoung guard regiments."; var _roll = roll_dice_chapter(1, 100, "high"); if (_roll>30 && _roll<70){ //TODO would be cool to have this changed to be a guard specific piece of equipment - _text += "In return for your labour and in honour of your chapter the commander of the guard division has a brand new Land Raider destined for the army diverted to your chapter"; - scr_add_vehicle("Land Raider"); - } else if (_roll>=70){ + _text += "In return for your labour and in honour of your chapter the commander of the guard division has a brand new Rhino destined for the army diverted to your chapter"; + scr_add_vehicle("Rhino"); + } else if (_roll>=70 ){ var _wanted_types = ["Ice","Desert","Agri","Lava","Death"]; var _star = scr_get_stars(true,[],_wanted_types)[0]; _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on {_star.name}."; diff --git a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml index 22a810dc9c..fb21493ebe 100644 --- a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml +++ b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml @@ -183,17 +183,17 @@ function UnitQuickFindPanel() constructor{ system : _sys.name, system_id : _sys.id, target : id, - important_person : _event.event_data.trophy_owner, - person_name : _event.event_data.delivering_marine, + important_person : _event.fleetevent_data.trophy_owner, + person_name : _event.fleetevent_data.delivering_marine, planet : 0, - start_system : _event.event_data.system, + start_system : _event.fleetevent_data.system, time : _event.timer, }; _mission_data.click_left = method(_mission_data,function(){ set_map_pan_to_loc(system_id); }); - + _mission_data.hover = method(_mission_data,function(){ tooltip_draw($"You are to have {person_name} deliver trophy hunted on {start_system} to the {start_system} regiments\n\nLeft click to see target fleet intercept system right click to view the trophy bearing marine {person_name}"); }); From 23f929636ff73763986b2dd156d96281b5d42836 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 11 Dec 2025 22:08:03 +0000 Subject: [PATCH 07/93] another mass move to PlanetData and optomise --- objects/obj_star/Create_0.gml | 5 + scripts/scr_PlanetData/scr_PlanetData.gml | 727 ++++++++++++++---- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 17 +- scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml | 375 +-------- .../scr_mechanicus_missions.gml | 2 +- .../scr_mission_functions.gml | 12 +- .../scr_ork_fleet_functions.gml | 2 +- .../scr_planetary_feature.gml | 10 +- 8 files changed, 613 insertions(+), 537 deletions(-) diff --git a/objects/obj_star/Create_0.gml b/objects/obj_star/Create_0.gml index ac94fffd2e..936b1e2bfa 100644 --- a/objects/obj_star/Create_0.gml +++ b/objects/obj_star/Create_0.gml @@ -71,6 +71,11 @@ p_problem_other_data = array_create_advanced(_planet_array_size, array_create_ad p_timer = array_create_advanced(_planet_array_size, array_create(8, -1)); +system_datas = array_create(8, 0); +system_garrison = array_create(8, 0); + +system_sabatours = array_create(8, 0) + add_feature = function(planet, feature){ array_push(p_feature[planet], feature); } diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 96dc83e039..7fe9b27489 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -4,37 +4,112 @@ #macro ARR_strength_descriptions ["none", "Minimal", "Sparse", "Moderate", "Numerous", "Very Numerous", "Overwhelming"]; function PlanetData(planet, system) constructor{ -//safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere - //disposition - if (system.dispo[planet] < -100 && system.dispo[planet] > -1000 && system.p_owner[planet] != eFACTION.Player ) { // Personal Rule code be doing some interesting things - system.dispo[planet] = -100; // TODO LOW DISPOSITION_REVAMP // Consider revamping the disposition system - } else if (system.dispo[planet] > 100) { - system.dispo[planet] = 100; - } // static large_pop_conversion = 1000000000; - self.planet = planet; self.system = system; - x = system.x; - y = system.y; - player_disposition = system.dispo[planet]; - planet_type = system.p_type[planet]; - operatives = system.p_operatives[planet]; + + + static refresh_data = function(){ + features = system.p_feature[planet]; + current_owner = system.p_owner[planet]; + origional_owner = system.p_first[planet]; + population = system.p_population[planet]; + max_population = system.p_max_population[planet]; + large_population = system.p_large[planet]; + secondary_population = system.p_pop[planet]; + is_craftworld = system.craftworld; + is_hulk = system.space_hulk; + x = system.x; + y = system.y; + player_disposition = system.dispo[planet]; + planet_type = system.p_type[planet]; + operatives = system.p_operatives[planet]; + pdf = system.p_pdf[planet]; + fortification_level = system.p_fortified[planet]; + star_station = system.p_station[planet]; + pdf_loss_reduction = 0; + + // Whether or not player forces are on the planet + player_forces = system.p_player[planet]; + + defence_lasers = system.p_lasers[planet]; + defence_silos = system.p_silo[planet]; + ground_defences = system.p_defenses[planet]; + upgrades = system.p_upgrades[planet]; + // v how much of a problem they are from 1-5 + planet_forces = array_create(14, 0); + guardsmen = system.p_guardsmen[planet]; + pdf = system.p_pdf[planet]; + + try{ + planet_forces[eFACTION.Player] = player_forces; + + planet_forces[eFACTION.Imperium] = guardsmen; + + planet_forces[eFACTION.Ecclesiarchy] = system.p_sisters[planet]; + planet_forces[eFACTION.Eldar] = system.p_eldar[planet]; + planet_forces[eFACTION.Ork] = system.p_orks[planet]; + planet_forces[eFACTION.Tau] = system.p_tau[planet]; + planet_forces[eFACTION.Tyranids] = system.p_tyranids[planet]; + planet_forces[eFACTION.Chaos] = system.p_chaos[planet]+ system.p_demons[planet]; + planet_forces[eFACTION.Heretics] = system.p_traitors[planet]; + + planet_forces[eFACTION.Necrons] = system.p_necrons[planet]; + }catch(_exception){ + handle_exception(_exception); + } + + fortification_level = system.p_fortified[planet]; + + is_heretic = system.p_hurssy[planet]; + + heretic_timer = system.p_hurssy_time[planet]; + + secret_corruption = system.p_heresy_secret[planet]; + + corruption = system.p_heresy[planet]; + + population_influences = system.p_influence[planet]; + + raided_this_turn = system.p_raided[planet]; + // + governor = system.p_governor[planet]; + + problems = system.p_problem[planet]; + problems_data = system.p_problem_other_data[planet]; + problem_timers = system.p_timer[planet]; + + deamons = system.p_demons[planet]; + chaos_forces = system.p_chaos[planet]; + + requests_help = system.p_halp[planet]; + + //safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere + //disposition + if (system.dispo[planet] < -100 && system.dispo[planet] > -1000 && system.p_owner[planet] != eFACTION.Player ) { // Personal Rule code be doing some interesting things + system.dispo[planet] = -100; // TODO LOW DISPOSITION_REVAMP // Consider revamping the disposition system + } else if (system.dispo[planet] > 100) { + system.dispo[planet] = 100; + } + + garrisons = system.system_garrison[planet]; + sabatours = system.system_sabatours[planet]; + system.system_datas[planet] = self; + } + + refresh_data(); + + static edit_player_forces = function(val){ + system.p_player[planet]+=val; + player_forces = system.p_player[planet]; + } function add_operatives(new_ops){ array_push(system.p_operatives[planet], new_ops); operatives = system.p_operatives[planet]; } - features = system.p_feature[planet]; - current_owner = system.p_owner[planet]; - origional_owner = system.p_first[planet]; - population = system.p_population[planet]; - max_population = system.p_max_population[planet]; - large_population = system.p_large[planet]; - secondary_population = system.p_pop[planet]; - is_craftworld = system.craftworld; - is_hulk = system.space_hulk; + static set_player_disposition = function(new_dispo){ player_disposition = new_dispo; @@ -69,6 +144,21 @@ function PlanetData(planet, system) constructor{ return pop_value; } + static end_turn_population_growth = function(){ + if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.Heretics] == 0) && (planet_forces[eFACTION.Tau] == 0) && (planet_forces[eFACTION.Ork] == 0) && (planet_forces[eFACTION.Necrons] == 0) && (planet_forces[eFACTION.Tyranids] == 0)) { + if (!large_population) { + set_population(round(population * 1.0008)); + } else if (large_population == 1) { + edit_population(choose(0, 0.01)); + } + } + } + + static alter_influence = function(faction,value){ + adjust_influence(eFACTION.Tyranids, -1, planet,system); + population_influences = p_influence[planet]; + } + static send_colony_ship = function(target, targ_planet, type){ new_colony_fleet(system, planet, target, targ_planet, type); } @@ -120,15 +210,16 @@ function PlanetData(planet, system) constructor{ return _at_war; } - guardsmen = system.p_guardsmen[planet]; - static edit_guardsmen = function(edit_val){ system.p_guardsmen[planet] = max(0, system.p_guardsmen[planet] + edit_val); guardsmen = system.p_guardsmen[planet]; } - pdf = system.p_pdf[planet]; - fortification_level = system.p_fortified[planet]; + static edit_pdf = function(edit_val){ + system.p_pdf[planet] = max(0, system.p_pdf[planet] + edit_val); + pdf = system.p_pdf[planet]; + } + static alter_fortification = function(alteration){ system.p_fortified[planet] += alteration; fortification_level = system.p_fortified[planet]; @@ -144,40 +235,6 @@ function PlanetData(planet, system) constructor{ system.p_pdf[planet] = pdf; return new_pdf; } - star_station = system.p_station[planet]; - pdf_loss_reduction = 0; - - // Whether or not player forces are on the planet - player_forces = system.p_player[planet]; - - static edit_player_forces = function(val){ - system.p_player[planet]+=val; - player_forces = system.p_player[planet]; - } - defence_lasers = system.p_lasers[planet]; - defence_silos = system.p_silo[planet]; - ground_defences = system.p_defenses[planet]; - upgrades = system.p_upgrades[planet]; - // v how much of a problem they are from 1-5 - planet_forces = array_create(14, 0); - - try{ - planet_forces[1] = player_forces; - - planet_forces[2] = guardsmen; - - planet_forces[5] = system.p_sisters[planet]; - planet_forces[6] = system.p_eldar[planet]; - planet_forces[7] = system.p_orks[planet]; - planet_forces[8] = system.p_tau[planet]; - planet_forces[9] = system.p_tyranids[planet]; - planet_forces[10] = system.p_traitors[planet]; - planet_forces[11] = system.p_chaos[planet]+ system.p_demons[planet]; - - planet_forces[13] = system.p_necrons[planet]; - }catch(_exception){ - handle_exception(_exception); - } static add_forces = function(faction, val){ var _new_val = planet_forces[faction]+val; @@ -257,9 +314,9 @@ function PlanetData(planet, system) constructor{ return _text; } static grow_ork_forces = function(){ - var contin=0; - var rando=roll_dice(1,100);// This part handles the spreading - // if (rando<30){ + var contin = 0; + var _rando = roll_dice(1,100);// This part handles the spreading + // if (_rando<30){ var _non_deads = planets_without_type("dead", system); var _has_warboss = has_feature(P_features.OrkWarboss); @@ -273,7 +330,35 @@ function PlanetData(planet, system) constructor{ var _warboss = get_features(P_features.OrkWarboss)[0]; _warboss.turns_static++; } - if (array_length(_non_deads)>0 && rando>40){ + var _roll_num = 100; + if (_has_stronghold){ + _roll_num -= (_has_stronghold + 1) * 3; + } + var _ork_growth = roll_dice_chapter(1, 100, "high"); + success = false; // This part handles the increasing in numbers + + var _ork_growth_threshold = 13; + + if (_has_warboss){ + _ork_growth_threshold *= 2; + } + + var _orks = planet_forces[eFACTION.Ork]; + if ((current_owner == eFACTION.Ork) && (_orks < 5) && (planet_forces[eFACTION.Heretics] == 0) && (p_player[i] <= 0 || !is_garrison_force)) { + if ((_orks> 0) && (_ork_growth <= _ork_growth_threshold)) { + if (sabotage_force) { + if (irandom(3) < 2) { + scr_event_log("green", $"sabotage force on {name()} disrupts ork forces", name); + } else { + add_forces(eFACTION.Ork,1); + } + } else { + add_forces(eFACTION.Ork,1); + } + } + } + + if (array_length(_non_deads)>0 && _rando>40){ var _ork_spread_planet = array_random_element(_non_deads); var _orks = planet_forces[eFACTION.Ork] var _ork_target = system.p_orks[_ork_spread_planet]; @@ -294,7 +379,7 @@ function PlanetData(planet, system) constructor{ } } contin=0; - rando=roll_dice(1,100);// This part handles the ship building + _rando=roll_dice(1,100);// This part handles the ship building if (population>0 && pdf==0 && guardsmen==0 && planet_forces[10]==0) and (planet_forces[eFACTION.Tau]==0){ if (!large_population){ set_population(population*0.97); @@ -316,8 +401,8 @@ function PlanetData(planet, system) constructor{ } if (_has_warboss && !_has_stronghold){ - rando=roll_dice_chapter(1,100, "low"); - if (rando<30){ + _rando=roll_dice_chapter(1,100, "low"); + if (_rando<30){ add_feature(P_features.OrkStronghold); } } else { @@ -333,14 +418,14 @@ function PlanetData(planet, system) constructor{ } if (!enemies_present){ - rando=roll_dice_chapter(1,150, "low"); + _rando=roll_dice_chapter(1,150, "low"); if (_has_warboss){ - rando -= 20; + _rando -= 20; } if (_has_stronghold){ - rando -= _stronghold.tier*5; + _rando -= _stronghold.tier*5; } - if (obj_controller.known[eFACTION.Ork]>0) then rando-=10;// Empire bonus, was 15 before + if (obj_controller.known[eFACTION.Ork]>0) then _rando-=10;// Empire bonus, was 15 before // Check for industrial facilities var fleet_buildable = ((planet_type!="Dead" && planet_type!="Lava") || _has_warboss || _has_stronghold); @@ -353,15 +438,15 @@ function PlanetData(planet, system) constructor{ }; } if (planet_type == "Forge"){ - rando-=80; + _rando-=80; } else if (planet_type == "Hive" || planet_type == "Temperate"){ - rando-=30; + _rando-=30; }else if (planet_type == "Agri"){ - rando-=10; + _rando-=10; } var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); if (_ork_fleet=="none"){ - if (rando<=20){ + if (_rando<=20){ new_ork_fleet(x,y); } } else { @@ -375,18 +460,18 @@ function PlanetData(planet, system) constructor{ var _pdata = self; with (_ork_fleet){ // Increase ship number for this object? - var rando=irandom(101); - if (obj_controller.known[eFACTION.Ork]>0) then rando-=10; + var _rando=irandom(101); + if (obj_controller.known[eFACTION.Ork]>0) then _rando-=10; var _planet_type = _pdata.planet_type; if (_planet_type=="Forge"){ - rando-=20; + _rando-=20; } else if (_planet_type=="Hive"){ - rando-=10; + _rando-=10; }else if (_planet_type=="Shrine" || _planet_type=="Temperate"){ - rando-=5; + _rando-=5; } - if (rando<=15){// was 25 - rando=choose(1,1,1,1,1,1,1,2,2,2); + if (_rando<=15){// was 25 + _rando=choose(1,1,1,1,1,1,1,2,2,2); var _big_stronghold = false if (_has_stronghold){ if (_stronghold.tier>=2){ @@ -395,17 +480,17 @@ function PlanetData(planet, system) constructor{ } if (_planet_type=="Forge" || _big_stronghold || _has_warboss){ if (!irandom(10)){ - rando = 3; + _rando = 3; } }else if (_has_stronghold || _planet_type=="Hive"){ if (!irandom(30)){ - rando = 3; + _rando = 3; } } if (capital_number<=0){ - rando = 3; + _rando = 3; } - switch(rando){ + switch(_rando){ case 3: capital_number+=1; break; @@ -449,9 +534,9 @@ function PlanetData(planet, system) constructor{ } } if (_has_warboss){ - rando=roll_dice(1,100)+10; + _rando=roll_dice(1,100)+10; var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); - if (_ork_fleet!="none" && rando < _warboss.turns_static){ + if (_ork_fleet!="none" && _rando < _warboss.turns_static){ _warboss.turns_static = 0; _ork_fleet.cargo_data.ork_warboss = _warboss; delete_feature(P_features.OrkWarboss); @@ -463,11 +548,6 @@ function PlanetData(planet, system) constructor{ } - deamons = system.p_demons[planet]; - chaos_forces = system.p_chaos[planet]; - - requests_help = system.p_halp[planet]; - // current planet heresy if (population == 0) { system.p_heresy[planet] = 0; @@ -477,29 +557,15 @@ function PlanetData(planet, system) constructor{ } } - - corruption = system.p_heresy[planet]; - static alter_corruption = function(value){ alter_planet_corruption(value, planet, system); corruption = system.p_heresy[planet]; } - - is_heretic = system.p_hurssy[planet]; - heretic_timer = system.p_hurssy_time[planet]; - - secret_corruption = system.p_heresy_secret[planet]; - - population_influences = system.p_influence[planet]; - - raided_this_turn = system.p_raided[planet]; - // - governor = system.p_governor[planet]; - - problems = system.p_problem[planet]; - problems_data = system.p_problem_other_data[planet]; - problem_timers = system.p_timer[planet]; + static set_corruption = function(value){ + system.p_heresy[planet] = value; + corruption = system.p_heresy[planet]; + } static has_problem = function(problem){ has_problem_planet(planet, problem, system); @@ -540,6 +606,7 @@ function PlanetData(planet, system) constructor{ static add_feature = function(feature_type){ var new_feature = new NewPlanetFeature(feature_type); array_push(system.p_feature[planet], new_feature); + features = system.p_feature[planet]; return new_feature; } @@ -558,6 +625,7 @@ function PlanetData(planet, system) constructor{ static delete_feature = function(feature){ delete_features(system.p_feature[planet], feature); + features = system.p_feature[planet]; } static bombard = scr_bomb_world; @@ -803,13 +871,13 @@ function PlanetData(planet, system) constructor{ static pdf_loss_reduction_calc = function(){ pdf_loss_reduction = fortification_level*0.001; if (pdf_will_support_player()){ - pdf_loss_reduction+=garrison.viable_garrison*0.0005; + pdf_loss_reduction+=garrisons.viable_garrison*0.0005; } return pdf_loss_reduction; } static pdf_defence_loss_to_orks = function(){ - var active_garrison = pdf_will_support_player() && garrison.viable_garrison>0; + var active_garrison = pdf_will_support_player() && garrisons.viable_garrison>0; if (planet_forces[eFACTION.Ork]>=4) and (pdf>=30000){ pdf=floor(pdf*(min(0.95, 0.55+pdf_loss_reduction))); } @@ -837,7 +905,7 @@ function PlanetData(planet, system) constructor{ var xx=15; var yy=25; var current_planet=planet; - var nm=scr_roman(current_planet), temp1=0; + var temp1=0; draw_set_halign(fa_center); draw_set_valign(fa_top); draw_set_font(fnt_40k_14); @@ -910,11 +978,16 @@ function PlanetData(planet, system) constructor{ yy+=20; draw_set_font(fnt_40k_14b); draw_set_halign(fa_left); - if (!is_craftworld && !is_hulk) then draw_text(xx+480,yy+196,$"{system.name} {nm} ({planet_type})"); - if (is_craftworld) then draw_text(xx+480,yy+196,string(system.name)+" (Craftworld)"); + if (!is_craftworld && !is_hulk){ + draw_text(xx+480,yy+196,$"{name()} ({planet_type})"); + } + else if (is_craftworld){ + draw_text(xx+480,yy+196,string(system.name)+" (Craftworld)"); + } else if (is_hulk){ + draw_text(xx+480,yy+196,"Space Hulk"); + } // if (is_craftworld=0) and (is_hulk=0) then draw_text(xx+534,yy+214,string(planet_type)+" World"); // if (is_craftworld=1) then draw_text(xx+594,yy+214,"Craftworld"); - if (is_hulk) then draw_text(xx+480,yy+196,"Space Hulk"); // draw_sprite(spr_planet_splash,temp1,xx+349,yy+194); scr_image("ui/planet",scr_planet_image_numbers(planet_type),xx+349,yy+194,128,128); @@ -944,17 +1017,17 @@ function PlanetData(planet, system) constructor{ if (is_craftworld=0) and (is_hulk=0){ - var y7=240,temp3=string(scr_display_number(guardsmen)); + var y7=240,_guard_force=string(scr_display_number(guardsmen)); if (guardsmen>0){ - draw_text(xx+480,yy+y7,$"Imperial Guard: {temp3}"); + draw_text(xx+480,yy+y7,$"Imperial Guard: {_guard_force}"); y7+=20; } - var temp4=string(scr_display_number(pdf)); + var _pdf_force =string(scr_display_number(pdf)); if (current_owner!=8){ - draw_text(xx+480,yy+y7,$"Defense Force: {temp4}"); + draw_text(xx+480,yy+y7,$"Defense Force: {_pdf_force}"); } if (current_owner=8){ - draw_text(xx+480,yy+y7,$"Gue'Vesa Force: {temp4}"); + draw_text(xx+480,yy+y7,$"Gue'Vesa Force: {_pdf_force}"); } } @@ -980,7 +1053,7 @@ function PlanetData(planet, system) constructor{ draw_set_color(0); draw_set_alpha(0.2); draw_rectangle(xx+481,yy+280,xx+716,yy+298,0); - if (scr_click_left()) and (obj_controller.requisition>=improve_cost){ + if (scr_click_left() && obj_controller.requisition >= improve_cost){ obj_controller.requisition-=improve_cost; alter_fortification(1); @@ -1191,10 +1264,7 @@ function PlanetData(planet, system) constructor{ } else if (current_owner=8) and (pdf>0){ - system.p_pdf[planet]-= strength*(irandom_range(49, 51) * 100000); - if (pdf<0){ - system.p_pdf[planet]=0; - } + edit_pdf(-strength*(irandom_range(49, 51) * 100000)); kill = large_population ? strength*0.15 : strength*15000000 } @@ -1214,10 +1284,10 @@ function PlanetData(planet, system) constructor{ var _pop_percentage_kill = population > 0 ? (kill / population) * 100 : 0; edit_population(kill*-1); - if (system.p_pdf[planet]<0) then system.p_pdf[planet]=0; + if (population_influences[eFACTION.Tyranids] > 3){ var _max_influence_reduction = min(_pop_percentage_kill,population_influences[eFACTION.Tyranids]-3); - adjust_influence(eFACTION.Tyranids,-_max_influence_reduction,planet,system); + alter_influence(eFACTION.Tyranids,-_max_influence_reduction); if (has_feature(P_features.Gene_Stealer_Cult)){ if (population_influences[eFACTION.Tyranids]<20){ delete_feature(P_features.Gene_Stealer_Cult); @@ -1225,9 +1295,9 @@ function PlanetData(planet, system) constructor{ } } - if (population+pdf<=0) and (current_owner=1) and (obj_controller.faction_status[eFACTION.Imperium]="War"){ + if (population + pdf<=0) and (current_owner=1) and (obj_controller.faction_status[eFACTION.Imperium]="War"){ if (!has_feature(P_features.Monastery)){ - current_owner=2; + set_new_owner(eFACTION.Imperium); add_disposition(-50); } } @@ -1250,10 +1320,10 @@ function PlanetData(planet, system) constructor{ job:_mission, task_time : 0 }; - add_operatives(operation_data) - system.garrison = true; + add_operatives(operation_data); + system.garrisons = true; - //if there was an outstanding mission to provide the given garrison + //if there was an outstanding mission to provide the given garrisons var garrison_request = find_problem("provide_garrison"); if (garrison_request>-1){ init_garrison_mission(planet, system, garrison_request); @@ -1269,19 +1339,19 @@ function PlanetData(planet, system) constructor{ var _loading = obj_star_select.loading; var garrison_assignment = obj_controller.view_squad && _loading; - if (garrison_assignment && (garrison_issue && _mission=="garrison")){ + if (garrison_assignment && (garrison_issue && _mission=="garrisons")){ planet_draw = c_red; - tooltip_draw("Can't garrison on non-friendly planet or planet with no friendly PDF", 150); + tooltip_draw("Can't garrisons on non-friendly planet or planet with no friendly PDF", 150); } if (mouse_check_button_pressed(mb_left)){ if (garrison_assignment){ - if (!(garrison_issue && _mission=="garrison")){ + if (!(garrison_issue && _mission=="garrisons")){ create_planet_garrison(); exit; } } else if (!_loading){ - garrison = new GarrisonForce(operatives); - system.garrison = garrison.garrison_force; + garrisons = new GarrisonForce(operatives); + system.garrisons = garrisons.garrison_force; feature=""; buttons_selected=false; } else if (_loading && planet >0){ @@ -1310,14 +1380,9 @@ function PlanetData(planet, system) constructor{ } if (!instance_exists(obj_ground_mission)){ check_for_artifact_grab_mission(); - } - if (!instance_exists(obj_ground_mission)){ check_for_stc_grab_mission(); - } - // Ancient Ruins - if (!instance_exists(obj_ground_mission)){ scr_check_for_ruins_exploration(); - } + } instance_destroy(obj_star_select); exit; } @@ -1325,6 +1390,378 @@ function PlanetData(planet, system) constructor{ } } + static end_of_turn_population_influence_and_enemy_growth = function(){ + + sabotage_force = sabatours.garrison_force; + total_garrison = garrisons.total_garrison; + is_garrison_force = garrisons.garrison_force; + + // Orks grow in number + + end_turn_population_growth(); + + // increasing necrons + if (array_length(features) != 0) { + var has_awake_tomb = false, + nfleet = 0; + if (awake_tomb_world(features) == 1) { + has_awake_tomb = true; + } + if (has_awake_tomb) { + if (planet_forces[eFACTION.Necrons] < 3) { + planet_forces[eFACTION.Necrons] += 2; + } else if (planet_forces[eFACTION.Necrons] < 6) { + planet_forces[eFACTION.Necrons] += 1; + } + } + if (sabotage_force && irandom(2) < 2) { + planet_forces[eFACTION.Necrons]--; + scr_event_log("green", $"sabotage force on {name()} disrupts necron forces", name); + } + + if (has_awake_tomb) { + // Necron fleets, woooo + //necrons kill populatin + if ((population > 0) && (p_player[i] + pdf + guardsmen + planet_forces[eFACTION.Tyranids] == 0)) { + population = population * 0.75; + if ((large_population == 0) && (population <= 5000)) { + population = 0; + } + } + + var fleet_spawn_chance = roll_dice_chapter(1, 100, "high"); + onceh = 0; + + if (fleet_spawn_chance <= 15) { + if (system.present_fleet[eFACTION.Necrons] > 0) { + //if necron fleet + necron_fleet = instance_nearest(x, y, obj_en_fleet); + + if (necron_fleet.owner == eFACTION.Necrons) { + if (necron_fleet.escort_number < necron_fleet.capital_number * 1.5) { + necron_fleet.escort_number += 2; + } else if (necron_fleet.frigate_number < necron_fleet.capital_number * 3) { + necron_fleet.frigate_number += 1; + } else { + necron_fleet.capital_number += 1; + } + } + } else if (system.present_fleet[eFACTION.Necrons] == 0) { + necron_fleet = instance_create(x, y, obj_en_fleet); + necron_fleet.owner = eFACTION.Necrons; + necron_fleet.capital_number = 1; + necron_fleet.sprite_index = spr_fleet_necron; + necron_fleet.image_speed = 0; + necron_fleet.image_index = 1; + system.present_fleet[eFACTION.Necrons] += 1; + } + var enemy_fleets = 0; + with(necron_fleet) { + if (owner == eFACTION.Necrons) { + var ii = 0; + ii += capital_number; + ii += round((frigate_number / 2)); + ii += round((escort_number / 4)); + if (ii <= 1) { + ii = 1; + } // image_index=max(8,round(ii)); + + if ((ii >= 7) && (capital_number > 1)) { + for (var fleet_n = 1; fleet_n <= 10; fleet_n++) { + if (orbiting.present_fleet[fleet_n] > 0) { + enemy_fleets++; + } + } + } + } + } + if (enemy_fleets > 0) { + var necron_fleet2; + necron_fleet2 = instance_create(x, y, obj_en_fleet); + necron_fleet2.owner = eFACTION.Necrons; + necron_fleet2.sprite_index = spr_fleet_necron; + // necron_fleet2.image_index=0; + necron_fleet.image_speed = 0; + necron_fleet2.capital_number = 1; + necron_fleet2.frigate_number = round(necron_fleet.frigate_number / 2); + necron_fleet2.escort_number = round(necron_fleet.escort_number / 2); + system.present_fleet[eFACTION.Necrons] += 1; + + necron_fleet.capital_number -= 1; + necron_fleet.frigate_number -= necron_fleet2.frigate_number; + necron_fleet.escort_number -= necron_fleet2.escort_number; + var nearest_planet_coords = [0, 0]; + var found_near_planet = false; + with(obj_star) { + if (present_fleet[eFACTION.Necrons] == 0) { + if (!array_contains(p_type, "Dead")) { + for (var plan = 1; plan <= planets; plan++) { + if (p_owner[plan] <= 5) { + found_near_planet = true; + nearest_planet_coords = [x, y]; + break; + } + } + } + } + } + + if (found_near_planet) { + var tgt1, tgt2; + + necron_fleet2.action_x = nearest_planet_coords[0]; + necron_fleet2.action_y = nearest_planet_coords[1]; + with (necron_fleet2){ + set_fleet_movement(); + } + } + } + } + } + } + + end_turn_heretics_and_corruption_growth(); + + end_turn_genestealer_cults(); + + + // Spread influence on controlled sector + if ((planet_type != "Space Hulk") && (planet_type != "Dead")) { + if ((corruption < 70 && current_owner == 10)) { + if (current_owner == 10){ + alter_corruption(2); + } + + } + if (current_owner == eFACTION.Tau && population_influences[eFACTION.Tyranids]<70){ + var _influ_chance = roll_dice(1,100); + if (_influ_chance <= 5 && population_influences[eFACTION.Tyranids]>=20){ + alter_influence(eFACTION.Tau, 1); + } + } + + if (planet_type == "Daemon"){ + if (pdf > 0) { + pdf = 0; + } + if (guardsmen > 0) { + guardsmen = 0; + } + } + + } + + } + + + static end_turn_genestealer_cults = function(){ + // Genestealer cults grow in number + if (has_feature(P_features.Gene_Stealer_Cult)) { + var cult = get_features(P_features.Gene_Stealer_Cult)[0]; + cult.cult_age++; + alter_influence(eFACTION.Tyranids, cult.cult_age / 100); + var planet_garrison = garrisons; + if (cult.hiding) { + var find_nid_chance = 50 - planet_garrison.total_garrison; + if (population_influences[eFACTION.Tyranids] > 50) { + var find_cult_chance = irandom(50); + var alert_text = $"A hidden Genestealer Cult in {name} Has suddenly burst forth from hiding!"; + if (planet_garrison.garrison_force) { + var alert_text = $"A hidden Genestealer Cult in {name} Has been discovered by marine garrisons!"; + find_cult_chance -= 25; + } + if (find_cult_chance < 1) { + cult.hiding = false; + scr_popup("System Lost", alert_text, "Genestealer Cult", ""); + set_new_owner(eFACTION.Tyranids); + scr_event_log("red", $"A hidden Genestealer Cult in {name} {i} has Started a revolt.", name); + edit_forces(eFACTION.Tyranids,1); + } + } + } + var _nids = planet_forces[eFACTION.Tyranids]; + if ((!cult.hiding) && (_nids <= 3) && (planet_type != "Space Hulk") && (population_influences[eFACTION.Tyranids] > 10)) { + var spread = 0; + var _rando = irandom(150); + _rando -= population_influences[eFACTION.Tyranids]; + if (_rando <= 15) { + spread = 1; + } + + if ((planet_type == "Lava") && (_nids >= 2)) { + spread = 0; + } + if (((planet_type == "Ice") || (planet_type == "Desert")) && (_nids >= 3)) { + spread = 0; + } + + if (spread == 1) { + add_forces(eFACTION.Tyranids, 1); + } + } + if (population_influences[eFACTION.Tyranids] > 55) { + set_new_owner(eFACTION.Tyranids); + } + } else if (population_influences[eFACTION.Tyranids] > 5) { + alter_influence(eFACTION.Tyranids, -1); + if ((irandom(200) + (population_influences[eFACTION.Tyranids] / 10)) > 195) { + add_feature(P_features.Gene_Stealer_Cult); + } + } + } + + static end_turn_heretics_and_corruption_growth = function(){ + // traitors cults + var notixt; + var is_ork; + notixt = false; + + var _rando = roll_dice(1,100); + + if ((current_owner == eFACTION.Chaos) && (corruption < 80)) { + alter_corruption(1); + } + + if ((current_owner != eFACTION.Chaos) && (current_owner != eFACTION.Heretics) && (current_owner != eFACTION.Eldar) && (planet_type != "Dead") && (planet_type != "Craftworld")) { + success = false; + is_ork = current_owner == eFACTION.Ork; + + if (!is_ork) { + //made a linear function for this while here...now the minimum for the roll is a bit higher, but + var score_to_beat = (3 / 4) * (corruption + secret_corruption) - 27.5; + + //if (corruption+secret_corruption>=25) and (_rando<=3) then success=true; + //if (corruption+secret_corruption>=50) and (_rando<=10) then success=true; + //if (corruption+secret_corruption>=70) and (_rando<=25) then success=true; + //if (corruption+secret_corruption>=90) and (_rando<=40) then success=true; + if (_rando < score_to_beat) { + success = true; + } + } + + if (success && (pdf == 0) && (guardsmen == 0) && (planet_forces[eFACTION.Tau] == 0) && (planet_forces[eFACTION.Ork] == 0)) { + current_owner = 10; + scr_alert("red", "owner", $"{name()} has fallen to heretics!", x, y); + + if (visited == 1) { + //visited variable check whether the star has been visited or not 1 for true 0 for false + if (planet_type == "Forge") { + add_disposition(-10); + // 10 disposition decreases for the respective planet + obj_controller.disposition[3] -= 3; // 10 disposition decrease for the toaster Fetishest since they aren't that numerous + } else if (has_feature(P_features.Sororitas_Cathedral) || (planet_type == "Shrine")) { + add_disposition(-4); // similarly 10 disposition decrease, note those nurses are a bit pissy and + // and you can't easily gain their favor because you cannot ask them to "step down" from office. + obj_controller.disposition[5] -= 5; + } else { + // the missus diplomacy 0 is when they cringe when you enter the office and cannot ask them for a date. + } + } + } + + if (success && (planet_type != "Space Hulk")) { + _rando = roll_dice(1,100); + // // // obj_controller.x=self.x;obj_controller.y=self.y; + if (is_garrison_force) { + _rando -= total_garrison; + } + + var tixt = ""; + + // controls losing pdf due to heretic cults + var traitor_mod = 0; + + if (_rando <= 40) { + notixt = true; + var garrison_mod = choose(0.05, 0.1, 0.15, 0.2); + + if (is_garrison_force) { + garrison_mod -= 0.01 * total_garrison; + } + + if (garrison_mod > 0) { + var lost = floor(pdf * garrison_mod); + + if (pdf <= 500) { + lost = pdf ; + edit_forces(eFACTION.Heretics, 1); + } + + edit_pdf(-lost); + + if (planet_forces[eFACTION.Heretics] == 0) { + if (pdf > 0) { + tixt = $"{scr_display_number(lost)} PDF killed in a rebellion on {name()}."; + } else if (pdf == 0) { + tixt = $"Heretic cults have appeared in {name()}."; + } + + scr_alert("purple", "owner", tixt, x, y); + scr_event_log("purple", tixt, name); + } + } else { + tixt = $"Marine garrisons prevents rebellion on {name()}"; + scr_alert("green", "owner", tixt, x, y); + scr_event_log("green", tixt, name); + corruption -= irandom(5); + } + // Cult crushed; don't bother showing if there's already fighting going on over there + } else if ((_rando >= 41) && (_rando < 81) && (planet_forces[eFACTION.Heretics] < 2)) { + if (is_garrison_force) { + traitor_mod = choose(1, 2); + } else { + traitor_mod = 2; + } + + planet_forces[eFACTION.Heretics] = traitor_mod; + tixt = $"Heretic cults have appeared in {name()}."; + } else if ((_rando >= 81) && (_rando < 91) && (planet_forces[eFACTION.Heretics] < 3)) { + // Minor uprising + if (is_garrison_force) { + traitor_mod = choose(2, 3); + } else { + traitor_mod = 3; + } + edit_forces(eFACTION.Heretics,traitor_mod); + tixt = $"Heretic cults have spread around {name()}."; + } // Major uprising + + // major and huge uprisings are impossible as long as a garrisons of at least 10 marines is present + if ((_rando >= 91) && (_rando < 100) && (planet_forces[eFACTION.Heretics] < 4)) { + notixt = true; + edit_forces(eFACTION.Heretics,4); + + if ((obj_controller.faction_defeated[10] == 0) && (obj_controller.faction_gender[10] == 1)) { + edit_forces(eFACTION.Heretics,5); + } + + var n_name = name(); + scr_popup("Heretic Revolt", $"A massive heretic uprising on {n_name} threatens to plunge the star system into chaos.", "chaos_cultist", ""); + scr_alert("red", "owner", $"Massive heretic uprising on {n_name}.", x, y); + scr_event_log("purple", $"Massive heretic uprising on {n_name}.", name); + } // Huge uprising + + if ((_rando >= 100) && (planet_forces[eFACTION.Heretics] < 5)) { + edit_forces(eFACTION.Heretics,6); + set_new_owner(eFACTION.Heretics) + add_feature(P_features.Daemonic_Incursion); + + set_corruption(corruption < 80 ? 80 : 95) + + tixt = $"Daemonic incursion on {name()}!"; + } // Oh god what + + if ((_rando >= 41) && (!notixt) && tixt != "") { + scr_alert("red", "owner", tixt, x, y); + scr_event_log("purple", tixt, name); + } + // if (planet_forces[eFACTION.Heretics]>2){obj_controller.x=self.x;obj_controller.y=self.y;} + } // End traitors cult + } + + } + + } diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index f3b4a3e6bd..1dae443719 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -1,10 +1,14 @@ function scr_enemy_ai_a() { - system_garrison = []; - system_sabatours = []; + system_garrison = [0]; + system_sabatours = [0]; system_datas = [0]; for (var i=1;i<=planets;i++){ + var garrison = new GarrisonForce(p_operatives[i], true); + var sabatours = new GarrisonForce(p_operatives[i], true, "sabotage"); + array_push(system_garrison, garrison); + array_push(system_sabatours, sabatours); array_push(system_datas,new PlanetData(i, self)); } // guardsmen hop from planet to planet @@ -46,15 +50,10 @@ function scr_enemy_ai_a() { var _planet_data; for (var _run =1;_run<=planets;_run++){ _planet_data = system_datas[_run]; - garrison_force=false; - var garrison = new GarrisonForce(p_operatives[_run], true); - var sabatours = new GarrisonForce(p_operatives[_run], true, "sabotage"); - _planet_data.garrison = garrison; - _planet_data.sabatours = sabatours; + garrison = _planet_data.garrisons; + sabatours = _planet_data.sabatours; garrison_force = garrison.garrison_force; - array_push(system_garrison, garrison); - array_push(system_sabatours, sabatours); stop=0; ensure_no_planet_negatives(_run); diff --git a/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml b/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml index 3ee0b01044..3d66a6b699 100644 --- a/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml +++ b/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml @@ -11,379 +11,8 @@ function scr_enemy_ai_b() { i = 0; for (i = 1; i <= planets; i++) { - var cur_garrison = system_garrison[i - 1]; - var cur_sabatours = system_sabatours[i - 1]; - - sabotage_force = cur_sabatours.garrison_force; - total_garrison = cur_garrison.total_garrison; - is_garrison_force = cur_garrison.garrison_force; - - var planet_string = $"{string(name)} {scr_roman_numerals()[i - 1]}"; - // Orks grow in number - var ork_growth = floor(random(100)) + 1; - success = false; // This part handles the increasing in numbers - if ((p_owner[i] == 7) && (p_orks[i] < 5) && (p_traitors[i] == 0) && (p_player[i] <= 0 || !is_garrison_force)) { - if ((p_orks[i] > 0) && (p_orks[i] < 5) && (ork_growth <= 15)) { - if (sabotage_force) { - if (irandom(3) < 2) { - scr_event_log("green", $"sabotage force on {planet_string} disrupts ork forces", name); - } else { - p_orks[i] += 1; - } - } else { - p_orks[i] += 1; - } - } - } - if ((p_population[i] < p_max_population[i]) && (p_type[i] != "Dead") && (p_type[i] != "Craftworld") && (p_owner[i] <= 5) && (p_traitors[i] == 0) && (p_tau[i] == 0) && (p_orks[i] == 0) && (p_necrons[i] == 0) && (p_tyranids[i] == 0)) { - if (p_large[i] == 0) { - p_population[i] = round(p_population[i] * 1.0008); - } else if (p_large[i] == 1) { - p_population[i] += choose(0, 0.01); - } - } - - // increasing necrons - if (array_length(p_feature[i]) != 0) { - var has_awake_tomb = false, - nfleet = 0; - if (awake_tomb_world(p_feature[i]) == 1) { - has_awake_tomb = true; - } - if (has_awake_tomb) { - if (p_necrons[i] < 3) { - p_necrons[i] += 2; - } else if (p_necrons[i] < 6) { - p_necrons[i] += 1; - } - } - if (sabotage_force && irandom(2) < 2) { - p_necrons[i]--; - scr_event_log("green", $"sabotage force on {planet_string} disrupts necron forces", name); - } - - if (has_awake_tomb) { - // Necron fleets, woooo - //necrons kill populatin - if ((p_population[i] > 0) && (p_player[i] + p_pdf[i] + p_guardsmen[i] + p_tyranids[i] == 0)) { - p_population[i] = p_population[i] * 0.75; - if ((p_large[i] == 0) && (p_population[i] <= 5000)) { - p_population[i] = 0; - } - } - - var fleet_spawn_chance = roll_dice_chapter(1, 100, "high"); - onceh = 0; - - if (fleet_spawn_chance <= 15) { - if (present_fleet[eFACTION.Necrons] > 0) { - //if necron fleet - necron_fleet = instance_nearest(x, y, obj_en_fleet); - - if (necron_fleet.owner == eFACTION.Necrons) { - if (necron_fleet.escort_number < necron_fleet.capital_number * 1.5) { - necron_fleet.escort_number += 2; - } else if (necron_fleet.frigate_number < necron_fleet.capital_number * 3) { - necron_fleet.frigate_number += 1; - } else { - necron_fleet.capital_number += 1; - } - } - } else if (present_fleet[eFACTION.Necrons] == 0) { - necron_fleet = instance_create(x, y, obj_en_fleet); - necron_fleet.owner = eFACTION.Necrons; - necron_fleet.capital_number = 1; - necron_fleet.sprite_index = spr_fleet_necron; - necron_fleet.image_speed = 0; - necron_fleet.image_index = 1; - present_fleet[eFACTION.Necrons] += 1; - } - var enemy_fleets = 0; - with(necron_fleet) { - if (owner == eFACTION.Necrons) { - var ii = 0; - ii += capital_number; - ii += round((frigate_number / 2)); - ii += round((escort_number / 4)); - if (ii <= 1) { - ii = 1; - } // image_index=max(8,round(ii)); - - if ((ii >= 7) && (capital_number > 1)) { - for (var fleet_n = 1; fleet_n <= 10; fleet_n++) { - if (orbiting.present_fleet[fleet_n] > 0) { - enemy_fleets++; - } - } - } - } - } - if (enemy_fleets > 0) { - var necron_fleet2; - necron_fleet2 = instance_create(x, y, obj_en_fleet); - necron_fleet2.owner = eFACTION.Necrons; - necron_fleet2.sprite_index = spr_fleet_necron; - // necron_fleet2.image_index=0; - necron_fleet.image_speed = 0; - necron_fleet2.capital_number = 1; - necron_fleet2.frigate_number = round(necron_fleet.frigate_number / 2); - necron_fleet2.escort_number = round(necron_fleet.escort_number / 2); - present_fleet[eFACTION.Necrons] += 1; - - necron_fleet.capital_number -= 1; - necron_fleet.frigate_number -= necron_fleet2.frigate_number; - necron_fleet.escort_number -= necron_fleet2.escort_number; - var nearest_planet_coords = [0, 0]; - var found_near_planet = false; - with(obj_star) { - if (present_fleet[eFACTION.Necrons] == 0) { - if (!array_contains(p_type, "Dead")) { - for (var plan = 1; plan <= planets; plan++) { - if (p_owner[plan] <= 5) { - found_near_planet = true; - nearest_planet_coords = [x, y]; - break; - } - } - } - } - } - - if (found_near_planet) { - var tgt1, tgt2; - - necron_fleet2.action_x = nearest_planet_coords[0]; - necron_fleet2.action_y = nearest_planet_coords[1]; - necron_fleet2.alarm[4] = 1; - } - } - } - } - } - // traitors cults - var notixt; - var is_ork; - notixt = false; - - rando = irandom(99) + 1; - - if ((p_owner[i] == eFACTION.Chaos) && (p_heresy[i] < 80)) { - p_heresy[i] += 1; - } - - if ((p_owner[i] != eFACTION.Chaos) && (p_owner[i] != eFACTION.Heretics) && (p_owner[i] != eFACTION.Eldar) && (planets >= i) && (p_type[i] != "Dead") && (p_type[i] != "Craftworld")) { - success = false; - is_ork = p_owner[i] == eFACTION.Ork; - - if (!is_ork) { - //made a linear function for this while here...now the minimum for the roll is a bit higher, but - var score_to_beat = (3 / 4) * (p_heresy[i] + p_heresy_secret[i]) - 27.5; - - //if (p_heresy[i]+p_heresy_secret[i]>=25) and (rando<=3) then success=true; - //if (p_heresy[i]+p_heresy_secret[i]>=50) and (rando<=10) then success=true; - //if (p_heresy[i]+p_heresy_secret[i]>=70) and (rando<=25) then success=true; - //if (p_heresy[i]+p_heresy_secret[i]>=90) and (rando<=40) then success=true; - if (rando < score_to_beat) { - success = true; - } - } - - if (success && (p_pdf[i] == 0) && (p_guardsmen[i] == 0) && (p_tau[i] == 0) && (p_orks[i] == 0)) { - p_owner[i] = 10; - scr_alert("red", "owner", string(name) + " " + string(i) + " has fallen to heretics!", x, y); - - if (visited == 1) { - //visited variable check whether the star has been visited or not 1 for true 0 for false - if (p_type[i] == "Forge") { - dispo[i] -= 10; // 10 disposition decreases for the respective planet - obj_controller.disposition[3] -= 3; // 10 disposition decrease for the toaster Fetishest since they aren't that numerous - } else if (planet_feature_bool(p_feature[i], P_features.Sororitas_Cathedral) || (p_type[i] == "Shrine")) { - dispo[i] -= 4; // similarly 10 disposition decrease, note those nurses are a bit pissy and - // and you can't easily gain their favor because you cannot ask them to "step down" from office. - obj_controller.disposition[5] -= 5; - } else { - // the missus diplomacy 0 is when they cringe when you enter the office and cannot ask them for a date. - } - } - } - - if (success && (p_type[i] != "Space Hulk")) { - rando = floor(random(100)) + 1; - // // // obj_controller.x=self.x;obj_controller.y=self.y; - if (is_garrison_force) { - rando -= total_garrison; - } - - var tixt = ""; - - // controls losing pdf due to heretic cults - var traitor_mod = 0; - - if (rando <= 40) { - notixt = true; - var garrison_mod = choose(0.05, 0.1, 0.15, 0.2); - - if (is_garrison_force) { - garrison_mod -= 0.01 * total_garrison; - } - - if (garrison_mod > 0) { - var lost = floor(p_pdf[i] * garrison_mod); - - if (p_pdf[i] <= 500) { - lost = p_pdf[i]; - p_traitors[i] = 1; - } - - p_pdf[i] -= lost; - - if (p_traitors[i] == 0) { - if (p_pdf[i] > 0) { - tixt = $"{scr_display_number(lost)} PDF killed in a rebellion on {planet_string}."; - } else if (p_pdf[i] == 0) { - tixt = $"Heretic cults have appeared in {planet_string}."; - } - - scr_alert("purple", "owner", tixt, x, y); - scr_event_log("purple", tixt, name); - } - } else { - tixt = $"Marine garrison prevents rebellion on {planet_string}"; - scr_alert("green", "owner", tixt, x, y); - scr_event_log("green", tixt, name); - p_heresy[i] -= irandom(5); - } - // Cult crushed; don't bother showing if there's already fighting going on over there - } else if ((rando >= 41) && (rando < 81) && (p_traitors[i] < 2)) { - if (is_garrison_force) { - traitor_mod = choose(1, 2); - } else { - traitor_mod = 2; - } - - p_traitors[i] = traitor_mod; - tixt = $"Heretic cults have appeared in {planet_string}."; - } else if ((rando >= 81) && (rando < 91) && (p_traitors[i] < 3)) { - // Minor uprising - if (is_garrison_force) { - traitor_mod = choose(2, 3); - } else { - traitor_mod = 3; - } - p_traitors[i] = traitor_mod; - tixt = $"Heretic cults have spread around {planet_string}."; - } // Major uprising - - // major and huge uprisings are impossible as long as a garrison of at least 10 marines is present - if ((rando >= 91) && (rando < 100) && (p_traitors[i] < 4)) { - notixt = true; - p_traitors[i] = 4; - - if ((obj_controller.faction_defeated[10] == 0) && (obj_controller.faction_gender[10] == 1)) { - p_traitors[i] = 5; - } - - var n_name = planet_numeral_name(i); - scr_popup("Heretic Revolt", $"A massive heretic uprising on {n_name} threatens to plunge the star system into chaos.", "chaos_cultist", ""); - scr_alert("red", "owner", $"Massive heretic uprising on {n_name}.", x, y); - scr_event_log("purple", $"Massive heretic uprising on {n_name}.", name); - } // Huge uprising - - if ((rando >= 100) && (p_traitors[i] < 5)) { - p_traitors[i] = 6; - p_owner[i] = 10; - array_push(p_feature[i], new NewPlanetFeature(P_features.Daemonic_Incursion)); - - if (p_heresy[i] >= 80) { - p_heresy[i] = 95; - } else if (p_heresy[i] < 80) { - p_heresy[i] = 80; - } - - tixt = $"Daemonic incursion on {planet_numeral_name(i)}!"; - } // Oh god what - - if ((rando >= 41) && (!notixt) && tixt != "") { - scr_alert("red", "owner", tixt, x, y); - scr_event_log("purple", tixt, name); - } - // if (p_traitors[i]>2){obj_controller.x=self.x;obj_controller.y=self.y;} - } // End traitors cult - } - // Genestealer cults grow in number - if (planet_feature_bool(p_feature[i], P_features.Gene_Stealer_Cult)) { - var cult = return_planet_features(p_feature[i], P_features.Gene_Stealer_Cult)[0]; - cult.cult_age++; - adjust_influence(eFACTION.Tyranids, cult.cult_age / 100, i); - var planet_garrison = system_garrison[i - 1]; - if (cult.hiding) { - var find_nid_chance = 50 - planet_garrison.total_garrison; - if (p_influence[i][eFACTION.Tyranids] > 50) { - var find_cult_chance = irandom(50); - var alert_text = $"A hidden Genestealer Cult in {name} Has suddenly burst forth from hiding!"; - if (planet_garrison.garrison_force) { - var alert_text = $"A hidden Genestealer Cult in {name} Has been discovered by marine garrison!"; - find_cult_chance -= 25; - } - if (find_cult_chance < 1) { - cult.hiding = false; - scr_popup("System Lost", alert_text, "Genestealer Cult", ""); - owner = eFACTION.Tyranids; - scr_event_log("red", $"A hidden Genestealer Cult in {name} {i} has Started a revolt.", name); - p_tyranids[i] += 1; - } - } - } - if ((!cult.hiding) && (p_tyranids[i] <= 3) && (p_type[i] != "Space Hulk") && (p_influence[i][eFACTION.Tyranids] > 10)) { - var spread = 0; - rando = irandom(150); - rando -= p_influence[i][eFACTION.Tyranids]; - if (rando <= 15) { - spread = 1; - } - - if ((p_type[i] == "Lava") && (p_tyranids[i] == 2)) { - spread = 0; - } - if (((p_type[i] == "Ice") || (p_type[i] == "Desert")) && (p_tyranids[i] == 3)) { - spread = 0; - } - - if (spread == 1) { - p_tyranids[i] += 1; - } - } - if (p_influence[i][eFACTION.Tyranids] > 55) { - p_owner[i] = eFACTION.Tyranids; - } - } else if (p_influence[i][eFACTION.Tyranids] > 5) { - adjust_influence(eFACTION.Tyranids, -1, i); - if ((irandom(200) + (p_influence[i][eFACTION.Tyranids] / 10)) > 195) { - array_push(p_feature[i], new NewPlanetFeature(P_features.Gene_Stealer_Cult)); - } - } - - // Spread influence on controlled sector - if ((p_type[i] != "Space Hulk") && (p_type[i] != "Dead")) { - if ((p_heresy[i] < 70) && (owner == 10)) { - p_heresy[i] += 2; - } - if ((p_heresy[i] < 70) && (owner == 8)) { - var doggy = floor(random(100)) + 1; - if ((doggy <= 5) && (p_heresy[i] >= 20)) { - p_heresy[i] += 1; - } - } - } - - if ((p_type[i] == "Daemon") && (p_type[i] != "Space Hulk")) { - if (p_pdf[i] > 0) { - p_pdf[i] = 0; - } - if (p_guardsmen[i] > 0) { - p_guardsmen[i] = 0; - } - } + system_datas[i].refresh_data(); + system_datas[i].end_of_turn_population_influence_and_enemy_growth(); // if (p_heresy[i]>0) and (owner != eFACTION.Chaos) then p_heresy[i]-=2; } // Tau rebellions diff --git a/scripts/scr_mechanicus_missions/scr_mechanicus_missions.gml b/scripts/scr_mechanicus_missions/scr_mechanicus_missions.gml index 1ab242d254..79cd0b6c24 100644 --- a/scripts/scr_mechanicus_missions/scr_mechanicus_missions.gml +++ b/scripts/scr_mechanicus_missions/scr_mechanicus_missions.gml @@ -8,7 +8,7 @@ function mechanicus_missions_end_turn(planet){ var percent_complete = increment_mission_completion(_prob_data); scr_alert("",$"mission",$"Mechanicus Mission on {planet_numeral_name(planet)} is {floor(percent_complete)}% complete.",0,0); if (percent_complete>=100){ - remove_planet_problem(planet,"mech_raider") + remove_planet_problem(planet,"mech_raider"); scr_mission_reward("mech_raider",id,planet); } } diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 2019372c7a..c260b1440c 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -86,7 +86,7 @@ function scr_new_governor_mission(planet, problem = ""){ }; if (problem != ""){ if (problem == "provide_garrison"){ - if (system_garrison[planet-1].garrison_force){ + if (system_garrison[planet].garrison_force){ exit; } mission_data.reason = choose("stability", "importance"); @@ -308,9 +308,9 @@ function init_train_forces_mission(planet, star, mission_slot, marine){ function complete_garrison_mission(targ_planet, problem_index){ var planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage", "active")){ - if (planet.current_owner == eFACTION.Imperium && system_garrison[targ_planet-1].garrison_force){ + if (planet.current_owner == eFACTION.Imperium && system_garrison[targ_planet].garrison_force){ var _mission_string = $"The garrison on {planet_numeral_name(targ_planet)} has finished the period of garrison support agreed with the planetary governor."; - var p_garrison = system_garrison[targ_planet-1]; + var p_garrison = system_garrison[targ_planet]; var result = p_garrison.garrison_disposition_change(id, targ_planet); if (!p_garrison.garrison_leader){ p_garrison.find_leader(); @@ -674,13 +674,15 @@ function deliver_trophy_end_turn_check(){ var _wanted_types = ["Ice","Desert","Agri","Lava","Death"]; var _star = scr_get_stars(true,[],_wanted_types)[0]; _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on {_star.name}."; - _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it befre you do"; + _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it before you do"; var _planet = scr_get_planet_with_type(_wanted_types); - var _battle_ground = new NewPlanetFeature(P_features.AstartesBattleGround); + var _battle_ground = new NewPlanetFeature(P_features.OldBattleGround); _battle_ground.player_hidden = false; + _battle_ground.imperium_known = true; + _star.add_feature(_planet,_battle_ground); } scr_popup( diff --git a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml index 566029cad3..5fe6d5efed 100644 --- a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml +++ b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml @@ -18,7 +18,7 @@ function new_ork_fleet(xx,yy){ function orks_end_turn_growth(){ for (i=1;i<=planets;i++){ - var _pdata = new PlanetData(i, self); + var _pdata = system_datas[i].refresh_data(); if (!p_orks[i]){ var _strongholds = _pdata.get_features(P_features.OrkStronghold); for (var s=0;s Date: Fri, 12 Dec 2025 03:29:43 +0000 Subject: [PATCH 08/93] fixes --- ChapterMaster.yyp | 2 +- scripts/scr_PlanetData/scr_PlanetData.gml | 13 +++++++------ .../scr_draw_planet_features.gml | 8 ++++---- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 6 +++--- .../scr_ork_fleet_functions.gml | 3 ++- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index b05df75306..a3915146de 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -579,7 +579,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.1400.0.901", + "IDEVersion":"2024.1400.0.904", }, "name":"ChapterMaster", "resources":[ diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 7fe9b27489..b59e6cc939 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -156,7 +156,7 @@ function PlanetData(planet, system) constructor{ static alter_influence = function(faction,value){ adjust_influence(eFACTION.Tyranids, -1, planet,system); - population_influences = p_influence[planet]; + population_influences = system.p_influence[planet]; } static send_colony_ship = function(target, targ_planet, type){ @@ -344,7 +344,7 @@ function PlanetData(planet, system) constructor{ } var _orks = planet_forces[eFACTION.Ork]; - if ((current_owner == eFACTION.Ork) && (_orks < 5) && (planet_forces[eFACTION.Heretics] == 0) && (p_player[i] <= 0 || !is_garrison_force)) { + if ((current_owner == eFACTION.Ork) && (_orks < 5) && (planet_forces[eFACTION.Heretics] == 0) && (player_forces <= 0 || !is_garrison_force)) { if ((_orks> 0) && (_ork_growth <= _ork_growth_threshold)) { if (sabotage_force) { if (irandom(3) < 2) { @@ -1151,7 +1151,7 @@ function PlanetData(planet, system) constructor{ var size = ["", "Small", "", "Large"]; if ( feat_count > 0){ for (i =0; i < feat_count ;i++){ - cur_feature= features[i] + cur_feature = features[i] if (cur_feature.planet_display != 0){ if (cur_feature.f_type == P_features.Gene_Stealer_Cult){ if (!cur_feature.hiding){ @@ -1253,7 +1253,8 @@ function PlanetData(planet, system) constructor{ system.p_tyranids[planet]-=2; } else if (planet_forces[eFACTION.Ork]>0){ - if (strength>2) then strength=2;if (strength<1) then strength=0; + if (strength>2) then strength=2; + if (strength<1) then strength=0; system.p_orks[planet]-=2; } else if (current_owner=eFACTION.Tau) and (planet_forces[eFACTION.Tau]>0){ @@ -1422,7 +1423,7 @@ function PlanetData(planet, system) constructor{ if (has_awake_tomb) { // Necron fleets, woooo //necrons kill populatin - if ((population > 0) && (p_player[i] + pdf + guardsmen + planet_forces[eFACTION.Tyranids] == 0)) { + if ((population > 0) && (player_forces + pdf + guardsmen + planet_forces[eFACTION.Tyranids] == 0)) { population = population * 0.75; if ((large_population == 0) && (population <= 5000)) { population = 0; @@ -1643,7 +1644,7 @@ function PlanetData(planet, system) constructor{ current_owner = 10; scr_alert("red", "owner", $"{name()} has fallen to heretics!", x, y); - if (visited == 1) { + if (system.visited == 1) { //visited variable check whether the star has been visited or not 1 for true 0 for false if (planet_type == "Forge") { add_disposition(-10); diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index b4a2f3ba91..48c90c2f5c 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -7,11 +7,11 @@ function FeatureSelected(Feature, system, planet) constructor{ feature = Feature; main_slate = new DataSlateMKTwo(); exit_sequence = false; - entrance_sequence=true; - remove=false; - destroy=false; + entrance_sequence = true; + remove = false; + destroy = false; exit_count = 0; - enter_count=18; + enter_count = 18; planet_data = new PlanetData(planet,system); if (feature.f_type == P_features.Forge){ diff --git a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml index 974fb2790c..e69d738942 100644 --- a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml +++ b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml @@ -52,6 +52,7 @@ function scr_enemy_ai_d() { } } } + for (var i=1;i<=planets;i++){ problem_count_down(i); if (planet_problemless(i)) then continue; @@ -445,10 +446,9 @@ function scr_enemy_ai_d() { // Local problems will go here var planet; - for (var i=0;i<=planets;i++){ - planet=i+1; + for (var planet=1;i<=planets;i++){ if (i < array_length(system_garrison)){ - var garrison = system_garrison[i]; + var garrison = system_garrison[planet]; if (garrison.garrison_force){ if (garrison.garrison_disposition_change(self,planet)!="none"){ dispo[planet]+=garrison.dispo_change; diff --git a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml index 5fe6d5efed..c2b2b81377 100644 --- a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml +++ b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml @@ -18,7 +18,8 @@ function new_ork_fleet(xx,yy){ function orks_end_turn_growth(){ for (i=1;i<=planets;i++){ - var _pdata = system_datas[i].refresh_data(); + var _pdata = system_datas[i]; + _pdata.refresh_data(); if (!p_orks[i]){ var _strongholds = _pdata.get_features(P_features.OrkStronghold); for (var s=0;s Date: Sun, 14 Dec 2025 13:09:09 +0000 Subject: [PATCH 09/93] general refactors --- scripts/scr_buttons/scr_buttons.gml | 46 ++++------ .../scr_draw_planet_features.gml | 88 ++++++++++++------- 2 files changed, 71 insertions(+), 63 deletions(-) diff --git a/scripts/scr_buttons/scr_buttons.gml b/scripts/scr_buttons/scr_buttons.gml index 357b0afc34..23fbb29839 100644 --- a/scripts/scr_buttons/scr_buttons.gml +++ b/scripts/scr_buttons/scr_buttons.gml @@ -54,22 +54,20 @@ function pop_draw_return_values() { /// @example /// var rs = new ReactiveString("Hello", 100, 200); /// rs.draw(); -function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor { +function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor{ + standard_loc_data(); + self.x1 = x1; self.y1 = y1; - x2 = 0; - y2 = 0; + self.text = text; + halign = fa_left; valign = fa_top; - - self.text = text; text_max_width = -1; font = fnt_40k_14; colour = CM_GREEN_COLOR; tooltip = ""; max_width = -1; - h = 0; - w = 0; scale_text=false; move_data_to_current_scope(data); @@ -139,11 +137,9 @@ function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor { /// @param {struct|bool} [data=false] Optional struct of properties to apply. /// @returns {LabeledIcon} function LabeledIcon(icon, text, x1 = 0, y1 = 0, data = false) constructor { + standard_loc_data(); self.x1 = x1; self.y1 = y1; - x2 = 0; - y2 = 0; - self.text = text; text_max_width = -1; font = fnt_40k_14; @@ -281,8 +277,7 @@ function standard_loc_data(){ /// @param {struct|bool} [data=false] Initial property overrides. /// @returns {UnitButtonObject} function UnitButtonObject(data = false) constructor { - x1 = 0; - y1 = 0; + standard_loc_data(); w = 102; h = 30; h_gap = 4; @@ -433,10 +428,11 @@ function PurchaseButton(req) : UnitButtonObject() constructor { static draw = function(allow_click = true) { add_draw_return_values(); - var _but = draw_unit_buttons([x1, y1, x2, y2], label, [1, 1], color,,, alpha); + draw_sprite_ext(spr_requisition, 0, x1, y1, _scale, _scale, 0, c_white, 1); + var _but = draw_unit_buttons([x1 + (get_sprite_width(spr_requisition) * scale), y1, x2, y2], label, [1, 1], color,,, alpha); var _sh = sprite_get_height(spr_requisition); var _scale = (y2 - y1) / _sh; - draw_sprite_ext(spr_requisition, 0, x1, y2, _scale, _scale, 0, c_white, 1); + var _allow_click = obj_controller.requisition >= req_value; if (scr_hit(x1, y1, x2, y2) && tooltip != "") { tooltip_draw(tooltip); @@ -460,8 +456,7 @@ function PurchaseButton(req) : UnitButtonObject() constructor { } function slider_bar() constructor { - x1 = 0; - y1 = 0; + standard_loc_data(); w = 102; h = 15; value_limits = [0, 0]; @@ -657,10 +652,7 @@ function MultiSelect(options_array, title, data = {}) constructor { self.title = title; x_gap = 10; y_gap = 5; - x1 = 0; - y1 = 0; - x2 = 0; - y2 = 0; + standard_loc_data(); on_change = false; active_col = CM_GREEN_COLOR; inactive_col = c_gray; @@ -672,6 +664,7 @@ function MultiSelect(options_array, title, data = {}) constructor { _next_tog.active = false; array_push(toggles, _next_tog); } + static update = item_data_updater; update(data); @@ -771,8 +764,7 @@ function RadioSet(options_array, title = "", data = {}) constructor { allow_changes = true; x_gap = 10; y_gap = 5; - x1 = 0; - y1 = 0; + standard_loc_data(); title_font = fnt_40k_14b; draw_title = true; space_evenly = false; @@ -905,10 +897,7 @@ function RadioSet(options_array, title = "", data = {}) constructor { /// @param {struct} [data={}] Initial properties. /// @returns {ToggleButton} function ToggleButton(data = {}) constructor { - x1 = 0; - y1 = 0; - x2 = 0; - y2 = 0; + standard_loc_data(); tooltip = ""; str1 = ""; width = 0; @@ -1036,10 +1025,7 @@ function ToggleButton(data = {}) constructor { /// @param {struct} [data={}] Initial properties. /// @returns {InteractiveButton} function InteractiveButton(data = {}) constructor { - x1 = 0; - y1 = 0; - x2 = 0; - y2 = 0; + standard_loc_data(); str1 = ""; inactive_tooltip = ""; tooltip = ""; diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index 48c90c2f5c..1fdf3fca9f 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -28,8 +28,39 @@ function FeatureSelected(Feature, system, planet) constructor{ } } } + forge_assign_button = new UnitButtonObject({ + label:"Assign To Forge", + color:CM_RED_COLOR, + bind_method :function(){ + obj_controller.unit_profile = false; + obj_controller.view_squad = false; + group_selection(techs,{ + purpose:"Forge Assignment", + purpose_code : "forge_assignment", + number:worker_capacity, + system:planet_data.system, + feature:feature, + planet : planet_data.planet, + selections : [] + }); + destroy=true; + }, + bind_scope :self, + }); + + forge_upgrade_button = new UnitButtonObject({ + color:CM_RED_COLOR, + bind_scope :self, + bind_method :function(){ + obj_controller.requisition -= upgrade_cost; + feature.size++; + worker_capacity*=2; + } + }) } + exit_button = new UnitButtonObject({label:"<---",color:CM_RED_COLOR}); + draw_planet_features = function(xx,yy){ add_draw_return_values(); draw_set_halign(fa_center); @@ -40,7 +71,7 @@ function FeatureSelected(Feature, system, planet) constructor{ xx-=(25*exit_count); main_slate.draw(xx,yy, 1.38,1.38); exit_count++; - if (xx-25<=obj_star_select.main_data_slate.XX) then remove=true; + remove = (xx-25<=obj_star_select.main_data_slate.XX); } else if (entrance_sequence){ enter_count--; xx-=(25*enter_count); @@ -49,16 +80,18 @@ function FeatureSelected(Feature, system, planet) constructor{ }else { main_slate.draw(xx,yy, 1.4,1.4); } - var area_width = main_slate.width; - var area_height = main_slate.height; - var generic = false; - var title="", body=""; - var _button_tooltip = ""; + w = main_slate.width; + h = main_slate.height; + generic = false; + title=""; + body=""; + button_tooltip = ""; //draw_glow_dot(xx+150, yy+150); //rack_and_pinion(xx+230, yy+170); var rectangle = []; draw_set_color(c_green); - if (point_and_click(draw_unit_buttons([xx+12, yy+20], "<---",[1,1],c_red))){ + exit_button.update({x1:xx+12,y1:yy+20}); + if (exit_button.draw()){ exit_sequence=true; }; draw_set_halign(fa_center); @@ -69,31 +102,20 @@ function FeatureSelected(Feature, system, planet) constructor{ draw_set_color(c_gray); draw_text(xx+10, yy+50, $"Working Techs : {feature.techs_working}/{worker_capacity}"); - if (point_and_click(draw_unit_buttons([xx+10, yy+70], "Assign To Forge",[1,1],c_red))){ - obj_controller.unit_profile = false; - obj_controller.view_squad = false; - group_selection(techs,{ - purpose:"Forge Assignment", - purpose_code : "forge_assignment", - number:worker_capacity, - system:planet_data.system, - feature:feature, - planet : planet_data.planet, - selections : [] - }); - destroy=true; - - } + forge_assign_button.update({x1:xx+10,y1 : yy+70}); + forge_assign_button.draw(); //TODO move over to using the draw button object ot streamline this - var next_position = [xx+10, yy+95]; + var next_position = {x1:x1+10, y1: yy+95}; if (feature.size<3){ var upgrade_cost = 2000 * feature.size; - var last_button = draw_unit_buttons(next_position, $"Upgrade Forge ({upgrade_cost} req)",[1,1],c_red); - next_position = [last_button[0], last_button[3]]; - if (point_and_click(last_button) && obj_controller.requisition>=upgrade_cost){ - obj_controller.requisition -= upgrade_cost; - feature.size++; - worker_capacity*=2; + forge_upgrade_button.update(next_position); + forge_upgrade_button.update({ + label:$"Upgrade Forge ({upgrade_cost} req)", + }); + forge_upgrade_button.draw(); + next_position={ + x1:forge_upgrade_button.x1, + y1:forge_upgrade_button.y2, } } if (feature.size>1 && !feature.vehicle_hanger){ @@ -267,7 +289,7 @@ function FeatureSelected(Feature, system, planet) constructor{ mission_description=$"The governor of {planet_name} has sent many requests to the sector commander for help with defending against xenos raids on the populace of the planet, the reports seem to suggest the xenos in question are in fact dark eldar."; help = "Set a squad to ambush"; button_text = "Send Squad"; - _button_tooltip = "milage may vary on playability of this mission progress at your own risk"; + button_tooltip = "milage may vary on playability of this mission progress at your own risk"; button_function = function(){ var dudes = collect_role_group("all", obj_star_select.target.name); group_selection(dudes,{ @@ -314,13 +336,13 @@ function FeatureSelected(Feature, system, planet) constructor{ var text_body_height = string_height_ext(string_hash_to_newline(mission_description),-1,area_width-20); if (help!="none"){ draw_text_ext(xx+10, yy+40+text_body_height+10,help,-1,area_width-20); - text_body_height+=string_height_ext(string_hash_to_newline(mission_description),-1,area_width-20)+10; + text_body_height += string_height_ext(string_hash_to_newline(mission_description),-1,area_width-20)+10; } if (button_text!="none"){ var _button = draw_unit_buttons([xx+((area_width/2)-(string_width(button_text)/2)), yy+40+text_body_height+10], button_text); - if (_button_tooltip != "" && scr_hit(_button)){ - tooltip_draw(_button_tooltip); + if (button_tooltip != "" && scr_hit(_button)){ + tooltip_draw(button_tooltip); } if (point_and_click(_button)){ if (is_callable(button_function)){ From cc7e43b5cac493bf1141a425fd205e296fcf6599 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 14 Dec 2025 14:16:12 +0000 Subject: [PATCH 10/93] Mechanicus Fleet shenanigans --- ChapterMaster.yyp | 1 + objects/obj_en_fleet/Create_0.gml | 6 +- scripts/scr_PlanetData/scr_PlanetData.gml | 24 +++ .../scr_draw_planet_features.gml | 36 ++-- scripts/scr_enemy_ai_e/scr_enemy_ai_e.gml | 7 +- .../scr_forge_world_functions.gml | 95 ++++++---- .../scr_mechanicus_fleet_functions.gml | 22 +++ .../scr_mechanicus_fleet_functions.yy | 13 ++ .../scr_planetary_feature.gml | 4 +- .../scr_player_fleet_functions.gml | 8 + .../scr_unit_quick_find_pane.gml | 168 +++++++++--------- 11 files changed, 241 insertions(+), 143 deletions(-) create mode 100644 scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml create mode 100644 scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index a3915146de..e69d7cd6a4 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -865,6 +865,7 @@ {"id":{"name":"scr_marine_struct","path":"scripts/scr_marine_struct/scr_marine_struct.yy",},}, {"id":{"name":"scr_master_loc","path":"scripts/scr_master_loc/scr_master_loc.yy",},}, {"id":{"name":"scr_max_marine","path":"scripts/scr_max_marine/scr_max_marine.yy",},}, + {"id":{"name":"scr_mechanicus_fleet_functions","path":"scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.yy",},}, {"id":{"name":"scr_mechanicus_missions","path":"scripts/scr_mechanicus_missions/scr_mechanicus_missions.yy",},}, {"id":{"name":"scr_mission_eta","path":"scripts/scr_mission_eta/scr_mission_eta.yy",},}, {"id":{"name":"scr_mission_functions","path":"scripts/scr_mission_functions/scr_mission_functions.yy",},}, diff --git a/objects/obj_en_fleet/Create_0.gml b/objects/obj_en_fleet/Create_0.gml index 024096527a..987ee13358 100644 --- a/objects/obj_en_fleet/Create_0.gml +++ b/objects/obj_en_fleet/Create_0.gml @@ -4,8 +4,8 @@ capital_number=0; frigate_number=0; escort_number=0; guardsmen=0; -home_x=0; -home_y=0; +home_x=x; +home_y=y; selected=0; ret=0; hurt=0; @@ -56,6 +56,8 @@ check_events_destructions = function(){ //TODO set up special save method for faction specific fleet variables inquisitor=-1; +set_movement = method(self,set_fleet_movement); + cargo_data = {}; image_xscale=1.25; diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index b59e6cc939..69d822f62f 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1762,6 +1762,30 @@ function PlanetData(planet, system) constructor{ } + static check_old_battles_feature = functions(){ + if (has_feature(P_features.OldBattleGround)){ + var _feats = get_features(P_features.OldBattleGround); + for (var i=0;i1 && !feature.vehicle_hanger){ var upgrade_cost = 3000; - var build_coords = draw_unit_buttons(next_position, $"Build Vehicle Hanger({upgrade_cost} req)",[1,1],c_red); + var build_coords = draw_unit_buttons(_next_position, $"Build Vehicle Hanger({upgrade_cost} req)",[1,1],c_red); if (scr_hit(build_coords)){ tooltip_draw("Required to Build Vehicles in the Forge") } @@ -130,7 +130,7 @@ function FeatureSelected(Feature, system, planet) constructor{ array_push(obj_controller.player_forge_data.vehicle_hanger,[obj_controller.selected.name,planet_data.planet]); } } else if(feature.vehicle_hanger){ - draw_text(next_position[0], next_position[1], "Forge has a vehicle hanger") + draw_text(_next_position[0], _next_position[1], "Forge has a vehicle hanger Allowing vehicles to be coonstructed behavior"); //TODO somthing if the forge has a hanger } break; @@ -158,6 +158,10 @@ function FeatureSelected(Feature, system, planet) constructor{ title = "Ancinet Ruins"; body = "Unload Marines onto the planet to explore the ruins"; break; + case P_features.OldBattleGround: + generic=true; + title = "Old Battlefield"; + body = "The site of a previously unrecorded battle between {feature.faction1} and {feature.faction2} forces long forgotten"; case P_features.STC_Fragment: generic=true; title = "STC Fragment"; @@ -180,7 +184,7 @@ function FeatureSelected(Feature, system, planet) constructor{ body = $"The Cult of {feature.name} {control_string}"; break; case P_features.Victory_Shrine: - draw_text_transformed(xx+(area_width/2), yy +10, "Victory Shrine", 2, 2, 0); + draw_text_transformed(xx+(w/2), yy +10, "Victory Shrine", 2, 2, 0); draw_set_halign(fa_left); draw_set_color(c_gray); /*if (!feature.parade){ @@ -192,7 +196,7 @@ function FeatureSelected(Feature, system, planet) constructor{ }*/ break; case P_features.Monastery: - draw_text_transformed(xx+(area_width/2), yy +10, feature.name, 2, 2, 0); + draw_text_transformed(xx+(w/2), yy +10, feature.name, 2, 2, 0); if (feature.forge==0){ draw_text_transformed(xx+80, yy +50, "Forge", 1, 1, 0); if (draw_building_builder(xx+40, yy+70,500,spr_forge_holo)){ @@ -329,18 +333,18 @@ function FeatureSelected(Feature, system, planet) constructor{ mission_description=$"The governor of {planet_name} has expressed his distaste of the neighboring governance of {target.name} {feature.target} he has expressed his views that they engage in heretical ways and harbor xenos enemies though in truth it is more likely that he simply wishes his political enemies disposed of, whatever the case his planet has great economic means and he has made bare his plans to compensate the emperors angels for their aid"; break; } - draw_text_transformed(xx+(area_width/2), yy +5, mission_name_key(feature.problem), 2, 2, 0); + draw_text_transformed(xx+(w/2), yy +5, mission_name_key(feature.problem), 2, 2, 0); draw_set_halign(fa_left); draw_set_color(c_gray); - draw_text_ext(xx+10, yy+40,mission_description,-1,area_width-20); - var text_body_height = string_height_ext(string_hash_to_newline(mission_description),-1,area_width-20); + draw_text_ext(xx+10, yy+40,mission_description,-1,w-20); + var text_body_height = string_height_ext(string_hash_to_newline(mission_description),-1,w-20); if (help!="none"){ - draw_text_ext(xx+10, yy+40+text_body_height+10,help,-1,area_width-20); - text_body_height += string_height_ext(string_hash_to_newline(mission_description),-1,area_width-20)+10; + draw_text_ext(xx+10, yy+40+text_body_height+10,help,-1,w-20); + text_body_height += string_height_ext(string_hash_to_newline(mission_description),-1,w-20)+10; } if (button_text!="none"){ - var _button = draw_unit_buttons([xx+((area_width/2)-(string_width(button_text)/2)), yy+40+text_body_height+10], button_text); + var _button = draw_unit_buttons([xx+((w/2)-(string_width(button_text)/2)), yy+40+text_body_height+10], button_text); if (button_tooltip != "" && scr_hit(_button)){ tooltip_draw(button_tooltip); } @@ -356,11 +360,11 @@ function FeatureSelected(Feature, system, planet) constructor{ break; } if (generic){ - draw_text_ext_transformed(xx+(area_width/2), yy +5, title, -1, area_width-20, 2, 2, 0) + draw_text_ext_transformed(xx+(w/2), yy +5, title, -1, w-20, 2, 2, 0) draw_set_halign(fa_left); draw_set_color(c_gray); - draw_text_ext(xx+10, yy+40,body,-1,area_width-20); + draw_text_ext(xx+10, yy+40,body,-1,w-20); } pop_draw_return_values(); return "done"; diff --git a/scripts/scr_enemy_ai_e/scr_enemy_ai_e.gml b/scripts/scr_enemy_ai_e/scr_enemy_ai_e.gml index 7764e2e567..dfd8ff2246 100644 --- a/scripts/scr_enemy_ai_e/scr_enemy_ai_e.gml +++ b/scripts/scr_enemy_ai_e/scr_enemy_ai_e.gml @@ -603,7 +603,8 @@ function scr_enemy_ai_e() { halfpop = p_max_population[run] / 2; if (array_length(p_feature[run])) { - var planet_data = new PlanetData(run, self); + var _planet_data = new PlanetData(run, self); + _planet_data = system_datas[run]; // Transforming billions pop number to a real number so the code can handle it // Otherwise, 3 and a half billions get translated as 3,50 instead of 3500000000 @@ -644,7 +645,9 @@ function scr_enemy_ai_e() { } } } - } + } + _planet_data.refresh_data(); + _planet_data.check_old_battles_feature(); } // End p_feature!="" diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index 34e2b21182..bfa768544a 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -25,52 +25,73 @@ function imperial_navy_fleet_construction(){ //if system needs more navy fleets get forge world to make some } else if (navy_fleet_count=0;i--){ + var _sys = _forge_systems[i]; + var good=true; + for(var o=1; o<=_sys.planets; o++) { + + if (_sys[p_type] == "Forge"){ + var _nearest = instance_nearest(x,y,obj_en_fleet) + if (_nearest.x ==x && _nearest.y==y && _nearest.navy){ + good=false; + break; + } + } + } + + if (!good){ + array_delete(_forge_systems,i,1); + } + } // After initial navy fleet construction fleet growth is handled in obj_en_fleet.alarm_5 if (array_length(forge_systems)){ - var construction_forge,new_navy_fleet; + var construction_forge; construction_forge = array_random_element(forge_systems); build_new_navy_fleet(construction_forge) } } } +function get_imperium_forge_systems(){ + var forge_systems = []; + with(obj_star){ + var good=false; + for(var o=1; o<=planets; o++) { + if (p_type[o]=="Forge") + and (p_owner[o]==eFACTION.Mechanicus) + and (p_orks[o]+p_tau[o]+p_tyranids[o]+p_chaos[o]+p_traitors[o]+p_necrons[o]==0) { + + var enemy_fleets = [ + eFACTION.Ork, + eFACTION.Tau, + eFACTION.Tyranids, + eFACTION.Chaos, + eFACTION.Necrons + ] + + var enemy_fleet_count = array_reduce(enemy_fleets, function(prev, curr) { + return prev + present_fleet[curr] + }); + + good = enemy_fleet_count<=0; + } + if (good){ + break; + } + } + if (good){ + good = x<=room_width && y<=room_height; + } + if (good){ + array_push(forge_systems, id); + } + } + return forge_systems; +} + function build_planet_defence_fleets(){ imp_ships=0; var _defence_fleet_log = {}; diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml new file mode 100644 index 0000000000..6a9982643e --- /dev/null +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml @@ -0,0 +1,22 @@ +function spawn_mechanicus_explore_fleet(){ + + var _forges = get_imperium_forge_systems(); + if (!array_length(_forges)){ + return -1; + } + + var _forge = array_random_element(_forges); + var _fleet = instance_create(_forge.x, _forge.y, obj_en_fleet); + + with (_fleet){ + owner = eFACTION.Mechanicus; + warp_able = true; + capital_number = 2; + frigate_number = 5; + escort_number = 20; + navy = 0; + choose_fleet_sprite_image(); + } + + return _fleet; +} \ No newline at end of file diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.yy b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.yy new file mode 100644 index 0000000000..da0672f643 --- /dev/null +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"scr_mechanicus_fleet_functions", + "isCompatibility":false, + "isDnD":false, + "name":"scr_mechanicus_fleet_functions", + "parent":{ + "name":"fleet", + "path":"folders/Scripts/fleet.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index 2d0cb37711..6dbccdf88e 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -69,7 +69,7 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{ break; case P_features.OldBattleGround: player_hidden = true; - imperium_known = false + imperium_known = false; //This is janky but we have no way of defining non player astartes faction1 = "astartes"; faction2 = "imperium"; @@ -77,7 +77,7 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{ break; case P_features.Secret_Base: base_type = base_types.Lair; - inquis_hidden =1; + inquis_hidden = 1; planet_display = "Hidden Secret Base"; player_hidden = 0; style = "UTL"; diff --git a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml index 47c4b41318..2b2a4d1801 100644 --- a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml +++ b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml @@ -31,6 +31,14 @@ function init_player_fleet_arrays(){ ship_turrets=[]; ship_lost = []; } + +function get_player_fleet_intercept_time(star,time_abundance){ + var _travel = -1 + var _nearest_player_fleet = instance_nearest(star.x, star.y, obj_p_fleet); + if (instance_exists(_nearest_player_fleet)){ + _travel = get_viable_travel_time(time_abundance, _nearest_player_fleet.x, _nearest_player_fleet.y, star.x, star.y, _nearest_fleet, false); + } +} function fleet_has_roles(fleet="none", roles){ var all_ships = fleet_full_ship_array(fleet); var unit; diff --git a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml index fb21493ebe..8d195ef717 100644 --- a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml +++ b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml @@ -1,14 +1,14 @@ // Script assets have changed for v2.3.0 see -// https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information +// https : //help.yoyogames.com/hc/en-us/articles/360005277377 for more information function UnitQuickFindPanel() constructor{ main_panel = new DataSlate(); garrison_log = {}; ship_count = 0; tab_buttons = { - "fleets":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "garrisons":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "hider":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "missions":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), + "fleets" : new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), + "garrisons" : new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), + "hider" : new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), + "missions" : new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), } static detail_slate = new DataSlateMKTwo(); @@ -35,11 +35,11 @@ function UnitQuickFindPanel() constructor{ static add_unit_to_garrison_log = function(_unit,unit_location){ if (!struct_exists(garrison_log, unit_location[2])){ garrison_log[$ unit_location[2]] = { - units:[_unit], - vehicles:0, - garrison:false, - healers:0, - techies:0 + units : [_unit], + vehicles : 0, + garrison : false, + healers : 0, + techies : 0 } } else { array_push(garrison_log[$ unit_location[2]].units, _unit); @@ -79,11 +79,11 @@ function UnitQuickFindPanel() constructor{ var _unit = [co, u]; if (!struct_exists(garrison_log, unit_location)){ garrison_log[$ unit_location] = { - units:[_unit], - vehicles:1, - garrison:false, - healers:0, - techies:0 + units : [_unit], + vehicles : 1, + garrison : false, + healers : 0, + techies : 0 } } else { array_push(garrison_log[$ unit_location].units, _unit); @@ -138,10 +138,10 @@ function UnitQuickFindPanel() constructor{ var mission_explain = mission_name_key(problems[p]); if (mission_explain != "none"){ var _data = { - system : name, - mission : mission_explain, - time : p_timer[i][p], - planet : i, + system : name, + mission : mission_explain, + time : p_timer[i][p], + planet : i, }; _data.click_left = method(_data,function(){ @@ -160,10 +160,10 @@ function UnitQuickFindPanel() constructor{ if (mission_explain!="none"){ array_push(temp_log, { - system : "", - mission : mission_explain, - time : obj_controller.quest_end[i] - obj_controller.turn, - planet : 0 + system : "", + mission : mission_explain, + time : obj_controller.quest_end[i] - obj_controller.turn, + planet : 0 } ) } @@ -175,19 +175,19 @@ function UnitQuickFindPanel() constructor{ var _event = events[i]; if (struct_exists(_event, "turn_end")){ switch (_event.turn_end){ - case "deliver_trophy_end_turn_check": + case "deliver_trophy_end_turn_check" : var _mission = $"Deliver Trophy Guard"; var _sys = fleets_next_location(); var _mission_data = { - mission : _mission, - system : _sys.name, - system_id : _sys.id, - target : id, - important_person : _event.fleetevent_data.trophy_owner, - person_name : _event.fleetevent_data.delivering_marine, - planet : 0, - start_system : _event.fleetevent_data.system, - time : _event.timer, + mission : _mission, + system : _sys.name, + system_id : _sys.id, + target : id, + important_person : _event.fleetevent_data.trophy_owner, + person_name : _event.fleetevent_data.delivering_marine, + planet : 0, + start_system : _event.fleetevent_data.system, + time : _event.timer, }; _mission_data.click_left = method(_mission_data,function(){ @@ -217,13 +217,13 @@ function UnitQuickFindPanel() constructor{ mission_log = temp_log; var _data = { - x1 : xx+60, - y1 : yy+50, - y2 : yy + h, - set_column_widths : [80,130], - headings : ["Location", "Mission","Time\nRemaining"], - row_data : mission_log, - row_key_draw : ["system","mission","time"], + x1 : xx+60, + y1 : yy+50, + y2 : yy + h, + set_column_widths : [80,130], + headings : ["Location", "Mission","Time\nRemaining"], + row_data : mission_log, + row_key_draw : ["system","mission","time"], } mission_table = new Table(_data); @@ -420,20 +420,20 @@ function UnitQuickFindPanel() constructor{ }else if (hover_item!="none"){ if point_and_click(hover_item.draw(xx+10, yy+90+(20*hover_item.root_item), "Manage")){ group_selection(garrison_log[$system_names[hover_item.root_item]].units,{ - purpose:$"{system_names[hover_item.root_item]} Management", - purpose_code : "manage", - number:0, - system:star_by_name(system_names[hover_item.root_item]).id, - feature:"none", - planet : 0, - selections : [] + purpose : $"{system_names[hover_item.root_item]} Management", + purpose_code : "manage", + number : 0, + system : star_by_name(system_names[hover_item.root_item]).id, + feature : "none", + planet : 0, + selections : [] }); } } } else if (view_area == "missions"){ mission_table.update({ - x1 : xx+60, - y1 : yy+50, + x1 : xx+60, + y1 : yy+50, }); mission_table.draw(); } @@ -733,7 +733,7 @@ function setup_planet_mission_group(){ } function HelpfulPlaces()constructor{ - main_panel = new DataSlate({draggable:true,cherub:true}); + main_panel = new DataSlate({draggable : true,cherub : true}); var _imperial_help_requests = stars_with_help_requests(); var _help_requests = []; @@ -741,9 +741,9 @@ function HelpfulPlaces()constructor{ for (var i=0;i 0){ var _data = { - system : id, - planet : _forge, - name : planet_numeral_name(_forge), - owner_name : obj_controller.faction[p_owner[_forge]], - owner : p_owner[_forge], - owner_status : obj_controller.faction_status[p_owner[_forge]], + system : id, + planet : _forge, + name : planet_numeral_name(_forge), + owner_name : obj_controller.faction[p_owner[_forge]], + owner : p_owner[_forge], + owner_status : obj_controller.faction_status[p_owner[_forge]], }; _data.click_left = method(_data, function(){ @@ -862,48 +862,48 @@ function HelpfulPlaces()constructor{ array_push(_columns , _longest_name); forges_table = new Table({ - row_key_draw : ["name","owner_name","owner_status"], - headings : ["Name", " Owner ", " Owner\nStatus "], - row_data : _forges, - set_column_widths : _columns, + row_key_draw : ["name","owner_name","owner_status"], + headings : ["Name", " Owner ", " Owner\nStatus "], + row_data : _forges, + set_column_widths : _columns, }); places_radio = new RadioSet([ { - str1 : "Help Requests", + str1 : "Help Requests", }, { - str1 : "Navy Fleets", + str1 : "Navy Fleets", }, { - str1 :"Forge Worlds", + str1 : "Forge Worlds", } ]); main_panel.inside_method = function(){ places_radio.update({ - x1: x1 + 30, - y1: y1 + 25, + x1 : x1 + 30, + y1 : y1 + 25, }); places_radio.draw(); var _new_position = { - x1:x1+40, - y1:y1+50, - y2:y1 + main_panel.height, + x1 : x1+40, + y1 : y1+50, + y2 : y1 + main_panel.height, } switch (places_radio.current_selection){ - case 1: + case 1 : navy_table.update(_new_position); navy_table.draw(); break; - case 0: + case 0 : help_table.update(_new_position); help_table.draw(); break; - case 2: + case 2 : forges_table.update(_new_position); forges_table.draw(); break; From d88535809f2514768fc82d275f333596c1a4d2eb Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Mon, 15 Dec 2025 20:39:38 +0000 Subject: [PATCH 11/93] trouble shoooting --- objects/obj_en_fleet/Alarm_1.gml | 4 +++- objects/obj_en_fleet/Create_0.gml | 2 +- scripts/scr_PlanetData/scr_PlanetData.gml | 2 +- scripts/scr_mission_functions/scr_mission_functions.gml | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/objects/obj_en_fleet/Alarm_1.gml b/objects/obj_en_fleet/Alarm_1.gml index 93ce5b0489..5638eaadee 100644 --- a/objects/obj_en_fleet/Alarm_1.gml +++ b/objects/obj_en_fleet/Alarm_1.gml @@ -346,7 +346,9 @@ else if (action=="" && _is_orbiting){ action_x=plin.x; action_y=plin.y; set_fleet_movement(); - if (n!=5) then good=5; + if (n!=5){ + good=5; + } } } } diff --git a/objects/obj_en_fleet/Create_0.gml b/objects/obj_en_fleet/Create_0.gml index 987ee13358..5bd4e4f684 100644 --- a/objects/obj_en_fleet/Create_0.gml +++ b/objects/obj_en_fleet/Create_0.gml @@ -18,7 +18,7 @@ guardsmen_ratio=0; guardsmen_unloaded=0; complex_route = []; warp_able = false; -ii_check=floor(random(5))+1; +ii_check = floor(random(5))+1; etah=0; safe=0; last_turn_check = 0; diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 69d822f62f..8a8615143b 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1762,7 +1762,7 @@ function PlanetData(planet, system) constructor{ } - static check_old_battles_feature = functions(){ + static check_old_battles_feature = function(){ if (has_feature(P_features.OldBattleGround)){ var _feats = get_features(P_features.OldBattleGround); for (var i=0;i30 && _roll<70){ //TODO would be cool to have this changed to be a guard specific piece of equipment From 3cc8af0e3d5c106707f606662df7b61689ef8764 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 16 Dec 2025 00:02:20 +0000 Subject: [PATCH 12/93] problems real problems --- ChapterMaster.yyp | 3 +- objects/obj_controller/CleanUp_0.gml | 10 +- objects/obj_en_fleet/Create_0.gml | 4 +- objects/obj_en_fleet/Draw_0.gml | 153 ++++--- objects/obj_star/Draw_0.gml | 63 ++- scripts/__init_global/__init_global.gml | 1 + .../action_draw_ellipse.gml | 8 + scripts/ds_map_helpers/ds_map_helpers.gml | 21 + scripts/ds_map_helpers/ds_map_helpers.yy | 13 + .../scr_fleet_functions.gml | 379 ++++++++---------- 10 files changed, 364 insertions(+), 291 deletions(-) create mode 100644 scripts/ds_map_helpers/ds_map_helpers.gml create mode 100644 scripts/ds_map_helpers/ds_map_helpers.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index 227a018050..bf9558d3e3 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -579,7 +579,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.1400.0.901", + "IDEVersion":"2024.1400.0.904", }, "name":"ChapterMaster", "resources":[ @@ -728,6 +728,7 @@ {"id":{"name":"DiploCommonComponents","path":"scripts/DiploCommonComponents/DiploCommonComponents.yy",},}, {"id":{"name":"draw_line_dashed","path":"scripts/draw_line_dashed/draw_line_dashed.yy",},}, {"id":{"name":"draw_set_blend_mode","path":"scripts/draw_set_blend_mode/draw_set_blend_mode.yy",},}, + {"id":{"name":"ds_map_helpers","path":"scripts/ds_map_helpers/ds_map_helpers.yy",},}, {"id":{"name":"exp_and_exp_growth","path":"scripts/exp_and_exp_growth/exp_and_exp_growth.yy",},}, {"id":{"name":"explode_script","path":"scripts/explode_script/explode_script.yy",},}, {"id":{"name":"instance_create","path":"scripts/instance_create/instance_create.yy",},}, diff --git a/objects/obj_controller/CleanUp_0.gml b/objects/obj_controller/CleanUp_0.gml index e43d58b1e2..7e592e24d0 100644 --- a/objects/obj_controller/CleanUp_0.gml +++ b/objects/obj_controller/CleanUp_0.gml @@ -1,12 +1,6 @@ global.name_generator = new NameGenerator(); -var _star_arrays = []; -ds_map_values_to_array(global.star_sprites,_star_arrays); -for (var i=0;iroom_width) or (y<0) or (y>room_height) then exit; -if (image_alpha=0) then exit; +if (!point_in_rectangle(x, y, 0, 0, room_width, room_height) || !image_alpha){ + exit; +} var coords = [0,0]; var near_star = instance_nearest(x,y, obj_star); @@ -15,59 +24,104 @@ if (x==near_star.x && y==near_star.y){ var coords = fleet_star_draw_offsets(); } +image_index = min(image_index,9) -if (image_index>9) then image_index=9; +var _scale_x_pos = x+(coords[0]*scale); +var _scale_y_pos = y+(coords[1]*scale); +var _m_dist=point_distance(mouse_x,mouse_y,_scale_x_pos,(_scale_y_pos)); -var m_dist=point_distance(mouse_x,mouse_y,x+(coords[0]*scale),y+((coords[1])*scale+(12*scale))); -var within=false; -if (!obj_controller.zoomed){ - if (m_dist<=16*scale) and (!instance_exists(obj_ingame_menu)) then within=1; -} -if (obj_controller.zoomed=1){ +var _is_zoom = obj_controller.zoomed; + +var _within = _m_dist<=16*scale && !_is_zoom && !instance_exists(obj_ingame_menu); + + +add_draw_return_values(); +if (_is_zoom){ var faction_colour = global.star_name_colors[owner]; draw_set_color(faction_colour); if (owner == eFACTION.Imperium) and (navy=0) then draw_set_alpha(0.5); draw_circle(x,y,12,0); draw_set_alpha(1); - if (m_dist<=16) and (!instance_exists(obj_ingame_menu)) then within=1; + if (_m_dist<=16) and (!instance_exists(obj_ingame_menu)) then _within=1; } -// if (obj_controller.selected!=0) and (selected=1) then within=1; +// if (obj_controller.selected!=0) and (selected=1) then _within=1; -if (obj_controller.selecting_planet>0){ - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249){ - if (instance_exists(obj_star_select)){if (obj_star_select.button1!="") then within=0;} - } - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234+16) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249+16){ - if (instance_exists(obj_star_select)){if (obj_star_select.button2!="") then within=0;} - } - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234+32) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249+32){ - if (instance_exists(obj_star_select)){if (obj_star_select.button3!="") then within=0;} - } +if (obj_controller.selecting_planet>0 && _within){ + _within = scr_void_click(); } - -if (action!=""){ - draw_set_halign(fa_left);draw_set_alpha(1); +if (action != ""){ + draw_set_halign(fa_left); + draw_set_alpha(1); draw_set_color(c_white); draw_line_width(x,y,action_x,action_y,1); // draw_set_font(fnt_40k_14b); - if (obj_controller.zoomed=0) then draw_text_transformed(x+12,y,string_hash_to_newline("ETA "+string(action_eta)),1,1,0); - if (obj_controller.zoomed=1) then draw_text_transformed(x+24,y,string_hash_to_newline("ETA "+string(action_eta)),2,2,0);// was 1.4 + var _tex_scale = obj_controller.zoomed ?2:1; + draw_text_transformed(x+12,y,$"ETA {action_eta}",_tex_scale,_tex_scale,0); } + + switch(owner){ case eFACTION.Ork: - var _has_warboss =false; + var _has_warboss =false; if (fleet_has_cargo("ork_warboss")){ draw_icon = true; _has_warboss = true; } + break; +} +var _reset = false; + +if (last_turn_image_check != obj_controller.turn){ + _reset = true; + +} + +if (ds_map_exists(global.en_fleet_sprites, uid)){ + if (_reset){ + ds_map_delete_sprite(global.en_fleet_sprites, uid); + } +} else { + _reset = true; +} + +if (_reset){ + add_draw_return_values(); + var _fleet_image_surface = surface_create(128, 64); + surface_set_target(_fleet_image_surface); + var faction_colour = global.star_name_colors[owner]; + var _xx = 24; + var _yy = 24; + draw_set_color(faction_colour); + draw_set_alpha(0.5); + draw_circle(_xx,_yy,12,0); + draw_set_alpha(1); + if (navy && owner == eFACTION.Imperium){ + draw_set_color(global.star_name_colors[eFACTION.Mechanicus]); + draw_circle_with_outline_width(); + draw_circle_with_outline_width(_xx,_yy,12,0.3); + } + + if (draw_icon){ + draw_sprite_ext(spr_faction_icons, owner,_xx-32,_yy-32,1,1,0,c_white,1) + } + draw_sprite_ext(sprite_index,image_index,_xx,_yy,1,1,0,c_white,1); + + surface_reset_target(); + + var _new_sprite = sprite_create_from_surface(_fleet_image_surface, 0, 0, surface_get_width(_fleet_image_surface), surface_get_height(_fleet_image_surface), false, false, 0, 0); + + ds_map_set(global.en_fleet_sprites, uid, _new_sprite); + surface_clear_and_free(_fleet_image_surface); + last_turn_image_check = obj_controller.turn; + pop_draw_return_values(); } var fleet_descript=""; -if (within=1) or (selected>0){ +if (_within || selected>0){ draw_set_color(CM_GREEN_COLOR); draw_set_font(fnt_40k_14b); draw_set_halign(fa_center); @@ -129,7 +183,7 @@ if (within=1) or (selected>0){ // if (owner = eFACTION.Imperium) and (navy=1){fleet_descript=string(capital_max_imp[1]+frigate_max_imp[1]+escort_max_imp[1]);} if (global.cheat_debug=true){ - fleet_descript+="C"+string(capital_number)+"|F"+string(frigate_number)+"|E"+string(escort_number); + fleet_descript+=$"C{capital_number}|F{frigate_number}|E{escort_number}"; } // fleet_descript=string(capital_number)+"|"+string(frigate_number)+"|"+string(escort_number); @@ -138,34 +192,13 @@ if (within=1) or (selected>0){ draw_set_halign(fa_left); } -if (fleet_descript!="" && within){ - tooltip_draw(fleet_descript); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12*scale,0); -} else { - var faction_colour = global.star_name_colors[owner]; - draw_set_color(faction_colour); - draw_set_alpha(0.5); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12*scale,0); - draw_set_alpha(1); - if (navy && owner == eFACTION.Imperium){ - draw_set_color(global.star_name_colors[eFACTION.Mechanicus]); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12*scale,1); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12.1*scale,1); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12.2*scale,1); - } -} -if (draw_icon){ - draw_sprite_ext(spr_faction_icons, owner,x+(coords[0]*scale)-(32*scale),y+(coords[1]*scale)-(32*scale),1*scale,1*scale,0,c_white,1) -} -draw_sprite_ext(sprite_index,image_index,x+(coords[0]*scale),y+(coords[1]*scale),1*scale,1*scale,0,c_white,1); - +var _sprite = ds_map_find_value(global.en_fleet_sprites, uid) +draw_sprite_ext(_sprite, 0, _scale_x_pos-(24*scale) , _scale_y_pos-(24*scale), scale, scale, 1, c_white, 1); -/*if (owner = eFACTION.Ork){ - draw_set_font(fnt_small); - draw_set_halign(fa_center); - draw_set_color(c_white); - draw_text(x,y+32,string(escort_number)+"/"+string(frigate_number)+"/"+string(capital_number)); -}*/ +if (fleet_descript!="" && _within){ + tooltip_draw(fleet_descript); + draw_circle(_scale_x_pos,_scale_y_pos,12*scale,0); +} if (instance_exists(target)){ @@ -175,5 +208,7 @@ if (instance_exists(target)){ draw_set_alpha(1); } +pop_draw_return_values(); + /* */ /* */ diff --git a/objects/obj_star/Draw_0.gml b/objects/obj_star/Draw_0.gml index cf103abbff..5f4c8c546b 100644 --- a/objects/obj_star/Draw_0.gml +++ b/objects/obj_star/Draw_0.gml @@ -1,24 +1,42 @@ // Draws the system name and color codes it based on ownership +add_draw_return_values(); if (p_type[1]="Craftworld") and (obj_controller.known[eFACTION.Eldar]=0){ draw_set_alpha(0); draw_set_color(255); draw_circle(old_x,old_y,5,0); draw_set_alpha(1); + pop_draw_return_values(); exit; } var show=name; -if (global.cheat_debug=true) then show=string(name)+"#"+string(p_problem[1,1])+":"+string(p_timer[1,1])+"#"+string(p_problem[1,2])+":"+string(p_timer[1,2])+"#"+string(p_problem[1,3])+":"+string(p_timer[1,3]); +if (global.cheat_debug){ + show = $"{name}"; + for (var i=1;i<=planets;i++){ + for (p=0;p0) then draw_sprite_ext(spr_warp_storm,storm_image,x,y,0.75*scale,0.75*scale,0,c_white,1); +if (storm>0){ + draw_sprite_ext(spr_warp_storm,storm_image,x,y,0.75*scale,0.75*scale,0,c_white,1); +} //ad hoc way of determining whether stuff is in view or not...needs work @@ -44,38 +62,39 @@ if (global.load == -1 && (obj_controller.zoomed || in_camera_view(star_box_shape } if (ds_map_exists(global.star_sprites, name)){ - var _old_sprite = ds_map_find_value(global.star_sprites, name); - if (sprite_exists(_old_sprite)){ - if (_reset){ - sprite_delete(_old_sprite); - } - } else { - _reset = true; - } if (_reset){ - ds_map_delete(global.star_sprites, name); + ds_map_delete_sprite(global.star_sprites, name); } } else { _reset = true; } + if (_reset){ - star_tag_surface = surface_create(256, 128); + var star_tag_surface = surface_create(256, 128); var xx=64; var yy=0; surface_set_target(star_tag_surface); - var panel_width = string_width(name) + 60; + + var _name_width = string_width(name); + + var _panel_width = _name_width + 60; + + var _panel_center = xx-(_panel_width/2); + + var _panel_y = yy + 30; + if (owner != eFACTION.Player ){ var _faction_index = owner; var faction_colour = global.star_name_colors[_faction_index]; - draw_sprite_general(spr_p_name_bg, 0, 0, 0, string_width(name) + 60, 32, xx-(panel_width/2), yy+30, 1, 1, 0, faction_colour, faction_colour, faction_colour, faction_colour, 1); - draw_sprite_ext(spr_faction_icons,_faction_index,xx+(panel_width/2)-30,yy+25, 0.60, 0.60, 0, c_white, 1); + draw_sprite_general(spr_p_name_bg, 0, 0, 0, _panel_width, 32, _panel_center, _panel_y, 1, 1, 0, faction_colour, faction_colour, faction_colour, faction_colour, 1); + draw_sprite_ext(spr_faction_icons,_faction_index,xx+(_panel_width/2)-30,yy+25, 0.60, 0.60, 0, c_white, 1); } else { scr_shader_initialize(); var main_color = make_colour_from_array(obj_controller.body_colour_replace); var right_pauldron = make_colour_from_array(obj_controller.pauldron_colour_replace); - draw_sprite_general(spr_p_name_bg, 0, 0, 0, string_width(name) + 60, 32, xx-(panel_width/2), yy+30, 1, 1, 0, main_color, main_color, right_pauldron, right_pauldron, 1); + draw_sprite_general(spr_p_name_bg, 0, 0, 0, _panel_width, 32, _panel_center, _panel_y, 1, 1, 0, main_color, main_color, right_pauldron, right_pauldron, 1); var faction_sprite = global.chapter_icon.sprite; - draw_sprite_ext(faction_sprite,0,xx+(panel_width/2)-30,yy+30, 0.2, 0.2, 0, c_white, 1); + draw_sprite_ext(faction_sprite,0,_panel_center-30,_panel_y, 0.2, 0.2, 0, c_white, 1); //context.set_vertical_gradient(main_color, right_pauldron); //draw_text_ext_transformed_color(gx + xoffset,gy + yoffset,text,sep,owner.width,xscale,yscale,angle ,col1, col2, col3, col4, alpha); } @@ -90,6 +109,8 @@ if (global.load == -1 && (obj_controller.zoomed || in_camera_view(star_box_shape var _sprite = ds_map_find_value(global.star_sprites, name) draw_sprite_ext(_sprite, 0, x-(64*scale), y, scale, scale, 1, c_white, 1); } -draw_set_valign(fa_top) +draw_set_valign(fa_top); + +pop_draw_return_values(); diff --git a/scripts/__init_global/__init_global.gml b/scripts/__init_global/__init_global.gml index 5ffa35cd09..927f1913bb 100644 --- a/scripts/__init_global/__init_global.gml +++ b/scripts/__init_global/__init_global.gml @@ -42,5 +42,6 @@ function __init_global() { global.ui_click_lock = false; global.name_generator = new NameGenerator(); global.star_sprites = ds_map_create(); + global.en_fleet_sprites = ds_map_create(); global.base_component_surface = -1; } diff --git a/scripts/action_draw_ellipse/action_draw_ellipse.gml b/scripts/action_draw_ellipse/action_draw_ellipse.gml index 97ccdf0dc5..6475d0e821 100644 --- a/scripts/action_draw_ellipse/action_draw_ellipse.gml +++ b/scripts/action_draw_ellipse/action_draw_ellipse.gml @@ -22,3 +22,11 @@ function action_draw_ellipse(argument0, argument1, argument2, argument3, argumen } + + +function draw_circle_with_outline_width(xx,yy,r,w){ + for (var i=0.0;i0){// 135 ; guardsmen onto planet - var en_p,en_planets,land,i; - i=0;en_planets=0;land=0; - - if (sta.x=home_x) and (sta.y=home_y){ - repeat(4){i+=1; - en_p[i]=0; - if (sta.p_owner[i]<=5){en_p[i]=1;en_planets+=1;} - } - - if (guardsmen>0) and (en_planets>0){ - land=floor(guardsmen/en_planets); - i=0; - repeat(4){i+=1; - if (en_p[i]=1){guardsmen-=land;sta.p_guardsmen[i]+=land;} - } - if (guardsmen<5) then guardsmen=0; - } - } - if (sta.owner>5) or ((sta.owner = eFACTION.Player) and (obj_controller.faction_status[eFACTION.Imperium]="War")){ - repeat(4){i+=1; - en_p[i]=0; - if (sta.p_player[i]>0) and (obj_controller.faction_status[eFACTION.Imperium]="War"){en_p[i]=1;en_planets+=1;} - } - - if (guardsmen>0) and (en_planets>0){ - land=floor(guardsmen/en_planets); - i=0; - repeat(4){i+=1; - if (en_p[i]=1){guardsmen-=land;sta.p_guardsmen[i]+=land;} - } - if (guardsmen<5) then guardsmen=0; - } - } - }*/ - if (owner= eFACTION.Inquisition){ @@ -785,7 +750,9 @@ function fleet_arrival_logic(){ if (instance_exists(obj_p_ship)){ var p_ship=instance_nearest(x,y,obj_p_ship); if (p_ship.action="") and (point_distance(x,y,p_ship.x,p_ship.y)<80){ - if (obj_controller.p_known[8]=0) then obj_controller.p_known[8]=1; + if (obj_controller.p_known[8]=0){ + obj_controller.p_known[8]=1; + } } } } @@ -797,16 +764,10 @@ function fleet_arrival_logic(){ if (point_distance(plap.x,plap.y,action_x,action_y)<80) then mess=0; } - if (mess=1) and (sta.vision!=0){ - scr_alert("red","owner",$"Contact has been lost with {sta.name}!",sta.x,sta.y); - scr_event_log("red",$"Contact has been lost with {sta.name}.");sta.vision=0;} + if (mess=1) and (orbiting.vision!=0){ + scr_alert("red","owner",$"Contact has been lost with {orbiting.name}!",orbiting.x,orbiting.y); + scr_event_log("red",$"Contact has been lost with {orbiting.name}.");orbiting.vision=0;} } - action_x=0; - action_y=0; - - - - // 135 ; fleet chase @@ -815,159 +776,161 @@ function fleet_arrival_logic(){ } - old_x=x;old_y=y; - x=-100;y=-100; - - cur_star=instance_nearest(old_x,old_y,obj_en_fleet); - var mergus=false; - - mergus=cur_star.image_index; - if (mergus<3) then mergus=0; - if (mergus>=3) then mergus=10; - if (owner = eFACTION.Tau) and (mergus>=3) then mergus=0; - if (string_count("_her",trade_goods)=0) then mergus=99;// was 999 - - // Think this might be causing the crash - if (owner=eFACTION.Tau) and (sta.present_fleet[eFACTION.Imperium]+sta.present_fleet[eFACTION.Player]>=1) - and (sta.present_fleet[eFACTION.Tau]=1) and (image_index=1) and (ret=0) then mergus=15; - if (cur_star.owner=eFACTION.Tau) and (owner=eFACTION.Tau) and (ret=1) then mergus=0; - - - - - if (owner=eFACTION.Tau) and (image_index=1){ - // show_message("Tau||| Other Owner: "+string(cur_star.owner)+" ret: "+string(ret)+" mergus: "+string(mergus)); - } - - if (owner=eFACTION.Chaos) and (fleet_has_cargo("csm")) or ( fleet_has_cargo("warband")){ - mergus=0; - } - // if (cur_star.owner!=owner) then mergus=0; - - - - - if (cur_star.x=old_x) and (cur_star.y=old_y) and (cur_star.owner=self.owner) and (cur_star.action="") and (mergus=1999){// Merge the fleets - cur_star.escort_number+=self.escort_number; - cur_star.frigate_number+=self.frigate_number;// show_message("Tau fleet merging"); - cur_star.capital_number+=self.capital_number; - cur_star.guardsmen+=self.guardsmen; - - - - cur_star=instance_nearest(old_x,old_y,obj_star); - // if (cur_star.present_fleets>=1) then cur_star.present_fleets-=1; - if (owner = eFACTION.Tau){obj_controller.tau_fleets-=1;cur_star.tau_fleets-=1;} - if (owner = eFACTION.Chaos) then obj_controller.chaos_fleets-=1; - - instance_destroy(); - }// End merge fleets - - - - if (owner=eFACTION.Tau) and (mergus=15){ // Get the fuck out - var new_star, stue;new_star=0;stue=0;ret=1; - - - instance_activate_object(obj_star);// new_star - stue=instance_nearest(x,y,obj_star); - - - - if (image_index=1){// Start influence thing - var tau_influence; - var tau_influence_chance=irandom(100)+1; - var tau_influence_planet=irandom(stue.planets)+1; - - with (stue){ - if (p_type[tau_influence_planet]!="Dead"){ - - scr_alert("green","owner",$"Tau ship broadcasts subversive messages to {planet_numeral_name(tau_influence_planet)}.",sta.x,sta.y); - tau_influence = p_influence[tau_influence_planet][eFACTION.Tau] - - if (tau_influence_chance<=70) and (tau_influence<70){ - adjust_influence[tau_influence_planet](eFACTION.Tau, 10, tau_influence_planet); - if (p_type[tau_influence_planet]=="Forge") then adjust_influence(eFACTION.Tau, -5, tau_influence_planet); - } - - if (tau_influence_chance<=3) and (tau_influence<70){ - adjust_influence(eFACTION.Tau, 30, tau_influence_planet); - if (p_type[tau_influence_planet]=="Forge") then adjust_influence(eFACTION.Tau, -25, tau_influence_planet); - } - } - } - } - - - - instance_deactivate_object(stue); - - with(obj_star){ - if (owner != eFACTION.Tau) then instance_deactivate_object(instance_id); - } - - var good;good=0; - - repeat(100){ - var xx, yy; - if (good=0){ - xx=x+choose(random(300),random(300)*-1); - yy=y+choose(random(300),random(300)*-1); - new_star=instance_nearest(xx,yy,obj_star); - if (new_star.owner!=eFACTION.Tau) then with(new_star){instance_deactivate_object(id);} - if (new_star.owner=eFACTION.Tau) then good=1; - } - } - - // show_message("Get the fuck out working?: "+string(good)); - - if (new_star.owner=eFACTION.Tau){ - // show_message("Tau fleet actually fleeing"); - action_x=new_star.x; - action_y=new_star.y; - set_fleet_movement(); - } - - instance_activate_object(obj_star); - // This appears bugged - } - - - - - - - x=old_x; - y=old_y; - - var _csm = fleet_has_cargo("warband"); + var old_x=x,old_y=y; + var _other_orbiting = []; + var _id = id; + with (obj_en_fleet){ + if (x!=old_x || y!=old_y){ + continue; + } + if (_id==id ){ + continue; + } + + array_push(_other_orbiting,id); - if (cur_star.x=old_x) and (cur_star.y=old_y) and (cur_star.owner=self.owner) and (cur_star.action="") and ((owner = eFACTION.Tau) or (owner = eFACTION.Chaos)) and (mergus=10) and (!_csm){// Move somewhere new - var stue, stue2;stue=0;stue2=0; - var goood=0; - - with(obj_star){ - if (is_dead_star()){ - instance_deactivate_object(id); - } - } - stue=instance_nearest(x,y,obj_star); - instance_deactivate_object(stue); - repeat(10){ - if (goood=0){ - stue2=instance_nearest(x+choose(random(400),random(400)*-1),y+choose(random(400),random(400)*-1),obj_star); - if (owner = eFACTION.Tau) and (stue2.owner = eFACTION.Tau) then goood=1; - if (owner = eFACTION.Chaos) and (stue2.owner != eFACTION.Chaos) then goood=1; - if (stue2.planets=0) then goood=0; - if (stue.present_fleet[eFACTION.Imperium]>0) or (stue.present_fleet[eFACTION.Player]>0) then goood=0; - if (stue2.planets=1) and (stue2.p_type[1]="Dead") then goood=0; - } - } - action_x=stue2.x; - action_y=stue2.y; - set_fleet_movement();// stue.present_fleets-=1; - instance_activate_object(obj_star); } + + for (var i=0;i=3) then mergus=10; + if (owner = eFACTION.Tau) and (mergus>=3) then mergus=0; + if (string_count("_her",trade_goods)=0) then mergus=99;// was 999 + + // Think this might be causing the crash + if (owner=eFACTION.Tau) and (sta.present_fleet[eFACTION.Imperium]+sta.present_fleet[eFACTION.Player]>=1) + and (sta.present_fleet[eFACTION.Tau]=1 && image_index=1) and (ret=0) then mergus=15; + + if (_other_fleet.owner=eFACTION.Tau) and (owner=eFACTION.Tau) and (ret=1) then mergus=0; + + + + + if (owner=eFACTION.Tau) and (image_index=1){ + // show_message("Tau||| Other Owner: "+string(cur_star.owner)+" ret: "+string(ret)+" mergus: "+string(mergus)); + } + + if (owner=eFACTION.Chaos) and (fleet_has_cargo("csm")) or ( fleet_has_cargo("warband")){ + mergus=0; + } + // if (cur_star.owner!=owner) then mergus=0; + + + + + //This will never trigger at the moment + if ((_other_fleet.owner=self.owner) and (_other_fleet.action="") and (mergus=1999){// Merge the fleets + merge_fleets(id,_other_fleet) + + }// End merge fleets + + + + if (owner=eFACTION.Tau) and (mergus=15){ // Get the fuck out + var new_star;new_star=0;ret=1; + + + instance_activate_object(obj_star);// new_star + + + + if (image_index=1){// Start influence thing + + with (orbiting){ + var tau_influence; + var tau_influence_chance=irandom(100)+1; + var tau_influence_planet=irandom(orbiting.planets)+1; + if (p_type[tau_influence_planet]!="Dead"){ + + scr_alert("green","owner",$"Tau ship broadcasts subversive messages to {planet_numeral_name(tau_influence_planet)}.",sta.x,sta.y); + tau_influence = p_influence[tau_influence_planet][eFACTION.Tau] + + if (tau_influence_chance<=70) and (tau_influence<70){ + adjust_influence[tau_influence_planet](eFACTION.Tau, 10, tau_influence_planet); + if (p_type[tau_influence_planet]=="Forge"){ + adjust_influence(eFACTION.Tau, -5, tau_influence_planet); + } + } + + if (tau_influence_chance<=3) and (tau_influence<70){ + adjust_influence(eFACTION.Tau, 30, tau_influence_planet); + if (p_type[tau_influence_planet]=="Forge"){ + adjust_influence(eFACTION.Tau, -25, tau_influence_planet); + } + } + } + } + } + + + + instance_deactivate_object(orbiting); + + with(obj_star){ + if (owner != eFACTION.Tau) then instance_deactivate_object(instance_id); + } + + var good=0; + + repeat(100){ + var xx, yy; + if (good=0){ + xx=x+choose(random(300),random(300)*-1); + yy=y+choose(random(300),random(300)*-1); + new_star=instance_nearest(xx,yy,obj_star); + if (new_star.owner!=eFACTION.Tau) then with(new_star){instance_deactivate_object(id);} + if (new_star.owner=eFACTION.Tau) then good=1; + } + } + + // show_message("Get the fuck out working?: "+string(good)); + + if (new_star.owner==eFACTION.Tau){ + // show_message("Tau fleet actually fleeing"); + action_x=new_star.x; + action_y=new_star.y; + set_fleet_movement(); + } + + instance_activate_object(obj_star); + // This appears bugged + } + + var _csm = fleet_has_cargo("warband"); + + if (cur_star.x=old_x) and (cur_star.y=old_y) and (cur_star.owner=self.owner) and (cur_star.action="") and ((owner = eFACTION.Tau) or (owner = eFACTION.Chaos)) and (mergus=10) and (!_csm){// Move somewhere new + var stue, stue2;stue=0;stue2=0; + var goood=0; + + with(obj_star){ + if (is_dead_star()){ + instance_deactivate_object(id); + } + } + stue=instance_nearest(x,y,obj_star); + instance_deactivate_object(stue); + repeat(10){ + if (goood=0){ + stue2=instance_nearest(x+choose(random(400),random(400)*-1),y+choose(random(400),random(400)*-1),obj_star); + if (owner = eFACTION.Tau) and (stue2.owner = eFACTION.Tau) then goood=1; + if (owner = eFACTION.Chaos) and (stue2.owner != eFACTION.Chaos) then goood=1; + if (stue2.planets=0) then goood=0; + if (stue.present_fleet[eFACTION.Imperium]>0) or (stue.present_fleet[eFACTION.Player]>0) then goood=0; + if (stue2.planets=1) and (stue2.p_type[1]="Dead") then goood=0; + } + } + action_x=stue2.x; + action_y=stue2.y; + set_fleet_movement();// stue.present_fleets-=1; + instance_activate_object(obj_star); + } + } + // ORKS @@ -1031,8 +994,6 @@ function fleet_arrival_logic(){ instance_activate_object(obj_star); } - - exit;// end of eta=0 } function choose_fleet_sprite_image(){ @@ -1068,6 +1029,22 @@ function merge_fleets(main_fleet, merge_fleet){ main_fleet.cargo_data[$ _merge_cargo[i]] = merge_fleet.cargo_data[$ _merge_cargo[i]]; } } + main_fleet.guardsmen += merge_fleet.guardsmen; + + //This bit allseems a bit superfluouse but keepingjust in case it breaks something + switch(merge_fleet.owner){ + var _is_orbiting = is_orbiting(merge_fleet); + case eFACTION.Tau: + obj_controller.tau_fleets--; + if (_is_orbiting){ + merge_fleet.orbiting.tau_fleets--; + } + break; + case eFACTION.Chaos: + obj_controller.chaos_fleets--; + break; + + } instance_destroy(merge_fleet.id); } From 6a17fd039cbdf5300eb7e4b2fe2f7b6e73f5d016 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 16 Dec 2025 00:10:08 +0000 Subject: [PATCH 13/93] centralise fleet strength calc --- objects/obj_en_fleet/Alarm_1.gml | 2 +- objects/obj_en_fleet/Step_0.gml | 7 ++----- scripts/scr_PlanetData/scr_PlanetData.gml | 5 +---- scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml | 6 +++--- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 2 +- .../scr_forge_world_functions.gml | 2 +- .../scr_imperial_navy_functions.gml | 15 ++++----------- .../scr_ork_fleet_functions.gml | 2 +- .../scr_player_fleet_functions.gml | 5 +---- 9 files changed, 15 insertions(+), 31 deletions(-) diff --git a/objects/obj_en_fleet/Alarm_1.gml b/objects/obj_en_fleet/Alarm_1.gml index 93ce5b0489..8419676d77 100644 --- a/objects/obj_en_fleet/Alarm_1.gml +++ b/objects/obj_en_fleet/Alarm_1.gml @@ -329,7 +329,7 @@ else if (action=="" && _is_orbiting){ new_fleet.image_index=1; /*with(new_fleet){ - var ii;ii=0;ii+=capital_number;ii+=round((frigate_number/2));ii+=round((escort_number/4)); + var ii=floor(standard_fleet_strength_calc()); if (ii<=1) then ii=1;image_index=ii; }*/ diff --git a/objects/obj_en_fleet/Step_0.gml b/objects/obj_en_fleet/Step_0.gml index 00144c38dc..3e55ade5f0 100644 --- a/objects/obj_en_fleet/Step_0.gml +++ b/objects/obj_en_fleet/Step_0.gml @@ -31,16 +31,13 @@ if (ii_check=0){ ii_check=10; if (owner != eFACTION.Eldar) and (owner != eFACTION.Inquisition){ - var ii=0; - ii+=capital_number; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1; image_index=ii; image_index=min(image_index,9); } if (owner = eFACTION.Eldar){ - var ii;ii=0;ii+=capital_number;ii+=round((frigate_number/2));ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1;image_index=ii; image_index=min(image_index,5); } diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 96dc83e039..c1385bfe75 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -418,10 +418,7 @@ function PlanetData(planet, system) constructor{ } } - var ii=0; - ii+=capital_number; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1; image_index=ii; //if big enough flee bugger off to new star diff --git a/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml b/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml index 33b4d73bf4..373a02512e 100644 --- a/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml +++ b/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml @@ -117,7 +117,7 @@ function scr_enemy_ai_c() { } /*if (fleet!=0){ if (instance_exists(fleet)) then with(fleet){ - var ii;ii=0;ii+=capital_number;ii+=round((frigate_number/2));ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1;image_index=ii; } }*/ @@ -319,7 +319,7 @@ function scr_enemy_ai_c() { } /*if (fleet!=0){ if (instance_exists(fleet)) then with(fleet){ - var ii;ii=0;ii+=capital_number;ii+=round((frigate_number/2));ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1;image_index=ii; } }*/ @@ -343,7 +343,7 @@ function scr_enemy_ai_c() { if (p_type[i]="Death") or (p_type[i]="Hive") then ship.capital_number+=choose(0,1,1); ship.capital_number+=1; ship.escort_number+=3; - ship.image_index=floor((ship.capital_number)+(ship.frigate_number/2)+(ship.escort_number/4)); + ship.image_index=round(standard_fleet_strength_calc()); p_type[i]="Dead"; delete_features(p_feature[i], P_features.Reclamation_pools);// show_message("D"); if (planets=1) and (p_type[1]="Dead") then image_alpha=0.33; diff --git a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml index 974fb2790c..9af3f039dd 100644 --- a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml +++ b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml @@ -283,7 +283,7 @@ function scr_enemy_ai_d() { fleet.frigate_number=round(random_range(4,8)); fleet.escort_number=round(random_range(8,18));*/ - fleet.image_index=floor((fleet.capital_number)+(fleet.frigate_number/2)+(fleet.escort_number/4)); + fleet.image_index=round(standard_fleet_strength_calc()); fleet.image_alpha=0; fleet.action_x=x; diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index cb8caf3b9e..09dc9a0264 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -72,7 +72,7 @@ function build_planet_defence_fleets(){ var _defence_fleet_log = {}; with(obj_en_fleet){ if (owner==eFACTION.Imperium){ - var _imperial_fleet_defence_score = capital_number + (frigate_number/2) + (escort_number/4); + var _imperial_fleet_defence_score = round(standard_fleet_strength_calc()); obj_controller.imp_ships += _imperial_fleet_defence_score; //log this to prevent double work later figuring out if a planet has an orbiting defence fleet if (!navy && action=="" && is_orbiting()){ diff --git a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml index 0fa27ee7f9..b1b4d0335c 100644 --- a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml +++ b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml @@ -127,9 +127,7 @@ function build_new_navy_fleet(construction_forge){ navy=1; var total_ships=0; - total_ships+=capital_number-1; - total_ships+=round((frigate_number/2)); - total_ships+=round((escort_number/4)); + total_ships+=round(standard_fleet_strength_calc()); if (total_ships<=1 && capital_number+frigate_number+escort_number>0) then total_ships=1; choose_fleet_sprite_image() image_index=total_ships; @@ -178,10 +176,7 @@ function new_navy_ships_forge(){ if (capital_number>1) then capital_number=1; } if (onceh=1){ - var ii=0; - ii+=capital_number; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()); image_index=ii<=1?1:ii; } @@ -1047,10 +1042,8 @@ function setup_start_imperial_navy_fleet(system){ warp_able=true; image_speed=0; - ii+=capital_number-1; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); - if (ii<=1) and (capital_number+frigate_number+escort_number>0){ + ii+=round(standard_fleet_strength_calc()); + if (ii<=1) and (ii>0){ ii=1; } image_index=ii; diff --git a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml index 566029cad3..c8c782ed21 100644 --- a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml +++ b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml @@ -76,7 +76,7 @@ function ork_fleet_arrive_target(){ } } if (ork_attack_planet>0){ - p_tyranids[ork_attack_planet] -= floor(_ork_fleet.capital_number+(_ork_fleet.frigate_number/2)); + p_tyranids[ork_attack_planet] -= round(standard_fleet_strength_calc()); var _pdata = new PlanetData(ork_attack_planet, self); diff --git a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml index 47c4b41318..a5a217c8b5 100644 --- a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml +++ b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml @@ -239,10 +239,7 @@ function delete_ship_from_fleet(index, fleet){ } } function set_player_fleet_image(){ - var ii=0; - ii+=capital_number; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); + var ii=round(standard_fleet_strength_calc()) if (ii<=1) then ii=1; image_index=min(ii,9); } From e5474a5caec58d87b2274866878bff4bb2441462 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 16 Dec 2025 19:03:13 +0000 Subject: [PATCH 14/93] hoperfyully sort tau fleets --- objects/obj_en_fleet/Draw_0.gml | 1 - scripts/scr_Table/scr_Table.gml | 6 +- .../scr_fleet_functions.gml | 226 ++++++++---------- .../scr_system_search_helpers.gml | 28 ++- .../spr_fleet_imperial/spr_fleet_imperial.yy | 45 ++-- sprites/spr_fleet_tau/spr_fleet_tau.yy | 49 ++-- 6 files changed, 192 insertions(+), 163 deletions(-) diff --git a/objects/obj_en_fleet/Draw_0.gml b/objects/obj_en_fleet/Draw_0.gml index 0f0b116620..6c18729c02 100644 --- a/objects/obj_en_fleet/Draw_0.gml +++ b/objects/obj_en_fleet/Draw_0.gml @@ -101,7 +101,6 @@ if (_reset){ draw_set_alpha(1); if (navy && owner == eFACTION.Imperium){ draw_set_color(global.star_name_colors[eFACTION.Mechanicus]); - draw_circle_with_outline_width(); draw_circle_with_outline_width(_xx,_yy,12,0.3); } diff --git a/scripts/scr_Table/scr_Table.gml b/scripts/scr_Table/scr_Table.gml index 9bf8884c25..7b5c562ba9 100644 --- a/scripts/scr_Table/scr_Table.gml +++ b/scripts/scr_Table/scr_Table.gml @@ -18,9 +18,7 @@ function Table(data) constructor{ move_data_to_current_scope(data); - update(); - - static update = function(data){ + static update = function(data={}){ move_data_to_current_scope(data); w = 0; column_widths = []; @@ -60,7 +58,7 @@ function Table(data) constructor{ w += column_widths[i] + col_spacing; } } - + update(); static draw = function(){ add_draw_return_values(); diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 3a89e39fbb..365f907a12 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -624,6 +624,8 @@ function fleet_arrival_logic(){ action_x=0; action_y=0; is_orbiting(); + + arrival_logic_finished = false; // cur_star.present_fleets+=1;if (owner = eFACTION.Tau) then cur_star.tau_fleets+=1; @@ -791,145 +793,129 @@ function fleet_arrival_logic(){ } + var _fleet_strength = standard_fleet_strength_calc(); for (var i=0;i=3) then mergus=10; - if (owner = eFACTION.Tau) and (mergus>=3) then mergus=0; - if (string_count("_her",trade_goods)=0) then mergus=99;// was 999 - - // Think this might be causing the crash - if (owner=eFACTION.Tau) and (sta.present_fleet[eFACTION.Imperium]+sta.present_fleet[eFACTION.Player]>=1) - and (sta.present_fleet[eFACTION.Tau]=1 && image_index=1) and (ret=0) then mergus=15; - if (_other_fleet.owner=eFACTION.Tau) and (owner=eFACTION.Tau) and (ret=1) then mergus=0; - - - + var _other_fleet_strength=standard_fleet_strength_calc(_other_fleet); + - if (owner=eFACTION.Tau) and (image_index=1){ - // show_message("Tau||| Other Owner: "+string(cur_star.owner)+" ret: "+string(ret)+" mergus: "+string(mergus)); + var _same_owner = owner == _other_fleet.owner; + + var _attempt_merge = _same_owner && _other_fleet_strength + _fleet_strength <= 9; + + if (_same_owner && !_attempt_merge && owner==eFACTION){ + var _faction_check = obj_controller.faction_status[eFACTION.Mechanicus]=="War"?1:2; + var _len = _faction_check == 1?3:4 + if (array_sum(orbiting.present_fleet,0,_faction_check,_len)>0){ + _attempt_merge=true; + } + } - + + if (string_count("_her",trade_goods)=0){ + _attempt_merge = false; + } + if (owner=eFACTION.Chaos) and (fleet_has_cargo("csm")) or ( fleet_has_cargo("warband")){ - mergus=0; + var _csm = fleet_has_cargo("warband"); + _attempt_merge = false; } - // if (cur_star.owner!=owner) then mergus=0; + + // if (cur_star.owner!=owner) then _other_fleet_strength=0; //This will never trigger at the moment - if ((_other_fleet.owner=self.owner) and (_other_fleet.action="") and (mergus=1999){// Merge the fleets + if (_attempt_merge){// Merge the fleets merge_fleets(id,_other_fleet) }// End merge fleets - - - if (owner=eFACTION.Tau) and (mergus=15){ // Get the fuck out - var new_star;new_star=0;ret=1; - - - instance_activate_object(obj_star);// new_star - - - - if (image_index=1){// Start influence thing - - with (orbiting){ - var tau_influence; - var tau_influence_chance=irandom(100)+1; - var tau_influence_planet=irandom(orbiting.planets)+1; - if (p_type[tau_influence_planet]!="Dead"){ - - scr_alert("green","owner",$"Tau ship broadcasts subversive messages to {planet_numeral_name(tau_influence_planet)}.",sta.x,sta.y); - tau_influence = p_influence[tau_influence_planet][eFACTION.Tau] - - if (tau_influence_chance<=70) and (tau_influence<70){ - adjust_influence[tau_influence_planet](eFACTION.Tau, 10, tau_influence_planet); - if (p_type[tau_influence_planet]=="Forge"){ - adjust_influence(eFACTION.Tau, -5, tau_influence_planet); - } - } - - if (tau_influence_chance<=3) and (tau_influence<70){ - adjust_influence(eFACTION.Tau, 30, tau_influence_planet); - if (p_type[tau_influence_planet]=="Forge"){ - adjust_influence(eFACTION.Tau, -25, tau_influence_planet); - } - } - } - } - } - - - - instance_deactivate_object(orbiting); - - with(obj_star){ - if (owner != eFACTION.Tau) then instance_deactivate_object(instance_id); - } - - var good=0; - - repeat(100){ - var xx, yy; - if (good=0){ - xx=x+choose(random(300),random(300)*-1); - yy=y+choose(random(300),random(300)*-1); - new_star=instance_nearest(xx,yy,obj_star); - if (new_star.owner!=eFACTION.Tau) then with(new_star){instance_deactivate_object(id);} - if (new_star.owner=eFACTION.Tau) then good=1; - } + + //if fleet is damaged but existing fleet is too large to merge feck off elsewhere preferably somewhere friendly + else if (_same_owner && (owner == eFACTION.Tau || (owner = eFACTION.Chaos && !csm))){// Move somewhere new + + var _chosen =false; + var _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + while (_chosen_id != "none"){ + if (scr_orbiting_fleet(eFACTION.Imperium) != "none"){ + _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + } else { + break; + } } - - // show_message("Get the fuck out working?: "+string(good)); - - if (new_star.owner==eFACTION.Tau){ - // show_message("Tau fleet actually fleeing"); - action_x=new_star.x; - action_y=new_star.y; - set_fleet_movement(); + + instance_activate_object(obj_star); + if (_chosen_id !="none"){ + action_x=_chosen_id.x; + action_y=_chosen_id.y; + set_fleet_movement(); + arrival_logic_finished = true; } - - instance_activate_object(obj_star); - // This appears bugged - } - var _csm = fleet_has_cargo("warband"); + //TODO somelogc to go find somewhere else if there are no avialable rebuild planets + } + } - if (cur_star.x=old_x) and (cur_star.y=old_y) and (cur_star.owner=self.owner) and (cur_star.action="") and ((owner = eFACTION.Tau) or (owner = eFACTION.Chaos)) and (mergus=10) and (!_csm){// Move somewhere new - var stue, stue2;stue=0;stue2=0; - var goood=0; - - with(obj_star){ - if (is_dead_star()){ - instance_deactivate_object(id); + if (owner=eFACTION.Tau && !arrival_logic_finished) { + + + //so i'mjust sort of crudely interpreting things how i think duke meant to make it + //basically if the tau fleet is weakened or small instead of trying a hostile takeover + //they instrsd instigste a tau propaganda campaign and get the fuck out the system + + //if tau fleet is too weak then flee + if (standard_fleet_strength_calc()<3){// Start influence thing + + with (orbiting){ + var tau_influence; + var tau_influence_chance=roll_dice(1,100,"high"); + var tau_influence_planet=irandom(orbiting.planets)+1; + if (p_type[tau_influence_planet]!="Dead"){ + + scr_alert("green","owner",$"Tau ship broadcasts subversive messages to {planet_numeral_name(tau_influence_planet)}.",sta.x,sta.y); + tau_influence = p_influence[tau_influence_planet][eFACTION.Tau] + + if (tau_influence_chance<=70) and (tau_influence<70){ + adjust_influence[tau_influence_planet](eFACTION.Tau, 10, tau_influence_planet); + if (p_type[tau_influence_planet]=="Forge"){ + adjust_influence(eFACTION.Tau, -5, tau_influence_planet); + } + } + + if (tau_influence_chance<=3) and (tau_influence<70){ + adjust_influence(eFACTION.Tau, 30, tau_influence_planet); + if (p_type[tau_influence_planet]=="Forge"){ + adjust_influence(eFACTION.Tau, -25, tau_influence_planet); + } + } + } + } + var _chosen =false; + var _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + while (_chosen_id != "none"){ + if (scr_orbiting_fleet(eFACTION.Imperium) != "none"){ + _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + } else { + break; } } - stue=instance_nearest(x,y,obj_star); - instance_deactivate_object(stue); - repeat(10){ - if (goood=0){ - stue2=instance_nearest(x+choose(random(400),random(400)*-1),y+choose(random(400),random(400)*-1),obj_star); - if (owner = eFACTION.Tau) and (stue2.owner = eFACTION.Tau) then goood=1; - if (owner = eFACTION.Chaos) and (stue2.owner != eFACTION.Chaos) then goood=1; - if (stue2.planets=0) then goood=0; - if (stue.present_fleet[eFACTION.Imperium]>0) or (stue.present_fleet[eFACTION.Player]>0) then goood=0; - if (stue2.planets=1) and (stue2.p_type[1]="Dead") then goood=0; - } - } - action_x=stue2.x; - action_y=stue2.y; - set_fleet_movement();// stue.present_fleets-=1; - instance_activate_object(obj_star); - } - } + + instance_activate_object(obj_star); + if (_chosen_id !="none"){ + action_x=_chosen_id.x; + action_y=_chosen_id.y; + set_fleet_movement(); + arrival_logic_finished = true; + } + } + + + } + + @@ -940,7 +926,7 @@ function fleet_arrival_logic(){ // If the connected planet is owned by orks then choose a random one within 400 not owned by orks - if (owner == eFACTION.Ork){ + else if (owner == eFACTION.Ork){ if (is_orbiting()){ with (orbiting){ ork_fleet_arrive_target(); @@ -1031,9 +1017,9 @@ function merge_fleets(main_fleet, merge_fleet){ } main_fleet.guardsmen += merge_fleet.guardsmen; - //This bit allseems a bit superfluouse but keepingjust in case it breaks something + //This bit allseems a bit superfluouse but keepingjust in case it breaks something] + var _is_orbiting = is_orbiting(merge_fleet); switch(merge_fleet.owner){ - var _is_orbiting = is_orbiting(merge_fleet); case eFACTION.Tau: obj_controller.tau_fleets--; if (_is_orbiting){ diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index c7d3ad3fee..f8b8a3999f 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -320,7 +320,7 @@ function nearest_star_proper(xx,yy) { } -function nearest_star_with_ownership(xx,yy, ownership, start_star="none", ignore_dead = true){ +function nearest_star_with_ownership(xx,yy, ownership, start_star="none", ignore_dead = true,keep_deactivated=false){ var nearest = "none" var _deactivated = []; var total_stars = instance_number(obj_star); @@ -328,29 +328,39 @@ function nearest_star_with_ownership(xx,yy, ownership, start_star="none", ignore if (!is_array(ownership)){ ownership = [ownership]; } + deactivate = function(deactiv_id){ + array_push(_deactivated, deactiv_id.id); + instance_deactivate_object(deactiv_id.id); + } while (nearest=="none" && i":"","Keyframes":[ - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"7ed3ac9a-c1a3-4966-8c07-799101e9fca6","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"f2227933-b8bc-4bf6-9d8e-524410250dc7","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"cdb72c37-035a-45e6-9261-6bb7235b36d0","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"1746812c-c63b-415d-b459-f12dc9208349","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"b70d4f7d-d6e5-4417-a451-df64b6cc0dfc","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"edc14729-eece-4ed2-8dfc-a5f8c7dfe38b","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"7c517f52-18b0-4ce3-907a-266b27998f5e","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"da9e9585-4af5-4c8f-bf1e-b0865913f48c","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"7e369ca2-e39c-4f3a-95cf-1f7ece113915","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"e924ab6f-120a-498b-80ba-78f1ec0f34fe","IsCreationKey":false,"Key":4.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"83e2105e-06f4-433a-b155-899860422247","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"6e7f9699-c511-43fb-b4aa-f01b6cb66560","IsCreationKey":false,"Key":5.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"7b33f482-c952-4a96-ae8e-fc3c743bb25f","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"8cfe88df-f523-462d-bcf6-20f2367cf625","IsCreationKey":false,"Key":6.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"948a2eb0-29bf-4b0d-8710-2641375e304c","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"e41b6128-03e4-490c-be0e-4c177c1dcfaa","IsCreationKey":false,"Key":7.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"c527feba-1ebf-430b-bcce-57c3998dd2ba","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"38bd26a6-a925-4d86-8cc1-91d1fa137e25","IsCreationKey":false,"Key":8.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"3a21b19b-398c-43ca-98e1-b7cbeafd021a","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"212d7172-82b2-47e9-95c1-fb55d943413e","IsCreationKey":false,"Key":9.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"7ed3ac9a-c1a3-4966-8c07-799101e9fca6","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"f2227933-b8bc-4bf6-9d8e-524410250dc7","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"cdb72c37-035a-45e6-9261-6bb7235b36d0","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"1746812c-c63b-415d-b459-f12dc9208349","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"b70d4f7d-d6e5-4417-a451-df64b6cc0dfc","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"edc14729-eece-4ed2-8dfc-a5f8c7dfe38b","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"7c517f52-18b0-4ce3-907a-266b27998f5e","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"da9e9585-4af5-4c8f-bf1e-b0865913f48c","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"7e369ca2-e39c-4f3a-95cf-1f7ece113915","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"e924ab6f-120a-498b-80ba-78f1ec0f34fe","IsCreationKey":false,"Key":4.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"83e2105e-06f4-433a-b155-899860422247","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"6e7f9699-c511-43fb-b4aa-f01b6cb66560","IsCreationKey":false,"Key":5.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"7b33f482-c952-4a96-ae8e-fc3c743bb25f","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"8cfe88df-f523-462d-bcf6-20f2367cf625","IsCreationKey":false,"Key":6.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"948a2eb0-29bf-4b0d-8710-2641375e304c","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"e41b6128-03e4-490c-be0e-4c177c1dcfaa","IsCreationKey":false,"Key":7.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"c527feba-1ebf-430b-bcce-57c3998dd2ba","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"38bd26a6-a925-4d86-8cc1-91d1fa137e25","IsCreationKey":false,"Key":8.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"3a21b19b-398c-43ca-98e1-b7cbeafd021a","path":"sprites/spr_fleet_imperial/spr_fleet_imperial.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"212d7172-82b2-47e9-95c1-fb55d943413e","IsCreationKey":false,"Key":9.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, ],"resourceType":"KeyframeStore","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, ], - "visibleRange":{ - "x":0.0, - "y":0.0, - }, + "visibleRange":null, "volume":1.0, "xorigin":11, "yorigin":11, diff --git a/sprites/spr_fleet_tau/spr_fleet_tau.yy b/sprites/spr_fleet_tau/spr_fleet_tau.yy index 3e3b10899a..ea24ba85e3 100644 --- a/sprites/spr_fleet_tau/spr_fleet_tau.yy +++ b/sprites/spr_fleet_tau/spr_fleet_tau.yy @@ -78,23 +78,42 @@ "timeUnits":1, "tracks":[ {"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore":"","Keyframes":[ - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"cdd4c365-a564-4c95-85ab-bda104c5d5e1","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"1641c7b0-ba32-46a1-bdef-7751da95e1c5","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"95d93dc5-c7db-4369-b68a-31026d5959fc","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"b1f176e9-a3cc-4a3b-94bf-ade7ddc106a3","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"617ee12d-133c-4e96-ba8d-93535804252d","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"1051b8c3-13b3-4b12-909d-886c3a09de27","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"06e6544f-caed-4f40-8705-c7108e508215","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"195aff74-b345-485c-8c41-640d808b3d87","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"3e69a52d-25e9-4c9b-89b5-80990b84fd94","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"a06bc4eb-65c2-4824-b12e-4b2594e8cdc6","IsCreationKey":false,"Key":4.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"1a9a662c-67fe-4cdf-bdbf-c87e0070a330","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"a5c0c0a4-63b3-43bc-8743-90cbd113bcb7","IsCreationKey":false,"Key":5.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"bb9a18cc-c332-4f49-86d2-1dd6b6a501ca","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"4c0c4440-a668-4464-9e1c-647382b2af86","IsCreationKey":false,"Key":6.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"a28eb7be-b330-4c6f-a971-0412e89f9546","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"21ad7732-67d7-4445-a580-dc99939fd767","IsCreationKey":false,"Key":7.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"6faa2ba4-5a83-4f02-8506-0aed83da2623","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"8c836550-2c0b-4ff6-bdf5-db3f343e1f8c","IsCreationKey":false,"Key":8.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"93464d16-aa98-4c7b-83a4-f5f56f3bf632","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"621a69a7-bcaa-4299-821f-7014d3b98d91","IsCreationKey":false,"Key":9.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, - {"$Keyframe":"","Channels":{"0":{"$SpriteFrameKeyframe":"","Id":{"name":"4f6782bd-e559-446b-9cfb-76c842cac2e6","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},},"Disabled":false,"id":"ed6f8cbd-bba9-4119-b444-6aa8e37e6443","IsCreationKey":false,"Key":10.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"cdd4c365-a564-4c95-85ab-bda104c5d5e1","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"1641c7b0-ba32-46a1-bdef-7751da95e1c5","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"95d93dc5-c7db-4369-b68a-31026d5959fc","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"b1f176e9-a3cc-4a3b-94bf-ade7ddc106a3","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"617ee12d-133c-4e96-ba8d-93535804252d","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"1051b8c3-13b3-4b12-909d-886c3a09de27","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"06e6544f-caed-4f40-8705-c7108e508215","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"195aff74-b345-485c-8c41-640d808b3d87","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"3e69a52d-25e9-4c9b-89b5-80990b84fd94","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"a06bc4eb-65c2-4824-b12e-4b2594e8cdc6","IsCreationKey":false,"Key":4.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"1a9a662c-67fe-4cdf-bdbf-c87e0070a330","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"a5c0c0a4-63b3-43bc-8743-90cbd113bcb7","IsCreationKey":false,"Key":5.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"bb9a18cc-c332-4f49-86d2-1dd6b6a501ca","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"4c0c4440-a668-4464-9e1c-647382b2af86","IsCreationKey":false,"Key":6.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"a28eb7be-b330-4c6f-a971-0412e89f9546","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"21ad7732-67d7-4445-a580-dc99939fd767","IsCreationKey":false,"Key":7.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"6faa2ba4-5a83-4f02-8506-0aed83da2623","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"8c836550-2c0b-4ff6-bdf5-db3f343e1f8c","IsCreationKey":false,"Key":8.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"93464d16-aa98-4c7b-83a4-f5f56f3bf632","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"621a69a7-bcaa-4299-821f-7014d3b98d91","IsCreationKey":false,"Key":9.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, + {"$Keyframe":"","Channels":{ + "0":{"$SpriteFrameKeyframe":"","Id":{"name":"4f6782bd-e559-446b-9cfb-76c842cac2e6","path":"sprites/spr_fleet_tau/spr_fleet_tau.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",}, + },"Disabled":false,"id":"ed6f8cbd-bba9-4119-b444-6aa8e37e6443","IsCreationKey":false,"Key":10.0,"Length":1.0,"resourceType":"Keyframe","resourceVersion":"2.0","Stretch":false,}, ],"resourceType":"KeyframeStore","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, ], - "visibleRange":{ - "x":0.0, - "y":0.0, - }, + "visibleRange":null, "volume":1.0, "xorigin":11, "yorigin":11, From fe1edb7f8bf3a1305cc6f9f685f06d0fd32f8995 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 16 Dec 2025 20:06:35 +0000 Subject: [PATCH 15/93] swapped and or --- objects/obj_en_fleet/Alarm_1.gml | 2 +- objects/obj_en_fleet/Step_0.gml | 9 +-- .../scr_fleet_functions.gml | 68 ++++++++++++------- .../scr_system_search_helpers.gml | 22 +++--- 4 files changed, 57 insertions(+), 44 deletions(-) diff --git a/objects/obj_en_fleet/Alarm_1.gml b/objects/obj_en_fleet/Alarm_1.gml index 8419676d77..f4fa173031 100644 --- a/objects/obj_en_fleet/Alarm_1.gml +++ b/objects/obj_en_fleet/Alarm_1.gml @@ -29,7 +29,7 @@ if (_khorne_cargo && owner=eFACTION.Chaos) { if (_is_orbiting) { turns_static++; - if (turns_static>5 && owner==eFACTION.Ork){ + if (turns_static>5 && owner == eFACTION.Ork){ if (!irandom(7)){ ork_fleet_move(); _is_orbiting=false; diff --git a/objects/obj_en_fleet/Step_0.gml b/objects/obj_en_fleet/Step_0.gml index 3e55ade5f0..32da6fd92f 100644 --- a/objects/obj_en_fleet/Step_0.gml +++ b/objects/obj_en_fleet/Step_0.gml @@ -115,14 +115,7 @@ if (owner = eFACTION.Tyranids) and (trade_goods=""){ } if (global.load>=0){ - if (owner = eFACTION.Imperium) then sprite_index=spr_fleet_imperial; - if (owner = eFACTION.Mechanicus) then sprite_index=spr_fleet_mechanicus; - if (owner = eFACTION.Inquisition) then sprite_index=spr_fleet_inquisition; - if (owner = eFACTION.Eldar) then sprite_index=spr_fleet_eldar; - if (owner = eFACTION.Ork) then sprite_index=spr_fleet_ork; - if (owner = eFACTION.Tau) then sprite_index=spr_fleet_tau; - if (owner = eFACTION.Tyranids) then sprite_index=spr_fleet_tyranid; - if (owner = eFACTION.Chaos) then sprite_index=spr_fleet_chaos; + choose_fleet_sprite_image(); } if (image_index=0) then image_index=1; diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 365f907a12..4d975634f8 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -14,7 +14,19 @@ function distribute_strength_to_fleet(strength, fleet){ } } + +function standard_fleet_strength_calc(fleet = "none"){ + if (fleet == "none"){ + return capital_number + (frigate_number/2) + (escort_number/4); + } else { + with (fleet){ + return standard_fleet_strength_calc(); + } + } +} + //to be run within with scope +//@mixin obj_en_fleet function set_fleet_target(targ_x, targ_y, final_target){ action_x = targ_x; action_y = targ_y; @@ -708,7 +720,7 @@ function fleet_arrival_logic(){ if (fleet_has_cargo("ork_warboss")) cancel=true; if (fleet_has_cargo("csm")) then cancel=true; - if (!cancel && ((trade_goods!="return" && owner!=eFACTION.Tyranids && owner!=eFACTION.Chaos) || (fleet_has_cargo("player_goods")))){ + if (!cancel && ((trade_goods!="return" && owner!=eFACTION.Tyranids && owner!=eFACTION.Chaos) && (fleet_has_cargo("player_goods")))){ if (scr_efleet_arrive_at_trade_loc()){ exit; } @@ -794,7 +806,7 @@ function fleet_arrival_logic(){ } var _fleet_strength = standard_fleet_strength_calc(); - for (var i=0;i0){ _attempt_merge=true; } } - if (string_count("_her",trade_goods)=0){ + if (!string_count("_her",trade_goods)){ _attempt_merge = false; } @@ -837,25 +849,31 @@ function fleet_arrival_logic(){ //if fleet is damaged but existing fleet is too large to merge feck off elsewhere preferably somewhere friendly else if (_same_owner && (owner == eFACTION.Tau || (owner = eFACTION.Chaos && !csm))){// Move somewhere new - var _chosen =false; - var _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); - while (_chosen_id != "none"){ - if (scr_orbiting_fleet(eFACTION.Imperium) != "none"){ - _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); - } else { - break; - } - } + if (standard_fleet_strength_calc()<3){ + + var _chosen =false; + var _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + while (_chosen_id != "none"){ + if (scr_orbiting_fleet(eFACTION.Imperium) != "none"){ + _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); + } else { + break; + } + } + + instance_activate_object(obj_star); + if (_chosen_id !="none"){ + action_x=_chosen_id.x; + action_y=_chosen_id.y; + set_fleet_movement(); + arrival_logic_finished = true; + } + + //TODO somelogc to go find somewhere else if there are no avialable rebuild planets + } else { - instance_activate_object(obj_star); - if (_chosen_id !="none"){ - action_x=_chosen_id.x; - action_y=_chosen_id.y; - set_fleet_movement(); - arrival_logic_finished = true; + _chosen_id = nearest_star_with_ownership(x,y,[2,3,4,5,7],orbiting); } - - //TODO somelogc to go find somewhere else if there are no avialable rebuild planets } } @@ -910,7 +928,7 @@ function fleet_arrival_logic(){ set_fleet_movement(); arrival_logic_finished = true; } - } + } } @@ -980,6 +998,8 @@ function fleet_arrival_logic(){ instance_activate_object(obj_star); } + + show_debug_message($"fleet orbiting {instance_nearest(x,y,obj_star)} : {obj_controller.faction[owner]}: cur_targ {target}"); } function choose_fleet_sprite_image(){ diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index f8b8a3999f..c01f98ee72 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -268,25 +268,25 @@ function shuffled_planet_array(){ /// ignoring any that are disqualified by the exclusion conditions. function distance_removed_star(origional_x,origional_y, star_offset = choose(2,3), disclude_hulk=true, disclude_elder=true, disclude_deads=true, warp_concious=true){ var from = instance_nearest(origional_x,origional_y,obj_star); - var _deactivated = []; + var deactivated = []; for(var i=0; i Date: Tue, 16 Dec 2025 22:55:06 +0000 Subject: [PATCH 16/93] abstracrt and clean up --- ChapterMaster.yyp | 1 + .../scr_fleet_functions.gml | 28 ++----------------- .../scr_tau_fleet_functions.gml | 27 ++++++++++++++++++ .../scr_tau_fleet_functions.yy | 13 +++++++++ 4 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 scripts/scr_tau_fleet_functions/scr_tau_fleet_functions.gml create mode 100644 scripts/scr_tau_fleet_functions/scr_tau_fleet_functions.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index bf9558d3e3..bd0743b2f6 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -934,6 +934,7 @@ {"id":{"name":"scr_system_spawn_functions","path":"scripts/scr_system_spawn_functions/scr_system_spawn_functions.yy",},}, {"id":{"name":"scr_Table","path":"scripts/scr_Table/scr_Table.yy",},}, {"id":{"name":"scr_target","path":"scripts/scr_target/scr_target.yy",},}, + {"id":{"name":"scr_tau_fleet_functions","path":"scripts/scr_tau_fleet_functions/scr_tau_fleet_functions.yy",},}, {"id":{"name":"scr_text_hit","path":"scripts/scr_text_hit/scr_text_hit.yy",},}, {"id":{"name":"scr_thought","path":"scripts/scr_thought/scr_thought.yy",},}, {"id":{"name":"scr_tooltip_draw","path":"scripts/scr_tooltip_draw/scr_tooltip_draw.yy",},}, diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 4d975634f8..5483bb4bfc 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -809,7 +809,7 @@ function fleet_arrival_logic(){ for (var i=0;i Date: Tue, 16 Dec 2025 22:57:29 +0000 Subject: [PATCH 17/93] Documentation and notes --- scripts/scr_fleet_functions/scr_fleet_functions.gml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 5483bb4bfc..7d71c046f0 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -790,6 +790,8 @@ function fleet_arrival_logic(){ } + //interactions and merging with other already present fleets + var old_x=x,old_y=y; var _other_orbiting = []; var _id = id; From ef1ecbbd672b9f04f56cbcd66609db101aa08b35 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 16 Dec 2025 23:49:54 +0000 Subject: [PATCH 18/93] better handlingof mech exploretion fleets --- scripts/scr_PlanetData/scr_PlanetData.gml | 32 +++++++++++++------ .../scr_apothecary_ground.gml | 18 +++++++++-- scripts/scr_cheatcode/scr_cheatcode.gml | 6 ++-- .../scr_draw_planet_features.gml | 2 +- .../scr_planetary_feature.gml | 6 ++++ 5 files changed, 49 insertions(+), 15 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 361f42020c..020fc86563 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1762,21 +1762,35 @@ function PlanetData(planet, system) constructor{ static check_old_battles_feature = function(){ if (has_feature(P_features.OldBattleGround)){ var _feats = get_features(P_features.OldBattleGround); + for (var i=0;i0){ @@ -286,7 +291,14 @@ function apothecary_simple(){ with (cur_system){ if (array_length(p_feature[p])!=0){ var _planet_data = new PlanetData(p, self); - _planet_data.recover_starship(cur_techs); + if (_cur_unit_count){ + _planet_data.search_old_battle_grounds(cur_units); + } + + if (cur_tech_count){ + _planet_data.recover_starship(cur_techs); + } + if (_planet_data.planet_training(_loc_heal_points)){ } diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 7a1d6c21a9..afb1d9e899 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -384,7 +384,6 @@ function scr_cheatcode(argument0) { case "forgemastermeet": var _forge_master = scr_role_count("Forge Master", "", "units"); if (array_length(_forge_master)>0){ - show_debug_message("meet forge master"); obj_controller.menu_lock = false; instance_destroy(obj_popup_dialogue); scr_toggle_diplomacy(); @@ -392,7 +391,6 @@ function scr_cheatcode(argument0) { obj_controller.character_diplomacy = _forge_master[0]; diplo_txt="Greetings chapter master"; } else { - show_debug_message("no forge master"); } break; } @@ -471,6 +469,10 @@ function draw_planet_debug_features(){ e_num : P_features.Starship, name : "Ancient Starship" }, + { + e_num : P_features.OldBattleGround, + name : "Old Battle Ground" + }, ] diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index 8547b15923..2b1b656ba3 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -161,7 +161,7 @@ function FeatureSelected(Feature, system, planet) constructor{ case P_features.OldBattleGround: generic=true; title = "Old Battlefield"; - body = "The site of a previously unrecorded battle between {feature.faction1} and {feature.faction2} forces long forgotten"; + body = "The site of a previously unrecorded battle between {feature.faction1} and {feature.faction2} forces long forgotten\nUnload Marines to search Techmarines are advisable to help, it would be best any tech priests not be aware of such an operation it may create a conflict of interest"; case P_features.STC_Fragment: generic=true; title = "STC Fragment"; diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index 6dbccdf88e..6a7dd29f1d 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -73,6 +73,7 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{ //This is janky but we have no way of defining non player astartes faction1 = "astartes"; faction2 = "imperium"; + explore_size = irandom_range(1000, 10000); explored = 0; break; case P_features.Secret_Base: @@ -380,6 +381,11 @@ function scr_planetary_feature(planet_num) { case P_features.OrkWarboss: var lop=$"Ork Warboss discovered on {numeral_n}."; scr_alert("red","feature",lop,x,y); + scr_event_log("red",lop); + break; + case P_features.OldBattleGround: + var lop=$"Old Battle Ground discovered on {numeral_n}."; + scr_alert("green","feature",lop,x,y); scr_event_log("red",lop); break; } From 49d3d02ec046775dcea3a388949dae0641cbf560 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 17 Dec 2025 00:21:30 +0000 Subject: [PATCH 19/93] start marine bits --- scripts/scr_PlanetData/scr_PlanetData.gml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 020fc86563..45846a969a 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -658,6 +658,15 @@ function PlanetData(planet, system) constructor{ return _training_happend; }; + static search_old_battle_grounds(){ + if (!has_feature(P_features.OldBattleGround)){ + exit; + } + + var _battle = get_features(P_features.OldBattleGround)[0]; + } + + static recover_starship = function(techs){ try { var engineer_count = array_length(techs); @@ -1773,7 +1782,7 @@ function PlanetData(planet, system) constructor{ if (owner != eFACTION.Mechanicus){ continue; } - if (instance_exists(target) &&target.id== _sys.id){ + if (instance_exists(target) && target.id== _sys.id){ _fleet_enroute = true; } } From 6c157e9fa7a2f38cc0b43fb5ac350d93cbb31901 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 17 Dec 2025 01:37:21 +0000 Subject: [PATCH 20/93] syntax error --- scripts/scr_PlanetData/scr_PlanetData.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 45846a969a..207bc3831a 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -658,7 +658,7 @@ function PlanetData(planet, system) constructor{ return _training_happend; }; - static search_old_battle_grounds(){ + static search_old_battle_grounds = function(){ if (!has_feature(P_features.OldBattleGround)){ exit; } From 9f0747c177466a60cdbe485d451f255b4f50e8e5 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 17 Dec 2025 23:50:15 +0000 Subject: [PATCH 21/93] beast hunt maximum flavour --- objects/obj_controller/Alarm_5.gml | 7 +- objects/obj_star/Draw_0.gml | 3 +- objects/obj_star_select/Draw_64.gml | 48 ++++---- scripts/instance_create/instance_create.gml | 17 +++ scripts/scr_PlanetData/scr_PlanetData.gml | 21 +++- .../scr_apothecary_ground.gml | 2 +- scripts/scr_buttons/scr_buttons.gml | 2 +- scripts/scr_cheatcode/scr_cheatcode.gml | 6 +- .../scr_draw_planet_features.gml | 5 +- scripts/scr_fleet_events/scr_fleet_events.gml | 1 + .../scr_forge_world_functions.gml | 18 +-- .../scr_khornate_fleet_functions.gml | 21 ++-- .../scr_marine_struct/scr_marine_struct.gml | 9 ++ .../scr_mechanicus_fleet_functions.gml | 29 +++++ .../scr_mission_functions.gml | 109 +++++++++++++++++- .../scr_planetary_feature.gml | 5 +- .../scr_player_fleet_functions.gml | 2 +- 17 files changed, 244 insertions(+), 61 deletions(-) diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index c676504a97..1117ba4e26 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -135,7 +135,12 @@ if (scr_has_adv("Tech-Scavengers")){ scr_alert("","loot",tix,0,0); } } -imperial_navy_fleet_construction(); + +try{ + imperial_navy_fleet_construction(); +}catch(_exception){ + handle_exception(_exception); +} // ** Adeptus Mechanicus Geneseed Tithe ** if (gene_tithe==0) and (faction_status[eFACTION.Imperium]!="War"){ diff --git a/objects/obj_star/Draw_0.gml b/objects/obj_star/Draw_0.gml index 5f4c8c546b..edaa1c6a88 100644 --- a/objects/obj_star/Draw_0.gml +++ b/objects/obj_star/Draw_0.gml @@ -14,11 +14,12 @@ var show=name; if (global.cheat_debug){ show = $"{name}"; for (var i=1;i<=planets;i++){ - for (p=0;p0){ // draw_sprite_ext(spr_force_icon,en_fleet[i],x3,y3,0.5,0.5,0,c_white,1); scr_image("ui/force",en_fleet[i],x3-16,y3-16,32,32); x3+=64; } } - - } } pop_draw_return_values(); +}catch(_exception){ + handle_exception(_exception); + instance_destroy(); +} /* */ diff --git a/scripts/instance_create/instance_create.gml b/scripts/instance_create/instance_create.gml index cdeaa079f5..9f97b0cca4 100644 --- a/scripts/instance_create/instance_create.gml +++ b/scripts/instance_create/instance_create.gml @@ -28,3 +28,20 @@ function instance_at_location(xx,yy,obj_type){ var _nearest = instance_nearest(xx, yy, obj_type); return (_nearest.x == xx && _nearest.y == yy) ? _nearest : noone; } + +function instance_distance(instance_1,instance_2){ + return point_distance(instance_1.x, instance_1.y, instance_2.x, instance_2.y) +} + +function nearest_instance(instance_array,check_instance){ + var _inst = instance_array[0]; + var _inst_dist = instance_distance(_inst,check_instance); + for (var i=1;i=0;i--){ + if (array_length(_forge_systems) == 0 && obj_controller.faction_status[eFACTION.Imperium] != "War"){ + scr_alert("red", "forge_world", "No active uncontested forge worlds imperial navy unable to rebuild at speed"); + } + + for (var i=array_length(_forge_systems)-1;i>=0;i--){ var _sys = _forge_systems[i]; var good=true; for(var o=1; o<=_sys.planets; o++) { @@ -47,16 +51,16 @@ function imperial_navy_fleet_construction(){ } } // After initial navy fleet construction fleet growth is handled in obj_en_fleet.alarm_5 - if (array_length(forge_systems)){ + if (array_length(_forge_systems)){ var construction_forge; - construction_forge = array_random_element(forge_systems); + construction_forge = array_random_element(_forge_systems); build_new_navy_fleet(construction_forge) } } } function get_imperium_forge_systems(){ - var forge_systems = []; + var _forge_systems = []; with(obj_star){ var good=false; for(var o=1; o<=planets; o++) { @@ -74,7 +78,7 @@ function get_imperium_forge_systems(){ var enemy_fleet_count = array_reduce(enemy_fleets, function(prev, curr) { return prev + present_fleet[curr] - }); + }, 0); good = enemy_fleet_count<=0; } @@ -86,10 +90,10 @@ function get_imperium_forge_systems(){ good = x<=room_width && y<=room_height; } if (good){ - array_push(forge_systems, id); + array_push(_forge_systems, id); } } - return forge_systems; + return _forge_systems; } function build_planet_defence_fleets(){ diff --git a/scripts/scr_khornate_fleet_functions/scr_khornate_fleet_functions.gml b/scripts/scr_khornate_fleet_functions/scr_khornate_fleet_functions.gml index f0f032b0a2..6f506a190b 100644 --- a/scripts/scr_khornate_fleet_functions/scr_khornate_fleet_functions.gml +++ b/scripts/scr_khornate_fleet_functions/scr_khornate_fleet_functions.gml @@ -272,19 +272,14 @@ function spawn_chaos_warlord(){ array_push(candidate_systems, self) } - var fleet_target = array_reduce(candidate_systems, method({nfleet}, function(prev, curr) { - if !prev - return curr - var prev_dist = point_distance(prev.x, prev.y, nfleet.x, nfleet.y) - var curr_dist = point_distance(curr.x, curr.y, nfleet.x, nfleet.y) - - return (prev_dist > curr_dist) ? curr : prev; - }),noone); + if (array_length(candidate_systems)){ + var fleet_target = nearest_instance(candidate_systems,nfleet); - with (nfleet){ - nfleet.action_x=fleet_target.x; - nfleet.action_y=fleet_target.y; - set_fleet_movement() + with (nfleet){ + nfleet.action_x=fleet_target.x; + nfleet.action_y=fleet_target.y; + set_fleet_movement() + } } var tix=$"Chaos Lord {faction_leader[eFACTION.Chaos]} continues his Black Crusade into Sector {obj_ini.sector_name}."; @@ -298,7 +293,7 @@ function spawn_chaos_warlord(){ function destroy_khorne_fleet(){ var chaos_lord_killed=false; with(instance_nearest(x, y, obj_star)){ - if system_feature_bool(p_feature, P_features.ChaosWarband == 1) then chaos_lord_killed=true; + if system_feature_bool(p_feature, P_features.ChaosWarband) then chaos_lord_killed=true; } if (chaos_lord_killed){ obj_controller.faction_defeated[10]=1; diff --git a/scripts/scr_marine_struct/scr_marine_struct.gml b/scripts/scr_marine_struct/scr_marine_struct.gml index 9308991eb6..a2828d9c12 100644 --- a/scripts/scr_marine_struct/scr_marine_struct.gml +++ b/scripts/scr_marine_struct/scr_marine_struct.gml @@ -478,6 +478,7 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} religion_sub_cult = "none"; base_group = "none"; role_history = []; + epithets = []; enum eROLE_TAG { Techmarine = 0, Librarian = 1, @@ -819,6 +820,10 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} return ""; }; + static add_epithet(epithet){ + array_push(epithets,epithet); + } + static has_trait = marine_has_trait; static add_feat = function(feat) { @@ -2009,6 +2014,10 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} } } } + var _name = "{temp_role} {name()}"; + if (array_length(epithest)){ + _name += $" {epithets[0]}"; + } return string("{0} {1}", temp_role, name()); }; diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml index 6a9982643e..e6fdf75f87 100644 --- a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml @@ -19,4 +19,33 @@ function spawn_mechanicus_explore_fleet(){ } return _fleet; +} + +///@mixin FleetEvent +function mech_fleet_explore_battle_grounds(){ + var _navy_fleet = get_fleet_uid(fleet_uid); + + if (!is_orbiting(_navy_fleet)){ + return; + } + + var _has_battle = system_feature_bool(orbiting.p_feature,P_features.OldBattleGround); + if (_has_battle){ + var _p_data = orbiting.system_datas[_has_battle]; + _p_data.refresh_data(); + } else{ + return; + } + + var _battle_ground = _p_data.get_features(P_features.OldBattleGround)[0]; + + if (_battle_ground.explored == 0){ + var _text = $"The Mechanicus have arrived on {_p_data.name()} It will now be impossible to access the site without Mechanicus surveillance any potential rescources will now be fully put towards their aimsin service of the Ommnissiah"; + scr_popup($"Mechanicus Scavange {_p_data.name()}") + } else { + var _marines = _p_data.collect_planet_group("all"); + if (array_length(_marines)){ + if () + } + } } \ No newline at end of file diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index c30587a63c..78ef377826 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -450,34 +450,116 @@ function complete_train_forces_mission(targ_planet, problem_index){ } } +function get_beast_rumor(_planet_type, _beast_name){ + switch (_planet_type){ + case "Feudal": + return choose( + $"Peasants whisper prayers at night, for {_beast_name} walks the old forest paths.", + $"Knights of the realm have failed to slay {_beast_name}, their banners now hang in tatters.", + $"Church bells toll whenever {_beast_name} is sighted." + ); + + case "Ice": + return choose( + $"The ice cracks when {_beast_name} hunts.", + $"Entire hab-blocks were found frozen solid in the wake of {_beast_name}.", + $"The wind carries the howls of {_beast_name} across the tundra." + ); + + case "Death": + return choose( + $"Nothing lives long where {_beast_name} roams.", + $"Scavenger clans refuse entire regions claimed by {_beast_name}.", + $"Even apex predators flee the shadow of {_beast_name}." + ); + } + + return ""; +} + + +function get_beast_name_by_planet_type(_planet_type){ + switch (_planet_type){ + case "Feudal": + return choose( + "The Thorn-King", + "Blackwood Stalker", + "Crowned Razorback", + "Cathedral Stag", + "Old Bloodfather", + "The Green Tyrant" + ); + + case "Ice": + return choose( + "The Frostwyrm", + "Glacial Leviathan", + "The Howling Pale", + "Rimehorn Colossus", + "White Death Ursid", + "Icebound Devourer" + ); + + case "Death": + return choose( + "The Charnel Leviathan", + "God-Eater Beast", + "Void-Spined Terror", + "Apex Predatrix", + "Emperor’s Bane", + "The Unending Maw" + ); + } + + return "Unknown Horror"; +} + + +function format_beast_trophy(_beast_name){ + return choose( + $"The Severed Crown of {_beast_name}", + $"The Fanged Skull of {_beast_name}", + $"The Head of {_beast_name}", + $"The Blackened Remains of {_beast_name}" + ); +} + + function init_beast_hunt_mission(planet, star, mission_slot){ - var problems_data = star.p_problem_other_data[planet] - var mission_data = problems_data[mission_slot]; + var _problems_data = star.p_problem_other_data[planet]; + var mission_data = _problems_data[mission_slot]; if (mission_data.stage == "preliminary"){ var numeral_name = planet_numeral_name(planet, star); mission_data.stage = "active"; var _mission_length=(irandom_range(2,5)); star.p_timer[planet][mission_slot] = _mission_length; + star.p_problem_other_data = {}; //pop.image="ancient_ruins"; var gar_pop=instance_create(0,0,obj_popup); //TODO some new universal methods for popups - gar_pop.title=$"Marines assigned to hunt beasts around {numeral_name}"; - gar_pop.text=$"The govornor of {numeral_name} Thanks you for the participation of your elite warriors in your execution of such a menial task."; + + var _beast_name = get_beast_name_by_planet_type(star.p_type[planet]); + gar_pop.title=$"Marines assigned to hunt {_beast_name} beasts around {numeral_name}"; + gar_pop.text=$"The governor thanks you for lending your warriors to a task beneath their station — yet one whose outcome will be remembered. And that your marines shall find the {_beast_name} a suitable challenge. As things stand rumours say {get_beast_rumor(_beast_name, star.p_type[planet])}"; //pip.image="event_march" gar_pop.add_option({ str1: "Happy Hunting" }); gar_pop.image=""; gar_pop.cooldown=8; + gar_pop.pop_data.beast_name = _beast_name; + mission_data.beast_name = _beast_name; obj_controller.cooldown=20; scr_event_log("",$"Beast hunters deployed to {numeral_name} for {_mission_length} months.", star.name); } } +///@mixin obj_star function complete_beast_hunt_mission(targ_planet, problem_index){ var planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage","active")){ + var _problem_data = p_problem_other_data[targ_planet][problem_index]; _mission_string = ""; var man_conditions = { "job": "hunt_beast", @@ -535,7 +617,8 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ trophy_owner : array_random_element(_successful_hunters), system: self.name, planet : targ_planet, - target_fleet : array_random_element(_navy_fleets) + target_fleet : array_random_element(_navy_fleets), + beast :_problem_data.beast_name, }; var _options = { @@ -563,7 +646,10 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ } } function init_deliver_trophy_mission(){ - text = $"After your marines return there is a great feast to honour them. Much fanfare is made of the great trophy {pop_data.trophy_owner.name_role()} bears, a great monstrous head as tall as he is that the governor proclaims must be the largest of it's kind and the momst fearsome beast in the sector."; + pop_data.trophy_name = format_beast_trophy(pop_data.beast); + text = $"Much fanfare is made of the great trophy {pop_data.trophy_owner.name_role()} bears: {pop_data.trophy_name}."; + text += $" The governor proclaims it proof that {_beast_name} was the most fearsome predator in the sector."; + text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; @@ -632,6 +718,17 @@ function deliver_trophy_mission_fleet_destroyed(){ ); } +function get_beast_epithet(_planet_type){ + switch (_planet_type){ + case "Feudal": return "The King-Slayer"; + case "Ice": return "The Pale Reaper"; + case "Death": return "The Emperor’s Fang"; + } + return ""; +} + + + ///@mixin FleetEvent function deliver_trophy_end_turn_check(){ show_debug_message($"evetn_Data = {fleetevent_data}"); diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index 6a7dd29f1d..9893ffe50b 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -75,6 +75,7 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{ faction2 = "imperium"; explore_size = irandom_range(1000, 10000); explored = 0; + planet_display = "Old Battle Ground"; break; case P_features.Secret_Base: base_type = base_types.Lair; @@ -236,7 +237,9 @@ function system_feature_bool(system, search_feature){ for (var sys =1; sys<5; sys++){ sys_bool = planet_feature_bool(system[sys], search_feature) if (sys_bool==1){ - break;} + sys_bool = sys; + break; + } } return sys_bool; } diff --git a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml index f4c6c26d9a..5ac980cf66 100644 --- a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml +++ b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml @@ -36,7 +36,7 @@ function get_player_fleet_intercept_time(star,time_abundance){ var _travel = -1 var _nearest_player_fleet = instance_nearest(star.x, star.y, obj_p_fleet); if (instance_exists(_nearest_player_fleet)){ - _travel = get_viable_travel_time(time_abundance, _nearest_player_fleet.x, _nearest_player_fleet.y, star.x, star.y, _nearest_fleet, false); + _travel = get_viable_travel_time(time_abundance, _nearest_player_fleet.x, _nearest_player_fleet.y, star.x, star.y, _nearest_player_fleet, false); } } function fleet_has_roles(fleet="none", roles){ From d8abe160177a7b4ae2b5c805c8aefcd637bc8570 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 18 Dec 2025 23:54:46 +0000 Subject: [PATCH 22/93] add stylistic depth --- scripts/scr_mission_functions/scr_mission_functions.gml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 78ef377826..7ce47b651e 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -557,9 +557,9 @@ function init_beast_hunt_mission(planet, star, mission_slot){ ///@mixin obj_star function complete_beast_hunt_mission(targ_planet, problem_index){ - var planet = new PlanetData(targ_planet, self); + var _planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage","active")){ - var _problem_data = p_problem_other_data[targ_planet][problem_index]; + var _problem_data = problems_data[problem_index]; _mission_string = ""; var man_conditions = { "job": "hunt_beast", @@ -619,6 +619,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ planet : targ_planet, target_fleet : array_random_element(_navy_fleets), beast :_problem_data.beast_name, + system_type : _planet.planet_type; }; var _options = { @@ -761,7 +762,8 @@ function deliver_trophy_end_turn_check(){ if (_present){ var _text = "{_marine.role(name)} is able to rendevous with the imperial navy at {_meet_point.name}." _text += $" The guard regiments of {fleetevent_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns many of the regiments banners."; - _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.name_role()} spreading far and wide amoung guard regiments."; + var _marine_epithet = get_beast_epithet(fleetevent_data.planet_type); + _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.name_role()} spreading far and wide amoung guard regiments and has garnered the epithet {_marine_epithet}."; var _roll = roll_dice_chapter(1, 100, "high"); if (_roll>30 && _roll<70){ //TODO would be cool to have this changed to be a guard specific piece of equipment From 6b22193caf76ffefffad35ccf759dea0d075c41a Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Fri, 19 Dec 2025 21:13:38 +0000 Subject: [PATCH 23/93] minor improvements --- scripts/scr_PlanetData/scr_PlanetData.gml | 2 +- scripts/scr_buttons/scr_buttons.gml | 4 +++- scripts/scr_cheatcode/scr_cheatcode.gml | 5 +++- scripts/scr_draw_text/scr_draw_text.gml | 20 +++++++++------- scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml | 2 +- .../scr_marine_struct/scr_marine_struct.gml | 17 +++++++++---- .../scr_mechanicus_fleet_functions.gml | 4 ++-- .../scr_mission_functions.gml | 15 ++++++------ .../scr_ork_fleet_functions.gml | 2 +- scripts/scr_ui_manage/scr_ui_manage.gml | 24 +++++++++++++++++-- 10 files changed, 66 insertions(+), 29 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 30c516c715..0199acb18e 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -116,7 +116,7 @@ function PlanetData(planet, system) constructor{ system.dispo[planet] = player_disposition; } - static collect_planet_group(group=SPECIALISTS_STANDARD,opposite=false,search_conditions = {companies:"all"}){ + static collect_planet_group = function(group=SPECIALISTS_STANDARD,opposite=false,search_conditions = {companies:"all"}){ return(collect_role_group(group,[system.name,planet],opposite,search_conditions)) } diff --git a/scripts/scr_buttons/scr_buttons.gml b/scripts/scr_buttons/scr_buttons.gml index 2c034b960a..0c8d2f7a6d 100644 --- a/scripts/scr_buttons/scr_buttons.gml +++ b/scripts/scr_buttons/scr_buttons.gml @@ -69,6 +69,7 @@ function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor{ tooltip = ""; max_width = -1; scale_text=false; + scale = 1; move_data_to_current_scope(data); @@ -91,7 +92,8 @@ function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor{ h = string_height(text) * scale; } } else { - w = string_width(text); + w = string_width(text) * scale; + h = string_height(text) * scale; } pop_draw_return_values(); diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 3e4941c35b..9ca7c0f482 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -527,11 +527,14 @@ function draw_planet_debug_problems(){ case "deliver_trophy": var _unit = fetch_unit(scr_random_marine("",0)); var _navy_fleets = get_imperial_navy_fleets(); + var _plan_type = target.p_type[obj_controller.selecting_planet]; var _pop_data = { trophy_owner : _unit, system: target.name, planet : obj_controller.selecting_planet, - target_fleet : array_random_element(_navy_fleets) + target_fleet : array_random_element(_navy_fleets), + beast : get_beast_name_by_planet_type(_plan_type) , + planet_type :_plan_type , } var _pop = instance_create(0,0,obj_popup); diff --git a/scripts/scr_draw_text/scr_draw_text.gml b/scripts/scr_draw_text/scr_draw_text.gml index a1a3fdae9b..d74566b1ce 100644 --- a/scripts/scr_draw_text/scr_draw_text.gml +++ b/scripts/scr_draw_text/scr_draw_text.gml @@ -62,16 +62,20 @@ function draw_text_glow_transformed(_x, _y, _text, _text_scale = [1,1], _angle = /// @function draw_text_outline /// @description This function will draw text in a similar way to draw_text(), only now the text will have an outline that may improve readability. -function draw_text_outline(_x, _y, _text, _outl_col=c_black, _text_col=-1){ +function draw_text_outline(_x, _y, _text, _outl_col=c_black, _text_col=-1,scale =1){ var _cur_color = draw_get_color(); draw_set_color(_outl_col); - draw_text(_x-1.5, _y, _text); - draw_text(_x+1.5, _y, _text); - draw_text(_x, _y-1.5, _text); - draw_text(_x, _y+1.5, _text); - if (_text_col != -1) draw_set_color(_text_col); - else draw_set_color(_cur_color); - draw_text(_x, _y, _text); + draw_text_transformed(_x-1.5, _y, _text, scale, scale, 0); + draw_text_transformed(_x+1.5, _y, _text, scale, scale, 0); + draw_text_transformed(_x, _y-1.5, _text, scale, scale, 0); + draw_text_transformed(_x, _y+1.5, _text, scale, scale, 0); + if (_text_col != -1){ + draw_set_color(_text_col); + } + else{ + draw_set_color(_cur_color); + } + draw_text_transformed(_x, _y, _text,scale, scale, 0); draw_set_color(_cur_color); } diff --git a/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml b/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml index 3d66a6b699..7922c04042 100644 --- a/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml +++ b/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml @@ -93,7 +93,7 @@ function scr_enemy_ai_b() { } if (badd == 1) { - scr_alert("red", "owner", "Planet " + planet_string + " has succeeded to the Tau Empire!", x, y); + scr_alert("red", "owner", "Planet {planet_numeral_name(i)} has succeed ed to the Tau Empire!", x, y); if (visited == 1) { //visited variable checks whether the star has been visited by the chapter or not 1 for true 0 for false if (p_type[i] == "Forge") { diff --git a/scripts/scr_marine_struct/scr_marine_struct.gml b/scripts/scr_marine_struct/scr_marine_struct.gml index a2828d9c12..89f005640e 100644 --- a/scripts/scr_marine_struct/scr_marine_struct.gml +++ b/scripts/scr_marine_struct/scr_marine_struct.gml @@ -820,7 +820,13 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} return ""; }; - static add_epithet(epithet){ + static add_epithet = function(epithet){ + if (is_string(epithet)){ + epithet = { + title : epithet, + story : "", + } + } array_push(epithets,epithet); } @@ -2004,7 +2010,7 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} } //quick way of getting name and role combined in string - static name_role = function() { + static name_role = function(include_epithet = true) { var temp_role = role(); if (squad != "none") { if (struct_exists(obj_ini.squad_types[$ obj_ini.squads[squad].type], temp_role)) { @@ -2014,9 +2020,12 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} } } } + var _name = "{temp_role} {name()}"; - if (array_length(epithest)){ - _name += $" {epithets[0]}"; + if (include_epithet){ + if (array_length(epithets)){ + _name += $" {epithets[0].title}"; + } } return string("{0} {1}", temp_role, name()); }; diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml index e6fdf75f87..b07f942107 100644 --- a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml @@ -41,11 +41,11 @@ function mech_fleet_explore_battle_grounds(){ if (_battle_ground.explored == 0){ var _text = $"The Mechanicus have arrived on {_p_data.name()} It will now be impossible to access the site without Mechanicus surveillance any potential rescources will now be fully put towards their aimsin service of the Ommnissiah"; - scr_popup($"Mechanicus Scavange {_p_data.name()}") + scr_popup($"Mechanicus Scavange {_p_data.name()}",_text, "mech"); } else { var _marines = _p_data.collect_planet_group("all"); if (array_length(_marines)){ - if () + if (true){} } } } \ No newline at end of file diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 7ce47b651e..bd6044378b 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -474,7 +474,7 @@ function get_beast_rumor(_planet_type, _beast_name){ ); } - return ""; + return $"{_beast_name} is the most fesarsome fauna in the entire segment according to locals"; } @@ -511,7 +511,7 @@ function get_beast_name_by_planet_type(_planet_type){ ); } - return "Unknown Horror"; + return "Glistening Horror"; } @@ -533,14 +533,13 @@ function init_beast_hunt_mission(planet, star, mission_slot){ mission_data.stage = "active"; var _mission_length=(irandom_range(2,5)); star.p_timer[planet][mission_slot] = _mission_length; - star.p_problem_other_data = {}; //pop.image="ancient_ruins"; var gar_pop=instance_create(0,0,obj_popup); //TODO some new universal methods for popups var _beast_name = get_beast_name_by_planet_type(star.p_type[planet]); - gar_pop.title=$"Marines assigned to hunt {_beast_name} beasts around {numeral_name}"; - gar_pop.text=$"The governor thanks you for lending your warriors to a task beneath their station — yet one whose outcome will be remembered. And that your marines shall find the {_beast_name} a suitable challenge. As things stand rumours say {get_beast_rumor(_beast_name, star.p_type[planet])}"; + gar_pop.title=$"Hunt {_beast_name} beasts around {numeral_name}"; + gar_pop.text=$"The governor thanks you for lending your warriors to a task beneath their station — yet one whose outcome will be remembered. And that your marines shall find the {_beast_name} a suitable challenge. As things stand rumours say {get_beast_rumor(star.p_type[planet])}"; //pip.image="event_march" gar_pop.add_option({ str1: "Happy Hunting" @@ -559,7 +558,7 @@ function init_beast_hunt_mission(planet, star, mission_slot){ function complete_beast_hunt_mission(targ_planet, problem_index){ var _planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage","active")){ - var _problem_data = problems_data[problem_index]; + var _problem_data = _planet.problems_data[problem_index]; _mission_string = ""; var man_conditions = { "job": "hunt_beast", @@ -619,7 +618,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ planet : targ_planet, target_fleet : array_random_element(_navy_fleets), beast :_problem_data.beast_name, - system_type : _planet.planet_type; + planet_type : _planet.planet_type, }; var _options = { @@ -649,7 +648,7 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ function init_deliver_trophy_mission(){ pop_data.trophy_name = format_beast_trophy(pop_data.beast); text = $"Much fanfare is made of the great trophy {pop_data.trophy_owner.name_role()} bears: {pop_data.trophy_name}."; - text += $" The governor proclaims it proof that {_beast_name} was the most fearsome predator in the sector."; + text += $" The governor proclaims it proof that {pop_data.beast} was the most fearsome predator in the sector."; text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; diff --git a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml index 0b58398dce..0ec8e96db5 100644 --- a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml +++ b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml @@ -77,7 +77,7 @@ function ork_fleet_arrive_target(){ } } if (ork_attack_planet>0){ - p_tyranids[ork_attack_planet] -= round(standard_fleet_strength_calc()); + p_tyranids[ork_attack_planet] -= round(standard_fleet_strength_calc(_ork_fleet)); var _pdata = new PlanetData(ork_attack_planet, self); diff --git a/scripts/scr_ui_manage/scr_ui_manage.gml b/scripts/scr_ui_manage/scr_ui_manage.gml index a935f8e312..cd9f7612c4 100644 --- a/scripts/scr_ui_manage/scr_ui_manage.gml +++ b/scripts/scr_ui_manage/scr_ui_manage.gml @@ -446,6 +446,22 @@ function reset_manage_unit_constants(unit){ unit_manage_image = unit.draw_unit_image(); temp[122] = unit.handle_stat_growth(); + + var _string_data = { + colour : #50a076, + scale : 0.7, + halign :fa_center, + font :fnt_40k_30b, + scale_text :true, + max_width : 250, + }; + + var _name=unit.name(); + if (array_length(unit.epithets)){ + _name += unit.epithets[0].title; + } + unit_manage_constants.name = new ReactiveString(_name,0,0,_string_data); + /*if (man[sel]="vehicle"){ // TODO }*/ @@ -706,8 +722,12 @@ function draw_sprite_and_unit_equip_data(){ draw_set_font(fnt_40k_14b); draw_text_transformed_outline(_name_box.x1, _name_box.y1, _name_box.text1, 1, 1, 0); draw_text_transformed_outline(_name_box.x1, _name_box.y2, _name_box.text2, 1, 1, 0); - draw_set_font(fnt_40k_30b); - draw_text_transformed_outline(_name_box.x1, _name_box.y3, _name_box.text3, 0.7, 0.7, 0); + + unit_manage_constants.name.update({ + x1: xx + 402, + y1: yy + 76, + }); + unit_manage_constants.name.draw(); // Draw unit info From 03b9e6e937a382935e402f4db1983ae088d8ca53 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 20 Dec 2025 02:16:44 +0000 Subject: [PATCH 24/93] better searching capabilities --- scripts/is_specialist/is_specialist.gml | 188 ++++++++++++++---- scripts/scr_PlanetData/scr_PlanetData.gml | 9 +- .../scr_mission_functions.gml | 97 ++++----- .../scr_player_fleet_functions.gml | 1 - 4 files changed, 204 insertions(+), 91 deletions(-) diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index 26ec8f1be5..092b24c4d3 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -229,10 +229,13 @@ function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=fa var _total_count = 0; if (struct_exists(search_conditions, "max")){ _max_count = search_conditions.max; + search_conditions.max_wanted = search_conditions.max; } - if (!struct_exists(search_conditions, "companies")){ - search_conditions.companies = "all"; - } + search_conditions.group = group; + search_conditions.location = location; + search_conditions.opposite = opposite; + + var _conditions = new SearchConditions(search_conditions); for (var com=0;com<=10;com++){ if (_max_count>0){ if (array_length(_units)>=_max_count){ @@ -242,55 +245,158 @@ function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=fa var _wanted_companies = search_conditions.companies; if (_wanted_companies!="all"){ if (is_array(_wanted_companies)){ - if (!array_contains(_wanted_companies, com)) then continue; + if (!array_contains(_wanted_companies, com)){ + continue; + } } else { - if (_wanted_companies != com) then continue; + if (_wanted_companies != com){ + continue; + } } } for (var i=0;i0){ - if (array_length(_units)>=_max_count){ + if (_conditions.end_loop){ break; - } } - if array_length(_units) - _add=false; - unit=fetch_unit([com,i]); - if (unit.name()=="") then continue; - if (group!="all"){ - if (is_array(group)){ - if (array_length(group) == 3) { - _is_special_group = unit.IsSpecialist(group[0], group[1], group[2]); - } else { - _is_special_group = unit.IsSpecialist(group[0], group[1]); - } + _unit=fetch_unit([com,i]); + + if (_conditions.evaluate(_unit)){ + array_push(_units, _unit); + } + } + } + return _units; +} + + +function SearchConditions(data) constructor{ + group = "all"; + opposite = false; + location = ""; + max_wanted = 0; + companies = "all"; + + static update_constants = function(data){ + move_data_to_current_scope(data); + group_is_complex = is_array(group); + if (group_is_complex){ + if (array_length(_group) == 3){ + group_search_heads = true; + } else { + group_search_heads = false; + } + } + complex_location = is_array(location); + + search_companies = !is_string(companies); + if (search_companies){ + search_multiple_companies = is_array(search_companies); + } + + if (max_wanted > 0){ + found = 0; + } + + end_loop = false; + } + + update_constants(data); + + static evaluate = function(unit){ + if (unit.name()==""){ + return false; + } + if (search_companies){ + if (search_multiple_companies){ + if (!array_contains(_wanted_companies, unit.company)){ + return false; + } + } else { + if (_wanted_companies != unit.company){ + return false; + } + } + } + + var _add = false; + if (group!="all"){ + var _group = group; + if (group_is_array){ + if (group_search_heads) { + _is_special_group = unit.IsSpecialist(_group[0], _group[1], _group[2]); } else { - _is_special_group = unit.IsSpecialist(group); + _is_special_group = unit.IsSpecialist(_group[0], _group[1]); } } else { - _is_special_group = true; + _is_special_group = unit.IsSpecialist(_group); } - if ((_is_special_group && !opposite) || (!_is_special_group && opposite)){ - if (location==""){ - _add=true; - } else if (!is_array(location)){ - _add=unit.is_at_location(location); - } else { - _add=unit.is_at_location(location[0], location[1], location[2]); - } - } - if (_add){ - if (struct_exists(search_conditions, "stat")){ - _add = stat_valuator(search_conditions.stat, unit); - } - if (struct_exists(search_conditions,"job")){ - _add = (unit.assignment() == search_conditions.job); - } - } - if (_add) then array_push(_units, obj_ini.TTRPG[com][i]); - } + } else { + _is_special_group = true; + } + if ((_is_special_group && !opposite) || (!_is_special_group && opposite)){ + if (location==""){ + _add=true; + } else if (!complex_location){ + _add=unit.is_at_location(location); + } else { + _add=unit.is_at_location(location[0], location[1], location[2]); + } + } + if (_add){ + if (struct_exists(self, "stat")){ + _add = stat_valuator(stat, unit); + } + if (struct_exists(self,"job")){ + _add = (unit.assignment() == job); + } + } + + if (max_wanted > 0 && _add){ + found++; + if (found>max_wanted){ + _add = false; + end_loop = true; + } + } + + + return _add; + } + +} + + +function UnitGroup(units) constructor{ + self.units = units; + + static number = function(){ + return array_length(units); + } + + static has_role = function(role){ + for (var i=0;i Date: Sat, 20 Dec 2025 18:05:40 +0000 Subject: [PATCH 25/93] better improvements to searching units and sorting --- scripts/is_specialist/is_specialist.gml | 108 ++++++++++++++---- scripts/scr_PlanetData/scr_PlanetData.gml | 39 +++++-- .../scr_mechanicus_fleet_functions.gml | 8 +- 3 files changed, 124 insertions(+), 31 deletions(-) diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index 092b24c4d3..b1449285d5 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -275,6 +275,7 @@ function SearchConditions(data) constructor{ location = ""; max_wanted = 0; companies = "all"; + allegiance = ""; static update_constants = function(data){ move_data_to_current_scope(data); @@ -302,55 +303,100 @@ function SearchConditions(data) constructor{ update_constants(data); - static evaluate = function(unit){ - if (unit.name()==""){ - return false; - } + static oposite_switch = function(val){ + return opposite ? !val : val; + } + + static company_evaluate = function(){ + var _add = true; if (search_companies){ if (search_multiple_companies){ if (!array_contains(_wanted_companies, unit.company)){ - return false; + _add = false; } } else { if (_wanted_companies != unit.company){ - return false; + _add = false; } } + _add = oposite_switch(_add); } - var _add = false; + return _add; + } + + static group_evaluate = function(){ + + var _add = true; if (group!="all"){ var _group = group; if (group_is_array){ if (group_search_heads) { - _is_special_group = unit.IsSpecialist(_group[0], _group[1], _group[2]); + _add = unit.IsSpecialist(_group[0], _group[1], _group[2]); } else { - _is_special_group = unit.IsSpecialist(_group[0], _group[1]); + _add = unit.IsSpecialist(_group[0], _group[1]); } } else { - _is_special_group = unit.IsSpecialist(_group); + _add = unit.IsSpecialist(_group); } - } else { - _is_special_group = true; + _add = oposite_switch(_add); } - if ((_is_special_group && !opposite) || (!_is_special_group && opposite)){ - if (location==""){ - _add=true; - } else if (!complex_location){ + return _add; + } + + static location_evaluate = function(){ + var _add = true; + if (location!=""){ + if (!complex_location){ _add=unit.is_at_location(location); } else { _add=unit.is_at_location(location[0], location[1], location[2]); } - } + _add = oposite_switch(_add); + } + + return _add; + } + + static checks_order = [ + company_evaluate, + group_evaluate, + location_evaluate + ]; + + + static evaluate = function(unit){ + self.unit = unit; + if (unit.name()==""){ + return false; + } + + var _add = true; + for (var i=0;i 0 && _add){ found++; if (found>max_wanted){ @@ -383,6 +429,26 @@ function UnitGroup(units) constructor{ return false; } + static has_base_group = function(group){ + for (var i=0;i 0){ + text = ""; + scr_popup("Conflict of Interest",) + } + } + + } @@ -1583,16 +1606,16 @@ function PlanetData(planet, system) constructor{ var find_nid_chance = 50 - planet_garrison.total_garrison; if (population_influences[eFACTION.Tyranids] > 50) { var find_cult_chance = irandom(50); - var alert_text = $"A hidden Genestealer Cult in {name} Has suddenly burst forth from hiding!"; + var alert_text = $"A hidden Genestealer Cult on {name()} Has suddenly burst forth from hiding!"; if (planet_garrison.garrison_force) { - var alert_text = $"A hidden Genestealer Cult in {name} Has been discovered by marine garrisons!"; + var alert_text = $"A hidden Genestealer Cult on {name()} Has been discovered by marine garrisons!"; find_cult_chance -= 25; } if (find_cult_chance < 1) { cult.hiding = false; scr_popup("System Lost", alert_text, "Genestealer Cult", ""); set_new_owner(eFACTION.Tyranids); - scr_event_log("red", $"A hidden Genestealer Cult in {name} {i} has Started a revolt.", name); + scr_event_log("red", $"A hidden Genestealer Cult on {name()} has Started a revolt.", system.name); edit_forces(eFACTION.Tyranids,1); } } @@ -1715,12 +1738,12 @@ function PlanetData(planet, system) constructor{ } scr_alert("purple", "owner", tixt, x, y); - scr_event_log("purple", tixt, name); + scr_event_log("purple", tixt, system.name); } } else { tixt = $"Marine garrisons prevents rebellion on {name()}"; scr_alert("green", "owner", tixt, x, y); - scr_event_log("green", tixt, name); + scr_event_log("green", tixt, system.name); corruption -= irandom(5); } // Cult crushed; don't bother showing if there's already fighting going on over there @@ -1756,7 +1779,7 @@ function PlanetData(planet, system) constructor{ var n_name = name(); scr_popup("Heretic Revolt", $"A massive heretic uprising on {n_name} threatens to plunge the star system into chaos.", "chaos_cultist", ""); scr_alert("red", "owner", $"Massive heretic uprising on {n_name}.", x, y); - scr_event_log("purple", $"Massive heretic uprising on {n_name}.", name); + scr_event_log("purple", $"Massive heretic uprising on {n_name}.", system.name); } // Huge uprising if ((_rando >= 100) && (planet_forces[eFACTION.Heretics] < 5)) { @@ -1771,7 +1794,7 @@ function PlanetData(planet, system) constructor{ if ((_rando >= 41) && (!notixt) && tixt != "") { scr_alert("red", "owner", tixt, x, y); - scr_event_log("purple", tixt, name); + scr_event_log("purple", tixt, system.name); } // if (planet_forces[eFACTION.Heretics]>2){obj_controller.x=self.x;obj_controller.y=self.y;} } // End traitors cult diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml index b07f942107..5f0dd00cc5 100644 --- a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml @@ -41,11 +41,15 @@ function mech_fleet_explore_battle_grounds(){ if (_battle_ground.explored == 0){ var _text = $"The Mechanicus have arrived on {_p_data.name()} It will now be impossible to access the site without Mechanicus surveillance any potential rescources will now be fully put towards their aimsin service of the Ommnissiah"; - scr_popup($"Mechanicus Scavange {_p_data.name()}",_text, "mech"); + scr_popup($"Mechanicus Scavange {_p_data.name()}", _text, "mech"); } else { var _marines = _p_data.collect_planet_group("all"); if (array_length(_marines)){ - if (true){} + var _heritecs = obj_controller.tech_status == "heretics"; + if (_heritecs){ + _text = "The Rumours of the heretical practices of your marines have not gone un-noticed your presence is thusly even more enraging to mechanicus"; + } + } } } \ No newline at end of file From 03d54dbb4a2392c173e565c392f252778f02780a Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 20 Dec 2025 19:09:17 +0000 Subject: [PATCH 26/93] coonsistent use of active_roles and other sorting --- ChapterMaster.yyp | 1 + objects/obj_controller/Alarm_5.gml | 11 +- objects/obj_controller/Alarm_6.gml | 67 +-- objects/obj_ncombat/Alarm_1.gml | 52 +-- scripts/is_specialist/is_specialist.gml | 404 ------------------ scripts/scr_PlanetData/scr_PlanetData.gml | 15 +- .../scr_UnitGroup_and_group_selection.gml | 403 +++++++++++++++++ .../scr_UnitGroup_and_group_selection.yy | 13 + .../scr_specialist_training.gml | 52 ++- 9 files changed, 524 insertions(+), 494 deletions(-) create mode 100644 scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml create mode 100644 scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index f1a3b07771..6869cb597b 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -958,6 +958,7 @@ {"id":{"name":"scr_unit_size","path":"scripts/scr_unit_size/scr_unit_size.yy",},}, {"id":{"name":"scr_unit_spawn_functions","path":"scripts/scr_unit_spawn_functions/scr_unit_spawn_functions.yy",},}, {"id":{"name":"scr_unit_traits","path":"scripts/scr_unit_traits/scr_unit_traits.yy",},}, + {"id":{"name":"scr_UnitGroup_and_group_selection","path":"scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy",},}, {"id":{"name":"scr_uuid_generate","path":"scripts/scr_uuid_generate/scr_uuid_generate.yy",},}, {"id":{"name":"scr_vehicle_count","path":"scripts/scr_vehicle_count/scr_vehicle_count.yy",},}, {"id":{"name":"scr_vehicle_helpers","path":"scripts/scr_vehicle_helpers/scr_vehicle_helpers.yy",},}, diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index 1117ba4e26..e387384e6f 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -15,6 +15,7 @@ var spikky=0; var roll=0; var novice_type=""; var unit; +var _roles = active_roles(); try_and_report_loop("chaos_spread", function(){ @@ -82,7 +83,7 @@ while (i1){ - scr_alert("green","recruitment",$"{recruits_finished}x {obj_ini.role[100][12]} have joined X Company.",0,0); + scr_alert("green","recruitment",$"{recruits_finished}x {_roles[12]} have joined X Company.",0,0); } @@ -414,10 +415,10 @@ if (disposition[eFACTION.Ork]>=60) then scr_loyalty("Xeno Associate","+"); if (disposition[eFACTION.Tau]>=60) then scr_loyalty("Xeno Associate","+"); var loyalty_counter=0; -loyalty_counter=scr_role_count(obj_ini.role[100][15],""); +loyalty_counter=scr_role_count(_roles[15],""); if (loyalty_counter==0) then scr_loyalty("Lack of Apothecary","+"); -loyalty_counter=scr_role_count(obj_ini.role[100][14],""); +loyalty_counter=scr_role_count(_roles[14],""); if (loyalty_counter==0) then scr_loyalty("Undevout","+"); // TODO in another PR rework how Non-Codex Size is determined, perhaps the inquisition needs to pass some checks or do an investigation event // which you could eventually interrupt (kill the team) and cover it up? diff --git a/objects/obj_controller/Alarm_6.gml b/objects/obj_controller/Alarm_6.gml index 039a9cc5e3..171a033801 100644 --- a/objects/obj_controller/Alarm_6.gml +++ b/objects/obj_controller/Alarm_6.gml @@ -10,6 +10,7 @@ if (menu==1) and (managing>0){ var manz=0,vanz=0,stahp=0; sel_promoting=1; + var _roles = active_roles(); for(var f=0; f0){ // sets up count for the marines if (man[f]=="man"){ manz+=1; - if (unit.role()==obj_ini.role[100][5]) { cap+=1;} - else if (unit.role()==obj_ini.role[100][15]) { apo+=1;} - else if (unit.role()==obj_ini.role[100][14]) { chap+=1;} - else if (unit.role()==obj_ini.role[100][17]) { lib+=1;} - else if (unit.role()==obj_ini.role[100][16]) { tech+=1;} - else if (unit.role()==obj_ini.role[100][6]) { drea+=1;} - else if (unit.role()==$"Venerable {obj_ini.role[100][6]}"){ vdrea+=1;} - else if (unit.role()==obj_ini.role[100][11]) { bear+=1;} - else if (unit.role()==obj_ini.role[100][8]) { tct+=1;} - else if (unit.role()==obj_ini.role[100][10]) { assa+=1;} - else if (unit.role()==obj_ini.role[100][9]) { dev+=1;} - else if (unit.role()==obj_ini.role[100][12]) { sco+=1;} - else if (unit.role()==obj_ini.role[100][2]) { hon+=1;} - else if (unit.role()==obj_ini.role[100][3]) { ve+=1;} - else if (unit.role()==obj_ini.role[100][4]) { ter+=1;} - else if (unit.role()==obj_ini.role[100][18]) { sgt++;} - else if (unit.role()==obj_ini.role[100][19]) { vet_sgt++;} + if (unit.role()==_roles[5]) { cap+=1;} + else if (unit.role()==_roles[15]) { apo+=1;} + else if (unit.role()==_roles[14]) { chap+=1;} + else if (unit.role()==_roles[17]) { lib+=1;} + else if (unit.role()==_roles[16]) { tech+=1;} + else if (unit.role()==_roles[6]) { drea+=1;} + else if (unit.role()==$"Venerable {_roles[6]}"){ vdrea+=1;} + else if (unit.role()==_roles[11]) { bear+=1;} + else if (unit.role()==_roles[8]) { tct+=1;} + else if (unit.role()==_roles[10]) { assa+=1;} + else if (unit.role()==_roles[9]) { dev+=1;} + else if (unit.role()==_roles[12]) { sco+=1;} + else if (unit.role()==_roles[2]) { hon+=1;} + else if (unit.role()==_roles[3]) { ve+=1;} + else if (unit.role()==_roles[4]) { ter+=1;} + else if (unit.role()==_roles[18]) { sgt++;} + else if (unit.role()==_roles[19]) { vet_sgt++;} else if (unit.role()=="Codiciery") { codi+=1;} else if (unit.role()=="Lexicanum") { lexi+=1;} - else if (unit.role()==obj_ini.role[100][eROLE.Ancient]) { champ+=1;} + else if (unit.role()==_roles[eROLE.Ancient]) { champ+=1;} } // sets up count for the vehicles // TODO This needs to be extended to accomodate the selection text like the man ones @@ -62,22 +63,22 @@ if (menu==1) and (managing>0){ selecting_dudes=""; // Infantry text if (cap>0){ - selecting_dudes+=string(cap)+" "+string(obj_ini.role[100][5]); + selecting_dudes+=string(cap)+" "+string(_roles[5]); if (cap>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (chap>0){ - selecting_dudes+=string(chap)+" "+string(obj_ini.role[100][14]); + selecting_dudes+=string(chap)+" "+string(_roles[14]); if (chap>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (champ>0){ - selecting_dudes+=$"{champ} {obj_ini.role[100][eROLE.Ancient]}"; + selecting_dudes+=$"{champ} {_roles[eROLE.Ancient]}"; if (chap>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (apo>0){ - selecting_dudes+=string(apo)+" "+string(obj_ini.role[100][15]); + selecting_dudes+=string(apo)+" "+string(_roles[15]); if (apo>1) then selecting_dudes+="s"; selecting_dudes+=", "; } @@ -97,17 +98,17 @@ if (menu==1) and (managing>0){ selecting_dudes+=", "; } if (bear>0){ - selecting_dudes+=string(bear)+" "+string(obj_ini.role[100][11]); + selecting_dudes+=string(bear)+" "+string(_roles[11]); if (bear>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (hon>0){ - selecting_dudes+=string(hon)+" "+string(obj_ini.role[100][2]); + selecting_dudes+=string(hon)+" "+string(_roles[2]); if (hon>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (tech>0){ - selecting_dudes+=string(tech)+" "+string(obj_ini.role[100][16]); + selecting_dudes+=string(tech)+" "+string(_roles[16]); if (tech>1) then selecting_dudes+="s"; selecting_dudes+=", "; } @@ -117,42 +118,42 @@ if (menu==1) and (managing>0){ selecting_dudes+=", "; } if (ve>0){ - selecting_dudes+=string(ve)+" "+string(obj_ini.role[100][3]); + selecting_dudes+=string(ve)+" "+string(_roles[3]); if (ve>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (tct>0){ - selecting_dudes+=string(tct)+" "+string(obj_ini.role[100][8]); + selecting_dudes+=string(tct)+" "+string(_roles[8]); if (tct>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (dev>0){ - selecting_dudes+=string(dev)+" "+string(obj_ini.role[100][9]); + selecting_dudes+=string(dev)+" "+string(_roles[9]); if (dev>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (assa>0){ - selecting_dudes+=string(assa)+" "+string(obj_ini.role[100][eROLE.Assault]); + selecting_dudes+=string(assa)+" "+string(_roles[eROLE.Assault]); if (sgt>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (sco>0){ - selecting_dudes+=string(sco)+" "+string(obj_ini.role[100][12]); + selecting_dudes+=string(sco)+" "+string(_roles[12]); if (sco>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (drea>0){ - selecting_dudes+=string(drea)+" "+string(obj_ini.role[100][6]); + selecting_dudes+=string(drea)+" "+string(_roles[6]); if (drea>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (sgt>0){ - selecting_dudes+=string(sgt)+" "+string(obj_ini.role[100][18]); + selecting_dudes+=string(sgt)+" "+string(_roles[18]); if (sgt>1) then selecting_dudes+="s"; selecting_dudes+=", "; } if (vet_sgt>0){ - selecting_dudes+=string(vet_sgt)+" "+string(obj_ini.role[100][19]); + selecting_dudes+=string(vet_sgt)+" "+string(_roles[19]); if (vet_sgt>1) then selecting_dudes+="s"; selecting_dudes+=", "; } diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 53186af849..d467834988 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -1,5 +1,7 @@ var a1;a1=""; +var _roles = active_roles(); + if (ally>0) and (ally_forces>0){ if (ally=3){ @@ -133,24 +135,24 @@ if (string_count("_attack",battle_special)>0){ if (tacticals>0) and (veterans>0){ - p2=string(tacticals+veterans)+" "+string(obj_ini.role[100][8])+"s, "; + p2=string(tacticals+veterans)+" "+string(_roles[8])+"s, "; } if (tacticals>0) and (veterans=0){ - if (tacticals=1) then p2=string(tacticals)+" "+string(obj_ini.role[100][8])+", "; - if (tacticals>1) then p2=string(tacticals)+" "+string(obj_ini.role[100][8])+"s, "; + if (tacticals=1) then p2=string(tacticals)+" "+string(_roles[8])+", "; + if (tacticals>1) then p2=string(tacticals)+" "+string(_roles[8])+"s, "; } if (tacticals=0) and (veterans>0){ - if (veterans=1) then p2=string(veterans)+" "+string(obj_ini.role[100][3])+", "; - if (veterans>1) then p2=string(veterans)+" "+string(obj_ini.role[100][3])+"s, "; + if (veterans=1) then p2=string(veterans)+" "+string(_roles[3])+", "; + if (veterans>1) then p2=string(veterans)+" "+string(_roles[3])+"s, "; } if (assaults>0){ - if (assaults=1) then p2+=string(assaults)+" "+string(obj_ini.role[100][10])+", "; - if (assaults>1) then p2+=string(assaults)+" "+string(obj_ini.role[100][10])+"s, "; + if (assaults=1) then p2+=string(assaults)+" "+string(_roles[10])+", "; + if (assaults>1) then p2+=string(assaults)+" "+string(_roles[10])+"s, "; } if (devastators>0){ - if (devastators=1) then p2+=string(devastators)+" "+string(obj_ini.role[100][9])+", "; - if (devastators>1) then p2+=string(devastators)+" "+string(obj_ini.role[100][9])+"s, "; + if (devastators=1) then p2+=string(devastators)+" "+string(_roles[9])+", "; + if (devastators>1) then p2+=string(devastators)+" "+string(_roles[9])+"s, "; } if (temp<200) and (terminators>0){ @@ -159,37 +161,37 @@ if (temp<200) and (terminators>0){ } if (temp<200) and (chaplains>0){ - if (chaplains=1) then p2+=string(chaplains)+" "+string(obj_ini.role[100][14])+", "; - if (chaplains>1) then p2+=string(chaplains)+" "+string(obj_ini.role[100][14])+", "; + if (chaplains=1) then p2+=string(chaplains)+" "+string(_roles[14])+", "; + if (chaplains>1) then p2+=string(chaplains)+" "+string(_roles[14])+", "; } if (temp<200) and (apothecaries>0){ - if (apothecaries=1) then p2+=string(apothecaries)+" "+string(obj_ini.role[100][15])+", "; - if (apothecaries>1) then p2+=string(apothecaries)+" "+string(obj_ini.role[100][15])+", "; + if (apothecaries=1) then p2+=string(apothecaries)+" "+string(_roles[15])+", "; + if (apothecaries>1) then p2+=string(apothecaries)+" "+string(_roles[15])+", "; } if (temp<200) and (librarians>0){ - if (librarians=1) then p2+=string(librarians)+" "+string(obj_ini.role[100,17])+", "; - if (librarians>1) then p2+=string(librarians)+" "+string(obj_ini.role[100,17])+", "; + if (librarians=1) then p2+=string(librarians)+" "+string(_roles[17])+", "; + if (librarians>1) then p2+=string(librarians)+" "+string(_roles[17])+", "; } if (temp<200) and (techmarines>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][16])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][16])+", "; + if (techmarines=1) then p2+=string(techmarines)+" "+string(_roles[16])+", "; + if (techmarines>1) then p2+=string(techmarines)+" "+string(_roles[16])+", "; } if (temp<200) and (sgts>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][18])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][18])+", "; + if (techmarines=1) then p2+=string(techmarines)+" "+string(_roles[18])+", "; + if (techmarines>1) then p2+=string(techmarines)+" "+string(_roles[18])+", "; } if (temp<200) and (vet_sgts>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][19])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][19])+", "; + if (techmarines=1) then p2+=string(techmarines)+" "+string(_roles[19])+", "; + if (techmarines>1) then p2+=string(techmarines)+" "+string(_roles[19])+", "; } if (scouts>0){ - if (scouts=1) then p2+=string(scouts)+" "+string(obj_ini.role[100][12])+", "; - if (scouts>1) then p2+=string(scouts)+" "+string(obj_ini.role[100][12])+"s, "; + if (scouts=1) then p2+=string(scouts)+" "+string(_roles[12])+", "; + if (scouts>1) then p2+=string(scouts)+" "+string(_roles[12])+"s, "; } @@ -226,8 +228,8 @@ if (standard_bearers>1) and (dropping=0) then p5=" Chapter Ancients hold your C if (dreadnoughts+predators+land_raiders>3){ p6=" Forming up the armoured division is "; - if (dreadnoughts=1) then p6+=string(dreadnoughts)+" "+string(obj_ini.role[100][6])+", "; - if (dreadnoughts>1) then p6+=string(dreadnoughts)+" "+string(obj_ini.role[100][6])+"s, "; + if (dreadnoughts=1) then p6+=string(dreadnoughts)+" "+string(_roles[6])+", "; + if (dreadnoughts>1) then p6+=string(dreadnoughts)+" "+string(_roles[6])+"s, "; if (rhinos=1) then p6+=string(rhinos)+" Rhino, "; if (rhinos>1) then p6+=string(rhinos)+" Rhinos, "; diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index b1449285d5..46041abf28 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -211,407 +211,3 @@ function is_specialist(unit_role, type = SPECIALISTS_STANDARD, include_trainee = return array_contains(_specialists, unit_role); } - -//TODO write this out with proper formatting when i can be assed -//Used to quikcly collect groups of marines with given parameters -// group takes a string relating to options in the role_groups function, to ignore filtering by group use "all" - // can also pass an array to filter for mutiple groups -// location takes wther a string with a system name or an array with 3 parameters [,,] -// if opposite is true then then the roles defined in the group argument are ignored and all others collected -// search conditions - // companies, takes either an int or an arrat to define which companies to search in - // any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines - // job allows you to find marines forfuling certain tasks like garrison or forge etc - -function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=false, search_conditions = {companies:"all"}){ - var _units = [], unit, count=0, _add=false, _is_special_group; - var _max_count = 0; - var _total_count = 0; - if (struct_exists(search_conditions, "max")){ - _max_count = search_conditions.max; - search_conditions.max_wanted = search_conditions.max; - } - search_conditions.group = group; - search_conditions.location = location; - search_conditions.opposite = opposite; - - var _conditions = new SearchConditions(search_conditions); - for (var com=0;com<=10;com++){ - if (_max_count>0){ - if (array_length(_units)>=_max_count){ - break; - } - } - var _wanted_companies = search_conditions.companies; - if (_wanted_companies!="all"){ - if (is_array(_wanted_companies)){ - if (!array_contains(_wanted_companies, com)){ - continue; - } - } else { - if (_wanted_companies != com){ - continue; - } - } - } - for (var i=0;i 0){ - found = 0; - } - - end_loop = false; - } - - update_constants(data); - - static oposite_switch = function(val){ - return opposite ? !val : val; - } - - static company_evaluate = function(){ - var _add = true; - if (search_companies){ - if (search_multiple_companies){ - if (!array_contains(_wanted_companies, unit.company)){ - _add = false; - } - } else { - if (_wanted_companies != unit.company){ - _add = false; - } - } - _add = oposite_switch(_add); - } - - return _add; - } - - static group_evaluate = function(){ - - var _add = true; - if (group!="all"){ - var _group = group; - if (group_is_array){ - if (group_search_heads) { - _add = unit.IsSpecialist(_group[0], _group[1], _group[2]); - } else { - _add = unit.IsSpecialist(_group[0], _group[1]); - } - } else { - _add = unit.IsSpecialist(_group); - } - _add = oposite_switch(_add); - } - return _add; - } - - static location_evaluate = function(){ - var _add = true; - if (location!=""){ - if (!complex_location){ - _add=unit.is_at_location(location); - } else { - _add=unit.is_at_location(location[0], location[1], location[2]); - } - _add = oposite_switch(_add); - } - - return _add; - } - - static checks_order = [ - company_evaluate, - group_evaluate, - location_evaluate - ]; - - - static evaluate = function(unit){ - self.unit = unit; - if (unit.name()==""){ - return false; - } - - var _add = true; - for (var i=0;i 0 && _add){ - found++; - if (found>max_wanted){ - _add = false; - end_loop = true; - } - } - - - return _add; - } - -} - - -function UnitGroup(units) constructor{ - self.units = units; - - static number = function(){ - return array_length(units); - } - - static has_role = function(role){ - for (var i=0;i _stat_val[1]){ - match = false; - break; - } - break; - - case "exless": - if (unit[$ _stat_val[0]] >= _stat_val[1]){ - match = false; - break; - } - break; - } - } - return match; -} - -function collect_by_religeon(religion, sub_cult="", location=""){ - var _units = [], unit, count=0, _add=false; - for (var com=0;com<=10;com++){ - for (var i=1;i 0) { - for (var veh = 0; veh < array_length(vehicles); veh++) { - unit = vehicles[veh]; - add_vehicle_to_manage_arrays(unit); - } - } - other_manage_data(); - man_current = 0; - man_max = MANAGE_MAN_MAX; - - if (selection_data.select_type == MissionSelectType.Squads){ - new_company_struct(); - company_data.has_squads = true; - company_data.squad_location = selection_data.system.name; - company_data.squad_search(); - managing = -1; - } - } - } catch (_exception) { - //handle and send player back to map - handle_exception(_exception); - scr_toggle_manage(); - } -} diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 5d41675791..c0f8f71ac8 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -689,9 +689,16 @@ function PlanetData(planet, system) constructor{ allegiance : "mechanicus" }); - if (array_length(_priests) > 0){ - text = ""; - scr_popup("Conflict of Interest",) + if (_priests.number > 0){ + if (_priests.number == _techmarines.number){ + text = "Without any technical staff wholly loyal to the chapter the TechPriests Quickly set too Work sequestering any valuable resources for the Omnissiah"; + text += + scr_popup("Mars Control"); + } else { + text = "After Unloading Marines too site it becomes clear there is discontent among the group.\n"; + text = "A contingent of the force comprised of Techpriests are unhappy with the decision.\n"; + scr_popup("Conflict of Interest",) + } } } @@ -1073,7 +1080,7 @@ function PlanetData(planet, system) constructor{ if (!is_hulk){ - if (improve=1){ + if (improve){ draw_set_color(c_green); draw_rectangle(xx+481,yy+280,xx+716,yy+298,0); draw_sprite(spr_requisition,0,xx+657,yy+283); diff --git a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml new file mode 100644 index 0000000000..f9feafcad1 --- /dev/null +++ b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml @@ -0,0 +1,403 @@ +//TODO write this out with proper formatting when i can be assed +//Used to quikcly collect groups of marines with given parameters +// group takes a string relating to options in the role_groups function, to ignore filtering by group use "all" + // can also pass an array to filter for mutiple groups +// location takes wther a string with a system name or an array with 3 parameters [,,] +// if opposite is true then then the roles defined in the group argument are ignored and all others collected +// search conditions + // companies, takes either an int or an arrat to define which companies to search in + // any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines + // job allows you to find marines forfuling certain tasks like garrison or forge etc + +function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=false, search_conditions = {companies:"all"}){ + var _units = [], unit, count=0, _add=false, _is_special_group; + var _max_count = 0; + var _total_count = 0; + if (struct_exists(search_conditions, "max")){ + _max_count = search_conditions.max; + search_conditions.max_wanted = search_conditions.max; + } + search_conditions.group = group; + search_conditions.location = location; + search_conditions.opposite = opposite; + + var _conditions = new SearchConditions(search_conditions); + for (var com=0;com<=10;com++){ + if (_max_count>0){ + if (array_length(_units)>=_max_count){ + break; + } + } + var _wanted_companies = search_conditions.companies; + if (_wanted_companies!="all"){ + if (is_array(_wanted_companies)){ + if (!array_contains(_wanted_companies, com)){ + continue; + } + } else { + if (_wanted_companies != com){ + continue; + } + } + } + for (var i=0;i 0){ + found = 0; + } + + end_loop = false; + } + + update_constants(data); + + static oposite_switch = function(val){ + return opposite ? !val : val; + } + + static company_evaluate = function(){ + var _add = true; + if (search_companies){ + if (search_multiple_companies){ + if (!array_contains(_wanted_companies, unit.company)){ + _add = false; + } + } else { + if (_wanted_companies != unit.company){ + _add = false; + } + } + _add = oposite_switch(_add); + } + + return _add; + } + + static group_evaluate = function(){ + + var _add = true; + if (group!="all"){ + var _group = group; + if (group_is_array){ + if (group_search_heads) { + _add = unit.IsSpecialist(_group[0], _group[1], _group[2]); + } else { + _add = unit.IsSpecialist(_group[0], _group[1]); + } + } else { + _add = unit.IsSpecialist(_group); + } + _add = oposite_switch(_add); + } + return _add; + } + + static location_evaluate = function(){ + var _add = true; + if (location!=""){ + if (!complex_location){ + _add=unit.is_at_location(location); + } else { + _add=unit.is_at_location(location[0], location[1], location[2]); + } + _add = oposite_switch(_add); + } + + return _add; + } + + static checks_order = [ + company_evaluate, + group_evaluate, + location_evaluate + ]; + + + static evaluate = function(unit){ + self.unit = unit; + if (unit.name()==""){ + return false; + } + + var _add = true; + for (var i=0;i 0 && _add){ + found++; + if (found>max_wanted){ + _add = false; + end_loop = true; + } + } + + + return _add; + } + +} + + +function UnitGroup(units) constructor{ + self.units = units; + + static number = function(){ + return array_length(units); + } + + static has_role = function(role){ + for (var i=0;i _stat_val[1]){ + match = false; + break; + } + break; + + case "exless": + if (unit[$ _stat_val[0]] >= _stat_val[1]){ + match = false; + break; + } + break; + } + } + return match; +} + +function collect_by_religeon(religion, sub_cult="", location=""){ + var _units = [], unit, count=0, _add=false; + for (var com=0;com<=10;com++){ + for (var i=1;i 0) { + for (var veh = 0; veh < array_length(vehicles); veh++) { + unit = vehicles[veh]; + add_vehicle_to_manage_arrays(unit); + } + } + other_manage_data(); + man_current = 0; + man_max = MANAGE_MAN_MAX; + + if (selection_data.select_type == MissionSelectType.Squads){ + new_company_struct(); + company_data.has_squads = true; + company_data.squad_location = selection_data.system.name; + company_data.squad_search(); + managing = -1; + } + } + } catch (_exception) { + //handle and send player back to map + handle_exception(_exception); + scr_toggle_manage(); + } +} \ No newline at end of file diff --git a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy new file mode 100644 index 0000000000..2d2594c762 --- /dev/null +++ b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"scr_UnitGroup_and_group_selection", + "isCompatibility":false, + "isDnD":false, + "name":"scr_UnitGroup_and_group_selection", + "parent":{ + "name":"marines_and_profiles", + "path":"folders/Scripts/marines_and_profiles.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/scr_specialist_training/scr_specialist_training.gml b/scripts/scr_specialist_training/scr_specialist_training.gml index 7cf686d1fa..7b52f7363b 100644 --- a/scripts/scr_specialist_training/scr_specialist_training.gml +++ b/scripts/scr_specialist_training/scr_specialist_training.gml @@ -1,14 +1,15 @@ function specialistfunct (specialist, req_exp) { + var _roles = active_roles(); var spec_tips = [ - string("{0} Potential", obj_ini.role[100][16]), - string("{0} Potential", obj_ini.role[100][15]), - string("{0} Potential", obj_ini.role[100][14]), - string("{0} Potential", obj_ini.role[100][17]), - string("{0} Applicant", obj_ini.role[100][16]), - string("{0} Applicant", obj_ini.role[100][15]), - string("{0} Applicant", obj_ini.role[100][14]), - string("{0} Applicant", obj_ini.role[100][17]), + string("{0} Potential", _roles[16]), + string("{0} Potential", _roles[15]), + string("{0} Potential", _roles[14]), + string("{0} Potential", _roles[17]), + string("{0} Applicant", _roles[16]), + string("{0} Applicant", _roles[15]), + string("{0} Applicant", _roles[14]), + string("{0} Applicant", _roles[17]), string("Promote to Marine") ]; @@ -50,7 +51,7 @@ function specialistfunct (specialist, req_exp) { break; } - if (role() == obj_ini.role[100][12]) { + if (role() == _roles[12]) { colors[0] = c_fuchsia; } @@ -59,7 +60,7 @@ function specialistfunct (specialist, req_exp) { } if (experience >= req_exp) { - if (!(role() == obj_ini.role[100][12])) { + if (!(role() == _roles[12])) { spec_tip = tips_list[1]; } else { spec_tip = tips_list[2]; @@ -77,6 +78,7 @@ function specialistfunct (specialist, req_exp) { // specialist - Integer index (0: Techmarine, 1: Librarian, 2: Chaplain, 3: Apothecary) // Returns: Array containing company and position of selected marine, or "none" if no suitable marine found function spec_data_set(specialist) { + var _roles = active_roles(); var _data = spec_train_data[specialist]; var _search = { "stat": _data.req, @@ -89,10 +91,10 @@ function spec_data_set(specialist) { var random_marine=scr_random_marine( // TODO LOW SEARCH_OPTIONAL // Make this function handle optional search_params [ - obj_ini.role[100][8], - obj_ini.role[100][18], - obj_ini.role[100][10], - obj_ini.role[100][9] + _roles[8], + _roles[18], + _roles[10], + _roles[9] ], _data.min_exp, _search @@ -102,13 +104,14 @@ function spec_data_set(specialist) { function apothecary_training(){ + var _roles = active_roles(); // ** Training ** // * Apothecary * var recruit_count=0; var training_points_values = ARR_apothecary_training_tiers; apothecary_recruit_points += training_points_values[training_apothecary] - novice_type = string("{0} Aspirant",obj_ini.role[100][15]) + novice_type = string("{0} Aspirant",_roles[15]) if (training_apothecary>0){ recruit_count=scr_role_count(novice_type,""); @@ -123,7 +126,7 @@ function apothecary_training(){ apothecary_recruit_points-=48; unit = fetch_unit(random_marine); scr_alert("green","recruitment",unit.name_role()+" has finished training.",0,0); - unit.update_role(obj_ini.role[100][15]); + unit.update_role(_roles[15]); unit.role_tag = [0, 0, 0, 0]; unit.add_exp(10); @@ -171,7 +174,7 @@ function apothecary_training(){ } } else { training_apothecary = 0; - scr_alert("red","recruitment",$"No marines available for {obj_ini.role[100][eROLE.Apothecary]} traning",0,0); + scr_alert("red","recruitment",$"No marines available for {_roles[eROLE.Apothecary]} traning",0,0); } } } @@ -179,13 +182,14 @@ function apothecary_training(){ function chaplain_training(){ + var _roles = active_roles(); // * Chaplain training * // TODO add functionality for Space Wolves and Iron Hands var recruit_count=0; var training_points_values = ARR_chaplain_training_tiers; if (global.chapter_name!="Space Wolves") and (global.chapter_name!="Iron Hands"){ chaplain_points += training_points_values[training_chaplain]; - novice_type = string("{0} Aspirant",obj_ini.role[100][14]); + novice_type = string("{0} Aspirant",_roles[14]); if (training_chaplain>0){ recruit_count=scr_role_count(novice_type,""); @@ -197,7 +201,7 @@ function chaplain_training(){ unit = fetch_unit(random_marine); scr_alert("green","recruitment",unit.name_role()+" has finished training.",0,0); chaplain_points-=48; - unit.update_role(obj_ini.role[100][14]); + unit.update_role(_roles[14]); unit.role_tag = [0, 0, 0, 0]; unit.add_exp(10); chaplain_aspirant=0; @@ -242,7 +246,7 @@ function chaplain_training(){ } } else { training_chaplain = 0; - scr_alert("red","recruitment",$"No remaining {obj_ini.role[100][eROLE.Chaplain]} applicant marines for training",0,0); + scr_alert("red","recruitment",$"No remaining {_roles[eROLE.Chaplain]} applicant marines for training",0,0); } } } @@ -251,6 +255,7 @@ function chaplain_training(){ function librarian_training(){ + var _roles = active_roles(); var recruit_count=0; // * Psycher Training * var training_points_values = ARR_chaplain_training_tiers; @@ -309,11 +314,12 @@ function librarian_training(){ } function techmarine_training(){ + var _roles = active_roles(); var recruit_count=0; var training_points_values = [ 0, 1,2,4,6,10,14]; tech_points += training_points_values[training_techmarine]; - novice_type = string("{0} Aspirant",obj_ini.role[100][16]); + novice_type = string("{0} Aspirant",_roles[16]); if (training_techmarine>0){ recruit_count=scr_role_count(novice_type,""); @@ -330,7 +336,7 @@ function techmarine_training(){ unit = fetch_unit(random_marine) tech_points-=360; - unit.update_role(obj_ini.role[100][16]); + unit.update_role(_roles[16]); unit.role_tag = [0, 0, 0, 0]; unit.add_exp(30); @@ -418,7 +424,7 @@ function techmarine_training(){ } } else{ training_techmarine = 0; - scr_alert("red","recruitment",$"No marines with sufficient technology aptitude for {obj_ini.role[100][eROLE.Techmarine]} training",0,0); + scr_alert("red","recruitment",$"No marines with sufficient technology aptitude for {_roles[eROLE.Techmarine]} training",0,0); } } } From 2f8b5179230e692427fdf1a3956242a92d7ac0f7 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 21 Dec 2025 02:32:52 +0000 Subject: [PATCH 27/93] compile and event tweaking --- .../scr_UnitGroup_and_group_selection.gml | 7 +- .../scr_chapter_managent_events.gml | 179 +++++++++++++++++- scripts/scr_event_code/scr_event_code.gml | 103 +--------- scripts/scr_random_event/scr_random_event.gml | 135 ++++--------- 4 files changed, 226 insertions(+), 198 deletions(-) diff --git a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml index f9feafcad1..9276fc9794 100644 --- a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml +++ b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml @@ -67,7 +67,7 @@ function SearchConditions(data) constructor{ move_data_to_current_scope(data); group_is_complex = is_array(group); if (group_is_complex){ - if (array_length(_group) == 3){ + if (array_length(group) == 3){ group_search_heads = true; } else { group_search_heads = false; @@ -174,7 +174,7 @@ function SearchConditions(data) constructor{ if (_add){ if (struct_exists(self,"job")){ _add = oposite_switch((unit.assignment() == job)); - }); + } } if (_add){ @@ -185,7 +185,7 @@ function SearchConditions(data) constructor{ if (max_wanted > 0 && _add){ found++; - if (found>max_wanted){ + if (found > max_wanted){ _add = false; end_loop = true; } @@ -231,7 +231,6 @@ function UnitGroup(units) constructor{ return true; } } - return false; } diff --git a/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml b/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml index 48ca6fb654..d3a03fdf7e 100644 --- a/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml +++ b/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml @@ -285,4 +285,181 @@ function new_forge_master_chosen(pick){ scr_move_unit_info(pick.company, 0, pick.marine_number, i); } } -} \ No newline at end of file +} + + + +function strange_build_event(){ + log_message("RE: Fey Mood"); + var _search_params = {trait : ["crafter","tinkerer"], trait_any : true} + var marine_and_company = scr_random_marine("",0, _search_params); + if (marine_and_company == "none"){ + marine_and_company = scr_random_marine("",0, "none"); + } + if(marine_and_company != "none"){ + var marine = marine_and_company[0]; + var company = marine_and_company[1]; + var text=""; + var _unit = fetch_unit(marine_and_company); + var role = _unit.role(); + text = _unit.name_role(); + text+=" is taken by a strange mood and starts building!"; + + + var crafted_object; + var craft_roll=roll_dice_chapter(1, 100, "low"); + var heritical_item = false; + + //this bit should be improved, idk what duke was checking for here + //TODO make craft chance reflective of crafters skill, rewards players for having skilled tech area + if (scr_has_disadv("Tech-Heresy")) { + craft_roll+=20; + } + if (_unit.has_trait("tech_heretic")){ + craft_roll+=60; + } + if (scr_has_adv("Crafter")) { + if (craft_roll>80) { + craft_roll-=10; + } + if (craft_roll<60) { + craft_roll+=10; + } + } + + if (craft_roll<=50){ + crafted_object=choose("Icon","Icon","Statue"); + } + else if ((craft_roll>50) && (craft_roll<=60)) { + crafted_object=choose("Bike","Rhino"); + } + else if ((craft_roll>60) && (craft_roll<=80)) { + crafted_object="Artifact"; + } + else { + crafted_object=choose("baby","robot","demon","fusion"); + heritical_item=1; + } + + + add_event({ + e_id : "strange_building", + duration : 1, + name : _unit.name(), + company : company, + marine : marine, + crafted : crafted_object, + }) + + scr_popup("Can He Build marine?!?",text,"tech_build",""); + + var marine_is_planetside = _unit.planet_location>0; + if (marine_is_planetside && heritical_item) { + var _system = star_by_name(_unit.location_string); + var _planet = _unit.planet_location; + if (_system!="none"){ + with (_system){ + p_hurssy[_planet]+=6; + p_hurssy_time[_planet]=2; + } + } + } + else if (!marine_is_planetside and heritical_item){ + var _fleet = find_ships_fleet(_unit.ship_location); + if (_fleet!="none"){ + //the intended code for here was to add some sort of chaos event on the ship stashed up ready to fire in a few turns + } + } + return true; + } + return false; +} + +function init_mutated_gene_random_event(){ + //TODO make reprocussions to ignoring this + log_message("RE: Gene-Seed Mutation"); + var text = "The Chapter's gene-seed has mutated! Apothecaries are scrambling to control the damage and prevent further contamination. What is thy will?"; + var _opt1 = "Dispose of "; + var _percent_remove = 0; + if (obj_controller.gene_seed <= 30) { + _opt1 += "100% of the gene-seed."; + _percent_remove = 100; + } + if ((obj_controller.gene_seed > 30) && (obj_controller.gene_seed < 60)) { + _opt1 += "50% of all gene-seed."; + _percent_remove = 50; + } + if (obj_controller.gene_seed >= 60) { + _opt1 += "33% of all gene-seed."; + _percent_remove = 33; + } + + var _opt2 = "Tell the apothecaries to let it be."; + + + var _pop_data = { + percent_remove : _percent_remove, + options : [ + { + str1:_opt1, + choice_func : event_dispose_of_mutated_gene, + }, + { + str1:_opt2, + choice_func : function(){ + scr_loyalty("Mutant Gene-Seed", "+"); + popup_default_close(); + } + }, + ] + } + + scr_popup("Gene-Seed Mutated!",text,"gene_bad",_pop_data); + scr_event_log("red","The Chapter Gene-Seed has mutated."); + + return true; +} + + +function event_dispose_of_mutated_gene(){ + if (pop_data.percent_remove > 0){ + obj_controller.gene_seed -= (obj_controller.gene_seed * (pop_data.percent_remove/100)) + } + popup_default_close(); +} + + +function init_marine_distinguishment_event(){ + log_message("RE: Promotion"); + var marine_and_company = scr_random_marine([obj_ini.role[100][8],obj_ini.role[100][12],obj_ini.role[100][9],obj_ini.role[100][10]],0); + if(marine_and_company == "none") + { + log_error("RE: Promotion, couldn't pick a space marine"); + return false; + } + var marine=marine_and_company[1]; + var company=marine_and_company[0]; + var _unit = fetch_unit(marine_and_company); + var role=_unit.role(); + var text = _unit.name_role(); + var company_text = scr_convert_company_to_string(company); + //var company_text = scr_company_string(company); + if(company_text != ""){ + company_text = $"({company_text})"; + } + text += company_text; + text += " has distinguished himself.\n\nHe is up for review to be promoted."; + + if (company != 10){ + _unit.add_exp(10); + } + else { + _unit.add_exp(max(20, _unit.experience)); + } + + scr_popup("Promotions!",text,"distinguished",""); + scr_event_log("green",text); + return true; +} + + diff --git a/scripts/scr_event_code/scr_event_code.gml b/scripts/scr_event_code/scr_event_code.gml index 35bf476edc..e71fd4f1f7 100644 --- a/scripts/scr_event_code/scr_event_code.gml +++ b/scripts/scr_event_code/scr_event_code.gml @@ -92,7 +92,7 @@ function event_end_turn_action(){ // Starts chaos invasion if (_event.e_id=="chaos_invasion"){ var xx=0,yy=0,flee=0,dirr=0; - var star_id = scr_random_find(1,true,"",""); + var star_id = scr_random_find(0,true,"",""); if(star_id != undefined){ scr_event_log("purple",$"Chaos Fleets exit the warp near the {star_id.name} system.", star_id.name); for(var j=0; j<4; j++){ @@ -103,9 +103,9 @@ function event_end_turn_action(){ flee.owner=eFACTION.Chaos; flee.sprite_index=spr_fleet_chaos; flee.image_index=4; - flee.capital_number=choose(0,1); - flee.frigate_number=choose(2,3); - flee.escort_number=choose(4,5,6); + flee.capital_number=choose(0,0,0,1); + flee.frigate_number=choose(2,2,,3); + flee.escort_number=choose(4,4,4,5,6); flee.cargo_data.csm = true; obj_controller.chaos_fleets+=1; flee.action_x=star_id.x; @@ -301,91 +301,6 @@ function handle_discovered_governor_assasinations(){ } } -function strange_build_event(){ - log_message("RE: Fey Mood"); - var _search_params = {trait : ["crafter","tinkerer"], trait_any : true} - var marine_and_company = scr_random_marine("",0, _search_params); - if (marine_and_company == "none"){ - marine_and_company = scr_random_marine("",0, "none"); - } - if(marine_and_company != "none"){ - var marine = marine_and_company[0]; - var company = marine_and_company[1]; - var text=""; - var _unit = fetch_unit(marine_and_company); - var role = _unit.role(); - text = _unit.name_role(); - text+=" is taken by a strange mood and starts building!"; - - - var crafted_object; - var craft_roll=roll_dice_chapter(1, 100, "low"); - var heritical_item = false; - - //this bit should be improved, idk what duke was checking for here - //TODO make craft chance reflective of crafters skill, rewards players for having skilled tech area - if (scr_has_disadv("Tech-Heresy")) { - craft_roll+=20; - } - if (_unit.has_trait("tech_heretic")){ - craft_roll+=60; - } - if (scr_has_adv("Crafter")) { - if (craft_roll>80) { - craft_roll-=10; - } - if (craft_roll<60) { - craft_roll+=10; - } - } - - if (craft_roll<=50){ - crafted_object=choose("Icon","Icon","Statue"); - } - else if ((craft_roll>50) && (craft_roll<=60)) { - crafted_object=choose("Bike","Rhino"); - } - else if ((craft_roll>60) && (craft_roll<=80)) { - crafted_object="Artifact"; - } - else { - crafted_object=choose("baby","robot","demon","fusion"); - heritical_item=1; - } - - - add_event({ - e_id : "strange_building", - duration : 1, - name : _unit.name(), - company : company, - marine : marine, - crafted : crafted_object, - }) - - scr_popup("Can He Build marine?!?",text,"tech_build",""); - - var marine_is_planetside = _unit.planet_location>0; - if (marine_is_planetside && heritical_item) { - var _system = star_by_name(_unit.location_string); - var _planet = _unit.planet_location; - if (_system!="none"){ - with (_system){ - p_hurssy[_planet]+=6; - p_hurssy_time[_planet]=2; - } - } - } - else if (!marine_is_planetside and heritical_item){ - var _fleet = find_ships_fleet(_unit.ship_location); - if (_fleet!="none"){ - //the intended code for here was to add some sort of chaos event on the ship stashed up ready to fire in a few turns - } - } - return true; - } - return false; -} function make_faction_enemy_event(){ log_message("RE: Enemy"); @@ -405,7 +320,7 @@ function make_faction_enemy_event(){ if(array_length(factions) == 0){ log_error("RE: Enemy, no faction could be chosen"); - exit; + return false; } var chosen_faction = array_random_element(factions); @@ -449,12 +364,4 @@ function make_faction_enemy_event(){ return true; } return false; -} - - -function event_dispose_of_mutated_gene(){ - if (pop_data.percent_remove > 0){ - obj_controller.gene_seed -= (obj_controller.gene_seed * (pop_data.percent_remove/100)) - } - popup_default_close(); } \ No newline at end of file diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index b02d9853b5..c46129c8a9 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -36,7 +36,9 @@ function scr_random_event(execute_now) { if(execute_now) { var random_event_roll = irandom(100); - if ((last_event+30)<=turn) then random_event_roll=1;// If 30 turns without random event then do one + if ((last_event+30)<=turn){ + random_event_roll=1;// If 30 turns without random event then do one + } if (random_event_roll>5) then exit;// Frequency of events if ((turn-15) 1500){ + luck_roll+=20; + } + else if (obj_controller.marines > 1000){ + luck_roll+=10; + } + else if (obj_controller.marines > 500){ + luck_roll+=5; + }else if (obj_controller.marines <500){ + luck_roll-=5; + } + if (luck_roll<=45) then player_luck=luck.good; if (luck_roll>45) and (luck_roll<55) then player_luck=luck.neutral; if (luck_roll>=55) then player_luck=luck.bad; @@ -82,11 +96,11 @@ function scr_random_event(execute_now) { [ EVENT.warp_storms, EVENT.enemy_forces, - EVENT.crusade, // Reportly breaks often because of lack of imperial fleets and eats player ships // TODO LOW CRUSADE_EVENT // fix + EVENT.crusade, EVENT.enemy, // Save-scumming event, Should probably base this on something else than tech-scavs EVENT.mutation, EVENT.ship_lost, // Another save-scumming event, mainly due to rarity of player ships - //EVENT.chaos_invasion, // Spawns Chaos fleets way too close to player owned worlds with no warning and usually lots of big ships, save-scum galore and encourages fleet-based chapters // TODO LOW INVASION_EVENT // Make them spawn way farther with more warning, make them have a different goal or remove this event entirely + EVENT.chaos_invasion, EVENT.necron_awaken, // Inquisitor check for this is inverted EVENT.fallen, // Event mission cannot be completed and never expires // TODO LOW FALLEN_EVENT // fix ]; @@ -122,7 +136,7 @@ function scr_random_event(execute_now) { } break; case EVENT.mechanicus_mission: - if (known[eFACTION.Mechanicus] == 0 || obj_controller.disposition[3] < 50 || obj_controller.faction_status[eFACTION.Mechanicus] == "War") { + if (known[eFACTION.Mechanicus] == 0 || obj_controller.disposition[3] < 40 || obj_controller.faction_status[eFACTION.Mechanicus] == "War") { events_share[i] -= 1; events_total -= 1; } @@ -132,10 +146,7 @@ function scr_random_event(execute_now) { } break; case EVENT.enemy: - if(scr_has_adv("Scavangers")){ - events_share[i] += 2; - events_total += 2; - } + break; case EVENT.mutation: if(gene_seed < 5){ @@ -275,36 +286,7 @@ function scr_random_event(execute_now) { } else if (chosen_event == EVENT.promotion){ - log_message("RE: Promotion"); - var marine_and_company = scr_random_marine([obj_ini.role[100][8],obj_ini.role[100][12],obj_ini.role[100][9],obj_ini.role[100][10]],0); - if(marine_and_company == "none") - { - log_error("RE: Promotion, couldn't pick a space marine"); - exit; - } - var marine=marine_and_company[1]; - var company=marine_and_company[0]; - var _unit = obj_ini.TTRPG[company][marine]; - var role=_unit.role(); - var text = _unit.name_role(); - var company_text = scr_convert_company_to_string(company); - //var company_text = scr_company_string(company); - if(company_text != ""){ - company_text = "("+company_text+")"; - } - text += company_text; - text += " has distinguished himself.##He åis up for review to be promoted."; - - if (company != 10){ - _unit.add_exp(10); - } - else { - _unit.add_exp(max(20, _unit.experience)); - } - - scr_popup("Promotions!",text,"distinguished",""); - scr_event_log("green",text); - _evented = true; + _evented = init_marine_distinguishment_event() } else if (chosen_event == EVENT.strange_building){ @@ -659,11 +641,11 @@ function scr_random_event(execute_now) { log_error("RE: Enemy Forces, couldn't find a planet in the " + star_id.name +" system for the enemy"); exit; } - var planet = eligible_planets[irandom(array_length(eligible_planets) - 1)]; + var planet = array_random_element(eligible_planets); //var enemy = choose(7,8,9,10,13); var enemy = choose(7,8,9); var text; - var max_enemies_on_planet = 5; // I don't know the actual value, i need to change it; + var max_enemies_on_planet = 6; // I don't know the actual value, i need to change it; switch(enemy) { case 7: @@ -681,22 +663,22 @@ function scr_random_event(execute_now) { star_id.p_tyranids[planet] += 5; star_id.p_tyranids[planet] = min(star_id.p_tyranids[planet], max_enemies_on_planet); break; - //case 10: this doesn't work - // text = "Heretics"; - // star_id.p_heretics[planet] = 4; - // star_id.p_heretics[planet] = min(star_id.p_heretics[planet], max_enemies_on_planet); - // break; - //case 13: - // text = "Necron"; // I don't know if its a good idea to spawn necrons from this event, leaving it in for now - // star_id.p_necron[planet] = 4; - // star_id.p_necron[planet] = min(star_id.p_necron[planet], max_enemies_on_planet); - // break; + case 10: + text = "Heretics"; + star_id.p_heretics[planet] = 4; + star_id.p_heretics[planet] = min(star_id.p_heretics[planet], max_enemies_on_planet); + break; + case 13: + text = "Necron"; // I don't know if its a good idea to spawn necrons from this event, leaving it in for now + star_id.p_necron[planet] = 4; + star_id.p_necron[planet] = min(star_id.p_necron[planet], max_enemies_on_planet); + break; default: log_error("RE: Enemy Forces, couldn't pick an enemy faction"); exit; } - scr_alert("red","enemy", $"{text} forces suddenly appear at {star_id.name} {planet}!",star_id.x,star_id.y); - scr_event_log("red",$"{text} forces suddenly appear at {star_id.name} {planet}!"); + scr_alert("red","enemy", $"A Space Hulk carrying {text} breaches Space and has crashed Into {star_id.name} {planet}!",star_id.x,star_id.y); + scr_event_log("red",$"A Space Hulk carrying {text} Space Hulk Crashes Into System {star_id.name} {planet}!"); _evented = true; } } @@ -711,47 +693,7 @@ function scr_random_event(execute_now) { } else if ((chosen_event == EVENT.mutation)) { - //TODO make reprocussions to ignoring this - log_message("RE: Gene-Seed Mutation"); - var text = "The Chapter's gene-seed has mutated! Apothecaries are scrambling to control the damage and prevent further contamination. What is thy will?"; - var _opt1 = "Dispose of "; - var _percent_remove = 0; - if (obj_controller.gene_seed <= 30) { - _opt1 += "100% of the gene-seed."; - _percent_remove = 100; - } - if ((obj_controller.gene_seed > 30) && (obj_controller.gene_seed < 60)) { - _opt1 += "50% of all gene-seed."; - _percent_remove = 50; - } - if (obj_controller.gene_seed >= 60) { - _opt1 += "33% of all gene-seed."; - _percent_remove = 33; - } - - var _opt2 = "Tell the apothecaries to let it be."; - - - var _pop_data = { - percent_remove : _percent_remove, - options : [ - { - str1:_opt1, - choice_func : event_dispose_of_mutated_gene, - }, - { - str1:_opt2, - choice_func : function(){ - scr_loyalty("Mutant Gene-Seed", "+"); - popup_default_close(); - } - }, - ] - } - - scr_popup("Gene-Seed Mutated!",text,"gene_bad",_pop_data); - _evented = true; - scr_event_log("red","The Chapter Gene-Seed has mutated."); + init_mutated_gene_random_event(); } else if (chosen_event == EVENT.ship_lost){ @@ -842,10 +784,13 @@ function event_fallen(){ log_error("RE: Hunt the Fallen, coulnd't assign a problem to the planet"); return; } + + var _planet = system_datas[planet]; + _planet.refresh_data(); - var text = "Sources indicate one of the Fallen may be upon "+string(star.name)+" "+string(scr_roman(planet))+". We have "+string(eta)+" months to send out a strike team and scour the planet. Any longer and any Fallen that might be there will have escaped."; + var text = $"Sources indicate one of the Fallen may be upon {_planet.name()} . We have {eta} months to send out a strike team and scour the planet. Any longer and any Fallen that might be there will have escaped."; scr_popup("Hunt the Fallen",text,"fallen",""); - scr_event_log("","Sources indicate one of the Fallen may be upon "+string(star.name)+" "+string(scr_roman(planet))+". We have "+string(eta)+" months to investigate."); + scr_event_log("",$"Sources indicate one of the Fallen may be upon {_planet.name()}. We have {eta} months to investigate."); var star_alert = instance_create(star.x+16,star.y-24,obj_star_event); star_alert.image_alpha=1; star_alert.image_speed=1; From 5f1c21b57a04463c5923227b79282b389cb86526 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 21 Dec 2025 03:19:19 +0000 Subject: [PATCH 28/93] governor profiles --- ChapterMaster.yyp | 1 + objects/obj_star/Create_0.gml | 5 + scripts/scr_PlanetData/scr_PlanetData.gml | 99 +++++++++++ scripts/scr_governors/scr_governors.gml | 29 ++++ scripts/scr_governors/scr_governors.yy | 13 ++ scripts/scr_purge_world/scr_purge_world.gml | 174 +++++--------------- 6 files changed, 190 insertions(+), 131 deletions(-) create mode 100644 scripts/scr_governors/scr_governors.gml create mode 100644 scripts/scr_governors/scr_governors.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index 6869cb597b..5ca74e6db3 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -830,6 +830,7 @@ {"id":{"name":"scr_get_item_names","path":"scripts/scr_get_item_names/scr_get_item_names.yy",},}, {"id":{"name":"scr_gift_items","path":"scripts/scr_gift_items/scr_gift_items.yy",},}, {"id":{"name":"scr_gov_disp","path":"scripts/scr_gov_disp/scr_gov_disp.yy",},}, + {"id":{"name":"scr_governors","path":"scripts/scr_governors/scr_governors.yy",},}, {"id":{"name":"scr_ground_ai_helpers","path":"scripts/scr_ground_ai_helpers/scr_ground_ai_helpers.yy",},}, {"id":{"name":"scr_has_adv","path":"scripts/scr_has_adv/scr_has_adv.yy",},}, {"id":{"name":"scr_has_disadv","path":"scripts/scr_has_disadv/scr_has_disadv.yy",},}, diff --git a/objects/obj_star/Create_0.gml b/objects/obj_star/Create_0.gml index 936b1e2bfa..23f59b6afe 100644 --- a/objects/obj_star/Create_0.gml +++ b/objects/obj_star/Create_0.gml @@ -69,6 +69,11 @@ p_influence = array_create_advanced(_planet_array_size, array_create(15, 0)); p_problem = array_create_advanced(_planet_array_size, array_create(8, "")); p_problem_other_data = array_create_advanced(_planet_array_size, array_create_advanced(8, {})); p_timer = array_create_advanced(_planet_array_size, array_create(8, -1)); +p_governor = []; + +for (var i=1;i<8;i++){ + array_push(p_governor, new GovernorProfile()); +} system_datas = array_create(8, 0); diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index c0f8f71ac8..dbcdc3a425 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1851,6 +1851,105 @@ function PlanetData(planet, system) constructor{ } } + static purge = scr_purge_world; + + static assasinate_governor_setup = function(){ + var aroll=roll_dice_chapter(1, 100, "high"); + var chance = 100; + // var siz_penalty=0; + var o=0; + var yep=0; + + // Disposition + aroll += floor(star.dispo[planet] / 10); + + // Advantages + if (scr_has_adv("Ambushers")){ + aroll+=10; + } + if (scr_has_adv("Lightning Warriors")){ + aroll+=5; + } + + // Size - unused + // if ((action_score > 5) && (action_score <= 10)) { siz_penalty = 5; } + // if ((action_score > 10) && (action_score <= 20)) { siz_penalty = 20; } + // if ((action_score > 20) && (action_score <= 50)) { siz_penalty = 30; } + // if ((action_score > 50) && (action_score <= 100)) { siz_penalty = 50; } + // if ((action_score > 100) && (action_score <= 200)) { siz_penalty = 75; } + // if (action_score > 200) { siz_penalty = 125; } + + var spec1=0,spec2=0,txt=""; // TODO consider making it a battle with Planetary governor's guards + txt="Your Astartes descend upon the surface of {name()} and plot the movements and schedule of the governor. "; + txt+="Once the time is right their target is ambushed " + txt+="choose("in their home","in the streets","while driving","taking a piss")+" and tranquilized. "; + + if(scr_has_disadv("Never Forgive")) then spec1=1; + if (global.chapter_name="Space Wolves" || obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { + spec1=3; + } + else if (global.chapter_name="Iron Hands" || obj_ini.progenitor == ePROGENITOR.IRON_HANDS) { + spec1=6; + } + if (obj_ini.omophagea=1){ + spec1=choose(spec1,20); + } + + if (spec1=1) then txt+="They are brought to the already-prepared facilities for Fallen, tortured to make "+string(choose("him","him","her"))+" appear a heretic, and then incinerated. "; + if (spec1=3) then txt+=string(choose("He","He","She"))+" is tossed to the Fenrisian Wolves and viciously mauled, torn apart, and eaten. The beasts leave nothing but bloody scraps. "; + if (spec1=6) then txt+=string(choose("He","He","She"))+" is stuck in with the other criminals, and scum, to be turned into a servitor. Soon nothing remains that could be likened to the former Governor. "; + if (spec1=20){ + if (action_score>1) then txt+="Things get out of hand, and the Governor is torn limb from limb and consumed. "+string(choose("His","His","Her"))+" flesh is torn off and eaten, bone pulverized, and marrow sucked free. "; + if (action_score=1) then txt+="Your battle brother chops apart the Governor and eats a sizeable portion of "+string(choose("his","his","her"))+" flesh, focusing upon the eyes, teeth, and fingers. Once full the rest is disposed of. "; + } + + if (spec1=0){ + spec2=choose(1,2,3,4,5,5,5); + if (spec2=1) then txt+="Their still-living body is disintegrated by acid. "; + if (spec2=2) then txt+="The Governor is jettisoned into the local star at the first opporunity. "; + if (spec2=3) then txt+=string(choose("He","He","She"))+" is burned as fuel for one of your vessels. "; + if (spec2=4) then txt+="A few grenades is all it takes to blow "+string(choose("his","his","her"))+" body to smithereens. "; + if (spec2=5) then txt+=string(choose("He","He","She"))+" is executed in a mundane fashion and buried. "; + } + + txt+="What is thy will?"; + + var pip=instance_create(0,0,obj_popup); + pip.title="Planetary Governor Assassinated"; + pip.text=txt; + pip.planet=planet; + pip.p_data = new PlanetData(planet,star); + var options = [ + { + str1 : "Allow the official successor to become Planetary Governor.", + choice_func : allow_governor_successor, + }, + { + str1 : "Ensure that a sympathetic successor will be the one to rule.", + choice_func : install_sympathetic_successor, + }, + { + str1 : "Remove all successors and install a loyal Chapter Serf.", + choice_func : install_chapter_surf, + }, + ] + pip.add_option(options); + pip.cooldown=20; + + // Result- this is the multiplier for the chance of discovery with the inquisition, can also be used to determine + // the new Governor disposition if they are the official successor + if (aroll < chance){// Discovered + pip.estimate=2; + } else if (aroll >= chance){// Success + pip.estimate=1; + } + // If there are enemy non-chaos forces then they may be used as a cover + // Does not work with chaos because if the governor dies, with chaos present, the new governor would possibly be investigated + if (planet_forces[eFACTION.Ork]>=4) or (planet_forces[eFACTION.Necrons]>=3) or (planet_forces[eFACTION.Tyranids]>=5){ + pip.estimate=pip.estimate*0.5; + } + } + } diff --git a/scripts/scr_governors/scr_governors.gml b/scripts/scr_governors/scr_governors.gml new file mode 100644 index 0000000000..fa2c8ea1ba --- /dev/null +++ b/scripts/scr_governors/scr_governors.gml @@ -0,0 +1,29 @@ +function GovernorProfile(){ + born = obj_controlller.turn - irandom_range(240,2400); + + static age = function(){ + born - obj_controlller.turn; + } + + gender = choose(GENDER.Female,GENDER.Male); + + name = global.name_generator.generate_imperial_name(); + + astartes_view = irandom(4);//0 hates astartes 4 likes astartes + + sector_commander_view = irandom(4); + + personal_security = irandom(4); + + constitution = 10; + strength = 10; + luck = 10; + dexterity = 10; + wisdom = irandom_range(25, 50); + piety = irandom_range(25, 60); + charisma = irandom_range(25, 60); + technology = irandom_range(10, 40); + intelligence = irandom_range(25, 50); + weapon_skill = 5; + ballistic_skill = 5; +} \ No newline at end of file diff --git a/scripts/scr_governors/scr_governors.yy b/scripts/scr_governors/scr_governors.yy new file mode 100644 index 0000000000..99d71d1e81 --- /dev/null +++ b/scripts/scr_governors/scr_governors.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"scr_governors", + "isCompatibility":false, + "isDnD":false, + "name":"scr_governors", + "parent":{ + "name":"marines_and_profiles", + "path":"folders/Scripts/marines_and_profiles.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index b81a2eae37..df567654e4 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -1,19 +1,19 @@ function scr_purge_world(star, planet, action_type, action_score) { - var pop_before,pop_after,sci1,sci2,txt1,txt2, max_kill, overkill, heres_before, heres_after, kill; + var pop_before,pop_after,sci1,influence_reduction,txt1,txt2, max_kill, overkill, heres_before, heres_after, kill; var isquest,thequest,questnum;isquest=0;thequest="";questnum=0;pop_after=0;txt1="";txt2="";overkill=0; if ((action_type==DropType.PurgeFire) or (action_type==DropType.PurgeSelective)) and (star.p_traitors[planet]=0) and (star.p_chaos[planet]=0) and (obj_controller.turn>=obj_controller.chaos_turn){ - if (planet_feature_bool(star.p_feature[planet],P_features.Warlord10) == 1) and (obj_controller.known[10]=0) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ + if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]=0) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ var pop=instance_create(0,0,obj_popup); pop.image="chaos_symbol"; pop.title="Concealed Heresy"; pop.text=$"Your astartes set out and begin to cleanse {planet_numeral_name(planet, star)} of possible heresy. The general populace appears to be devout in their faith, but a disturbing trend appears- the odd citizen cursing your forces, frothing at the mouth, and screaming out heresy most foul. One week into the cleansing a large hostile force is detected approaching and encircling your forces."; exit; } - if (planet_feature_bool(star.p_feature[planet],P_features.Warlord10) == 1) and (obj_controller.known[10]>=2) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ + if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]>=2) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ attacking=10; obj_controller.cooldown=30;combating=1;// Start battle here @@ -60,9 +60,8 @@ function scr_purge_world(star, planet, action_type, action_score) { txt1+=choose(" position themselves over the target in close orbit, and unleash", " unload"); if (ships_selected=1) then txt1+="s"; txt1+= $" annihilation upon {planet_numeral_name(planet, star)}. Even from space the explosions can be seen, {choose("tearing ground", "hammering", "battering", "thundering")} across the planet's surface."; - - if (star.p_large[planet]=0) then max_kill=action_score*15000000; - if (star.p_large[planet]=1) then max_kill=action_score*0.015;// Population if large + + max_kill = population_small_conversion(0.015) * max_kill; pop_before=star.p_population[planet]; @@ -75,26 +74,27 @@ function scr_purge_world(star, planet, action_type, action_score) { kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed pop_after=pop_before-kill; - sci1=0;sci2=0; + sci1=0; + influence_reduction=0; if (pop_before>0) then sci1=(pop_after/pop_before)*100;// Relative % of people murderized - if (sci1>0) then sci2=min((sci1*2),action_score*2);// How much hurresy to get rid of - heres_after=heres_before-sci2; + if (sci1>0) then influence_reduction=min((sci1*2),action_score*2);// How much hurresy to get rid of + heres_after=heres_before-influence_reduction; if (pop_before>0) and (pop_after=0) then heres_after=0; - if (star.p_large[planet]=0) then pop_after=round(pop_after); + if (!population_large) then pop_after=round(pop_after); if (pop_after<=0) and (pop_before>0) then heres_after=0; - var _displayed_population = star.p_large[planet] == 1 ? $"{pop_before} billion" : scr_display_number(floor(pop_before)); - var _displayed_killed = star.p_large[planet] == 1 ? $"{kill} billion" : scr_display_number(floor(kill)); + var _displayed_population = large_population ? $"{pop_before} billion" : scr_display_number(floor(pop_before)); + var _displayed_killed = large_population ? $"{kill} billion" : scr_display_number(floor(kill)); txt1 += $"##The world had {_displayed_population} Imperium subjects. {_displayed_killed} were purged over the duration of the bombardment.##Heresy has fallen down to {max(0, heres_after)}%."; if (pop_after<=0){ if (star.p_owner[planet]=2) and (obj_controller.faction_status[2]!="War"){ - if (star.p_type[planet]="Temperate" || star.p_type[planet]="Hive" || star.p_type[planet]="Desert"){ + if (planet_type="Temperate" || planet_type="Hive" || planet_type="Desert"){ var _disp_hit = -10; - if (star.p_type[planet]="Temperate") then _disp_hit = -5; - if (star.p_type[planet]="Desert") then _disp_hit = -3; + if (planet_type="Temperate") then _disp_hit = -5; + if (planet_type="Desert") then _disp_hit = -3; scr_audience(eFACTION.Imperium, "bombard_angry", _disp_hit, "", 0, 0); } @@ -102,8 +102,8 @@ function scr_purge_world(star, planet, action_type, action_score) { } if (star.p_owner[planet]=3) and (obj_controller.faction_status[3]!="War"){ - if (star.p_type[planet]="Forge") then _disp_hit =-15; - if (star.p_type[planet]="Ice") then _disp_hit =-7; + if (planet_type="Forge") then _disp_hit =-15; + if (planet_type="Ice") then _disp_hit =-7; scr_audience(eFACTION.Inquisition, "bombard_angry", _disp_hit, "", 0, 0); } @@ -133,11 +133,11 @@ function scr_purge_world(star, planet, action_type, action_score) { } }else if (isquest=0){ // TODO add more variation, with planets, features, marine equipment perhaps? txt1=choose( - $"Timing their visits right, Your forces scour {star.name} {planet} burning down whatever the local heretic communities call their homes. Their screams were quickly extinguished by fire, turning whatever it was before, into ash.", - $"Your forces scour {star.name} {planet}, burning homes and towns that reek of heresy. The screams and wails of the damned carry through the air." + $"Timing their visits right, Your forces scour {name()} burning down whatever the local heretic communities call their homes. Their screams were quickly extinguished by fire, turning whatever it was before, into ash.", + $"Your forces scour {name()}, burning homes and towns that reek of heresy. The screams and wails of the damned carry through the air." ); - if (star.p_large[planet]=0) then max_kill=action_score*12000;// Population if normal + if (!population_large) then max_kill=action_score*12000;// Population if normal if (star.p_large[planet]=1) then max_kill=action_score*0.0000012;// Population if large pop_before=star.p_population[planet]; @@ -150,17 +150,17 @@ function scr_purge_world(star, planet, action_type, action_score) { kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed - if (star.p_large[planet]=0) then pop_after=pop_before-kill; + if (!population_large) then pop_after=pop_before-kill; if (star.p_large[planet]=1) then pop_after=pop_before; - sci1=0;sci2=0; + sci1=0;influence_reduction=0; if (pop_before>0) then sci1=(pop_after/pop_before)*100;// Relative % of people murderized - if (sci1>0) then sci2=min((sci1*2),round(action_score/25));// How much hurresy to get rid of - heres_after=heres_before-sci2; + if (sci1>0) then influence_reduction=min((sci1*2),round(action_score/25));// How much hurresy to get rid of + heres_after=heres_before-influence_reduction; if (pop_before>0) and (pop_after=0) then heres_after=0; var nid_influence = star.p_influence[planet][eFACTION.Tyranids]; - if (planet_feature_bool(star.p_feature[planet], P_features.Gene_Stealer_Cult)) { + if (has_feature( P_features.Gene_Stealer_Cult)) { var cult = return_planet_features(star.p_feature[planet], P_features.Gene_Stealer_Cult)[0]; if (cult.hiding) {} } else { @@ -171,9 +171,9 @@ function scr_purge_world(star, planet, action_type, action_score) { txt1 += " There are signs of a genestealer infestation but the cultists are too unorganized to do any real damage to their influence on this world"; } } - if (star.p_large[planet]=0) then pop_after=round(pop_after); + if (!population_large) then pop_after=round(pop_after); if (pop_after<=0) and (pop_before>0) then heres_after=0; - if (star.p_large[planet]=0) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.##Heresy has fallen down to "+string(max(0,heres_after))+"%."; + if (!population_large) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.##Heresy has fallen down to "+string(max(0,heres_after))+"%."; if (star.p_large[planet]=1) then txt1+="##The planet had a population of "+string(pop_before)+" billion and "+string(scr_display_number(action_score*12000))+" were purged over the duration of the cleansing.##Heresy has fallen down to "+string(max(0,heres_after))+"%."; } } @@ -205,7 +205,7 @@ function scr_purge_world(star, planet, action_type, action_score) { $"Your marines move across {star.name} {scr_roman(planet)}, rooting out sources of corruption. Heretics are dragged from their lairs and executed in the streets." ); - if (star.p_large[planet]=0) then max_kill=action_score*30;// Population if normal + if (!population_large) then max_kill=action_score*30;// Population if normal if (star.p_large[planet]=1) then max_kill=0;// Population if large pop_before=star.p_population[planet]; @@ -215,14 +215,14 @@ function scr_purge_world(star, planet, action_type, action_score) { // Minimum kills kill=min(action_score*30,pop_before);// How many people ARE going to be killed - if (star.p_large[planet]=0) then pop_after=pop_before-kill; - sci2=round(action_score/50); - heres_after=heres_before-sci2; + if (!population_large) then pop_after=pop_before-kill; + influence_reduction=round(action_score/50); + heres_after=heres_before-influence_reduction; if (pop_before>0) and (pop_after=0) then heres_after=0; - if (star.p_large[planet]=0) then pop_after=round(pop_after); + if (!population_large) then pop_after=round(pop_after); if (pop_after<=0) and (pop_before>0) then heres_after=0; - if (star.p_large[planet]=0) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.##Heresy has fallen to "+string(max(0,heres_after))+"%."; + if (!population_large) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.##Heresy has fallen to "+string(max(0,heres_after))+"%."; if (star.p_large[planet]=1) then txt1+="##The planet had a population of "+string(pop_before)+" billion and "+string(action_score*30)+" die over the duration of the search.##Heresy has fallen to "+string(max(0,heres_after))+"%."; } } @@ -230,109 +230,21 @@ function scr_purge_world(star, planet, action_type, action_score) { if (action_type=DropType.PurgeAssassinate){ - var aroll=roll_dice_chapter(1, 100, "high"); - var chance = 100; - // var siz_penalty=0; - var o=0; - var yep=0; - - // Disposition - aroll += floor(star.dispo[planet] / 10); - - // Advantages - if(scr_has_adv("Ambushers")) then aroll+=10; - if(scr_has_adv("Lightning Warriors")) then aroll+=5; - - // Size - unused - // if ((action_score > 5) && (action_score <= 10)) { siz_penalty = 5; } - // if ((action_score > 10) && (action_score <= 20)) { siz_penalty = 20; } - // if ((action_score > 20) && (action_score <= 50)) { siz_penalty = 30; } - // if ((action_score > 50) && (action_score <= 100)) { siz_penalty = 50; } - // if ((action_score > 100) && (action_score <= 200)) { siz_penalty = 75; } - // if (action_score > 200) { siz_penalty = 125; } - - var spec1=0,spec2=0,txt=""; // TODO consider making it a battle with Planetary governor's guards - txt="Your Astartes descend upon the surface of "+string(star.name)+" "+string(scr_roman(planet))+" and plot the movements and schedule of the governor. "; - txt+="Once the time is right their target is ambushed "+choose("in their home","in the streets","while driving","taking a piss")+" and tranquilized. "; - - if(scr_has_disadv("Never Forgive")) then spec1=1; - if (global.chapter_name="Space Wolves" || obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { spec1=3; } - if (global.chapter_name="Iron Hands" || obj_ini.progenitor == ePROGENITOR.IRON_HANDS) { spec1=6; } - if (obj_ini.omophagea=1) then spec1=choose(spec1,20); - - if (spec1=1) then txt+="They are brought to the already-prepared facilities for Fallen, tortured to make "+string(choose("him","him","her"))+" appear a heretic, and then incinerated. "; - if (spec1=3) then txt+=string(choose("He","He","She"))+" is tossed to the Fenrisian Wolves and viciously mauled, torn apart, and eaten. The beasts leave nothing but bloody scraps. "; - if (spec1=6) then txt+=string(choose("He","He","She"))+" is stuck in with the other criminals, and scum, to be turned into a servitor. Soon nothing remains that could be likened to the former Governor. "; - if (spec1=20){ - if (action_score>1) then txt+="Things get out of hand, and the Governor is torn limb from limb and consumed. "+string(choose("His","His","Her"))+" flesh is torn off and eaten, bone pulverized, and marrow sucked free. "; - if (action_score=1) then txt+="Your battle brother chops apart the Governor and eats a sizeable portion of "+string(choose("his","his","her"))+" flesh, focusing upon the eyes, teeth, and fingers. Once full the rest is disposed of. "; - } - - if (spec1=0){ - spec2=choose(1,2,3,4,5,5,5); - if (spec2=1) then txt+="Their still-living body is disintegrated by acid. "; - if (spec2=2) then txt+="The Governor is jettisoned into the local star at the first opporunity. "; - if (spec2=3) then txt+=string(choose("He","He","She"))+" is burned as fuel for one of your vessels. "; - if (spec2=4) then txt+="A few grenades is all it takes to blow "+string(choose("his","his","her"))+" body to smithereens. "; - if (spec2=5) then txt+=string(choose("He","He","She"))+" is executed in a mundane fashion and buried. "; - } - - txt+="What is thy will?"; - - var pip=instance_create(0,0,obj_popup); - pip.title="Planetary Governor Assassinated"; - pip.text=txt; - pip.planet=planet; - pip.p_data = new PlanetData(planet,star); - var options = [ - { - str1 : "Allow the official successor to become Planetary Governor.", - choice_func : allow_governor_successor, - }, - { - str1 : "Ensure that a sympathetic successor will be the one to rule.", - choice_func : install_sympathetic_successor, - }, - { - str1 : "Remove all successors and install a loyal Chapter Serf.", - choice_func : install_chapter_surf, - }, - ] - pip.add_option(options); - pip.cooldown=20; - - // Result- this is the multiplier for the chance of discovery with the inquisition, can also be used to determine - // the new Governor disposition if they are the official successor - if (aroll < chance){// Discovered - pip.estimate=2; - } else if (aroll >= chance){// Success - pip.estimate=1; - } - // If there are enemy non-chaos forces then they may be used as a cover - // Does not work with chaos because if the governor dies, with chaos present, the new governor would possibly be investigated - if (star.p_orks[planet]>=4) or (star.p_necrons[planet]>=3) or (star.p_tyranids[planet]>=5){ - pip.estimate=pip.estimate*0.5; - } - } - - - - - - - + } if (action_type!=DropType.PurgeAssassinate){ if (isquest=0){// DO EET txt2=txt1; - star.p_heresy[planet]-=sci2; - star.p_influence[planet][eFACTION.Tau]-=sci2; - if (action_type Date: Sun, 21 Dec 2025 04:01:13 +0000 Subject: [PATCH 29/93] streamline purging --- objects/obj_star_select/Draw_64.gml | 8 +- scripts/scr_PlanetData/scr_PlanetData.gml | 4 + scripts/scr_purge_world/scr_purge_world.gml | 203 +++++++++++--------- 3 files changed, 119 insertions(+), 96 deletions(-) diff --git a/objects/obj_star_select/Draw_64.gml b/objects/obj_star_select/Draw_64.gml index 59447440bd..71f597d563 100644 --- a/objects/obj_star_select/Draw_64.gml +++ b/objects/obj_star_select/Draw_64.gml @@ -186,7 +186,9 @@ if (obj_controller.selecting_planet!=0){ if (p_data.player_forces>0){ if (is_enemy){ button1="Attack"; - button2="Purge"; + if (p_data.population){ + button2="Purge"; + } } } } @@ -199,7 +201,9 @@ if (obj_controller.selecting_planet!=0){ else { button1="Attack"; button2="Raid"; - button3="Purge"; + if (p_data.population){ + button2="Purge"; + } } if (torpedo>0){ diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index dbcdc3a425..45c8ba0aa7 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -100,6 +100,10 @@ function PlanetData(planet, system) constructor{ refresh_data(); + static total_corruption(){ + return secret_corruption + corruption; + } + static edit_player_forces = function(val){ system.p_player[planet]+=val; player_forces = system.p_player[planet]; diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index df567654e4..88d2e66ce4 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -1,6 +1,6 @@ function scr_purge_world(star, planet, action_type, action_score) { - var pop_before,pop_after,sci1,influence_reduction,txt1,txt2, max_kill, overkill, heres_before, heres_after, kill; + var pop_before,pop_after,population_reduction_percentage,influence_reduction,txt1,txt2, max_kill, overkill, heres_before, heres_after, kill; var isquest,thequest,questnum;isquest=0;thequest="";questnum=0;pop_after=0;txt1="";txt2="";overkill=0; @@ -13,84 +13,93 @@ function scr_purge_world(star, planet, action_type, action_score) { pop.text=$"Your astartes set out and begin to cleanse {planet_numeral_name(planet, star)} of possible heresy. The general populace appears to be devout in their faith, but a disturbing trend appears- the odd citizen cursing your forces, frothing at the mouth, and screaming out heresy most foul. One week into the cleansing a large hostile force is detected approaching and encircling your forces."; exit; } - if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]>=2) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ - - attacking=10; - obj_controller.cooldown=30;combating=1;// Start battle here - - instance_deactivate_all(true); - instance_activate_object(obj_controller); - instance_activate_object(obj_ini); - instance_activate_object(obj_drop_select); - - instance_create(0,0,obj_ncombat); - obj_ncombat.battle_object=p_target; - obj_ncombat.battle_loc=p_target.name; - obj_ncombat.battle_id=obj_controller.selecting_planet; - obj_ncombat.dropping=0; - obj_ncombat.attacking=10; - obj_ncombat.enemy=10; - obj_ncombat.formation_set=1; - - /* - obj_ncombat.battle_object=p_target; - obj_ncombat.battle_loc=p_target.name; - obj_ncombat.battle_id=obj_controller.selecting_planet; - obj_ncombat.dropping=1-attack; - obj_ncombat.attacking=attack; - obj_ncombat.enemy=attacking; - obj_ncombat.formation_set=formation_possible[formation_current]; - */ - - obj_ncombat.leader=1; - obj_ncombat.threat=5; - obj_ncombat.battle_special="WL10_later"; - scr_battle_allies(); - setup_battle_formations(); - roster.add_to_battle(); + if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]>=2) and (obj_controller.faction_gender[10]=1){ + with(obj_drop_select){ + + attacking=10; + obj_controller.cooldown=30; + combating=1;// Start battle here + + instance_deactivate_all(true); + instance_activate_object(obj_controller); + instance_activate_object(obj_ini); + instance_activate_object(obj_drop_select); + + instance_create(0,0,obj_ncombat); + obj_ncombat.battle_object=p_target; + obj_ncombat.battle_loc=p_target.name; + obj_ncombat.battle_id=obj_controller.selecting_planet; + obj_ncombat.dropping=0; + obj_ncombat.attacking=10; + obj_ncombat.enemy=10; + obj_ncombat.formation_set=1; + + obj_ncombat.leader=1; + obj_ncombat.threat=5; + obj_ncombat.battle_special="WL10_later"; + scr_battle_allies(); + setup_battle_formations(); + roster.add_to_battle(); + } } } + var heres_before = max(total_corruption(),population_influences[eFACTION.Tau],population_influences[eFACTION.Tyranids]);// Starting heresy + + var heres_target = "corruption"; + + if (max(population_influences[eFACTION.Tau],population_influences[eFACTION.Tyranids]) > total_corruption()){ + if (population_influences[eFACTION.Tau]>population_influences[eFACTION.Tyranids]){ + heres_target = "tau"; + } else{ + heres_target = "genestealers"; + } + + } + // TODO - while I don't expect Surface to Orbit weapons retaliating against player's purge bombardment, it might still be worthwhile to consider possible situations if (action_type=DropType.PurgeBombard){// Bombardment - txt1=choose("Your cruiser and larger ship", "The heavens rumble and thunder as your ship"); - if (ships_selected>1) then txt1+="s"; + var _ship = string_plural("ship",ships_selected); + txt1=choose($"Your cruiser and larger {_ship}", $"The heavens rumble and thunder as your {_ship}"); txt1+=choose(" position themselves over the target in close orbit, and unleash", " unload"); - if (ships_selected=1) then txt1+="s"; - txt1+= $" annihilation upon {planet_numeral_name(planet, star)}. Even from space the explosions can be seen, {choose("tearing ground", "hammering", "battering", "thundering")} across the planet's surface."; + var _adjective = choose("tearing ground", "hammering", "battering", "thundering"); + txt1+= $" annihilation upon {name()}. Even from space the explosions can be seen, {_adjective} across the planet's surface."; max_kill = population_small_conversion(0.015) * max_kill; - pop_before=star.p_population[planet]; - - heres_before=max(star.p_heresy[planet]+star.p_heresy_secret[planet],star.p_influence[planet][eFACTION.Tau]);// Starting heresy + pop_before=population; // Minimum kills - if (pop_before>0) then overkill=max(pop_before*0.1,((heres_before/200)*pop_before)); - if (pop_before=0) then overkill=0; + overkill=max(pop_before*0.1,((heres_before/200)*pop_before)); + kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed - pop_after=pop_before-kill; - sci1=0; + pop_after=max(pop_before-kill,0); + population_reduction_percentage=0; influence_reduction=0; - if (pop_before>0) then sci1=(pop_after/pop_before)*100;// Relative % of people murderized - if (sci1>0) then influence_reduction=min((sci1*2),action_score*2);// How much hurresy to get rid of + population_reduction_percentage=(pop_after/pop_before)*100;// Relative % of people murderized + + if (population_reduction_percentage>0){ + influence_reduction=min((population_reduction_percentage*2),action_score*2);// How much hurresy to get rid of + } heres_after=heres_before-influence_reduction; - if (pop_before>0) and (pop_after=0) then heres_after=0; + - if (!population_large) then pop_after=round(pop_after); - if (pop_after<=0) and (pop_before>0) then heres_after=0; + if (!population_large){ + pop_after=round(pop_after); + } + - var _displayed_population = large_population ? $"{pop_before} billion" : scr_display_number(floor(pop_before)); + var _displayed_population = display_population(); var _displayed_killed = large_population ? $"{kill} billion" : scr_display_number(floor(kill)); - txt1 += $"##The world had {_displayed_population} Imperium subjects. {_displayed_killed} were purged over the duration of the bombardment.##Heresy has fallen down to {max(0, heres_after)}%."; + txt1 += $"\n\nThe world had {_displayed_population} Imperium subjects. {_displayed_killed} were purged over the duration of the bombardment.\n\nHeresy has fallen down to {max(0, heres_after)}%."; if (pop_after<=0){ - if (star.p_owner[planet]=2) and (obj_controller.faction_status[2]!="War"){ + if (current_owner=2) and (obj_controller.faction_status[2]!="War"){ if (planet_type="Temperate" || planet_type="Hive" || planet_type="Desert"){ var _disp_hit = -10; if (planet_type="Temperate") then _disp_hit = -5; @@ -100,7 +109,7 @@ function scr_purge_world(star, planet, action_type, action_score) { } } } - if (star.p_owner[planet]=3) and (obj_controller.faction_status[3]!="War"){ + if (current_owner=3) and (obj_controller.faction_status[3]!="War"){ if (planet_type="Forge") then _disp_hit =-15; if (planet_type="Ice") then _disp_hit =-7; @@ -114,7 +123,7 @@ function scr_purge_world(star, planet, action_type, action_score) { if (action_type=DropType.PurgeFire){// Burn baby burn var i=0; - if (has_problem_planet(planet, "cleanse", star)){ + if (has_problem("cleanse")){ isquest=1; thequest="cleanse"; questnum=i; @@ -123,13 +132,12 @@ function scr_purge_world(star, planet, action_type, action_score) { if (isquest=1){ if (thequest="cleanse") and (action_score>=20){ remove_planet_problem(planet,thequest,star); - - if (obj_controller.demanding=0) then obj_controller.disposition[4]+=1; - if (obj_controller.demanding=1) then obj_controller.disposition[4]+=choose(0,0,1); + + alter_disposition(eFACTION.Inquisition,obj_controller.demanding ? choose(0,0,1) :1); txt1="Your marines scour the underhive of "+string(star.name)+" "+string(planet)+", spraying mutants down with promethium as they go. It takes several days but a sizeable dent is put in their numbers."; - scr_event_log("","Inquisition Mission Completed: The mutants of "+string(star.name)+" "+string(scr_roman(planet))+" have been cleansed by promethium."); - scr_gov_disp(star.name,planet,choose(1,2,3)); + scr_event_log("","Inquisition Mission Completed: The mutants of {name()} have been cleansed by promethium."); + add_disposition(choose(1,2,3)); } }else if (isquest=0){ // TODO add more variation, with planets, features, marine equipment perhaps? txt1=choose( @@ -138,31 +146,34 @@ function scr_purge_world(star, planet, action_type, action_score) { ); if (!population_large) then max_kill=action_score*12000;// Population if normal - if (star.p_large[planet]=1) then max_kill=action_score*0.0000012;// Population if large + if (large_population) then max_kill=action_score*0.0000012;// Population if large pop_before=star.p_population[planet]; - heres_before=max(star.p_heresy[planet]+star.p_heresy_secret[planet],star.p_influence[planet][eFACTION.Tau]);// Starting heresy - // Minimum kills if (pop_before>0) then overkill=min(pop_before*0.01,((heres_before/200)*pop_before)); if (pop_before=0) then overkill=0; kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed - if (!population_large) then pop_after=pop_before-kill; - if (star.p_large[planet]=1) then pop_after=pop_before; + if (!population_large) then pop_after=max(pop_before-kill,0); + if (large_population) then pop_after=pop_before; - sci1=0;influence_reduction=0; - if (pop_before>0) then sci1=(pop_after/pop_before)*100;// Relative % of people murderized - if (sci1>0) then influence_reduction=min((sci1*2),round(action_score/25));// How much hurresy to get rid of + population_reduction_percentage=0; + influence_reduction=0; + if (pop_before>0) then population_reduction_percentage=(pop_after/pop_before)*100;// Relative % of people murderized + if (population_reduction_percentage>0){ + influence_reduction=min((population_reduction_percentage*2),round(action_score/25));// How much hurresy to get rid of + } heres_after=heres_before-influence_reduction; if (pop_before>0) and (pop_after=0) then heres_after=0; - var nid_influence = star.p_influence[planet][eFACTION.Tyranids]; + var nid_influence = population_influences[eFACTION.Tyranids]; if (has_feature( P_features.Gene_Stealer_Cult)) { var cult = return_planet_features(star.p_feature[planet], P_features.Gene_Stealer_Cult)[0]; - if (cult.hiding) {} + if (cult.hiding) { + + } } else { if (nid_influence > 25) { txt1 += " Scores of mutant offspring from a genestealer infestation are burnt, while we have damaged their influence over this world, the mutants appear to lack the organisation of a true cult"; @@ -172,9 +183,12 @@ function scr_purge_world(star, planet, action_type, action_score) { } } if (!population_large) then pop_after=round(pop_after); - if (pop_after<=0) and (pop_before>0) then heres_after=0; - if (!population_large) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.##Heresy has fallen down to "+string(max(0,heres_after))+"%."; - if (star.p_large[planet]=1) then txt1+="##The planet had a population of "+string(pop_before)+" billion and "+string(scr_display_number(action_score*12000))+" were purged over the duration of the cleansing.##Heresy has fallen down to "+string(max(0,heres_after))+"%."; + + if (!population_large){ + txt1+="\n\nThe planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; + }else { + txt1+="\n\nThe planet had a population of "+string(pop_before)+" billion and "+string(scr_display_number(action_score*12000))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; + } } } @@ -191,53 +205,55 @@ function scr_purge_world(star, planet, action_type, action_score) { if (thequest="purge") and (action_score>=10){ remove_planet_problem(planet, "purge", star); - if (obj_controller.demanding=0) then obj_controller.disposition[4]+=1; - if (obj_controller.demanding=1) then obj_controller.disposition[4]+=choose(0,0,1); + alter_disposition(eFACTION.Inquisition,obj_controller.demanding ? choose(0,0,1) :1); txt1="Your marines drop fast and hard, blowing through guards and mercenaries with minimal resistance. Before ten minutes have passed all your targets are executed."; - scr_event_log("","Inquisition Mission Completed: The unruly Nobles of "+string(star.name)+" "+string(scr_roman(planet))+" have been purged."); - scr_gov_disp(star.name,planet,choose(1,2,3)); + scr_event_log("","Inquisition Mission Completed: The unruly Nobles of {name()} have been purged."); + add_disposition(choose(1,2,3)); } } else if (isquest=0){ // TODO add more variation, with planets, features, possibly marine equipment txt1=choose( $"Your marines move across {star.name} {scr_roman(planet)}, searching for high profile targets. Once found, they are dragged outside from their lairs. Their execution would soon follow.", $"Your marines move across {star.name} {scr_roman(planet)}, rooting out sources of corruption. Heretics are dragged from their lairs and executed in the streets." - ); + ); if (!population_large) then max_kill=action_score*30;// Population if normal - if (star.p_large[planet]=1) then max_kill=0;// Population if large + if (large_population) then max_kill=0;// Population if large pop_before=star.p_population[planet]; - heres_before=max(star.p_heresy[planet]+star.p_heresy_secret[planet],star.p_influence[planet][eFACTION.Tau]);// Starting heresy - // Minimum kills kill=min(action_score*30,pop_before);// How many people ARE going to be killed - if (!population_large) then pop_after=pop_before-kill; + if (!population_large) then pop_after=max(pop_before-kill,0); influence_reduction=round(action_score/50); heres_after=heres_before-influence_reduction; if (pop_before>0) and (pop_after=0) then heres_after=0; if (!population_large) then pop_after=round(pop_after); - if (pop_after<=0) and (pop_before>0) then heres_after=0; - if (!population_large) then txt1+="##The planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.##Heresy has fallen to "+string(max(0,heres_after))+"%."; - if (star.p_large[planet]=1) then txt1+="##The planet had a population of "+string(pop_before)+" billion and "+string(action_score*30)+" die over the duration of the search.##Heresy has fallen to "+string(max(0,heres_after))+"%."; + + if (!population_large) then txt1+=$"\n\nThe planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; + if (large_population) then txt1+=$"\n\nThe planet had a population of {pop_before} billion and {action_score*30} die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; } } if (action_type=DropType.PurgeAssassinate){ - + assasinate_governor_setup(); } if (action_type!=DropType.PurgeAssassinate){ if (isquest=0){// DO EET txt2=txt1; - alter_corruption(-influence_reduction) - alter_influence(eFACTION.Tau , -influence_reduction); + if (heres_target == "corruption"){ + alter_corruption(-influence_reduction); + }else if (heres_target == "tau"){ + alter_influence(eFACTION.Tau , -influence_reduction); + }else if (heres_target == "genestealers"){ + alter_influence(eFACTION.Tyranids , -influence_reduction); + } if (action_type Date: Sun, 21 Dec 2025 22:38:24 +0000 Subject: [PATCH 30/93] error with hidden cult influence --- objects/obj_star_select/Draw_64.gml | 65 +-------------------- scripts/scr_PlanetData/scr_PlanetData.gml | 70 +++++++++++++++++++++-- scripts/scr_garrison/scr_garrison.gml | 13 +++-- 3 files changed, 76 insertions(+), 72 deletions(-) diff --git a/objects/obj_star_select/Draw_64.gml b/objects/obj_star_select/Draw_64.gml index 71f597d563..b8dd549b8b 100644 --- a/objects/obj_star_select/Draw_64.gml +++ b/objects/obj_star_select/Draw_64.gml @@ -170,8 +170,8 @@ draw_set_font(fnt_40k_14b); if (obj_controller.selecting_planet!=0){ if (p_data.planet != obj_controller.selecting_planet){ - delete p_data; p_data = new PlanetData(obj_controller.selecting_planet, target); + target.system_datas[obj_controller.selecting_planet] = p_data; } // Buttons that are available if (!buttons_selected){ @@ -273,7 +273,7 @@ if (obj_controller.selecting_planet!=0){ } } }else if (garrison!="" && !population){ - if (garrison.garrison_force ){ + if (garrison.garrison_force){ draw_set_font(fnt_40k_14); if (!garrison.garrison_leader){ garrison.find_leader() @@ -312,66 +312,7 @@ if (obj_controller.selecting_planet!=0){ } else if (population){ garrison_data_slate.title = "Population Report"; garrison_data_slate.inside_method = function(){ - draw_set_color(c_gray); - var xx = garrison_data_slate.XX; - var yy = garrison_data_slate.YY; - var cur_planet = obj_controller.selecting_planet; - var half_way = garrison_data_slate.height/2; - var spacing_x = 100 - var spacing_y = 65 - draw_set_halign(fa_left); - if (!target.space_hulk) { - if (obj_controller.faction_status[eFACTION.Imperium] != "War" && p_data.current_owner <= 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War") { - colonist_button.update({ - x1:xx+35, - y1:half_way, - allow_click : array_length(potential_doners), - }); - colonist_button.draw(); - - recruiting_button.update({ - x1:xx+(spacing_x*2)+15, - y1:half_way, - allow_click : true, - }); - recruiting_button.draw(); - if (p_data.has_feature(P_features.Recruiting_World)) { - var _recruit_world = p_data.get_features(P_features.Recruiting_World)[0]; - if (_recruit_world.recruit_type == 0) && (obj_controller.faction_status[p_data.current_owner] != "War" && obj_controller.faction_status[p_data.current_owner] != "Antagonism" || p_data.player_disposition >= 50) { - draw_text(xx+(spacing_x*3)+35, half_way-20, "Open: Voluntery"); - } else if (_recruit_world.recruit_type == 0 && p_data.player_disposition <= 50) { - draw_text(xx+(spacing_x*3)+35, half_way-20, "Covert: Voluntery"); - } else { - draw_text(xx+(spacing_x*3)+35, half_way-20, "Abduct"); - } - recruitment_type_button.update({ - x1:xx+(spacing_x*3)+35, - y1:half_way, - allow_click : true, - }); - recruitment_type_button.draw(); - - draw_text(xx+(spacing_x*3)-15, half_way+(spacing_y)-20, $"Req:{_recruit_world.recruit_cost * 2}"); - if (_recruit_world.recruit_cost > 0) { - recruitment_costdown_button.update({ - x1:xx+(spacing_x*2)+35, - y1:half_way+(spacing_y), - allow_click : true, - }); - recruitment_costdown_button.draw(); - } - if (_recruit_world.recruit_cost < 5) { - recruitment_costup_button.update({ - x1:xx+(spacing_x*3)+35, - y1:half_way+(spacing_y), - allow_click : true, - }); - recruitment_costup_button.draw(); - } - } - } - } - + p_data.draw_planet_population_controls(); } garrison_data_slate.draw(344+main_data_slate.width-4, 160, 0.6, 0.6); } diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 45c8ba0aa7..2c02e93013 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1004,15 +1004,15 @@ function PlanetData(planet, system) constructor{ var bar_start_point = xx+349; var bar_percent_length = (bar_width/100); var current_bar_percent = 0; - var hidden_cult = false; + var _hidden_cult = false; if (has_feature(P_features.Gene_Stealer_Cult)){ - hidden_cult = get_features(P_features.Gene_Stealer_Cult)[0].hiding; + _hidden_cult = get_features(P_features.Gene_Stealer_Cult)[0].hiding; } for (var i=1;i<13;i++){ if (population_influences[i]>0){ draw_set_color(global.star_name_colors[i]); - if (hidden_cult){ + if (_hidden_cult && i == eFACTION.Tyranids){ draw_set_color(global.star_name_colors[eFACTION.Imperium]); } var current_start = bar_start_point+(current_bar_percent*bar_percent_length) @@ -1031,7 +1031,7 @@ function PlanetData(planet, system) constructor{ draw_text(xx+480,yy+196,$"{name()} ({planet_type})"); } else if (is_craftworld){ - draw_text(xx+480,yy+196,string(system.name)+" (Craftworld)"); + draw_text(xx+480,yy+196,$"{system.name} (Craftworld)"); } else if (is_hulk){ draw_text(xx+480,yy+196,"Space Hulk"); } @@ -1294,6 +1294,68 @@ function PlanetData(planet, system) constructor{ } } + static draw_planet_population_controls = function(){ + draw_set_color(c_gray); + var _gar_slate = obj_star_select.garrison_data_slate; + var xx = _gar_slate.XX; + var yy = _gar_slate.YY; + var _half_way = _gar_slate.height/2; + var spacing_x = 100 + var spacing_y = 65 + draw_set_halign(fa_left); + if (!target.space_hulk) { + if (obj_controller.faction_status[eFACTION.Imperium] != "War" && current_owner <= 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War") { + colonist_button.update({ + x1:xx+35, + y1:_half_way, + allow_click : array_length(potential_doners), + }); + colonist_button.draw(); + + recruiting_button.update({ + x1:xx+(spacing_x*2)+15, + y1:_half_way, + allow_click : true, + }); + recruiting_button.draw(); + if (has_feature(P_features.Recruiting_World)) { + var _recruit_world = get_features(P_features.Recruiting_World)[0]; + if (_recruit_world.recruit_type == 0) && (obj_controller.faction_status[current_owner] != "War" && obj_controller.faction_status[p_data.current_owner] != "Antagonism" || p_data.player_disposition >= 50) { + draw_text(xx+(spacing_x*3)+35, _half_way-20, "Open: Voluntery"); + } else if (_recruit_world.recruit_type == 0 && player_disposition <= 50) { + draw_text(xx+(spacing_x*3)+35, _half_way-20, "Covert: Voluntery"); + } else { + draw_text(xx+(spacing_x*3)+35, _half_way-20, "Abduct"); + } + recruitment_type_button.update({ + x1:xx+(spacing_x*3)+35, + y1:_half_way, + allow_click : true, + }); + recruitment_type_button.draw(); + + draw_text(xx+(spacing_x*3)-15, _half_way+(spacing_y)-20, $"Req:{_recruit_world.recruit_cost * 2}"); + if (_recruit_world.recruit_cost > 0) { + recruitment_costdown_button.update({ + x1:xx+(spacing_x*2)+35, + y1:_half_way+(spacing_y), + allow_click : true, + }); + recruitment_costdown_button.draw(); + } + if (_recruit_world.recruit_cost < 5) { + recruitment_costup_button.update({ + x1:xx+(spacing_x*3)+35, + y1:_half_way+(spacing_y), + allow_click : true, + }); + recruitment_costup_button.draw(); + } + } + } + } + } + static suffer_navy_bombard = function(strength){ diff --git a/scripts/scr_garrison/scr_garrison.gml b/scripts/scr_garrison/scr_garrison.gml index 36010cffda..7b18680380 100644 --- a/scripts/scr_garrison/scr_garrison.gml +++ b/scripts/scr_garrison/scr_garrison.gml @@ -147,19 +147,20 @@ function GarrisonForce(planet_operatives, turn_end=false, type="garrison") const } static garrison_report = function(){ - var system = obj_star_select.target; - var planet = obj_controller.selecting_planet; + var _system = obj_star_select.target; + var _p = obj_controller.selecting_planet; + var _planet = _system.system_datas[_p]; var report_string = "Hail My lord.##"; - report_string+=$"Report for garrison on {system.name} {scr_roman_numerals()[planet-1]} is as follows#"; + report_string+=$"Report for garrison on {_planet.name()} is as follows#"; if ((array_length(garrison_squads)) > 1){ report_string+= $"The garrison is comprised of {array_length(garrison_squads)} squads," } else {report_string+="The garrison is comprised of a single _squad,"} report_string+= $" with a total man count of {total_garrison}.#" - if (system.p_owner[planet] != eFACTION.Player && system.dispo[planet] >=-100) { - var disposition = disposition_description_chart(system.dispo[planet]); + if (_planet.current_owner!= eFACTION.Player && _planet.disposition >=-100) { + var disposition = disposition_description_chart(_planet.disposition); report_string += $"Our Relationship with the Rulers of the planet is {disposition}#"; - } else if (system.dispo[planet] < -1000) { + } else if (_planet.disposition < -1000) { if (system.p_owner[planet] == eFACTION.Player){ report_string += $"Rule of the planet is going well"; } else { From 3038c4a976af306edfc604c0f6f1a54339ff2a60 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 27 Dec 2025 02:30:29 +0000 Subject: [PATCH 31/93] keep grinding --- scripts/scr_PlanetData/scr_PlanetData.gml | 4 +- .../scr_drop_select_function.gml | 6 +- scripts/scr_governors/scr_governors.gml | 15 +- scripts/scr_purge_world/scr_purge_world.gml | 141 +++++++++++------- .../scr_unit_quick_find_pane.gml | 2 +- 5 files changed, 105 insertions(+), 63 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 2c02e93013..b5bf5d223f 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -733,7 +733,7 @@ function PlanetData(planet, system) constructor{ _starship.funds_spent+=_requisition_spend; if (_requisition_spend>0 && _starship.funds_spent<_target_spend){ - scr_alert("green","owner",$"{_requisition_spend} Requision spent on Ancient Ship repairs in materials and outfitting (outfitting {(_starship.funds_spent/_target_spend)*100}%)",system.x,system.y); + scr_alert("green","owner",$"{_requisition_spend} Requisition spent on Ancient Ship repairs in materials and outfitting (outfitting {(_starship.funds_spent/_target_spend)*100}%)",system.x,system.y); } if (_starship.funds_spent>=_target_spend && _starship.engineer_score>=2000){// u2=tar; //TODO refactor into general new ship logic @@ -1972,7 +1972,7 @@ function PlanetData(planet, system) constructor{ if (spec1=0){ spec2=choose(1,2,3,4,5,5,5); if (spec2=1) then txt+="Their still-living body is disintegrated by acid. "; - if (spec2=2) then txt+="The Governor is jettisoned into the local star at the first opporunity. "; + if (spec2=2) then txt+="The Governor is jettisoned into the local star at the first opportunity. "; if (spec2=3) then txt+=string(choose("He","He","She"))+" is burned as fuel for one of your vessels. "; if (spec2=4) then txt+="A few grenades is all it takes to blow "+string(choose("his","his","her"))+" body to smithereens. "; if (spec2=5) then txt+=string(choose("He","He","She"))+" is executed in a mundane fashion and buried. "; diff --git a/scripts/scr_drop_select_function/scr_drop_select_function.gml b/scripts/scr_drop_select_function/scr_drop_select_function.gml index 574867809f..268a2ad58a 100644 --- a/scripts/scr_drop_select_function/scr_drop_select_function.gml +++ b/scripts/scr_drop_select_function/scr_drop_select_function.gml @@ -392,7 +392,11 @@ function drop_select_draw() { _purge_score = array_length(roster.selected_units); } - scr_purge_world(p_target, planet_number, purge, _purge_score); + var _p_data = p_target.system_data[planet_number]; + + _p_data.refresh_data(); + + _p_data.purge(); } } } diff --git a/scripts/scr_governors/scr_governors.gml b/scripts/scr_governors/scr_governors.gml index fa2c8ea1ba..d705fa05ff 100644 --- a/scripts/scr_governors/scr_governors.gml +++ b/scripts/scr_governors/scr_governors.gml @@ -1,11 +1,20 @@ function GovernorProfile(){ - born = obj_controlller.turn - irandom_range(240,2400); + born = obj_controlller.turn - irandom_range(240,4800); + + uid = scr_uuid_generate(); static age = function(){ - born - obj_controlller.turn; + var _age = born - obj_controlller.turn; + if (_age < 0){ + _age = (born * -1) + obj_controlller.turn; + } + + _age/=12; + + return age; } - gender = choose(GENDER.Female,GENDER.Male); + gender = set_gender(); name = global.name_generator.generate_imperial_name(); diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index 88d2e66ce4..c624797d0d 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -1,19 +1,22 @@ -function scr_purge_world(star, planet, action_type, action_score) { +function scr_purge_world(action_type, action_score) { - var pop_before,pop_after,population_reduction_percentage,influence_reduction,txt1,txt2, max_kill, overkill, heres_before, heres_after, kill; - var isquest,thequest,questnum;isquest=0;thequest="";questnum=0;pop_after=0;txt1="";txt2="";overkill=0; + var population_reduction_percentage,influence_reduction, max_kill, heres_before, heres_after, kill; + var isquest=0,thequest="",questnum=0,pop_after=0,txt1="",txt2="",overkill=0; - - if ((action_type==DropType.PurgeFire) or (action_type==DropType.PurgeSelective)) and (star.p_traitors[planet]=0) and (star.p_chaos[planet]=0) and (obj_controller.turn>=obj_controller.chaos_turn){ - if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]=0) and (obj_controller.faction_gender[10]=1) then with(obj_drop_select){ - var pop=instance_create(0,0,obj_popup); - pop.image="chaos_symbol"; - pop.title="Concealed Heresy"; - pop.text=$"Your astartes set out and begin to cleanse {planet_numeral_name(planet, star)} of possible heresy. The general populace appears to be devout in their faith, but a disturbing trend appears- the odd citizen cursing your forces, frothing at the mouth, and screaming out heresy most foul. One week into the cleansing a large hostile force is detected approaching and encircling your forces."; - exit; - } - if (has_feature(P_features.Warlord10) == 1) and (obj_controller.known[10]>=2) and (obj_controller.faction_gender[10]=1){ + var _pop_before = population; + var _no_chaos = (planet_forces[eFACTION.Heretics] + planet_forces[eFACTION.Chaos])==0 + if ((action_type==DropType.PurgeFire || action_type==DropType.PurgeSelective) && _no_chaos && obj_controller.turn>=obj_controller.chaos_turn){ + if (has_feature(P_features.Warlord10) && obj_controller.known[10]=0 && obj_controller.faction_gender[10]=1){ + with(obj_drop_select){ + var pop=instance_create(0,0,obj_popup); + pop.image="chaos_symbol"; + pop.title="Concealed Heresy"; + pop.text=$"Your astartes set out and begin to cleanse {planet_numeral_name(planet, star)} of possible heresy. The general populace appears to be devout in their faith, but a disturbing trend appears- the odd citizen cursing your forces, frothing at the mouth, and screaming out heresy most foul. One week into the cleansing a large hostile force is detected approaching and encircling your forces."; + exit; + } + } + if (has_feature(P_features.Warlord10) && obj_controller.known[10]>=2 && obj_controller.faction_gender[10]=1){ with(obj_drop_select){ attacking=10; @@ -69,19 +72,17 @@ function scr_purge_world(star, planet, action_type, action_score) { max_kill = population_small_conversion(0.015) * max_kill; - pop_before=population; - // Minimum kills - overkill=max(pop_before*0.1,((heres_before/200)*pop_before)); + overkill=max(_pop_before*0.1,((heres_before/200)*_pop_before)); - kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed + kill=min(max_kill,overkill,_pop_before);// How many people ARE going to be killed - pop_after=max(pop_before-kill,0); + pop_after=max(_pop_before-kill,0); population_reduction_percentage=0; influence_reduction=0; - population_reduction_percentage=(pop_after/pop_before)*100;// Relative % of people murderized + population_reduction_percentage=(pop_after/_pop_before)*100;// Relative % of people murderized if (population_reduction_percentage>0){ influence_reduction=min((population_reduction_percentage*2),action_score*2);// How much hurresy to get rid of @@ -99,20 +100,28 @@ function scr_purge_world(star, planet, action_type, action_score) { txt1 += $"\n\nThe world had {_displayed_population} Imperium subjects. {_displayed_killed} were purged over the duration of the bombardment.\n\nHeresy has fallen down to {max(0, heres_after)}%."; if (pop_after<=0){ - if (current_owner=2) and (obj_controller.faction_status[2]!="War"){ + if (current_owner=2 && obj_controller.faction_status[2]!="War"){ if (planet_type="Temperate" || planet_type="Hive" || planet_type="Desert"){ var _disp_hit = -10; - if (planet_type="Temperate") then _disp_hit = -5; - if (planet_type="Desert") then _disp_hit = -3; + if (planet_type="Temperate"){ + _disp_hit = -5; + } + if (planet_type="Desert"){ + _disp_hit = -3; + } scr_audience(eFACTION.Imperium, "bombard_angry", _disp_hit, "", 0, 0); } } } - if (current_owner=3) and (obj_controller.faction_status[3]!="War"){ + if (current_owner=3 && obj_controller.faction_status[3]!="War"){ - if (planet_type="Forge") then _disp_hit =-15; - if (planet_type="Ice") then _disp_hit =-7; + if (planet_type="Forge"){ + _disp_hit =-15; + } + if (planet_type="Ice"){ + _disp_hit =-7; + } scr_audience(eFACTION.Inquisition, "bombard_angry", _disp_hit, "", 0, 0); } @@ -130,12 +139,12 @@ function scr_purge_world(star, planet, action_type, action_score) { } if (isquest=1){ - if (thequest="cleanse") and (action_score>=20){ + if (thequest="cleanse" && action_score>=20){ remove_planet_problem(planet,thequest,star); alter_disposition(eFACTION.Inquisition,obj_controller.demanding ? choose(0,0,1) :1); - txt1="Your marines scour the underhive of "+string(star.name)+" "+string(planet)+", spraying mutants down with promethium as they go. It takes several days but a sizeable dent is put in their numbers."; + txt1="Your marines scour the underhive of {name()}, spraying mutants down with promethium as they go. It takes several days but a sizeable dent is put in their numbers."; scr_event_log("","Inquisition Mission Completed: The mutants of {name()} have been cleansed by promethium."); add_disposition(choose(1,2,3)); } @@ -143,34 +152,38 @@ function scr_purge_world(star, planet, action_type, action_score) { txt1=choose( $"Timing their visits right, Your forces scour {name()} burning down whatever the local heretic communities call their homes. Their screams were quickly extinguished by fire, turning whatever it was before, into ash.", $"Your forces scour {name()}, burning homes and towns that reek of heresy. The screams and wails of the damned carry through the air." - ); - - if (!population_large) then max_kill=action_score*12000;// Population if normal - if (large_population) then max_kill=action_score*0.0000012;// Population if large - - pop_before=star.p_population[planet]; + ); + + max_kill = population_large_conversion(12000) *action_score; // Minimum kills - if (pop_before>0) then overkill=min(pop_before*0.01,((heres_before/200)*pop_before)); - if (pop_before=0) then overkill=0; + overkill=min(_pop_before*0.01,((heres_before/200)*_pop_before)); - kill=min(max_kill,overkill,pop_before);// How many people ARE going to be killed + kill=min(max_kill,overkill,_pop_before);// How many people ARE going to be killed - if (!population_large) then pop_after=max(pop_before-kill,0); - if (large_population) then pop_after=pop_before; + if (!population_large){ + pop_after=max(_pop_before-kill,0); + } + if (large_population){ + pop_after=_pop_before; + } population_reduction_percentage=0; influence_reduction=0; - if (pop_before>0) then population_reduction_percentage=(pop_after/pop_before)*100;// Relative % of people murderized + if (_pop_before>0) { + population_reduction_percentage=(pop_after/_pop_before)*100;// Relative % of people murderized + } if (population_reduction_percentage>0){ influence_reduction=min((population_reduction_percentage*2),round(action_score/25));// How much hurresy to get rid of } heres_after=heres_before-influence_reduction; - if (pop_before>0) and (pop_after=0) then heres_after=0; + if (_pop_before>0 && pop_after=0) { + heres_after=0; + } var nid_influence = population_influences[eFACTION.Tyranids]; if (has_feature( P_features.Gene_Stealer_Cult)) { - var cult = return_planet_features(star.p_feature[planet], P_features.Gene_Stealer_Cult)[0]; + var cult = get_features(P_features.Gene_Stealer_Cult)[0]; if (cult.hiding) { } @@ -182,12 +195,14 @@ function scr_purge_world(star, planet, action_type, action_score) { txt1 += " There are signs of a genestealer infestation but the cultists are too unorganized to do any real damage to their influence on this world"; } } - if (!population_large) then pop_after=round(pop_after); + if (!population_large){ + pop_after=round(pop_after); + } if (!population_large){ - txt1+="\n\nThe planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; + txt1+="\n\nThe planet had a population of "+string(scr_display_number(floor(_pop_before)))+" and "+string(scr_display_number(floor(kill)))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; }else { - txt1+="\n\nThe planet had a population of "+string(pop_before)+" billion and "+string(scr_display_number(action_score*12000))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; + txt1+="\n\nThe planet had a population of "+string(_pop_before)+" billion and "+string(scr_display_number(action_score*12000))+" were purged over the duration of the cleansing.\n\nHeresy has fallen down to "+string(max(0,heres_after))+"%."; } } } @@ -202,7 +217,7 @@ function scr_purge_world(star, planet, action_type, action_score) { } if (isquest=1){ - if (thequest="purge") and (action_score>=10){ + if (thequest="purge" && action_score>=10){ remove_planet_problem(planet, "purge", star); alter_disposition(eFACTION.Inquisition,obj_controller.demanding ? choose(0,0,1) :1); @@ -218,23 +233,37 @@ function scr_purge_world(star, planet, action_type, action_score) { $"Your marines move across {star.name} {scr_roman(planet)}, rooting out sources of corruption. Heretics are dragged from their lairs and executed in the streets." ); - if (!population_large) then max_kill=action_score*30;// Population if normal - if (large_population) then max_kill=0;// Population if large + if (!population_large) { + max_kill=action_score*30;// Population if normal + } + if (large_population) { + max_kill=0;// Population if large + } - pop_before=star.p_population[planet]; + _pop_before=population; // Minimum kills - kill=min(action_score*30,pop_before);// How many people ARE going to be killed + kill=min(action_score*30,_pop_before);// How many people ARE going to be killed - if (!population_large) then pop_after=max(pop_before-kill,0); + if (!population_large) { + pop_after=max(_pop_before-kill,0); + } influence_reduction=round(action_score/50); heres_after=heres_before-influence_reduction; - if (pop_before>0) and (pop_after=0) then heres_after=0; + if (_pop_before>0 && pop_after=0) { + heres_after=0; + } - if (!population_large) then pop_after=round(pop_after); + if (!population_large) { + pop_after=round(pop_after); + } - if (!population_large) then txt1+=$"\n\nThe planet had a population of "+string(scr_display_number(floor(pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; - if (large_population) then txt1+=$"\n\nThe planet had a population of {pop_before} billion and {action_score*30} die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; + if (!population_large) { + txt1+=$"\n\nThe planet had a population of "+string(scr_display_number(floor(_pop_before)))+" and "+string(scr_display_number(floor(kill)))+" die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; + } + if (large_population) { + txt1+=$"\n\nThe planet had a population of {_pop_before} billion and {action_score*30} die over the duration of the search.\n\nHeresy has fallen to "+string(max(0,heres_after))+"%."; + } } } @@ -258,7 +287,7 @@ function scr_purge_world(star, planet, action_type, action_score) { if (action_type Date: Tue, 21 Apr 2026 15:17:37 +0100 Subject: [PATCH 32/93] post merger error cleannup --- objects/obj_star_select/Draw_64.gml | 6 +- scripts/scr_PlanetData/scr_PlanetData.gml | 42 +++++++------- scripts/scr_cheatcode/scr_cheatcode.gml | 26 ++++----- .../scr_draw_planet_features.gml | 24 ++++---- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 6 +- scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml | 14 ++--- .../scr_inquisition_mission.gml | 2 +- .../scr_mechanicus_fleet_functions.gml | 4 +- .../scr_mission_functions.gml | 2 +- .../scr_ork_fleet_functions.gml | 2 +- .../scr_planetary_feature.gml | 56 +++++++++---------- scripts/scr_purge_world/scr_purge_world.gml | 8 +-- 12 files changed, 96 insertions(+), 96 deletions(-) diff --git a/objects/obj_star_select/Draw_64.gml b/objects/obj_star_select/Draw_64.gml index e57f0b1ff7..083e707c9e 100644 --- a/objects/obj_star_select/Draw_64.gml +++ b/objects/obj_star_select/Draw_64.gml @@ -325,9 +325,9 @@ if (obj_controller.selecting_planet!=0){ var building=instance_create(x,y,obj_temp_build); building.target=target; building.planet=obj_controller.selecting_planet; - building.lair = p_data.has_upgrade(P_features.Secret_Base); - if (p_data.has_upgrade(P_features.Arsenal)) then building.arsenal=1; - if (p_data.has_upgrade(P_features.Gene_Vault)) then building.gene_vault=1; + building.lair = p_data.has_upgrade(eP_FEATURES.Secret_Base); + if (p_data.has_upgrade(eP_FEATURES.Arsenal)) then building.arsenal=1; + if (p_data.has_upgrade(eP_FEATURES.Gene_Vault)) then building.gene_vault=1; obj_controller.temp[104]=string(scr_master_loc()); obj_controller.menu=60; with(obj_star_select){ diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 7df1b6e678..2aac85ca86 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -411,7 +411,7 @@ function PlanetData(planet, system) constructor{ if (_has_warboss && !_has_stronghold){ _rando=roll_dice_chapter(1,100, "low"); if (_rando<30){ - add_feature(P_features.OrkStronghold); + add_feature(eP_FEATURES.OrkStronghold); } } @@ -667,7 +667,7 @@ function PlanetData(planet, system) constructor{ }; static search_old_battle_grounds = function(units = []){ - if (!has_feature(P_features.OldBattleGround) || !array_length(units)){ + if (!has_feature(eP_FEATURES.OldBattleGround) || !array_length(units)){ exit; } @@ -680,7 +680,7 @@ function PlanetData(planet, system) constructor{ } } var _units = UnitGroup(_marines); - var _battle = get_features(P_features.OldBattleGround)[0]; + var _battle = get_features(eP_FEATURES.OldBattleGround)[0]; var _techmarines = _units.get_from({ group : SPECIALISTS_TECHS @@ -713,9 +713,9 @@ function PlanetData(planet, system) constructor{ static recover_starship = function(techs){ try { var engineer_count = array_length(techs); - if (has_feature(P_features.Starship) && engineer_count>0){ + if (has_feature(eP_FEATURES.Starship) && engineer_count>0){ //TODO allow total tech point usage here - var _starship = get_features(P_features.Starship)[0]; + var _starship = get_features(eP_FEATURES.Starship)[0]; var _engineer_score_start = _starship.engineer_score; if (_starship.engineer_score < 2000) { @@ -737,7 +737,7 @@ function PlanetData(planet, system) constructor{ } if (_starship.funds_spent>=_target_spend && _starship.engineer_score>=2000){// u2=tar; //TODO refactor into general new ship logic - delete_feature(P_features.Starship); + delete_feature(eP_FEATURES.Starship); var locy=$"{name()}"; @@ -1051,8 +1051,8 @@ function PlanetData(planet, system) constructor{ var bar_percent_length = bar_width / 100; var current_bar_percent = 0; var _hidden_cult = false; - if (has_feature(P_features.Gene_Stealer_Cult)){ - _hidden_cult = get_features(P_features.Gene_Stealer_Cult)[0].hiding; + if (has_feature(eP_FEATURES.Gene_Stealer_Cult)){ + _hidden_cult = get_features(eP_FEATURES.Gene_Stealer_Cult)[0].hiding; } for (var i=1;i<13;i++){ @@ -1267,7 +1267,7 @@ function PlanetData(planet, system) constructor{ for (i =0; i < feat_count ;i++){ cur_feature = features[i] if (cur_feature.planet_display != 0){ - if (cur_feature.f_type == P_features.Gene_Stealer_Cult){ + if (cur_feature.f_type == eP_FEATURES.Gene_Stealer_Cult){ if (!cur_feature.hiding){ array_push(planet_displays, [cur_feature.planet_display, cur_feature]); } @@ -1384,8 +1384,8 @@ function PlanetData(planet, system) constructor{ allow_click : true, }); recruiting_button.draw(); - if (has_feature(P_features.Recruiting_World)) { - var _recruit_world = get_features(P_features.Recruiting_World)[0]; + if (has_feature(eP_FEATURES.Recruiting_World)) { + var _recruit_world = get_features(eP_FEATURES.Recruiting_World)[0]; if (_recruit_world.recruit_type == 0) && (obj_controller.faction_status[current_owner] != "War" && obj_controller.faction_status[p_data.current_owner] != "Antagonism" || p_data.player_disposition >= 50) { draw_text(xx+(spacing_x*3)+35, _half_way-20, "Open: Voluntery"); } else if (_recruit_world.recruit_type == 0 && player_disposition <= 50) { @@ -1472,15 +1472,15 @@ function PlanetData(planet, system) constructor{ if (population_influences[eFACTION.Tyranids] > 3){ var _max_influence_reduction = min(_pop_percentage_kill,population_influences[eFACTION.Tyranids]-3); alter_influence(eFACTION.Tyranids,-_max_influence_reduction); - if (has_feature(P_features.Gene_Stealer_Cult)){ + if (has_feature(eP_FEATURES.Gene_Stealer_Cult)){ if (population_influences[eFACTION.Tyranids]<20){ - delete_feature(P_features.Gene_Stealer_Cult); + delete_feature(eP_FEATURES.Gene_Stealer_Cult); } } } if (population + pdf<=0) and (current_owner=1) and (obj_controller.faction_status[eFACTION.Imperium]="War"){ - if (!has_feature(P_features.Monastery)){ + if (!has_feature(eP_FEATURES.Monastery)){ set_new_owner(eFACTION.Imperium); add_disposition(-50); } @@ -1734,8 +1734,8 @@ function PlanetData(planet, system) constructor{ static end_turn_genestealer_cults = function(){ // Genestealer cults grow in number - if (has_feature(P_features.Gene_Stealer_Cult)) { - var cult = get_features(P_features.Gene_Stealer_Cult)[0]; + if (has_feature(eP_FEATURES.Gene_Stealer_Cult)) { + var cult = get_features(eP_FEATURES.Gene_Stealer_Cult)[0]; cult.cult_age++; alter_influence(eFACTION.Tyranids, cult.cult_age / 100); var planet_garrison = garrisons; @@ -1783,7 +1783,7 @@ function PlanetData(planet, system) constructor{ } else if (population_influences[eFACTION.Tyranids] > 5) { alter_influence(eFACTION.Tyranids, -1); if ((irandom(200) + (population_influences[eFACTION.Tyranids] / 10)) > 195) { - add_feature(P_features.Gene_Stealer_Cult); + add_feature(eP_FEATURES.Gene_Stealer_Cult); } } } @@ -1827,7 +1827,7 @@ function PlanetData(planet, system) constructor{ add_disposition(-10); // 10 disposition decreases for the respective planet obj_controller.disposition[3] -= 3; // 10 disposition decrease for the toaster Fetishest since they aren't that numerous - } else if (has_feature(P_features.Sororitas_Cathedral) || (planet_type == "Shrine")) { + } else if (has_feature(eP_FEATURES.SORORITAS_CATHEDRAL) || (planet_type == "Shrine")) { add_disposition(-4); // similarly 10 disposition decrease, note those nurses are a bit pissy and // and you can't easily gain their favor because you cannot ask them to "step down" from office. obj_controller.disposition[5] -= 5; @@ -1922,7 +1922,7 @@ function PlanetData(planet, system) constructor{ if ((_rando >= 100) && (planet_forces[eFACTION.Heretics] < 5)) { edit_forces(eFACTION.Heretics,6); set_new_owner(eFACTION.Heretics) - add_feature(P_features.Daemonic_Incursion); + add_feature(eP_FEATURES.Daemonic_Incursion); set_corruption(corruption < 80 ? 80 : 95) @@ -1940,8 +1940,8 @@ function PlanetData(planet, system) constructor{ } static check_old_battles_feature = function(){ - if (has_feature(P_features.OldBattleGround)){ - var _feats = get_features(P_features.OldBattleGround); + if (has_feature(eP_FEATURES.OldBattleGround)){ + var _feats = get_features(eP_FEATURES.OldBattleGround); for (var i=0;i=3) and (p_pdf[_run]<10000) then p_pdf[_run]*=(min(0.95, 0+pdf_loss_reduction)); if (guard_score>=2) and (p_pdf[_run]<2000) then p_pdf[_run]=0; if (guard_score>=1) and (p_pdf[_run]<200) then p_pdf[_run]=0; - if (_planet_data.population_influences[eFACTION.Tyranids] > 50 && _planet_data.has_feature(P_features.Gene_Stealer_Cult)){ + if (_planet_data.population_influences[eFACTION.Tyranids] > 50 && _planet_data.has_feature(eP_FEATURES.Gene_Stealer_Cult)){ var _cur_influ = p_influence[_run][eFACTION.Tyranids]; var _influence_reduction = _cur_influ * (p_pdf[_run]/_pdf_before); adjust_influence(eFACTION.Tyranids,-min(_influence_reduction,_cur_influ-3) , _run); if (p_influence[_run][eFACTION.Tyranids] < 20){ - _planet_data.delete_feature(P_features.Gene_Stealer_Cult); + _planet_data.delete_feature(eP_FEATURES.Gene_Stealer_Cult); } } } if (p_pdf[_run]=0) and (pdf_with_player){ - if (!_planet_data.has_feature(P_features.Monastery)) and (p_player[_run]<=0){ + if (!_planet_data.has_feature(eP_FEATURES.Monastery)) and (p_player[_run]<=0){ p_owner[_run]=2; dispo[_run]=-50; } diff --git a/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml b/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml index 39a7723da8..660b47c411 100644 --- a/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml +++ b/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml @@ -553,14 +553,14 @@ function scr_enemy_ai_c() { var ship=scr_orbiting_fleet(eFACTION.Tyranids); if (ship!="none") and (p_type[i]!="Dead") and (array_length(p_feature[i])!=0){ if (ship.capital_number>0){ - if (planet_feature_bool(p_feature[i], P_features.Reclamation_pools) ==1){ + if (planet_feature_bool(p_feature[i], eP_FEATURES.Reclamation_pools) ==1){ p_tyranids[i]=0; if (p_type[i]="Death") or (p_type[i]="Hive") then ship.capital_number+=choose(0,1,1); ship.capital_number+=1; ship.escort_number+=3; ship.image_index=round(standard_fleet_strength_calc()); p_type[i]="Dead"; - delete_features(p_feature[i], P_features.Reclamation_pools);// show_message("D"); + delete_features(p_feature[i], eP_FEATURES.Reclamation_pools);// show_message("D"); if (planets=1) and (p_type[1]="Dead") then image_alpha=0.33; if (planets=2) and (p_type[1]="Dead") and (p_type[2]="Dead") then image_alpha=0.33; if (planets=3) and (p_type[1]="Dead") and (p_type[2]="Dead") and (p_type[3]="Dead") then image_alpha=0.33; @@ -570,16 +570,16 @@ function scr_enemy_ai_c() { // if image_alpha = 0.33 then send the ship somewhere new } - if (planet_feature_bool(p_feature[i], P_features.Capillary_Towers)==1) and (p_type[i]!="Dead"){ + if (planet_feature_bool(p_feature[i], eP_FEATURES.Capillary_Towers)==1) and (p_type[i]!="Dead"){ p_population[i]=floor(p_population[i]*0.3); } - if (planet_feature_bool(p_feature[i], P_features.Capillary_Towers)==1) and (p_type[i]!="Dead"){ + if (planet_feature_bool(p_feature[i], eP_FEATURES.Capillary_Towers)==1) and (p_type[i]!="Dead"){ p_feature[i]=[]; - array_push(p_feature[i], new NewPlanetFeature(P_features.Capillary_Towers), new NewPlanetFeature(P_features.Reclamation_pools)); + array_push(p_feature[i], new NewPlanetFeature(eP_FEATURES.Capillary_Towers), new NewPlanetFeature(eP_FEATURES.Reclamation_pools)); p_population[i]=0;// show_message("C"); } - if (planet_feature_bool(p_feature[i], P_features.Capillary_Towers)==0) and (planet_feature_bool(p_feature[i], P_features.Reclamation_pools)==0) and (p_type[i]!="Dead"){ - array_push(p_feature[i], new NewPlanetFeature(P_features.Capillary_Towers));// show_message("B"); + if (planet_feature_bool(p_feature[i], eP_FEATURES.Capillary_Towers)==0) and (planet_feature_bool(p_feature[i], eP_FEATURES.Reclamation_pools)==0) and (p_type[i]!="Dead"){ + array_push(p_feature[i], new NewPlanetFeature(eP_FEATURES.Capillary_Towers));// show_message("B"); } } } diff --git a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml index e2af91b3f5..0763e70024 100644 --- a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml +++ b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml @@ -11,7 +11,7 @@ Helpers: scr_mission_eta -> given the xy of a _star where the mission is, calculate how long you should have to complete the mission Todo? maybe add a disposition influence here so that angy inquisitor gives you less spare time and vice versa - scr_star_has_planet_with_feature -> given the id of a _star and a `P_features` enum value, check if any planet on that _star has the desired feature + scr_star_has_planet_with_feature -> given the id of a _star and a `eP_FEATURES` enum value, check if any planet on that _star has the desired feature star_has_planet_with_forces -> given the id of a _star, and a faction, returns whether or not there are forces present there and in sufficient number */ diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml index 5f0dd00cc5..8c24f08bc5 100644 --- a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml @@ -29,7 +29,7 @@ function mech_fleet_explore_battle_grounds(){ return; } - var _has_battle = system_feature_bool(orbiting.p_feature,P_features.OldBattleGround); + var _has_battle = system_feature_bool(orbiting.p_feature,eP_FEATURES.OldBattleGround); if (_has_battle){ var _p_data = orbiting.system_datas[_has_battle]; _p_data.refresh_data(); @@ -37,7 +37,7 @@ function mech_fleet_explore_battle_grounds(){ return; } - var _battle_ground = _p_data.get_features(P_features.OldBattleGround)[0]; + var _battle_ground = _p_data.get_features(eP_FEATURES.OldBattleGround)[0]; if (_battle_ground.explored == 0){ var _text = $"The Mechanicus have arrived on {_p_data.name()} It will now be impossible to access the site without Mechanicus surveillance any potential rescources will now be fully put towards their aimsin service of the Ommnissiah"; diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 19635945b2..f6556111c9 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -824,7 +824,7 @@ function deliver_trophy_end_turn_check(){ _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it before you do"; var _planet = scr_get_planet_with_type(_wanted_types); - var _battle_ground = new NewPlanetFeature(P_features.OldBattleGround); + var _battle_ground = new NewPlanetFeature(eP_FEATURES.OldBattleGround); _battle_ground.player_hidden = false; diff --git a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml index 3b642b7e63..a9764af41d 100644 --- a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml +++ b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml @@ -21,7 +21,7 @@ function orks_end_turn_growth(){ var _pdata = system_datas[i]; _pdata.refresh_data(); if (!p_orks[i]){ - var _strongholds = _pdata.get_features(P_features.OrkStronghold); + var _strongholds = _pdata.get_features(eP_FEATURES.OrkStronghold); for (var s=0;s10) then p_heresy[planet_num]-=10; p_sisters[planet_num]=choose(2,2,3);goo=1; break; - case P_features.Necron_Tomb: + case eP_FEATURES.Necron_Tomb: var lop=$"Necron Tomb discovered on {numeral_n}."; scr_alert("red","feature",lop,x,y); scr_event_log("red",lop); break; - case P_features.Artifact: + case eP_FEATURES.Artifact: var lop=$"Artifact discovered on {numeral_n}."; scr_alert("green","feature",lop,x,y); scr_event_log("",lop); break; - case P_features.STC_Fragment: + case eP_FEATURES.STC_Fragment: var lop=$"STC Fragment located on {numeral_n}."; scr_alert("green","feature",lop,x,y); scr_event_log("",lop); break; - case P_features.Ancient_Ruins: + case eP_FEATURES.Ancient_Ruins: var lop=$"A {feat.ruins_size} Ancient Ruins discovered on {string(name)} {scr_roman(planet_num)}."; scr_alert("green","feature",lop,x,y); scr_event_log("",lop); break; - case P_features.Cave_Network: + case eP_FEATURES.Cave_Network: var lop=$"Extensive Cave Network discovered on {numeral_n}."; scr_alert("green","feature",lop,x,y); scr_event_log("",lop); break; - case P_features.OrkWarboss: + case eP_FEATURES.OrkWarboss: var lop=$"Ork Warboss discovered on {numeral_n}."; scr_alert("red","feature",lop,x,y); scr_event_log("red",lop); break; - case P_features.OldBattleGround: + case eP_FEATURES.OldBattleGround: var lop=$"Old Battle Ground discovered on {numeral_n}."; scr_alert("green","feature",lop,x,y); scr_event_log("red",lop); diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index 17673f2698..10c86365df 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -11,7 +11,7 @@ function scr_purge_world(action_type, action_score) { var _pop_before = population; var _no_chaos = (planet_forces[eFACTION.Heretics] + planet_forces[eFACTION.Chaos])==0 if ((action_type==DropType.PurgeFire || action_type==DropType.PurgeSelective) && _no_chaos && obj_controller.turn>=obj_controller.chaos_turn){ - if (has_feature(P_features.Warlord10) && obj_controller.known[10]=0 && obj_controller.faction_gender[10]=1){ + if (has_feature(eP_FEATURES.Warlord10) && obj_controller.known[10]=0 && obj_controller.faction_gender[10]=1){ with(obj_drop_select){ var pop=instance_create(0,0,obj_popup); pop.image="chaos_symbol"; @@ -20,7 +20,7 @@ function scr_purge_world(action_type, action_score) { exit; } } - if (has_feature(P_features.Warlord10) && obj_controller.known[10]>=2 && obj_controller.faction_gender[10]=1){ + if (has_feature(eP_FEATURES.Warlord10) && obj_controller.known[10]>=2 && obj_controller.faction_gender[10]=1){ with(obj_drop_select){ attacking=10; @@ -205,8 +205,8 @@ function scr_purge_world(action_type, action_score) { } var nid_influence = population_influences[eFACTION.Tyranids]; - if (has_feature( P_features.Gene_Stealer_Cult)) { - var cult = get_features(P_features.Gene_Stealer_Cult)[0]; + if (has_feature( eP_FEATURES.Gene_Stealer_Cult)) { + var cult = get_features(eP_FEATURES.Gene_Stealer_Cult)[0]; if (cult.hiding) { } From f6c9fd534ccc65f33f78cf2c3bc63e6f4c42f6c7 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 21 Apr 2026 18:47:54 +0100 Subject: [PATCH 33/93] grind through debugger errors --- ChapterMaster.yyp | 2 +- objects/obj_star/Draw_0.gml | 2 +- objects/obj_star_select/Draw_64.gml | 8 +- .../io.gamemaker.sdfshaders-1.0.0/prefab.json | 6 +- scripts/scr_PlanetData/scr_PlanetData.gml | 50 ++-- scripts/scr_cheatcode/scr_cheatcode.gml | 276 +----------------- .../scr_draw_planet_features.gml | 22 +- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 6 +- scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml | 14 +- scripts/scr_event_code/scr_event_code.gml | 67 +---- .../scr_mechanicus_fleet_functions.gml | 4 +- .../scr_mission_functions.gml | 2 +- .../scr_ork_fleet_functions.gml | 2 +- .../scr_planetary_feature.gml | 101 +++---- .../scr_player_fleet_functions.gml | 18 +- scripts/scr_purge_world/scr_purge_world.gml | 8 +- scripts/scr_random_event/scr_random_event.gml | 2 +- 17 files changed, 127 insertions(+), 463 deletions(-) diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index d0724d6d8c..4e00661bc5 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -594,7 +594,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.1400.3.974", + "IDEVersion":"2024.1400.5.1043", }, "name":"ChapterMaster", "resources":[ diff --git a/objects/obj_star/Draw_0.gml b/objects/obj_star/Draw_0.gml index 9ffee970fd..bc39d3a093 100644 --- a/objects/obj_star/Draw_0.gml +++ b/objects/obj_star/Draw_0.gml @@ -82,7 +82,7 @@ if (global.load == -1 && (obj_controller.zoomed || in_camera_view(star_box_shape var _panel_y = yy + 30; - if (owner != eFACTION.Player ){ + if (owner != eFACTION.PLAYER ){ var _faction_index = owner; var faction_colour = global.star_name_colors[_faction_index]; draw_sprite_general(spr_p_name_bg, 0, 0, 0, _panel_width, 32, _panel_center, _panel_y, 1, 1, 0, faction_colour, faction_colour, faction_colour, faction_colour, 1); diff --git a/objects/obj_star_select/Draw_64.gml b/objects/obj_star_select/Draw_64.gml index 083e707c9e..30d5a5f7c4 100644 --- a/objects/obj_star_select/Draw_64.gml +++ b/objects/obj_star_select/Draw_64.gml @@ -124,7 +124,7 @@ draw_sprite_ext(spr_servo_skull_head, 0,27+_screen_width/2,165, 2, 2, 0, c_white var system_string = $"{target.name} System"; -draw_set_color(target.owner == eFACTION.Player ? c_blue : 0); +draw_set_color(target.owner == eFACTION.PLAYER ? c_blue : 0); if (_standard_star){ draw_text_transformed(184,180,system_string,1,1,0); @@ -325,9 +325,9 @@ if (obj_controller.selecting_planet!=0){ var building=instance_create(x,y,obj_temp_build); building.target=target; building.planet=obj_controller.selecting_planet; - building.lair = p_data.has_upgrade(eP_FEATURES.Secret_Base); - if (p_data.has_upgrade(eP_FEATURES.Arsenal)) then building.arsenal=1; - if (p_data.has_upgrade(eP_FEATURES.Gene_Vault)) then building.gene_vault=1; + building.lair = p_data.has_upgrade(eP_FEATURES.SECRET_BASE); + if (p_data.has_upgrade(eP_FEATURES.ARSENAL)) then building.arsenal=1; + if (p_data.has_upgrade(eP_FEATURES.GENE_VAULT)) then building.gene_vault=1; obj_controller.temp[104]=string(scr_master_loc()); obj_controller.menu=60; with(obj_star_select){ diff --git a/prefabs/io.gamemaker.sdfshaders-1.0.0/prefab.json b/prefabs/io.gamemaker.sdfshaders-1.0.0/prefab.json index df08dd8bcf..0982967454 100644 --- a/prefabs/io.gamemaker.sdfshaders-1.0.0/prefab.json +++ b/prefabs/io.gamemaker.sdfshaders-1.0.0/prefab.json @@ -4,9 +4,9 @@ "Description":"Signed Distance Field (SDF) Shaders", "DisplayName":"SDF Shaders", "Exports":[ - {"$PrefabExportMetadata":"v3","AssetName":"__yy_sdf_blur_shader","Description":"SDF Shader with Blur","DisplayName":"SDF Blur Shader","FolderPath":"","ResourceType":"GMShader","ResourceVersion":0,}, - {"$PrefabExportMetadata":"v3","AssetName":"__yy_sdf_effect_shader","Description":"SDF Shader with Effects","DisplayName":"SDF Effect Shader","FolderPath":"","ResourceType":"GMShader","ResourceVersion":0,}, - {"$PrefabExportMetadata":"v3","AssetName":"__yy_sdf_shader","Description":"SDF Shader","DisplayName":"SDF Shader","FolderPath":"","ResourceType":"GMShader","ResourceVersion":0,}, + {"$PrefabExportMetadata":"v4","AssetName":"__yy_sdf_blur_shader","Description":"SDF Shader with Blur","DisplayName":"SDF Blur Shader","FolderPath":"","ResourceType":"GMShader","ResourceVersion":0,}, + {"$PrefabExportMetadata":"v4","AssetName":"__yy_sdf_effect_shader","Description":"SDF Shader with Effects","DisplayName":"SDF Effect Shader","FolderPath":"","ResourceType":"GMShader","ResourceVersion":0,}, + {"$PrefabExportMetadata":"v4","AssetName":"__yy_sdf_shader","Description":"SDF Shader","DisplayName":"SDF Shader","FolderPath":"","ResourceType":"GMShader","ResourceVersion":0,}, ], "PackageId":"io.gamemaker.sdfshaders", "Version":"1.0.0", diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 2aac85ca86..6d0c2b2cee 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -45,7 +45,7 @@ function PlanetData(planet, system) constructor{ pdf = system.p_pdf[planet]; try{ - planet_forces[eFACTION.Player] = player_forces; + planet_forces[eFACTION.PLAYER] = player_forces; planet_forces[eFACTION.Imperium] = guardsmen; @@ -89,7 +89,7 @@ function PlanetData(planet, system) constructor{ //safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere //disposition - if (system.dispo[planet] < -100 && system.dispo[planet] > -1000 && system.p_owner[planet] != eFACTION.Player ) { // Personal Rule code be doing some interesting things + if (system.dispo[planet] < -100 && system.dispo[planet] > -1000 && system.p_owner[planet] != eFACTION.PLAYER ) { // Personal Rule code be doing some interesting things system.dispo[planet] = -100; // TODO LOW DISPOSITION_REVAMP // Consider revamping the disposition system } else if (system.dispo[planet] > 100) { system.dispo[planet] = 100; @@ -102,7 +102,7 @@ function PlanetData(planet, system) constructor{ refresh_data(); - static total_corruption(){ + static total_corruption = function(){ return secret_corruption + corruption; } @@ -411,7 +411,7 @@ function PlanetData(planet, system) constructor{ if (_has_warboss && !_has_stronghold){ _rando=roll_dice_chapter(1,100, "low"); if (_rando<30){ - add_feature(eP_FEATURES.OrkStronghold); + add_feature(eP_FEATURES.ORKSTRONGHOLD); } } @@ -667,7 +667,7 @@ function PlanetData(planet, system) constructor{ }; static search_old_battle_grounds = function(units = []){ - if (!has_feature(eP_FEATURES.OldBattleGround) || !array_length(units)){ + if (!has_feature(eP_FEATURES.OLDBATTLEGROUND) || !array_length(units)){ exit; } @@ -680,7 +680,7 @@ function PlanetData(planet, system) constructor{ } } var _units = UnitGroup(_marines); - var _battle = get_features(eP_FEATURES.OldBattleGround)[0]; + var _battle = get_features(eP_FEATURES.OLDBATTLEGROUND)[0]; var _techmarines = _units.get_from({ group : SPECIALISTS_TECHS @@ -713,9 +713,9 @@ function PlanetData(planet, system) constructor{ static recover_starship = function(techs){ try { var engineer_count = array_length(techs); - if (has_feature(eP_FEATURES.Starship) && engineer_count>0){ + if (has_feature(eP_FEATURES.STARSHIP) && engineer_count>0){ //TODO allow total tech point usage here - var _starship = get_features(eP_FEATURES.Starship)[0]; + var _starship = get_features(eP_FEATURES.STARSHIP)[0]; var _engineer_score_start = _starship.engineer_score; if (_starship.engineer_score < 2000) { @@ -737,7 +737,7 @@ function PlanetData(planet, system) constructor{ } if (_starship.funds_spent>=_target_spend && _starship.engineer_score>=2000){// u2=tar; //TODO refactor into general new ship logic - delete_feature(eP_FEATURES.Starship); + delete_feature(eP_FEATURES.STARSHIP); var locy=$"{name()}"; @@ -1051,8 +1051,8 @@ function PlanetData(planet, system) constructor{ var bar_percent_length = bar_width / 100; var current_bar_percent = 0; var _hidden_cult = false; - if (has_feature(eP_FEATURES.Gene_Stealer_Cult)){ - _hidden_cult = get_features(eP_FEATURES.Gene_Stealer_Cult)[0].hiding; + if (has_feature(eP_FEATURES.GENE_STEALER_CULT)){ + _hidden_cult = get_features(eP_FEATURES.GENE_STEALER_CULT)[0].hiding; } for (var i=1;i<13;i++){ @@ -1267,7 +1267,7 @@ function PlanetData(planet, system) constructor{ for (i =0; i < feat_count ;i++){ cur_feature = features[i] if (cur_feature.planet_display != 0){ - if (cur_feature.f_type == eP_FEATURES.Gene_Stealer_Cult){ + if (cur_feature.f_type == eP_FEATURES.GENE_STEALER_CULT){ if (!cur_feature.hiding){ array_push(planet_displays, [cur_feature.planet_display, cur_feature]); } @@ -1384,8 +1384,8 @@ function PlanetData(planet, system) constructor{ allow_click : true, }); recruiting_button.draw(); - if (has_feature(eP_FEATURES.Recruiting_World)) { - var _recruit_world = get_features(eP_FEATURES.Recruiting_World)[0]; + if (has_feature(eP_FEATURES.RECRUITING_WORLD)) { + var _recruit_world = get_features(eP_FEATURES.RECRUITING_WORLD)[0]; if (_recruit_world.recruit_type == 0) && (obj_controller.faction_status[current_owner] != "War" && obj_controller.faction_status[p_data.current_owner] != "Antagonism" || p_data.player_disposition >= 50) { draw_text(xx+(spacing_x*3)+35, _half_way-20, "Open: Voluntery"); } else if (_recruit_world.recruit_type == 0 && player_disposition <= 50) { @@ -1472,15 +1472,15 @@ function PlanetData(planet, system) constructor{ if (population_influences[eFACTION.Tyranids] > 3){ var _max_influence_reduction = min(_pop_percentage_kill,population_influences[eFACTION.Tyranids]-3); alter_influence(eFACTION.Tyranids,-_max_influence_reduction); - if (has_feature(eP_FEATURES.Gene_Stealer_Cult)){ + if (has_feature(eP_FEATURES.GENE_STEALER_CULT)){ if (population_influences[eFACTION.Tyranids]<20){ - delete_feature(eP_FEATURES.Gene_Stealer_Cult); + delete_feature(eP_FEATURES.GENE_STEALER_CULT); } } } if (population + pdf<=0) and (current_owner=1) and (obj_controller.faction_status[eFACTION.Imperium]="War"){ - if (!has_feature(eP_FEATURES.Monastery)){ + if (!has_feature(eP_FEATURES.MONASTERY)){ set_new_owner(eFACTION.Imperium); add_disposition(-50); } @@ -1734,8 +1734,8 @@ function PlanetData(planet, system) constructor{ static end_turn_genestealer_cults = function(){ // Genestealer cults grow in number - if (has_feature(eP_FEATURES.Gene_Stealer_Cult)) { - var cult = get_features(eP_FEATURES.Gene_Stealer_Cult)[0]; + if (has_feature(eP_FEATURES.GENE_STEALER_CULT)) { + var cult = get_features(eP_FEATURES.GENE_STEALER_CULT)[0]; cult.cult_age++; alter_influence(eFACTION.Tyranids, cult.cult_age / 100); var planet_garrison = garrisons; @@ -1783,7 +1783,7 @@ function PlanetData(planet, system) constructor{ } else if (population_influences[eFACTION.Tyranids] > 5) { alter_influence(eFACTION.Tyranids, -1); if ((irandom(200) + (population_influences[eFACTION.Tyranids] / 10)) > 195) { - add_feature(eP_FEATURES.Gene_Stealer_Cult); + add_feature(eP_FEATURES.GENE_STEALER_CULT); } } } @@ -1922,7 +1922,7 @@ function PlanetData(planet, system) constructor{ if ((_rando >= 100) && (planet_forces[eFACTION.Heretics] < 5)) { edit_forces(eFACTION.Heretics,6); set_new_owner(eFACTION.Heretics) - add_feature(eP_FEATURES.Daemonic_Incursion); + add_feature(eP_FEATURES.DAEMONIC_INCURSION); set_corruption(corruption < 80 ? 80 : 95) @@ -1940,8 +1940,8 @@ function PlanetData(planet, system) constructor{ } static check_old_battles_feature = function(){ - if (has_feature(eP_FEATURES.OldBattleGround)){ - var _feats = get_features(eP_FEATURES.OldBattleGround); + if (has_feature(eP_FEATURES.OLDBATTLEGROUND)){ + var _feats = get_features(eP_FEATURES.OLDBATTLEGROUND); for (var i=0;i 200) { siz_penalty = 125; } var spec1=0,spec2=0,txt=""; // TODO consider making it a battle with Planetary governor's guards - txt="Your Astartes descend upon the surface of {name()} and plot the movements and schedule of the governor. "; + txt=$"Your Astartes descend upon the surface of {name()} and plot the movements and schedule of the governor. "; txt+="Once the time is right their target is ambushed " - txt+="choose("in their home","in the streets","while driving","taking a piss")+" and tranquilized. "; + txt+=choose("in their home","in the streets","while driving","taking a piss") + " and tranquilized. "; if(scr_has_disadv("Never Forgive")) then spec1=1; if (global.chapter_name="Space Wolves" || obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 5c5fcf2f8e..ec19e24cac 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -138,265 +138,6 @@ function scr_cheatcode(argument0) { } } break; - - case "inquismission": - var mission = cheat_arguments[0]; - show_debug_message($"{mission},"); - switch (mission){ - case "1": //default - scr_inquisition_mission(EVENT.inquisition_mission); - break; - case "planet": - scr_inquisition_mission(EVENT.inquisition_planet); - break; - case "spyrer": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.spyrer); - break; - case "artifact": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.artifact); - break; - case "inquisitor": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.inquisitor); - break; - case "purge": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.purge); - break; - case "tomb_world": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.tomb_world); - break; - case "tyranid_organism": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.tyranid_organism); - break; - case "demon": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.demon_world); - break; - default: - scr_inquisition_mission(EVENT.inquisition_mission); - break; - } - show_debug_message("inquisitor mission initiated"); - obj_controller.location_viewer.update_mission_log(); - break; - case "artifactpopulate": - with (obj_star) { - for (var i = 1; i <= planets; i++) { - array_push(p_feature[i], new NewPlanetFeature(eP_FEATURES.Artifact)); - } - } - break; - case "ruinspopulate": - with (obj_star) { - for (var i = 1; i <= planets; i++) { - array_push(p_feature[i], new NewPlanetFeature(eP_FEATURES.Ancient_Ruins)); - } - } - break; - case "stcpopulate": - with (obj_star) { - for (var i = 1; i <= planets; i++) { - array_push(p_feature[i], new NewPlanetFeature(eP_FEATURES.STC_Fragment)); - } - } - break; - case "event": - if (cheat_arguments[0] == "crusade") { - show_debug_message("crusading"); - with (obj_controller) { - launch_crusade(); - } - } else if (cheat_arguments[0] == "tomb") { - show_debug_message("necron_tomb_awaken"); - with (obj_controller) { - awaken_tomb_event(); - } - } else if (cheat_arguments[0] == "techuprising") { - tech_uprising_event(); - } else if (cheat_arguments[0] == "inspection") { - new_inquisitor_inspection(); - } else if (cheat_arguments[0] == "slaughtersong") { - create_starship_event(); - } else if (cheat_arguments[0] == "fallen"){ - event_fallen(); - }else if (cheat_arguments[0] == "surfremove"){ - var _star_id = scr_random_find(0,true,"",""); - add_event({ - duration : 2, - e_id : "governor_assassination", - variant : 2, - system : _star_id.name, - planet : irandom_range(1, _star_id.planets), - }); - } else if (cheat_arguments[0] == "strangebuild"){ - show_debug_message("strange build"); - strange_build_event(); - }else if (cheat_arguments[0] == "factionenemy"){ - make_faction_enemy_event(); - }else if (cheat_arguments[0] == "stopall"){ - obj_controller.last_event = 1000000; - show_debug_message($"last event : {obj_controller.last_event}") - }else if (cheat_arguments[0] == "startevents"){ - obj_controller.last_event = 0; - show_debug_message($"last event : {obj_controller.last_event}") - }else { - with (obj_controller) { - scr_random_event(false); - } - } - break; - case "infreq": - if (global.cheat_req == 0) { - global.cheat_req = 1; - cheatyface = 1; - obj_controller.tempRequisition = obj_controller.requisition; - obj_controller.requisition = 51234; - } else { - global.cheat_req = 0; - cheatyface = 1; - obj_controller.requisition = obj_controller.tempRequisition; - } - break; - case "infseed": - if (global.cheat_gene == 0) { - global.cheat_gene = 1; - cheatyface = 1; - obj_controller.tempGene_seed = obj_controller.gene_seed; - obj_controller.gene_seed = 9999; - } else { - global.cheat_gene = 0; - cheatyface = 1; - obj_controller.gene_seed = obj_controller.tempGene_seed; - } - break; - case "debug": - if (global.cheat_debug == 0) { - global.cheat_debug = 1; - cheatyface = 1; - } else { - global.cheat_debug = 0; - cheatyface = 1; - } - break; - case "test": - cheatyface = 1; - diplomacy = 10.5; - scr_dialogue("test"); - break; - case "req": - if (global.cheat_req == 0) { - cheatyface = 1; - obj_controller.requisition = real(cheat_arguments[0]); - } - break; - case "seed": - if (global.cheat_gene == 0) { - cheatyface = 1; - obj_controller.gene_seed = real(cheat_arguments[0]); - } - break; - case "depimp": - obj_controller.disposition[2] = real(cheat_arguments[0]); - break; - case "depmec": - obj_controller.disposition[3] = real(cheat_arguments[0]); - break; - case "depinq": - obj_controller.disposition[4] = real(cheat_arguments[0]); - break; - case "depecc": - obj_controller.disposition[5] = real(cheat_arguments[0]); - break; - case "depeld": - obj_controller.disposition[6] = real(cheat_arguments[0]); - break; - case "depork": - obj_controller.disposition[7] = real(cheat_arguments[0]); - break; - case "deptau": - obj_controller.disposition[8] = real(cheat_arguments[0]); - break; - case "deptyr": - obj_controller.disposition[9] = real(cheat_arguments[0]); - break; - case "depcha": - obj_controller.disposition[10] = real(cheat_arguments[0]); - break; - case "depall": - global.cheat_disp = 1; - cheatyface = 1; - for (var i = 2; i <= 10; i++) { - obj_controller.disposition[i] = real(cheat_arguments[0]); - } - break; - case "stc": - repeat(cheat_arguments[0]){ - scr_add_stc_fragment(); - } - break; - case "recruit": - var _start_pos = 0 - var length = (array_length(obj_controller.recruit_name) - 1) - var i = 0; - while (i < length) { - if (obj_controller.recruit_name[i] == "") { - _start_pos = i - break - } else { - i++ - continue - } - } - for (i = _start_pos; i < (real(cheat_arguments[0]) + _start_pos); i++) { - array_insert(obj_controller.recruit_corruption, i, 0); - array_insert(obj_controller.recruit_distance, i, 0); - array_insert(obj_controller.recruit_training, i, 1); - array_insert(obj_controller.recruit_exp, i, 20); - array_insert(obj_controller.recruit_data, i, {}); - array_insert(obj_controller.recruit_name, i, global.name_generator.generate_space_marine_name()); - scr_alert("green", "recruitment", (string(obj_controller.recruit_name[i]) + "has started training."), 0, 0) - } - break; - case "shiplostevent": - loose_ship_to_warp_event(); - break; - case "recoverlostship": - return_lost_ship(); - break; - case "gloriana": - var _fleet = get_nearest_player_fleet(0,0); - add_ship_to_fleet(new_player_ship("Gloriana"),_fleet); - break; - case "zoom": - set_zoom_to_default(); - break; - case "orkinvasion": - out_of_system_warboss(); - break; - case "forgemastermeet": - var _forge_master = scr_role_count("Forge Master", "", "units"); - if (array_length(_forge_master)>0){ - obj_controller.menu_lock = false; - instance_destroy(obj_popup_dialogue); - scr_toggle_diplomacy(); - obj_controller.diplomacy = -1; - obj_controller.character_diplomacy = _forge_master[0]; - diplo_txt="Greetings chapter master"; - } else { - } - break; - } - } - } catch(_exception) { - show_debug_message(_exception.longMessage); - } -} - - if (array_length(cheat_arguments)) { - spawn_mechanicus_mission(cheat_arguments[0]); - } else { - spawn_mechanicus_mission(); - } - break; - case "inquismission": var mission = cheat_arguments[0]; LOGGER.debug($"{mission},"); @@ -677,15 +418,15 @@ function draw_planet_debug_options() { function draw_planet_debug_features(){ static _addable_features = [ { - e_num : eP_FEATURES.Gene_Stealer_Cult, + e_num : eP_FEATURES.GENE_STEALER_CULT, name : "GeneStealer Cult" }, { - e_num : eP_FEATURES.Ancient_Ruins, + e_num : eP_FEATURES.ANCIENT_RUINS, name : "Ancient Ruins" }, { - e_num : eP_FEATURES.Artifact, + e_num : eP_FEATURES.ARTIFACT, name : "Artefact" }, { @@ -697,25 +438,26 @@ function draw_planet_debug_features(){ name : "Sororitas Cathedral" }, { - e_num : eP_FEATURES.OrkWarboss, + e_num : eP_FEATURES.ORKWARBOSS, name : "Ork Warboss" }, { - e_num : eP_FEATURES.OrkStronghold, + e_num : eP_FEATURES.ORKSTRONGHOLD, name : "Ork stronghold" }, { - e_num : eP_FEATURES.Monastery, + e_num : eP_FEATURES.MONASTERY, name : "Fortress Monastery" }, { - e_num : eP_FEATURES.Starship, + e_num : eP_FEATURES.STARSHIP, name : "Ancient Starship" }, { - e_num : eP_FEATURES.OldBattleGround, + e_num : eP_FEATURES.OLDBATTLEGROUND, name : "Old Battle Ground" }, + ] var base_y = 220; base_y += 2; diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index 9ab38e1a2e..f8af7b546e 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -46,7 +46,7 @@ function FeatureSelected(Feature, system, planet) constructor{ enter_count = 18; planet_data = new PlanetData(planet,system); - if (feature.f_type == eP_FEATURES.Forge){ + if (feature.f_type == eP_FEATURES.FORGE){ var _worker_caps = [2,4,8]; worker_capacity = _worker_caps[feature.size-1]; techs = collect_role_group(SPECIALISTS_TECHS, obj_star_select.target.name); @@ -128,7 +128,7 @@ function FeatureSelected(Feature, system, planet) constructor{ }; draw_set_halign(fa_center); switch (feature.f_type){ - case eP_FEATURES.Forge: + case eP_FEATURES.FORGE: draw_text_transformed(xx+(w/2), yy +10, "Chapter Forge", 2, 2, 0); draw_set_halign(fa_left); draw_set_color(c_gray); @@ -166,7 +166,7 @@ function FeatureSelected(Feature, system, planet) constructor{ //TODO somthing if the forge has a hanger } break; - case eP_FEATURES.Necron_Tomb: + case eP_FEATURES.NECRON_TOMB: generic=true; if (feature.awake==0 && feature.sealed==0){ @@ -180,17 +180,17 @@ function FeatureSelected(Feature, system, planet) constructor{ body = "The Cursed ranks of living metal spew forth from the Necron tomb below" } break; - case eP_FEATURES.Artifact: + case eP_FEATURES.ARTIFACT: generic=true; title = "Unknown Artifact"; body = "Unload Marines onto the planet to search for the artifact"; break; - case eP_FEATURES.Ancient_Ruins: + case eP_FEATURES.ANCIENT_RUINS: generic=true; title = "Ancinet Ruins"; body = "Unload Marines onto the planet to explore the ruins"; break; - case eP_FEATURES.OldBattleGround: + case eP_FEATURES.OLDBATTLEGROUND: generic=true; title = "Old Battlefield"; body = $"The site of a previously unrecorded battle between {feature.faction1} and {feature.faction2} forces long forgotten\nUnload Marines to search Techmarines are advisable to help, it would be best any tech priests not be aware of such an operation it may create a conflict of interest"; @@ -200,7 +200,7 @@ function FeatureSelected(Feature, system, planet) constructor{ title = "STC Fragment"; body = $"Unload a {obj_ini.role[100][16]} and whatever entourage you deem necessary to recover the STC Fragment"; break; - case eP_FEATURES.Gene_Stealer_Cult: + case eP_FEATURES.GENE_STEALER_CULT: generic=true; var cult_control = planet_data.population_influences[eFACTION.Tyranids]; title = $"Cult of {feature.name}"; @@ -216,7 +216,7 @@ function FeatureSelected(Feature, system, planet) constructor{ } body = $"The Cult of {feature.name} {control_string}"; break; - case eP_FEATURES.Victory_Shrine: + case eP_FEATURES.VICTORY_SHRINE: draw_text_transformed(xx+(w/2), yy +10, "Victory Shrine", 2, 2, 0); draw_set_halign(fa_left); draw_set_color(c_gray); @@ -228,7 +228,7 @@ function FeatureSelected(Feature, system, planet) constructor{ } }*/ break; - case eP_FEATURES.Monastery: + case eP_FEATURES.MONASTERY: draw_text_transformed(xx+(w/2), yy +10, feature.name, 2, 2, 0); if (feature.forge==0){ draw_text_transformed(xx+80, yy +50, "Forge", 1, 1, 0); @@ -239,7 +239,7 @@ function FeatureSelected(Feature, system, planet) constructor{ }; } break; - case eP_FEATURES.OrkStronghold: + case eP_FEATURES.ORKSTRONGHOLD: title = "Ork Stronghold"; generic = true; if (planet_data.planet_forces[eFACTION.Ork]){ @@ -248,7 +248,7 @@ function FeatureSelected(Feature, system, planet) constructor{ body = "Without a force of orks to hold it together the fortress is slowly pulled apart from within by the inhabitants, It's capabilities will constantly decrease until soon there will be nothing left"; } break - case eP_FEATURES.Recruiting_World: + case eP_FEATURES.RECRUITING_WORLD: generic = true; if (planet_data.planet_forces[eFACTION.ORK]) { body = $"For as long as this Stronghold stands the orks here will continue to fortify it. The larger it gets the greater the capacity of this planet to produce orkish machines of war and ships and the better protected the ork forces will be from bombardment"; diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index b37647c348..9679dafa01 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -379,17 +379,17 @@ function scr_enemy_ai_a() { if (guard_score>=3) and (p_pdf[_run]<10000) then p_pdf[_run]*=(min(0.95, 0+pdf_loss_reduction)); if (guard_score>=2) and (p_pdf[_run]<2000) then p_pdf[_run]=0; if (guard_score>=1) and (p_pdf[_run]<200) then p_pdf[_run]=0; - if (_planet_data.population_influences[eFACTION.Tyranids] > 50 && _planet_data.has_feature(eP_FEATURES.Gene_Stealer_Cult)){ + if (_planet_data.population_influences[eFACTION.Tyranids] > 50 && _planet_data.has_feature(eP_FEATURES.GENE_STEALER_CULT)){ var _cur_influ = p_influence[_run][eFACTION.Tyranids]; var _influence_reduction = _cur_influ * (p_pdf[_run]/_pdf_before); adjust_influence(eFACTION.Tyranids,-min(_influence_reduction,_cur_influ-3) , _run); if (p_influence[_run][eFACTION.Tyranids] < 20){ - _planet_data.delete_feature(eP_FEATURES.Gene_Stealer_Cult); + _planet_data.delete_feature(eP_FEATURES.GENE_STEALER_CULT); } } } if (p_pdf[_run]=0) and (pdf_with_player){ - if (!_planet_data.has_feature(eP_FEATURES.Monastery)) and (p_player[_run]<=0){ + if (!_planet_data.has_feature(eP_FEATURES.MONASTERY)) and (p_player[_run]<=0){ p_owner[_run]=2; dispo[_run]=-50; } diff --git a/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml b/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml index 660b47c411..975a5a3bf3 100644 --- a/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml +++ b/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml @@ -553,14 +553,14 @@ function scr_enemy_ai_c() { var ship=scr_orbiting_fleet(eFACTION.Tyranids); if (ship!="none") and (p_type[i]!="Dead") and (array_length(p_feature[i])!=0){ if (ship.capital_number>0){ - if (planet_feature_bool(p_feature[i], eP_FEATURES.Reclamation_pools) ==1){ + if (planet_feature_bool(p_feature[i], eP_FEATURES.RECLAMATION_POOLS) ==1){ p_tyranids[i]=0; if (p_type[i]="Death") or (p_type[i]="Hive") then ship.capital_number+=choose(0,1,1); ship.capital_number+=1; ship.escort_number+=3; ship.image_index=round(standard_fleet_strength_calc()); p_type[i]="Dead"; - delete_features(p_feature[i], eP_FEATURES.Reclamation_pools);// show_message("D"); + delete_features(p_feature[i], eP_FEATURES.RECLAMATION_POOLS);// show_message("D"); if (planets=1) and (p_type[1]="Dead") then image_alpha=0.33; if (planets=2) and (p_type[1]="Dead") and (p_type[2]="Dead") then image_alpha=0.33; if (planets=3) and (p_type[1]="Dead") and (p_type[2]="Dead") and (p_type[3]="Dead") then image_alpha=0.33; @@ -570,16 +570,16 @@ function scr_enemy_ai_c() { // if image_alpha = 0.33 then send the ship somewhere new } - if (planet_feature_bool(p_feature[i], eP_FEATURES.Capillary_Towers)==1) and (p_type[i]!="Dead"){ + if (planet_feature_bool(p_feature[i], eP_FEATURES.CAPILLARY_TOWERS)==1) and (p_type[i]!="Dead"){ p_population[i]=floor(p_population[i]*0.3); } - if (planet_feature_bool(p_feature[i], eP_FEATURES.Capillary_Towers)==1) and (p_type[i]!="Dead"){ + if (planet_feature_bool(p_feature[i], eP_FEATURES.CAPILLARY_TOWERS)==1) and (p_type[i]!="Dead"){ p_feature[i]=[]; - array_push(p_feature[i], new NewPlanetFeature(eP_FEATURES.Capillary_Towers), new NewPlanetFeature(eP_FEATURES.Reclamation_pools)); + array_push(p_feature[i], new NewPlanetFeature(eP_FEATURES.CAPILLARY_TOWERS), new NewPlanetFeature(eP_FEATURES.RECLAMATION_POOLS)); p_population[i]=0;// show_message("C"); } - if (planet_feature_bool(p_feature[i], eP_FEATURES.Capillary_Towers)==0) and (planet_feature_bool(p_feature[i], eP_FEATURES.Reclamation_pools)==0) and (p_type[i]!="Dead"){ - array_push(p_feature[i], new NewPlanetFeature(eP_FEATURES.Capillary_Towers));// show_message("B"); + if (planet_feature_bool(p_feature[i], eP_FEATURES.CAPILLARY_TOWERS)==0) and (planet_feature_bool(p_feature[i], eP_FEATURES.RECLAMATION_POOLS)==0) and (p_type[i]!="Dead"){ + array_push(p_feature[i], new NewPlanetFeature(eP_FEATURES.CAPILLARY_TOWERS));// show_message("B"); } } } diff --git a/scripts/scr_event_code/scr_event_code.gml b/scripts/scr_event_code/scr_event_code.gml index f525d67032..6969aff2e5 100644 --- a/scripts/scr_event_code/scr_event_code.gml +++ b/scripts/scr_event_code/scr_event_code.gml @@ -135,7 +135,7 @@ function event_end_turn_action() { if (_event_star!="none"){ _event_star.dispo[_planet]=-10;// Resets var twix=$"Inquisition executes Chapter Serf in control of {pllanet_numera_name(planet, _event_star)} and installs a new Planetary Governor."; - if (_event_star.p_owner[_planet]=eFACTION.Player){ + if (_event_star.p_owner[_planet]=eFACTION.PLAYER){ _event_star.p_owner[_planet]=_event_star.p_first[_planet]; } scr_alert("","",twix,0,0); @@ -381,70 +381,7 @@ function handle_discovered_governor_assasinations() { } } -function make_faction_enemy_event(){ - log_message("RE: Enemy"); - - var factions = []; - if(obj_controller.known[eFACTION.Imperium] == 1){ - array_push(factions,2); - } - if(obj_controller.known[eFACTION.Mechanicus] == 1){ - array_push(factions,3); - } - if(obj_controller.known[eFACTION.Inquisition] == 1){ - array_push(factions,4); - } - if(obj_controller.known[eFACTION.Ecclesiarchy] == 1){ - array_push(factions,5); - } - - if(array_length(factions) == 0){ - log_error("RE: Enemy, no faction could be chosen"); - return false; - } - var chosen_faction = array_random_element(factions); - - var text = "You have made an enemy within the "; - var log = "An enemy has been made within the "; - var _e_name = ""; - switch(chosen_faction) { - case 2: - _e_name="enemy_imperium"; - text += "Imperium"; - log += "Imperium"; - break; - case 3: - _e_name="enemy_mechanicus"; - text += "Mechanicus"; - log += "Mechanicus"; - break; - case 4: - _e_name="enemy_inquisition"; - text += "Inquisition"; - log += "Inquisition"; - break; - case 5: - _e_name="enemy_ecclesiarchy"; - text += "Ecclesiarchy"; - log += "Ecclesiarchy"; - break; - default: - log_error("RE: Enemy, no faction could be chosen"); - exit; - } - if (_e_name != ""){ - add_event({ - duration : irandom_range(12,96), - e_id : _e_name, - }) - alter_disposition(chosen_faction, -20) - text +="; relations with them will be soured for the forseable future."; - scr_popup("Diplomatic Incident",text,"angry",""); - scr_event_log("red",string(log)); - return true; - } - return false; -} + function strange_build_event() { LOGGER.info("RE: Fey Mood"); var _search_params = { diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml index 8c24f08bc5..74c638aec7 100644 --- a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml @@ -29,7 +29,7 @@ function mech_fleet_explore_battle_grounds(){ return; } - var _has_battle = system_feature_bool(orbiting.p_feature,eP_FEATURES.OldBattleGround); + var _has_battle = system_feature_bool(orbiting.p_feature,eP_FEATURES.OLDBATTLEGROUND); if (_has_battle){ var _p_data = orbiting.system_datas[_has_battle]; _p_data.refresh_data(); @@ -37,7 +37,7 @@ function mech_fleet_explore_battle_grounds(){ return; } - var _battle_ground = _p_data.get_features(eP_FEATURES.OldBattleGround)[0]; + var _battle_ground = _p_data.get_features(eP_FEATURES.OLDBATTLEGROUND)[0]; if (_battle_ground.explored == 0){ var _text = $"The Mechanicus have arrived on {_p_data.name()} It will now be impossible to access the site without Mechanicus surveillance any potential rescources will now be fully put towards their aimsin service of the Ommnissiah"; diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index f6556111c9..54d79255cc 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -824,7 +824,7 @@ function deliver_trophy_end_turn_check(){ _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it before you do"; var _planet = scr_get_planet_with_type(_wanted_types); - var _battle_ground = new NewPlanetFeature(eP_FEATURES.OldBattleGround); + var _battle_ground = new NewPlanetFeature(eP_FEATURES.OLDBATTLEGROUND); _battle_ground.player_hidden = false; diff --git a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml index a9764af41d..806ec1a426 100644 --- a/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml +++ b/scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml @@ -21,7 +21,7 @@ function orks_end_turn_growth(){ var _pdata = system_datas[i]; _pdata.refresh_data(); if (!p_orks[i]){ - var _strongholds = _pdata.get_features(eP_FEATURES.OrkStronghold); + var _strongholds = _pdata.get_features(eP_FEATURES.ORKSTRONGHOLD); for (var s=0;s10) then p_heresy[planet_num]-=10; p_sisters[planet_num]=choose(2,2,3);goo=1; break; - case eP_FEATURES.Necron_Tomb: + case eP_FEATURES.NECRON_TOMB: var lop=$"Necron Tomb discovered on {numeral_n}."; scr_alert("red","feature",lop,x,y); scr_event_log("red",lop); break; - case eP_FEATURES.Artifact: + case eP_FEATURES.ARTIFACT: var lop=$"Artifact discovered on {numeral_n}."; scr_alert("green","feature",lop,x,y); scr_event_log("",lop); @@ -502,22 +503,22 @@ function scr_planetary_feature(planet_num) { scr_alert("green","feature",lop,x,y); scr_event_log("",lop); break; - case eP_FEATURES.Ancient_Ruins: + case eP_FEATURES.ANCIENT_RUINS: var lop=$"A {feat.ruins_size} Ancient Ruins discovered on {string(name)} {scr_roman(planet_num)}."; scr_alert("green","feature",lop,x,y); scr_event_log("",lop); break; - case eP_FEATURES.Cave_Network: + case eP_FEATURES.CAVE_NETWORK: var lop=$"Extensive Cave Network discovered on {numeral_n}."; scr_alert("green","feature",lop,x,y); scr_event_log("",lop); break; - case eP_FEATURES.OrkWarboss: + case eP_FEATURES.ORKWARBOSS: var lop=$"Ork Warboss discovered on {numeral_n}."; scr_alert("red","feature",lop,x,y); scr_event_log("red",lop); break; - case eP_FEATURES.OldBattleGround: + case eP_FEATURES.OLDBATTLEGROUND: var lop=$"Old Battle Ground discovered on {numeral_n}."; scr_alert("green","feature",lop,x,y); scr_event_log("red",lop); diff --git a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml index 278252683a..45422e3a3e 100644 --- a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml +++ b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml @@ -25,28 +25,12 @@ function get_player_fleet_intercept_time(star,time_abundance){ _travel = get_viable_travel_time(time_abundance, _nearest_player_fleet.x, _nearest_player_fleet.y, star.x, star.y, _nearest_player_fleet, false); } } -function fleet_has_roles(fleet="none", roles){ - var all_ships = fleet_full_ship_array(fleet); - var unit; - for (var i=0;i<=10;i++){ - for (var s=0;s=obj_controller.chaos_turn){ - if (has_feature(eP_FEATURES.Warlord10) && obj_controller.known[10]=0 && obj_controller.faction_gender[10]=1){ + if (has_feature(eP_FEATURES.WARLORD10) && obj_controller.known[10]=0 && obj_controller.faction_gender[10]=1){ with(obj_drop_select){ var pop=instance_create(0,0,obj_popup); pop.image="chaos_symbol"; @@ -20,7 +20,7 @@ function scr_purge_world(action_type, action_score) { exit; } } - if (has_feature(eP_FEATURES.Warlord10) && obj_controller.known[10]>=2 && obj_controller.faction_gender[10]=1){ + if (has_feature(eP_FEATURES.WARLORD10) && obj_controller.known[10]>=2 && obj_controller.faction_gender[10]=1){ with(obj_drop_select){ attacking=10; @@ -205,8 +205,8 @@ function scr_purge_world(action_type, action_score) { } var nid_influence = population_influences[eFACTION.Tyranids]; - if (has_feature( eP_FEATURES.Gene_Stealer_Cult)) { - var cult = get_features(eP_FEATURES.Gene_Stealer_Cult)[0]; + if (has_feature( eP_FEATURES.GENE_STEALER_CULT)) { + var cult = get_features(eP_FEATURES.GENE_STEALER_CULT)[0]; if (cult.hiding) { } diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index d660c4c0ee..0f701384de 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -86,7 +86,7 @@ function scr_random_event(execute_now) { EVENT.strange_behavior, EVENT.fleet_delay, EVENT.harlequins, - EVENT.succession_war, + EVENT.SUCCESSION_WAR, EVENT.random_fun, ]; } From 9332887126ec8f0d07221d6b1dfe55ca923ce97e Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 12:06:17 +0100 Subject: [PATCH 34/93] shitty duplicationn --- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 3 --- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 11 ----------- 2 files changed, 14 deletions(-) diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 9679dafa01..0129e33b60 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -27,9 +27,6 @@ function scr_enemy_ai_a() { LOGGER.debug($"system_has_guard {p_guardsmen}"); } - } - } - // checking for inquisition dead world inspections here if (present_fleet[eFACTION.PLAYER] >= 0 && !present_fleet[eFACTION.INQUISITION]) { inquisitor_inspect_base(); diff --git a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml index 6fafc42661..551a2faeda 100644 --- a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml +++ b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml @@ -359,17 +359,6 @@ function scr_enemy_ai_d() { } - fleet.image_index = floor(fleet.capital_number + (fleet.frigate_number / 2) + (fleet.escort_number / 4)); - fleet.image_alpha = 0; - - fleet.action_x = x; - fleet.action_y = y; - - fleet.action_eta = p_timer[i][firstest]; - fleet.action = "move"; - } - } - } if (has_problem_planet_and_time(i, "Hive Fleet", 3) > -1) { var woop = scr_role_count("Chief " + string(obj_ini.role[100][17]), ""); From e99120d6c6d5ea1c25e7ac35d9296c0df3bd360d Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 15:05:38 +0100 Subject: [PATCH 35/93] refactor event code event func calling --- .../scr_chapter_managent_events.gml | 2 +- scripts/scr_cheatcode/scr_cheatcode.gml | 46 +- scripts/scr_event_code/scr_event_code.gml | 514 ++++++++---------- .../scr_unit_quick_find_pane.gml | 4 +- 4 files changed, 237 insertions(+), 329 deletions(-) diff --git a/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml b/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml index dc9a925ad9..d98372e78f 100644 --- a/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml +++ b/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml @@ -347,7 +347,7 @@ function strange_build_event(){ var marine_is_planetside = _unit.planet_location>0; if (marine_is_planetside && heritical_item) { - var _system = star_by_name(_unit.location_string); + var _system = find_star_by_name(_unit.location_string); var _planet = _unit.planet_location; if (_system!="none"){ with (_system){ diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index ec19e24cac..bbc7fdb56d 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -415,6 +415,7 @@ function draw_planet_debug_options() { } } +@mixin function draw_planet_debug_features(){ static _addable_features = [ { @@ -473,47 +474,8 @@ function draw_planet_debug_features(){ } } -/// @mixin -function draw_planet_debug_problems() { - var base_y = 220; - var _keys = PLANET_PROBLEM_KEYS; - base_y += 2; - for (var i = 0; i < array_length(_keys); i++) { - var _y = base_y + i * 20; - draw_text(38, _y, _keys[i]); - if (scr_hit(38, _y, 337, _y + 20)) { - tooltip_draw(mission_name_key(_keys[i])); - if (mouse_button_clicked()) { - switch (_keys[i]) { - case "inquisitor": - mission_inquistion_hunt_inquisitor(target.id); - break; - case "necron": - mission_inquisition_tomb_world(target.id); - break; - case "mech_raider": - spawn_mechanicus_mission("mech_raider"); - break; - case "mech_mars": - spawn_mechanicus_mission("mech_mars"); - break; - case "mech_bionics": - spawn_mechanicus_mission("mech_bionics"); - break; - - for (var i=0;i= 0; i--) { - var _event = event[i]; - if (_event.e_id == "" || _event.duration < 0) { - array_delete(event, i, 1); - continue; + +function event_remove_player_serf(_event) { + var _star_name = _event.system; + var _event_star = find_star_by_name(_event.system); + var _planet = _event.planet; + if (_event_star != "none") { + _event_star.dispo[_planet] = -10; // Resets + var twix = $"Inquisition executes Chapter Serf in control of {pllanet_numera_name(planet, _event_star)} and installs a new Planetary Governor."; + if (_event_star.p_owner[_planet] == eFACTION.PLAYER) { + _event_star.p_owner[_planet] = _event_star.p_first[_planet]; } + scr_alert("", "", twix, 0, 0); + scr_event_log("", twix, _star_name); + } +} - _event.duration -= 1; +function event_game_over_man(_event) { + obj_controller.alarm[8] = 1; +} - if (_event.duration == 0) { - if (_event.e_id == "game_over_man") { - obj_controller.alarm[8] = 1; - } - // Removes planetary governor installed by the chapter - if (_event.e_id == "remove_surf") { - var _star_name = _event.system; - var _event_star = find_star_by_name(_event.system); - var _planet = _event.planet; - if (_event_star != "none") { - _event_star.dispo[_planet] = -10; // Resets - var twix = $"Inquisition executes Chapter Serf in control of {pllanet_numera_name(planet, _event_star)} and installs a new Planetary Governor."; - if (_event_star.p_owner[_planet] == eFACTION.PLAYER) { - _event_star.p_owner[_planet] = _event_star.p_first[_planet]; - } - scr_alert("", "", twix, 0, 0); - scr_event_log("", twix, _star_name); - } - } else if (_event.e_id == "enemy_imperium") { - // Changes relation to good - scr_alert("green", "enemy", "You have made amends with your enemy in the Imperium.", 0, 0); - disposition[eFACTION.IMPERIUM] += 20; - scr_event_log("", "Amends made with Imperium."); - } else if (_event.e_id == "enemy_mechanicus") { - scr_alert("green", "enemy", "You have made amends with your Mechanicus enemy.", 0, 0); - disposition[eFACTION.MECHANICUS] += 20; - scr_event_log("", "Amends made with Mechanicus enemy."); - } else if (_event.e_id == "enemy_inquisition") { - scr_alert("green", "enemy", "You have made amends with your enemy in the Inquisition.", 0, 0); - disposition[eFACTION.INQUISITION] += 20; - scr_event_log("", "Amends made with Inquisition enemy."); - } else if (_event.e_id == "enemy_ecclesiarchy") { - scr_alert("green", "enemy", "You have made amends with your enemy in the Ecclesiarchy.", 0, 0); - disposition[eFACTION.ECCLESIARCHY] += 20; - scr_event_log("", "Amends made with Ecclesiarchy enemy."); - } else if (_event.e_id == "imperium_daemon") { - // Sector commander losses its mind - var alert_string = $"Sector Commander {faction_leader[eFACTION.IMPERIUM]} has gone insane."; - scr_alert("red", "lol", alert_string, 0, 0); - faction_defeated[eFACTION.IMPERIUM] = 1; - scr_event_log("red", alert_string); - } - // Starts chaos invasion - if (_event.e_id == "chaos_invasion") { - var xx = 0, yy = 0, flee = 0, dirr = 0; - var star_id = scr_random_find(1, true, "", ""); - if (star_id != undefined) { - scr_event_log("purple", $"Chaos Fleets exit the warp near the {star_id.name} system.", star_id.name); - for (var j = 0; j < 4; j++) { - dirr += irandom_range(50, 100); - xx = star_id.x + lengthdir_x(72, dirr); - yy = star_id.y + lengthdir_y(72, dirr); - flee = instance_create(xx, yy, obj_en_fleet); - flee.owner = eFACTION.CHAOS; - flee.sprite_index = spr_fleet_chaos; - flee.image_index = 4; - flee.capital_number = choose(0, 1); - flee.frigate_number = choose(2, 3); - flee.escort_number = choose(4, 5, 6); - flee.cargo_data.csm = true; - obj_controller.chaos_fleets += 1; - flee.action_x = star_id.x; - flee.action_y = star_id.y; - with (flee) { - set_fleet_movement(); - } - } - } +function event_enemy_imperium(_event) { + // Changes relation to good + scr_alert("green", "enemy", "You have made amends with your enemy in the Imperium.", 0, 0); + disposition[eFACTION.IMPERIUM] += 20; + scr_event_log("", "Amends made with Imperium."); +} + +function event_enemy_mechanicus(_event) { + scr_alert("green", "enemy", "You have made amends with your Mechanicus enemy.", 0, 0); + disposition[eFACTION.MECHANICUS] += 20; + scr_event_log("", "Amends made with Mechanicus enemy."); +} + +function event_enemy_inquisition(_event) { + scr_alert("green", "enemy", "You have made amends with your enemy in the Inquisition.", 0, 0); + disposition[eFACTION.INQUISITION] += 20; + scr_event_log("", "Amends made with Inquisition enemy."); +} + +function event_enemy_ecclesiarchy(_event) { + scr_alert("green", "enemy", "You have made amends with your enemy in the Ecclesiarchy.", 0, 0); + disposition[eFACTION.ECCLESIARCHY] += 20; + scr_event_log("", "Amends made with Ecclesiarchy enemy."); +} + +function event_imperium_daemon(_event) { + // Sector commander losses its mind + var alert_string = $"Sector Commander {faction_leader[eFACTION.IMPERIUM]} has gone insane."; + scr_alert("red", "lol", alert_string, 0, 0); + faction_defeated[eFACTION.IMPERIUM] = 1; + scr_event_log("red", alert_string); +} + +function event_chaos_invasion(_event) { + // Starts chaos invasion + var xx = 0, yy = 0, flee = 0, dirr = 0; + var star_id = scr_random_find(1, true, "", ""); + if (star_id != undefined) { + scr_event_log("purple", $"Chaos Fleets exit the warp near the {star_id.name} system.", star_id.name); + for (var j = 0; j < 4; j++) { + dirr += irandom_range(50, 100); + xx = star_id.x + lengthdir_x(72, dirr); + yy = star_id.y + lengthdir_y(72, dirr); + flee = instance_create(xx, yy, obj_en_fleet); + flee.owner = eFACTION.CHAOS; + flee.sprite_index = spr_fleet_chaos; + flee.image_index = 4; + flee.capital_number = choose(0, 1); + flee.frigate_number = choose(2, 3); + flee.escort_number = choose(4, 5, 6); + flee.cargo_data.csm = true; + obj_controller.chaos_fleets += 1; + flee.action_x = star_id.x; + flee.action_y = star_id.y; + with (flee) { + set_fleet_movement(); } - // Ships construction - if (_event.e_id == "ship_construction") { - var new_ship_event = _event.ship_class; - var active_forges = []; - var chosen_star = false; - with (obj_star) { - if (owner == eFACTION.MECHANICUS) { - for (f = 1; f <= planets; f++) { - if ((p_type[f] == "Forge") && (p_owner[f] == eFACTION.MECHANICUS)) { - array_push(active_forges, new PlanetData(f, self)); - } - } - } - } - if (array_length(active_forges) > 0) { - var ship_spawn = active_forges[irandom(array_length(active_forges) - 1)]; - var _new_player_fleet = instance_create(ship_spawn.system.x, ship_spawn.system.y, obj_p_fleet); - - var _star_name = _event.system; - var _event_star = star_by_name(_event.system); - var _planet = _event.planet; - if (_event_star!="none"){ - _event_star.dispo[_planet]=-10;// Resets - var twix=$"Inquisition executes Chapter Serf in control of {pllanet_numera_name(planet, _event_star)} and installs a new Planetary Governor."; - if (_event_star.p_owner[_planet]=eFACTION.PLAYER){ - _event_star.p_owner[_planet]=_event_star.p_first[_planet]; - } - scr_alert("","",twix,0,0); - scr_event_log("",twix, _star_name); - } - } - // Changes relation to good - else if (_event.e_id=="enemy_imperium"){ - scr_alert("green","enemy","You have made amends with your enemy in the Imperium.",0,0); - disposition[eFACTION.Imperium]+=20; - scr_event_log("","Amends made with Imperium."); - } - else if (_event.e_id=="enemy_mechanicus"){ - scr_alert("green","enemy","You have made amends with your Mechanicus enemy.",0,0); - disposition[eFACTION.Mechanicus]+=20; - scr_event_log("","Amends made with Mechanicus enemy."); - } - else if (_event.e_id=="enemy_inquisition"){ - scr_alert("green","enemy","You have made amends with your enemy in the Inquisition.",0,0); - disposition[eFACTION.Inquisition]+=20; - scr_event_log("","Amends made with Inquisition enemy."); - } - else if (_event.e_id=="enemy_ecclesiarchy"){ - scr_alert("green","enemy","You have made amends with your enemy in the Ecclesiarchy.",0,0); - disposition[eFACTION.Ecclesiarchy]+=20; - scr_event_log("","Amends made with Ecclesiarchy enemy."); - } - // Sector commander losses its mind - else if (_event.e_id=="imperium_daemon"){ - var alert_string = $"Sector Commander {faction_leader[eFACTION.Imperium]} has gone insane." - scr_alert("red","lol",alert_string,0,0); - faction_defeated[eFACTION.Imperium]=1; - scr_event_log("red",alert_string); - } - // Starts chaos invasion - if (_event.e_id=="chaos_invasion"){ - var xx=0,yy=0,flee=0,dirr=0; - var star_id = scr_random_find(0,true,"",""); - if(star_id != undefined){ - scr_event_log("purple",$"Chaos Fleets exit the warp near the {star_id.name} system.", star_id.name); - for(var j=0; j<4; j++){ - dirr+=irandom_range(50,100); - xx=star_id.x+lengthdir_x(72,dirr); - yy=star_id.y+lengthdir_y(72,dirr); - flee=instance_create(xx,yy,obj_en_fleet); - flee.owner=eFACTION.Chaos; - flee.sprite_index=spr_fleet_chaos; - flee.image_index=4; - flee.capital_number=choose(0,0,0,1); - flee.frigate_number=choose(2,2,,3); - flee.escort_number=choose(4,4,4,5,6); - flee.cargo_data.csm = true; - obj_controller.chaos_fleets+=1; - flee.action_x=star_id.x; - flee.action_y=star_id.y; - with(flee){ - set_fleet_movement(); - } - } - } - } - // Ships construction - if (_event.e_id == "ship_construction"){ - var new_ship_event=_event.ship_class; - var active_forges = []; - var chosen_star = false; - with(obj_star){ - if (owner==eFACTION.Mechanicus){ - for (f=1;f<=planets;f++){ - if (p_type[f]=="Forge") and (p_owner[f]==eFACTION.Mechanicus){ - array_push(active_forges,new PlanetData(f, self)); - } - } - } - } - if (array_length(active_forges)>0){ - var ship_spawn = active_forges[irandom(array_length(active_forges)-1)]; - var _new_player_fleet=instance_create(ship_spawn.system.x,ship_spawn.system.y,obj_p_fleet); - // Creates the ship - var last_ship = new_player_ship(new_ship_event, ship_spawn.system.name); - - add_ship_to_fleet(last_ship, _new_player_fleet); - - // show_message(string(obj_ini.ship_class[last_ship])+":"+string(obj_ini.ship[last_ship])); - - if (obj_ini.ship_size[last_ship] != 1) { - scr_popup("Ship Constructed", $"Your new {obj_ini.ship_class[last_ship]} '{obj_ini.ship[last_ship]}' has finished being constructed. It is orbiting {ship_spawn.system.name} and awaits its maiden voyage.", "shipyard", ""); - } - if (obj_ini.ship_size[last_ship] == 1) { - scr_popup("Ship Constructed", $"Your new {obj_ini.ship_class[last_ship]} Escort '{obj_ini.ship[last_ship]}' has finished being constructed. It is orbiting {ship_spawn.system.name} and awaits its maiden voyage.", "shipyard", ""); - } - var bob = instance_create(ship_spawn.system.x + 16, ship_spawn.system.y - 24, obj_star_event); - bob.image_alpha = 1; - bob.image_speed = 1; - } - if (array_length(active_forges) == 0) { - _event.duration = 1; - scr_popup("Ship Construction Halted", $"A lack of suitable forge worlds in the system has halted construction of your requested ship.", "shipyard", ""); + } + } +} + +function event_ship_construction(_event) { + // Ships construction + var new_ship_event = _event.ship_class; + var active_forges = []; + var chosen_star = false; + with (obj_star) { + if (owner == eFACTION.MECHANICUS) { + for (f = 1; f <= planets; f++) { + if ((p_type[f] == "Forge") && (p_owner[f] == eFACTION.MECHANICUS)) { + array_push(active_forges, new PlanetData(f, self)); } } - // Spare the inquisitor - if (_event.e_id == "inquisitor_spared") { - hunt_inquisition_spared_inquisitor_consequence(_event); - } + } + } + if (array_length(active_forges) > 0) { + var ship_spawn = active_forges[irandom(array_length(active_forges) - 1)]; + var _new_player_fleet = instance_create(ship_spawn.system.x, ship_spawn.system.y, obj_p_fleet); + // Creates the ship + var last_ship = new_player_ship(new_ship_event, ship_spawn.system.name); - if (_event.e_id == "strange_building") { - var marine_name = _event.name; - var comp = _event.company; - var marine_num = _event.marine; - var _unit = fetch_unit([marine_num, comp]); - var item = _event.crafted; + add_ship_to_fleet(last_ship, _new_player_fleet); - LOGGER.warning($"comp: {comp}, marine_num: {marine_num}"); + // show_message(string(obj_ini.ship_class[last_ship])+":"+string(obj_ini.ship[last_ship])); - var killy = 0, tixt = $"{obj_ini.role[100][16]} {marine_name} has finished his work- "; + if (obj_ini.ship_size[last_ship] != 1) { + scr_popup("Ship Constructed", $"Your new {obj_ini.ship_class[last_ship]} '{obj_ini.ship[last_ship]}' has finished being constructed. It is orbiting {ship_spawn.system.name} and awaits its maiden voyage.", "shipyard", ""); + } + if (obj_ini.ship_size[last_ship] == 1) { + scr_popup("Ship Constructed", $"Your new {obj_ini.ship_class[last_ship]} Escort '{obj_ini.ship[last_ship]}' has finished being constructed. It is orbiting {ship_spawn.system.name} and awaits its maiden voyage.", "shipyard", ""); + } + var bob = instance_create(ship_spawn.system.x + 16, ship_spawn.system.y - 24, obj_star_event); + bob.image_alpha = 1; + bob.image_speed = 1; + } + if (array_length(active_forges) == 0) { + _event.duration = 1; + scr_popup("Ship Construction Halted", $"A lack of suitable forge worlds in the system has halted construction of your requested ship.", "shipyard", ""); + } +} - if (item == "Icon") { - tixt += $"it is a {global.chapter_name} Icon wrought in metal, finely decorated. Pride for his chapter seems to have overtaken him. There are no corrections to be made and the item is placed where many may view it."; - } - if (item == "Statue") { - tixt += "it is a small, finely crafted statue wrought in metal. The " + string(obj_ini.role[100][16]) + " is scolded for the waste of material, but none daresay the quality of the piece."; - } - if (item == "Bike") { - scr_add_item("Bike", 1); - tixt += "it is a finely crafted Bike, conforming mostly to STC standards. The other " + string(obj_ini.role[100][16]) + " are surprised at the rapid pace of his work."; - } - if (item == "Rhino") { - scr_add_vehicle("Rhino", 0, {}, "Storm Bolter", "Storm Bolter", "", "Artificer Hull", "Dozer Blades"); - tixt += "it is a finely crafted Rhino, conforming to STC standards. The other " + string(obj_ini.role[100][16]) + " are surprised at the rapid pace of his work."; - } - if (item == "Artifact") { - scr_event_log("", string(obj_ini.role[100][16]) + " " + string(marine_name) + " constructs an Artifact."); - var _last_artifact = scr_add_artifact("random_nodemon", "", 0); +function event_inquisitor_spared(_event) { + // Spare the inquisitor + hunt_inquisition_spared_inquisitor_consequence(_event); +} - tixt += $"some form of divine inspiration has seemed to have taken hold of him. An artifact {obj_ini.artifact[_last_artifact]} has been crafted."; - } - if (item == "baby") { - _unit.edit_corruption(choose(8, 12, 16, 20)); - tixt += "some form of horrendous statue. A weird amalgram of limbs and tentacles, the sheer atrocity of it is made worse by the tiny, baby-like form, the once natural shape of a human child twisted nearly beyond recognition."; - } else if (item == "robot") { - _unit.edit_corruption(choose(2, 4, 6, 8, 10)); - tixt += $"some form of small, box-like robot. It seems to teeter around haphazardly, nearly falling over with each step. {_unit.name()} maintains that it has no AI, though the other " + string(obj_ini.role[100][16]) + " express skepticism."; - _unit.add_trait("tech_heretic"); - } else if (item == "demon") { - _unit.edit_corruption(choose(8, 12, 16, 20)); - tixt += "some form of horrendous statue. What was meant to be some sort of angel, or primarch, instead has a mishappen face that is hardly human in nature. Between the fetid, ragged feathers and empty sockets it is truly blasphemous."; - _unit.add_trait("tech_heretic"); - } else if (item == "fusion") { - //TODO if tech heretic chosen don't kill the dude - // _unit.corruption+=choose(70); - tixt += $"some kind of ill-mannered ascension. One of your battle-brothers enters the armamentarium to find {marine_name} fused to a vehicle, his flesh twisted and submerged into the frame. Mechendrites and weapons fire upon the marine without warning, a windy scream eminating from the abomination. It takes several battle-brothers to take out what was once a " + string(obj_ini.role[100][16]) + "."; - - // This is causing the problem - - scr_kill_unit(comp, marine_num); +function event_strange_building(_event) { + var marine_name = _event.name; + var comp = _event.company; + var marine_num = _event.marine; + var _unit = fetch_unit([marine_num, comp]); + var item = _event.crafted; + + LOGGER.warning($"comp: {comp}, marine_num: {marine_num}"); + + var killy = 0, tixt = $"{obj_ini.role[100][16]} {marine_name} has finished his work- "; + + if (item == "Icon") { + tixt += $"it is a {global.chapter_name} Icon wrought in metal, finely decorated. Pride for his chapter seems to have overtaken him. There are no corrections to be made and the item is placed where many may view it."; + } + if (item == "Statue") { + tixt += "it is a small, finely crafted statue wrought in metal. The " + string(obj_ini.role[100][16]) + " is scolded for the waste of material, but none daresay the quality of the piece."; + } + if (item == "Bike") { + scr_add_item("Bike", 1); + tixt += "it is a finely crafted Bike, conforming mostly to STC standards. The other " + string(obj_ini.role[100][16]) + " are surprised at the rapid pace of his work."; + } + if (item == "Rhino") { + scr_add_vehicle("Rhino", 0, {}, "Storm Bolter", "Storm Bolter", "", "Artificer Hull", "Dozer Blades"); + tixt += "it is a finely crafted Rhino, conforming to STC standards. The other " + string(obj_ini.role[100][16]) + " are surprised at the rapid pace of his work."; + } + if (item == "Artifact") { + scr_event_log("", string(obj_ini.role[100][16]) + " " + string(marine_name) + " constructs an Artifact."); + var _last_artifact = scr_add_artifact("random_nodemon", "", 0); + + tixt += $"some form of divine inspiration has seemed to have taken hold of him. An artifact {obj_ini.artifact[_last_artifact]} has been crafted."; + } + if (item == "baby") { + _unit.edit_corruption(choose(8, 12, 16, 20)); + tixt += "some form of horrendous statue. A weird amalgram of limbs and tentacles, the sheer atrocity of it is made worse by the tiny, baby-like form, the once natural shape of a human child twisted nearly beyond recognition."; + } else if (item == "robot") { + _unit.edit_corruption(choose(2, 4, 6, 8, 10)); + tixt += $"some form of small, box-like robot. It seems to teeter around haphazardly, nearly falling over with each step. {_unit.name()} maintains that it has no AI, though the other " + string(obj_ini.role[100][16]) + " express skepticism."; + _unit.add_trait("tech_heretic"); + } else if (item == "demon") { + _unit.edit_corruption(choose(8, 12, 16, 20)); + tixt += "some form of horrendous statue. What was meant to be some sort of angel, or primarch, instead has a mishappen face that is hardly human in nature. Between the fetid, ragged feathers and empty sockets it is truly blasphemous."; + _unit.add_trait("tech_heretic"); + } else if (item == "fusion") { + //TODO if tech heretic chosen don't kill the dude + // _unit.corruption+=choose(70); + tixt += $"some kind of ill-mannered ascension. One of your battle-brothers enters the armamentarium to find {marine_name} fused to a vehicle, his flesh twisted and submerged into the frame. Mechendrites and weapons fire upon the marine without warning, a windy scream eminating from the abomination. It takes several battle-brothers to take out what was once a " + string(obj_ini.role[100][16]) + "."; + + // This is causing the problem + + scr_kill_unit(comp, marine_num); + with (obj_ini) { + scr_company_order(0); + } + } + if (item != "fusion") { + var options = [ + { + str1: "Execute the heretic", + choice_func: function() { + scr_kill_unit(pop_data.company, pop_data.marine_number); + var company_to_order = pop_data.company; with (obj_ini) { - scr_company_order(0); + scr_company_order(company_to_order); } - } - if (item != "fusion") { - var options = [ - { - str1: "Execute the heretic", - choice_func: function() { - scr_kill_unit(pop_data.company, pop_data.marine_number); - var company_to_order = pop_data.company; - with (obj_ini) { - scr_company_order(company_to_order); - } - popup_default_close(); - }, - }, - { - str1: "Move him to the Penitorium", - choice_func: function() { - popup_default_close(); - }, - }, - { - str1: "I see no problem", - choice_func: popup_default_close, - } - ]; - var _pop_data = { - options: options, - marine_number: marine_num, - company: comp, - marine_name: marine_name, - }; - } else { - _pop_data = ""; - } + popup_default_close(); + }, + }, + { + str1: "Move him to the Penitorium", + choice_func: function() { + popup_default_close(); + }, + }, + { + str1: "I see no problem", + choice_func: popup_default_close, + } + ]; + var _pop_data = { + options: options, + marine_number: marine_num, + company: comp, + marine_name: marine_name, + }; + } else { + _pop_data = ""; + } - scr_popup("He Built It", tixt, "tech_build", _pop_data); + scr_popup("He Built It", tixt, "tech_build", _pop_data); +} + + +function event_end_turn_action() { + var _event_length = array_length(event); + for (var i = _event_length - 1; i >= 0; i--) { + var _event = event[i]; + if (_event.e_id == "" || _event.duration < 0) { + array_delete(event, i, 1); + continue; + } + + _event.duration -= 1; + + if (_event.duration == 0) { + switch (_event.e_id) { + case "game_over_man": event_game_over_man(_event); break; + case "remove_surf": event_remove_player_serf(_event); break; + case "enemy_imperium": event_enemy_imperium(_event); break; + case "enemy_mechanicus": event_enemy_mechanicus(_event); break; + case "enemy_inquisition": event_enemy_inquisition(_event); break; + case "enemy_ecclesiarchy": event_enemy_ecclesiarchy(_event); break; + case "imperium_daemon": event_imperium_daemon(_event); break; + case "chaos_invasion": event_chaos_invasion(_event); break; + case "ship_construction": event_ship_construction(_event); break; + case "inquisitor_spared": event_inquisitor_spared(_event); break; + case "strange_building": event_strange_building(_event); break; } if (_event.duration <= 0) { array_delete(event, i, 1); @@ -339,6 +282,7 @@ function event_end_turn_action() { } } + function handle_discovered_governor_assasinations() { for (var i = 0; i < array_length(obj_controller.event); i++) { var _event = obj_controller.event[i]; diff --git a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml index 9d7d47001f..9e0820f6c9 100644 --- a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml +++ b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml @@ -591,7 +591,7 @@ function HoverBox() constructor { if (!hover_entered){ if (point_and_click([xx+10, yy+90+(20*i)-2,xx+main_panel.width,yy+90+(20*i)+18])){ - var star = star_by_name(system_names[i]); + var star = find_star_by_name(system_names[i]); if (star!="none"){ travel_target = [star.x, star.y]; travel_increments = [(travel_target[0]-obj_controller.x)/15,(travel_target[1]-obj_controller.y)/15]; @@ -621,7 +621,7 @@ function HoverBox() constructor { purpose : $"{system_names[hover_item.root_item]} Management", purpose_code : "manage", number : 0, - system : star_by_name(system_names[hover_item.root_item]).id, + system : find_star_by_name(system_names[hover_item.root_item]).id, feature : "none", planet : 0, selections : [] From 505e114aa16b158fb46b796a758b71984fe69cb9 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 15:20:13 +0100 Subject: [PATCH 36/93] bundle momre merge errors --- .../scr_chapter_managent_events.gml | 14 +-- scripts/scr_cheatcode/scr_cheatcode.gml | 2 +- scripts/scr_event_code/scr_event_code.gml | 87 ------------------- scripts/scr_hit/scr_hit.gml | 5 +- .../scr_imperial_navy_functions.gml | 36 ++------ .../scr_mission_functions.gml | 42 --------- 6 files changed, 15 insertions(+), 171 deletions(-) diff --git a/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml b/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml index d98372e78f..2144107c3a 100644 --- a/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml +++ b/scripts/scr_chapter_managent_events/scr_chapter_managent_events.gml @@ -280,9 +280,8 @@ function new_forge_master_chosen(pick) { } - function strange_build_event(){ - log_message("RE: Fey Mood"); + LOGGER.info("RE: Fey Mood"); var _search_params = {trait : ["crafter","tinkerer"], trait_any : true} var marine_and_company = scr_random_marine("",0, _search_params); if (marine_and_company == "none"){ @@ -413,11 +412,12 @@ function init_mutated_gene_random_event(){ } -function event_dispose_of_mutated_gene(){ - if (pop_data.percent_remove > 0){ - obj_controller.gene_seed -= (obj_controller.gene_seed * (pop_data.percent_remove/100)) - } - popup_default_close(); +function event_dispose_of_mutated_gene() { + if (pop_data.percent_remove > 0) { + var _removal_amount = ceil(obj_controller.gene_seed * (pop_data.percent_remove / 100)); + obj_controller.gene_seed -= _removal_amount; + } + popup_default_close(); } diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index bbc7fdb56d..f82e9815b9 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -415,7 +415,7 @@ function draw_planet_debug_options() { } } -@mixin +//@mixin function draw_planet_debug_features(){ static _addable_features = [ { diff --git a/scripts/scr_event_code/scr_event_code.gml b/scripts/scr_event_code/scr_event_code.gml index a4287b9f0c..2bfb2e7f66 100644 --- a/scripts/scr_event_code/scr_event_code.gml +++ b/scripts/scr_event_code/scr_event_code.gml @@ -326,85 +326,6 @@ function handle_discovered_governor_assasinations() { } -function strange_build_event() { - LOGGER.info("RE: Fey Mood"); - var _search_params = { - trait: [ - "crafter", - "tinkerer" - ], - trait_any: true, - }; - var marine_and_company = scr_random_marine("", 0, _search_params); - if (marine_and_company == "none") { - marine_and_company = scr_random_marine("", 0, "none"); - } - if (marine_and_company != "none") { - var marine = marine_and_company[0]; - var company = marine_and_company[1]; - var text = ""; - var _unit = fetch_unit(marine_and_company); - var role = _unit.role(); - text = _unit.name_role(); - text += " is taken by a strange mood and starts building!"; - - var crafted_object; - var craft_roll = roll_dice_chapter(1, 100, "low"); - var heritical_item = false; - - //this bit should be improved, idk what duke was checking for here - //TODO make craft chance reflective of crafters skill, rewards players for having skilled tech area - if (scr_has_disadv("Tech-Heresy")) { - craft_roll += 20; - } - if (_unit.has_trait("tech_heretic")) { - craft_roll += 60; - } - if (scr_has_adv("Crafter")) { - if (craft_roll > 80) { - craft_roll -= 10; - } - if (craft_roll < 60) { - craft_roll += 10; - } - } - - if (craft_roll <= 50) { - crafted_object = choose("Icon", "Icon", "Statue"); - } else if ((craft_roll > 50) && (craft_roll <= 60)) { - crafted_object = choose("Bike", "Rhino"); - } else if ((craft_roll > 60) && (craft_roll <= 80)) { - crafted_object = "Artifact"; - } else { - crafted_object = choose("baby", "robot", "demon", "fusion"); - heritical_item = 1; - } - - add_event({e_id: "strange_building", duration: 1, name: _unit.name(), company: company, marine: marine, crafted: crafted_object}); - - scr_popup("Can He Build marine?!?", text, "tech_build", ""); - - var marine_is_planetside = _unit.planet_location > 0; - if (marine_is_planetside && heritical_item) { - var _system = find_star_by_name(_unit.location_string); - var _planet = _unit.planet_location; - if (_system != "none") { - with (_system) { - p_hurssy[_planet] += 6; - p_hurssy_time[_planet] = 2; - } - } - } else if (!marine_is_planetside && heritical_item) { - var _fleet = find_ships_fleet(_unit.ship_location); - if (_fleet != "none") { - //the intended code for here was to add some sort of chaos event on the ship stashed up ready to fire in a few turns - } - } - return true; - } - return false; -} - function make_faction_enemy_event() { LOGGER.info("RE: Enemy"); @@ -466,11 +387,3 @@ function make_faction_enemy_event() { } return false; } - -function event_dispose_of_mutated_gene() { - if (pop_data.percent_remove > 0) { - var _removal_amount = ceil(obj_controller.gene_seed * (pop_data.percent_remove / 100)); - obj_controller.gene_seed -= _removal_amount; - } - popup_default_close(); -} diff --git a/scripts/scr_hit/scr_hit.gml b/scripts/scr_hit/scr_hit.gml index bd8cbf4680..fcf874a2e2 100644 --- a/scripts/scr_hit/scr_hit.gml +++ b/scripts/scr_hit/scr_hit.gml @@ -96,6 +96,7 @@ function click_controller(cooldown = 60, lock_bypass = false, mouse_button_lr=mb if (lock_bypass == false && global.ui_click_lock == true) { return false; } +} /// @description Returns true if left mouse button was clicked outside the desired rectangle area. /// @param {Array} _rect The [x1, y1, x2, y2] array defining the exclusion zone. /// @param {Real} _cooldown The cooldown duration in frames. @@ -105,10 +106,6 @@ function point_outside_and_click(_rect, _cooldown = 60, _lock_bypass = false) { return _point_and_click_logic(_rect, _cooldown, _lock_bypass, true); } - var mouse_clicked = event_number==ev_gui ? device_mouse_check_button_pressed(0,mouse_button_lr) : mouse_check_button_pressed(mouse_button_lr); - if (!mouse_clicked) { - return false; - } function point_and_click_sprite(x1, y1, sprite, x_scale = 1, y_scale = 1) { var _width = sprite_get_width(sprite) * x_scale; var _height = sprite_get_height(sprite) * y_scale; diff --git a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml index 07cd391369..b478bf2eed 100644 --- a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml +++ b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml @@ -103,34 +103,6 @@ function check_navy_guard_still_live() { } } -function build_new_navy_fleet(construction_forge) { - new_navy_fleet = instance_create(construction_forge.x, construction_forge.y, obj_en_fleet); - - with (new_navy_fleet) { - owner = eFACTION.IMPERIUM; - - capital_number = 0; - frigate_number = 0; - escort_number = 1; - home_x = x; - home_y = y; - warp_able = true; - with (construction_forge) { - present_fleet[2] += 1; - } - orbiting = construction_forge; - navy = 1; - - var total_ships = 0; - total_ships += capital_number - 1; - total_ships += round((frigate_number / 2)); - total_ships += round((escort_number / 4)); - if (total_ships <= 1 && capital_number + frigate_number + escort_number > 0) { - total_ships = 1; - } - choose_fleet_sprite_image(); - image_index = total_ships; - image_speed = 0; function build_new_navy_fleet(construction_forge){ new_navy_fleet=instance_create(construction_forge.x,construction_forge.y,obj_en_fleet); @@ -144,13 +116,17 @@ function build_new_navy_fleet(construction_forge){ home_x=x; home_y=y; warp_able = true; - with (construction_forge){present_fleet[2]+=1;} + with (construction_forge){ + present_fleet[2]+=1; + } orbiting=construction_forge; navy=1; var total_ships=0; total_ships+=round(standard_fleet_strength_calc()); - if (total_ships<=1 && capital_number+frigate_number+escort_number>0) then total_ships=1; + if (total_ships<=1 && capital_number+frigate_number+escort_number>0){ + total_ships=1; + } choose_fleet_sprite_image() image_index=total_ships; image_speed=0; diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 54d79255cc..78138984a8 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -55,48 +55,6 @@ function mission_name_key(mission) { } } -#macro planet_problem_keys ["meeting_trap","meeting","succession","mech_raider","mech_bionics","mech_mars","mech_tomb1","fallen","great_crusade","harlequins","fund_elder","provide_garrison","hunt_beast","protect_raiders","join_communion","join_parade","recover_artifacts","train_forces","spyrer","inquisitor","recon","cleanse","purge","tyranid_org","artifact_loan","necron","ethereal","demon_world","deliver_trophy"] - -function mission_name_key(mission){ - var mission_key = { - "meeting_trap" : "Chaos Lord Meeting", - "meeting" : "Chaos Lord Meeting", - "succession" : "War of succession", - "mech_raider" : "Provide Land Raider to Mechanicus", - "mech_bionics" : "Provide Bionic Augmented marines to study", - "mech_mars" : "Send Techmarines to mars", - "mech_tomb1": "Explore Mechanicus Tomb", - "fallen" : "Find Chapter Fallen", - "great_crusade": "Answer Crusade Muster Call", - "harlequins" : "Harlequin presence Report", - "fund_elder" : "provide assistance to Eldar", - "provide_garrison" : "Provision Garrison", - "hunt_beast" : "Hunt Beasts", - "protect_raiders" : "Protect From Raiders", - "join_communion" : "Join Planetary Religious Celebration", - "join_parade" : "Join Parade on Planet Surface", - "recover_artifacts" : "Recover Artifacts", - "train_forces" : "Train Planet Forces", - // Inquisition missions - "spyrer" : "Kill Spyrer for Inquisitor", - "inquisitor": "Radical Inquisitor Arriving", - "recon" : "Recon Mission for Inquisitor", - "cleanse" : "Cleanse Planet for Inquisitor", - "purge": "Purge Leadership for Inquisitor", - "tyranid_org" : "Capture Tyranid for Inquisitor", - // "bomb" : "Bombard World for Inquisitor", - "artifact_loan" : "Safeguard Artifact for the Inquisition", - "necron": "Bomb Necron Tomb for Inquisitor", - "ethereal": "Capture Ethereal for Inquisitor", - "demon_world": "Clear Demon World for Inquisitor" - - } - if (struct_exists(mission_key, mission)){ - return mission_key[$ mission]; - } else{ - return "none" - } -} if p_owner[planet] != eFACTION.Imperium then exit; var planet_type= p_type[planet]; From f050edbd23dcf2fc2d3bf467e699917dcc327a14 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 16:19:32 +0100 Subject: [PATCH 37/93] enum renames --- objects/obj_controller/Alarm_6.gml | 4 ++-- scripts/scr_PlanetData/scr_PlanetData.gml | 14 ++++++------ scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 22 +++++++++---------- .../scr_fleet_functions.gml | 14 ++++++------ .../scr_forge_world_functions.gml | 2 +- scripts/scr_purge_world/scr_purge_world.gml | 8 +++---- .../scr_tau_fleet_functions.gml | 10 ++++----- 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/objects/obj_controller/Alarm_6.gml b/objects/obj_controller/Alarm_6.gml index 128a45fb9e..d2ee87e88d 100644 --- a/objects/obj_controller/Alarm_6.gml +++ b/objects/obj_controller/Alarm_6.gml @@ -53,7 +53,7 @@ if ((menu == 1) && (managing > 0)) { else if (unit.role()==_roles[19]) { vet_sgt++;} else if (unit.role()=="Codiciery") { codi+=1;} else if (unit.role()=="Lexicanum") { lexi+=1;} - else if (unit.role()==_roles[eROLE.Ancient]) { champ+=1;} + else if (unit.role()==_roles[eROLE.ANCIENT]) { champ+=1;} } // sets up count for the vehicles // TODO This needs to be extended to accomodate the selection text like the man ones @@ -91,7 +91,7 @@ if ((menu == 1) && (managing > 0)) { selecting_dudes+=", "; } if (champ>0){ - selecting_dudes+=$"{champ} {_roles[eROLE.Ancient]}"; + selecting_dudes+=$"{champ} {_roles[eROLE.ANCIENT]}"; if (chap>1) then selecting_dudes+="s"; selecting_dudes+=", "; } diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 6d0c2b2cee..f0045a74bc 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -52,7 +52,7 @@ function PlanetData(planet, system) constructor{ planet_forces[eFACTION.Ecclesiarchy] = system.p_sisters[planet]; planet_forces[eFACTION.Eldar] = system.p_eldar[planet]; planet_forces[eFACTION.Ork] = system.p_orks[planet]; - planet_forces[eFACTION.Tau] = system.p_tau[planet]; + planet_forces[eFACTION.TAU] = system.p_tau[planet]; planet_forces[eFACTION.Tyranids] = system.p_tyranids[planet]; planet_forces[eFACTION.Chaos] = system.p_chaos[planet]+ system.p_demons[planet]; planet_forces[eFACTION.Heretics] = system.p_traitors[planet]; @@ -156,7 +156,7 @@ function PlanetData(planet, system) constructor{ }; static end_turn_population_growth = function(){ - if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.Heretics] == 0) && (planet_forces[eFACTION.Tau] == 0) && (planet_forces[eFACTION.Ork] == 0) && (planet_forces[eFACTION.Necrons] == 0) && (planet_forces[eFACTION.Tyranids] == 0)) { + if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.Heretics] == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.Ork] == 0) && (planet_forces[eFACTION.Necrons] == 0) && (planet_forces[eFACTION.Tyranids] == 0)) { if (!large_population) { set_population(round(population * 1.0008)); } else if (large_population == 1) { @@ -389,7 +389,7 @@ function PlanetData(planet, system) constructor{ } contin=0; _rando=roll_dice(1,100);// This part handles the ship building - if (population>0 && pdf==0 && guardsmen==0 && planet_forces[10]==0) and (planet_forces[eFACTION.Tau]==0){ + if (population>0 && pdf==0 && guardsmen==0 && planet_forces[10]==0) and (planet_forces[eFACTION.TAU]==0){ if (!large_population){ set_population(population*0.97); }else { @@ -1436,7 +1436,7 @@ function PlanetData(planet, system) constructor{ if (strength<1) then strength=0; system.p_orks[planet]-=2; } - else if (current_owner=eFACTION.Tau) and (planet_forces[eFACTION.Tau]>0){ + else if (current_owner=eFACTION.TAU) and (planet_forces[eFACTION.TAU]>0){ strength = strength>2 ? 2 : 0; system.p_tau[planet]-=2; @@ -1711,10 +1711,10 @@ function PlanetData(planet, system) constructor{ } } - if (current_owner == eFACTION.Tau && population_influences[eFACTION.Tyranids]<70){ + if (current_owner == eFACTION.TAU && population_influences[eFACTION.Tyranids]<70){ var _influ_chance = roll_dice(1,100); if (_influ_chance <= 5 && population_influences[eFACTION.Tyranids]>=20){ - alter_influence(eFACTION.Tau, 1); + alter_influence(eFACTION.TAU, 1); } } @@ -1817,7 +1817,7 @@ function PlanetData(planet, system) constructor{ } } - if (success && (pdf == 0) && (guardsmen == 0) && (planet_forces[eFACTION.Tau] == 0) && (planet_forces[eFACTION.Ork] == 0)) { + if (success && (pdf == 0) && (guardsmen == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.Ork] == 0)) { current_owner = 10; scr_alert("red", "owner", $"{name()} has fallen to heretics!", x, y); diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 0129e33b60..cfa4bedb50 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -334,7 +334,7 @@ function scr_enemy_ai_a() { var after_combat_guard_count=p_guardsmen[_run]; var after_combat_pdf=pdf_score; var after_combat_ork_force=planet_forces[eFACTION.Ork]; - var after_combat_tau=planet_forces[eFACTION.Tau]; + var after_combat_tau=planet_forces[eFACTION.TAU]; var after_combat_traitor=traitors_score; var after_combat_csm=csm_score; if (csm_score=6.1) then csm_score=8; @@ -347,7 +347,7 @@ function scr_enemy_ai_a() { // Guard attack if (guard_score>0) and (guard_attack!="") and (guard_score>0.5){ if (guard_attack="ork") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork]; - if (guard_attack="tau") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Tau]; + if (guard_attack="tau") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.TAU]; if (guard_attack="traitors") then tempor=choose(1,2,3,4,5,6)*traitors_score; if (guard_attack="csm") then tempor=choose(2,3,4,5,6,7)*csm_score; if (guard_attack="tyranids") then tempor=choose(2,3,4,5,6,7)*tyranids_score; @@ -355,7 +355,7 @@ function scr_enemy_ai_a() { rand1=choose(1,2,3,4,5)*guard_score; if (guard_attack="ork") and (planet_forces[eFACTION.Ork]>guard_score) then rand1=0; - if (guard_attack="tau") and (planet_forces[eFACTION.Tau]>guard_score) then rand1=0; + if (guard_attack="tau") and (planet_forces[eFACTION.TAU]>guard_score) then rand1=0; if (guard_attack="traitors") and (traitors_score>guard_score) then rand1=0; if (guard_attack="csm") and (csm_score>guard_score) then rand1=0; if (guard_attack="tyranids") and (tyranids_score>guard_score) then rand1=0; @@ -406,7 +406,7 @@ function scr_enemy_ai_a() { // PDF attack if ((pdf_score>0) and (pdf_attack!="")) or ((pdf_score>1) and (guard_score<0.5)){ if (pdf_attack="ork") then tempor=planet_forces[eFACTION.Ork]; - if (pdf_attack="tau") then tempor=planet_forces[eFACTION.Tau]; + if (pdf_attack="tau") then tempor=planet_forces[eFACTION.TAU]; if (pdf_attack="traitors") then tempor=traitors_score; if (pdf_attack="csm") then tempor=csm_score; if (pdf_attack="guard") then tempor=guard_score; @@ -450,7 +450,7 @@ function scr_enemy_ai_a() { rand1=choose(2,3,4,5,6)*sisters_score; if (sisters_attack="tau"){ - rand2=(choose(2,3,4,5)*planet_forces[eFACTION.Tau])*choose(1,1.25); + rand2=(choose(2,3,4,5)*planet_forces[eFACTION.TAU])*choose(1,1.25); if (rand1>rand2) then after_combat_tau-=1; }else if(sisters_attack="ork"){ rand2=(choose(2,3,4,5)*planet_forces[eFACTION.Ork])*choose(1,1.25); @@ -484,8 +484,8 @@ function scr_enemy_ai_a() { } // Tau attack - if (planet_forces[eFACTION.Tau]>0) and (tau_attack!="") and (tau_attack!="player"){ - rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Tau]; + if (planet_forces[eFACTION.TAU]>0) and (tau_attack!="") and (tau_attack!="player"){ + rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.TAU]; if (tau_attack="ork"){ rand2=(choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork])*choose(1,1.25); @@ -500,14 +500,14 @@ function scr_enemy_ai_a() { }else if (tau_attack="guard"){ rand2=(choose(1,2,3,4,5,6)*guard_score)*choose(1,1.25); if (rand1>rand2){ - if (planet_forces[eFACTION.Tau]<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.7); - if (planet_forces[eFACTION.Tau]>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); + if (planet_forces[eFACTION.TAU]<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.7); + if (planet_forces[eFACTION.TAU]>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); } }else if (tau_attack="pdf"){ rand2=(choose(1,2,3,4,5,6)*pdf_score)*choose(1,1.25); if (rand1>rand2){ - if (planet_forces[eFACTION.Tau]<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.7+pdf_loss_reduction))); - if (planet_forces[eFACTION.Tau]>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.55+pdf_loss_reduction))); + if (planet_forces[eFACTION.TAU]<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.7+pdf_loss_reduction))); + if (planet_forces[eFACTION.TAU]>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.55+pdf_loss_reduction))); } }else if (tau_attack="sisters"){ rand2=(choose(1,2,3,4,5,6)*sisters_score)*choose(1,1.25); diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 286f8e0e37..a9c72f98b7 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -681,7 +681,7 @@ function fleet_arrival_logic() { arrival_logic_finished = false; - // cur_star.present_fleets+=1;if (owner = eFACTION.Tau) then cur_star.tau_fleets+=1; + // cur_star.present_fleets+=1;if (owner = eFACTION.TAU) then cur_star.tau_fleets+=1; if (owner == eFACTION.Mechanicus){ @@ -831,7 +831,7 @@ function fleet_arrival_logic() { if (obj_controller.known[eFACTION.Inquisition]=0) then obj_controller.known[eFACTION.Inquisition]=1; } - else if (owner=eFACTION.Tau) { + else if (owner=eFACTION.TAU) { if (instance_exists(obj_p_ship)){ var p_ship=instance_nearest(x,y,obj_p_ship); @@ -892,8 +892,8 @@ function fleet_arrival_logic() { var _attempt_merge = _same_owner && _other_fleet_strength + _fleet_strength <= 9; - if (_same_owner && !_attempt_merge && owner==eFACTION.Tau){ - var _faction_check = obj_controller.faction_status[eFACTION.Tau]=="War" ? 1 : 2; + if (_same_owner && !_attempt_merge && owner==eFACTION.TAU){ + var _faction_check = obj_controller.faction_status[eFACTION.TAU]=="War" ? 1 : 2; var _len = _faction_check == 1 ? 3 : 4; if (array_sum(orbiting.present_fleet,0,_faction_check,_len)>0){ _attempt_merge=true; @@ -923,7 +923,7 @@ function fleet_arrival_logic() { //if fleet is damaged but existing fleet is too large to merge feck off elsewhere preferably somewhere friendly - else if (_same_owner && (owner == eFACTION.Tau || (owner = eFACTION.Chaos && !csm))){// Move somewhere new + else if (_same_owner && (owner == eFACTION.TAU || (owner = eFACTION.Chaos && !csm))){// Move somewhere new if (standard_fleet_strength_calc()<3){ @@ -953,7 +953,7 @@ function fleet_arrival_logic() { } } - if (owner=eFACTION.Tau && !arrival_logic_finished) { + if (owner=eFACTION.TAU && !arrival_logic_finished) { //so i'mjust sort of crudely interpreting things how i think duke meant to make it @@ -1157,7 +1157,7 @@ function merge_fleets(main_fleet, merge_fleet){ //This bit allseems a bit superfluouse but keepingjust in case it breaks something] var _is_orbiting = is_orbiting(merge_fleet); switch(merge_fleet.owner){ - case eFACTION.Tau: + case eFACTION.TAU: obj_controller.tau_fleets--; if (_is_orbiting){ merge_fleet.orbiting.tau_fleets--; diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index 2099a03747..f825826a79 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -70,7 +70,7 @@ function get_imperium_forge_systems(){ var enemy_fleets = [ eFACTION.Ork, - eFACTION.Tau, + eFACTION.TAU, eFACTION.Tyranids, eFACTION.Chaos, eFACTION.Necrons diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index 252e70ca7b..04c8e2c944 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -51,12 +51,12 @@ function scr_purge_world(action_type, action_score) { } } - var heres_before = max(total_corruption(),population_influences[eFACTION.Tau],population_influences[eFACTION.Tyranids]);// Starting heresy + var heres_before = max(total_corruption(),population_influences[eFACTION.TAU],population_influences[eFACTION.Tyranids]);// Starting heresy var heres_target = "corruption"; - if (max(population_influences[eFACTION.Tau],population_influences[eFACTION.Tyranids]) > total_corruption()){ - if (population_influences[eFACTION.Tau]>population_influences[eFACTION.Tyranids]){ + if (max(population_influences[eFACTION.TAU],population_influences[eFACTION.Tyranids]) > total_corruption()){ + if (population_influences[eFACTION.TAU]>population_influences[eFACTION.Tyranids]){ heres_target = "tau"; } else{ heres_target = "genestealers"; @@ -319,7 +319,7 @@ function scr_purge_world(action_type, action_score) { if (heres_target == "corruption"){ alter_corruption(-influence_reduction); }else if (heres_target == "tau"){ - alter_influence(eFACTION.Tau , -influence_reduction); + alter_influence(eFACTION.TAU , -influence_reduction); }else if (heres_target == "genestealers"){ alter_influence(eFACTION.Tyranids , -influence_reduction); } diff --git a/scripts/scr_tau_fleet_functions/scr_tau_fleet_functions.gml b/scripts/scr_tau_fleet_functions/scr_tau_fleet_functions.gml index e6f954bdee..425b9c1150 100644 --- a/scripts/scr_tau_fleet_functions/scr_tau_fleet_functions.gml +++ b/scripts/scr_tau_fleet_functions/scr_tau_fleet_functions.gml @@ -8,19 +8,19 @@ function tau_broadcast_propaganda_to_planet(){ if (p_type[tau_influence_planet]!="Dead"){ scr_alert("green","owner",$"Tau ship broadcasts subversive messages to {planet_numeral_name(tau_influence_planet)}.",sta.x,sta.y); - tau_influence = p_influence[tau_influence_planet][eFACTION.Tau] + tau_influence = p_influence[tau_influence_planet][eFACTION.TAU] if (tau_influence_chance<=70) and (tau_influence<70){ - adjust_influence[tau_influence_planet](eFACTION.Tau, 10, tau_influence_planet); + adjust_influence[tau_influence_planet](eFACTION.TAU, 10, tau_influence_planet); if (p_type[tau_influence_planet]=="Forge"){ - adjust_influence(eFACTION.Tau, -5, tau_influence_planet); + adjust_influence(eFACTION.TAU, -5, tau_influence_planet); } } if (tau_influence_chance<=3) and (tau_influence<70){ - adjust_influence(eFACTION.Tau, 30, tau_influence_planet); + adjust_influence(eFACTION.TAU, 30, tau_influence_planet); if (p_type[tau_influence_planet]=="Forge"){ - adjust_influence(eFACTION.Tau, -25, tau_influence_planet); + adjust_influence(eFACTION.TAU, -25, tau_influence_planet); } } } From 00ba73b7b35ed0a902a541634bda7b62bca7c699 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 16:21:50 +0100 Subject: [PATCH 38/93] purge scripts that ake sense --- scripts/scr_purge_world/scr_purge_world.gml | 192 ++++---------------- 1 file changed, 31 insertions(+), 161 deletions(-) diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index 04c8e2c944..5fbd95d2a1 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -3,15 +3,11 @@ function scr_purge_world(action_type, action_score) { var population_reduction_percentage,influence_reduction, max_kill, heres_before, heres_after, kill; var isquest=0,thequest="",questnum=0,pop_after=0,txt1="",txt2="",overkill=0; - instance_deactivate_all(true); - instance_activate_object(obj_controller); - instance_activate_object(obj_ini); - instance_activate_object(obj_drop_select); var _pop_before = population; var _no_chaos = (planet_forces[eFACTION.Heretics] + planet_forces[eFACTION.Chaos])==0 if ((action_type==DropType.PurgeFire || action_type==DropType.PurgeSelective) && _no_chaos && obj_controller.turn>=obj_controller.chaos_turn){ - if (has_feature(eP_FEATURES.WARLORD10) && obj_controller.known[10]=0 && obj_controller.faction_gender[10]=1){ + if (has_feature(P_features.Warlord10) && obj_controller.known[10]=0 && obj_controller.faction_gender[10]=1){ with(obj_drop_select){ var pop=instance_create(0,0,obj_popup); pop.image="chaos_symbol"; @@ -20,7 +16,7 @@ function scr_purge_world(action_type, action_score) { exit; } } - if (has_feature(eP_FEATURES.WARLORD10) && obj_controller.known[10]>=2 && obj_controller.faction_gender[10]=1){ + if (has_feature(P_features.Warlord10) && obj_controller.known[10]>=2 && obj_controller.faction_gender[10]=1){ with(obj_drop_select){ attacking=10; @@ -51,12 +47,12 @@ function scr_purge_world(action_type, action_score) { } } - var heres_before = max(total_corruption(),population_influences[eFACTION.TAU],population_influences[eFACTION.Tyranids]);// Starting heresy + var heres_before = max(total_corruption(),population_influences[eFACTION.Tau],population_influences[eFACTION.Tyranids]);// Starting heresy var heres_target = "corruption"; - if (max(population_influences[eFACTION.TAU],population_influences[eFACTION.Tyranids]) > total_corruption()){ - if (population_influences[eFACTION.TAU]>population_influences[eFACTION.Tyranids]){ + if (max(population_influences[eFACTION.Tau],population_influences[eFACTION.Tyranids]) > total_corruption()){ + if (population_influences[eFACTION.Tau]>population_influences[eFACTION.Tyranids]){ heres_target = "tau"; } else{ heres_target = "genestealers"; @@ -64,19 +60,8 @@ function scr_purge_world(action_type, action_score) { } - // TODO - while I don't expect Surface to Orbit weapons retaliating against player's purge bombardment, it might still be worthwhile to consider possible situations - if (action_type == eDROP_TYPE.PURGEBOMBARD) { - // Bombardment - txt1 = choose("Your cruiser and larger ship", "The heavens rumble and thunder as your ship"); - if (ships_selected > 1) { - txt1 += "s"; - } - txt1 += choose(" position themselves over the target in close orbit, and unleash", " unload"); - if (ships_selected == 1) { - txt1 += "s"; - } - txt1 += $" annihilation upon {planet_numeral_name(planet, star)}. Even from space the explosions can be seen, {choose("tearing ground", "hammering", "battering", "thundering")} across the planet's surface."; + // TODO - while I don't expect Surface to Orbit weapons retaliating against player's purge bombardment, it might still be worthwhile to consider possible situations if (action_type=DropType.PurgeBombard){// Bombardment var _ship = string_plural("ship",ships_selected); @@ -139,19 +124,11 @@ function scr_purge_world(action_type, action_score) { } scr_audience(eFACTION.Inquisition, "bombard_angry", _disp_hit, "", 0, 0); - // Minimum kills - if (pop_before > 0) { - overkill = max(pop_before * 0.1, ((heres_before / 200) * pop_before)); - } - if (pop_before == 0) { - overkill = 0; - } + } - kill = min(max_kill, overkill, pop_before); // How many people ARE going to be killed + + } - pop_after = pop_before - kill; - sci1 = 0; - sci2 = 0; if (action_type=DropType.PurgeFire){// Burn baby burn var i=0; @@ -205,15 +182,15 @@ function scr_purge_world(action_type, action_score) { } var nid_influence = population_influences[eFACTION.Tyranids]; - if (has_feature( eP_FEATURES.GENE_STEALER_CULT)) { - var cult = get_features(eP_FEATURES.GENE_STEALER_CULT)[0]; + if (has_feature( P_features.Gene_Stealer_Cult)) { + var cult = get_features(P_features.Gene_Stealer_Cult)[0]; if (cult.hiding) { } } else { if (nid_influence > 25) { txt1 += " Scores of mutant offspring from a genestealer infestation are burnt, while we have damaged their influence over this world, the mutants appear to lack the organisation of a true cult"; - adjust_influence(eFACTION.TYRANIDS, -10, planet, star); + adjust_influence(eFACTION.Tyranids, -10, planet, star); } else if (nid_influence > 0) { txt1 += " There are signs of a genestealer infestation but the cultists are too unorganized to do any real damage to their influence on this world"; } @@ -230,18 +207,14 @@ function scr_purge_world(action_type, action_score) { } } - if (action_type == eDROP_TYPE.PURGESELECTIVE) { - // Blam! - var i = 0; - if (has_problem_planet(planet, "purge", star)) { - isquest = 1; - thequest = "purge"; - questnum = i; - } - if (isquest == 1) { - if ((thequest == "purge") && (action_score >= 10)) { - remove_planet_problem(planet, "purge", star); + if (action_type=DropType.PurgeSelective){// Blam! + var i=0; + if (has_problem_planet(planet, "purge", star)){ + isquest=1; + thequest="purge"; + questnum=i; + } if (isquest=1){ if (thequest="purge" && action_score>=10){ @@ -294,20 +267,7 @@ function scr_purge_world(action_type, action_score) { } } - txt1 = "Your marines drop fast and hard, blowing through guards and mercenaries with minimal resistance. Before ten minutes have passed all your targets are executed."; - scr_event_log("", "Inquisition Mission Completed: The unruly Nobles of " + string(star.name) + " " + string(scr_roman(planet)) + " have been purged."); - scr_gov_disp(star.name, planet, choose(1, 2, 3)); - } - } else if (isquest == 0) { - // TODO add more variation, with planets, features, possibly marine equipment - txt1 = choose($"Your marines move across {star.name} {scr_roman(planet)}, searching for high profile targets. Once found, they are dragged outside from their lairs. Their execution would soon follow.", $"Your marines move across {star.name} {scr_roman(planet)}, rooting out sources of corruption. Heretics are dragged from their lairs and executed in the streets."); - if (star.p_large[planet] == 0) { - max_kill = action_score * 30; - } // Population if normal - if (star.p_large[planet] == 1) { - max_kill = 0; - } // Population if large if (action_type=DropType.PurgeAssassinate){ assasinate_governor_setup(); @@ -319,7 +279,7 @@ function scr_purge_world(action_type, action_score) { if (heres_target == "corruption"){ alter_corruption(-influence_reduction); }else if (heres_target == "tau"){ - alter_influence(eFACTION.TAU , -influence_reduction); + alter_influence(eFACTION.Tau , -influence_reduction); }else if (heres_target == "genestealers"){ alter_influence(eFACTION.Tyranids , -influence_reduction); } @@ -342,107 +302,17 @@ function scr_purge_world(action_type, action_score) { } } - if (spec1 == 0) { - spec2 = choose(1, 2, 3, 4, 5, 5, 5); - if (spec2 == 1) { - txt += "Their still-living body is disintegrated by acid. "; - } - if (spec2 == 2) { - txt += "The Governor is jettisoned into the local star at the first opporunity. "; - } - if (spec2 == 3) { - txt += string(choose("He", "He", "She")) + " is burned as fuel for one of your vessels. "; - } - if (spec2 == 4) { - txt += "A few grenades is all it takes to blow " + string(choose("his", "his", "her")) + " body to smithereens. "; - } - if (spec2 == 5) { - txt += string(choose("He", "He", "She")) + " is executed in a mundane fashion and buried. "; - } - } - - txt += "What is thy will?"; - - var pip = instance_create(0, 0, obj_popup); - pip.title = "Planetary Governor Assassinated"; - pip.text = txt; - pip.planet = planet; - pip.p_data = new PlanetData(planet, star); - var options = [ - { - str1: "Allow the official successor to become Planetary Governor.", - choice_func: allow_governor_successor, - }, - { - str1: "Ensure that a sympathetic successor will be the one to rule.", - choice_func: install_sympathetic_successor, - }, - { - str1: "Remove all successors and install a loyal Chapter Serf.", - choice_func: install_chapter_surf, - } - ]; - pip.add_option(options); - pip.cooldown = 20; - - // Result- this is the multiplier for the chance of discovery with the inquisition, can also be used to determine - // the new Governor disposition if they are the official successor - if (aroll < chance) { - // Discovered - pip.estimate = 2; - } else if (aroll >= chance) { - // Success - pip.estimate = 1; - } - // If there are enemy non-chaos forces then they may be used as a cover - // Does not work with chaos because if the governor dies, with chaos present, the new governor would possibly be investigated - if ((star.p_orks[planet] >= 4) || (star.p_necrons[planet] >= 3) || (star.p_tyranids[planet] >= 5)) { - pip.estimate = pip.estimate * 0.5; - } - } - - if (action_type != eDROP_TYPE.PURGEASSASSINATE) { - if (isquest == 0) { - // DO EET - txt2 = txt1; - star.p_heresy[planet] -= sci2; - star.p_influence[planet][eFACTION.TAU] -= sci2; - if (action_type < eDROP_TYPE.PURGESELECTIVE) { - star.p_population[planet] = pop_after; - } - if ((action_type == eDROP_TYPE.PURGESELECTIVE) && (star.p_large[planet] == 0)) { - star.p_population[planet] = pop_after; - } - if (star.p_heresy[planet] < 0) { - star.p_heresy[planet] = 0; - } - if (star.p_influence[planet][eFACTION.TAU] < 0) { - star.p_influence[planet][eFACTION.TAU] = 0; - } + if instance_exists(obj_drop_select){ + if (instance_exists(sh_target)){ + sh_target.acted=5; + } + with(obj_drop_select){ + instance_destroy(); + } + instance_destroy(); + } + - var pip = instance_create(0, 0, obj_popup); - pip.title = "Purge Results"; - pip.text = txt2; - } - if (isquest == 1) { - // DO EET - var pip; - pip = instance_create(0, 0, obj_popup); - pip.title = "Inquisition Mission Completed"; - pip.text = txt1; - pip.image = "inquisition"; - // scr_event_log("","Inquisition Mission Completed: The unruly nobles of "+string(star.name)+" "+string(scr_roman(planet))+" have been silenced."); - } - } - - if (instance_exists(obj_drop_select)) { - if (instance_exists(sh_target)) { - sh_target.acted = 5; - } - with (obj_drop_select) { - instance_destroy(); - } - instance_destroy(); - } } + From 4d2196e8860752da8ebcc7825d22374b75855fb6 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 16:25:49 +0100 Subject: [PATCH 39/93] update drop types --- scripts/scr_purge_world/scr_purge_world.gml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index 5fbd95d2a1..8705572fd6 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -6,13 +6,13 @@ function scr_purge_world(action_type, action_score) { var _pop_before = population; var _no_chaos = (planet_forces[eFACTION.Heretics] + planet_forces[eFACTION.Chaos])==0 - if ((action_type==DropType.PurgeFire || action_type==DropType.PurgeSelective) && _no_chaos && obj_controller.turn>=obj_controller.chaos_turn){ + if ((action_type==eDROPTYPE.PURGEFIRE || action_type==eDROPTYPE.PURGESELECTIVE) && _no_chaos && obj_controller.turn>=obj_controller.chaos_turn){ if (has_feature(P_features.Warlord10) && obj_controller.known[10]=0 && obj_controller.faction_gender[10]=1){ with(obj_drop_select){ var pop=instance_create(0,0,obj_popup); pop.image="chaos_symbol"; pop.title="Concealed Heresy"; - pop.text=$"Your astartes set out and begin to cleanse {planet_numeral_name(planet, star)} of possible heresy. The general populace appears to be devout in their faith, but a disturbing trend appears- the odd citizen cursing your forces, frothing at the mouth, and screaming out heresy most foul. One week into the cleansing a large hostile force is detected approaching and encircling your forces."; + pop.text=$"Your astartes set out and begin to cleanse {name()} of possible heresy. The general populace appears to be devout in their faith, but a disturbing trend appears- the odd citizen cursing your forces, frothing at the mouth, and screaming out heresy most foul. One week into the cleansing a large hostile force is detected approaching and encircling your forces."; exit; } } @@ -63,7 +63,7 @@ function scr_purge_world(action_type, action_score) { // TODO - while I don't expect Surface to Orbit weapons retaliating against player's purge bombardment, it might still be worthwhile to consider possible situations - if (action_type=DropType.PurgeBombard){// Bombardment + if (action_type=eDROPTYPE.PURGEBOMBARD){// Bombardment var _ship = string_plural("ship",ships_selected); txt1=choose($"Your cruiser and larger {_ship}", $"The heavens rumble and thunder as your {_ship}"); txt1+=choose(" position themselves over the target in close orbit, and unleash", " unload"); @@ -130,7 +130,7 @@ function scr_purge_world(action_type, action_score) { } - if (action_type=DropType.PurgeFire){// Burn baby burn + if (action_type=eDROPTYPE.PURGEFIRE){// Burn baby burn var i=0; if (has_problem("cleanse")){ isquest=1; @@ -208,7 +208,7 @@ function scr_purge_world(action_type, action_score) { } - if (action_type=DropType.PurgeSelective){// Blam! + if (action_type=eDROPTYPE.PURGESELECTIVE){// Blam! var i=0; if (has_problem_planet(planet, "purge", star)){ isquest=1; @@ -269,11 +269,11 @@ function scr_purge_world(action_type, action_score) { - if (action_type=DropType.PurgeAssassinate){ + if (action_type=eDROPTYPE.PURGEASSASSINATE){ assasinate_governor_setup(); } - if (action_type!=DropType.PurgeAssassinate){ + if (action_type!=eDROPTYPE.PURGEASSASSINATE){ if (isquest=0){// DO EET txt2=txt1; if (heres_target == "corruption"){ @@ -284,10 +284,10 @@ function scr_purge_world(action_type, action_score) { alter_influence(eFACTION.Tyranids , -influence_reduction); } - if (action_type Date: Wed, 22 Apr 2026 16:35:20 +0100 Subject: [PATCH 40/93] spaceing --- .../scr_imperial_navy_functions.gml | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml index b478bf2eed..2f773e87c8 100644 --- a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml +++ b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml @@ -105,34 +105,34 @@ function check_navy_guard_still_live() { function build_new_navy_fleet(construction_forge){ - new_navy_fleet=instance_create(construction_forge.x,construction_forge.y,obj_en_fleet); - - with(new_navy_fleet){ - owner=eFACTION.Imperium; - - capital_number=0; - frigate_number=0; - escort_number=1; - home_x=x; - home_y=y; - warp_able = true; - with (construction_forge){ - present_fleet[2]+=1; - } - orbiting=construction_forge; - navy=1; - - var total_ships=0; - total_ships+=round(standard_fleet_strength_calc()); - if (total_ships<=1 && capital_number+frigate_number+escort_number>0){ - total_ships=1; - } - choose_fleet_sprite_image() - image_index=total_ships; - image_speed=0; - - trade_goods="building_ships"; - } + new_navy_fleet=instance_create(construction_forge.x,construction_forge.y,obj_en_fleet); + + with(new_navy_fleet){ + owner=eFACTION.Imperium; + + capital_number=0; + frigate_number=0; + escort_number=1; + home_x=x; + home_y=y; + warp_able = true; + with (construction_forge){ + present_fleet[2]+=1; + } + orbiting=construction_forge; + navy=1; + + var total_ships=0; + total_ships+=round(standard_fleet_strength_calc()); + if (total_ships<=1 && capital_number+frigate_number+escort_number>0){ + total_ships=1; + } + choose_fleet_sprite_image() + image_index=total_ships; + image_speed=0; + + trade_goods="building_ships"; + } } /// @mixin From 9d0ca6f37029adc3906064932fe5513e27dda85a Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 16:37:57 +0100 Subject: [PATCH 41/93] navy finishedd --- .../scr_imperial_navy_functions.gml | 82 +++++++++---------- 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml index 2f773e87c8..4053d10258 100644 --- a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml +++ b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml @@ -136,70 +136,64 @@ function build_new_navy_fleet(construction_forge){ } /// @mixin -function new_navy_ships_forge() { - if (trade_goods == "building_ships") { - var onceh = 0, advance = false, p = 0; - - p = 0; +function new_navy_ships_forge(){ + if (trade_goods=="building_ships"){ + var onceh=0,advance=false,p=0; + + p=0; is_orbiting(); - for (var p = 1; p <= orbiting.planets; p++) { - if (orbiting.p_type[p] == "Forge") { + for (var p=1;p<=orbiting.planets;p++){ + if (orbiting.p_type[p]="Forge"){ //if no non-imperium,player, or eldar aligned fleets or ground forces, continue - if (orbiting.p_orks[p] + orbiting.p_chaos[p] + orbiting.p_tyranids[p] + orbiting.p_necrons[p] + orbiting.p_tau[p] + orbiting.p_traitors[p] == 0) { - if (orbiting.present_fleet[7] + orbiting.present_fleet[8] + orbiting.present_fleet[9] + orbiting.present_fleet[10] + orbiting.present_fleet[13] == 0) { - advance = 1; + if (orbiting.p_orks[p]+orbiting.p_chaos[p]+orbiting.p_tyranids[p]+orbiting.p_necrons[p]+orbiting.p_tau[p]+orbiting.p_traitors[p]=0){ + if (orbiting.present_fleet[7]+orbiting.present_fleet[8]+orbiting.present_fleet[9]+orbiting.present_fleet[10]+orbiting.present_fleet[13]=0){ + advance=1; } } - } + } } - - if (!advance) { + + if (!advance){ exit; } - //TODO here we can make fleet be restored more quickly by better forge worlds - if (escort_number < 12) { - escort_number += 1; - } else if (frigate_number < 5) { - frigate_number += 0.25; - onceh = 1; - if (frigate_number > 4.99) { - frigate_number = 5; - } - } else if (capital_number < 1) { - capital_number += 0.0834; - if (capital_number > 1) { - capital_number = 1; - } + //TODO here we can make fleet be restored more quickly by better forge worlds + if (escort_number<12) { + escort_number+=1; } - if (onceh == 1) { - var ii = 0; - ii += capital_number; - ii += round((frigate_number / 2)); - ii += round((escort_number / 4)); - image_index = ii <= 1 ? 1 : ii; + else if (frigate_number<5) { + frigate_number+=0.25; + onceh=1; + if (frigate_number>4.99) then frigate_number=5; + } + + else if (capital_number<1) { + capital_number+=0.0834; + if (capital_number>1) then capital_number=1; } if (onceh=1){ var ii=round(standard_fleet_strength_calc()); - if (capital_number >= 1 && frigate_number >= 5 && escort_number >= 12) { - var i = -1; - repeat (capital_number) { - i += 1; - capital_max_imp[i] = (((floor(random(15)) + 1) * 1000000) + 15000000) * 2; + image_index=ii<=1?1:ii; + } + + if (capital_number>=1 && frigate_number>=5 && escort_number>=12){ + var i=-1; + repeat(capital_number){i+=1; + capital_max_imp[i]=(((floor(random(15))+1)*1000000)+15000000)*2; } - i = -1; - repeat (frigate_number) { - i += 1; - frigate_max_imp[i] = (500000 + (floor(random(50)) + 1) * 10000) * 2; + i=-1; + repeat(frigate_number){i+=1; + frigate_max_imp[i]=(500000+(floor(random(50))+1)*10000)*2; } - trade_goods = ""; + trade_goods=""; } + //if (trade_goods="building_ships" || !advance) then exit; end_sequence_finished = true; - } + } } //TODO further breakup into a nvay fleet functions script From b11e11ed611b227f297fc8aac4f8927679e10543 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 16:45:29 +0100 Subject: [PATCH 42/93] mission repair part 1 --- .../scr_mission_functions.gml | 116 ++++++++++-------- 1 file changed, 65 insertions(+), 51 deletions(-) diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 78138984a8..360ef8e51d 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -55,59 +55,73 @@ function mission_name_key(mission) { } } - - if p_owner[planet] != eFACTION.Imperium then exit; - var planet_type= p_type[planet]; - if (problem == ""){ - if (planet_type=="Death"){ - problem = choose("hunt_beast", "provide_garrison"); - accept_time = 6+irandom(30); - } else if (planet_type == "Hive"){ - problem = choose("show_of_power", "provide_garrison", "purge_enemies", "raid_black_market"); - } else if (planet_type == "Temperate"){ - problem = choose("provide_garrison", "train_forces", "join_parade"); - }else if (planet_type == "Shrine"){ - problem = choose("provide_garrison", "join_communion"); - }else if (planet_type == "Ice"){ - problem = choose("provide_garrison", "hunt_beast"); - }else if (planet_type == "Lava"){ - problem = choose("provide_garrison", "protect_raiders"); - }else if (planet_type == "Agri"){ - problem = choose("provide_garrison", "protect_raiders", "recover_artifacts"); - }else if (planet_type == "Desert"){ - problem = choose("provide_garrison", "protect_raiders", "recover_artifacts"); - }else if (planet_type == "Feudal"){ - problem = choose("hunt_beast", "protect_raiders"); - } - } - var mission_data = { - stage : "preliminary", - applicant : "Governor" - }; - if (problem != ""){ - if (problem == "provide_garrison"){ - if (system_garrison[planet].garrison_force){ - exit; - } - mission_data.reason = choose("stability", "importance"); - } else if (problem=="purge_enemies"){ - var enemy = 0; - if (planets>1){ - for (var i=1;i<=planets;i++){ - if (i=planet) then continue; - if (p_owner[i]==eFACTION.Imperium){ - enemy=i; - break; - } - } - } - mission_data.target=enemy; - if (!enemy) then exit; - } - add_new_problem(planet,problem, 20+irandom(20), ,mission_data); - } +function scr_new_governor_mission(planet, problem = "") { + if (p_owner[planet] != eFACTION.IMPERIUM) { + exit; + } + var planet_type = p_type[planet]; + if (problem == "") { + if (planet_type == "Death") { + problem = choose("hunt_beast", "provide_garrison"); + accept_time = 6 + irandom(30); + } else if (planet_type == "Hive") { + problem = choose("show_of_power", "provide_garrison", "purge_enemies", "raid_black_market"); + } else if (planet_type == "Temperate") { + problem = choose("provide_garrison", "train_forces", "join_parade"); + } else if (planet_type == "Shrine") { + problem = choose("provide_garrison", "join_communion"); + } else if (planet_type == "Ice") { + problem = choose("provide_garrison", "hunt_beast"); + } else if (planet_type == "Lava") { + problem = choose("provide_garrison", "protect_raiders"); + } else if (planet_type == "Agri") { + problem = choose("provide_garrison", "protect_raiders", "recover_artifacts"); + } else if (planet_type == "Desert") { + problem = choose("provide_garrison", "protect_raiders", "recover_artifacts"); + } else if (planet_type == "Feudal") { + problem = choose("hunt_beast", "protect_raiders"); + } + } + var mission_data = { + stage: "preliminary", + applicant: "Governor", + }; + if (problem != "") { + if (problem == "provide_garrison") { + if (system_garrison[planet - 1].garrison_force) { + exit; + } + mission_data.reason = choose("stability", "importance"); + } else if (problem == "purge_enemies") { + var enemy = 0; + if (planets > 1) { + for (var i = 1; i <= planets; i++) { + if (i == planet) { + continue; + } + if (p_owner[i] == eFACTION.IMPERIUM) { + enemy = i; + break; + } + } + } + mission_data.target = enemy; + if (!enemy) { + exit; + } + } + add_new_problem(planet, problem, 20 + irandom(20),, mission_data); + } } +function init_marine_acting_strange() { + LOGGER.info("RE: Strange Behavior"); + var marine_and_company = scr_random_marine("", 0); + if (marine_and_company == "none") { + LOGGER.error("RE: Strange Behavior, couldn't pick a space marine"); + exit; + } + var unit = fetch_unit(marine_and_company); var role = unit.role(); var text = unit.name_role(); From 0f9fecae17f71d2e8c90c04e88381c6e53b779e4 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 16:46:51 +0100 Subject: [PATCH 43/93] mission duplicate --- .../scr_mission_functions.gml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 360ef8e51d..da8381ca3a 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -248,21 +248,6 @@ function protect_raiders_hold_memorial() { text = $"You prepare to have a large public memorial for your fallen marines on the planet surface as a show of defiance. The chapter are pleased by such an act and the population of the planet are mesmerized by the spectacle. The governor is furious not only has his incompetence to deal with the planets xenos issue been made public in such a way that the sector commander has now heard about it but he perceives his failures are being paraded in font of him\n nGovernor Disposition : -30"; } -function init_train_forces_mission(planet, star, mission_slot, marine) { - var _pdata = new PlanetData(planet, star); - var mission_data = _pdata.problems_data[mission_slot]; - if (mission_data.stage == "preliminary") { - var numeral_name = _pdata.name(); - mission_data.stage = "active"; - var _mission_length = irandom_range(3, 12); - star.p_timer[planet][mission_slot] = _mission_length; - //pop.image="ancient_ruins"; - var gar_pop = instance_create(0, 0, obj_popup); - //TODO some new universal methods for popups - gar_pop.title = $"Training forces on {numeral_name} begins"; - gar_pop.text = $"{marine.name_role()} Has taken leave of his current post in order to aid the governor of {numeral_name} and his pdf commanders with training local forces and bolstering defences."; - var _is_cap = role_compare(marine, eROLE.CAPTAIN); - function init_garrison_mission(planet, star, mission_slot){ var problems_data = star.p_problem_other_data[planet] var mission_data = problems_data[mission_slot]; From ed3586b14614c6a8dc5090c993b9dcabd782d4bb Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 16:51:48 +0100 Subject: [PATCH 44/93] more ennum catchup --- objects/obj_en_fleet/Alarm_1.gml | 2 +- scripts/scr_PlanetData/scr_PlanetData.gml | 52 +++++++++---------- scripts/scr_cheatcode/scr_cheatcode.gml | 2 +- .../scr_draw_planet_features.gml | 4 +- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 8 +-- scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml | 2 +- .../scr_forge_world_functions.gml | 2 +- .../scr_planetary_feature.gml | 4 +- scripts/scr_purge_world/scr_purge_world.gml | 12 ++--- 9 files changed, 44 insertions(+), 44 deletions(-) diff --git a/objects/obj_en_fleet/Alarm_1.gml b/objects/obj_en_fleet/Alarm_1.gml index 6464bb27da..00bd72488e 100644 --- a/objects/obj_en_fleet/Alarm_1.gml +++ b/objects/obj_en_fleet/Alarm_1.gml @@ -381,7 +381,7 @@ if (_is_orbiting) { frigate_number-=new_fleet.frigate_number; escort_number-=new_fleet.escort_number; - new_fleet.owner=eFACTION.Tyranids; + new_fleet.owner=eFACTION.TYRANIDS; new_fleet.sprite_index=spr_fleet_tyranid; new_fleet.image_index=1; diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index f0045a74bc..5a7cc972e9 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -53,7 +53,7 @@ function PlanetData(planet, system) constructor{ planet_forces[eFACTION.Eldar] = system.p_eldar[planet]; planet_forces[eFACTION.Ork] = system.p_orks[planet]; planet_forces[eFACTION.TAU] = system.p_tau[planet]; - planet_forces[eFACTION.Tyranids] = system.p_tyranids[planet]; + planet_forces[eFACTION.TYRANIDS] = system.p_tyranids[planet]; planet_forces[eFACTION.Chaos] = system.p_chaos[planet]+ system.p_demons[planet]; planet_forces[eFACTION.Heretics] = system.p_traitors[planet]; @@ -156,7 +156,7 @@ function PlanetData(planet, system) constructor{ }; static end_turn_population_growth = function(){ - if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.Heretics] == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.Ork] == 0) && (planet_forces[eFACTION.Necrons] == 0) && (planet_forces[eFACTION.Tyranids] == 0)) { + if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.Heretics] == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.Ork] == 0) && (planet_forces[eFACTION.Necrons] == 0) && (planet_forces[eFACTION.TYRANIDS] == 0)) { if (!large_population) { set_population(round(population * 1.0008)); } else if (large_population == 1) { @@ -166,7 +166,7 @@ function PlanetData(planet, system) constructor{ } static alter_influence = function(faction,value){ - adjust_influence(eFACTION.Tyranids, -1, planet,system); + adjust_influence(eFACTION.TYRANIDS, -1, planet,system); population_influences = system.p_influence[planet]; } @@ -1058,7 +1058,7 @@ function PlanetData(planet, system) constructor{ for (var i=1;i<13;i++){ if (population_influences[i]>0){ draw_set_color(global.star_name_colors[i]); - if (_hidden_cult && i == eFACTION.Tyranids){ + if (_hidden_cult && i == eFACTION.TYRANIDS){ draw_set_color(global.star_name_colors[eFACTION.Imperium]); } var current_start = bar_start_point + (current_bar_percent * bar_percent_length); @@ -1427,7 +1427,7 @@ function PlanetData(planet, system) constructor{ var kill = 0; // Eh heh heh - if (planet_forces[eFACTION.Tyranids]>0){ + if (planet_forces[eFACTION.TYRANIDS]>0){ strength = strength>2 ? 2 : 0; system.p_tyranids[planet]-=2; } @@ -1469,11 +1469,11 @@ function PlanetData(planet, system) constructor{ edit_population(kill*-1); - if (population_influences[eFACTION.Tyranids] > 3){ - var _max_influence_reduction = min(_pop_percentage_kill,population_influences[eFACTION.Tyranids]-3); - alter_influence(eFACTION.Tyranids,-_max_influence_reduction); + if (population_influences[eFACTION.TYRANIDS] > 3){ + var _max_influence_reduction = min(_pop_percentage_kill,population_influences[eFACTION.TYRANIDS]-3); + alter_influence(eFACTION.TYRANIDS,-_max_influence_reduction); if (has_feature(eP_FEATURES.GENE_STEALER_CULT)){ - if (population_influences[eFACTION.Tyranids]<20){ + if (population_influences[eFACTION.TYRANIDS]<20){ delete_feature(eP_FEATURES.GENE_STEALER_CULT); } } @@ -1600,7 +1600,7 @@ function PlanetData(planet, system) constructor{ if (has_awake_tomb) { // Necron fleets, woooo //necrons kill populatin - if ((population > 0) && (player_forces + pdf + guardsmen + planet_forces[eFACTION.Tyranids] == 0)) { + if ((population > 0) && (player_forces + pdf + guardsmen + planet_forces[eFACTION.TYRANIDS] == 0)) { population = population * 0.75; if ((large_population == 0) && (population <= 5000)) { population = 0; @@ -1711,9 +1711,9 @@ function PlanetData(planet, system) constructor{ } } - if (current_owner == eFACTION.TAU && population_influences[eFACTION.Tyranids]<70){ + if (current_owner == eFACTION.TAU && population_influences[eFACTION.TYRANIDS]<70){ var _influ_chance = roll_dice(1,100); - if (_influ_chance <= 5 && population_influences[eFACTION.Tyranids]>=20){ + if (_influ_chance <= 5 && population_influences[eFACTION.TYRANIDS]>=20){ alter_influence(eFACTION.TAU, 1); } } @@ -1737,11 +1737,11 @@ function PlanetData(planet, system) constructor{ if (has_feature(eP_FEATURES.GENE_STEALER_CULT)) { var cult = get_features(eP_FEATURES.GENE_STEALER_CULT)[0]; cult.cult_age++; - alter_influence(eFACTION.Tyranids, cult.cult_age / 100); + alter_influence(eFACTION.TYRANIDS, cult.cult_age / 100); var planet_garrison = garrisons; if (cult.hiding) { var find_nid_chance = 50 - planet_garrison.total_garrison; - if (population_influences[eFACTION.Tyranids] > 50) { + if (population_influences[eFACTION.TYRANIDS] > 50) { var find_cult_chance = irandom(50); var alert_text = $"A hidden Genestealer Cult on {name()} Has suddenly burst forth from hiding!"; if (planet_garrison.garrison_force) { @@ -1751,17 +1751,17 @@ function PlanetData(planet, system) constructor{ if (find_cult_chance < 1) { cult.hiding = false; scr_popup("System Lost", alert_text, "Genestealer Cult", ""); - set_new_owner(eFACTION.Tyranids); + set_new_owner(eFACTION.TYRANIDS); scr_event_log("red", $"A hidden Genestealer Cult on {name()} has Started a revolt.", system.name); - edit_forces(eFACTION.Tyranids,1); + edit_forces(eFACTION.TYRANIDS,1); } } } - var _nids = planet_forces[eFACTION.Tyranids]; - if ((!cult.hiding) && (_nids <= 3) && (planet_type != "Space Hulk") && (population_influences[eFACTION.Tyranids] > 10)) { + var _nids = planet_forces[eFACTION.TYRANIDS]; + if ((!cult.hiding) && (_nids <= 3) && (planet_type != "Space Hulk") && (population_influences[eFACTION.TYRANIDS] > 10)) { var spread = 0; var _rando = irandom(150); - _rando -= population_influences[eFACTION.Tyranids]; + _rando -= population_influences[eFACTION.TYRANIDS]; if (_rando <= 15) { spread = 1; } @@ -1774,15 +1774,15 @@ function PlanetData(planet, system) constructor{ } if (spread == 1) { - add_forces(eFACTION.Tyranids, 1); + add_forces(eFACTION.TYRANIDS, 1); } } - if (population_influences[eFACTION.Tyranids] > 55) { - set_new_owner(eFACTION.Tyranids); + if (population_influences[eFACTION.TYRANIDS] > 55) { + set_new_owner(eFACTION.TYRANIDS); } - } else if (population_influences[eFACTION.Tyranids] > 5) { - alter_influence(eFACTION.Tyranids, -1); - if ((irandom(200) + (population_influences[eFACTION.Tyranids] / 10)) > 195) { + } else if (population_influences[eFACTION.TYRANIDS] > 5) { + alter_influence(eFACTION.TYRANIDS, -1); + if ((irandom(200) + (population_influences[eFACTION.TYRANIDS] / 10)) > 195) { add_feature(eP_FEATURES.GENE_STEALER_CULT); } } @@ -2075,7 +2075,7 @@ function PlanetData(planet, system) constructor{ } // If there are enemy non-chaos forces then they may be used as a cover // Does not work with chaos because if the governor dies, with chaos present, the new governor would possibly be investigated - if (planet_forces[eFACTION.Ork]>=4) or (planet_forces[eFACTION.Necrons]>=3) or (planet_forces[eFACTION.Tyranids]>=5){ + if (planet_forces[eFACTION.Ork]>=4) or (planet_forces[eFACTION.Necrons]>=3) or (planet_forces[eFACTION.TYRANIDS]>=5){ pip.estimate=pip.estimate*0.5; } } diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index f82e9815b9..e2857b0d9f 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -431,7 +431,7 @@ function draw_planet_debug_features(){ name : "Artefact" }, { - e_num : eP_FEATURES.STC_Fragment, + e_num : DROP_TYPE.STC_FRAGMENT, name : "STC Fragment" }, { diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index f8af7b546e..ca944c3360 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -195,14 +195,14 @@ function FeatureSelected(Feature, system, planet) constructor{ title = "Old Battlefield"; body = $"The site of a previously unrecorded battle between {feature.faction1} and {feature.faction2} forces long forgotten\nUnload Marines to search Techmarines are advisable to help, it would be best any tech priests not be aware of such an operation it may create a conflict of interest"; break; - case eP_FEATURES.STC_Fragment: + case DROP_TYPE.STC_FRAGMENT: generic=true; title = "STC Fragment"; body = $"Unload a {obj_ini.role[100][16]} and whatever entourage you deem necessary to recover the STC Fragment"; break; case eP_FEATURES.GENE_STEALER_CULT: generic=true; - var cult_control = planet_data.population_influences[eFACTION.Tyranids]; + var cult_control = planet_data.population_influences[eFACTION.TYRANIDS]; title = $"Cult of {feature.name}"; var control_string = ""; if (cult_control<25){ diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index cfa4bedb50..47c8ad9873 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -376,11 +376,11 @@ function scr_enemy_ai_a() { if (guard_score>=3) and (p_pdf[_run]<10000) then p_pdf[_run]*=(min(0.95, 0+pdf_loss_reduction)); if (guard_score>=2) and (p_pdf[_run]<2000) then p_pdf[_run]=0; if (guard_score>=1) and (p_pdf[_run]<200) then p_pdf[_run]=0; - if (_planet_data.population_influences[eFACTION.Tyranids] > 50 && _planet_data.has_feature(eP_FEATURES.GENE_STEALER_CULT)){ - var _cur_influ = p_influence[_run][eFACTION.Tyranids]; + if (_planet_data.population_influences[eFACTION.TYRANIDS] > 50 && _planet_data.has_feature(eP_FEATURES.GENE_STEALER_CULT)){ + var _cur_influ = p_influence[_run][eFACTION.TYRANIDS]; var _influence_reduction = _cur_influ * (p_pdf[_run]/_pdf_before); - adjust_influence(eFACTION.Tyranids,-min(_influence_reduction,_cur_influ-3) , _run); - if (p_influence[_run][eFACTION.Tyranids] < 20){ + adjust_influence(eFACTION.TYRANIDS,-min(_influence_reduction,_cur_influ-3) , _run); + if (p_influence[_run][eFACTION.TYRANIDS] < 20){ _planet_data.delete_feature(eP_FEATURES.GENE_STEALER_CULT); } } diff --git a/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml b/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml index 975a5a3bf3..2c35b2f7e4 100644 --- a/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml +++ b/scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml @@ -550,7 +550,7 @@ function scr_enemy_ai_c() { var i=0; repeat(planets){i+=1; if (p_tyranids[i]>=5) and (planets>=i) and (p_player[i]+p_orks[i]+p_guardsmen[i]+p_pdf[i]+p_chaos[i]=0){ - var ship=scr_orbiting_fleet(eFACTION.Tyranids); + var ship=scr_orbiting_fleet(eFACTION.TYRANIDS); if (ship!="none") and (p_type[i]!="Dead") and (array_length(p_feature[i])!=0){ if (ship.capital_number>0){ if (planet_feature_bool(p_feature[i], eP_FEATURES.RECLAMATION_POOLS) ==1){ diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index f825826a79..ee7ac6af0a 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -71,7 +71,7 @@ function get_imperium_forge_systems(){ var enemy_fleets = [ eFACTION.Ork, eFACTION.TAU, - eFACTION.Tyranids, + eFACTION.TYRANIDS, eFACTION.Chaos, eFACTION.Necrons ] diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index f96433094d..e05d2afe50 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -130,7 +130,7 @@ function NewPlanetFeature(feature_type, other_data={}) constructor{ static ruins_combat_end=scr_ruins_combat_end; scr_ancient_ruins_setup(); break; - case eP_FEATURES.STC_Fragment: + case DROP_TYPE.STC_FRAGMENT: player_hidden = 1; Fragment_type =0; planet_display = "STC Fragment"; @@ -498,7 +498,7 @@ function scr_planetary_feature(planet_num) { scr_alert("green","feature",lop,x,y); scr_event_log("",lop); break; - case eP_FEATURES.STC_Fragment: + case DROP_TYPE.STC_FRAGMENT: var lop=$"STC Fragment located on {numeral_n}."; scr_alert("green","feature",lop,x,y); scr_event_log("",lop); diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index 8705572fd6..ad1d2c7a6f 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -47,12 +47,12 @@ function scr_purge_world(action_type, action_score) { } } - var heres_before = max(total_corruption(),population_influences[eFACTION.Tau],population_influences[eFACTION.Tyranids]);// Starting heresy + var heres_before = max(total_corruption(),population_influences[eFACTION.Tau],population_influences[eFACTION.TYRANIDS]);// Starting heresy var heres_target = "corruption"; - if (max(population_influences[eFACTION.Tau],population_influences[eFACTION.Tyranids]) > total_corruption()){ - if (population_influences[eFACTION.Tau]>population_influences[eFACTION.Tyranids]){ + if (max(population_influences[eFACTION.Tau],population_influences[eFACTION.TYRANIDS]) > total_corruption()){ + if (population_influences[eFACTION.Tau]>population_influences[eFACTION.TYRANIDS]){ heres_target = "tau"; } else{ heres_target = "genestealers"; @@ -181,7 +181,7 @@ function scr_purge_world(action_type, action_score) { heres_after=0; } - var nid_influence = population_influences[eFACTION.Tyranids]; + var nid_influence = population_influences[eFACTION.TYRANIDS]; if (has_feature( P_features.Gene_Stealer_Cult)) { var cult = get_features(P_features.Gene_Stealer_Cult)[0]; if (cult.hiding) { @@ -190,7 +190,7 @@ function scr_purge_world(action_type, action_score) { } else { if (nid_influence > 25) { txt1 += " Scores of mutant offspring from a genestealer infestation are burnt, while we have damaged their influence over this world, the mutants appear to lack the organisation of a true cult"; - adjust_influence(eFACTION.Tyranids, -10, planet, star); + adjust_influence(eFACTION.TYRANIDS, -10, planet, star); } else if (nid_influence > 0) { txt1 += " There are signs of a genestealer infestation but the cultists are too unorganized to do any real damage to their influence on this world"; } @@ -281,7 +281,7 @@ function scr_purge_world(action_type, action_score) { }else if (heres_target == "tau"){ alter_influence(eFACTION.Tau , -influence_reduction); }else if (heres_target == "genestealers"){ - alter_influence(eFACTION.Tyranids , -influence_reduction); + alter_influence(eFACTION.TYRANIDS , -influence_reduction); } if (action_type Date: Wed, 22 Apr 2026 16:54:17 +0100 Subject: [PATCH 45/93] enums and fix ork growth --- objects/obj_en_fleet/Alarm_1.gml | 2 +- scripts/scr_PlanetData/scr_PlanetData.gml | 169 +++++++++--------- .../scr_draw_planet_features.gml | 2 +- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 16 +- .../scr_fleet_functions.gml | 2 +- .../scr_forge_world_functions.gml | 2 +- 6 files changed, 95 insertions(+), 98 deletions(-) diff --git a/objects/obj_en_fleet/Alarm_1.gml b/objects/obj_en_fleet/Alarm_1.gml index 00bd72488e..78c91253a4 100644 --- a/objects/obj_en_fleet/Alarm_1.gml +++ b/objects/obj_en_fleet/Alarm_1.gml @@ -45,7 +45,7 @@ try { if (_is_orbiting) { turns_static++; - if (turns_static>5 && owner == eFACTION.Ork){ + if (turns_static>5 && owner == eFACTION.ORK){ if (!irandom(7)){ ork_fleet_move(); _is_orbiting=false; diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 5a7cc972e9..b07d29d58c 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -51,7 +51,7 @@ function PlanetData(planet, system) constructor{ planet_forces[eFACTION.Ecclesiarchy] = system.p_sisters[planet]; planet_forces[eFACTION.Eldar] = system.p_eldar[planet]; - planet_forces[eFACTION.Ork] = system.p_orks[planet]; + planet_forces[eFACTION.ORK] = system.p_orks[planet]; planet_forces[eFACTION.TAU] = system.p_tau[planet]; planet_forces[eFACTION.TYRANIDS] = system.p_tyranids[planet]; planet_forces[eFACTION.Chaos] = system.p_chaos[planet]+ system.p_demons[planet]; @@ -156,7 +156,7 @@ function PlanetData(planet, system) constructor{ }; static end_turn_population_growth = function(){ - if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.Heretics] == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.Ork] == 0) && (planet_forces[eFACTION.Necrons] == 0) && (planet_forces[eFACTION.TYRANIDS] == 0)) { + if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.Heretics] == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.ORK] == 0) && (planet_forces[eFACTION.Necrons] == 0) && (planet_forces[eFACTION.TYRANIDS] == 0)) { if (!large_population) { set_population(round(population * 1.0008)); } else if (large_population == 1) { @@ -321,21 +321,21 @@ function PlanetData(planet, system) constructor{ } return _text; } - static grow_ork_forces = function(){ + static grow_ork_forces = function(){ var contin = 0; var _rando = roll_dice(1,100);// This part handles the spreading // if (_rando<30){ var _non_deads = planets_without_type("dead", system); - var _has_warboss = has_feature(eP_FEATURES.ORKWARBOSS); - var _has_stronghold = has_feature(eP_FEATURES.ORKSTRONGHOLD); + var _has_warboss = has_feature(eP_features.ORKWARBOSS); + var _has_stronghold = has_feature(eP_features.ORKSTRONGHOLD); var _build_ships = false; - if (_has_stronghold) { - var _stronghold = get_features(eP_FEATURES.ORKSTRONGHOLD)[0]; + if (_has_stronghold){ + var _stronghold = get_features(eP_features.ORKSTRONGHOLD)[0]; } - if (_has_warboss) { - var _warboss = get_features(eP_FEATURES.ORKWARBOSS)[0]; + if (_has_warboss){ + var _warboss = get_features(eP_features.ORKWARBOSS)[0]; _warboss.turns_static++; } var _roll_num = 100; @@ -351,82 +351,75 @@ function PlanetData(planet, system) constructor{ _ork_growth_threshold *= 2; } - var _orks = planet_forces[eFACTION.Ork]; - if ((current_owner == eFACTION.Ork) && (_orks < 5) && (planet_forces[eFACTION.Heretics] == 0) && (player_forces <= 0 || !is_garrison_force)) { + var _orks = planet_forces[eFACTION.ORK]; + if ((current_owner == eFACTION.ORK) && (_orks < 5) && (planet_forces[eFACTION.Heretics] == 0) && (player_forces <= 0 || !is_garrison_force)) { if ((_orks> 0) && (_ork_growth <= _ork_growth_threshold)) { if (sabotage_force) { if (irandom(3) < 2) { scr_event_log("green", $"sabotage force on {name()} disrupts ork forces", name); } else { - add_forces(eFACTION.Ork,1); + add_forces(eFACTION.ORK,1); } } else { - add_forces(eFACTION.Ork,1); + add_forces(eFACTION.ORK,1); } } } if (array_length(_non_deads)>0 && _rando>40){ var _ork_spread_planet = array_random_element(_non_deads); - var _orks = planet_forces[eFACTION.ORK]; + var _orks = planet_forces[eFACTION.ORK] var _ork_target = system.p_orks[_ork_spread_planet]; - var _spread_orks = current_owner == eFACTION.ORK && ((pdf + guardsmen + planet_forces[8] + planet_forces[10] + planet_forces[1]) == 0); - if (_spread_orks) { + var _spread_orks = (current_owner==eFACTION.ORK && ((pdf + guardsmen + planet_forces[8] + planet_forces[10]+planet_forces[1]) == 0 )); + if (_spread_orks){ // determine maximum Ork presence on the source planet var _ork_max = planet_forces[eFACTION.ORK]; - if (_ork_max < 5 && _ork_target < 2) { - system.p_orks[_ork_spread_planet]++; - } - if (_orks > 4 && _ork_target < 3) { + if (_ork_max<5 && _ork_target<2) then system.p_orks[_ork_spread_planet]++; + if (_orks>4 && _ork_target<3){ system.p_orks[_ork_spread_planet]++; - if (_ork_target < 3) { + if (_ork_target<3){ system.p_orks[_ork_spread_planet]++; add_forces(eFACTION.ORK, -1); } } + } } contin=0; _rando=roll_dice(1,100);// This part handles the ship building - if (population>0 && pdf==0 && guardsmen==0 && planet_forces[10]==0) and (planet_forces[eFACTION.TAU]==0){ - if (!large_population){ - set_population(population*0.97); - }else { - edit_population(-0.01); - } - + if (population>0 && pdf==0 && guardsmen==0 && planet_forces[10]==0) and (planet_forces[eFACTION.Tau]==0){ + if (!large_population){ + set_population(population*0.97); + }else { + edit_population(-0.01); + } + }; var enemies_present=false; with (system){ - for (var n=0;n=1) and ((p_pdf[plan]>0) or (p_guardsmen[plan]>0) or (p_traitors[plan]>0) or (p_tau[plan]>0)){ + enemies_present=true; + } } } - if (_has_warboss && !_has_stronghold) { - rando = roll_dice_chapter(1, 100, "low"); - if (rando < 30) { - add_feature(eP_FEATURES.ORKSTRONGHOLD); + if (_has_warboss && !_has_stronghold){ + _rando=roll_dice_chapter(1,100, "low"); + if (_rando<30){ + add_feature(eP_features.ORKSTRONGHOLD); } } else { - if (_has_stronghold) { + if (_has_stronghold){ growth = 0.01; - if (_has_warboss) { + if (_has_warboss){ growth *= 2; } - if (_stronghold.tier < planet_forces[eFACTION.ORK]) { + if (_stronghold.tier0) then _rando-=10;// Empire bonus, was 15 before + if (obj_controller.known[eFACTION.ORK]>0) then _rando-=10;// Empire bonus, was 15 before // Check for industrial facilities - var fleet_buildable = (planet_type != "Dead" && planet_type != "Lava") || _has_warboss || _has_stronghold; - if (fleet_buildable && planet_forces[eFACTION.ORK] >= 4) { - // Used to not have Ice either + var fleet_buildable = ((planet_type!="Dead" && planet_type!="Lava") || _has_warboss || _has_stronghold); + if (fleet_buildable && planet_forces[eFACTION.ORK]>=4){// Used to not have Ice either - if (instance_exists(obj_p_fleet)) { - var ppp = instance_nearest(x, y, obj_p_fleet); - if ((point_distance(x, y, ppp.x, ppp.y) < 50) && (ppp.action == "")) { + if (instance_exists(obj_p_fleet)){ + var ppp=instance_nearest(x,y,obj_p_fleet); + if (point_distance(x,y,ppp.x,ppp.y)<50) and (ppp.action=""){ exit; - } + }; } if (planet_type == "Forge"){ _rando-=80; } else if (planet_type == "Hive" || planet_type == "Temperate"){ - _rando-=30; + _rando-=30; }else if (planet_type == "Agri"){ - _rando-=10; + _rando-=10; } - var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); + var _ork_fleet = scr_orbiting_fleet(eFACTION.ORK, system); if (_ork_fleet=="none"){ - if (_rando<=20){ - new_ork_fleet(x,y); - } + if (_rando<=20){ + new_ork_fleet(x,y); + } } else { + _build_ships = true; - } - } + + } + } } - if (_build_ships) { + if (_build_ships){ var _pdata = self; with (_ork_fleet){ // Increase ship number for this object? var _rando=irandom(101); - if (obj_controller.known[eFACTION.Ork]>0) then _rando-=10; + if (obj_controller.known[eFACTION.ORK]>0) then _rando-=10; var _planet_type = _pdata.planet_type; if (_planet_type=="Forge"){ _rando-=20; @@ -506,55 +500,58 @@ function PlanetData(planet, system) constructor{ } switch(_rando){ case 3: - capital_number += 1; + capital_number+=1; break; case 2: - frigate_number += 1; + frigate_number+=1; break; case 1: - escort_number += 1; + escort_number+=1; break; + } } var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1; image_index=ii; //if big enough flee bugger off to new star - if (image_index >= 5) { + if (image_index>=5){ instance_deactivate_object(_pdata.system); - with (obj_star) { - if (is_dead_star()) { + with(obj_star){ + if (is_dead_star()){ instance_deactivate_object(id); } else { - if (owner == eFACTION.ORK || array_contains(p_owner, eFACTION.ORK)) { + if (owner == eFACTION.ORK || array_contains(p_owner, eFACTION.ORK)){ instance_deactivate_object(id); - } + } } } - var new_wagh_star = instance_nearest(x, y, obj_star); - if (instance_exists(new_wagh_star)) { - action_x = new_wagh_star.x; - action_y = new_wagh_star.y; + var new_wagh_star = instance_nearest(x,y,obj_star); + if (instance_exists(new_wagh_star)){ + action_x=new_wagh_star.x; + action_y=new_wagh_star.y; action = ""; set_fleet_movement(); } + } instance_activate_object(obj_star); } } if (_has_warboss){ _rando=roll_dice(1,100)+10; - var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); + var _ork_fleet = scr_orbiting_fleet(eFACTION.ORK, system); if (_ork_fleet!="none" && _rando < _warboss.turns_static){ _warboss.turns_static = 0; _ork_fleet.cargo_data.ork_warboss = _warboss; - delete_feature(eP_FEATURES.ORKWARBOSS); - if (!_warboss.player_hidden || !irandom(5)) { - scr_alert("red", "ork", $"{_warboss.name} departs {name()} as his waaagh gains momentum", 0, 0); + delete_feature(eP_features.ORKWARBOSS); + if (!_warboss.player_hidden || !irandom(5)){ + scr_alert("red","ork",$"{_warboss.name} departs {name()} as his waaagh gains momentum",0,0); } } } - }; + + } // current planet heresy if (population == 0) { @@ -973,10 +970,10 @@ function PlanetData(planet, system) constructor{ static pdf_defence_loss_to_orks = function(){ var active_garrison = pdf_will_support_player() && garrisons.viable_garrison>0; - if (planet_forces[eFACTION.Ork]>=4) and (pdf>=30000){ + if (planet_forces[eFACTION.ORK]>=4) and (pdf>=30000){ pdf=floor(pdf*(min(0.95, 0.55+pdf_loss_reduction))); } - else if (planet_forces[eFACTION.Ork]>=4 && pdf<30000 && pdf>=10000){ + else if (planet_forces[eFACTION.ORK]>=4 && pdf<30000 && pdf>=10000){ pdf=active_garrison?pdf*0.4:0; } if ((planet_forces[eFACTION.ORK] >= 2) && (pdf < 2000)) { @@ -1431,7 +1428,7 @@ function PlanetData(planet, system) constructor{ strength = strength>2 ? 2 : 0; system.p_tyranids[planet]-=2; } - else if (planet_forces[eFACTION.Ork]>0){ + else if (planet_forces[eFACTION.ORK]>0){ if (strength>2) then strength=2; if (strength<1) then strength=0; system.p_orks[planet]-=2; @@ -1802,7 +1799,7 @@ function PlanetData(planet, system) constructor{ if ((current_owner != eFACTION.Chaos) && (current_owner != eFACTION.Heretics) && (current_owner != eFACTION.Eldar) && (planet_type != "Dead") && (planet_type != "Craftworld")) { success = false; - is_ork = current_owner == eFACTION.Ork; + is_ork = current_owner == eFACTION.ORK; if (!is_ork) { //made a linear function for this while here...now the minimum for the roll is a bit higher, but @@ -1817,7 +1814,7 @@ function PlanetData(planet, system) constructor{ } } - if (success && (pdf == 0) && (guardsmen == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.Ork] == 0)) { + if (success && (pdf == 0) && (guardsmen == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.ORK] == 0)) { current_owner = 10; scr_alert("red", "owner", $"{name()} has fallen to heretics!", x, y); @@ -2075,7 +2072,7 @@ function PlanetData(planet, system) constructor{ } // If there are enemy non-chaos forces then they may be used as a cover // Does not work with chaos because if the governor dies, with chaos present, the new governor would possibly be investigated - if (planet_forces[eFACTION.Ork]>=4) or (planet_forces[eFACTION.Necrons]>=3) or (planet_forces[eFACTION.TYRANIDS]>=5){ + if (planet_forces[eFACTION.ORK]>=4) or (planet_forces[eFACTION.Necrons]>=3) or (planet_forces[eFACTION.TYRANIDS]>=5){ pip.estimate=pip.estimate*0.5; } } diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index ca944c3360..dacce92494 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -242,7 +242,7 @@ function FeatureSelected(Feature, system, planet) constructor{ case eP_FEATURES.ORKSTRONGHOLD: title = "Ork Stronghold"; generic = true; - if (planet_data.planet_forces[eFACTION.Ork]){ + if (planet_data.planet_forces[eFACTION.ORK]){ body = $"For as long as this Stronghold stands the orks here will continue to fortify it. The larger it gets the greater the capacity of this planet to produce orkish machines of war and ships and the better protected the ork forces will be from bombardment"; } else { body = "Without a force of orks to hold it together the fortress is slowly pulled apart from within by the inhabitants, It's capabilities will constantly decrease until soon there will be nothing left"; diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 47c8ad9873..4b63070b0f 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -333,7 +333,7 @@ function scr_enemy_ai_a() { var after_combat_guard=guard_score; var after_combat_guard_count=p_guardsmen[_run]; var after_combat_pdf=pdf_score; - var after_combat_ork_force=planet_forces[eFACTION.Ork]; + var after_combat_ork_force=planet_forces[eFACTION.ORK]; var after_combat_tau=planet_forces[eFACTION.TAU]; var after_combat_traitor=traitors_score; var after_combat_csm=csm_score; @@ -346,7 +346,7 @@ function scr_enemy_ai_a() { var _active_garrison = pdf_with_player && garrison.viable_garrison>0; // Guard attack if (guard_score>0) and (guard_attack!="") and (guard_score>0.5){ - if (guard_attack="ork") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork]; + if (guard_attack="ork") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK]; if (guard_attack="tau") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.TAU]; if (guard_attack="traitors") then tempor=choose(1,2,3,4,5,6)*traitors_score; if (guard_attack="csm") then tempor=choose(2,3,4,5,6,7)*csm_score; @@ -354,7 +354,7 @@ function scr_enemy_ai_a() { rand1=choose(1,2,3,4,5)*guard_score; - if (guard_attack="ork") and (planet_forces[eFACTION.Ork]>guard_score) then rand1=0; + if (guard_attack="ork") and (planet_forces[eFACTION.ORK]>guard_score) then rand1=0; if (guard_attack="tau") and (planet_forces[eFACTION.TAU]>guard_score) then rand1=0; if (guard_attack="traitors") and (traitors_score>guard_score) then rand1=0; if (guard_attack="csm") and (csm_score>guard_score) then rand1=0; @@ -405,7 +405,7 @@ function scr_enemy_ai_a() { // PDF attack if ((pdf_score>0) and (pdf_attack!="")) or ((pdf_score>1) and (guard_score<0.5)){ - if (pdf_attack="ork") then tempor=planet_forces[eFACTION.Ork]; + if (pdf_attack="ork") then tempor=planet_forces[eFACTION.ORK]; if (pdf_attack="tau") then tempor=planet_forces[eFACTION.TAU]; if (pdf_attack="traitors") then tempor=traitors_score; if (pdf_attack="csm") then tempor=csm_score; @@ -453,7 +453,7 @@ function scr_enemy_ai_a() { rand2=(choose(2,3,4,5)*planet_forces[eFACTION.TAU])*choose(1,1.25); if (rand1>rand2) then after_combat_tau-=1; }else if(sisters_attack="ork"){ - rand2=(choose(2,3,4,5)*planet_forces[eFACTION.Ork])*choose(1,1.25); + rand2=(choose(2,3,4,5)*planet_forces[eFACTION.ORK])*choose(1,1.25); if (rand1>rand2) then after_combat_ork_force-=1; }else if(sisters_attack="traitors"){ rand2=(choose(1,2,3,4,5)*traitors_score)*choose(1,1.25); @@ -488,7 +488,7 @@ function scr_enemy_ai_a() { rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.TAU]; if (tau_attack="ork"){ - rand2=(choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork])*choose(1,1.25); + rand2=(choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK])*choose(1,1.25); if (rand1>rand2) then after_combat_ork_force-=1; }else if (tau_attack="traitors"){ rand2=(choose(1,2,3,4,5,6)*traitors_score)*choose(1,1.25); @@ -516,8 +516,8 @@ function scr_enemy_ai_a() { } // ork attack - if (planet_forces[eFACTION.Ork]>0) and (ork_attack!="") and (ork_attack!="player"){ - rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork]; + if (planet_forces[eFACTION.ORK]>0) and (ork_attack!="") and (ork_attack!="player"){ + rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK]; if (!stop) { // Start stop diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index a9c72f98b7..b6fcb25818 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -999,7 +999,7 @@ function fleet_arrival_logic() { // If the connected planet is owned by orks then choose a random one within 400 not owned by orks - else if (owner == eFACTION.Ork){ + else if (owner == eFACTION.ORK){ if (is_orbiting()){ with (orbiting){ ork_fleet_arrive_target(); diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index ee7ac6af0a..a692b99128 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -69,7 +69,7 @@ function get_imperium_forge_systems(){ and (p_orks[o]+p_tau[o]+p_tyranids[o]+p_chaos[o]+p_traitors[o]+p_necrons[o]==0) { var enemy_fleets = [ - eFACTION.Ork, + eFACTION.ORK, eFACTION.TAU, eFACTION.TYRANIDS, eFACTION.Chaos, From b70b3af9f1846bfa01bf4a8d5952a5f9741e09e6 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 17:11:48 +0100 Subject: [PATCH 46/93] faction enums --- scripts/scr_PlanetData/scr_PlanetData.gml | 169 +++++++++--------- .../scr_draw_planet_features.gml | 2 +- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 16 +- 3 files changed, 95 insertions(+), 92 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index b07d29d58c..5a7cc972e9 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -51,7 +51,7 @@ function PlanetData(planet, system) constructor{ planet_forces[eFACTION.Ecclesiarchy] = system.p_sisters[planet]; planet_forces[eFACTION.Eldar] = system.p_eldar[planet]; - planet_forces[eFACTION.ORK] = system.p_orks[planet]; + planet_forces[eFACTION.Ork] = system.p_orks[planet]; planet_forces[eFACTION.TAU] = system.p_tau[planet]; planet_forces[eFACTION.TYRANIDS] = system.p_tyranids[planet]; planet_forces[eFACTION.Chaos] = system.p_chaos[planet]+ system.p_demons[planet]; @@ -156,7 +156,7 @@ function PlanetData(planet, system) constructor{ }; static end_turn_population_growth = function(){ - if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.Heretics] == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.ORK] == 0) && (planet_forces[eFACTION.Necrons] == 0) && (planet_forces[eFACTION.TYRANIDS] == 0)) { + if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.Heretics] == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.Ork] == 0) && (planet_forces[eFACTION.Necrons] == 0) && (planet_forces[eFACTION.TYRANIDS] == 0)) { if (!large_population) { set_population(round(population * 1.0008)); } else if (large_population == 1) { @@ -321,21 +321,21 @@ function PlanetData(planet, system) constructor{ } return _text; } - static grow_ork_forces = function(){ + static grow_ork_forces = function(){ var contin = 0; var _rando = roll_dice(1,100);// This part handles the spreading // if (_rando<30){ var _non_deads = planets_without_type("dead", system); - var _has_warboss = has_feature(eP_features.ORKWARBOSS); - var _has_stronghold = has_feature(eP_features.ORKSTRONGHOLD); + var _has_warboss = has_feature(eP_FEATURES.ORKWARBOSS); + var _has_stronghold = has_feature(eP_FEATURES.ORKSTRONGHOLD); var _build_ships = false; - if (_has_stronghold){ - var _stronghold = get_features(eP_features.ORKSTRONGHOLD)[0]; + if (_has_stronghold) { + var _stronghold = get_features(eP_FEATURES.ORKSTRONGHOLD)[0]; } - if (_has_warboss){ - var _warboss = get_features(eP_features.ORKWARBOSS)[0]; + if (_has_warboss) { + var _warboss = get_features(eP_FEATURES.ORKWARBOSS)[0]; _warboss.turns_static++; } var _roll_num = 100; @@ -351,75 +351,82 @@ function PlanetData(planet, system) constructor{ _ork_growth_threshold *= 2; } - var _orks = planet_forces[eFACTION.ORK]; - if ((current_owner == eFACTION.ORK) && (_orks < 5) && (planet_forces[eFACTION.Heretics] == 0) && (player_forces <= 0 || !is_garrison_force)) { + var _orks = planet_forces[eFACTION.Ork]; + if ((current_owner == eFACTION.Ork) && (_orks < 5) && (planet_forces[eFACTION.Heretics] == 0) && (player_forces <= 0 || !is_garrison_force)) { if ((_orks> 0) && (_ork_growth <= _ork_growth_threshold)) { if (sabotage_force) { if (irandom(3) < 2) { scr_event_log("green", $"sabotage force on {name()} disrupts ork forces", name); } else { - add_forces(eFACTION.ORK,1); + add_forces(eFACTION.Ork,1); } } else { - add_forces(eFACTION.ORK,1); + add_forces(eFACTION.Ork,1); } } } if (array_length(_non_deads)>0 && _rando>40){ var _ork_spread_planet = array_random_element(_non_deads); - var _orks = planet_forces[eFACTION.ORK] + var _orks = planet_forces[eFACTION.ORK]; var _ork_target = system.p_orks[_ork_spread_planet]; - var _spread_orks = (current_owner==eFACTION.ORK && ((pdf + guardsmen + planet_forces[8] + planet_forces[10]+planet_forces[1]) == 0 )); - if (_spread_orks){ + var _spread_orks = current_owner == eFACTION.ORK && ((pdf + guardsmen + planet_forces[8] + planet_forces[10] + planet_forces[1]) == 0); + if (_spread_orks) { // determine maximum Ork presence on the source planet var _ork_max = planet_forces[eFACTION.ORK]; - if (_ork_max<5 && _ork_target<2) then system.p_orks[_ork_spread_planet]++; - if (_orks>4 && _ork_target<3){ + if (_ork_max < 5 && _ork_target < 2) { + system.p_orks[_ork_spread_planet]++; + } + if (_orks > 4 && _ork_target < 3) { system.p_orks[_ork_spread_planet]++; - if (_ork_target<3){ + if (_ork_target < 3) { system.p_orks[_ork_spread_planet]++; add_forces(eFACTION.ORK, -1); } } - } } contin=0; _rando=roll_dice(1,100);// This part handles the ship building - if (population>0 && pdf==0 && guardsmen==0 && planet_forces[10]==0) and (planet_forces[eFACTION.Tau]==0){ - if (!large_population){ - set_population(population*0.97); - }else { - edit_population(-0.01); - } - + if (population>0 && pdf==0 && guardsmen==0 && planet_forces[10]==0) and (planet_forces[eFACTION.TAU]==0){ + if (!large_population){ + set_population(population*0.97); + }else { + edit_population(-0.01); + } + }; var enemies_present=false; with (system){ - for (var n=0;n=1) and ((p_pdf[plan]>0) or (p_guardsmen[plan]>0) or (p_traitors[plan]>0) or (p_tau[plan]>0)){ - enemies_present=true; - } - } - } + var enemies_present = false; + with (system) { + for (var n = 0; n < array_length(_non_deads); n++) { + var plan = _non_deads[n]; if (_has_warboss && !_has_stronghold){ _rando=roll_dice_chapter(1,100, "low"); if (_rando<30){ - add_feature(eP_features.ORKSTRONGHOLD); + add_feature(eP_FEATURES.ORKSTRONGHOLD); + } + } + + if (_has_warboss && !_has_stronghold) { + rando = roll_dice_chapter(1, 100, "low"); + if (rando < 30) { + add_feature(eP_FEATURES.ORKSTRONGHOLD); } } else { - if (_has_stronghold){ + if (_has_stronghold) { growth = 0.01; - if (_has_warboss){ + if (_has_warboss) { growth *= 2; } - if (_stronghold.tier0) then _rando-=10;// Empire bonus, was 15 before + if (obj_controller.known[eFACTION.Ork]>0) then _rando-=10;// Empire bonus, was 15 before // Check for industrial facilities - var fleet_buildable = ((planet_type!="Dead" && planet_type!="Lava") || _has_warboss || _has_stronghold); - if (fleet_buildable && planet_forces[eFACTION.ORK]>=4){// Used to not have Ice either + var fleet_buildable = (planet_type != "Dead" && planet_type != "Lava") || _has_warboss || _has_stronghold; + if (fleet_buildable && planet_forces[eFACTION.ORK] >= 4) { + // Used to not have Ice either - if (instance_exists(obj_p_fleet)){ - var ppp=instance_nearest(x,y,obj_p_fleet); - if (point_distance(x,y,ppp.x,ppp.y)<50) and (ppp.action=""){ + if (instance_exists(obj_p_fleet)) { + var ppp = instance_nearest(x, y, obj_p_fleet); + if ((point_distance(x, y, ppp.x, ppp.y) < 50) && (ppp.action == "")) { exit; - }; + } } if (planet_type == "Forge"){ _rando-=80; } else if (planet_type == "Hive" || planet_type == "Temperate"){ - _rando-=30; + _rando-=30; }else if (planet_type == "Agri"){ - _rando-=10; + _rando-=10; } - var _ork_fleet = scr_orbiting_fleet(eFACTION.ORK, system); + var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); if (_ork_fleet=="none"){ - if (_rando<=20){ - new_ork_fleet(x,y); - } + if (_rando<=20){ + new_ork_fleet(x,y); + } } else { - _build_ships = true; - - } - } + } + } } - if (_build_ships){ + if (_build_ships) { var _pdata = self; with (_ork_fleet){ // Increase ship number for this object? var _rando=irandom(101); - if (obj_controller.known[eFACTION.ORK]>0) then _rando-=10; + if (obj_controller.known[eFACTION.Ork]>0) then _rando-=10; var _planet_type = _pdata.planet_type; if (_planet_type=="Forge"){ _rando-=20; @@ -500,58 +506,55 @@ function PlanetData(planet, system) constructor{ } switch(_rando){ case 3: - capital_number+=1; + capital_number += 1; break; case 2: - frigate_number+=1; + frigate_number += 1; break; case 1: - escort_number+=1; + escort_number += 1; break; - } } var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1; image_index=ii; //if big enough flee bugger off to new star - if (image_index>=5){ + if (image_index >= 5) { instance_deactivate_object(_pdata.system); - with(obj_star){ - if (is_dead_star()){ + with (obj_star) { + if (is_dead_star()) { instance_deactivate_object(id); } else { - if (owner == eFACTION.ORK || array_contains(p_owner, eFACTION.ORK)){ + if (owner == eFACTION.ORK || array_contains(p_owner, eFACTION.ORK)) { instance_deactivate_object(id); - } + } } } - var new_wagh_star = instance_nearest(x,y,obj_star); - if (instance_exists(new_wagh_star)){ - action_x=new_wagh_star.x; - action_y=new_wagh_star.y; + var new_wagh_star = instance_nearest(x, y, obj_star); + if (instance_exists(new_wagh_star)) { + action_x = new_wagh_star.x; + action_y = new_wagh_star.y; action = ""; set_fleet_movement(); } - } instance_activate_object(obj_star); } } if (_has_warboss){ _rando=roll_dice(1,100)+10; - var _ork_fleet = scr_orbiting_fleet(eFACTION.ORK, system); + var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); if (_ork_fleet!="none" && _rando < _warboss.turns_static){ _warboss.turns_static = 0; _ork_fleet.cargo_data.ork_warboss = _warboss; - delete_feature(eP_features.ORKWARBOSS); - if (!_warboss.player_hidden || !irandom(5)){ - scr_alert("red","ork",$"{_warboss.name} departs {name()} as his waaagh gains momentum",0,0); + delete_feature(eP_FEATURES.ORKWARBOSS); + if (!_warboss.player_hidden || !irandom(5)) { + scr_alert("red", "ork", $"{_warboss.name} departs {name()} as his waaagh gains momentum", 0, 0); } } } - - } + }; // current planet heresy if (population == 0) { @@ -970,10 +973,10 @@ function PlanetData(planet, system) constructor{ static pdf_defence_loss_to_orks = function(){ var active_garrison = pdf_will_support_player() && garrisons.viable_garrison>0; - if (planet_forces[eFACTION.ORK]>=4) and (pdf>=30000){ + if (planet_forces[eFACTION.Ork]>=4) and (pdf>=30000){ pdf=floor(pdf*(min(0.95, 0.55+pdf_loss_reduction))); } - else if (planet_forces[eFACTION.ORK]>=4 && pdf<30000 && pdf>=10000){ + else if (planet_forces[eFACTION.Ork]>=4 && pdf<30000 && pdf>=10000){ pdf=active_garrison?pdf*0.4:0; } if ((planet_forces[eFACTION.ORK] >= 2) && (pdf < 2000)) { @@ -1428,7 +1431,7 @@ function PlanetData(planet, system) constructor{ strength = strength>2 ? 2 : 0; system.p_tyranids[planet]-=2; } - else if (planet_forces[eFACTION.ORK]>0){ + else if (planet_forces[eFACTION.Ork]>0){ if (strength>2) then strength=2; if (strength<1) then strength=0; system.p_orks[planet]-=2; @@ -1799,7 +1802,7 @@ function PlanetData(planet, system) constructor{ if ((current_owner != eFACTION.Chaos) && (current_owner != eFACTION.Heretics) && (current_owner != eFACTION.Eldar) && (planet_type != "Dead") && (planet_type != "Craftworld")) { success = false; - is_ork = current_owner == eFACTION.ORK; + is_ork = current_owner == eFACTION.Ork; if (!is_ork) { //made a linear function for this while here...now the minimum for the roll is a bit higher, but @@ -1814,7 +1817,7 @@ function PlanetData(planet, system) constructor{ } } - if (success && (pdf == 0) && (guardsmen == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.ORK] == 0)) { + if (success && (pdf == 0) && (guardsmen == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.Ork] == 0)) { current_owner = 10; scr_alert("red", "owner", $"{name()} has fallen to heretics!", x, y); @@ -2072,7 +2075,7 @@ function PlanetData(planet, system) constructor{ } // If there are enemy non-chaos forces then they may be used as a cover // Does not work with chaos because if the governor dies, with chaos present, the new governor would possibly be investigated - if (planet_forces[eFACTION.ORK]>=4) or (planet_forces[eFACTION.Necrons]>=3) or (planet_forces[eFACTION.TYRANIDS]>=5){ + if (planet_forces[eFACTION.Ork]>=4) or (planet_forces[eFACTION.Necrons]>=3) or (planet_forces[eFACTION.TYRANIDS]>=5){ pip.estimate=pip.estimate*0.5; } } diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index dacce92494..ca944c3360 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -242,7 +242,7 @@ function FeatureSelected(Feature, system, planet) constructor{ case eP_FEATURES.ORKSTRONGHOLD: title = "Ork Stronghold"; generic = true; - if (planet_data.planet_forces[eFACTION.ORK]){ + if (planet_data.planet_forces[eFACTION.Ork]){ body = $"For as long as this Stronghold stands the orks here will continue to fortify it. The larger it gets the greater the capacity of this planet to produce orkish machines of war and ships and the better protected the ork forces will be from bombardment"; } else { body = "Without a force of orks to hold it together the fortress is slowly pulled apart from within by the inhabitants, It's capabilities will constantly decrease until soon there will be nothing left"; diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 4b63070b0f..47c8ad9873 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -333,7 +333,7 @@ function scr_enemy_ai_a() { var after_combat_guard=guard_score; var after_combat_guard_count=p_guardsmen[_run]; var after_combat_pdf=pdf_score; - var after_combat_ork_force=planet_forces[eFACTION.ORK]; + var after_combat_ork_force=planet_forces[eFACTION.Ork]; var after_combat_tau=planet_forces[eFACTION.TAU]; var after_combat_traitor=traitors_score; var after_combat_csm=csm_score; @@ -346,7 +346,7 @@ function scr_enemy_ai_a() { var _active_garrison = pdf_with_player && garrison.viable_garrison>0; // Guard attack if (guard_score>0) and (guard_attack!="") and (guard_score>0.5){ - if (guard_attack="ork") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK]; + if (guard_attack="ork") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork]; if (guard_attack="tau") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.TAU]; if (guard_attack="traitors") then tempor=choose(1,2,3,4,5,6)*traitors_score; if (guard_attack="csm") then tempor=choose(2,3,4,5,6,7)*csm_score; @@ -354,7 +354,7 @@ function scr_enemy_ai_a() { rand1=choose(1,2,3,4,5)*guard_score; - if (guard_attack="ork") and (planet_forces[eFACTION.ORK]>guard_score) then rand1=0; + if (guard_attack="ork") and (planet_forces[eFACTION.Ork]>guard_score) then rand1=0; if (guard_attack="tau") and (planet_forces[eFACTION.TAU]>guard_score) then rand1=0; if (guard_attack="traitors") and (traitors_score>guard_score) then rand1=0; if (guard_attack="csm") and (csm_score>guard_score) then rand1=0; @@ -405,7 +405,7 @@ function scr_enemy_ai_a() { // PDF attack if ((pdf_score>0) and (pdf_attack!="")) or ((pdf_score>1) and (guard_score<0.5)){ - if (pdf_attack="ork") then tempor=planet_forces[eFACTION.ORK]; + if (pdf_attack="ork") then tempor=planet_forces[eFACTION.Ork]; if (pdf_attack="tau") then tempor=planet_forces[eFACTION.TAU]; if (pdf_attack="traitors") then tempor=traitors_score; if (pdf_attack="csm") then tempor=csm_score; @@ -453,7 +453,7 @@ function scr_enemy_ai_a() { rand2=(choose(2,3,4,5)*planet_forces[eFACTION.TAU])*choose(1,1.25); if (rand1>rand2) then after_combat_tau-=1; }else if(sisters_attack="ork"){ - rand2=(choose(2,3,4,5)*planet_forces[eFACTION.ORK])*choose(1,1.25); + rand2=(choose(2,3,4,5)*planet_forces[eFACTION.Ork])*choose(1,1.25); if (rand1>rand2) then after_combat_ork_force-=1; }else if(sisters_attack="traitors"){ rand2=(choose(1,2,3,4,5)*traitors_score)*choose(1,1.25); @@ -488,7 +488,7 @@ function scr_enemy_ai_a() { rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.TAU]; if (tau_attack="ork"){ - rand2=(choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK])*choose(1,1.25); + rand2=(choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork])*choose(1,1.25); if (rand1>rand2) then after_combat_ork_force-=1; }else if (tau_attack="traitors"){ rand2=(choose(1,2,3,4,5,6)*traitors_score)*choose(1,1.25); @@ -516,8 +516,8 @@ function scr_enemy_ai_a() { } // ork attack - if (planet_forces[eFACTION.ORK]>0) and (ork_attack!="") and (ork_attack!="player"){ - rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK]; + if (planet_forces[eFACTION.Ork]>0) and (ork_attack!="") and (ork_attack!="player"){ + rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork]; if (!stop) { // Start stop From 9fad1978ef421f96b448390cb4368115581050e1 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 17:13:46 +0100 Subject: [PATCH 47/93] restore starship mission function --- scripts/scr_PlanetData/scr_PlanetData.gml | 43 ++++++----------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 5a7cc972e9..0b019f88f9 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -710,12 +710,12 @@ function PlanetData(planet, system) constructor{ } - static recover_starship = function(techs){ - try { - var engineer_count = array_length(techs); - if (has_feature(eP_FEATURES.STARSHIP) && engineer_count>0){ - //TODO allow total tech point usage here - var _starship = get_features(eP_FEATURES.STARSHIP)[0]; + static recover_starship = function(techs) { + try { + var engineer_count = array_length(techs); + if (has_feature(eP_FEATURES.STARSHIP) && engineer_count > 0) { + //TODO allow total tech point usage here + var _starship = get_features(eP_FEATURES.STARSHIP)[0]; var _engineer_score_start = _starship.engineer_score; if (_starship.engineer_score < 2000) { @@ -727,33 +727,10 @@ function PlanetData(planet, system) constructor{ var _target_spend = 10000; - var _maxr=floor(obj_controller.requisition/50); - var _requisition_spend=min(_maxr*50,array_length(techs)*50,_target_spend-_starship.funds_spent); - obj_controller.requisition-=_requisition_spend; - _starship.funds_spent+=_requisition_spend; - - if (_requisition_spend>0 && _starship.funds_spent<_target_spend){ - scr_alert("green","owner",$"{_requisition_spend} Requisition spent on Ancient Ship repairs in materials and outfitting (outfitting {(_starship.funds_spent/_target_spend)*100}%)",system.x,system.y); - } - if (_starship.funds_spent>=_target_spend && _starship.engineer_score>=2000){// u2=tar; - //TODO refactor into general new ship logic - delete_feature(eP_FEATURES.STARSHIP); - - var locy=$"{name()}"; - - var flit=instance_create(system.x,system.y,obj_p_fleet); - - var _slaughter = new_player_ship("Gloriana", system.name, "Slaughtersong"); - add_ship_to_fleet(_slaughter, flit); - flit.oribiting = system.id; - - scr_popup($"Ancient Ship Restored",$"The ancient ship within the ruins of {locy} has been fully repaired. It is determined to be a Gloriana Class vessel and is bristling with golden age weaponry and armour. Your {string(obj_ini.role[100][16])}s are excited; the Slaughtersong is ready for it's maiden voyage, at your command.","",""); - } - } - }catch (_exception){ - handle_exception(_exception); - } - } + var _maxr = floor(obj_controller.requisition / 50); + var _requisition_spend = min(_maxr * 50, array_length(techs) * 50, _target_spend - _starship.funds_spent); + obj_controller.requisition -= _requisition_spend; + _starship.funds_spent += _requisition_spend; if (_requisition_spend > 0 && _starship.funds_spent < _target_spend) { scr_alert("green", "owner", $"{_requisition_spend} Requision spent on Ancient Ship repairs in materials and outfitting (outfitting {(_starship.funds_spent / _target_spend) * 100}%)", system.x, system.y); From ed92e562a018622774cc54ae0b9571b3406e79ed Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 17:27:32 +0100 Subject: [PATCH 48/93] planet data debugging --- scripts/scr_PlanetData/scr_PlanetData.gml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 0b019f88f9..b11100166e 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -5,11 +5,11 @@ //safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere //disposition -function PlanetData(planet, system) constructor{ -// +function PlanetData(planet, system) constructor { + static large_pop_conversion = 1000000000; self.planet = planet; - self.system = system; + self.system = system; static refresh_data = function(){ @@ -87,7 +87,7 @@ function PlanetData(planet, system) constructor{ requests_help = system.p_halp[planet]; - //safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere + //safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere //disposition if (system.dispo[planet] < -100 && system.dispo[planet] > -1000 && system.p_owner[planet] != eFACTION.PLAYER ) { // Personal Rule code be doing some interesting things system.dispo[planet] = -100; // TODO LOW DISPOSITION_REVAMP // Consider revamping the disposition system @@ -2056,8 +2056,6 @@ function PlanetData(planet, system) constructor{ pip.estimate=pip.estimate*0.5; } } - - } From b6fe4ae9f5f3881282d60bc52dc33c0a7eab55fa Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 19:10:54 +0100 Subject: [PATCH 49/93] fallen mission patch --- scripts/scr_PlanetData/scr_PlanetData.gml | 142 +++++++++--------- .../scr_draw_planet_features.gml | 10 +- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 16 +- scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml | 2 +- .../scr_fleet_functions.gml | 6 +- .../scr_forge_world_functions.gml | 4 +- scripts/scr_purge_world/scr_purge_world.gml | 2 +- scripts/scr_random_event/scr_random_event.gml | 50 ++---- 8 files changed, 99 insertions(+), 133 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index b11100166e..5bda25c89f 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -51,13 +51,13 @@ function PlanetData(planet, system) constructor { planet_forces[eFACTION.Ecclesiarchy] = system.p_sisters[planet]; planet_forces[eFACTION.Eldar] = system.p_eldar[planet]; - planet_forces[eFACTION.Ork] = system.p_orks[planet]; + planet_forces[eFACTION.ORK] = system.p_orks[planet]; planet_forces[eFACTION.TAU] = system.p_tau[planet]; planet_forces[eFACTION.TYRANIDS] = system.p_tyranids[planet]; - planet_forces[eFACTION.Chaos] = system.p_chaos[planet]+ system.p_demons[planet]; - planet_forces[eFACTION.Heretics] = system.p_traitors[planet]; + planet_forces[eFACTION.CHAOS] = system.p_chaos[planet]+ system.p_demons[planet]; + planet_forces[eFACTION.HERETICS] = system.p_traitors[planet]; - planet_forces[eFACTION.Necrons] = system.p_necrons[planet]; + planet_forces[eFACTION.NECRONS] = system.p_necrons[planet]; }catch(_exception){ handle_exception(_exception); } @@ -98,6 +98,15 @@ function PlanetData(planet, system) constructor { garrisons = system.system_garrison[planet]; sabatours = system.system_sabatours[planet]; system.system_datas[planet] = self; + + // current planet heresy + if (population == 0) { + system.p_heresy[planet] = 0; + system.p_heresy_secret[planet] = 0; + for (var i = 0; i < array_length(system.p_influence[planet]); ++i) { + system.p_influence[planet][i] = 0; + } + } } refresh_data(); @@ -156,7 +165,7 @@ function PlanetData(planet, system) constructor { }; static end_turn_population_growth = function(){ - if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.Heretics] == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.Ork] == 0) && (planet_forces[eFACTION.Necrons] == 0) && (planet_forces[eFACTION.TYRANIDS] == 0)) { + if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.HERETICS] == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.ORK] == 0) && (planet_forces[eFACTION.NECRONS] == 0) && (planet_forces[eFACTION.TYRANIDS] == 0)) { if (!large_population) { set_population(round(population * 1.0008)); } else if (large_population == 1) { @@ -320,7 +329,8 @@ function PlanetData(planet, system) constructor { add_event({duration: _duration, e_id: "governor_assassination", variant: assaination_type, system: system.name, planet: planet}); } return _text; - } + }; + static grow_ork_forces = function(){ var contin = 0; var _rando = roll_dice(1,100);// This part handles the spreading @@ -351,17 +361,17 @@ function PlanetData(planet, system) constructor { _ork_growth_threshold *= 2; } - var _orks = planet_forces[eFACTION.Ork]; - if ((current_owner == eFACTION.Ork) && (_orks < 5) && (planet_forces[eFACTION.Heretics] == 0) && (player_forces <= 0 || !is_garrison_force)) { + var _orks = planet_forces[eFACTION.ORK]; + if ((current_owner == eFACTION.ORK) && (_orks < 5) && (planet_forces[eFACTION.HERETICS] == 0) && (player_forces <= 0 || !is_garrison_force)) { if ((_orks> 0) && (_ork_growth <= _ork_growth_threshold)) { if (sabotage_force) { if (irandom(3) < 2) { scr_event_log("green", $"sabotage force on {name()} disrupts ork forces", name); } else { - add_forces(eFACTION.Ork,1); + add_forces(eFACTION.ORK,1); } } else { - add_forces(eFACTION.Ork,1); + add_forces(eFACTION.ORK,1); } } } @@ -440,7 +450,7 @@ function PlanetData(planet, system) constructor { if (_has_stronghold){ _rando -= _stronghold.tier*5; } - if (obj_controller.known[eFACTION.Ork]>0) then _rando-=10;// Empire bonus, was 15 before + if (obj_controller.known[eFACTION.ORK]>0) then _rando-=10;// Empire bonus, was 15 before // Check for industrial facilities var fleet_buildable = (planet_type != "Dead" && planet_type != "Lava") || _has_warboss || _has_stronghold; @@ -460,7 +470,7 @@ function PlanetData(planet, system) constructor { }else if (planet_type == "Agri"){ _rando-=10; } - var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); + var _ork_fleet = scr_orbiting_fleet(eFACTION.ORK, system); if (_ork_fleet=="none"){ if (_rando<=20){ new_ork_fleet(x,y); @@ -475,7 +485,7 @@ function PlanetData(planet, system) constructor { with (_ork_fleet){ // Increase ship number for this object? var _rando=irandom(101); - if (obj_controller.known[eFACTION.Ork]>0) then _rando-=10; + if (obj_controller.known[eFACTION.ORK]>0) then _rando-=10; var _planet_type = _pdata.planet_type; if (_planet_type=="Forge"){ _rando-=20; @@ -544,7 +554,7 @@ function PlanetData(planet, system) constructor { } if (_has_warboss){ _rando=roll_dice(1,100)+10; - var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); + var _ork_fleet = scr_orbiting_fleet(eFACTION.ORK, system); if (_ork_fleet!="none" && _rando < _warboss.turns_static){ _warboss.turns_static = 0; _ork_fleet.cargo_data.ork_warboss = _warboss; @@ -556,15 +566,6 @@ function PlanetData(planet, system) constructor { } }; - // current planet heresy - if (population == 0) { - system.p_heresy[planet] = 0; - system.p_heresy_secret[planet] = 0; - for (var i = 0; i < array_length(system.p_influence[planet]); ++i) { - system.p_influence[planet][i] = 0; - } - } - static alter_corruption = function(value){ alter_planet_corruption(value, planet, system); corruption = system.p_heresy[planet]; @@ -705,10 +706,7 @@ function PlanetData(planet, system) constructor { } } } - - - } - + }; static recover_starship = function(techs) { try { @@ -950,10 +948,10 @@ function PlanetData(planet, system) constructor { static pdf_defence_loss_to_orks = function(){ var active_garrison = pdf_will_support_player() && garrisons.viable_garrison>0; - if (planet_forces[eFACTION.Ork]>=4) and (pdf>=30000){ + if (planet_forces[eFACTION.ORK]>=4) and (pdf>=30000){ pdf=floor(pdf*(min(0.95, 0.55+pdf_loss_reduction))); } - else if (planet_forces[eFACTION.Ork]>=4 && pdf<30000 && pdf>=10000){ + else if (planet_forces[eFACTION.ORK]>=4 && pdf<30000 && pdf>=10000){ pdf=active_garrison?pdf*0.4:0; } if ((planet_forces[eFACTION.ORK] >= 2) && (pdf < 2000)) { @@ -1408,7 +1406,7 @@ function PlanetData(planet, system) constructor { strength = strength>2 ? 2 : 0; system.p_tyranids[planet]-=2; } - else if (planet_forces[eFACTION.Ork]>0){ + else if (planet_forces[eFACTION.ORK]>0){ if (strength>2) then strength=2; if (strength<1) then strength=0; system.p_orks[planet]-=2; @@ -1543,7 +1541,7 @@ function PlanetData(planet, system) constructor { } } - } + }; static end_of_turn_population_influence_and_enemy_growth = function(){ @@ -1563,14 +1561,14 @@ function PlanetData(planet, system) constructor { has_awake_tomb = true; } if (has_awake_tomb) { - if (planet_forces[eFACTION.Necrons] < 3) { - planet_forces[eFACTION.Necrons] += 2; - } else if (planet_forces[eFACTION.Necrons] < 6) { - planet_forces[eFACTION.Necrons] += 1; + if (planet_forces[eFACTION.NECRONS] < 3) { + planet_forces[eFACTION.NECRONS] += 2; + } else if (planet_forces[eFACTION.NECRONS] < 6) { + planet_forces[eFACTION.NECRONS] += 1; } } if (sabotage_force && irandom(2) < 2) { - planet_forces[eFACTION.Necrons]--; + planet_forces[eFACTION.NECRONS]--; scr_event_log("green", $"sabotage force on {name()} disrupts necron forces", name); } @@ -1588,11 +1586,11 @@ function PlanetData(planet, system) constructor { onceh = 0; if (fleet_spawn_chance <= 15) { - if (system.present_fleet[eFACTION.Necrons] > 0) { + if (system.present_fleet[eFACTION.NECRONS] > 0) { //if necron fleet necron_fleet = instance_nearest(x, y, obj_en_fleet); - if (necron_fleet.owner == eFACTION.Necrons) { + if (necron_fleet.owner == eFACTION.NECRONS) { if (necron_fleet.escort_number < necron_fleet.capital_number * 1.5) { necron_fleet.escort_number += 2; } else if (necron_fleet.frigate_number < necron_fleet.capital_number * 3) { @@ -1601,18 +1599,18 @@ function PlanetData(planet, system) constructor { necron_fleet.capital_number += 1; } } - } else if (system.present_fleet[eFACTION.Necrons] == 0) { + } else if (system.present_fleet[eFACTION.NECRONS] == 0) { necron_fleet = instance_create(x, y, obj_en_fleet); - necron_fleet.owner = eFACTION.Necrons; + necron_fleet.owner = eFACTION.NECRONS; necron_fleet.capital_number = 1; necron_fleet.sprite_index = spr_fleet_necron; necron_fleet.image_speed = 0; necron_fleet.image_index = 1; - system.present_fleet[eFACTION.Necrons] += 1; + system.present_fleet[eFACTION.NECRONS] += 1; } var enemy_fleets = 0; with(necron_fleet) { - if (owner == eFACTION.Necrons) { + if (owner == eFACTION.NECRONS) { var ii = 0; ii += capital_number; ii += round((frigate_number / 2)); @@ -1633,14 +1631,14 @@ function PlanetData(planet, system) constructor { if (enemy_fleets > 0) { var necron_fleet2; necron_fleet2 = instance_create(x, y, obj_en_fleet); - necron_fleet2.owner = eFACTION.Necrons; + necron_fleet2.owner = eFACTION.NECRONS; necron_fleet2.sprite_index = spr_fleet_necron; // necron_fleet2.image_index=0; necron_fleet.image_speed = 0; necron_fleet2.capital_number = 1; necron_fleet2.frigate_number = round(necron_fleet.frigate_number / 2); necron_fleet2.escort_number = round(necron_fleet.escort_number / 2); - system.present_fleet[eFACTION.Necrons] += 1; + system.present_fleet[eFACTION.NECRONS] += 1; necron_fleet.capital_number -= 1; necron_fleet.frigate_number -= necron_fleet2.frigate_number; @@ -1648,7 +1646,7 @@ function PlanetData(planet, system) constructor { var nearest_planet_coords = [0, 0]; var found_near_planet = false; with(obj_star) { - if (present_fleet[eFACTION.Necrons] == 0) { + if (present_fleet[eFACTION.NECRONS] == 0) { if (!array_contains(p_type, "Dead")) { for (var plan = 1; plan <= planets; plan++) { if (p_owner[plan] <= 5) { @@ -1706,7 +1704,7 @@ function PlanetData(planet, system) constructor { } - } + }; static end_turn_genestealer_cults = function(){ @@ -1763,7 +1761,7 @@ function PlanetData(planet, system) constructor { add_feature(eP_FEATURES.GENE_STEALER_CULT); } } - } + }; static end_turn_heretics_and_corruption_growth = function(){ // traitors cults @@ -1773,13 +1771,13 @@ function PlanetData(planet, system) constructor { var _rando = roll_dice(1,100); - if ((current_owner == eFACTION.Chaos) && (corruption < 80)) { + if ((current_owner == eFACTION.CHAOS) && (corruption < 80)) { alter_corruption(1); } - if ((current_owner != eFACTION.Chaos) && (current_owner != eFACTION.Heretics) && (current_owner != eFACTION.Eldar) && (planet_type != "Dead") && (planet_type != "Craftworld")) { + if ((current_owner != eFACTION.CHAOS) && (current_owner != eFACTION.HERETICS) && (current_owner != eFACTION.Eldar) && (planet_type != "Dead") && (planet_type != "Craftworld")) { success = false; - is_ork = current_owner == eFACTION.Ork; + is_ork = current_owner == eFACTION.ORK; if (!is_ork) { //made a linear function for this while here...now the minimum for the roll is a bit higher, but @@ -1794,7 +1792,7 @@ function PlanetData(planet, system) constructor { } } - if (success && (pdf == 0) && (guardsmen == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.Ork] == 0)) { + if (success && (pdf == 0) && (guardsmen == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.ORK] == 0)) { current_owner = 10; scr_alert("red", "owner", $"{name()} has fallen to heretics!", x, y); @@ -1839,12 +1837,12 @@ function PlanetData(planet, system) constructor { if (pdf <= 500) { lost = pdf ; - edit_forces(eFACTION.Heretics, 1); + edit_forces(eFACTION.HERETICS, 1); } edit_pdf(-lost); - if (planet_forces[eFACTION.Heretics] == 0) { + if (planet_forces[eFACTION.HERETICS] == 0) { if (pdf > 0) { tixt = $"{scr_display_number(lost)} PDF killed in a rebellion on {name()}."; } else if (pdf == 0) { @@ -1861,33 +1859,33 @@ function PlanetData(planet, system) constructor { corruption -= irandom(5); } // Cult crushed; don't bother showing if there's already fighting going on over there - } else if ((_rando >= 41) && (_rando < 81) && (planet_forces[eFACTION.Heretics] < 2)) { + } else if ((_rando >= 41) && (_rando < 81) && (planet_forces[eFACTION.HERETICS] < 2)) { if (is_garrison_force) { traitor_mod = choose(1, 2); } else { traitor_mod = 2; } - planet_forces[eFACTION.Heretics] = traitor_mod; + planet_forces[eFACTION.HERETICS] = traitor_mod; tixt = $"Heretic cults have appeared in {name()}."; - } else if ((_rando >= 81) && (_rando < 91) && (planet_forces[eFACTION.Heretics] < 3)) { + } else if ((_rando >= 81) && (_rando < 91) && (planet_forces[eFACTION.HERETICS] < 3)) { // Minor uprising if (is_garrison_force) { traitor_mod = choose(2, 3); } else { traitor_mod = 3; } - edit_forces(eFACTION.Heretics,traitor_mod); + edit_forces(eFACTION.HERETICS,traitor_mod); tixt = $"Heretic cults have spread around {name()}."; } // Major uprising // major and huge uprisings are impossible as long as a garrisons of at least 10 marines is present - if ((_rando >= 91) && (_rando < 100) && (planet_forces[eFACTION.Heretics] < 4)) { + if ((_rando >= 91) && (_rando < 100) && (planet_forces[eFACTION.HERETICS] < 4)) { notixt = true; - edit_forces(eFACTION.Heretics,4); + edit_forces(eFACTION.HERETICS,4); if ((obj_controller.faction_defeated[10] == 0) && (obj_controller.faction_gender[10] == 1)) { - edit_forces(eFACTION.Heretics,5); + edit_forces(eFACTION.HERETICS,5); } var n_name = name(); @@ -1896,9 +1894,9 @@ function PlanetData(planet, system) constructor { scr_event_log("purple", $"Massive heretic uprising on {n_name}.", system.name); } // Huge uprising - if ((_rando >= 100) && (planet_forces[eFACTION.Heretics] < 5)) { - edit_forces(eFACTION.Heretics,6); - set_new_owner(eFACTION.Heretics) + if ((_rando >= 100) && (planet_forces[eFACTION.HERETICS] < 5)) { + edit_forces(eFACTION.HERETICS,6); + set_new_owner(eFACTION.HERETICS) add_feature(eP_FEATURES.DAEMONIC_INCURSION); set_corruption(corruption < 80 ? 80 : 95) @@ -1910,11 +1908,11 @@ function PlanetData(planet, system) constructor { scr_alert("red", "owner", tixt, x, y); scr_event_log("purple", tixt, system.name); } - // if (planet_forces[eFACTION.Heretics]>2){obj_controller.x=self.x;obj_controller.y=self.y;} + // if (planet_forces[eFACTION.HERETICS]>2){obj_controller.x=self.x;obj_controller.y=self.y;} } // End traitors cult } - } + }; static check_old_battles_feature = function(){ if (has_feature(eP_FEATURES.OLDBATTLEGROUND)){ @@ -1950,13 +1948,13 @@ function PlanetData(planet, system) constructor { set_movement(true,"move",); } - scr_popup("Mechanicus Exploration", $"A Mechanicus Exploration fleet has set off from {_star.name} to explore the battle grounds of {name()}. It will arrive in aproximatly {_time} months time"); + scr_popup("Mechanicus Exploration", $"A Mechanicus Exploration fleet has set off from {_star.name} to explore the battle grounds of {name()}. It will arrive in aproximatly {_time} months time","mechanicus"); } } } } - } + }; static purge = scr_purge_world; @@ -2052,13 +2050,9 @@ function PlanetData(planet, system) constructor { } // If there are enemy non-chaos forces then they may be used as a cover // Does not work with chaos because if the governor dies, with chaos present, the new governor would possibly be investigated - if (planet_forces[eFACTION.Ork]>=4) or (planet_forces[eFACTION.Necrons]>=3) or (planet_forces[eFACTION.TYRANIDS]>=5){ + if (planet_forces[eFACTION.ORK]>=4) or (planet_forces[eFACTION.NECRONS]>=3) or (planet_forces[eFACTION.TYRANIDS]>=5){ pip.estimate=pip.estimate*0.5; } - } -} - - - - + }; +} diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index ca944c3360..0d0482b788 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -242,20 +242,12 @@ function FeatureSelected(Feature, system, planet) constructor{ case eP_FEATURES.ORKSTRONGHOLD: title = "Ork Stronghold"; generic = true; - if (planet_data.planet_forces[eFACTION.Ork]){ + if (planet_data.planet_forces[eFACTION.ORK]){ body = $"For as long as this Stronghold stands the orks here will continue to fortify it. The larger it gets the greater the capacity of this planet to produce orkish machines of war and ships and the better protected the ork forces will be from bombardment"; } else { body = "Without a force of orks to hold it together the fortress is slowly pulled apart from within by the inhabitants, It's capabilities will constantly decrease until soon there will be nothing left"; } break - case eP_FEATURES.RECRUITING_WORLD: - generic = true; - if (planet_data.planet_forces[eFACTION.ORK]) { - body = $"For as long as this Stronghold stands the orks here will continue to fortify it. The larger it gets the greater the capacity of this planet to produce orkish machines of war and ships and the better protected the ork forces will be from bombardment"; - } else { - body = "Without a force of orks to hold it together the fortress is slowly pulled apart from within by the inhabitants, It's capabilities will constantly decrease until soon there will be nothing left"; - } - break; case eP_FEATURES.RECRUITING_WORLD: generic = true; var _planet = planet_data.planet; diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 47c8ad9873..4b63070b0f 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -333,7 +333,7 @@ function scr_enemy_ai_a() { var after_combat_guard=guard_score; var after_combat_guard_count=p_guardsmen[_run]; var after_combat_pdf=pdf_score; - var after_combat_ork_force=planet_forces[eFACTION.Ork]; + var after_combat_ork_force=planet_forces[eFACTION.ORK]; var after_combat_tau=planet_forces[eFACTION.TAU]; var after_combat_traitor=traitors_score; var after_combat_csm=csm_score; @@ -346,7 +346,7 @@ function scr_enemy_ai_a() { var _active_garrison = pdf_with_player && garrison.viable_garrison>0; // Guard attack if (guard_score>0) and (guard_attack!="") and (guard_score>0.5){ - if (guard_attack="ork") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork]; + if (guard_attack="ork") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK]; if (guard_attack="tau") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.TAU]; if (guard_attack="traitors") then tempor=choose(1,2,3,4,5,6)*traitors_score; if (guard_attack="csm") then tempor=choose(2,3,4,5,6,7)*csm_score; @@ -354,7 +354,7 @@ function scr_enemy_ai_a() { rand1=choose(1,2,3,4,5)*guard_score; - if (guard_attack="ork") and (planet_forces[eFACTION.Ork]>guard_score) then rand1=0; + if (guard_attack="ork") and (planet_forces[eFACTION.ORK]>guard_score) then rand1=0; if (guard_attack="tau") and (planet_forces[eFACTION.TAU]>guard_score) then rand1=0; if (guard_attack="traitors") and (traitors_score>guard_score) then rand1=0; if (guard_attack="csm") and (csm_score>guard_score) then rand1=0; @@ -405,7 +405,7 @@ function scr_enemy_ai_a() { // PDF attack if ((pdf_score>0) and (pdf_attack!="")) or ((pdf_score>1) and (guard_score<0.5)){ - if (pdf_attack="ork") then tempor=planet_forces[eFACTION.Ork]; + if (pdf_attack="ork") then tempor=planet_forces[eFACTION.ORK]; if (pdf_attack="tau") then tempor=planet_forces[eFACTION.TAU]; if (pdf_attack="traitors") then tempor=traitors_score; if (pdf_attack="csm") then tempor=csm_score; @@ -453,7 +453,7 @@ function scr_enemy_ai_a() { rand2=(choose(2,3,4,5)*planet_forces[eFACTION.TAU])*choose(1,1.25); if (rand1>rand2) then after_combat_tau-=1; }else if(sisters_attack="ork"){ - rand2=(choose(2,3,4,5)*planet_forces[eFACTION.Ork])*choose(1,1.25); + rand2=(choose(2,3,4,5)*planet_forces[eFACTION.ORK])*choose(1,1.25); if (rand1>rand2) then after_combat_ork_force-=1; }else if(sisters_attack="traitors"){ rand2=(choose(1,2,3,4,5)*traitors_score)*choose(1,1.25); @@ -488,7 +488,7 @@ function scr_enemy_ai_a() { rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.TAU]; if (tau_attack="ork"){ - rand2=(choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork])*choose(1,1.25); + rand2=(choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK])*choose(1,1.25); if (rand1>rand2) then after_combat_ork_force-=1; }else if (tau_attack="traitors"){ rand2=(choose(1,2,3,4,5,6)*traitors_score)*choose(1,1.25); @@ -516,8 +516,8 @@ function scr_enemy_ai_a() { } // ork attack - if (planet_forces[eFACTION.Ork]>0) and (ork_attack!="") and (ork_attack!="player"){ - rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork]; + if (planet_forces[eFACTION.ORK]>0) and (ork_attack!="") and (ork_attack!="player"){ + rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK]; if (!stop) { // Start stop diff --git a/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml b/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml index 0a23695f3e..e37f370654 100644 --- a/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml +++ b/scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml @@ -9,7 +9,7 @@ function scr_enemy_ai_b() { for (i = 1; i <= planets; i++) { system_datas[i].refresh_data(); system_datas[i].end_of_turn_population_influence_and_enemy_growth(); - // if (p_heresy[i]>0) and (owner != eFACTION.Chaos) then p_heresy[i]-=2; + // if (p_heresy[i]>0) and (owner != eFACTION.CHAOS) then p_heresy[i]-=2; } // Tau rebellions if ((present_fleet[8] >= 1) && (owner != eFACTION.TAU)) { diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index b6fcb25818..9712f10924 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -905,7 +905,7 @@ function fleet_arrival_logic() { _attempt_merge = false; } - if (owner=eFACTION.Chaos) and (fleet_has_cargo("csm")) or ( fleet_has_cargo("warband")){ + if (owner=eFACTION.CHAOS) and (fleet_has_cargo("csm")) or ( fleet_has_cargo("warband")){ var _csm = fleet_has_cargo("warband"); _attempt_merge = false; } @@ -923,7 +923,7 @@ function fleet_arrival_logic() { //if fleet is damaged but existing fleet is too large to merge feck off elsewhere preferably somewhere friendly - else if (_same_owner && (owner == eFACTION.TAU || (owner = eFACTION.Chaos && !csm))){// Move somewhere new + else if (_same_owner && (owner == eFACTION.TAU || (owner = eFACTION.CHAOS && !csm))){// Move somewhere new if (standard_fleet_strength_calc()<3){ @@ -1163,7 +1163,7 @@ function merge_fleets(main_fleet, merge_fleet){ merge_fleet.orbiting.tau_fleets--; } break; - case eFACTION.Chaos: + case eFACTION.CHAOS: obj_controller.chaos_fleets--; break; diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index a692b99128..eb840eccf6 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -72,8 +72,8 @@ function get_imperium_forge_systems(){ eFACTION.ORK, eFACTION.TAU, eFACTION.TYRANIDS, - eFACTION.Chaos, - eFACTION.Necrons + eFACTION.CHAOS, + eFACTION.NECRONS ] var enemy_fleet_count = array_reduce(enemy_fleets, function(prev, curr) { diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index ad1d2c7a6f..0bd872b7b0 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -5,7 +5,7 @@ function scr_purge_world(action_type, action_score) { var _pop_before = population; - var _no_chaos = (planet_forces[eFACTION.Heretics] + planet_forces[eFACTION.Chaos])==0 + var _no_chaos = (planet_forces[eFACTION.HERETICS] + planet_forces[eFACTION.CHAOS])==0 if ((action_type==eDROPTYPE.PURGEFIRE || action_type==eDROPTYPE.PURGESELECTIVE) && _no_chaos && obj_controller.turn>=obj_controller.chaos_turn){ if (has_feature(P_features.Warlord10) && obj_controller.known[10]=0 && obj_controller.faction_gender[10]=1){ with(obj_drop_select){ diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index 0f701384de..d1070738e7 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -303,10 +303,6 @@ function scr_random_event(execute_now) { } } } - - scr_event_log("",$"The Space Hulk {spaceHulk.name} appears near the {star_id.name} system.",star_id.name); - _evented = true; - } catch(_exception){ handle_exception(_exception); } @@ -958,37 +954,21 @@ function event_fallen() { var planet = scr_get_planet_with_owner(star, eFACTION.IMPERIUM); var eta = scr_mission_eta(star.x, star.y, 1); - if (!assigned_problem) { - log_error("RE: Hunt the Fallen, coulnd't assign a problem to the planet"); - return; - } - - var _planet = system_datas[planet]; - _planet.refresh_data(); - - var text = $"Sources indicate one of the Fallen may be upon {_planet.name()} . We have {eta} months to send out a strike team and scour the planet. Any longer and any Fallen that might be there will have escaped."; - scr_popup("Hunt the Fallen",text,"fallen",""); - scr_event_log("",$"Sources indicate one of the Fallen may be upon {_planet.name()}. We have {eta} months to investigate."); - var star_alert = instance_create(star.x+16,star.y-24,obj_star_event); - star_alert.image_alpha=1; - star_alert.image_speed=1; - star_alert.col="purple"; + var assigned_problem = add_new_problem(planet, "fallen", eta, star); + LOGGER.info($"assigned_problem {assigned_problem}"); + if (!assigned_problem) { + log_error("RE: Hunt the Fallen, coulnd't assign a problem to the planet"); + return; } - var assigned_problem = add_new_problem(planet, "fallen", eta, star); - LOGGER.info($"assigned_problem {assigned_problem}"); - - if (!assigned_problem) { - LOGGER.error("RE: Hunt the Fallen, coulnd't assign a problem to the planet"); - return; - } - - var text = "Sources indicate one of the Fallen may be upon " + string(star.name) + " " + string(scr_roman(planet)) + ". We have " + string(eta) + " months to send out a strike team and scour the planet. Any longer and any Fallen that might be there will have escaped."; - scr_popup("Hunt the Fallen", text, "fallen", ""); - scr_event_log("", "Sources indicate one of the Fallen may be upon " + string(star.name) + " " + string(scr_roman(planet)) + ". We have " + string(eta) + " months to investigate."); - var star_alert = instance_create(star.x + 16, star.y - 24, obj_star_event); - star_alert.image_alpha = 1; - star_alert.image_speed = 1; - star_alert.col = "purple"; - } + var _planet = system_datas[planet]; + _planet.refresh_data(); + + var text = $"Sources indicate one of the Fallen may be upon {_planet.name()} . We have {eta} months to send out a strike team and scour the planet. Any longer and any Fallen that might be there will have escaped."; + scr_popup("Hunt the Fallen",text,"fallen",""); + scr_event_log("",$"Sources indicate one of the Fallen may be upon {_planet.name()}. We have {eta} months to investigate."); + var star_alert = instance_create(star.x+16,star.y-24,obj_star_event); + star_alert.image_alpha=1; + star_alert.image_speed=1; + star_alert.col="purple"; } From e988e31bf63785c41aacdfcc6beb5299944985b2 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 19:15:22 +0100 Subject: [PATCH 50/93] porting event shuffling --- scripts/scr_random_event/scr_random_event.gml | 177 ++---------------- 1 file changed, 18 insertions(+), 159 deletions(-) diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index d1070738e7..b448098032 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -218,149 +218,6 @@ function scr_random_event(execute_now) { //DEBUG-FIN (EVENTS DEBUG CODE - 2) } } - - if (!execute_now){ - random_event_next = chosen_event; - exit; - } - - switch (curr_event) { - case eEVENT.INQUISITION_PLANET: - if (known[eFACTION.INQUISITION] == 0 || obj_controller.faction_status[eFACTION.INQUISITION] == "War") { - events_share[i] -= 1; - events_total -= 1; - } - break; - case eEVENT.INQUISITION_MISSION: - if (known[eFACTION.INQUISITION] == 0 || obj_controller.disposition[4] < 0 || obj_controller.faction_status[eFACTION.INQUISITION] == "War") { - events_share[i] -= 1; - events_total -= 1; - } - break; - case eEVENT.MECHANICUS_MISSION: - if (known[eFACTION.MECHANICUS] == 0 || obj_controller.disposition[3] < 50 || obj_controller.faction_status[eFACTION.MECHANICUS] == "War") { - events_share[i] -= 1; - events_total -= 1; - } else if (scr_has_adv("Tech-Brothers")) { - events_share[i] += 2; - events_total += 2; - } - break; - case eEVENT.ENEMY: - if (scr_has_adv("Scavangers")) { - events_share[i] += 2; - events_total += 2; - } - break; - case eEVENT.MUTATION: - if (gene_seed < 5) { - events_share[i] -= 1; - events_total -= 1; - } - break; - case eEVENT.NECRON_AWAKEN: - if (known[eFACTION.INQUISITION] == 0) { - events_share[i] -= 1; - events_total -= 1; - } - break; - case eEVENT.CRUSADE: - if (obj_controller.faction_status[eFACTION.IMPERIUM] == "War") { - events_share[i] -= 1; - events_total -= 1; - } - break; - case eEVENT.FLEET_DELAY: - var has_moving_fleet = false; - with (obj_p_fleet) { - if (action == "move") { - has_moving_fleet = true; - break; - } - } - if (!has_moving_fleet) { - events_share[i] -= 1; - events_total -= 1; - } - break; - case eEVENT.SHIP_LOST: - var has_moving_fleet = false; - with (obj_p_fleet) { - if (action == "move") { - has_moving_fleet = true; - break; - } - } - if (!has_moving_fleet) { - events_share[i] -= 1; - events_total -= 1; - } - break; - case eEVENT.FALLEN: - if (!scr_has_disadv("Never Forgive")) { - events_share[i] -= 1; - events_total -= 1; - } - } - } - catch(_exception){ - handle_exception(_exception); - } - } - } - - else if (chosen_event == EVENT.promotion){ - _evented = init_marine_distinguishment_event() - } - - else if (chosen_event == EVENT.strange_building){ - _evented = strange_build_event(); - } - - else if (chosen_event == EVENT.sororitas){ - log_message("RE: Sororitas Company"); - var own; - own=choose(1,2); - var star_id = scr_random_find(own,true,"",""); - - if(star_id == undefined && own == 1){ - own = 2; - star_id = scr_random_find(own,true,"",""); - } - - if(star_id == undefined){ - log_error("RE: Sororitas Company, couldn't find a star for the company"); - exit; - } - else{ - var eligible_planets = []; - for(var i = 1; i <= star_id.planets;i++){ - if(star_id.p_type[i] != "Dead"){ - array_push(eligible_planets,i); - } - } - if(array_length(eligible_planets) == 0){ - log_error("RE: Sororitas Company, couldn't find a planet on the " + star_id.name + " system for the company"); - exit; - } - - var planet = eligible_planets[irandom(array_length(eligible_planets)-1)]; - ++(star_id.p_sisters[planet]); - _evented = true; - - if ((own!=1) && (star_id.p_player[planet]<=0) && (star_id.present_fleet[1]==0)){ - scr_alert("green","sororitas","Sororitas place a company of sisters on "+string(star_id.name)+" "+string(planet)+".",star_id.x,star_id.y); - } - else{ - scr_popup("Sororitas","The Ecclesiarchy have placed a company of sisters on "+string(star_id.name)+" "+string(planet)+".","sororitas",""); - if (known[eFACTION.Ecclesiarchy]==0){ - known[eFACTION.Ecclesiarchy]=1; // this seesms like a thing another part of code already does, not sure tho - } - } - } - - } else if (chosen_event == EVENT.mechanicus_mission) { - evented = spawn_mechanicus_mission(); if (!execute_now) { random_event_next = chosen_event; @@ -954,21 +811,23 @@ function event_fallen() { var planet = scr_get_planet_with_owner(star, eFACTION.IMPERIUM); var eta = scr_mission_eta(star.x, star.y, 1); - var assigned_problem = add_new_problem(planet, "fallen", eta, star); - LOGGER.info($"assigned_problem {assigned_problem}"); - if (!assigned_problem) { - log_error("RE: Hunt the Fallen, coulnd't assign a problem to the planet"); - return; - } + if (planet>0){ + var assigned_problem = add_new_problem(planet, "fallen", eta, star); + LOGGER.info($"assigned_problem {assigned_problem}"); + if (!assigned_problem) { + log_error("RE: Hunt the Fallen, coulnd't assign a problem to the planet"); + return; + } - var _planet = system_datas[planet]; - _planet.refresh_data(); - - var text = $"Sources indicate one of the Fallen may be upon {_planet.name()} . We have {eta} months to send out a strike team and scour the planet. Any longer and any Fallen that might be there will have escaped."; - scr_popup("Hunt the Fallen",text,"fallen",""); - scr_event_log("",$"Sources indicate one of the Fallen may be upon {_planet.name()}. We have {eta} months to investigate."); - var star_alert = instance_create(star.x+16,star.y-24,obj_star_event); - star_alert.image_alpha=1; - star_alert.image_speed=1; - star_alert.col="purple"; + var _planet = system_datas[planet]; + _planet.refresh_data(); + + var text = $"Sources indicate one of the Fallen may be upon {_planet.name()} . We have {eta} months to send out a strike team and scour the planet. Any longer and any Fallen that might be there will have escaped."; + scr_popup("Hunt the Fallen",text,"fallen",""); + scr_event_log("",$"Sources indicate one of the Fallen may be upon {_planet.name()}. We have {eta} months to investigate."); + var star_alert = instance_create(star.x+16,star.y-24,obj_star_event); + star_alert.image_alpha=1; + star_alert.image_speed=1; + star_alert.col="purple"; + } } From c2bb821096e93922f262d0b82d077f0d421688ac Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 19:23:58 +0100 Subject: [PATCH 51/93] accidental reversioo to old methods --- scripts/scr_PlanetData/scr_PlanetData.gml | 2 +- scripts/scr_Table/scr_Table.gml | 6 ++++-- scripts/scr_cheatcode/scr_cheatcode.gml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 5bda25c89f..9c4a701738 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1113,7 +1113,7 @@ function PlanetData(planet, system) constructor { draw_set_color(0); draw_set_alpha(0.2); draw_rectangle(xx+481,yy+280,xx+716,yy+298,0); - if (scr_click_left() && obj_controller.requisition >= improve_cost){ + if (mouse_button_clicked() && obj_controller.requisition >= improve_cost){ obj_controller.requisition-=improve_cost; alter_fortification(1); diff --git a/scripts/scr_Table/scr_Table.gml b/scripts/scr_Table/scr_Table.gml index 556fd128e5..17d9adce82 100644 --- a/scripts/scr_Table/scr_Table.gml +++ b/scripts/scr_Table/scr_Table.gml @@ -72,6 +72,8 @@ function Table(data) constructor { update(); static draw = function(){ add_draw_return_values(); + + static draw = function() { add_draw_return_values(); @@ -148,12 +150,12 @@ function Table(data) constructor { _row.hover(); } if (struct_exists(_row,"click_left")){ - if (scr_click_left()){ + if (mouse_button_clicked()){ _row.click_left(); } } if (struct_exists(_row,"click_right")){ - if (scr_click_right()){ + if (mouse_button_clicked(mb_right)){ _row.click_right(); } } diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index e2857b0d9f..38e58a09b8 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -485,7 +485,7 @@ function draw_planet_debug_problems(){ draw_text(38, _y, _keys[i]); if (scr_hit(38, _y, 337,_y+20)){ tooltip_draw(mission_name_key(_keys[i])); - if (scr_click_left()){ + if (mouse_button_clicked()){ switch(_keys[i]){ case "inquisitor": mission_inquistion_hunt_inquisitor(target.id); From b1d8c0058e0d8076147033395aa9393e0bc2f915 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 22 Apr 2026 20:09:24 +0100 Subject: [PATCH 52/93] right click to tables --- scripts/scr_Table/scr_Table.gml | 73 ++++----------------------------- 1 file changed, 7 insertions(+), 66 deletions(-) diff --git a/scripts/scr_Table/scr_Table.gml b/scripts/scr_Table/scr_Table.gml index 17d9adce82..d8463d93ae 100644 --- a/scripts/scr_Table/scr_Table.gml +++ b/scripts/scr_Table/scr_Table.gml @@ -18,19 +18,6 @@ function Table(data) constructor { move_data_to_current_scope(data); - static update = function(data={}){ - move_data_to_current_scope(data); - w = 0; - column_widths = []; - header_h = 0; - for (var i=0; i y2 - row_h){ - break; - } - _col_draw_x = x1; - var _row = row_data[i]; - var _row_entered = scr_hit_dimensions(_col_draw_x,_row_level,w,row_h); - if (is_array(row_data[i])){ - for (var d=0;d Date: Thu, 23 Apr 2026 09:58:50 +0100 Subject: [PATCH 53/93] merge error on trade --- scripts/scr_trade/scr_trade.gml | 106 +++++--------------------------- 1 file changed, 16 insertions(+), 90 deletions(-) diff --git a/scripts/scr_trade/scr_trade.gml b/scripts/scr_trade/scr_trade.gml index 3f19f2176c..76753d5db6 100644 --- a/scripts/scr_trade/scr_trade.gml +++ b/scripts/scr_trade/scr_trade.gml @@ -326,94 +326,10 @@ function TradeAttempt(diplomacy) constructor { exit_button = new UnitButtonObject({x1: 818, y1: 796, label: "Exit"}); - trade_from_star = array_random_element(viable_faction_trade_stars); - - - if (!array_length(_stars_with_player_control) || (obj_ini.fleet_type!=ePlayerBase.home_world && array_length(player_fleet_targets))){ - trade_to_obj = array_random_element(player_fleet_targets); - } else if (!array_length(player_fleet_targets)){ - trade_to_obj = array_random_element(_stars_with_player_control); - } else { - trade_to_obj = choose(array_random_element(_stars_with_player_control), array_random_element(player_fleet_targets)); - } - return true; - } - static attempt_trade = function(){ - calculate_deal_chance(); - var attempt_rand = roll_dice_chapter(1, 100, "high"); - var _success = attempt_rand <= deal_chance; - if (_success){ - _success = find_trade_locations(); - if (_success){ - successful_trade_attempt(); - scr_dialogue("agree",{prepend:"[[Trade Accepted. Shipment initialized.]]"}); - //force_goodbye=1; - obj_controller.trading=0; - if (diplomacy_faction=6) or (diplomacy_faction=7) or (diplomacy_faction=8){ - scr_loyalty("Xeno Trade","+"); - } - } else { - //show_debug_message("no trade locations"); - } - } else { - var _dip = diplomacy_faction; - with (obj_controller){ - var _rela=relationship_hostility_matrix(diplomacy); - if (trading_artifact==0){ - diplo_text="[[Trade Refused]]##"; - } else { - diplo_text=""; - } - annoyed[_dip] += 1; - scr_dialogue("disagree",{prepend:"[[Trade Refused]]"}); - rando=choose(1,2,3); - if (_rela=="hostile"){ - force_goodbye=1; - if (rando==1) then diplo_text+="You would offer me scraps for the keys to a kingdom? You are foolish and, worse, you are unaware of your own incompetence."; - if (rando==2) then diplo_text+="Do not attempt exchanges with those so far above you, lapdog of the Corpse Emperor, it makes you look even more idiotic than you already do."; - if (rando==3) then diplo_text+="I would spit upon this ‘offer' you bring before me but I find myself too amused by it."; - } - else if (_rela!="hostile"){ - if (rando==1) then diplo_text+="You may consider my response to be a ‘no' and assume my attitude to be whatever you like, Chapter Master."; - if (rando==2) then diplo_text+="Have a care that you do not overstep the mark, Chapter Master, I see no reason to accept such a trade."; - if (rando==3) then diplo_text+="An unreasonable trade, whatever our working relationship might be. I refuse."; - } - if (annoyed[_dip]>=10){ - force_goodbye=1; - turns_ignored[_dip]=max(turns_ignored[_dip],1); - diplo_last="disagree"; - diplo_char=0; - diplo_alpha=0; - exit; - } - } - clear_options(); - } - - } - - offer_button = new UnitButtonObject({ - x1 : 630, - y1 : 649, - label : "Offer", - }); - offer_button.bind_method = function(){ - if (obj_controller.diplo_last !=" offer"){ - attempt_trade(); - } - } - offer_button.bind_scope = self; - - exit_button = new UnitButtonObject({ - x1 : 818, - y1 : 796, - label : "Exit", - }); - - exit_button.bind_method = function(){ - with (obj_controller){ - cooldown=8; - trading=0; + exit_button.bind_method = function() { + with (obj_controller) { + cooldown = 8; + trading = 0; scr_dialogue("trade_close"); click2 = 1; if (trading_artifact != 0) { @@ -701,8 +617,18 @@ function TradeAttempt(diplomacy) constructor { my_worth += _opt.number * 900; } - deal_chance=(100-penalty)-(((their_worth-(my_worth*dif_penalty)))); - var _chance = clamp(floor((deal_chance/20)), 0, 6); + if (diplomacy_faction == 6) { + my_worth += _opt.number * 500; + } + if (diplomacy_faction == 7) { + my_worth += _opt.number * 500; + } + if (diplomacy_faction == 8) { + my_worth += _opt.number * 1000; + } + } + } + }; trade_likely = ""; static chance_chart = [ From 76883e804f6a9570d8b6cfaae7650f5e88a5369b Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 10:12:54 +0100 Subject: [PATCH 54/93] load more coinstant catch up --- objects/obj_star/Draw_0.gml | 2 +- scripts/scr_PlanetData/scr_PlanetData.gml | 18 +++++++++--------- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 2 +- .../scr_fleet_functions.gml | 8 ++++---- .../scr_forge_world_functions.gml | 6 +++--- .../scr_imperial_navy_functions.gml | 8 ++++---- .../scr_mechanicus_fleet_functions.gml | 2 +- .../scr_mission_functions.gml | 2 +- .../scr_planetary_feature.gml | 2 +- scripts/scr_purge_world/scr_purge_world.gml | 16 ++++++++-------- scripts/scr_random_event/scr_random_event.gml | 10 +++++----- .../scr_system_search_helpers.gml | 2 +- 12 files changed, 39 insertions(+), 39 deletions(-) diff --git a/objects/obj_star/Draw_0.gml b/objects/obj_star/Draw_0.gml index bc39d3a093..a707fdd71a 100644 --- a/objects/obj_star/Draw_0.gml +++ b/objects/obj_star/Draw_0.gml @@ -1,6 +1,6 @@ // Draws the system name and color codes it based on ownership add_draw_return_values(); -if (p_type[1]="Craftworld") and (obj_controller.known[eFACTION.Eldar]=0){ +if (p_type[1]="Craftworld") and (obj_controller.known[eFACTION.ELDAR]=0){ draw_set_alpha(0); draw_set_color(255); draw_circle(old_x, old_y, 5, 0); diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 9c4a701738..f173d22b61 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -47,10 +47,10 @@ function PlanetData(planet, system) constructor { try{ planet_forces[eFACTION.PLAYER] = player_forces; - planet_forces[eFACTION.Imperium] = guardsmen; + planet_forces[eFACTION.IMPERIUM] = guardsmen; - planet_forces[eFACTION.Ecclesiarchy] = system.p_sisters[planet]; - planet_forces[eFACTION.Eldar] = system.p_eldar[planet]; + planet_forces[eFACTION.ECCLESIARCHY] = system.p_sisters[planet]; + planet_forces[eFACTION.ELDAR] = system.p_eldar[planet]; planet_forces[eFACTION.ORK] = system.p_orks[planet]; planet_forces[eFACTION.TAU] = system.p_tau[planet]; planet_forces[eFACTION.TYRANIDS] = system.p_tyranids[planet]; @@ -1034,7 +1034,7 @@ function PlanetData(planet, system) constructor { if (population_influences[i]>0){ draw_set_color(global.star_name_colors[i]); if (_hidden_cult && i == eFACTION.TYRANIDS){ - draw_set_color(global.star_name_colors[eFACTION.Imperium]); + draw_set_color(global.star_name_colors[eFACTION.IMPERIUM]); } var current_start = bar_start_point + (current_bar_percent * bar_percent_length); draw_rectangle(current_start, yy + 193, current_start + (bar_percent_length * population_influences[i]), yy + 210, 0); @@ -1345,7 +1345,7 @@ function PlanetData(planet, system) constructor { var spacing_y = 65 draw_set_halign(fa_left); if (!target.space_hulk) { - if (obj_controller.faction_status[eFACTION.Imperium] != "War" && current_owner <= 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War") { + if (obj_controller.faction_status[eFACTION.IMPERIUM] != "War" && current_owner <= 5) || (obj_controller.faction_status[eFACTION.IMPERIUM] == "War") { colonist_button.update({ x1:xx+35, y1:_half_way, @@ -1454,9 +1454,9 @@ function PlanetData(planet, system) constructor { } } - if (population + pdf<=0) and (current_owner=1) and (obj_controller.faction_status[eFACTION.Imperium]="War"){ + if (population + pdf<=0) and (current_owner=1) and (obj_controller.faction_status[eFACTION.IMPERIUM]="War"){ if (!has_feature(eP_FEATURES.MONASTERY)){ - set_new_owner(eFACTION.Imperium); + set_new_owner(eFACTION.IMPERIUM); add_disposition(-50); } } @@ -1775,7 +1775,7 @@ function PlanetData(planet, system) constructor { alter_corruption(1); } - if ((current_owner != eFACTION.CHAOS) && (current_owner != eFACTION.HERETICS) && (current_owner != eFACTION.Eldar) && (planet_type != "Dead") && (planet_type != "Craftworld")) { + if ((current_owner != eFACTION.CHAOS) && (current_owner != eFACTION.HERETICS) && (current_owner != eFACTION.ELDAR) && (planet_type != "Dead") && (planet_type != "Craftworld")) { success = false; is_ork = current_owner == eFACTION.ORK; @@ -1925,7 +1925,7 @@ function PlanetData(planet, system) constructor { var _sys = system if (_battle.imperium_known){ with (obj_en_fleet){ - if (owner != eFACTION.Mechanicus){ + if (owner != eFACTION.MECHANICUS){ continue; } if (instance_exists(target) && target.id == _sys.id){ diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 4b63070b0f..83963a3e37 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -13,7 +13,7 @@ function scr_enemy_ai_a() { } // guardsmen hop from planet to planet //not sure we really need this as it's handled with tht navy fleet functions but fuck it updated it and leaving it fot the sec - if (system_guard_total()>0 && present_fleet[eFACTION.Imperium]){ + if (system_guard_total()>0 && present_fleet[eFACTION.IMPERIUM]){ var cur_planet=0,most_enemies_found=0,current_guard_planet=0,most_enemies_planet=0; var _guard_planets = guard_find_planet_with_most_enemy_forces(self); diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 9712f10924..b652dbdebc 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -684,7 +684,7 @@ function fleet_arrival_logic() { // cur_star.present_fleets+=1;if (owner = eFACTION.TAU) then cur_star.tau_fleets+=1; - if (owner == eFACTION.Mechanicus){ + if (owner == eFACTION.MECHANICUS){ if (trade_goods == "mars_spelunk1"){ trade_goods="mars_spelunk2"; action_x=home_x; @@ -828,7 +828,7 @@ function fleet_arrival_logic() { var mess = 1, plap = instance_nearest(action_x, action_y, obj_p_fleet); if (string_count("DELETE",trade_goods)>0) then instance_destroy(); - if (obj_controller.known[eFACTION.Inquisition]=0) then obj_controller.known[eFACTION.Inquisition]=1; + if (obj_controller.known[eFACTION.INQUISITION]=0) then obj_controller.known[eFACTION.INQUISITION]=1; } else if (owner=eFACTION.TAU) { @@ -930,7 +930,7 @@ function fleet_arrival_logic() { var _chosen =false; var _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); while (_chosen_id != "none"){ - if (scr_orbiting_fleet(eFACTION.Imperium) != "none"){ + if (scr_orbiting_fleet(eFACTION.IMPERIUM) != "none"){ _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); } else { break; @@ -969,7 +969,7 @@ function fleet_arrival_logic() { var _chosen =false; var _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); while (_chosen_id != "none"){ - if (scr_orbiting_fleet(eFACTION.Imperium) != "none"){ + if (scr_orbiting_fleet(eFACTION.IMPERIUM) != "none"){ _chosen_id = nearest_star_with_ownership(x,y,owner,orbiting,true,true); } else { break; diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index eb840eccf6..407899120b 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -28,7 +28,7 @@ function imperial_navy_fleet_construction() { //TODO make standadised system for collating active forge worlds as we do this a lot var _forge_systems = get_imperium_forge_systems(); - if (array_length(_forge_systems) == 0 && obj_controller.faction_status[eFACTION.Imperium] != "War"){ + if (array_length(_forge_systems) == 0 && obj_controller.faction_status[eFACTION.IMPERIUM] != "War"){ scr_alert("red", "forge_world", "No active uncontested forge worlds imperial navy unable to rebuild at speed"); } @@ -65,7 +65,7 @@ function get_imperium_forge_systems(){ var good=false; for(var o=1; o<=planets; o++) { if (p_type[o]=="Forge") - and (p_owner[o]==eFACTION.Mechanicus) + and (p_owner[o]==eFACTION.MECHANICUS) and (p_orks[o]+p_tau[o]+p_tyranids[o]+p_chaos[o]+p_traitors[o]+p_necrons[o]==0) { var enemy_fleets = [ @@ -100,7 +100,7 @@ function build_planet_defence_fleets(){ imp_ships=0; var _defence_fleet_log = {}; with(obj_en_fleet){ - if (owner==eFACTION.Imperium){ + if (owner==eFACTION.IMPERIUM){ var _imperial_fleet_defence_score = round(standard_fleet_strength_calc()); obj_controller.imp_ships += _imperial_fleet_defence_score; //log this to prevent double work later figuring out if a planet has an orbiting defence fleet diff --git a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml index 4053d10258..4e0ef10cce 100644 --- a/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml +++ b/scripts/scr_imperial_navy_functions/scr_imperial_navy_functions.gml @@ -108,7 +108,7 @@ function build_new_navy_fleet(construction_forge){ new_navy_fleet=instance_create(construction_forge.x,construction_forge.y,obj_en_fleet); with(new_navy_fleet){ - owner=eFACTION.Imperium; + owner=eFACTION.IMPERIUM; capital_number=0; frigate_number=0; @@ -1083,7 +1083,7 @@ function setup_start_imperial_navy_fleet(system) { with (nav) { orbiting = system; - owner=eFACTION.Imperium; + owner=eFACTION.IMPERIUM; navy=1; capital_number = choose(1,2,3); @@ -1131,9 +1131,9 @@ function get_imperial_navy_fleets(){ var _fleets = []; with (obj_en_fleet){ - if (owner != eFACTION.Imperium || !navy){ + if (owner != eFACTION.IMPERIUM || !navy){ continue; - } else if (owner == eFACTION.Imperium && navy){ + } else if (owner == eFACTION.IMPERIUM && navy){ array_push(_fleets, id); } } diff --git a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml index 74c638aec7..3ba26c80f1 100644 --- a/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml +++ b/scripts/scr_mechanicus_fleet_functions/scr_mechanicus_fleet_functions.gml @@ -9,7 +9,7 @@ function spawn_mechanicus_explore_fleet(){ var _fleet = instance_create(_forge.x, _forge.y, obj_en_fleet); with (_fleet){ - owner = eFACTION.Mechanicus; + owner = eFACTION.MECHANICUS; warp_able = true; capital_number = 2; frigate_number = 5; diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index da8381ca3a..0cec2e89f6 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -274,7 +274,7 @@ function init_garrison_mission(planet, star, mission_slot){ function complete_garrison_mission(targ_planet, problem_index){ var planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage", "active")){ - if (planet.current_owner == eFACTION.Imperium && system_garrison[targ_planet].garrison_force){ + if (planet.current_owner == eFACTION.IMPERIUM && system_garrison[targ_planet].garrison_force){ var _mission_string = $"The garrison on {planet_numeral_name(targ_planet)} has finished the period of garrison support agreed with the planetary governor."; var p_garrison = system_garrison[targ_planet]; var result = p_garrison.garrison_disposition_change(id, targ_planet); diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index e05d2afe50..47fba98c64 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -481,7 +481,7 @@ function scr_planetary_feature(planet_num) { var numeral_n = planet_numeral_name(planet_num); switch (feat.f_type){ case eP_FEATURES.SORORITAS_CATHEDRAL: - if (obj_controller.known[eFACTION.Ecclesiarchy]=0) then obj_controller.known[eFACTION.Ecclesiarchy]=1; + if (obj_controller.known[eFACTION.ECCLESIARCHY]=0) then obj_controller.known[eFACTION.ECCLESIARCHY]=1; var lop=$"Sororitas Cathedral discovered on {numeral_n}."; scr_alert("green","feature",lop,x,y); scr_event_log("",lop); diff --git a/scripts/scr_purge_world/scr_purge_world.gml b/scripts/scr_purge_world/scr_purge_world.gml index 0bd872b7b0..9ce1c56666 100644 --- a/scripts/scr_purge_world/scr_purge_world.gml +++ b/scripts/scr_purge_world/scr_purge_world.gml @@ -47,12 +47,12 @@ function scr_purge_world(action_type, action_score) { } } - var heres_before = max(total_corruption(),population_influences[eFACTION.Tau],population_influences[eFACTION.TYRANIDS]);// Starting heresy + var heres_before = max(total_corruption(),population_influences[eFACTION.TAU],population_influences[eFACTION.TYRANIDS]);// Starting heresy var heres_target = "corruption"; - if (max(population_influences[eFACTION.Tau],population_influences[eFACTION.TYRANIDS]) > total_corruption()){ - if (population_influences[eFACTION.Tau]>population_influences[eFACTION.TYRANIDS]){ + if (max(population_influences[eFACTION.TAU],population_influences[eFACTION.TYRANIDS]) > total_corruption()){ + if (population_influences[eFACTION.TAU]>population_influences[eFACTION.TYRANIDS]){ heres_target = "tau"; } else{ heres_target = "genestealers"; @@ -110,7 +110,7 @@ function scr_purge_world(action_type, action_score) { _disp_hit = -3; } - scr_audience(eFACTION.Imperium, "bombard_angry", _disp_hit, "", 0, 0); + scr_audience(eFACTION.IMPERIUM, "bombard_angry", _disp_hit, "", 0, 0); } } } @@ -122,7 +122,7 @@ function scr_purge_world(action_type, action_score) { if (planet_type="Ice"){ _disp_hit =-7; } - scr_audience(eFACTION.Inquisition, "bombard_angry", _disp_hit, "", 0, 0); + scr_audience(eFACTION.INQUISITION, "bombard_angry", _disp_hit, "", 0, 0); } @@ -142,7 +142,7 @@ function scr_purge_world(action_type, action_score) { if (thequest="cleanse" && action_score>=20){ remove_planet_problem(planet,thequest,star); - alter_disposition(eFACTION.Inquisition,obj_controller.demanding ? choose(0,0,1) :1); + alter_disposition(eFACTION.INQUISITION,obj_controller.demanding ? choose(0,0,1) :1); txt1="Your marines scour the underhive of {name()}, spraying mutants down with promethium as they go. It takes several days but a sizeable dent is put in their numbers."; scr_event_log("","Inquisition Mission Completed: The mutants of {name()} have been cleansed by promethium."); @@ -220,7 +220,7 @@ function scr_purge_world(action_type, action_score) { if (thequest="purge" && action_score>=10){ remove_planet_problem(planet, "purge", star); - alter_disposition(eFACTION.Inquisition,obj_controller.demanding ? choose(0,0,1) :1); + alter_disposition(eFACTION.INQUISITION,obj_controller.demanding ? choose(0,0,1) :1); txt1="Your marines drop fast and hard, blowing through guards and mercenaries with minimal resistance. Before ten minutes have passed all your targets are executed."; scr_event_log("","Inquisition Mission Completed: The unruly Nobles of {name()} have been purged."); @@ -279,7 +279,7 @@ function scr_purge_world(action_type, action_score) { if (heres_target == "corruption"){ alter_corruption(-influence_reduction); }else if (heres_target == "tau"){ - alter_influence(eFACTION.Tau , -influence_reduction); + alter_influence(eFACTION.TAU , -influence_reduction); }else if (heres_target == "genestealers"){ alter_influence(eFACTION.TYRANIDS , -influence_reduction); } diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index b448098032..2645eec19d 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -123,19 +123,19 @@ function scr_random_event(execute_now) { switch (curr_event){ case EVENT.inquisition_planet: - if (known[eFACTION.Inquisition]==0 || obj_controller.faction_status[eFACTION.Inquisition]=="War") { + if (known[eFACTION.INQUISITION]==0 || obj_controller.faction_status[eFACTION.INQUISITION]=="War") { events_share[i] -= 1; events_total -= 1; } break; case EVENT.inquisition_mission: - if (known[eFACTION.Inquisition]==0 || obj_controller.disposition[4] < 0 || obj_controller.faction_status[eFACTION.Inquisition] == "War") { + if (known[eFACTION.INQUISITION]==0 || obj_controller.disposition[4] < 0 || obj_controller.faction_status[eFACTION.INQUISITION] == "War") { events_share[i] -= 1; events_total -= 1; } break; case EVENT.mechanicus_mission: - if (known[eFACTION.Mechanicus] == 0 || obj_controller.disposition[3] < 40 || obj_controller.faction_status[eFACTION.Mechanicus] == "War") { + if (known[eFACTION.MECHANICUS] == 0 || obj_controller.disposition[3] < 40 || obj_controller.faction_status[eFACTION.MECHANICUS] == "War") { events_share[i] -= 1; events_total -= 1; } @@ -154,13 +154,13 @@ function scr_random_event(execute_now) { } break; case EVENT.necron_awaken: - if((known[eFACTION.Inquisition] == 0)){ + if((known[eFACTION.INQUISITION] == 0)){ events_share[i] -= 1; events_total -= 1; } break; case EVENT.crusade: - if (obj_controller.faction_status[eFACTION.Imperium] == "War"){ + if (obj_controller.faction_status[eFACTION.IMPERIUM] == "War"){ events_share[i] -= 1; events_total -= 1; } diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index 038e77c721..477dc18230 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -287,7 +287,7 @@ function distance_removed_star(origional_x,origional_y, star_offset = choose(2,3 }; from=instance_nearest(origional_x,origional_y,obj_star); if (instance_exists(from)){ - if (disclude_elder && from.owner==eFACTION.Eldar){ + if (disclude_elder && from.owner==eFACTION.ELDAR){ i--; array_push(deactivated, id); instance_deactivate_object(from); From 0727d44e995df20d5e29926240229ddac701cab7 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 12:33:53 +0100 Subject: [PATCH 55/93] fix alarm 1 changes --- objects/obj_en_fleet/Alarm_1.gml | 70 +++++++------------------------- 1 file changed, 15 insertions(+), 55 deletions(-) diff --git a/objects/obj_en_fleet/Alarm_1.gml b/objects/obj_en_fleet/Alarm_1.gml index 78c91253a4..0f4b1bd904 100644 --- a/objects/obj_en_fleet/Alarm_1.gml +++ b/objects/obj_en_fleet/Alarm_1.gml @@ -43,24 +43,8 @@ try { turns_static = 0; } -if (_is_orbiting) { - turns_static++; - if (turns_static>5 && owner == eFACTION.ORK){ - if (!irandom(7)){ - ork_fleet_move(); - _is_orbiting=false; - } - } - if (instance_exists(obj_crusade)){ - try{ - fleet_respond_crusade(); - } catch(_exception) { - handle_exception(_exception); - } - } -} else { - turns_static = 0; -} + var dir = 0; + var ret = 0; if (navy && action == "" && _is_orbiting) { navy_orbiting_planet_end_turn_action(); @@ -367,33 +351,19 @@ if (_is_orbiting) { plin = 0; plin2 = 0; - if (good=1) and (n=5){ - if (!instance_exists(plin2)) then exit; - if (!array_contains(plin.p_type, "dead")) then good++ - - var new_fleet; - new_fleet=instance_create(x,y,obj_en_fleet); - new_fleet.capital_number=floor(capital_number*0.4); - new_fleet.frigate_number=floor(frigate_number*0.4); - new_fleet.escort_number=floor(escort_number*0.4); - - capital_number-=new_fleet.capital_number; - frigate_number-=new_fleet.frigate_number; - escort_number-=new_fleet.escort_number; - - new_fleet.owner=eFACTION.TYRANIDS; - new_fleet.sprite_index=spr_fleet_tyranid; - new_fleet.image_index=1; - - /*with(new_fleet){ - var ii=floor(standard_fleet_strength_calc()); - if (ii<=1) then ii=1;image_index=ii; - }*/ - - new_fleet.action_x=plin2.x; - new_fleet.action_y=plin2.y; - with(new_fleet){ - set_fleet_movement(); + if (capital_number > 5) { + n = 5; + } + + instance_deactivate_object(orbiting); + var _abort_migration = false; + + repeat (100) { + if (good != 5) { + xx = self.x + random_range(-300, 300); + yy = self.y + random_range(-300, 300); + if (good == 0) { + plin = instance_nearest(xx, yy, obj_star); } if ((good == 1) && (n == 5)) { plin2 = instance_nearest(xx, yy, obj_star); @@ -446,16 +416,6 @@ if (_is_orbiting) { } } } - - - if (good=1) and (instance_exists(plin)){ - action_x=plin.x; - action_y=plin.y; - set_fleet_movement(); - if (n!=5){ - good=5; - } - } } instance_activate_object(obj_star); if (_abort_migration) { From 167fd35c8f0adde6e3694c5f6b5479f9be6bcdc6 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 12:45:10 +0100 Subject: [PATCH 56/93] final enum reworks --- objects/obj_controller/Alarm_6.gml | 2 +- scripts/scr_mission_functions/scr_mission_functions.gml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/objects/obj_controller/Alarm_6.gml b/objects/obj_controller/Alarm_6.gml index d2ee87e88d..d8ca0bc0fe 100644 --- a/objects/obj_controller/Alarm_6.gml +++ b/objects/obj_controller/Alarm_6.gml @@ -159,7 +159,7 @@ if ((menu == 1) && (managing > 0)) { selecting_dudes+=", "; } if (assa>0){ - selecting_dudes+=string(assa)+" "+string(_roles[eROLE.Assault]); + selecting_dudes+=string(assa)+" "+string(_roles[eROLE.ASSAULT]); if (sgt>1) then selecting_dudes+="s"; selecting_dudes+=", "; } diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 0cec2e89f6..2e82a0cea0 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -335,7 +335,7 @@ function init_train_forces_mission(planet, star, mission_slot, marine){ //TODO some new universal methods for popups gar_pop.title=$"Training forces on {numeral_name} begins"; gar_pop.text=$"{marine.name_role()} Has taken leave of his current post in order to aid the governor of {numeral_name} and his pdf commanders with training local forces and bolstering defences."; - var _is_cap = role_compare(marine, eROLE.Captain); + var _is_cap = role_compare(marine, eROLE.CAPTAIN); if (_is_cap){ gar_pop.text += "the governor seems to be impressed that such a high ranking officer has been assigned to his request (disp +3)"; From 27b3ce921a047c3fe9f113b74dbafc20346f2897 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 12:52:44 +0100 Subject: [PATCH 57/93] revert all pane stuff to mine and layer etty on top --- .../scr_unit_quick_find_pane.gml | 971 +++++++----------- 1 file changed, 385 insertions(+), 586 deletions(-) diff --git a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml index 9e0820f6c9..6f6c54b2b0 100644 --- a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml +++ b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml @@ -1,15 +1,4 @@ // Script assets have changed for v2.3.0 see -// https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information -function UnitQuickFindPanel() constructor { - main_panel = new DataSlate(); - garrison_log = {}; - ship_count = 0; - tab_buttons = { - "fleets": new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "garrisons": new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "hider": new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "missions": new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - }; // https : //help.yoyogames.com/hc/en-us/articles/360005277377 for more information function UnitQuickFindPanel() constructor{ main_panel = new DataSlate(); @@ -22,26 +11,26 @@ function UnitQuickFindPanel() constructor{ "missions" : new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), } - static detail_slate = new DataSlateMKTwo(); + static detail_slate = new DataSlateMKTwo(); - view_area = "fleets"; + view_area = "fleets"; - static has_troops = function(name) { - return struct_exists(garrison_log, name); - }; + static has_troops = function(name){ + return struct_exists(garrison_log, name); + } - static player_force_stars = function() { - var _names = struct_get_names(garrison_log); - var _stars = []; - for (var i = 0; i < array_length(_names); i++) { - var _star = find_star_by_name(_names[i]); - if (_star != "none") { - array_push(_stars, _star); - } - } + static player_force_stars = function(){ + var _names = struct_get_names(garrison_log); + var _stars = []; + for (var i=0;i -1) { - obj_ini.ship_carrying[unit.ship_location] += unit.get_unit_size(); - } - } - }; + var unit_location, group; - static evaluate_vehicle_for_garrison_log = function(company, array_slot) { - var co = company; - var u = array_slot; + if (unit.name() == "" || !unit.controllable()) then return; + unit_location = unit.marine_location(); + if (unit_location[0]==location_types.planet && unit_location[2] != ""){ - if (obj_ini.veh_race[co][u] == 0) { - return; - } - if (obj_ini.veh_wid[co][u] > 0) { - unit_location = obj_ini.veh_loc[co][u]; - var _unit = [ - co, - u - ]; - if (!struct_exists(garrison_log, unit_location)) { - garrison_log[$ unit_location] = { - units: [_unit], - vehicles: 1, - garrison: false, - healers: 0, - techies: 0, - }; - } else { - array_push(garrison_log[$ unit_location].units, _unit); - garrison_log[$ unit_location].vehicles++; - } - } else if (obj_ini.veh_lid[co][u] > -1) { - obj_ini.ship_carrying[obj_ini.veh_lid[co][u]] += scr_unit_size("", obj_ini.veh_role[co][u], true); - } - }; + add_unit_to_garrison_log(unit,unit_location); + group = garrison_log[$ unit_location[2]]; + if (unit.IsSpecialist(SPECIALISTS_APOTHECARIES)){ + group.healers++; + } else if (unit.IsSpecialist(SPECIALISTS_TECHS)){ + group.techies++; + } + } else if (unit_location[0]==location_types.ship){ + if (unit.ship_location-1){ + obj_ini.ship_carrying[unit.ship_location]+=unit.get_unit_size(); + } + } + } - static update_garrison_log = function() { - try { - for (var i = 0; i < array_length(obj_ini.ship_carrying); i++) { - obj_ini.ship_carrying[i] = 0; - } - var _unit; - delete garrison_log; - garrison_log = {}; - obj_controller.specialist_point_handler.calculate_research_points(false); - ship_count = array_length(obj_ini.ship_carrying); - for (var co = 0; co <= obj_ini.companies; co++) { - for (var u = 0; u < array_length(obj_ini.TTRPG[co]); u++) { - /// @type {Struct.TTRPG_stats} - _unit = fetch_unit([co, u]); - evaluate_unit_for_garrison_log(_unit); - } - try { - for (var u = 0; u < array_length(obj_ini.veh_race[co]); u++) { - evaluate_vehicle_for_garrison_log(co, u); - } - } catch (_exception) { - handle_exception(_exception); - } - } - update_mission_log(); - } catch (_exception) { - handle_exception(_exception); - } - }; - - update_mission_log = function() { - mission_log = []; - var temp_log = []; - var p, i, problems; - with (obj_star) { - for (i = 1; i <= planets; i++) { - problems = p_problem[i]; - for (p = 0; p < array_length(problems); p++) { - if (problems[p] != "") { - if (problem_has_key_and_value(i, p, "stage", "preliminary")) { - continue; - } - var mission_explain = mission_name_key(problems[p]); - if (mission_explain != "none") { - array_push(temp_log, {system: name, mission: mission_explain, time: p_timer[i][p], planet: i}); - } - } - } - } - } - for (i = 0; i < array_length(obj_controller.quest); i++) { - if (obj_controller.quest[i] != "") { - var mission_explain = mission_name_key(obj_controller.quest[i]); - if (mission_explain != "none") { - array_push(temp_log, {system: "", mission: mission_explain, time: obj_controller.quest_end[i] - obj_controller.turn, planet: 0}); - } - } - } - mission_log = temp_log; - }; - hover_item = "none"; - travel_target = []; - travel_time = 0; - travel_increments = []; - is_entered = false; - start_fleet = 0; - start_system = 0; - garrison_log = {}; - mission_log = []; - hide_sequence = 0; - current_hover = -1; - hover_count = 0; - main_panel.inside_method = function() { - var xx = main_panel.XX; - var yy = main_panel.YY; - is_entered = scr_hit(xx, yy, xx + main_panel.width, yy + main_panel.height); - if (view_area == "fleets") { - var cur_fleet; - draw_set_color(c_white); - draw_set_halign(fa_center); - draw_text(xx + 80, yy + 50, "Capitals"); - draw_text(xx + 160, yy + 50, "Frigates"); - draw_text(xx + 240, yy + 50, "Escorts"); - draw_text(xx + 310, yy + 50, "Location"); - var i = start_fleet; - while (i < instance_number(obj_p_fleet) && (yy + 90 + (20 * i) + 12 + 20) < main_panel.YY + yy + main_panel.height) { - if (scr_hit(xx + 10, yy + 90 + (20 * i), xx + main_panel.width, yy + 90 + (20 * i) + 18)) { - draw_set_color(c_gray); - draw_rectangle(xx + 10 + 20, yy + 90 + (20 * i) - 2, xx + main_panel.width - 20, yy + 90 + (20 * i) + 18, 0); - draw_set_color(c_white); - } - cur_fleet = instance_find(obj_p_fleet, i); - draw_text(xx + 80, yy + 90 + (20 * i), cur_fleet.capital_number); - draw_text(xx + 160, yy + 90 + (20 * i), cur_fleet.frigate_number); - draw_text(xx + 240, yy + 90 + (20 * i), cur_fleet.escort_number); - var _fleet_point_data = cur_fleet.point_breakdown; - var _loc_display_string = ""; - var _zoomable_loc = true; - if (cur_fleet.action == "Lost") { - _loc_display_string = "Lost"; - _zoomable_loc = false; - } else if (string_count("crusade", cur_fleet.action)) { - _loc_display_string = "Crusading"; - _zoomable_loc = false; - } else if (cur_fleet.action == "move") { - _loc_display_string = "Warp Travel"; - } else { - var _near_star = instance_nearest(cur_fleet.x, cur_fleet.y, obj_star); - _loc_display_string = _near_star.name; + static evaluate_vehicle_for_garrison_log = function(company, array_slot){ + + var co = company; + var u = array_slot; if (obj_ini.veh_race[co][u]==0) then return; if (obj_ini.veh_wid[co][u]>0){ @@ -240,26 +94,36 @@ function UnitQuickFindPanel() constructor{ } } - var _fleet_coords = [ - xx + 10, - yy + 90 + (20 * i) - 2, - xx + main_panel.width, - yy + 90 + (20 * i) + 18 - ]; - - if (_zoomable_loc) { - if (point_and_click([xx + 10, yy + 90 + (20 * i) - 2, xx + main_panel.width, yy + 90 + (20 * i) + 18])) { - travel_target = [ - cur_fleet.x, - cur_fleet.y - ]; - travel_increments = [ - (travel_target[0] - obj_controller.x) / 15, - (travel_target[1] - obj_controller.y) / 15 - ]; - travel_time = 0; - } - } + + static update_garrison_log = function(){ + try{ + for (var i = 0;i 0 && hide_sequence < 15) || (hide_sequence > 15 && hide_sequence < 30)) { - if (hide_sequence > 15) { - x_draw = ((main_panel.width / 15) * (hide_sequence - 15)) - main_panel.width; - } else { - x_draw = -((main_panel.width / 15) * hide_sequence); - } - hide_sequence++; - } - if (hide_sequence > 15 || hide_sequence < 15) { - main_panel.draw(x_draw, 110, 0.46, 0.75); - if (tab_buttons.fleets.draw(x_draw, 79, "Fleets")) { - view_area = "fleets"; - } - if (tab_buttons.garrisons.draw(115 + x_draw, 79, "System Troops")) { - view_area = "garrisons"; - update_garrison_log(); - } - if (tab_buttons.missions.draw(230 + x_draw, 79, "Missions")) { - view_area = "missions"; - update_garrison_log(); - } - if (x_draw < 0) { - tab_buttons.hider.draw(0, lower_draw, "Show"); - } else { - if (tab_buttons.hider.draw(x_draw + 280, lower_draw, "Hide")) { - hide_sequence++; - } - } - } else if (hide_sequence == 15) { - if (tab_buttons.hider.draw(0, lower_draw, "Show")) { - hide_sequence++; - } - } - /*if (tab_buttons.troops.draw(345,79, "Troops")){ - view_area="troops"; - }*/ - } - if (array_length(travel_target) == 2) { - if (obj_controller.x != travel_target[0] || obj_controller.y != travel_target[1]) { - obj_controller.x += travel_increments[0]; - obj_controller.y += travel_increments[1]; - travel_time++; - } else { - travel_target = []; - } - if (travel_time == 15) { - obj_controller.x = travel_target[0]; - obj_controller.y = travel_target[1]; - travel_target = []; - } - } - } - pop_draw_return_values(); - }; -} + var _fleet_coords = [xx+10, yy+90+(20*i)-2,xx+main_panel.width,yy+90+(20*i)+18]; + + if (_zoomable_loc){ + if (point_and_click([xx+10, yy+90+(20*i)-2,xx+main_panel.width,yy+90+(20*i)+18])){ + travel_target = [cur_fleet.x, cur_fleet.y]; + travel_increments = [(travel_target[0]-obj_controller.x)/15,(travel_target[1]-obj_controller.y)/15]; + travel_time = 0; + } + } -function HoverBox() constructor { - root_item = "none"; - relative_x = 0; - relative_y = 0; - location = [ - 0, - 0, - 0, - 0 - ]; + if (scr_hit(_fleet_coords)){ + detail_slate.draw(xx+main_panel.width-10,_fleet_coords[1]-20, 1.5, 1.5); + var _xx = xx+main_panel.width-10; + var _yy = _fleet_coords[1]-20; + draw_set_font(fnt_40k_12i); + draw_text(_xx+160, _yy+10,"forge point\ntotal"); + draw_text( _xx+240, _yy+10,"forge point\nuse"); + draw_text( _xx+320, _yy+10,"apothecary\npoint total"); + draw_text(_xx+400, _yy+10,"apothecary\npoint use"); + draw_text(_xx+60, _yy+50,"Orbiting"); + var _y_line = _yy+50; + draw_text(_xx+160, _y_line,_fleet_point_data.forge_points); + draw_text(_xx+240, _y_line,_fleet_point_data.forge_points_use); + draw_text(_xx+320, _y_line , _fleet_point_data.heal_points); + draw_text(_xx+400, _y_line, _fleet_point_data.heal_points_use); + } + i++; + } + } else if (view_area=="garrisons"){ + var system_data; + draw_set_color(c_white); + draw_set_halign(fa_center); + draw_text(xx+80, yy+50, "System"); + draw_text(xx+160, yy+50, "Troops"); + draw_text(xx+240, yy+50, "Healers"); + draw_text(xx+310, yy+50, "Techies"); + var i = start_system; + var registered_hover=false; + var system_names = struct_get_names(garrison_log); + var hover_entered=false; + var any_hover = false; + if (hover_item!="none"){ + var loc=hover_item.location; + hover_entered = scr_hit(loc[0],loc[1],loc[2],loc[3]); + } + while(i-1 && current_hover!=i){ + registered_hover=false; + } else { + current_hover=i; + registered_hover=true; + hover_count++; + } + } else { + if (hover_item.root_item == i){ + draw_rectangle(xx+10+20, yy+90+(20*i)-2,xx+main_panel.width-20,yy+90+(20*i)+18, 0); + } + } + detail_slate.draw(xx+main_panel.width-10,_sys_item_y-20, 1.5, 1.5); + var _special_points = obj_controller.specialist_point_handler.point_breakdown.systems; + if (struct_exists(_special_points,_sys_name)){ + var _system_point_data = _special_points[$ _sys_name]; + var _xx = xx+main_panel.width-10; + var _yy = _sys_item_y-20; + draw_set_font(fnt_40k_12i); + draw_text(_xx+160, _yy+10,"forge point\ntotal"); + draw_text( _xx+240, _yy+10,"forge point\nuse"); + draw_text( _xx+320, _yy+10,"apothecary\npoint total"); + draw_text(_xx+400, _yy+10,"apothecary\npoint use"); + draw_text(_xx+60, _yy+50,"Orbiting"); + for (var s=1;s<=4;s++){ + draw_text( _xx+60, _yy+50 + (50*s),scr_roman(s)); + } + var _y_line = _yy+50; + for (var o=0;o<5;o++){ + var _area_item = _system_point_data[o]; + draw_text(_xx+220, _y_line,_area_item.forge_points); + draw_text(_xx+300, _y_line,_area_item.forge_points_use); + draw_text(_xx+380, _y_line , _area_item.heal_points); + draw_text(_xx+460, _y_line, _area_item.heal_points_use); + _y_line+=50; + } + + } + } + draw_text(xx+80, yy+90+(20*i), system_names[i]); + draw_text(xx+160, yy+90+(20*i), array_length(system_data.units)); + draw_text(xx+240, yy+90+(20*i), system_data.healers); + draw_text(xx+310, yy+90+(20*i), system_data.techies); if (!hover_entered){ if (point_and_click([xx+10, yy+90+(20*i)-2,xx+main_panel.width,yy+90+(20*i)+18])){ - var star = find_star_by_name(system_names[i]); + var star = star_by_name(system_names[i]); if (star!="none"){ travel_target = [star.x, star.y]; travel_increments = [(travel_target[0]-obj_controller.x)/15,(travel_target[1]-obj_controller.y)/15]; @@ -621,7 +423,7 @@ function HoverBox() constructor { purpose : $"{system_names[hover_item.root_item]} Management", purpose_code : "manage", number : 0, - system : find_star_by_name(system_names[hover_item.root_item]).id, + system : star_by_name(system_names[hover_item.root_item]).id, feature : "none", planet : 0, selections : [] @@ -700,24 +502,23 @@ function HoverBox() constructor { } } -function exit_adhoc_manage() { - scr_toggle_manage(); - if (struct_exists(selection_data, "system") && instance_exists(selection_data.system)) { - selection_data.system.alarm[3] = 2; - } +function HoverBox() constructor{ + root_item = "none"; + relative_x = 0; + relative_y = 0; + location = [0,0,0,0]; + static draw = function(xx, yy, button_text){ + location = draw_unit_buttons([relative_x, relative_y], button_text,[1,1], c_green,, fnt_40k_14b, 1); + return location; + } } -function update_garrison_manage() { - location_viewer.update_garrison_log(); - var _selection = []; - var sys_name = ""; - var _ships = -1; - var _planets = 0; - if (struct_exists(selection_data, "system") && instance_exists(selection_data.system)) { - if (struct_exists(location_viewer.garrison_log, selection_data.system.name)) { - var sys_name = selection_data.system.name; - } - } +function exit_adhoc_manage(){ + scr_toggle_manage(); + if (struct_exists(selection_data, "system") && instance_exists(selection_data.system)){ + selection_data.system.alarm[3]=2; + } +}; function update_garrison_manage(){ location_viewer.update_garrison_log(); @@ -731,215 +532,211 @@ function update_garrison_manage() { } } - if (struct_exists(selection_data, "planets")) { - _planets = selection_data.planets; - } + if (struct_exists(selection_data , "ships")){ + _ships = selection_data.ships; + } - _selection = collect_role_group("all", [sys_name, _planets, _ships]); + if (struct_exists(selection_data , "planets")){ + _planets = selection_data.planets; + } - if (array_length(_selection)) { - group_selection(_selection, selection_data); - } else { - exit_adhoc_manage(); - } + _selection = collect_role_group("all",[sys_name, _planets,_ships]); + + if (array_length(_selection)){ + group_selection(_selection,selection_data); + } else { + exit_adhoc_manage(); + } } -function update_general_manage_view() { - with (obj_controller) { - if (managing > 0) { - if ((managing <= 10) && (managing != 0)) { - scr_company_view(managing); - } - if ((managing > 10) || (managing == 0)) { - scr_special_view(managing); - } - new_company_struct(); - cooldown = 10; - sel_loading = -1; - unload = 0; - alarm[6] = 30; - } else if (managing == -1) { - update_garrison_manage(); - } - } + +function update_general_manage_view(){ + with (obj_controller){ + if (managing>0){ + if (managing<=10) and (managing!=0){ + scr_company_view(managing); + } + if (managing>10) or (managing=0){ + scr_special_view(managing); + } + new_company_struct(); + cooldown=10; + sel_loading=-1; + unload=0; + alarm[6]=30; + } else if (managing==-1){ + update_garrison_manage(); + } + } } -function toggle_selection_borders() { - for (var p = 0; p < array_length(display_unit); p++) { - if ((man_sel[p] == 1) && (man[p] == "man")) { - if (is_struct(display_unit[p])) { - var _unit = display_unit[p]; +function toggle_selection_borders(){ + for(var p=0; p -1) && _unit.controllable()) { - _unit.is_boarder = !_unit.is_boarder; + if (_unit.ship_location>-1) and (_unit.controllable()){ + _unit.is_boarder = !_unit.is_boarder; } } } - } + } } -/// @mixin -function add_bionics_selection() { - if (scr_item_count("Bionics") <= 0) { - return; - } - - for (var i = 0, _len = array_length(display_unit); i < _len; i++) { - /// @type {Struct.TTRPG_stats} - var _unit = display_unit[i]; - - if (man_sel[i] == 0 || !is_struct(_unit)) { - continue; - } - - if (!_unit.controllable()) { - continue; - } - - if (string_pos("Dread", ma_armour[i]) > 0) { - continue; +function add_bionics_selection(){ + var bionics_before=scr_item_count("Bionics"); + if (bionics_before>0){ + for(var p=0; p 0) { - alll = 0; + if (managing>0){ + alll=0; update_general_manage_view(); - } else if (managing == -1) { - update_garrison_manage(); + } else if (managing==-1){ + update_garrison_manage() } - sel_loading = -1; - unload = 0; - alarm[6] = 7; + sel_loading=-1; + unload=0; + alarm[6]=7; } -function load_selection() { - if (man_size > 0 && !location_out_of_player_control(selecting_location)) { +function load_selection(){ + if (man_size>0 && !location_out_of_player_control(selecting_location)){ scr_company_load(selecting_location); - menu = 30; - top = 1; - } + menu=30; + top=1; + } } -function unload_selection() { - if (man_size > 0 && obj_controller.selecting_ship >= 0 && !instance_exists(obj_star_select) && !location_out_of_player_control(selecting_location) && selecting_location != "Warp") { - cooldown = 8000; - var boba = 0; - var unload_star = find_star_by_name(selecting_location); - if (unload_star != "none") { - if (unload_star.space_hulk != 1) { +function unload_selection(){ + if (man_size>0 && obj_controller.selecting_ship>=0 && !instance_exists(obj_star_select)&& + !location_out_of_player_control(selecting_location) && selecting_location!="Warp"){ + cooldown=8000; + var boba=0; + var unload_star = star_by_name(selecting_location); + if (unload_star != "none"){ + if (unload_star.space_hulk!=1){ for (var t = 0; t < array_length(display_unit); t++) { if (man_sel[t] == 1) { - var _unit = display_unit[t]; + var _unit = display_unit[t]; if (is_array(_unit)) { - set_vehicle_last_ship(_unit); + set_vehicle_last_ship(_unit); } else { - _unit.set_last_ship(); + _unit.set_last_ship(); } } } - boba = instance_create(unload_star.x, unload_star.y, obj_star_select); - boba.loading = 1; + boba=instance_create(unload_star.x,unload_star.y,obj_star_select); + boba.loading=1; // selecting location is the ship right now; get it's orbit location - boba.loading_name = selecting_location; - boba.depth = self.depth - 50; + boba.loading_name=selecting_location; + boba.depth=self.depth-50; // sel_uid=obj_ini.ship_uid[selecting_ship]; scr_company_load(obj_ini.ship_location[selecting_ship]); } } - } + } } -function reset_selection_equipment() { - var _unit; - for (var f = 0; f < array_length(display_unit); f++) { +function reset_selection_equipment(){ + var _unit; + for(var f=0; f= 1 || is_specialist(ma_role[f], SPECIALISTS_RANK_AND_FILE) || is_specialist(ma_role[f], SPECIALISTS_SQUAD_LEADERS)) && man_sel[f] == 1) { - nuuum += 1; - if (pip.min_exp == 0) { - pip.min_exp = ma_exp[f]; - } - pip.min_exp = min(ma_exp[f], pip.min_exp); +function promote_selection(){ + if (sel_promoting==1) and (instance_number(obj_popup)==0){ + var pip=instance_create(0,0,obj_popup); + pip.type=5; + pip.company=managing; + + var god=0,nuuum=0; + for(var f=1; f=1 || is_specialist(ma_role[f], SPECIALISTS_RANK_AND_FILE) || is_specialist(ma_role[f], SPECIALISTS_SQUAD_LEADERS)) && man_sel[f]==1){ + nuuum+=1; + if (pip.min_exp==0) then pip.min_exp=ma_exp[f]; + pip.min_exp=min(ma_exp[f],pip.min_exp); } - if ((god == 0) && (ma_promote[f] >= 1) && (man_sel[f] == 1)) { - god = 1; - pip.unit_role = ma_role[f]; + if (god==0) and (ma_promote[f]>=1) and (man_sel[f]==1){ + god=1; + pip.unit_role=ma_role[f]; } } - if (nuuum > 1) { - pip.unit_role = "Marines"; - } - pip.units = nuuum; - } + if (nuuum>1) then pip.unit_role="Marines"; + pip.units=nuuum; + } } //to be run in obj_star_select -function setup_planet_mission_group() { - man_sel = []; - display_unit = []; - man = []; - return_place = []; - for (var i = 0; i < array_length(obj_controller.display_unit); i++) { - if (obj_controller.man_sel[i]) { - array_push(man_sel, obj_controller.man_sel[i]); - array_push(display_unit, obj_controller.display_unit[i]); - array_push(man, obj_controller.man[i]); - array_push(return_place, obj_controller.ma_lid[i]); - } - } +function setup_planet_mission_group(){ + man_sel=[]; + display_unit=[]; + man = []; + return_place = []; + for (var i=0;i 0) { - _helps++; - } - } - _data.help_requests = _helps; + var _helps = 0; + for (var h=1;h<=_star.planets;h++){ + if (_star.p_halp[h] > 0){ + _helps++; + } + } + _data.help_requests = _helps; - _data.hover = method(_data, function() { - tooltip_draw($"View {name}"); - }); + _data.hover = method(_data,function(){ + tooltip_draw($"View {name}"); + }); - _data.click_left = method(_data, function() { - set_map_pan_to_loc(star_id); - }); + _data.click_left = method(_data,function(){ + set_map_pan_to_loc(star_id); + }); - array_push(_help_requests, _data); - } + array_push(_help_requests,_data); + } - static x1 = 1289; - static y1 = 318; - main_panel.XX = x1; - main_panel.YY = y1; + static x1 = 1289; + static y1 = 318; + main_panel.XX=x1; + main_panel.YY=y1; static entered = function(){ return main_panel.entered(); @@ -985,25 +782,15 @@ function HelpfulPlaces()constructor{ } ); - help_table = new Table({row_key_draw: ["name", "system_count", "help_requests"], headings: ["System", "Planets", "Planets\nRequesting Help"], row_data: _help_requests}); - var _navy_fleets = []; - with (obj_en_fleet) { - if (owner != eFACTION.IMPERIUM || !navy) { - continue; - } - var _guard_percentage = fleet_remaining_guard_ratio() * 100; - - var _data = { - fleet_id: id, - location: "Warp", - remaining_guard: $"{_guard_percentage}%", - action: trade_goods, - }; - if (is_orbiting()) { - _data.location = orbiting.name; - } + var _navy_fleets = []; + + with (obj_en_fleet){ + if (owner != eFACTION.Imperium || !navy){ + continue; + } + var _guard_percentage = fleet_remaining_guard_ratio() * 100; var _data = { fleet_id : id, @@ -1015,16 +802,22 @@ function HelpfulPlaces()constructor{ _data.location = orbiting.name; } - _data.click_left = method(_data, function() { - set_map_pan_to_loc(fleet_id); - }); + _data.hover = method(_data,function(){ + if (location != "Warp"){ + tooltip_draw($"View fleet at {location}"); + } else { + tooltip_draw($"View fleet"); + } + + }); - array_push(_navy_fleets, _data); - } + _data.click_left = method(_data, function(){ + set_map_pan_to_loc(fleet_id); + }); - navy_table = new Table({row_key_draw: ["location", "remaining_guard"], headings: ["Location", "Remaining\nGuard"], row_data: _navy_fleets}); - var _forges = []; + array_push(_navy_fleets, _data); + } navy_table = new Table( { @@ -1033,9 +826,7 @@ function HelpfulPlaces()constructor{ row_data : _navy_fleets }); - _data.click_left = method(_data, function() { - set_map_pan_to_loc(system); - }); + var _forges = []; var _columns = []; var _longest_name = 0; @@ -1051,19 +842,24 @@ function HelpfulPlaces()constructor{ owner_status : obj_controller.faction_status[p_owner[_forge]], }; - var _name_length = string_width(_data.name); - if (_name_length > _longest_name) { - _longest_name = _name_length; - } + _data.click_left = method(_data, function(){ + set_map_pan_to_loc(system); + }); - array_push(_forges, _data); - } - } - array_push(_columns, _longest_name); + _data.hover = method(_data,function(){ + tooltip_draw($"click to view {system.name} system"); + + }); - forges_table = new Table({row_key_draw: ["name", "owner_name", "owner_status"], headings: ["Name", " Owner ", " Owner\nStatus "], row_data: _forges, set_column_widths: _columns}); + var _name_length = string_width(_data.name); + if (_name_length > _longest_name){ + _longest_name = _name_length; + } - places_radio = new RadioSet([{str1: "Help Requests"}, {str1: "Navy Fleets"}, {str1: "Forge Worlds"}]); + array_push(_forges , _data); + } + } + array_push(_columns , _longest_name); forges_table = new Table({ row_key_draw : ["name","owner_name","owner_status"], @@ -1122,3 +918,6 @@ function HelpfulPlaces()constructor{ } + + + From c012ae781ca58ceabe92a744ec1a850f5b004a2a Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 13:13:36 +0100 Subject: [PATCH 58/93] finish off panel stuff --- .../scr_unit_quick_find_pane.gml | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml index 6f6c54b2b0..2c6d8f1d7d 100644 --- a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml +++ b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml @@ -584,24 +584,31 @@ function toggle_selection_borders(){ } } + +/// @mixin function add_bionics_selection(){ - var bionics_before=scr_item_count("Bionics"); - if (bionics_before>0){ - for(var p=0; p 0) { + continue; + } + + _unit.add_bionics(); + } } function jail_selection(){ @@ -787,7 +794,7 @@ function HelpfulPlaces()constructor{ var _navy_fleets = []; with (obj_en_fleet){ - if (owner != eFACTION.Imperium || !navy){ + if (owner != eFACTION.IMPERIUM || !navy){ continue; } var _guard_percentage = fleet_remaining_guard_ratio() * 100; From 6cb2b0ea85006308ea9fbacb0c2f94df9cd783a2 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 13:19:00 +0100 Subject: [PATCH 59/93] fold in changes --- .../scr_draw_planet_features.gml | 141 ++++-------------- 1 file changed, 30 insertions(+), 111 deletions(-) diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index 0d0482b788..03627ac8e5 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -2,41 +2,8 @@ // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information /// @param {Struct.NewPlanetFeature|Struct.PlayerForge} _feature -function FeatureSelected(_feature, _system, _planet) constructor { - feature = _feature; - main_slate = new DataSlateMKTwo(); - exit_sequence = false; - entrance_sequence = true; - remove = false; - destroy = false; - exit_count = 0; - enter_count = 18; - planet_data = new PlanetData(_planet, _system); - - if (feature.f_type == eP_FEATURES.FORGE) { - var _worker_caps = [ - 2, - 4, - 8 - ]; - worker_capacity = _worker_caps[feature.size - 1]; - techs = collect_role_group(SPECIALISTS_TECHS, obj_star_select.target.name); - feature.techs_working = 0; - for (var i = 0; i < array_length(techs); i++) { - var _cur_tech = techs[i]; - if (_cur_tech.assignment() == "forge") { - if (_cur_tech.job.planet == planet_data.planet) { - feature.techs_working++; - if (feature.techs_working == worker_capacity) { - break; - } - } - } - } - } - -function FeatureSelected(Feature, system, planet) constructor{ - feature = Feature; +function FeatureSelected(_feature, _system, _planet) constructor{ + feature = _feature; main_slate = new DataSlateMKTwo(); exit_sequence = false; entrance_sequence = true; @@ -44,9 +11,9 @@ function FeatureSelected(Feature, system, planet) constructor{ destroy = false; exit_count = 0; enter_count = 18; - planet_data = new PlanetData(planet,system); + planet_data = new PlanetData(_planet,_system); - if (feature.f_type == eP_FEATURES.FORGE){ + if (feature.f_type == eP_FEATURES.Forge){ var _worker_caps = [2,4,8]; worker_capacity = _worker_caps[feature.size-1]; techs = collect_role_group(SPECIALISTS_TECHS, obj_star_select.target.name); @@ -195,14 +162,14 @@ function FeatureSelected(Feature, system, planet) constructor{ title = "Old Battlefield"; body = $"The site of a previously unrecorded battle between {feature.faction1} and {feature.faction2} forces long forgotten\nUnload Marines to search Techmarines are advisable to help, it would be best any tech priests not be aware of such an operation it may create a conflict of interest"; break; - case DROP_TYPE.STC_FRAGMENT: + case eP_FEATURES.STC_FRAGMENT: generic=true; title = "STC Fragment"; body = $"Unload a {obj_ini.role[100][16]} and whatever entourage you deem necessary to recover the STC Fragment"; break; case eP_FEATURES.GENE_STEALER_CULT: generic=true; - var cult_control = planet_data.population_influences[eFACTION.TYRANIDS]; + var cult_control = planet_data.population_influences[eFACTION.Tyranids]; title = $"Cult of {feature.name}"; var control_string = ""; if (cult_control<25){ @@ -242,7 +209,7 @@ function FeatureSelected(Feature, system, planet) constructor{ case eP_FEATURES.ORKSTRONGHOLD: title = "Ork Stronghold"; generic = true; - if (planet_data.planet_forces[eFACTION.ORK]){ + if (planet_data.planet_forces[eFACTION.Ork]){ body = $"For as long as this Stronghold stands the orks here will continue to fortify it. The larger it gets the greater the capacity of this planet to produce orkish machines of war and ships and the better protected the ork forces will be from bombardment"; } else { body = "Without a force of orks to hold it together the fortress is slowly pulled apart from within by the inhabitants, It's capabilities will constantly decrease until soon there will be nothing left"; @@ -253,7 +220,7 @@ function FeatureSelected(Feature, system, planet) constructor{ var _planet = planet_data.planet; var _star = obj_star_select.target; var p_data = new PlanetData(_planet, _star); - var _recruit_world = p_data.get_features(eP_FEATURES.RECRUITING_WORLD)[0]; + var _recruit_world = p_data.get_features(eP_FEATURES.Recruiting_World)[0]; var _spare_apoth_points = p_data.get_local_apothecary_points(); title = "Marine Recruitment"; body = $"There are {_spare_apoth_points} apothecary rescource points available for recruit screening,\n\n"; @@ -261,23 +228,22 @@ function FeatureSelected(Feature, system, planet) constructor{ body += $"There is a {_recruit_find_chance * 100}% of producing a successful recruit this month on the basis of the available apothecary time to screen candidates and the chances of the aspirants passing their trials to an acceptable standard,\n\n"; - if ((obj_controller.faction_status[p_data.current_owner] == "War" || obj_controller.faction_status[p_data.current_owner] == "Antagonism") && (p_data.player_disposition <= 50)) { - // TODO LOW RECRUITING_DIALOG // Make this more dynamic. + if (obj_controller.faction_status[p_data.current_owner] == "War" || obj_controller.faction_status[p_data.current_owner] == "Antagonism") && (p_data.player_disposition <= 50) { // TODO LOW RECRUITING_DIALOG // Make this more dynamic. if (_recruit_world.recruit_type == 0) { - body += "Since our relations with the populations' faction are... strained, we are having to do our recruiting operation covertly,\n\n"; + body += "Since our relations with the populations' faction are... strained, we are having to do our recruiting operation covertly,\n\n" } else { - body += "Since our relations with the populations' faction are... strained, we are having to do our recruiting operation covertly,"; - body += " our brothers are authorized to use more extreme methods of recruitment,\n\n"; + body += "Since our relations with the populations' faction are... strained, we are having to do our recruiting operation covertly," + body += " our brothers are authorized to use more extreme methods of recruitment,\n\n" } } else if (obj_controller.faction_status[p_data.current_owner] == "War" || obj_controller.faction_status[p_data.current_owner] == "Antagonism") { if (_recruit_world.recruit_type == 0) { - body += "The population has grown accustomed to us and their Governor has given us the clear to openly recruit,\n\n"; + body += "The population has grown accustomed to us and their Governor has given us the clear to openly recruit,\n\n" } else { - body += "The population has grown accustomed to us and their Governor has given us the clear to openly recruit,"; - body += " however our brothers are still authorized to use more extreme methods of recruitment regardless,\n\n"; + body += "The population has grown accustomed to us and their Governor has given us the clear to openly recruit," + body += " however our brothers are still authorized to use more extreme methods of recruitment regardless,\n\n" } - } else if (_recruit_world.recruit_type == 1) { - body += "We've authorized our brothers to use more extreme methods of recruitment, should we really allow this Milord?\n\n"; + } else if (_recruit_world.recruit_type == 1){ + body += "We've authorized our brothers to use more extreme methods of recruitment, should we really allow this Milord?\n\n" } if (p_data.player_disposition < 100) { @@ -286,66 +252,19 @@ function FeatureSelected(Feature, system, planet) constructor{ body += "To increase recruit success chance more apothecaries will be required on the planet surface."; } break; - case eP_FEATURES.MISSION: - var mission_description = $""; - var planet_name = planet_numeral_name(planet_data.planet, obj_star_select.target); - var button_text = "none"; - var button_function = "none"; - var help = "none"; - switch (feature.problem) { - case "provide_garrison": - var reason; - if (feature.reason == "importance") {} - mission_description = $"The governor of {planet_name} has requested a force of marines might stay behind following your departure.\n\n\n assign a squad to garrison to initiate mission, The garrison leeader will need to be capable of conducting himself in a diplomatic manner in order for the garrison duration to be a success"; + case eP_FEATURES.MISSION: + var mission_description=$""; + var planet_name = planet_numeral_name(planet_data.planet, obj_star_select.target); + var button_text="none"; + var button_function="none"; + var help = "none"; + switch(feature.problem){ + case "provide_garrison": + var reason; + if (feature.reason == "importance"){ - break; - case "join_communion": - mission_description = $"The governor of {planet_name} has Invited a delegate of your forces to take part in ceremony."; - break; - case "hunt_beast": - mission_description = $"The governor of {planet_name} has bemoaned the raiding of huge beasts on the fringes of the planets largest city, the numbers have swelled recently and are causing huge damage to the planets small economy. You could send a force to intervene, it would provide a fine test of metal for any that partake."; - help = "This is a good opportunity to provide experience and training, having at least one marine with experience in such matters would be advisable"; - button_text = "Send Hunters"; - button_function = function() { - var dudes = collect_role_group("all", obj_star_select.target.name); - group_selection(dudes, {purpose: "Beast Hunt", purpose_code: feature.problem, number: 3, system: planet_data.system, feature: obj_star_select.feature, planet: planet_data.planet, array_slot: feature.array_position, selections: []}); - destroy = true; - }; - break; - case "protect_raiders": - mission_description = $"The governor of {planet_name} has sent many requests to the sector commander for help with defending against xenos raids on the populace of the planet, the reports seem to suggest the xenos in question are in fact dark eldar."; - help = "Set a squad to ambush"; - button_text = "Send Squad"; - _button_tooltip = "milage may vary on playability of this mission progress at your own risk"; - button_function = function() { - var dudes = collect_role_group("all", obj_star_select.target.name); - group_selection(dudes, {purpose: "Select Squad for Ambush", purpose_code: feature.problem, number: 1, system: planet_data.system, feature: obj_star_select.feature, planet: planet_data.planet, array_slot: feature.array_position, select_type: eMISSION_SELECT_TYPE.SQUADS, selections: []}); - destroy = true; - }; - break; - case "train_forces": - mission_description = $"The governor of {planet_name} fears the planet will not hold in the case of major incursion, it has not seen war in some time and he fears the ineptitude of the commanders available, he asks for aid in planning a thorough plan for defense and schedule of works for a period of at least 6 months."; - help = $"A task best suited to the more knowledgable or wise of your Commanders"; - button_text = "Assign Officer"; - button_function = function() { - var dudes = collect_role_group(SPECIALISTS_CAPTAIN_CANDIDATES, obj_star_select.target.name); - group_selection(dudes, {purpose: "Select Officer", purpose_code: feature.problem, number: 1, system: planet_data.system, feature: obj_star_select.feature, planet: planet_data.planet, array_slot: feature.array_position, selections: []}); - destroy = true; - }; - break; - case "Purge_enemies": - mission_description = $"The governor of {planet_name} has expressed his distaste of the neighboring governance of {target.name} {feature.target} he has expressed his views that they engage in heretical ways and harbor xenos enemies though in truth it is more likely that he simply wishes his political enemies disposed of, whatever the case his planet has great economic means and he has made bare his plans to compensate the emperors angels for their aid"; - break; - } - draw_text_transformed(xx + (area_width / 2), yy + 5, mission_name_key(feature.problem), 2, 2, 0); - draw_set_halign(fa_left); - draw_set_color(c_gray); - draw_text_ext(xx + 10, yy + 40, mission_description, -1, area_width - 20); - var text_body_height = string_height_ext(string_hash_to_newline(mission_description), -1, area_width - 20); - if (help != "none") { - draw_text_ext(xx + 10, yy + 40 + text_body_height + 10, help, -1, area_width - 20); - text_body_height += string_height_ext(string_hash_to_newline(mission_description), -1, area_width - 20) + 10; - } + } + mission_description=$"The governor of {planet_name} has requested a force of marines might stay behind following your departure.\n\n\n assign a squad to garrison to initiate mission, The garrison leeader will need to be capable of conducting himself in a diplomatic manner in order for the garrison duration to be a success"; break; case "join_communion": @@ -381,7 +300,7 @@ function FeatureSelected(Feature, system, planet) constructor{ purpose:"Select Squad for Ambush", purpose_code : feature.problem, number:1, - system : planet_data.system, + _system : planet_data.system, feature:obj_star_select.feature, planet : planet_data.planet, array_slot : feature.array_position, From 879e7e910187b821ead904b1c283bd903a2ac423 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 13:24:54 +0100 Subject: [PATCH 60/93] scr_draw planet features fixed --- .../scr_draw_planet_features/scr_draw_planet_features.gml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml index 03627ac8e5..f14b2fda98 100644 --- a/scripts/scr_draw_planet_features/scr_draw_planet_features.gml +++ b/scripts/scr_draw_planet_features/scr_draw_planet_features.gml @@ -13,7 +13,7 @@ function FeatureSelected(_feature, _system, _planet) constructor{ enter_count = 18; planet_data = new PlanetData(_planet,_system); - if (feature.f_type == eP_FEATURES.Forge){ + if (feature.f_type == eP_FEATURES.FORGE){ var _worker_caps = [2,4,8]; worker_capacity = _worker_caps[feature.size-1]; techs = collect_role_group(SPECIALISTS_TECHS, obj_star_select.target.name); @@ -169,7 +169,7 @@ function FeatureSelected(_feature, _system, _planet) constructor{ break; case eP_FEATURES.GENE_STEALER_CULT: generic=true; - var cult_control = planet_data.population_influences[eFACTION.Tyranids]; + var cult_control = planet_data.population_influences[eFACTION.TYRANIDS]; title = $"Cult of {feature.name}"; var control_string = ""; if (cult_control<25){ @@ -209,7 +209,7 @@ function FeatureSelected(_feature, _system, _planet) constructor{ case eP_FEATURES.ORKSTRONGHOLD: title = "Ork Stronghold"; generic = true; - if (planet_data.planet_forces[eFACTION.Ork]){ + if (planet_data.planet_forces[eFACTION.ORK]){ body = $"For as long as this Stronghold stands the orks here will continue to fortify it. The larger it gets the greater the capacity of this planet to produce orkish machines of war and ships and the better protected the ork forces will be from bombardment"; } else { body = "Without a force of orks to hold it together the fortress is slowly pulled apart from within by the inhabitants, It's capabilities will constantly decrease until soon there will be nothing left"; @@ -220,7 +220,7 @@ function FeatureSelected(_feature, _system, _planet) constructor{ var _planet = planet_data.planet; var _star = obj_star_select.target; var p_data = new PlanetData(_planet, _star); - var _recruit_world = p_data.get_features(eP_FEATURES.Recruiting_World)[0]; + var _recruit_world = p_data.get_features(eP_FEATURES.RECRUITING_WORLD)[0]; var _spare_apoth_points = p_data.get_local_apothecary_points(); title = "Marine Recruitment"; body = $"There are {_spare_apoth_points} apothecary rescource points available for recruit screening,\n\n"; From 14a61722eea5e94652aec2dfe0949daf2e58d6bc Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 13:31:18 +0100 Subject: [PATCH 61/93] revert changes but run gobo --- scripts/scr_cheatcode/scr_cheatcode.gml | 2 +- .../scr_mission_functions.gml | 1111 ++++++++--------- 2 files changed, 555 insertions(+), 558 deletions(-) diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 38e58a09b8..c25424ef0b 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -478,7 +478,7 @@ function draw_planet_debug_features(){ /// @mixin function draw_planet_debug_problems(){ var base_y = 220; - var _keys = planet_problem_keys; + var _keys = PLANET_PROBLEM_KEYS; base_y += 2; for (var i=0;i 1) { - for (var i = 1; i <= planets; i++) { - if (i == planet) { - continue; - } - if (p_owner[i] == eFACTION.IMPERIUM) { - enemy = i; + if (planets>1){ + for (var i=1;i<=planets;i++){ + if (i=planet) then continue; + if (p_owner[i]==eFACTION.IMPERIUM){ + enemy=i; break; } } } - mission_data.target = enemy; - if (!enemy) { - exit; - } + mission_data.target=enemy; + if (!enemy) then exit; } - add_new_problem(planet, problem, 20 + irandom(20),, mission_data); + add_new_problem(planet,problem, 20+irandom(20), ,mission_data); } } -function init_marine_acting_strange() { - LOGGER.info("RE: Strange Behavior"); - var marine_and_company = scr_random_marine("", 0); - if (marine_and_company == "none") { - LOGGER.error("RE: Strange Behavior, couldn't pick a space marine"); +function init_marine_acting_strange(){ + global.logger.info("RE: Strange Behavior"); + var marine_and_company = scr_random_marine("",0); + if(marine_and_company == "none") + { + global.logger.error("RE: Strange Behavior, couldn't pick a space marine"); exit; } @@ -126,47 +139,47 @@ function init_marine_acting_strange() { var role = unit.role(); var text = unit.name_role(); var company_text = scr_convert_company_to_string(unit.company); - if (company_text != "") { + if(company_text != ""){ company_text = $"({company_text})"; text += company_text; } text += " is behaving strangely."; - scr_alert("color", "lol", text, 0, 0); - scr_event_log("color", text); + scr_alert("color","lol",text,0,0); + scr_event_log("color",text); } function role_compare(unit, role){ - return unit.role() == obj_ini.role[100][role]; + return unit.role() == obj_ini.role[100][role]; } -function init_protect_raider_mission(squad) { +function init_protect_raider_mission(squad){ var _squad_units = squad.get_squad_structs(); var _squad_wisdom = stat_average(_squad_units, "wisdom"); var _squad_dex = stat_average(_squad_units, "dexterity"); var _tester = global.character_tester; var _pdata = new PlanetData(selection_data.planet, selection_data.system); - var _mod = _squad_wisdom + _squad_dex / 20; - if (scr_has_adv("Ambushers")) { - _mod += 10; + var _mod = _squad_wisdom+_squad_dex/20; + if (scr_has_adv("Ambushers")){ + _mod += 10 } var _leader = fetch_unit(squad.determine_leader()); - var _wis_test = _tester.standard_test(_leader, "wisdom", _mod, ["ambush"]); + var _wis_test = _tester.standard_test(_leader, "wisdom", _mod, ["ambush"]); - if (!_wis_test[0]) { + if (!_wis_test[0]){ var _mission_data = variable_clone(selection_data); - if (_wis_test[1] < -25) { + if (_wis_test[1] < -25){ scr_toggle_manage(); - var gar_pop = instance_create(0, 0, obj_popup); - gar_pop.title = $"Strange Disappearance"; + var gar_pop = instance_create(0, 0, obj_popup); + gar_pop.title=$"Strange Disappearance"; gar_pop.pdata = _pdata; - gar_pop.text = $"Your Marines make planet fall and are directed to report to the governor for the duration of the operation after a period of reconnaissance dig in for their ambush. After a two weeks have passed A message from the governor reaches your astropaths that your marines have not been heard of for some time, The raiders also were not noted to have arrived onor left the planet"; + gar_pop.text=$"Your Marines make planet fall and are directed to report to the governor for the duration of the operation after a period of reconnaissance dig in for their ambush. After a two weeks have passed A message from the governor reaches your astropaths that your marines have not been heard of for some time, The raiders also were not noted to have arrived onor left the planet"; //pip.image="event_march" var _dead_marine = array_random_index(_squad_units); - for (var i = 0; i < array_length(_dead_marine); i++) { - if (i == _dead_marine) { + for (var i = 0;i _worst_hit) { + if (_loyalty_hit>_worst_hit){ _worst_hit = _loyalty_hit; _worst = i; } } } - - if (_worst == -1) { - text = $"You are able to convince your captains of the strategic need to cover up the incidence, various excuses are made and fake logs that cover up the disaster of the mission"; + + if (_worst == -1){ + text = $"You are able to convince your captains of the strategic need to cover up the incidence, various excuses are made and fake logs that cover up the disaster of the mission" } else { - text = $"Not all of your captains are convinced of the need to use deceit and a none have breached the order but it has soured your relations with a few namely {_caps[_worst].name_role()}"; - } + text = $"Not all of your captains are convinced of the need to use deceit and a none have breached the order but it has soured your relations with a few namely {_caps[_worst].name_role()}" + } } -function protect_raiders_hold_memorial() { - reset_popup_options(); - options1 = "continue"; - _pdata.add_disposition(-30); - text = $"You prepare to have a large public memorial for your fallen marines on the planet surface as a show of defiance. The chapter are pleased by such an act and the population of the planet are mesmerized by the spectacle. The governor is furious not only has his incompetence to deal with the planets xenos issue been made public in such a way that the sector commander has now heard about it but he perceives his failures are being paraded in font of him\n nGovernor Disposition : -30"; +function protect_raiders_hold_memorial(){ + reset_popup_options(); + options1 = "continue"; + _pdata.add_disposition(-30); + text = $"You prepare to have a large public memorial for your fallen marines on the planet surface as a show of defiance. The chapter are pleased by such an act and the population of the planet are mesmerized by the spectacle. The governor is furious not only has his incompetence to deal with the planets xenos issue been made public in such a way that the sector commander has now heard about it but he perceives his failures are being paraded in font of him\n nGovernor Disposition : -30"; } function init_garrison_mission(planet, star, mission_slot){ - var problems_data = star.p_problem_other_data[planet] - var mission_data = problems_data[mission_slot]; - if (mission_data.stage == "preliminary"){ - var numeral_name = planet_numeral_name(planet, star); - mission_data.stage = "active"; - var garrison_length=(10+irandom(6)); - star.p_timer[planet][mission_slot] = garrison_length; - //pop.image="ancient_ruins"; - var gar_pop=instance_create(0,0,obj_popup); - //TODO some new universal methods for popups - gar_pop.title=$"Requested Garrison Provided to {numeral_name}"; - gar_pop.text=$"The governor of {numeral_name} Thanks you for considering his request for a garrison, you agree that the garrison will remain for at least {garrison_length} months."; - //pip.image="event_march" - gar_pop.add_option("Commence Garrison"); + var problems_data = star.p_problem_other_data[planet] + var mission_data = problems_data[mission_slot]; + if (mission_data.stage == "preliminary"){ + var numeral_name = planet_numeral_name(planet, star); + mission_data.stage = "active"; + var garrison_length=(10+irandom(6)); + star.p_timer[planet][mission_slot] = garrison_length; + //pop.image="ancient_ruins"; + var gar_pop=instance_create(0,0,obj_popup); + //TODO some new universal methods for popups + gar_pop.title=$"Requested Garrison Provided to {numeral_name}"; + gar_pop.text=$"The governor of {numeral_name} Thanks you for considering his request for a garrison, you agree that the garrison will remain for at least {garrison_length} months."; + //pip.image="event_march" + gar_pop.add_option("Commence Garrison"); gar_pop.image=""; gar_pop.cooldown=8; - obj_controller.cooldown=8; - scr_event_log("",$"Garrison committed to {numeral_name} for {garrison_length} months.", star.name ); - } + obj_controller.cooldown=8; + scr_event_log("",$"Garrison committed to {numeral_name} for {garrison_length} months.", star.name ); + } } + //@mixin obj_star function complete_garrison_mission(targ_planet, problem_index){ - var planet = new PlanetData(targ_planet, self); + var planet = new PlanetData(targ_planet, self); if (problem_has_key_and_value(targ_planet,problem_index,"stage", "active")){ if (planet.current_owner == eFACTION.IMPERIUM && system_garrison[targ_planet].garrison_force){ var _mission_string = $"The garrison on {planet_numeral_name(targ_planet)} has finished the period of garrison support agreed with the planetary governor."; @@ -281,180 +303,172 @@ function complete_garrison_mission(targ_planet, problem_index){ if (!p_garrison.garrison_leader){ p_garrison.find_leader(); } - if (result == "none") { - //TODO make a dedicated plus minus string function if there isn't one already - } else if (!result) { - var effect = result * irandom_range(1, 5); + if (result == "none"){ + //TODO make a dedicated plus minus string function if there isn't one already + } else if (!result){ + var effect = result * irandom_range(1,5); dispo[targ_planet] += effect; _mission_string += $"A number of diplomatic incidents occured over the period which had considerable negative effects on our disposition with the planetary governor (disposition -{effect})"; } else { - var effect = result * irandom_range(1, 5); + var effect = result * irandom_range(1,5); dispo[targ_planet] += result * effect; _mission_string += $"As a diplomatic mission the duration of the stay was a success with our political position with the planet being enhanced greatly (disposition +{effect})"; } var tester = global.character_tester; - var widom_test = tester.standard_test(p_garrison.garrison_leader, "wisdom", 0, ["siege"]); - if (widom_test[0]) { + var widom_test = tester.standard_test(p_garrison.garrison_leader, "wisdom",0, ["siege"]); + if (widom_test[0]){ p_fortified[targ_planet]++; - _mission_string += $"while stationed {p_garrison.garrison_leader.name_role()} makes several notable observations and is able to instruct the planets defense core leaving the world better defended (fortifications++)."; + _mission_string+=$"while stationed {p_garrison.garrison_leader.name_role()} makes several notable observations and is able to instruct the planets defense core leaving the world better defended (fortifications++)."; } //TODO just generall apply this each turn with a garrison to see if a cult is found - if (planet_feature_bool(p_feature[targ_planet], eP_FEATURES.GENE_STEALER_CULT)) { - var cult = return_planet_features(planet.features, eP_FEATURES.GENE_STEALER_CULT)[0]; - if (cult.hiding) { - widom_test = tester.standard_test(p_garrison.garrison_leader, "wisdom", 0, ["tyranids"]); - if (widom_test[0]) { + if (planet_feature_bool(p_feature[targ_planet], P_features.Gene_Stealer_Cult)){ + var cult = return_planet_features(planet.features,P_features.Gene_Stealer_Cult)[0]; + if (cult.hiding){ + widom_test = tester.standard_test(p_garrison.garrison_leader, "wisdom",0, ["tyranids"]); + if (widom_test[0]){ cult.hiding = false; - _mission_string += "Most alarmingly signs of a genestealer cult are noted by the garrison. how far the rot has gone will now need to be investigated and the xenos taint purged."; + _mission_string+="Most alarmingly signs of a genestealer cult are noted by the garrison. how far the rot has gone will now need to be investigated and the xenos taint purged."; } } } - scr_popup($"Agreed Garrison of {planet_numeral_name(targ_planet)} complete", _mission_string, "", ""); + scr_popup($"Agreed Garrison of {planet_numeral_name(targ_planet)} complete",_mission_string,"",""); } else { planet.add_disposition(-20); - scr_popup($"Agreed Garrison of {planet_numeral_name(targ_planet)}", $"your agreed garrison of {planet_numeral_name(targ_planet)} was cut short by your chapter the planetary governor has expressed his displeasure (disposition -20)", "", ""); + scr_popup($"Agreed Garrison of {planet_numeral_name(targ_planet)}",$"your agreed garrison of {planet_numeral_name(targ_planet)} was cut short by your chapter the planetary governor has expressed his displeasure (disposition -20)","",""); } remove_planet_problem(targ_planet, "provide_garrison"); } else { remove_planet_problem(targ_planet, "provide_garrison"); - } + } } function init_train_forces_mission(planet, star, mission_slot, marine){ - var _pdata = new PlanetData(planet, star); - var mission_data = _pdata.problems_data[mission_slot]; - if (mission_data.stage == "preliminary"){ - var numeral_name = _pdata.name(); - mission_data.stage = "active"; - var _mission_length=(irandom_range(3,12)); - star.p_timer[planet][mission_slot] = _mission_length; - //pop.image="ancient_ruins"; - var gar_pop=instance_create(0,0,obj_popup); - //TODO some new universal methods for popups - gar_pop.title=$"Training forces on {numeral_name} begins"; - gar_pop.text=$"{marine.name_role()} Has taken leave of his current post in order to aid the governor of {numeral_name} and his pdf commanders with training local forces and bolstering defences."; - var _is_cap = role_compare(marine, eROLE.CAPTAIN); - - if (_is_cap){ - gar_pop.text += "the governor seems to be impressed that such a high ranking officer has been assigned to his request (disp +3)"; - _pdata.add_disposition(3); - } - - //pip.image="event_march" - gar_pop.add_option($"Good luck {marine.name()}"); + var _pdata = new PlanetData(planet, star); + var mission_data = _pdata.problems_data[mission_slot]; + if (mission_data.stage == "preliminary"){ + var numeral_name = _pdata.name(); + mission_data.stage = "active"; + var _mission_length=(irandom_range(3,12)); + star.p_timer[planet][mission_slot] = _mission_length; + //pop.image="ancient_ruins"; + var gar_pop=instance_create(0,0,obj_popup); + //TODO some new universal methods for popups + gar_pop.title=$"Training forces on {numeral_name} begins"; + gar_pop.text=$"{marine.name_role()} Has taken leave of his current post in order to aid the governor of {numeral_name} and his pdf commanders with training local forces and bolstering defences."; + var _is_cap = role_compare(marine, eROLE.CAPTAIN); + + if (_is_cap){ + gar_pop.text += "the governor seems to be impressed that such a high ranking officer has been assigned to his request (disp +3)"; + _pdata.add_disposition(3); + } + + //pip.image="event_march" + gar_pop.add_option($"Good luck {marine.name()}"); gar_pop.image=""; gar_pop.cooldown=500; - obj_controller.cooldown=500; - scr_event_log("",$"{marine.name_role()} deployed to {numeral_name} for {_mission_length} months.", star.name); - } + obj_controller.cooldown=500; + scr_event_log("",$"{marine.name_role()} deployed to {numeral_name} for {_mission_length} months.", star.name); + } } function complete_train_forces_mission(targ_planet, problem_index){ - var planet = new PlanetData(targ_planet, self); - if (problem_has_key_and_value(targ_planet,problem_index,"stage","active")){ - var man_conditions = { + var planet = new PlanetData(targ_planet, self); + if (problem_has_key_and_value(targ_planet,problem_index,"stage","active")){ + var man_conditions = { "job": "train_forces", - "max": 1, - }; + "max" : 1, + } var _mission_string = ""; - var _trainer = collect_role_group("all", [name, targ_planet, 0], false, man_conditions); - if (array_length(_trainer)) { + var _trainer = collect_role_group("all",[name,targ_planet,0], false, man_conditions); + if (array_length(_trainer)){ var _unit_report_string = ""; var _tester = global.character_tester; var _wis_test_difficulty = -20; _trainer = _trainer[0]; var _tyannic_vet = _trainer.has_trait("tyrannic_vet"); - if (_tyannic_vet) { + if (_tyannic_vet){ _wis_test_difficulty += 10; - if (planet.has_feature(eP_FEATURES.GENE_STEALER_CULT)) { - var _cult = planet.get_features(eP_FEATURES.GENE_STEALER_CULT)[0]; - if (_cult.hiding) { - planet.delete_feature(eP_FEATURES.GENE_STEALER_CULT); + if (planet.has_feature(P_features.Gene_Stealer_Cult)){ + var _cult = planet.get_features(P_features.Gene_Stealer_Cult)[0]; + if (_cult.hiding){ + planet.delete_feature(P_features.Gene_Stealer_Cult); _mission_string += $"Fortune has smiled on this mission, {_trainer.name_role()}'s abilities as a Veteran of dealing with the Tyranids came in handy and in a short period was able to discern the existencee of a cult. He was able to organise those he considered to be still loyal to rally an extermiation of the cult, reeports suggest he was so successful as to have completely wiped the genestealer presence from the planet"; } } } var _siege_master = _trainer.has_trait("siege_master"); - if (_siege_master) { - _wis_test_difficulty += 10; + if (_siege_master){ + _wis_test_difficulty+=10; } var _brute = _trainer.has_trait("brute"); - if (_brute) { - _wis_test_difficulty -= 10; + if (_brute){ + _wis_test_difficulty-=10; } var _leader = _trainer.has_trait("natural_leader"); - if (_leader) { - _wis_test_difficulty += 10; + if (_leader){ + _wis_test_difficulty+=10; } - _unit_pass = _tester.standard_test(_trainer, "wisdom",_wis_test_difficulty); - if (_unit_pass[0]){ - var _new_pdf = planet.recruit_pdf((_unit_pass[1]/10));//this will approximate podf improvement for the time being - _mission_string += $"Training of the Pdf went well and improved the quality of the pdf as well as providing sizeable big recruitment improvement for the planet {_new_pdf} new pdf were recruited"; - if (_leader){ - var _disp_gain = 10; - planet.add_disposition(_disp_gain); - _mission_string += $"\n{_trainer.name_role()}s reputation a natural and confident leader proved well earned as he also made excellent diplomatic headway with the governor and his generals (disposition +{_disp_gain})" - } - if (_siege_master){ - _mission_string += $"{_trainer.name()}s trained eye as a Siege Master also allowed him to make several improvements to the planets fortifications (fortification +1)"; - planet.alter_fortification(1); - } else { - if (roll_dice(1, 100) > 75 && _trainer.intelligence > 45){ - _mission_string += $"{_trainer.name()} has proven themselves a great strategist when it comes to defensive structures beyond previousy known "; - var _start_stats = variable_clone(_trainer.get_stat_line()); - _trainer.add_trait("siege_master"); - var end_stat = _trainer.get_stat_line(); - var _stat_diff = compare_stats(end_stat,_start_stats); - _unit_report_string += $"{_trainer.name_role()} Has gained the trait {global.trait_list.siege_master.display_name}, {(print_stat_diffs(_stat_diff))}\n"; - _mission_string += "The new insights have allowed for minor improvements to planetary fortifications (fortification +1)"; - planet.alter_fortification(1); - } - } - } else { - disp_loss = -5; - _mission_string += "The orgional training mission was a failiure" - if (_brute){ - _mission_string += "in no short part due to his brutish nature (Trait : Brute)"; - } - _mission_string += "."; - - _mission_string += "He failed to work effectively with the existing chain of command"; - - if (_unit_pass[1] < -20) { - var _hard_loss_traits = [ - "harshborn", - "feral", - "zealous_faith", - "blood_for_blood", - "blunt", - "brute", - "brawler" - ]; + _unit_pass = _tester.standard_test(_trainer, "wisdom",_wis_test_difficulty); + if (_unit_pass[0]){ + var _new_pdf = planet.recruit_pdf((_unit_pass[1]/10));//this will approximate podf improvement for the time being + _mission_string += $"Training of the Pdf went well and improved the quality of the pdf as well as providing sizeable big recruitment improvement for the planet {_new_pdf} new pdf were recruited"; + if (_leader){ + var _disp_gain = 10; + planet.add_disposition(_disp_gain); + _mission_string += $"\n{_trainer.name_role()}s reputation a natural and confident leader proved well earned as he also made excellent diplomatic headway with the governor and his generals (disposition +{_disp_gain})" + } + if (_siege_master){ + _mission_string += $"{_trainer.name()}s trained eye as a Siege Master also allowed him to make several improvements to the planets fortifications (fortification +1)"; + planet.alter_fortification(1); + } else { + if (roll_dice(1, 100) > 75 && _trainer.intelligence > 45){ + _mission_string += $"{_trainer.name()} has proven themselves a great strategist when it comes to defensive structures beyond previousy known "; + var _start_stats = variable_clone(_trainer.get_stat_line()); + _trainer.add_trait("siege_master"); + var end_stat = _trainer.get_stat_line(); + var _stat_diff = compare_stats(end_stat,_start_stats); + _unit_report_string += $"{_trainer.name_role()} Has gained the trait {global.trait_list.siege_master.display_name}, {(print_stat_diffs(_stat_diff))}\n"; + _mission_string += "The new insights have allowed for minor improvements to planetary fortifications (fortification +1)"; + planet.alter_fortification(1); + } + } + } else { + disp_loss = -5; + _mission_string += "The orgional training mission was a failiure" + if (_brute){ + _mission_string += "in no short part due to his brutish nature (Trait : Brute)"; + } + _mission_string += "."; + + _mission_string+= "He failed to work effectively with the existing chain of command"; + + if (_unit_pass[1]<-20){ + var _hard_loss_traits = ["harshborn", "feral", "zealous_faith", "blood_for_blood", "blunt","brute", "brawler"]; var _hard_loss = false; - for (var i = 0; i < array_length(_hard_loss_traits); i++) { - if (array_contains(_trainer.traits, _hard_loss_traits[i])) { + for (var i=0;i=-10){ - if (irandom(100)<_unit.luck){ - _unit.add_or_sub_health(-100); - _unit_report_string += $"{_unit.name_role()} Was injured (health - 100)\n"; - } else { - _unit.add_or_sub_health(-250); - _unit_report_string += $"{_unit.name_role()} Was Badly injured, it is unknown if he will recover (health - 250)\n"; - } - } - } - } - _unit.job="none" + _unit = _hunters[i]; + _unit_pass = _tester.standard_test(_unit, "weapon_skill",10, ["beast"]); + if (_unit_pass[0]){ + _success=true; + _largest_pass = max(_largest_pass,_unit_pass[1]); + } + if (_unit_pass[0]){ + + _unit_report_string += _unit.add_trait("beast_slayer",true, true); + array_push(_successful_hunters, _unit); + } else { + var _tough_check = _tester.standard_test(_unit, "constitution",_unit.luck); + if (!_tough_check[0]){ + if (_tough_check[1]<-10){ + _unit_report_string += $"{_unit.name_role()} Was mauled to death\n"; + scr_kill_unit(_unit.company, _unit.marine_number); + _deaths++; + } else if (_tough_check[1]>=-10){ + if (irandom(100)<_unit.luck){ + _unit.add_or_sub_health(-100); + _unit_report_string += $"{_unit.name_role()} Was injured (health - 100)\n"; + } else { + _unit.add_or_sub_health(-250); + _unit_report_string += $"{_unit.name_role()} Was Badly injured, it is unknown if he will recover (health - 250)\n"; + } + } + } + } + _unit.job="none" } var _pop_data = ""; var _navy_fleets = get_imperial_navy_fleets(); if (array_length(_successful_hunters) && _largest_pass > 20 && array_length(_navy_fleets)){ - _pop_data = { - trophy_owner : array_random_element(_successful_hunters), - system: self.name, - planet : targ_planet, - target_fleet : array_random_element(_navy_fleets), - beast :_problem_data.beast_name, - planet_type : _planet.planet_type, - }; - - var _options = { - choice_func : init_deliver_trophy_mission, - str1 : "Continue", - } - - _pop_data.options = _options; - } + _pop_data = { + trophy_owner : array_random_element(_successful_hunters), + system: self.name, + planet : targ_planet, + target_fleet : array_random_element(_navy_fleets), + beast :_problem_data.beast_name, + planet_type : _planet.planet_type, + }; + + var _options = { + choice_func : init_deliver_trophy_mission, + str1 : "Continue", + } + + _pop_data.options = _options; + } if (_success){ - _mission_string = $"The mission was a success and a great number of beasts rounded up and slain, your marines were able to gain great skills and the prestige of your chapter has increased greatly across the planets populace." - if (_deaths){ - _mission_string += $"Unfortunatly {_deaths} of your marines died." - } - _mission_string += $"\n{_unit_report_string}"; + _mission_string = $"The mission was a success and a great number of beasts rounded up and slain, your marines were able to gain great skills and the prestige of your chapter has increased greatly across the planets populace." + if (_deaths){ + _mission_string += $"Unfortunatly {_deaths} of your marines died." + } + _mission_string += $"\n{_unit_report_string}"; } else { _mission_string = $"The mission was a failiure. The governor is disapointed and the legend of your chapter has undoubtedly been diminished"; _mission_string += $"\n{_unit_report_string}"; @@ -650,79 +664,79 @@ function complete_beast_hunt_mission(targ_planet, problem_index){ } else { remove_planet_problem(targ_planet, "hunt_beast"); - } + } } function init_deliver_trophy_mission(){ - pop_data.trophy_name = format_beast_trophy(pop_data.beast); - text = $"Much fanfare is made of the great trophy {pop_data.trophy_owner.name_role()} bears: {pop_data.trophy_name}."; - text += $" The governor proclaims it proof that {pop_data.beast} was the most fearsome predator in the sector."; + pop_data.trophy_name = format_beast_trophy(pop_data.beast); + text = $"Much fanfare is made of the great trophy {pop_data.trophy_owner.name_role()} bears: {pop_data.trophy_name}."; + text += $" The governor proclaims it proof that {pop_data.beast} was the most fearsome predator in the sector."; - text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; + text += $"\n\nAn astropathic message is later recieved from the Commander of an Imperial Navy fleet explaining that his fleet is currrently home to the {irandom_numeral(100)},{irandom_numeral(100)} and {irandom_numeral(100)} {pop_data.system} Regiments and pleads that the trophy be handed over to his fleet in order to boost the moral of the regiments and fleet in general"; - replace_options([ - { - str1 : "Refuse and place the trophy into the Librarium", - choice_func : function(){ - scr_add_artifact(); - } + replace_options([ + { + str1 : "Refuse and place the trophy into the Librarium", + choice_func : function(){ + scr_add_artifact(); + } - }, - { - str1 : "Accept", - choice_func : accept_deliver_trophy_mission - } - ]); + }, + { + str1 : "Accept", + choice_func : accept_deliver_trophy_mission + } + ]); } function accept_deliver_trophy_mission(){ - text = $"You Send a reply to tell the commander you accept and will ensure the trophy is delivered in person by the marine that slew the beast"; - var _targ_fleet = pop_data.target_fleet; + text = $"You Send a reply to tell the commander you accept and will ensure the trophy is delivered in person by the marine that slew the beast"; + var _targ_fleet = pop_data.target_fleet; - var _targ_fleet_intercept = fleets_next_location(_targ_fleet); - if (_targ_fleet.action == ""){ - text += $"\n\n the fleet in question is currently active around the {_targ_fleet_intercept.name} system"; - } else { - text += $"\n\n the fleet will next be accessible around the {_targ_fleet_intercept.name} system"; - } + var _targ_fleet_intercept = fleets_next_location(_targ_fleet); + if (_targ_fleet.action == ""){ + text += $"\n\n the fleet in question is currently active around the {_targ_fleet_intercept.name} system"; + } else { + text += $"\n\n the fleet will next be accessible around the {_targ_fleet_intercept.name} system"; + } - pop_data.target_fleet = _targ_fleet.uid; + pop_data.target_fleet = _targ_fleet.uid; - pop_data.delivering_marine = pop_data.trophy_owner.name_role(); - var _t_owner = pop_data.trophy_owner; - pop_data.trophy_owner = _t_owner.uid; + pop_data.delivering_marine = pop_data.trophy_owner.name_role(); + var _t_owner = pop_data.trophy_owner; + pop_data.trophy_owner = _t_owner.uid; - var _fleet_event = new FleetEvent(pop_data); + var _fleet_event = new FleetEvent(pop_data); - _fleet_event.turn_end = "deliver_trophy_end_turn_check"; - _fleet_event.destroy = "deliver_trophy_mission_fleet_destroyed"; - _fleet_event.timer_end = "deliver_trophy_mission_timed_out"; + _fleet_event.turn_end = "deliver_trophy_end_turn_check"; + _fleet_event.destroy = "deliver_trophy_mission_fleet_destroyed"; + _fleet_event.timer_end = "deliver_trophy_mission_timed_out"; - _fleet_event.timer = 120; + _fleet_event.timer = 120; - _targ_fleet.add_event(_fleet_event); + _targ_fleet.add_event(_fleet_event); - reset_popup_options(); + reset_popup_options(); } ///@mixin FleetEvent function deliver_trophy_mission_timed_out(){ - scr_popup( - "Objective Forgotten", - $"It has been so long in the life of a mortal that the commanders that once saught your delivery of the trophy from the hunt on {fleetevent_data.system} have now all either died or moved to greener pastures. The trophy will instead remain in the chapters possession", - ); + scr_popup( + "Objective Forgotten", + $"It has been so long in the life of a mortal that the commanders that once saught your delivery of the trophy from the hunt on {fleetevent_data.system} have now all either died or moved to greener pastures. The trophy will instead remain in the chapters possession", + ); } ///@mixin FleetEvent function deliver_trophy_mission_fleet_destroyed(){ - scr_popup( - "Fleet Destroyed", - $"With the Imperial Navy fleet containing the regiments from {fleetevent_data.system} destroyed there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", - ); + scr_popup( + "Fleet Destroyed", + $"With the Imperial Navy fleet containing the regiments from {fleetevent_data.system} destroyed there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", + ); } function get_beast_epithet(_planet_type){ @@ -738,96 +752,96 @@ function get_beast_epithet(_planet_type){ ///@mixin FleetEvent function deliver_trophy_end_turn_check(){ - var _navy_fleet = get_fleet_uid(fleet_uid); - if (!instance_exists(_navy_fleet)){ - deliver_trophy_mission_fleet_destroyed(); - return; - } - - var _ratio =0; - with (_navy_fleet){ - _ratio = fleet_remaining_guard_ratio(); - } - - if (_ratio<=0){ - scr_popup( - "Regiments Destroyed ", - $"The guard Regiments from {fleetevent_data.system} serving in the imperial navy fleet have been annihilated wholesale there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", - ); - return; - } - - if (is_orbiting(_navy_fleet)){ - var _nearest_player = instance_at_location(_navy_fleet.x,_navy_fleet.y,obj_p_fleet); - if (instance_exists(_nearest_player)){ - var _ships = fleet_full_ship_array(_nearest_player); - var _marine = fetch_unit_uid(fleetevent_data.trophy_owner); - var _present = _marine.is_at_location("", 0, _ships); - var _meet_point = _navy_fleet.orbiting; - if (_present){ - var _text = "{_marine.role(name)} is able to rendevous with the imperial navy at {_meet_point.name}." - _text += $" The guard regiments of {fleetevent_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns many of the regiments banners."; - var _marine_epithet = get_beast_epithet(fleetevent_data.planet_type); - _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.name_role()} spreading far and wide amoung guard regiments and has garnered the epithet {_marine_epithet}."; - var _roll = roll_dice_chapter(1, 100, "high"); - if (_roll>30 && _roll<70){ - //TODO would be cool to have this changed to be a guard specific piece of equipment - _text += "In return for your labour and in honour of your chapter the commander of the guard division has a brand new Rhino destined for the army diverted to your chapter"; - scr_add_vehicle("Rhino"); - } else if (_roll>=70 ){ - var _wanted_types = ["Ice","Desert","Agri","Lava","Death"]; - var _star = scr_get_stars(true,[],_wanted_types)[0]; - _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on {_star.name}."; - _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it before you do"; - - var _planet = scr_get_planet_with_type(_wanted_types); - var _battle_ground = new NewPlanetFeature(eP_FEATURES.OLDBATTLEGROUND); - - _battle_ground.player_hidden = false; - - _battle_ground.imperium_known = true; - - _star.add_feature(_planet,_battle_ground); - } - scr_popup( - "Trophy Delivered ", - _text, - ); - } - } - } + var _navy_fleet = get_fleet_uid(fleet_uid); + if (!instance_exists(_navy_fleet)){ + deliver_trophy_mission_fleet_destroyed(); + return; + } + + var _ratio =0; + with (_navy_fleet){ + _ratio = fleet_remaining_guard_ratio(); + } + + if (_ratio<=0){ + scr_popup( + "Regiments Destroyed ", + $"The guard Regiments from {fleetevent_data.system} serving in the imperial navy fleet have been annihilated wholesale there is no reason to now deliver the trophy from the hunt to them The trophy will instead remain in the chapters possession", + ); + return; + } + + if (is_orbiting(_navy_fleet)){ + var _nearest_player = instance_at_location(_navy_fleet.x,_navy_fleet.y,obj_p_fleet); + if (instance_exists(_nearest_player)){ + var _ships = fleet_full_ship_array(_nearest_player); + var _marine = fetch_unit_uid(fleetevent_data.trophy_owner); + var _present = _marine.is_at_location("", 0, _ships); + var _meet_point = _navy_fleet.orbiting; + if (_present){ + var _text = "{_marine.role(name)} is able to rendevous with the imperial navy at {_meet_point.name}." + _text += $" The guard regiments of {fleetevent_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns many of the regiments banners."; + var _marine_epithet = get_beast_epithet(fleetevent_data.planet_type); + _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.name_role()} spreading far and wide amoung guard regiments and has garnered the epithet {_marine_epithet}."; + var _roll = roll_dice_chapter(1, 100, "high"); + if (_roll>30 && _roll<70){ + //TODO would be cool to have this changed to be a guard specific piece of equipment + _text += "In return for your labour and in honour of your chapter the commander of the guard division has a brand new Rhino destined for the army diverted to your chapter"; + scr_add_vehicle("Rhino"); + } else if (_roll>=70 ){ + var _wanted_types = ["Ice","Desert","Agri","Lava","Death"]; + var _star = scr_get_stars(true,[],_wanted_types)[0]; + _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on {_star.name}."; + _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it before you do"; + + var _planet = scr_get_planet_with_type(_wanted_types); + var _battle_ground = new NewPlanetFeature(P_features.OldBattleGround); + + _battle_ground.player_hidden = false; + + _battle_ground.imperium_known = true; + + _star.add_feature(_planet,_battle_ground); + } + scr_popup( + "Trophy Delivered ", + _text, + ); + } + } + } } //TODO allow most of these functions to be condensed and allow arrays of problems or planets and maybe increase filtering options //filtering options could be done via universal methods that all the filters to be passed to many other game systems -function has_any_problem_planet(planet, star = "none") { - if (star == "none") { - for (var i = 0; i < array_length(p_problem[planet]); i++) { - if (p_problem[planet][i] != "") { +function has_any_problem_planet(planet, star="none"){ + if (star=="none"){ + for (var i=0;i 0) { - _had_problem = i; + if (star=="none"){ + for (var i = 0;i0){ + _had_problem=i; } } } } else { - with (star) { - _had_problem = has_problem_planet_with_time(planet, problem); + with (star){ + _had_problem=has_problem_planet_with_time(planet, problem) } } - return _had_problem; + return _had_problem; } -//returns the array position of a gien problem on a given planet -function find_problem_planet(planet, problem, star = "none") { - if (star == "none") { - for (var i = 0; i < array_length(p_problem[planet]); i++) { - if (p_problem[planet][i] == problem) { + +//returns the array position of a gien problem on a given planet +function find_problem_planet(planet, problem, star="none"){ + if (star=="none"){ + for (var i = 0;i Date: Thu, 23 Apr 2026 13:38:30 +0100 Subject: [PATCH 62/93] starighten ouot planet data --- scripts/scr_PlanetData/scr_PlanetData.gml | 1063 ++++++++--------- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 8 +- .../scr_system_search_helpers.gml | 2 +- 3 files changed, 524 insertions(+), 549 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index f173d22b61..c55d1e2c54 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1,15 +1,16 @@ // Script assets have changed for v2.3.0 see // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information -#macro FORCE_STRENGTH_DESCRIPTIONS ["none", "Minimal", "Sparse", "Moderate", "Numerous", "Very Numerous", "Overwhelming"]; +#macro ARR_STRENGTH_DESCRIPTIONS ["none", "Minimal", "Sparse", "Moderate", "Numerous", "Very Numerous", "Overwhelming"]; - //safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere - //disposition -function PlanetData(planet, system) constructor { - static large_pop_conversion = 1000000000; +/// @param {real} planet +/// @param {Asset.GMObject.obj_star} system +function PlanetData(planet, system) constructor{ +// + static large_pop_conversion = 1000000000; self.planet = planet; - self.system = system; + self.system = system; static refresh_data = function(){ @@ -87,7 +88,7 @@ function PlanetData(planet, system) constructor { requests_help = system.p_halp[planet]; - //safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere + //safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere //disposition if (system.dispo[planet] < -100 && system.dispo[planet] > -1000 && system.p_owner[planet] != eFACTION.PLAYER ) { // Personal Rule code be doing some interesting things system.dispo[planet] = -100; // TODO LOW DISPOSITION_REVAMP // Consider revamping the disposition system @@ -98,20 +99,11 @@ function PlanetData(planet, system) constructor { garrisons = system.system_garrison[planet]; sabatours = system.system_sabatours[planet]; system.system_datas[planet] = self; - - // current planet heresy - if (population == 0) { - system.p_heresy[planet] = 0; - system.p_heresy_secret[planet] = 0; - for (var i = 0; i < array_length(system.p_influence[planet]); ++i) { - system.p_influence[planet][i] = 0; - } - } } refresh_data(); - static total_corruption = function(){ + static total_corruption(){ return secret_corruption + corruption; } @@ -127,9 +119,9 @@ function PlanetData(planet, system) constructor { static set_player_disposition = function(new_dispo){ - player_disposition = new_dispo; + player_disposition = new_dispo; system.dispo[planet] = player_disposition; - }; + } static collect_planet_group = function(group=SPECIALISTS_STANDARD,opposite=false,search_conditions = {companies:"all"}){ return(collect_role_group(group,[system.name,planet],opposite,search_conditions)) @@ -137,32 +129,31 @@ function PlanetData(planet, system) constructor { static owner_faction_disposition = function(){ return obj_controller.disposition[current_owner]; - }; + } - static set_population = function(new_population) { + static set_population = function(new_population){ population = new_population; system.p_population[planet] = population; - }; + } - static edit_population = function(edit_val) { + static edit_population = function(edit_val){ population = population + edit_val >= 0 ? population + edit_val : 0; system.p_population[planet] = population; - }; + } //assumes a large pop figure and changes down if small pop planet - static population_small_conversion = function(pop_value) { - if (!large_population) { + static population_small_conversion = function(pop_value){ + if (!large_population){ pop_value *= large_pop_conversion; } return pop_value; - }; - - static population_large_conversion = function(pop_value) { - if (large_population) { + } + static population_large_conversion = function(pop_value){ + if (large_population){ pop_value /= large_pop_conversion; } return pop_value; - }; + } static end_turn_population_growth = function(){ if ((population < max_population) && (planet_type != "Dead") && (planet_type != "Craftworld") && (current_owner <= 5) && (planet_forces[eFACTION.HERETICS] == 0) && (planet_forces[eFACTION.TAU] == 0) && (planet_forces[eFACTION.ORK] == 0) && (planet_forces[eFACTION.NECRONS] == 0) && (planet_forces[eFACTION.TYRANIDS] == 0)) { @@ -181,65 +172,59 @@ function PlanetData(planet, system) constructor { static send_colony_ship = function(target, targ_planet, type){ new_colony_fleet(system, planet, target, targ_planet, type); - }; + } - static set_new_owner = function(new_owner) { + static set_new_owner = function(new_owner){ system.p_owner[planet] = new_owner; current_owner = new_owner; - }; - - static return_to_first_owner = function(allow_player = false) { - if (!allow_player && origional_owner == eFACTION.PLAYER) { + } + static return_to_first_owner = function(allow_player = false){ + if (!allow_player && origional_owner == eFACTION.PLAYER){ set_new_owner(eFACTION.IMPERIUM); } else { set_new_owner(origional_owner); } - }; + } - static add_disposition = function(alteration) { - var _new_dispo = clamp(player_disposition + alteration, 0, 100); + static add_disposition = function(alteration){ + var _new_dispo = clamp(player_disposition+alteration, 0, 100); player_disposition = _new_dispo; system.dispo[planet] = player_disposition; - }; - static display_population = function() { - if (large_population) { + } + + static display_population = function(){ + if (large_population){ return $"{population} B"; } else { return $"{scr_display_number(population)}"; } - }; + } - static owner_status = function() { + static owner_status = function(){ return obj_controller.faction_status[current_owner]; - }; + } - static at_war = function(imperium = 1, antagonism = 0, war = 1) { - var _at_war = false; + static at_war = function(imperium=1, antagonism=0, war=1){ + var _at_war = false if (imperium) { - if (current_owner > 5) { - _at_war = true; - } + if (current_owner>5) then _at_war=true; } if (antagonism) { - if (owner_status() == "Antagonism") { - _at_war = true; - } + if (owner_status()=="Antagonism") then _at_war=true; } if (war) { - if (owner_status() == "War") { - _at_war = true; - } + if (owner_status()=="War") then _at_war=true; } return _at_war; - }; + } static edit_guardsmen = function(edit_val){ system.p_guardsmen[planet] = max(0, system.p_guardsmen[planet] + edit_val); guardsmen = system.p_guardsmen[planet]; - }; + } static edit_pdf = function(edit_val){ system.p_pdf[planet] = max(0, system.p_pdf[planet] + edit_val); @@ -247,30 +232,30 @@ function PlanetData(planet, system) constructor { } static alter_fortification = function(alteration){ - system.p_fortified[planet] += alteration; - fortification_level = system.p_fortified[planet]; + system.p_fortified[planet] += alteration; + fortification_level = system.p_fortified[planet]; } static recruit_pdf = function(percentage_pop){ - var new_pdf = population * (percentage_pop/100); - edit_population(new_pdf*-1); - if (large_population){ - new_pdf *= large_pop_conversion; - } - pdf += new_pdf; - system.p_pdf[planet] = pdf; - return new_pdf; + var new_pdf = population * (percentage_pop/100); + edit_population(new_pdf*-1); + if (large_population){ + new_pdf *= large_pop_conversion; + } + pdf += new_pdf; + system.p_pdf[planet] = pdf; + return new_pdf; } - static add_forces = function(faction, val){ - var _new_val = planet_forces[faction]+val; - return edit_forces(faction,_new_val); - } + static add_forces = function(faction, val){ + var _new_val = planet_forces[faction]+val; + return edit_forces(faction,_new_val); + } - static edit_forces = function(faction, val) { - planet_forces[faction] = clamp(val, 0, 12); + static edit_forces = function(faction, val){ + planet_forces[faction] = clamp(val,0,12); var _new_val = planet_forces[faction]; - switch (faction) { + switch (faction){ case eFACTION.ORK: system.p_orks[planet] = _new_val; break; @@ -294,22 +279,25 @@ function PlanetData(planet, system) constructor { break; case eFACTION.ECCLESIARCHY: system.p_sisters[planet] = _new_val; - break; + break; } - return _new_val; - }; + return _new_val + + } + + - static assasinate_governor = function(assaination_type, discovery_modifier) { + static assasinate_governor = function(assaination_type, discovery_modifier){ var randa = roll_dice_chapter(1, 100, "high"); var randa2 = roll_dice(1, 100); //type 1 is install a sympathectic else it's a straight serf installation - if (assaination_type == 1) { + if (assaination_type == 1){ var _discovery_rate = 10; set_player_disposition(70 + floor(random_range(5, 15)) + 1); - var _text = $"Many of the successors for {name()} are removed or otherwise made indisposed. Your chapter ensures that the new Planetary Governor is sympathetic to your plight and more than willing to heed your advice. A powerful new ally may be in the making."; - scr_event_log("", $"Planetary Governor of {name()} assassinated. A more suitable Governor is installed."); + var _text = $"Many of the successors for {name()} are removed or otherwise made indisposed. Your chapter ensures that the new Planetary Governor is sympathetic to your plight and more than willing to heed your advice. A powerful new ally may be in the making."; + scr_event_log("", $"Planetary Governor of {name()} assassinated. A more suitable Governor is installed."); } else { var _discovery_rate = 25; if (origional_owner != 3) { @@ -321,16 +309,21 @@ function PlanetData(planet, system) constructor { } if (randa2 <= (_discovery_rate * discovery_modifier)) { - if (assaination_type == 1) { + if (assaination_type == 1){ var _duration = ((choose(1, 2, 3, 4, 5, 6) + choose(1, 2, 3, 4, 5, 6)) * 6) + choose(-3, -2, -1, 0, 1, 2, 3); } else { var _duration = (choose(1, 2) * 6) + choose(-3, -2, -1, 0, 1, 2, 3); } - add_event({duration: _duration, e_id: "governor_assassination", variant: assaination_type, system: system.name, planet: planet}); + add_event({ + duration : _duration, + e_id : "governor_assassination", + variant : assaination_type, + system : system.name, + planet : planet, + }); } return _text; - }; - + } static grow_ork_forces = function(){ var contin = 0; var _rando = roll_dice(1,100);// This part handles the spreading @@ -340,11 +333,11 @@ function PlanetData(planet, system) constructor { var _has_warboss = has_feature(eP_FEATURES.ORKWARBOSS); var _has_stronghold = has_feature(eP_FEATURES.ORKSTRONGHOLD); var _build_ships = false; - if (_has_stronghold) { + if (_has_stronghold){ var _stronghold = get_features(eP_FEATURES.ORKSTRONGHOLD)[0]; } - if (_has_warboss) { + if (_has_warboss){ var _warboss = get_features(eP_FEATURES.ORKWARBOSS)[0]; _warboss.turns_static++; } @@ -378,65 +371,58 @@ function PlanetData(planet, system) constructor { if (array_length(_non_deads)>0 && _rando>40){ var _ork_spread_planet = array_random_element(_non_deads); - var _orks = planet_forces[eFACTION.ORK]; + var _orks = planet_forces[eFACTION.ORK] var _ork_target = system.p_orks[_ork_spread_planet]; - var _spread_orks = current_owner == eFACTION.ORK && ((pdf + guardsmen + planet_forces[8] + planet_forces[10] + planet_forces[1]) == 0); - if (_spread_orks) { + var _spread_orks = (current_owner==eFACTION.ORK && ((pdf + guardsmen + planet_forces[8] + planet_forces[10]+planet_forces[1]) == 0 )); + if (_spread_orks){ // determine maximum Ork presence on the source planet var _ork_max = planet_forces[eFACTION.ORK]; - if (_ork_max < 5 && _ork_target < 2) { - system.p_orks[_ork_spread_planet]++; - } - if (_orks > 4 && _ork_target < 3) { + if (_ork_max<5 && _ork_target<2) then system.p_orks[_ork_spread_planet]++; + if (_orks>4 && _ork_target<3){ system.p_orks[_ork_spread_planet]++; - if (_ork_target < 3) { + if (_ork_target<3){ system.p_orks[_ork_spread_planet]++; add_forces(eFACTION.ORK, -1); } } + } } contin=0; _rando=roll_dice(1,100);// This part handles the ship building if (population>0 && pdf==0 && guardsmen==0 && planet_forces[10]==0) and (planet_forces[eFACTION.TAU]==0){ - if (!large_population){ - set_population(population*0.97); - }else { - edit_population(-0.01); - } - + if (!large_population){ + set_population(population*0.97); + }else { + edit_population(-0.01); + } + }; var enemies_present=false; with (system){ - for (var n=0;n=1) and ((p_pdf[plan]>0) or (p_guardsmen[plan]>0) or (p_traitors[plan]>0) or (p_tau[plan]>0)){ + enemies_present=true; + } } } - if (_has_warboss && !_has_stronghold) { - rando = roll_dice_chapter(1, 100, "low"); - if (rando < 30) { + if (_has_warboss && !_has_stronghold){ + _rando=roll_dice_chapter(1,100, "low"); + if (_rando<30){ add_feature(eP_FEATURES.ORKSTRONGHOLD); } } else { - if (_has_stronghold) { + if (_has_stronghold){ growth = 0.01; - if (_has_warboss) { + if (_has_warboss){ growth *= 2; } - if (_stronghold.tier < planet_forces[eFACTION.ORK]) { + if (_stronghold.tier0) then _rando-=10;// Empire bonus, was 15 before // Check for industrial facilities - var fleet_buildable = (planet_type != "Dead" && planet_type != "Lava") || _has_warboss || _has_stronghold; - if (fleet_buildable && planet_forces[eFACTION.ORK] >= 4) { - // Used to not have Ice either + var fleet_buildable = ((planet_type!="Dead" && planet_type!="Lava") || _has_warboss || _has_stronghold); + if (fleet_buildable && planet_forces[eFACTION.ORK]>=4){// Used to not have Ice either - if (instance_exists(obj_p_fleet)) { - var ppp = instance_nearest(x, y, obj_p_fleet); - if ((point_distance(x, y, ppp.x, ppp.y) < 50) && (ppp.action == "")) { + if (instance_exists(obj_p_fleet)){ + var ppp=instance_nearest(x,y,obj_p_fleet); + if (point_distance(x,y,ppp.x,ppp.y)<50) and (ppp.action=""){ exit; - } + }; } if (planet_type == "Forge"){ _rando-=80; } else if (planet_type == "Hive" || planet_type == "Temperate"){ - _rando-=30; + _rando-=30; }else if (planet_type == "Agri"){ - _rando-=10; + _rando-=10; } var _ork_fleet = scr_orbiting_fleet(eFACTION.ORK, system); if (_ork_fleet=="none"){ - if (_rando<=20){ - new_ork_fleet(x,y); - } + if (_rando<=20){ + new_ork_fleet(x,y); + } } else { + _build_ships = true; - } - } + + } + } } - if (_build_ships) { + if (_build_ships){ var _pdata = self; with (_ork_fleet){ // Increase ship number for this object? @@ -516,38 +503,40 @@ function PlanetData(planet, system) constructor { } switch(_rando){ case 3: - capital_number += 1; + capital_number+=1; break; case 2: - frigate_number += 1; + frigate_number+=1; break; case 1: - escort_number += 1; + escort_number+=1; break; + } } var ii=round(standard_fleet_strength_calc()); if (ii<=1) then ii=1; image_index=ii; //if big enough flee bugger off to new star - if (image_index >= 5) { + if (image_index>=5){ instance_deactivate_object(_pdata.system); - with (obj_star) { - if (is_dead_star()) { + with(obj_star){ + if (is_dead_star()){ instance_deactivate_object(id); } else { - if (owner == eFACTION.ORK || array_contains(p_owner, eFACTION.ORK)) { + if (owner == eFACTION.ORK || array_contains(p_owner, eFACTION.ORK)){ instance_deactivate_object(id); - } + } } } - var new_wagh_star = instance_nearest(x, y, obj_star); - if (instance_exists(new_wagh_star)) { - action_x = new_wagh_star.x; - action_y = new_wagh_star.y; + var new_wagh_star = instance_nearest(x,y,obj_star); + if (instance_exists(new_wagh_star)){ + action_x=new_wagh_star.x; + action_y=new_wagh_star.y; action = ""; set_fleet_movement(); } + } instance_activate_object(obj_star); } @@ -559,16 +548,26 @@ function PlanetData(planet, system) constructor { _warboss.turns_static = 0; _ork_fleet.cargo_data.ork_warboss = _warboss; delete_feature(eP_FEATURES.ORKWARBOSS); - if (!_warboss.player_hidden || !irandom(5)) { - scr_alert("red", "ork", $"{_warboss.name} departs {name()} as his waaagh gains momentum", 0, 0); + if (!_warboss.player_hidden || !irandom(5)){ + scr_alert("red","ork",$"{_warboss.name} departs {name()} as his waaagh gains momentum",0,0); } } } - }; + + } + + // current planet heresy + if (population == 0) { + system.p_heresy[planet] = 0; + system.p_heresy_secret[planet] = 0; + for (var i = 0; i < array_length(system.p_influence[planet]); ++i) { + system.p_influence[planet][i] = 0; + } + } static alter_corruption = function(value){ - alter_planet_corruption(value, planet, system); - corruption = system.p_heresy[planet]; + alter_planet_corruption(value, planet, system); + corruption = system.p_heresy[planet]; } static set_corruption = function(value){ @@ -577,62 +576,65 @@ function PlanetData(planet, system) constructor { } static has_problem = function(problem){ - has_problem_planet(planet, problem, system); + has_problem_planet(planet, problem, system); } - static remove_problem = function(problem) { - remove_planet_problem(planet, problem, system); - }; - - static find_problem = function(problem) { + static remove_problem = function(problem){ + remove_planet_problem(planet ,problem,system) + } + static find_problem = function(problem){ return find_problem_planet(planet, problem, system); - }; + } + + static add_problem = function(problem, timer, other_data={}){ + return add_new_problem(planet, problem, timer,system, other_data); + } - static add_problem = function(problem, timer, other_data = {}) { - return add_new_problem(planet, problem, timer, system, other_data); - }; - static name = function() { - var _name = ""; + static name = function(){ + var _name=""; - _name = planet_numeral_name(planet, system); + _name = planet_numeral_name(planet, system); return _name; - }; + } - static xenos_and_heretics = function() { + static xenos_and_heretics = function(){ var xh_force = 0; - for (var i = 5; i < array_length(planet_forces); i++) { + for (var i=5;i 0) { + if (has_feature(eP_FEATURES.STARSHIP) && engineer_count>0){ //TODO allow total tech point usage here var _starship = get_features(eP_FEATURES.STARSHIP)[0]; var _engineer_score_start = _starship.engineer_score; - if (_starship.engineer_score < 2000) { - for (var v = 0; v < engineer_count; v++) { - _starship.engineer_score += techs[v].technology / 2; + if (_starship.engineer_score<2000){ + for (var v=0;v 0 && _starship.funds_spent < _target_spend) { - scr_alert("green", "owner", $"{_requisition_spend} Requision spent on Ancient Ship repairs in materials and outfitting (outfitting {(_starship.funds_spent / _target_spend) * 100}%)", system.x, system.y); + var _maxr=floor(obj_controller.requisition/50); + var _requisition_spend=min(_maxr*50,array_length(techs)*50,_target_spend-_starship.funds_spent); + obj_controller.requisition-=_requisition_spend; + _starship.funds_spent+=_requisition_spend; + + if (_requisition_spend>0 && _starship.funds_spent<_target_spend){ + scr_alert("green","owner",$"{_requisition_spend} Requisition spent on Ancient Ship repairs in materials and outfitting (outfitting {(_starship.funds_spent/_target_spend)*100}%)",system.x,system.y); } - if (_starship.funds_spent >= _target_spend && _starship.engineer_score >= 2000) { - // u2=tar; + if (_starship.funds_spent>=_target_spend && _starship.engineer_score>=2000){// u2=tar; //TODO refactor into general new ship logic delete_feature(eP_FEATURES.STARSHIP); - - var locy = $"{name()}"; - - var flit = instance_create(system.x, system.y, obj_p_fleet); - + + var locy=$"{name()}"; + + var flit=instance_create(system.x,system.y,obj_p_fleet); + var _slaughter = new_player_ship("Gloriana", system.name, "Slaughtersong"); add_ship_to_fleet(_slaughter, flit); flit.oribiting = system.id; - - scr_popup($"Ancient Ship Restored", $"The ancient ship within the ruins of {locy} has been fully repaired. It is determined to be a Gloriana Class vessel and is bristling with golden age weaponry and armour. Your {string(obj_ini.role[100][16])}s are excited; the Slaughtersong is ready for it's maiden voyage, at your command.", "", ""); + + scr_popup($"Ancient Ship Restored",$"The ancient ship within the ruins of {locy} has been fully repaired. It is determined to be a Gloriana Class vessel and is bristling with golden age weaponry and armour. Your {string(obj_ini.role[100][16])}s are excited; the Slaughtersong is ready for it's maiden voyage, at your command.","",""); } - } - } catch (_exception) { + } + }catch (_exception){ handle_exception(_exception); } - }; + } - static guard_score_calc = function() { + static guard_score_calc = function(){ guard_score = 0; - if (guardsmen < 500 && guardsmen > 0) { + if (guardsmen < 500 && guardsmen>0) { guard_score = 0.1; } else if (guardsmen >= 100000000) { guard_score = 7; @@ -777,198 +781,179 @@ function PlanetData(planet, system) constructor { } return guard_score; - }; + } + + static continue_to_planet_battle = function(stop){ - static continue_to_planet_battle = function(stop) { var _nids_real = planet_forces[eFACTION.TYRANIDS]; var _nids_score = _nids_real < 4 ? 0 : _nids_real; - var _nid_diff = _nids_score - _nids_real; + var _nid_diff = _nids_score-_nids_real; - if ((chaos_forces == 6.1) && (_nids_real > 0)) { - tyranids_score = _nids_real; - } + if (chaos_forces==6.1) and (_nids_real>0) then tyranids_score=_nids_real; - if (current_owner == eFACTION.TAU) { + if (current_owner == eFACTION.TAU){ stop = (xenos_and_heretics() + _nid_diff + player_forces + planet_forces[eFACTION.ECCLESIARCHY]) <= 0; } - - if (stop) { - if ((planet_forces[eFACTION.ORK] > 0) && (planet_forces[eFACTION.ECCLESIARCHY] > 0)) { - stop = 0; - } + + if (stop){ + if (planet_forces[eFACTION.ORK]>0) and (planet_forces[eFACTION.ECCLESIARCHY]>0) then stop=0; } - var imperium_forces = (guardsmen > 0) || (pdf > 0) || (planet_forces[eFACTION.ECCLESIARCHY] > 0); + var imperium_forces = ((guardsmen>0) or (pdf>0) or (planet_forces[eFACTION.ECCLESIARCHY]>0)); - if (stop) { - if (planet_forces[eFACTION.NECRONS] >= 5 || planet_forces[eFACTION.TYRANIDS] >= 5 && imperium_forces) { - stop = 0; - } + if (stop){ + if (planet_forces[eFACTION.NECRONS]>=5 || planet_forces[eFACTION.TYRANIDS]>=5 && imperium_forces) then stop=0; } + //tau fight imperial - if (stop) { - if (current_owner == eFACTION.TAU) { - if (((guardsmen > 0) || (planet_forces[eFACTION.ECCLESIARCHY] > 0)) && ((pdf > 0) || (planet_forces[eFACTION.TAU] > 0))) { - stop = 0; - } + if (stop){ + if (current_owner = eFACTION.TAU){ + if ((guardsmen>0) or (planet_forces[eFACTION.ECCLESIARCHY]>0)) and ((pdf>0) or (planet_forces[eFACTION.TAU]>0)) then stop=0; } + } - + // Attack heretics whenever possible, even player controlled ones - if (stop) { - if ((player_forces + pdf > 0) && (guardsmen > 0) && (obj_controller.faction_status[2] == "War")) { - stop = 0; - } + if (stop){ + if (player_forces+pdf>0) and (guardsmen>0) and (obj_controller.faction_status[2]="War") then stop=0; } - if (stop) { - if ((player_forces + pdf > 0) && (planet_forces[eFACTION.ECCLESIARCHY] > 0) && (obj_controller.faction_status[5] == "War")) { - stop = 0; - } + if (stop){ + if (player_forces+pdf>0) and (planet_forces[eFACTION.ECCLESIARCHY]>0) and (obj_controller.faction_status[5]="War") then stop=0; } return stop; - }; + } - static pdf_will_support_player = function() { - if (current_owner == eFACTION.TAU) { + static pdf_will_support_player = function(){ + if (current_owner== eFACTION.TAU){ return false; } - if (has_feature(eP_FEATURES.GENE_STEALER_CULT) && current_owner == eFACTION.TYRANIDS) { + if (has_feature(eP_FEATURES.GENE_STEALER_CULT) && current_owner==eFACTION.TYRANIDS){ return false; } - if ((current_owner == 1 || obj_controller.faction_status[2] != "War") && pdf) { + if ((current_owner=1 || obj_controller.faction_status[2]!="War") && pdf){ return true; } return false; - }; + } - static guard_attack_matrix = function() { + static guard_attack_matrix = function(){ var guard_attack = ""; // if (p_eldar[planet]>0) and (p_owner[planet]!=6) then guard_attack="eldar"; //if (planet_forces[eFACTION.TAU] + planet_forces[eFACTION.ORK] + planet_forces[eFACTION.HERETICS]+ planet_forces[eFACTION.CHAOS]) - if (planet_forces[eFACTION.TAU] > 0) { - guard_attack = "tau"; - } - if (planet_forces[eFACTION.ORK] > 0) { - guard_attack = "ork"; - } - if (planet_forces[eFACTION.HERETICS] > 0) { - // Always goes after traitors first, unless - guard_attack = "traitors"; - if ((planet_forces[eFACTION.HERETICS] <= 1 && planet_forces[eFACTION.TAU] >= 4) && (current_owner != 8)) { - guard_attack = "tau"; - } - } - if (planet_forces[eFACTION.CHAOS] > 0) { - guard_attack = "csm"; - } - if ((pdf > 0) && (current_owner == eFACTION.TAU)) { - guard_attack = "pdf"; + if (planet_forces[eFACTION.TAU]>0) then guard_attack="tau"; + if (planet_forces[eFACTION.ORK]>0) then guard_attack="ork"; + if (planet_forces[eFACTION.HERETICS]>0){ + // Always goes after traitors first, unless + guard_attack="traitors"; + if (planet_forces[eFACTION.HERETICS]<=1 && planet_forces[eFACTION.TAU]>=4) and (current_owner!=8) then guard_attack="tau"; } + if (planet_forces[eFACTION.CHAOS]>0) then guard_attack="csm"; + if (pdf>0) and (current_owner=eFACTION.TAU) then guard_attack="pdf"; - if (current_owner == eFACTION.PLAYER) { - if (pdf > 0 && obj_controller.faction_status[2] == "War") { - guard_attack = "pdf"; - } - } - if ((planet_forces[eFACTION.TYRANIDS] <= 1) && (planet_forces[eFACTION.ORK] >= 4)) { - guard_attack = "ork"; + if (current_owner = eFACTION.PLAYER){ + if (pdf>0 && obj_controller.faction_status[2]=="War") then guard_attack="pdf"; } + if (planet_forces[eFACTION.TYRANIDS]<=1) and (planet_forces[eFACTION.ORK]>=4) then guard_attack="ork"; // if (p_tyranids[planet]>0) and (guard_attack="") then guard_attack="tyranids"; - if (planet_forces[eFACTION.TYRANIDS] >= 4) { - guard_attack = "tyranids"; - } else if (planet_forces[eFACTION.TYRANIDS] > 0) { - if (has_feature(eP_FEATURES.GENE_STEALER_CULT)) { + if (planet_forces[eFACTION.TYRANIDS]>=4){ + guard_attack="tyranids"; + }else if (planet_forces[eFACTION.TYRANIDS]>0){ + if (has_feature(eP_FEATURES.GENE_STEALER_CULT)){ var _hidden_cult = get_features(eP_FEATURES.GENE_STEALER_CULT)[0].hiding; - if (!_hidden_cult) { - guard_attack = "tyranids"; - } else if (population_influences[eFACTION.TYRANIDS] >= 50) { - guard_attack = "pdf"; + if (!_hidden_cult){ + guard_attack="tyranids"; + }else if (population_influences[eFACTION.TYRANIDS]>=50){ + guard_attack="pdf"; } } else { - guard_attack = "tyranids"; + guard_attack="tyranids"; } - } else if (population_influences[eFACTION.TYRANIDS] >= 50) { - guard_attack = "pdf"; - } + } else if (population_influences[eFACTION.TYRANIDS]>=50){ + guard_attack="pdf"; + } - return guard_attack; - }; + return guard_attack; + } - static pdf_attack_matrix = function() { - var _no_notable_traitors = planet_forces[eFACTION.HERETICS] <= 1; + + static pdf_attack_matrix = function(){ + var _no_notable_traitors = planet_forces[eFACTION.HERETICS]<=1; var _pdf_attack = ""; - if (planet_forces[eFACTION.TYRANIDS] >= 4 && !has_feature(eP_FEATURES.GENE_STEALER_CULT)) { + if (planet_forces[eFACTION.TYRANIDS]>=4 && !has_feature(eP_FEATURES.GENE_STEALER_CULT)){ _pdf_attack = "tyranids"; } - if (_no_notable_traitors && _pdf_attack == "") { - if (planet_forces[eFACTION.ORK] >= 4) { - _pdf_attack = "ork"; - } else if (planet_forces[eFACTION.TAU] >= 4 && current_owner != 8) { - _pdf_attack = "tau"; + if (_no_notable_traitors && _pdf_attack=="") { + if ((planet_forces[eFACTION.ORK]>=4)){ + _pdf_attack="ork"; + } else if (planet_forces[eFACTION.TAU]>=4 && current_owner!=8){ + _pdf_attack="tau"; } - } - if (guardsmen && _pdf_attack == "") { - if (obj_controller.faction_status[2] == "War") { - if (pdf_will_support_player()) { - _pdf_attack = "guard"; + } + if (guardsmen && _pdf_attack==""){ + if (obj_controller.faction_status[2]=="War"){ + if (pdf_will_support_player()){ + _pdf_attack="guard"; } - } else if (current_owner == eFACTION.TAU) { - _pdf_attack = "guard"; - } else if (has_feature(eP_FEATURES.GENE_STEALER_CULT) && population_influences[eFACTION.TYRANIDS] >= 50) { - _pdf_attack = "guard"; + } else if (current_owner == eFACTION.TAU){ + _pdf_attack="guard"; + }else if (has_feature(eP_FEATURES.GENE_STEALER_CULT) && population_influences[eFACTION.TYRANIDS]>=50){ + _pdf_attack="guard"; } } - if (_pdf_attack == "") { - if (planet_forces[eFACTION.CHAOS] > 0) { - _pdf_attack = "csm"; - } else if (planet_forces[eFACTION.HERETICS] > 0) { - _pdf_attack = "traitors"; - } else if (planet_forces[eFACTION.ORK] > 0) { - _pdf_attack = "ork"; - } else if ((planet_forces[eFACTION.TAU] > 0) && (current_owner != eFACTION.TAU)) { - _pdf_attack = "tau"; + if (_pdf_attack==""){ + if (planet_forces[eFACTION.CHAOS]>0){ + _pdf_attack="csm"; + } else if (planet_forces[eFACTION.HERETICS]>0){ + _pdf_attack="traitors"; + } else if ((planet_forces[eFACTION.ORK]>0)){ + _pdf_attack="ork"; + } else if (planet_forces[eFACTION.TAU]>0) and (current_owner!=eFACTION.TAU){ + _pdf_attack="tau"; } } // Always goes after traitors first, unless - return _pdf_attack; - }; + return _pdf_attack; + } - static pdf_loss_reduction_calc = function(){ - pdf_loss_reduction = fortification_level*0.001; - if (pdf_will_support_player()){ - pdf_loss_reduction+=garrisons.viable_garrison*0.0005; - } - return pdf_loss_reduction; - } + static pdf_loss_reduction_calc = function(){ + pdf_loss_reduction = fortification_level*0.001; + if (pdf_will_support_player()){ + pdf_loss_reduction+=garrisons.viable_garrison*0.0005; + } + return pdf_loss_reduction; + } - static pdf_defence_loss_to_orks = function(){ - var active_garrison = pdf_will_support_player() && garrisons.viable_garrison>0; + static pdf_defence_loss_to_orks = function(){ + var active_garrison = pdf_will_support_player() && garrisons.viable_garrison>0; if (planet_forces[eFACTION.ORK]>=4) and (pdf>=30000){ - pdf=floor(pdf*(min(0.95, 0.55+pdf_loss_reduction))); - } + pdf=floor(pdf*(min(0.95, 0.55+pdf_loss_reduction))); + } else if (planet_forces[eFACTION.ORK]>=4 && pdf<30000 && pdf>=10000){ - pdf=active_garrison?pdf*0.4:0; + pdf=active_garrison?pdf*0.4:0; } - if ((planet_forces[eFACTION.ORK] >= 2) && (pdf < 2000)) { - pdf = 0; + else if (planet_forces[eFACTION.ORK]>=3) and (pdf<10000){ + pdf=active_garrison?pdf*0.4:0; } - if ((planet_forces[eFACTION.ORK] >= 1) && (pdf < 200)) { - pdf = 0; + else if (planet_forces[eFACTION.ORK]<3 && pdf>30000){ + pdf=floor(pdf*(min(0.95, 0.7+pdf_loss_reduction))); } + if (planet_forces[eFACTION.ORK]>=2) and (pdf<2000){ pdf=0;} + if (planet_forces[eFACTION.ORK]>=1) and (pdf<200){ pdf=0;} system.p_pdf[planet] = pdf; - }; + } + - static planet_info_screen = function() { - if (!instance_exists(obj_star_select)) { + static planet_info_screen = function(){ + if (!instance_exists(obj_star_select)){ exit; } - var improve=0 + var improve=0 var xx=15; var yy=25; var current_planet=planet; @@ -976,54 +961,51 @@ function PlanetData(planet, system) constructor { draw_set_halign(fa_center); draw_set_valign(fa_top); draw_set_font(fnt_40k_14); - + var _xenos_and_heretics = xenos_and_heretics(); - if ((current_owner <= 5) && (!_xenos_and_heretics)) { - if (planet_forces[eFACTION.PLAYER] > 0 || system.present_fleet[1] > 0) { - if (fortification_level < 5) { - improve = 1; - } + if (current_owner<=5) and (!_xenos_and_heretics){ + if (planet_forces[eFACTION.PLAYER]>0||system.present_fleet[1]>0){ + if (fortification_level<5) then improve=1; } } - + // Draw disposition here - var yyy = 0; + var yyy=0; var _succession = has_problem("succession"); - if ((player_disposition >= 0 && current_owner <= 5 && population > 0) && (_succession == 0)) { - var wack = 0; + if ((player_disposition>=0 && current_owner<=5 && population>0)) and (_succession=0){ + var wack=0; draw_set_color(c_blue); - draw_rectangle(xx + 349, yy + 175, xx + 349 + (min(100, player_disposition) * 3.68), yy + 192, 0); + draw_rectangle(xx+349,yy+175,xx+349+(min(100,player_disposition)*3.68),yy+192,0); } draw_set_color(c_gray); - draw_rectangle(xx + 349, yy + 175, xx + 717, yy + 192, 1); + draw_rectangle(xx+349,yy+175,xx+717,yy+192,1); draw_set_color(c_white); - if (!_succession) { - if ((player_disposition >= 0) && (origional_owner <= 5) && (current_owner <= 5) && (population > 0)) { - draw_text(xx + 534, yy + 176, "Disposition: " + string(min(100, player_disposition)) + "/100"); + + if (!_succession){ + if (player_disposition>=0) and (origional_owner<=5) and (current_owner<=5) and (population>0){ + draw_text(xx+534,yy+176,"Disposition: "+string(min(100,player_disposition))+"/100"); } - if ((player_disposition > -30) && (player_disposition < 0) && (current_owner <= 5) && (population > 0)) { - draw_text(xx + 534, yy + 176, "Disposition: ???/100"); + if (player_disposition>-30) and (player_disposition<0) and (current_owner<=5) and (population>0){ + draw_text(xx+534,yy+176,"Disposition: ???/100"); } - if (((player_disposition >= 0) && (origional_owner <= 5) && (current_owner > 5)) || (population <= 0)) { - draw_text(xx + 534, yy + 176, "-------------"); + if ((player_disposition>=0) and (origional_owner<=5) and (current_owner>5)) or (population<=0){ + draw_text(xx+534,yy+176,"-------------"); } - if (player_disposition <= -3000) { - draw_text(xx + 534, yy + 176, "Disposition: N/A"); - } - } else if (_succession) { - draw_text(xx + 534, yy + 176, "War of _Succession"); + if (player_disposition<=-3000) then draw_text(xx+534,yy+176,"Disposition: N/A"); + } else if (_succession){ + draw_text(xx+534,yy+176,"War of _Succession"); } draw_set_color(c_gray); // End draw disposition draw_set_color(c_gray); - draw_rectangle(xx + 349, yy + 193, xx + 717, yy + 210, 0); - var bar_width = 717 - 349; - var bar_start_point = xx + 349; - var bar_percent_length = bar_width / 100; + draw_rectangle(xx+349,yy+193,xx+717,yy+210,0); + var bar_width = 717-349; + var bar_start_point = xx+349; + var bar_percent_length = (bar_width/100); var current_bar_percent = 0; var _hidden_cult = false; if (has_feature(eP_FEATURES.GENE_STEALER_CULT)){ @@ -1036,16 +1018,16 @@ function PlanetData(planet, system) constructor { if (_hidden_cult && i == eFACTION.TYRANIDS){ draw_set_color(global.star_name_colors[eFACTION.IMPERIUM]); } - var current_start = bar_start_point + (current_bar_percent * bar_percent_length); - draw_rectangle(current_start, yy + 193, current_start + (bar_percent_length * population_influences[i]), yy + 210, 0); - current_bar_percent += population_influences[i]; + var current_start = bar_start_point+(current_bar_percent*bar_percent_length) + draw_rectangle(current_start,yy+193,current_start+(bar_percent_length*population_influences[i]),yy+210,0); + current_bar_percent+=population_influences[i]; } draw_set_color(c_gray); } - draw_set_color(c_white); - draw_text(xx + 534, yy + 194, "Population Influence"); - yy += 20; + draw_set_color(c_white); + draw_text(xx+534,yy+194,"Population Influence"); + yy+=20; draw_set_font(fnt_40k_14b); draw_set_halign(fa_left); if (!is_craftworld && !is_hulk){ @@ -1060,19 +1042,28 @@ function PlanetData(planet, system) constructor { // if (is_craftworld=1) then draw_text(xx+594,yy+214,"Craftworld"); // draw_sprite(spr_planet_splash,temp1,xx+349,yy+194); - scr_image("ui/planet", scr_planet_image_numbers(planet_type), xx + 349, yy + 194, 128, 128); - draw_rectangle(xx + 349, yy + 194, xx + 477, yy + 322, 1); + scr_image("ui/planet",scr_planet_image_numbers(planet_type),xx+349,yy+194,128,128); + draw_rectangle(xx+349,yy+194,xx+477,yy+322,1); draw_set_font(fnt_40k_14); - + var pop_string = $"Population: {display_population()}"; + var _button_manager = obj_star_select.button_manager; - _button_manager.update({label: pop_string, tooltip: "population data toggle with 'P'", keystroke: press_exclusive(ord("P")), x1: xx + 480, y1: yy + 217, w: 200, h: 22}); + _button_manager.update({ + label:pop_string, + tooltip : "population data toggle with 'P'", + keystroke : press_exclusive(ord("P")), + x1 : xx+480, + y1 : yy+217, + w : 200, + h : 22 + }); _button_manager.update_loc(); - if (_button_manager.draw()) { + if (_button_manager.draw()){ obj_star_select.population = !obj_star_select.population; - if (obj_star_select.population) { - obj_star_select.potential_donors = find_population_doners(system.id); + if (obj_star_select.population){ + obj_star_select.potential_donors = find_population_donors(system.id); } } @@ -1098,59 +1089,53 @@ function PlanetData(planet, system) constructor { if (!is_hulk){ if (improve){ draw_set_color(c_green); - draw_rectangle(xx + 481, yy + 280, xx + 716, yy + 298, 0); - draw_sprite(spr_requisition, 0, xx + 657, yy + 283); - - var improve_cost = 1500, yep = 0, o = 0; + draw_rectangle(xx+481,yy+280,xx+716,yy+298,0); + draw_sprite(spr_requisition,0,xx+657,yy+283); + + + var improve_cost=1500,yep=0,o=0; - if (scr_has_adv("Siege Masters")) { - improve_cost = 1100; + if (scr_has_adv("Siege Masters")){ + improve_cost=1100; } - - draw_text_glow(xx + 671, yy + 281, improve_cost, 16291875, 0); - - if (scr_hit(xx + 481, yy + 282, xx + 716, yy + 300)) { + + draw_text_glow(xx+671, yy+281,improve_cost,16291875,0); + + if (scr_hit(xx+481,yy+282,xx+716,yy+300)){ draw_set_color(0); draw_set_alpha(0.2); draw_rectangle(xx+481,yy+280,xx+716,yy+298,0); if (mouse_button_clicked() && obj_controller.requisition >= improve_cost){ obj_controller.requisition-=improve_cost; alter_fortification(1); - - if ((player_disposition > 0) && (player_disposition <= 100)) { - add_disposition(9 - fortification_level); + + if (player_disposition>0) and (player_disposition<=100){ + add_disposition(9-fortification_level); } } + } draw_set_alpha(1); draw_set_color(0); } - var forti_string = [ - "None", - "Sparse", - "Light", - "Moderate", - "Heavy", - "Major", - "Extreme" - ]; + var forti_string = ["None", "Sparse","Light","Moderate","Heavy","Major","Extreme"]; var planet_forti = $"Defenses: {forti_string[fortification_level]}"; - draw_text(xx + 480, yy + 280, planet_forti); + draw_text(xx+480,yy+280,planet_forti); } - + draw_set_color(c_gray); - - if (is_hulk == 1) { - temp5 = "Integrity: " + string(floor(fortification_level * 20)) + "%"; - draw_text(xx + 480, yy + 280, temp5); + + if (is_hulk=1){ + temp5="Integrity: "+string(floor(fortification_level*20))+"%"; + draw_text(xx+480,yy+280,temp5); } - - var temp6 = "???"; - var target_planet_heresy = corruption; + + var temp6="???"; + var target_planet_heresy=corruption; if (target_planet_heresy < 0) { - temp6 = "DEBUG: Heresy below 0!"; + temp6 = "DEBUG: Heresy below 0!" } else if (target_planet_heresy <= 10) { temp6 = "None"; } else if (target_planet_heresy <= 30) { @@ -1166,46 +1151,23 @@ function PlanetData(planet, system) constructor { } else if (target_planet_heresy > 100) { temp6 = "DEBUG: Heresy above 100!"; } else { - temp6 = "DEBUG: Heresy somehow unknown value!"; + temp6 = "DEBUG: Heresy somehow unknown value!" } - draw_text(xx + 480, yy + 300, $"Corruption: {temp6}"); - + draw_text(xx+480,yy+300,$"Corruption: {temp6}"); + + draw_set_font(fnt_40k_14b); - draw_text(xx + 349, yy + 326, "Planetary Presence"); - draw_text(xx + 535, yy + 326, "Planetary Features"); + draw_text(xx+349,yy+326,"Planetary Presence"); + draw_text(xx+535,yy+326,"Planetary Features"); draw_set_font(fnt_40k_14); - + + var presence_text = ""; - var faction_names = [ - "Adeptas", - "Orks", - "Tau", - "Tyranids", - "Chaos", - "Traitors", - "Daemons", - "Necrons" - ]; - var faction_ids = [ - "p_sisters", - "p_orks", - "p_tau", - "p_tyranids", - "p_traitors", - "p_chaos", - "p_demons", - "p_necrons" - ]; - var blurbs = [ - "Minima", - "Parvus", - "Moderatus", - "Significus", - "Enormicus", - "Extremis" - ]; - + var faction_names = ["Adeptas", "Orks", "Tau", "Tyranids", "Chaos", "Traitors", "Daemons", "Necrons"]; + var faction_ids = ["p_sisters", "p_orks", "p_tau", "p_tyranids", "p_traitors", "p_chaos", "p_demons", "p_necrons"]; + var blurbs = ["Minima", "Parvus", "Moderatus", "Significus", "Enormicus", "Extremis"]; + for (var t = 0; t < array_length(faction_names); t++) { var faction = faction_names[t]; var faction_id = faction_ids[t]; @@ -1228,7 +1190,10 @@ function PlanetData(planet, system) constructor { } } - draw_text(xx + 349, yy + 346, string_hash_to_newline(string(presence_text))); + draw_text(xx+349,yy+346,string_hash_to_newline(string(presence_text))); + + + var to_show=0,temp9="";t=-1; //TODO makeeverything below calculated once and OOP @@ -1240,10 +1205,16 @@ function PlanetData(planet, system) constructor { var size = ["", "Small", "", "Large"]; if ( feat_count > 0){ for (i =0; i < feat_count ;i++){ - cur_feature = features[i] - if (cur_feature.planet_display != 0){ - if (cur_feature.f_type == eP_FEATURES.GENE_STEALER_CULT){ - if (!cur_feature.hiding){ + var cur_feature = features[i]; + try { + if (cur_feature.planet_display != 0) { + if (cur_feature.f_type == eP_FEATURES.GENE_STEALER_CULT) { + if (!cur_feature.hiding) { + array_push(planet_displays, [cur_feature.planet_display, cur_feature]); + } + } else if (cur_feature.player_hidden == 1) { + array_push(planet_displays, ["????", ""]); + } else { array_push(planet_displays, [cur_feature.planet_display, cur_feature]); } if (cur_feature.f_type == eP_FEATURES.MONASTERY) { @@ -1253,34 +1224,32 @@ function PlanetData(planet, system) constructor { array_push(planet_displays, [size_string, forge]); } } - } + } } catch (_exception) { LOGGER.error(cur_feature); handle_exception(_exception); } } } - if (upgrade_count > 0) { - for (i = 0; i < upgrade_count; i++) { + if (upgrade_count>0){ + for (i =0; i < upgrade_count ;i++){ var _upgrade = upgrades[i]; - if (_upgrade.f_type == eP_FEATURES.SECRET_BASE) { - if (_upgrade.forge > 0) { + if (_upgrade.f_type == eP_FEATURES.SECRET_BASE){ + if (_upgrade.forge>0){ var forge = _upgrade.forge_data; - var size_string = $"{size[forge.size]} Chapter Forge"; + var size_string= $"{size[forge.size]} Chapter Forge" array_push(planet_displays, [size_string, forge]); } } } } - for (i = 0; i < array_length(problems); i++) { - if (problems[i] == "") { - continue; - } - var problem_data = problems_data[i]; - if (struct_exists(problem_data, "stage")) { - if (problem_data.stage == "preliminary") { - var mission_string = $"{problem_data.applicant} Audience"; + for (i=0;i 0) { - var current_planet = planet; + if (planet>0){ + var current_planet=planet; draw_set_color(c_black); draw_set_halign(fa_center); - + /*if (obj_controller.recruiting_worlds_bought>0) and (system.p_owner[planet]<=5) and (obj_controller.faction_status[system.p_owner[planet]]!="War"){ if (string_count("Recr",system.p_feature[planet])=0){ button4="+Recruiting"; } }*/ - + /*if (origional_owner=1){ if (mouse_x>=xx+363) and (mouse_y>=yy+194) and (mouse_x0){ @@ -1332,8 +1299,8 @@ function PlanetData(planet, system) constructor { } } }*/ - } - }; + } + } static draw_planet_population_controls = function(){ draw_set_color(c_gray); @@ -1349,7 +1316,7 @@ function PlanetData(planet, system) constructor { colonist_button.update({ x1:xx+35, y1:_half_way, - allow_click : array_length(potential_doners), + allow_click : array_length(potential_donors), }); colonist_button.draw(); @@ -1397,10 +1364,10 @@ function PlanetData(planet, system) constructor { } } - static suffer_navy_bombard = function(strength){ + static suffer_navy_bombard = function(strength){ - var kill = 0; + var kill = 0; // Eh heh heh if (planet_forces[eFACTION.TYRANIDS]>0){ strength = strength>2 ? 2 : 0; @@ -1408,41 +1375,37 @@ function PlanetData(planet, system) constructor { } else if (planet_forces[eFACTION.ORK]>0){ if (strength>2) then strength=2; - if (strength<1) then strength=0; + if (strength<1) then strength=0; system.p_orks[planet]-=2; } else if (current_owner=eFACTION.TAU) and (planet_forces[eFACTION.TAU]>0){ strength = strength>2 ? 2 : 0; system.p_tau[planet]-=2; - - kill = large_population ? strength*0.15 : strength*15000000 + + kill = large_population ? strength*0.15 : strength*15000000 } else if (current_owner=8) and (pdf>0){ edit_pdf(-strength*(irandom_range(49, 51) * 100000)); - - kill = large_population ? strength*0.15 : strength*15000000 + + kill = large_population ? strength*0.15 : strength*15000000 } else if (current_owner=10){ - kill = large_population ? strength * 0.15 : strength * 15000000; - } else if (current_owner == 10) { - strength = strength > 2 ? 2 : 0; - - if (system.p_chaos[planet] > 0) { - system.p_chaos[planet] = max(0, system.p_traitors[planet] - 1); - } else if (system.p_traitors[planet] > 0) { - system.p_traitors[planet] = max(0, system.p_traitors[planet] - 2); + strength = strength>2 ? 2 : 0; + + if (system.p_chaos[planet]>0){ + system.p_chaos[planet]=max(0,system.p_traitors[planet]-1); + } else if (system.p_traitors[planet]>0){ + system.p_traitors[planet]=max(0,system.p_traitors[planet]-2); } kill = strength * population_small_conversion(0.15); - if (system.p_heresy[planet] > 0) { - system.p_heresy[planet] = max(0, system.p_heresy[planet] - 5); - } + if (system.p_heresy[planet]>0) then system.p_heresy[planet]=max(0,system.p_heresy[planet]-5); } var _pop_percentage_kill = population > 0 ? (kill / population) * 100 : 0; - edit_population(kill*-1); + edit_population(kill*-1); if (population_influences[eFACTION.TYRANIDS] > 3){ var _max_influence_reduction = min(_pop_percentage_kill,population_influences[eFACTION.TYRANIDS]-3); @@ -1457,45 +1420,46 @@ function PlanetData(planet, system) constructor { if (population + pdf<=0) and (current_owner=1) and (obj_controller.faction_status[eFACTION.IMPERIUM]="War"){ if (!has_feature(eP_FEATURES.MONASTERY)){ set_new_owner(eFACTION.IMPERIUM); - add_disposition(-50); + add_disposition(-50); } - } - }; + } + } - static create_planet_garrison = function() { + static create_planet_garrison = function(){ var company_data = obj_controller.company_data; var squad_index = company_data.company_squads[company_data.cur_squad]; - var current_squad = obj_ini.squads[squad_index]; - current_squad.set_location(system.name, 0, planet); + var current_squad=obj_ini.squads[squad_index]; + current_squad.set_location(system.name,0,planet); var _mission = obj_star_select.mission; - current_squad.assignment = { - type: _mission, - location: system.name, - ident: planet, + current_squad.assignment={ + type:_mission, + location:system.name, + ident:planet, }; var operation_data = { - type: "squad", - reference: squad_index, - job: _mission, - task_time: 0, + type:"squad", + reference:squad_index, + job:_mission, + task_time : 0 }; add_operatives(operation_data); system.garrisons = true; //if there was an outstanding mission to provide the given garrisons var garrison_request = find_problem("provide_garrison"); - if (garrison_request > -1) { + if (garrison_request>-1){ init_garrison_mission(planet, system, garrison_request); } instance_destroy(obj_star_select); - }; + } + - static planet_selection_logic = function() { + static planet_selection_logic = function(){ var planet_is_allies = scr_is_planet_owned_by_allies(system, planet); - var garrison_issue = !planet_is_allies || pdf <= 0; - var _mission = variable_instance_exists(obj_star_select, "mission") ? obj_star_select.mission : ""; + var garrison_issue = (!planet_is_allies || pdf<=0); + var _mission = variable_instance_exists(obj_star_select,"mission") ? obj_star_select.mission : ""; - var _loading = obj_star_select.loading; + var _loading = obj_star_select.loading; var garrison_assignment = obj_controller.view_squad && _loading; if (garrison_assignment && (garrison_issue && _mission=="garrisons")){ planet_draw = c_red; @@ -1514,24 +1478,29 @@ function PlanetData(planet, system) constructor { buttons_selected=false; } else if (_loading && planet >0){ + obj_controller.unload=planet; + obj_controller.return_object=system; + obj_controller.return_size=obj_controller.man_size; + edit_player_forces(obj_controller.man_size) + // 135 ; SPECIAL PLANET CRAP HERE - + // Recon Stuff - if (has_problem("recon")) { - var arti = instance_create(system.x, system.y, obj_temp7); // Unloading / artifact crap + if (has_problem("recon")){ + var arti=instance_create(system.x,system.y,obj_temp7);// Unloading / artifact crap - arti.num = planet; - arti.alarm[0] = 1; - arti.loc = obj_controller.selecting_location; - arti.managing = obj_controller.managing; - arti.type = "recon"; + arti.num=planet; + arti.alarm[0]=1; + arti.loc=obj_controller.selecting_location; + arti.managing=obj_controller.managing; + arti.type="recon"; - with (arti) { - setup_planet_mission_group(); + with (arti){ + setup_planet_mission_group() } } - if (!instance_exists(obj_ground_mission)) { + if (!instance_exists(obj_ground_mission)){ check_for_artifact_grab_mission(); check_for_stc_grab_mission(); scr_check_for_ruins_exploration(); @@ -1541,7 +1510,7 @@ function PlanetData(planet, system) constructor { } } - }; + } static end_of_turn_population_influence_and_enemy_growth = function(){ @@ -1704,10 +1673,10 @@ function PlanetData(planet, system) constructor { } - }; + } - static end_turn_genestealer_cults = function(){ + static end_turn_genestealer_cults = function(){ // Genestealer cults grow in number if (has_feature(eP_FEATURES.GENE_STEALER_CULT)) { var cult = get_features(eP_FEATURES.GENE_STEALER_CULT)[0]; @@ -1761,7 +1730,7 @@ function PlanetData(planet, system) constructor { add_feature(eP_FEATURES.GENE_STEALER_CULT); } } - }; + } static end_turn_heretics_and_corruption_growth = function(){ // traitors cults @@ -1912,7 +1881,7 @@ function PlanetData(planet, system) constructor { } // End traitors cult } - }; + } static check_old_battles_feature = function(){ if (has_feature(eP_FEATURES.OLDBATTLEGROUND)){ @@ -1948,13 +1917,13 @@ function PlanetData(planet, system) constructor { set_movement(true,"move",); } - scr_popup("Mechanicus Exploration", $"A Mechanicus Exploration fleet has set off from {_star.name} to explore the battle grounds of {name()}. It will arrive in aproximatly {_time} months time","mechanicus"); + scr_popup("Mechanicus Exploration", $"A Mechanicus Exploration fleet has set off from {_star.name} to explore the battle grounds of {name()}. It will arrive in aproximatly {_time} months time"); } } } } - }; + } static purge = scr_purge_world; @@ -1985,9 +1954,9 @@ function PlanetData(planet, system) constructor { // if (action_score > 200) { siz_penalty = 125; } var spec1=0,spec2=0,txt=""; // TODO consider making it a battle with Planetary governor's guards - txt=$"Your Astartes descend upon the surface of {name()} and plot the movements and schedule of the governor. "; + txt="Your Astartes descend upon the surface of {name()} and plot the movements and schedule of the governor. "; txt+="Once the time is right their target is ambushed " - txt+=choose("in their home","in the streets","while driving","taking a piss") + " and tranquilized. "; + txt+="choose("in their home","in the streets","while driving","taking a piss")+" and tranquilized. "; if(scr_has_disadv("Never Forgive")) then spec1=1; if (global.chapter_name="Space Wolves" || obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { @@ -2053,6 +2022,12 @@ function PlanetData(planet, system) constructor { if (planet_forces[eFACTION.ORK]>=4) or (planet_forces[eFACTION.NECRONS]>=3) or (planet_forces[eFACTION.TYRANIDS]>=5){ pip.estimate=pip.estimate*0.5; } - }; + } + } + + + + + diff --git a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml index 551a2faeda..32d8e5c113 100644 --- a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml +++ b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml @@ -443,11 +443,11 @@ function scr_enemy_ai_d() { if (!already_enroute) { var pop_doner_options = []; //this stops needless repeats of searches - if (!struct_exists(obj_controller.end_turn_insights, "population_doners")) { - pop_doner_options = find_population_doners(); + if (!struct_exists(obj_controller.end_turn_insights, "population_donors")) { + pop_doner_options = find_population_donors(); } - obj_controller.end_turn_insights.population_doners = pop_doner_options; - pop_doner_options = obj_controller.end_turn_insights.population_doners; + obj_controller.end_turn_insights.population_donors = pop_doner_options; + pop_doner_options = obj_controller.end_turn_insights.population_donors; var deletion = -1; for (var i = 0; i < array_length(pop_doner_options); i++) { diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index 477dc18230..e5d07d3e9c 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -373,7 +373,7 @@ function nearest_star_with_ownership(xx,yy, ownership, start_star="none", ignore return nearest; } -function find_population_doners(doner_to = 0) { +function find_population_donors(doner_to = 0) { var pop_doner_options = []; with (obj_star) { if (obj_star.id == doner_to) { From 7143267bf01d2cea6c03293183d48172fda5a581 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 13:43:06 +0100 Subject: [PATCH 63/93] niggles --- scripts/scr_PlanetData/scr_PlanetData.gml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index c55d1e2c54..7e3a062222 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -99,11 +99,20 @@ function PlanetData(planet, system) constructor{ garrisons = system.system_garrison[planet]; sabatours = system.system_sabatours[planet]; system.system_datas[planet] = self; + + // current planet heresy + if (population == 0) { + system.p_heresy[planet] = 0; + system.p_heresy_secret[planet] = 0; + for (var i = 0; i < array_length(system.p_influence[planet]); ++i) { + system.p_influence[planet][i] = 0; + } + } } refresh_data(); - static total_corruption(){ + static total_corruption = function(){ return secret_corruption + corruption; } @@ -556,15 +565,6 @@ function PlanetData(planet, system) constructor{ } - // current planet heresy - if (population == 0) { - system.p_heresy[planet] = 0; - system.p_heresy_secret[planet] = 0; - for (var i = 0; i < array_length(system.p_influence[planet]); ++i) { - system.p_influence[planet][i] = 0; - } - } - static alter_corruption = function(value){ alter_planet_corruption(value, planet, system); corruption = system.p_heresy[planet]; @@ -1956,7 +1956,7 @@ function PlanetData(planet, system) constructor{ var spec1=0,spec2=0,txt=""; // TODO consider making it a battle with Planetary governor's guards txt="Your Astartes descend upon the surface of {name()} and plot the movements and schedule of the governor. "; txt+="Once the time is right their target is ambushed " - txt+="choose("in their home","in the streets","while driving","taking a piss")+" and tranquilized. "; + txt+=choose("in their home","in the streets","while driving","taking a piss")+" and tranquilized. "; if(scr_has_disadv("Never Forgive")) then spec1=1; if (global.chapter_name="Space Wolves" || obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { From 9437c654428eeeadde0bfc48a5910f2f0eae2bf6 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 13:46:01 +0100 Subject: [PATCH 64/93] final file now --- objects/obj_ncombat/Alarm_1.gml | 146 +++++++++++++++++++------------- 1 file changed, 85 insertions(+), 61 deletions(-) diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index a539a586d4..62d194cebb 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -1,13 +1,11 @@ var a1; a1 = ""; -var a1;a1=""; -var _roles = active_roles(); - - -if (ally>0) and (ally_forces>0){ - if (ally=3){ - if (ally_forces>=1) then a1="Joining your forces are 10 Techpriests and 20 Skitarii. Omnissian Power Axes come to life, crackling and popping with disruptive energy, and Conversion Beam Projectors are levelled to fire. The Tech-Guard are silent as they form a perimeter around their charges, at contrast with their loud litanies and Lingua-technis bursts."; +if ((ally > 0) && (ally_forces > 0)) { + if (ally == 3) { + if (ally_forces >= 1) { + a1 = "Joining your forces are 10 Techpriests and 20 Skitarii. Omnissian Power Axes come to life, crackling and popping with disruptive energy, and Conversion Beam Projectors are levelled to fire. The Tech-Guard are silent as they form a perimeter around their charges, at contrast with their loud litanies and Lingua-technis bursts."; + } } } @@ -182,30 +180,41 @@ if (string_count("_attack", battle_special) > 0) { exit; } - - - - - -if (tacticals>0) and (veterans>0){ - p2=string(tacticals+veterans)+" "+string(_roles[8])+"s, "; +if ((tacticals > 0) && (veterans > 0)) { + p2 = string(tacticals + veterans) + " " + string(obj_ini.role[100][8]) + "s, "; } -if (tacticals>0) and (veterans=0){ - if (tacticals=1) then p2=string(tacticals)+" "+string(_roles[8])+", "; - if (tacticals>1) then p2=string(tacticals)+" "+string(_roles[8])+"s, "; +if ((tacticals > 0) && (veterans == 0)) { + if (tacticals == 1) { + p2 = string(tacticals) + " " + string(obj_ini.role[100][8]) + ", "; + } + if (tacticals > 1) { + p2 = string(tacticals) + " " + string(obj_ini.role[100][8]) + "s, "; + } } -if (tacticals=0) and (veterans>0){ - if (veterans=1) then p2=string(veterans)+" "+string(_roles[3])+", "; - if (veterans>1) then p2=string(veterans)+" "+string(_roles[3])+"s, "; +if ((tacticals == 0) && (veterans > 0)) { + if (veterans == 1) { + p2 = string(veterans) + " " + string(obj_ini.role[100][3]) + ", "; + } + if (veterans > 1) { + p2 = string(veterans) + " " + string(obj_ini.role[100][3]) + "s, "; + } } -if (assaults>0){ - if (assaults=1) then p2+=string(assaults)+" "+string(_roles[10])+", "; - if (assaults>1) then p2+=string(assaults)+" "+string(_roles[10])+"s, "; +if (assaults > 0) { + if (assaults == 1) { + p2 += string(assaults) + " " + string(obj_ini.role[100][10]) + ", "; + } + if (assaults > 1) { + p2 += string(assaults) + " " + string(obj_ini.role[100][10]) + "s, "; + } } -if (devastators>0){ - if (devastators=1) then p2+=string(devastators)+" "+string(_roles[9])+", "; - if (devastators>1) then p2+=string(devastators)+" "+string(_roles[9])+"s, "; +if (devastators > 0) { + if (devastators == 1) { + p2 += string(devastators) + " " + string(obj_ini.role[100][9]) + ", "; + } + if (devastators > 1) { + p2 += string(devastators) + " " + string(obj_ini.role[100][9]) + "s, "; + } } if ((temp < 200) && (terminators > 0)) { @@ -217,38 +226,65 @@ if ((temp < 200) && (terminators > 0)) { } } -if (temp<200) and (chaplains>0){ - if (chaplains=1) then p2+=string(chaplains)+" "+string(_roles[14])+", "; - if (chaplains>1) then p2+=string(chaplains)+" "+string(_roles[14])+", "; +if ((temp < 200) && (chaplains > 0)) { + if (chaplains == 1) { + p2 += string(chaplains) + " " + string(obj_ini.role[100][14]) + ", "; + } + if (chaplains > 1) { + p2 += string(chaplains) + " " + string(obj_ini.role[100][14]) + ", "; + } } -if (temp<200) and (apothecaries>0){ - if (apothecaries=1) then p2+=string(apothecaries)+" "+string(_roles[15])+", "; - if (apothecaries>1) then p2+=string(apothecaries)+" "+string(_roles[15])+", "; +if ((temp < 200) && (apothecaries > 0)) { + if (apothecaries == 1) { + p2 += string(apothecaries) + " " + string(obj_ini.role[100][15]) + ", "; + } + if (apothecaries > 1) { + p2 += string(apothecaries) + " " + string(obj_ini.role[100][15]) + ", "; + } } -if (temp<200) and (librarians>0){ - if (librarians=1) then p2+=string(librarians)+" "+string(_roles[17])+", "; - if (librarians>1) then p2+=string(librarians)+" "+string(_roles[17])+", "; +if ((temp < 200) && (librarians > 0)) { + if (librarians == 1) { + p2 += string(librarians) + " " + string(obj_ini.role[100][17]) + ", "; + } + if (librarians > 1) { + p2 += string(librarians) + " " + string(obj_ini.role[100][17]) + ", "; + } } -if (temp<200) and (techmarines>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(_roles[16])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(_roles[16])+", "; +if ((temp < 200) && (techmarines > 0)) { + if (techmarines == 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][16]) + ", "; + } + if (techmarines > 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][16]) + ", "; + } } -if (temp<200) and (sgts>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(_roles[18])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(_roles[18])+", "; +if ((temp < 200) && (sgts > 0)) { + if (techmarines == 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][18]) + ", "; + } + if (techmarines > 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][18]) + ", "; + } } -if (temp<200) and (vet_sgts>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(_roles[19])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(_roles[19])+", "; +if ((temp < 200) && (vet_sgts > 0)) { + if (techmarines == 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][19]) + ", "; + } + if (techmarines > 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][19]) + ", "; + } } - -if (scouts>0){ - if (scouts=1) then p2+=string(scouts)+" "+string(_roles[12])+", "; - if (scouts>1) then p2+=string(scouts)+" "+string(_roles[12])+"s, "; +if (scouts > 0) { + if (scouts == 1) { + p2 += string(scouts) + " " + string(obj_ini.role[100][12]) + ", "; + } + if (scouts > 1) { + p2 += string(scouts) + " " + string(obj_ini.role[100][12]) + "s, "; + } } // temp5=string_length(p2);p2=string_delete(p2,temp5-1,2);// p2+="."; @@ -337,19 +373,7 @@ if (dreadnoughts + predators + land_raiders > 3) { p6 += string(whirlwinds) + " Whirlwinds, "; } -if (dreadnoughts+predators+land_raiders>3){ - p6=" Forming up the armoured division is "; - if (dreadnoughts=1) then p6+=string(dreadnoughts)+" "+string(_roles[6])+", "; - if (dreadnoughts>1) then p6+=string(dreadnoughts)+" "+string(_roles[6])+"s, "; - - if (rhinos=1) then p6+=string(rhinos)+" Rhino, "; - if (rhinos>1) then p6+=string(rhinos)+" Rhinos, "; - - if (predators=1) then p6+=string(predators)+" Predator, "; - if (predators>1) then p6+=string(predators)+" Predators, "; - - if (land_raiders=1) then p6+=string(land_raiders)+" Land Raider, "; - if (land_raiders>1) then p6+=string(land_raiders)+" Land Raiders, "; + // Other vehicles here? var woo; woo = string_length(p6); From 2a72168c666878570fcd43ef02dd585518e5ac3a Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 13:49:55 +0100 Subject: [PATCH 65/93] may this be the end of this madness --- objects/obj_star_select/Draw_64.gml | 367 ++++++++++++---------- scripts/scr_PlanetData/scr_PlanetData.gml | 9 +- 2 files changed, 202 insertions(+), 174 deletions(-) diff --git a/objects/obj_star_select/Draw_64.gml b/objects/obj_star_select/Draw_64.gml index 30d5a5f7c4..3edf527066 100644 --- a/objects/obj_star_select/Draw_64.gml +++ b/objects/obj_star_select/Draw_64.gml @@ -1,17 +1,14 @@ -if (instances_exist_any([obj_bomb_select, obj_drop_select, obj_popup])) { - exit; -} -if (obj_controller.zoomed == 1) { - exit; -} -if (!instance_exists(target)) { - exit; -} -if (obj_controller.menu == 60) { + + +if (instances_exist_any([obj_bomb_select, obj_drop_select, obj_popup])){ exit; } +if (obj_controller.zoomed=1) then exit; +if (!instance_exists(target)) then exit; +if (obj_controller.menu=60) then exit; + add_draw_return_values(); draw_set_font(fnt_40k_14b); draw_set_halign(fa_center); @@ -36,67 +33,61 @@ if (loading=1){ button3=""; button4=""; - obj_controller.selecting_planet = 0; - button1 = ""; - button2 = ""; - button3 = ""; - button4 = ""; - - if (instance_exists(target)) { - if (target.space_hulk == 1) { + if (instance_exists(target)){ + if (target.space_hulk==1){ pop_draw_return_values(); exit; } } } -if (obj_controller.selecting_planet > target.planets) { +if (obj_controller.selecting_planet>target.planets){ obj_controller.selecting_planet = 0; } -var click_accepted = (!obj_controller.menu) && (!obj_controller.zoomed) && (!instance_exists(obj_bomb_select)) && (!instance_exists(obj_drop_select)); +var click_accepted = (!obj_controller.menu) and (!obj_controller.zoomed) and (!instance_exists(obj_bomb_select)) and (!instance_exists(obj_drop_select)); if (click_accepted && (!debug || !debug_slate.entered())) { - if (mouse_button_clicked(, 0)) { - var closes = 0, sta1 = 0, sta2 = 0; + if (mouse_button_clicked(, 0)){ + var closes=0,sta1=0,sta2=0; var mouse_consts = return_mouse_consts(); - sta1 = instance_nearest(mouse_consts[0], mouse_consts[1], obj_star); - sta2 = point_distance(mouse_consts[0], mouse_consts[1], sta1.x, sta1.y); - closes = true; - if (sta2 > 15) { - if (scr_hit(27, 165, 300, 165 + 294)) { - closes = false; - } else if (obj_controller.selecting_planet > 0) { + sta1=instance_nearest(mouse_consts[0],mouse_consts[1],obj_star); + sta2=point_distance(mouse_consts[0],mouse_consts[1],sta1.x,sta1.y); + closes=true; + if (sta2>15){ + if (scr_hit( + 27, + 165, + 300, + 165+294) + ){ + closes=false + } else if (obj_controller.selecting_planet>0){ closes = !main_data_slate.entered(); - if (closes) { - if (is_struct(garrison) || population) { - closes = !garrison_data_slate.entered(); + if (closes){ + if (is_struct(garrison) || population){ + closes = !garrison_data_slate.entered(); } } - - if (!is_string(feature)) { - if (feature.main_slate.entered()) { - closes = false; + + if (!is_string(feature)){ + if (feature.main_slate.entered()){ + closes=false; } } } var shutter_button; - var shutters = [ - shutter_1, - shutter_2, - shutter_3, - shutter_4 - ]; - for (var i = 0; i < 4; i++) { + var shutters = [shutter_1, shutter_2, shutter_3, shutter_4]; + for (var i=0; i<4;i++){ shutter_button = shutters[i]; - if (shutter_button.hit()) { - closes = false; + if (shutter_button.hit()){ + closes=false; break; } } - if (closes) { - cooldown = 0; - obj_controller.sel_system_x = 0; - obj_controller.sel_system_y = 0; - obj_controller.selecting_planet = 0; - obj_controller.popup = 0; + if (closes){ + cooldown=0; + obj_controller.sel_system_x=0; + obj_controller.sel_system_y=0; + obj_controller.selecting_planet=0; + obj_controller.popup=0; instance_destroy(); } } @@ -129,21 +120,31 @@ draw_set_color(target.owner == eFACTION.PLAYER ? c_blue : 0); if (_standard_star){ draw_text_transformed(184,180,system_string,1,1,0); draw_set_color(global.star_name_colors[target.owner]); - draw_text_transformed(184, 180, system_string, 1, 1, 0); + draw_text_transformed(184,180,system_string,1,1,0); } -if (global.cheat_debug && obj_controller.selecting_planet && !loading) { + +if (global.cheat_debug && obj_controller.selecting_planet && !loading){ draw_planet_debug_options(); } -if (obj_controller.menu == 0 && !debug) { - if (manage_units_button.draw(has_player_forces)) { - var _viewer = obj_controller.location_viewer; + +if (obj_controller.menu == 0 && !debug){ + if (manage_units_button.draw(has_player_forces)){ + var _viewer = obj_controller.location_viewer _viewer.update_garrison_log(); var _unit_dispersement = _viewer.garrison_log; var _sys_name = target.name; - if (struct_exists(_unit_dispersement, target.name)) { - group_selection(_unit_dispersement[$ _sys_name].units, {purpose: $"{target.name} Management", purpose_code: "manage", number: 0, system: target.id, feature: "none", planet: 0, selections: []}); + if (struct_exists(_unit_dispersement, target.name)){ + group_selection(_unit_dispersement[$ _sys_name].units,{ + purpose:$"{target.name} Management", + purpose_code : "manage", + number:0, + system:target.id, + feature:"none", + planet : 0, + selections : [] + }); instance_destroy(); pop_draw_return_values(); exit; @@ -151,15 +152,17 @@ if (obj_controller.menu == 0 && !debug) { } } -if (loading != 0) { + +if (loading!=0){ draw_set_font(fnt_40k_14); draw_set_color(CM_GREEN_COLOR); draw_text(184,202, "Select Destination"); } + //the draw and click on planets logic -if (!debug) { +if (!debug){ planet_selection_action(); } @@ -170,12 +173,12 @@ if (obj_controller.selecting_planet!=0){ p_data = new PlanetData(obj_controller.selecting_planet, target); target.system_datas[obj_controller.selecting_planet] = p_data; } - // Buttons that are available - if (!buttons_selected) { - if ((obj_controller.faction_status[eFACTION.IMPERIUM] != "War" && p_data.current_owner > 5) || (obj_controller.faction_status[eFACTION.IMPERIUM] == "War" && p_data.at_war(0, 1, 1) && p_data.player_disposition <= 50)) { - var is_enemy = true; +// Buttons that are available + if (!buttons_selected){ + if (obj_controller.faction_status[eFACTION.IMPERIUM] != "War" && p_data.current_owner > 5) || (obj_controller.faction_status[eFACTION.IMPERIUM] == "War" && p_data.at_war(0, 1, 1) && p_data.player_disposition <= 50) { + var is_enemy=true; } else { - var is_enemy = false; + var is_enemy=false; } if (p_data.planet>0){ @@ -189,15 +192,11 @@ if (obj_controller.selecting_planet!=0){ } } } - if (target.present_fleet[1] > 0) /* and (target.p_type[obj_controller.selecting_planet]!="Dead")*/ { + if (target.present_fleet[1]>0)/* and (target.p_type[obj_controller.selecting_planet]!="Dead")*/{ if (is_enemy) { - button1 = "Attack"; - button2 = "Raid"; - button3 = "Bombard"; - } else { - button1 = "Attack"; - button2 = "Raid"; - button3 = "Purge"; + button1="Attack"; + button2="Raid"; + button3="Bombard"; } else { button1="Attack"; @@ -213,58 +212,60 @@ if (obj_controller.selecting_planet!=0){ if (pfleet.capital_number+pfleet.frigate_number>0) and (button4="") then button4="Cyclonic Torpedo"; } } + } } var planet_upgrades = target.p_upgrades[obj_controller.selecting_planet]; - if (((p_data.planet_type == "Dead") || (array_length(p_data.upgrades) > 0)) && ((target.present_fleet[1] > 0) || (target.p_player[obj_controller.selecting_planet] > 0))) { - if ((array_length(p_data.features) == 0) || (array_length(planet_upgrades) > 0)) { + if (((p_data.planet_type=="Dead") or (array_length(p_data.upgrades)>0)) and ((target.present_fleet[1]>0) or (target.p_player[obj_controller.selecting_planet]>0))){ + if (array_length(p_data.features)==0) or (array_length(planet_upgrades)>0){ + chock = !p_data.xenos_and_heretics(); - if (chock == 1) { - if (p_data.has_upgrade(eP_FEATURES.SECRET_BASE)) { - button1 = "Base"; - } else if (p_data.has_upgrade(eP_FEATURES.ARSENAL)) { - button1 = "Arsenal"; - } else if (p_data.has_upgrade(eP_FEATURES.GENE_VAULT)) { - button1 = "Gene-Vault"; - } else if (array_length(p_data.upgrades) == 0) { - button1 = "Build"; + if (chock==1){ + if (p_data.has_upgrade(eP_FEATURES.SECRET_BASE)){ + button1="Base"; + }else if (p_data.has_upgrade(eP_FEATURES.ARSENAL)){ + button1="Arsenal"; + }else if (p_data.has_upgrade(eP_FEATURES.GENE_VAULT)){ + button1="Gene-Vault"; + }else if (array_length(p_data.upgrades)==0){ + button1="Build"; } - if (array_contains(["Build", "Gene-Vault", "Arsenal", "Base"], button1)) { - button2 = ""; - button3 = ""; - button4 = ""; - button5 = ""; + if (array_contains(["Build","Gene-Vault","Arsenal","Base"],button1)){ + button2=""; + button3=""; + button4=""; + button5=""; } } } } - - if (obj_controller.recruiting_worlds_bought > 0 && !p_data.at_war()) { - if (!p_data.has_feature(eP_FEATURES.RECRUITING_WORLD) && p_data.planet_type != "Dead" && !target.space_hulk) { - button4 = "+Recruiting"; + + if (obj_controller.recruiting_worlds_bought>0 && !p_data.at_war()){ + if (!p_data.has_feature(eP_FEATURES.RECRUITING_WORLD) && p_data.planet_type != "Dead" && !target.space_hulk){ + button4="+Recruiting"; } } - if (target.space_hulk) { - if (target.present_fleet[1] > 0) { - button1 = "Raid"; - button2 = "Bombard"; - button3 = ""; - button4 = ""; + if (target.space_hulk){ + if (target.present_fleet[1]>0){ + button1="Raid"; + button2="Bombard"; + button3=""; + button4=""; } } - buttons_selected = true; + buttons_selected=true; } - main_data_slate.inside_method = function() { + main_data_slate.inside_method = function(){ p_data.planet_info_screen(); - }; - var slate_draw_scale = 420 / 850; - if (feature != "") { - if (is_struct(feature)) { - feature.draw_planet_features(344 + main_data_slate.width - 4, 165); - if (feature.remove) { - feature = ""; - } else if (feature.destroy) { + } + var slate_draw_scale = 420/850; + if (feature!=""){ + if (is_struct(feature)){ + feature.draw_planet_features(344+main_data_slate.width-4,165) + if (feature.remove){ + feature=""; + }else if (feature.destroy){ feature = ""; instance_destroy(); pop_draw_return_values(); @@ -274,40 +275,41 @@ if (obj_controller.selecting_planet!=0){ }else if (garrison!="" && !population){ if (garrison.garrison_force){ draw_set_font(fnt_40k_14); - if (!garrison.garrison_leader) { - garrison.find_leader(); + if (!garrison.garrison_leader){ + garrison.find_leader() garrison.garrison_disposition_change(target, obj_controller.selecting_planet, true); - garrison_data_slate.sub_title = $"Garrison Leader {garrison.garrison_leader.name_role()}"; + garrison_data_slate.sub_title = $"Garrison Leader {garrison.garrison_leader.name_role()}" garrison_data_slate.body_text = garrison.garrison_report(); } - garrison_data_slate.inside_method = function() { - garrison_data_slate.title = "Garrison Report"; + garrison_data_slate.inside_method=function(){ + garrison_data_slate.title = "Garrison Report" draw_set_color(c_gray); var xx = garrison_data_slate.XX; var yy = garrison_data_slate.YY; var cur_planet = obj_controller.selecting_planet; - var half_way = yy + garrison_data_slate.height / 2; + var half_way = yy+garrison_data_slate.height/2; draw_set_halign(fa_left); - draw_line(xx + 10, half_way, garrison_data_slate.width - 10, half_way); - var defence_data = determine_pdf_defence(target.p_pdf[cur_planet], garrison, target.p_fortified[cur_planet]); + draw_line(xx+10, half_way, garrison_data_slate.width-10, half_way); + var defence_data = determine_pdf_defence(target.p_pdf[cur_planet], garrison,target.p_fortified[cur_planet]); var defence_string = $"Planetary Defence : {defence_data[0]}"; - draw_text(xx + 20, half_way, defence_string); - if (scr_hit(xx + 20, half_way + 10, xx + 20 + string_width(defence_string), half_way + 10 + 20)) { + draw_text(xx+20, half_way, defence_string); + if (scr_hit(xx+20, half_way+10, xx+20+string_width(defence_string), half_way+10+20)){ tooltip_draw(defence_data[1], 400); } - if (garrison.dispo_change != "none") { - if (garrison.dispo_change > 55) { - draw_text(xx + 20, half_way + 30, $"Garrison Disposition Effect : Positive"); - } else if (garrison.dispo_change > 44) { - draw_text(xx + 20, half_way + 30, $"Garrison Disposition Effect : Neutral"); - } else { - draw_text(xx + 20, half_way + 30, $"Garrison Disposition Effect : Negative"); + if (garrison.dispo_change!="none"){ + if (garrison.dispo_change>55){ + draw_text(xx+20, half_way+30, $"Garrison Disposition Effect : Positive"); + } else if (garrison.dispo_change>44){ + draw_text(xx+20, half_way+30, $"Garrison Disposition Effect : Neutral"); + } else{ + draw_text(xx+20, half_way+30, $"Garrison Disposition Effect : Negative"); } } - }; - garrison_data_slate.draw(340 + main_data_slate.width, 160, 0.6, 0.6); - } - } else if (population) { + } + garrison_data_slate.draw(340+main_data_slate.width, 160, 0.6, 0.6); + + } + } else if (population){ garrison_data_slate.title = "Population Report"; garrison_data_slate.inside_method = function(){ p_data.draw_planet_population_controls(); @@ -317,8 +319,14 @@ if (obj_controller.selecting_planet!=0){ if (obj_controller.selecting_planet>0){ main_data_slate.draw(344,160, slate_draw_scale, slate_draw_scale+0.1); } - if (obj_controller.selecting_planet > 0) { - main_data_slate.draw(344, 160, slate_draw_scale, slate_draw_scale + 0.1); + var current_button=""; + var shutter_x = main_data_slate.XX-165; + var shutter_y = 296+165; + if (!debug){ + if (shutter_1.draw_shutter(shutter_x, shutter_y, button1, 0.5, true)) then current_button=button1; + if (shutter_2.draw_shutter(shutter_x, shutter_y+47, button2,0.5, true))then current_button=button2; + if (shutter_3.draw_shutter(shutter_x, shutter_y+(47*2), button3,0.5, true))then current_button=button3; + if (shutter_4.draw_shutter(shutter_x, shutter_y+(47*3), button4,0.5, true))then current_button=button4; } if (current_button!=""){ if (array_contains(["Build","Base","Arsenal","Gene-Vault"],current_button)){ @@ -333,43 +341,60 @@ if (obj_controller.selecting_planet!=0){ with(obj_star_select){ instance_destroy(); } - } else if (current_button == "Raid" && instance_nearest(x, y, obj_p_fleet).acted <= 1) { - instance_create_layer(x, y, layer_get_all()[0], obj_drop_select, {p_target: target, planet_number: obj_controller.selecting_planet, sh_target: instance_nearest(x, y, obj_p_fleet), purge: 0}); - } else if (current_button == "Attack") { + }else if (current_button=="Raid" && instance_nearest(x,y,obj_p_fleet).acted<=1){ + instance_create_layer(x, y, layer_get_all()[0], obj_drop_select,{ + p_target:target, + planet_number : obj_controller.selecting_planet, + sh_target:instance_nearest(x,y,obj_p_fleet), + purge:0, + }); + + }else if (current_button=="Attack"){ var _allow_attack = true; - var _targ = !target.present_fleet[1] ? -50 : instance_nearest(x, y, obj_p_fleet); - if (instance_exists(_targ)) { - if (_targ.acted >= 2) { + var _targ = !target.present_fleet[1] ? -50 : instance_nearest(x,y,obj_p_fleet); + if (instance_exists(_targ)){ + if (_targ.acted>=2){ _allow_attack = false; } } - if (_allow_attack) { - instance_create_layer(x, y, layer_get_all()[0], obj_drop_select, {p_target: target, planet_number: obj_controller.selecting_planet, attack: true, sh_target: _targ, purge: 0}); - } - } else if (current_button == "Purge") { + if (_allow_attack){ + instance_create_layer(x, y, layer_get_all()[0], obj_drop_select,{ + p_target:target, + planet_number : obj_controller.selecting_planet, + attack :true, + sh_target : _targ, + purge:0, + }); + } + + }else if (current_button=="Purge"){ var _allow_attack = true; - var _targ = !target.present_fleet[1] ? -50 : instance_nearest(x, y, obj_p_fleet); - if (instance_exists(_targ)) { - if (_targ.acted >= 2) { + var _targ = !target.present_fleet[1] ? -50 : instance_nearest(x,y,obj_p_fleet); + if (instance_exists(_targ)){ + if (_targ.acted>=2){ _allow_attack = false; } } - if (_allow_attack) { - instance_create_layer(x, y, layer_get_all()[0], obj_drop_select, {p_target: target, purge: 1, planet_number: obj_controller.selecting_planet, sh_target: _targ}); + if (_allow_attack){ + instance_create_layer(x, y, layer_get_all()[0], obj_drop_select,{ + p_target:target, + purge:1, + planet_number : obj_controller.selecting_planet, + sh_target : _targ, + }); } - } else if (current_button == "Bombard") { - instance_create(x, y, obj_bomb_select); - if (instance_exists(obj_bomb_select)) { - obj_bomb_select.p_target = target; - obj_bomb_select.sh_target = instance_nearest(x, y, obj_p_fleet); + + }else if (current_button=="Bombard"){ + instance_create(x,y,obj_bomb_select); + if (instance_exists(obj_bomb_select)){ + obj_bomb_select.p_target=target; + obj_bomb_select.sh_target=instance_nearest(x,y,obj_p_fleet); obj_bomb_select.p_data = p_data; - if (instance_nearest(x, y, obj_p_fleet).acted > 0) { - with (obj_bomb_select) { - instance_destroy(); - } + if (instance_nearest(x,y,obj_p_fleet).acted>0) then with(obj_bomb_select){ + instance_destroy(); } } - } else if (current_button == "+Recruiting") { + }else if (current_button=="+Recruiting"){ if (obj_controller.recruiting_worlds_bought > 0 && p_data.current_owner <= 5 && !p_data.at_war()) { if (!p_data.has_feature(eP_FEATURES.RECRUITING_WORLD)) { if (obj_controller.faction_status[eFACTION.IMPERIUM] == "War") { @@ -397,27 +422,30 @@ if (obj_controller.selecting_planet!=0){ // 135 ; popup? } } - } else if (current_button == "Cyclonic Torpedo") { + }else if (current_button=="Cyclonic Torpedo"){ scr_destroy_planet(2); } - } + } } -if (target != 0) { - if ((player_fleet > 0) && (imperial_fleet + mechanicus_fleet + inquisitor_fleet + eldar_fleet + ork_fleet + tau_fleet + heretic_fleet > 0)) { + +if (target!=0){ + if (player_fleet>0) and (imperial_fleet+mechanicus_fleet+inquisitor_fleet+eldar_fleet+ork_fleet+tau_fleet+heretic_fleet>0){ draw_set_color(0); draw_set_alpha(0.75); - draw_rectangle(37, 413, 270, 452, 0); + draw_rectangle(37,413,270,452,0); draw_set_alpha(1); - + /*draw_set_color(CM_GREEN_COLOR);draw_rectangle(40,247,253,273,1);*/ - + + draw_set_halign(fa_left); - + + draw_set_color(0); draw_set_font(fnt_40k_14b); - draw_text(37, 413, "Select Fleet Combat"); - + draw_text(37,413,"Select Fleet Combat"); + draw_set_color(CM_GREEN_COLOR); draw_set_font(fnt_40k_14b); draw_text(37.5,413.5,"Select Fleet Combat"); @@ -428,8 +456,8 @@ if (target != 0) { for (var i=1;i<=7;i++){ if (en_fleet[i]>0){ // draw_sprite_ext(spr_force_icon,en_fleet[i],x3,y3,0.5,0.5,0,c_white,1); - scr_image("ui/force", en_fleet[i], x3 - 16, y3 - 16, 32, 32); - x3 += 64; + scr_image("ui/force",en_fleet[i],x3-16,y3-16,32,32); + x3+=64; } } } @@ -443,4 +471,5 @@ pop_draw_return_values(); /* */ + /* */ diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 7e3a062222..1b4063798a 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1316,9 +1316,8 @@ function PlanetData(planet, system) constructor{ colonist_button.update({ x1:xx+35, y1:_half_way, - allow_click : array_length(potential_donors), }); - colonist_button.draw(); + colonist_button.draw(array_length(potential_donors)); recruiting_button.update({ x1:xx+(spacing_x*2)+15, @@ -1340,7 +1339,7 @@ function PlanetData(planet, system) constructor{ y1:_half_way, allow_click : true, }); - recruitment_type_button.draw(); + recruitment_type_button.draw(true); draw_text(xx+(spacing_x*3)-15, _half_way+(spacing_y)-20, $"Req:{_recruit_world.recruit_cost * 2}"); if (_recruit_world.recruit_cost > 0) { @@ -1349,7 +1348,7 @@ function PlanetData(planet, system) constructor{ y1:_half_way+(spacing_y), allow_click : true, }); - recruitment_costdown_button.draw(); + recruitment_costdown_button.draw(true); } if (_recruit_world.recruit_cost < 5) { recruitment_costup_button.update({ @@ -1357,7 +1356,7 @@ function PlanetData(planet, system) constructor{ y1:_half_way+(spacing_y), allow_click : true, }); - recruitment_costup_button.draw(); + recruitment_costup_button.draw(true); } } } From 72750d83ffbdbef4985778b7a9a23def6a974939 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 15:07:17 +0100 Subject: [PATCH 66/93] start fixing governor profiles --- scripts/scr_governors/scr_governors.gml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/scr_governors/scr_governors.gml b/scripts/scr_governors/scr_governors.gml index d705fa05ff..f2f968c012 100644 --- a/scripts/scr_governors/scr_governors.gml +++ b/scripts/scr_governors/scr_governors.gml @@ -1,12 +1,21 @@ -function GovernorProfile(){ - born = obj_controlller.turn - irandom_range(240,4800); + +enum ePREFERENCE{ + HATES = 0, + DISLIKES, + NEUTRAL, + LIKES, + LOVES +} + +function GovernorProfile() constructor{ + born = obj_controller.turn - irandom_range(240,4800); uid = scr_uuid_generate(); static age = function(){ - var _age = born - obj_controlller.turn; + var _age = born - obj_controller.turn; if (_age < 0){ - _age = (born * -1) + obj_controlller.turn; + _age = (born * -1) + obj_controller.turn; } _age/=12; @@ -20,7 +29,7 @@ function GovernorProfile(){ astartes_view = irandom(4);//0 hates astartes 4 likes astartes - sector_commander_view = irandom(4); + sector_commander_view = irandom(4);//likes commmander hates commander personal_security = irandom(4); From d25aa4d9bd51d16464e849b627351625c3e71068 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 23 Apr 2026 16:02:41 +0100 Subject: [PATCH 67/93] lading and saving of governor --- objects/obj_star/Create_0.gml | 14 ++++++++++++-- scripts/scr_governors/scr_governors.gml | 7 ++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/objects/obj_star/Create_0.gml b/objects/obj_star/Create_0.gml index df09a620dc..842b02f438 100644 --- a/objects/obj_star/Create_0.gml +++ b/objects/obj_star/Create_0.gml @@ -72,9 +72,9 @@ p_influence = array_create_advanced(_planet_array_size, array_create(15, 0)); p_problem = array_create_advanced(_planet_array_size, array_create(8, "")); p_problem_other_data = array_create_advanced(_planet_array_size, array_create_advanced(8, {})); p_timer = array_create_advanced(_planet_array_size, array_create(8, -1)); -p_governor = []; +p_governor = array_create(_planet_array_size, 0); -for (var i=1;i<8;i++){ +for (var i=1;i Date: Thu, 23 Apr 2026 19:11:11 +0100 Subject: [PATCH 68/93] copy on write issue --- objects/obj_star/Create_0.gml | 1 - scripts/NameGenerator/NameGenerator.gml | 6 ++++-- scripts/scr_governors/scr_governors.gml | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/objects/obj_star/Create_0.gml b/objects/obj_star/Create_0.gml index 842b02f438..11055b321e 100644 --- a/objects/obj_star/Create_0.gml +++ b/objects/obj_star/Create_0.gml @@ -72,7 +72,6 @@ p_influence = array_create_advanced(_planet_array_size, array_create(15, 0)); p_problem = array_create_advanced(_planet_array_size, array_create(8, "")); p_problem_other_data = array_create_advanced(_planet_array_size, array_create_advanced(8, {})); p_timer = array_create_advanced(_planet_array_size, array_create(8, -1)); -p_governor = array_create(_planet_array_size, 0); for (var i=1;i Date: Sat, 25 Apr 2026 13:08:49 +0100 Subject: [PATCH 69/93] solve remmaining launch crashes --- objects/obj_star/Alarm_1.gml | 5 ++++- objects/obj_star/Create_0.gml | 8 ++------ objects/obj_star/Draw_0.gml | 2 +- scripts/NameGenerator/NameGenerator.gml | 8 -------- scripts/scr_cheatcode/scr_cheatcode.gml | 2 +- scripts/scr_governors/scr_governors.gml | 2 +- scripts/scr_planetary_feature/scr_planetary_feature.gml | 8 ++++---- 7 files changed, 13 insertions(+), 22 deletions(-) diff --git a/objects/obj_star/Alarm_1.gml b/objects/obj_star/Alarm_1.gml index 0e57d05e7f..345ca2f577 100644 --- a/objects/obj_star/Alarm_1.gml +++ b/objects/obj_star/Alarm_1.gml @@ -3,7 +3,10 @@ // If getting to max pop is very rare, it will be awful to recruit from // some planets may be better or worse than others depending on their max pop. // TODO refactor and improve logic -for (var i = 1; i <= 4; i++) { +for (var i = 1; i <= planets; i++) { + p_governor[i] = new GovernorProfile(); +} +for (var i = 1; i <= planets; i++) { p_population[i] = 0; // 10B switch (p_type[i]) { case "Lava": diff --git a/objects/obj_star/Create_0.gml b/objects/obj_star/Create_0.gml index 11055b321e..b69c2e6e4a 100644 --- a/objects/obj_star/Create_0.gml +++ b/objects/obj_star/Create_0.gml @@ -63,8 +63,8 @@ p_heresy = array_create(_planet_array_size, 0); p_hurssy = array_create(_planet_array_size, 0); p_hurssy_time = array_create(_planet_array_size, 0); p_heresy_secret = array_create(_planet_array_size, 0); -p_raided = array_create(_planet_array_size, 0); -p_governor = array_create(_planet_array_size, ""); +p_raided = array_create(_planet_array_size, false); +p_governor = array_create(_planet_array_size, false); p_operatives = array_create_advanced(_planet_array_size, []); p_feature = array_create_advanced(_planet_array_size, []); p_upgrades = array_create_advanced(_planet_array_size, []); @@ -73,10 +73,6 @@ p_problem = array_create_advanced(_planet_array_size, array_create(8, "")); p_problem_other_data = array_create_advanced(_planet_array_size, array_create_advanced(8, {})); p_timer = array_create_advanced(_planet_array_size, array_create(8, -1)); -for (var i=1;i Date: Sat, 25 Apr 2026 13:45:13 +0100 Subject: [PATCH 70/93] finish pathway for choosing to keep trophy --- scripts/scr_add_artifact/scr_add_artifact.gml | 20 +++++++++++++++++-- .../scr_mission_functions.gml | 19 +++++++++++++++++- .../scr_unit_quick_find_pane.gml | 4 ++-- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/scripts/scr_add_artifact/scr_add_artifact.gml b/scripts/scr_add_artifact/scr_add_artifact.gml index b921bf4cdd..4d1f44b707 100644 --- a/scripts/scr_add_artifact/scr_add_artifact.gml +++ b/scripts/scr_add_artifact/scr_add_artifact.gml @@ -38,6 +38,7 @@ function scr_add_artifact(artifact_type = "random", artifact_tags = "", is_ident good = false; } } + if (base_type == "") { if (array_contains(["Weapon", "Armour", "Gear", "Device"], artifact_type)) { base_type = artifact_type; @@ -284,14 +285,23 @@ function ArtifactStruct(Index) constructor { return obj_ini.artifact[index]; }; + static update_type = function(new_type){ + obj_ini.artifact[index] = new_type; + } + static condition = function() { return obj_ini.artifact_condition[index]; }; - static loc = function() { + static loc = function(set_loc) { return obj_ini.artifact_loc[index]; }; + + static set_loc = function(new_loc){ + obj_ini.artifact_loc[index] = new_loc; + } + //combination of what is normally lid and wid static sid = function() { return obj_ini.artifact_sid[index]; @@ -303,7 +313,8 @@ function ArtifactStruct(Index) constructor { "Statue", "Casket", "Chalice", - "Robot" + "Robot", + "trophy" ]; if (array_contains(none_equips, type())) { _can_equip = false; @@ -363,6 +374,11 @@ function ArtifactStruct(Index) constructor { return obj_ini.artifact_identified[index]; }; + static add_tag = function(tag_to_add){ + if (!array_contains(tags(), tag_to_add)){ + array_push(obj_ini.artifact_tags[index],tag_to_add); + } + } static has_tag = function(wanted_tag) { return array_contains(tags(), wanted_tag); }; diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 421bd5fbe2..5a88b13504 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -678,7 +678,24 @@ function init_deliver_trophy_mission(){ { str1 : "Refuse and place the trophy into the Librarium", choice_func : function(){ - scr_add_artifact(); + var _arti = scr_add_artifact("trophy", [], 0, ""); + reset_popup_options(); + _arti.name = pop_data.trophy_name; + var _daemonic = roll_dice_chapter(1, 10, "low"); + if (_daemonic == 10){ + _arti.add_tag("daemonic") + } + _arti.set_loc(_pop_data.system); + //base_type == choose("gear", "weapon", "trophy"); + var _base_type = choose("weapon", "trophy"); + if (_base_type == "weapon"){ + _arti.update_type("Company Standard"); + } + text = "Your Marines elect to keep the {pop_data.trophy_name} as for the chapter in it's honour"; + + if (_base_type == "weapon"){ + text += "The grisly remains have been fashioned into a make shift standard that is crude but fearsome to behold"; + } } }, diff --git a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml index 2c6d8f1d7d..2486ff7122 100644 --- a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml +++ b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml @@ -52,7 +52,7 @@ function UnitQuickFindPanel() constructor{ if (unit.name() == "" || !unit.controllable()) then return; unit_location = unit.marine_location(); - if (unit_location[0]==location_types.planet && unit_location[2] != ""){ + if (unit_location[0] == eLOCATION_TYPES.PLANET && unit_location[2] != ""){ add_unit_to_garrison_log(unit,unit_location); group = garrison_log[$ unit_location[2]]; @@ -61,7 +61,7 @@ function UnitQuickFindPanel() constructor{ } else if (unit.IsSpecialist(SPECIALISTS_TECHS)){ group.techies++; } - } else if (unit_location[0]==location_types.ship){ + } else if (unit_location[0]==eLOCATION_TYPES.SHIP){ if (unit.ship_location-1){ obj_ini.ship_carrying[unit.ship_location]+=unit.get_unit_size(); } From f799fdee09bcbcad4fa6e1de04c10d0a17a6bb40 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 25 Apr 2026 13:57:59 +0100 Subject: [PATCH 71/93] merge problems a_D --- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 38 ++++++++++------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml index 32d8e5c113..ef4c8ae13d 100644 --- a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml +++ b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml @@ -341,24 +341,20 @@ function scr_enemy_ai_d() { fleet.escort_number = round(random_range(12, 27)); /*fleet.capital_number=choose(5,6); - fleet.frigate_number=round(random_range(4,8)); - fleet.escort_number=round(random_range(8,18));*/ - - fleet.image_index=round(standard_fleet_strength_calc()); - fleet.image_alpha=0; - - fleet.action_x=x; - fleet.action_y=y; - - fleet.action_eta=p_timer[i][firstest]; - fleet.action="move"; - } - - - } - - } + fleet.frigate_number=round(random_range(4,8)); + fleet.escort_number=round(random_range(8,18));*/ + fleet.image_index = round(standard_fleet_strength_calc()); + fleet.image_alpha = 0; + + fleet.action_x = x; + fleet.action_y = y; + + fleet.action_eta = p_timer[i][firstest]; + fleet.action = "move"; + } + } + } if (has_problem_planet_and_time(i, "Hive Fleet", 3) > -1) { var woop = scr_role_count("Chief " + string(obj_ini.role[100][17]), ""); @@ -539,10 +535,10 @@ function scr_enemy_ai_d() { // Local problems will go here var planet; - for (var i = 0; i <= planets; i++) { - planet = i + 1; - if (i < array_length(system_garrison)) { - var garrison = system_garrison[i]; + for (var planet=1;planet<=planets;planet++){ + planet = planet + 1; + if (planet < array_length(system_garrison)) { + var garrison = system_garrison[planet]; if (garrison.garrison_force) { if (garrison.garrison_disposition_change(self, planet) != "none") { dispo[planet] += garrison.dispo_change; From a49eea2eb1e1f8e3b783d37f7792663e58572543 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 25 Apr 2026 14:02:57 +0100 Subject: [PATCH 72/93] repair ai a --- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 272 +++++----------------- 1 file changed, 63 insertions(+), 209 deletions(-) diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 83963a3e37..73f1b4e401 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -1,20 +1,21 @@ /// @mixin function scr_enemy_ai_a() { - system_garrison = [0]; - system_sabatours = [0]; - system_datas = [0]; - - for (var i=1;i<=planets;i++){ - var garrison = new GarrisonForce(p_operatives[i], true); - var sabatours = new GarrisonForce(p_operatives[i], true, "sabotage"); - array_push(system_garrison, garrison); - array_push(system_sabatours, sabatours); - array_push(system_datas,new PlanetData(i, self)); - } - // guardsmen hop from planet to planet - //not sure we really need this as it's handled with tht navy fleet functions but fuck it updated it and leaving it fot the sec - if (system_guard_total()>0 && present_fleet[eFACTION.IMPERIUM]){ - var cur_planet=0,most_enemies_found=0,current_guard_planet=0,most_enemies_planet=0; + system_garrison = []; + system__sabatours = []; + system_datas = [0]; + + for (var i = 1; i <= planets; i++) { + var _garrison = new GarrisonForce(p_operatives[i], true); + var _sabatours = new GarrisonForce(p_operatives[i], true, "sabotage"); + array_push(system_garrison, _garrison); + array_push(system__sabatours, _sabatours); + array_push(system_datas, new PlanetData(i, self)); + } + // guardsmen hop from planet to planet + //not sure we really need this as it's handled with tht navy fleet functions but fuck it updated it and leaving it fot the sec + if (system_guard_total() > 0 && present_fleet[eFACTION.IMPERIUM]) { + LOGGER.debug($"system_has_guard {p_guardsmen}"); + var cur_planet = 0, most_enemies_found = 0, current_guard_planet = 0, most_enemies_planet = 0; var _guard_planets = guard_find_planet_with_most_enemy_forces(self); @@ -27,6 +28,18 @@ function scr_enemy_ai_a() { LOGGER.debug($"system_has_guard {p_guardsmen}"); } + if ((obj_controller.faction_defeated[10] > 0) && (obj_controller.faction_gender[10] == 2)) { + var cur_planet = 0; + repeat (planets) { + cur_planet += 1; + if (array_length(p_feature[cur_planet]) != 0) { + if ((planet_feature_bool(p_feature[cur_planet], eP_FEATURES.CHAOSWARBAND) == 1) && (p_chaos[cur_planet] <= 0)) { + delete_features(p_feature[cur_planet], eP_FEATURES.CHAOSWARBAND); + } + } + } + } + // checking for inquisition dead world inspections here if (present_fleet[eFACTION.PLAYER] >= 0 && !present_fleet[eFACTION.INQUISITION]) { inquisitor_inspect_base(); @@ -34,14 +47,14 @@ function scr_enemy_ai_a() { var stop; var rand = 0; - var garrison_force = false, total_garrison = 0; + var _garrison_force = false, total_garrison = 0; var _planet_data; - for (var _run =1;_run<=planets;_run++){ - _planet_data = system_datas[_run]; - garrison = _planet_data.garrisons; - sabatours = _planet_data.sabatours; + for (var _run = 1; _run <= planets; _run++) { - garrison_force = garrison.garrison_force; + _planet_data = system_datas[_run]; + _garrison = _planet_data.garrisons; + _sabatours = _planet_data.sabatours; + _garrison_force = garrison_garrison_force; stop = 0; ensure_no_planet_negatives(_run); @@ -90,11 +103,11 @@ function scr_enemy_ai_a() { if ((p_tyranids[_run] > 0) && (stop != 1) && (p_owner[_run] != 9)) { // This might have been causing the problem /*if (p_tyranids[_run]<5) and (p_guardsmen[_run]>0){ - if (p_tyranids[_run]=4) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-100000); - if (p_tyranids[_run]=3) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-20000); - if (p_tyranids[_run]=2) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-5000); - if (p_tyranids[_run]=1) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-500); - }*/ + if (p_tyranids[_run]=4) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-100000); + if (p_tyranids[_run]=3) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-20000); + if (p_tyranids[_run]=2) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-5000); + if (p_tyranids[_run]=1) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-500); + }*/ if (p_tyranids[_run] >= 5) { tyranids_score = 7; } @@ -120,9 +133,9 @@ function scr_enemy_ai_a() { var defence_mult = _planet_data.fortification_level * 0.1; try { - if (pdf_with_player && garrison_force) { - //if player supports give garrison bonus - pdf_score = determine_pdf_defence(_planet_data.pdf, garrison, _planet_data.fortification_level)[0]; + if (pdf_with_player && _garrison_force) { + //if player supports give _garrison bonus + pdf_score = determine_pdf_defence(_planet_data.pdf, _garrison, _planet_data.fortification_level)[0]; } else { pdf_score = determine_pdf_defence(_planet_data.pdf,, _planet_data.fortification_level)[0]; } @@ -330,90 +343,10 @@ function scr_enemy_ai_a() { } } - var after_combat_guard=guard_score; - var after_combat_guard_count=p_guardsmen[_run]; - var after_combat_pdf=pdf_score; - var after_combat_ork_force=planet_forces[eFACTION.ORK]; - var after_combat_tau=planet_forces[eFACTION.TAU]; - var after_combat_traitor=traitors_score; - var after_combat_csm=csm_score; - if (csm_score=6.1) then csm_score=8; - var after_combat_necrons=necrons_score; - var after_combat_tyranids=tyranids_score; - var after_combat_sisters=sisters_score; - var tempor=0,rand1=0,rand2=0; - - var _active_garrison = pdf_with_player && garrison.viable_garrison>0; - // Guard attack - if (guard_score>0) and (guard_attack!="") and (guard_score>0.5){ - if (guard_attack="ork") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK]; - if (guard_attack="tau") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.TAU]; - if (guard_attack="traitors") then tempor=choose(1,2,3,4,5,6)*traitors_score; - if (guard_attack="csm") then tempor=choose(2,3,4,5,6,7)*csm_score; - if (guard_attack="tyranids") then tempor=choose(2,3,4,5,6,7)*tyranids_score; - - rand1=choose(1,2,3,4,5)*guard_score; - - if (guard_attack="ork") and (planet_forces[eFACTION.ORK]>guard_score) then rand1=0; - if (guard_attack="tau") and (planet_forces[eFACTION.TAU]>guard_score) then rand1=0; - if (guard_attack="traitors") and (traitors_score>guard_score) then rand1=0; - if (guard_attack="csm") and (csm_score>guard_score) then rand1=0; - if (guard_attack="tyranids") and (tyranids_score>guard_score) then rand1=0; - - if (guard_attack="pdf"){ - if (pdf_with_player){ - pdf_mod=irandom_range(1,6+garrison.total_garrison*0.1); - }else{ - pdf_mod=irandom(5)+1; - } - rand1=(choose(3,4,5,6)*guard_score)*choose(1,1.25,1.25); - rand2=(pdf_mod*pdf_score)*choose(1,1.25); - if (rand1>rand2){ - var _pdf_before = p_pdf[_run]; - if (guard_score<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.7+pdf_loss_reduction))); - if (guard_score>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.55+pdf_loss_reduction))); - if (guard_score>=4) and (p_pdf[_run]<30000) then p_pdf[_run]*=(min(0.95, 1+pdf_loss_reduction)); - if (guard_score>=3) and (p_pdf[_run]<10000) then p_pdf[_run]*=(min(0.95, 0+pdf_loss_reduction)); - if (guard_score>=2) and (p_pdf[_run]<2000) then p_pdf[_run]=0; - if (guard_score>=1) and (p_pdf[_run]<200) then p_pdf[_run]=0; - if (_planet_data.population_influences[eFACTION.TYRANIDS] > 50 && _planet_data.has_feature(eP_FEATURES.GENE_STEALER_CULT)){ - var _cur_influ = p_influence[_run][eFACTION.TYRANIDS]; - var _influence_reduction = _cur_influ * (p_pdf[_run]/_pdf_before); - adjust_influence(eFACTION.TYRANIDS,-min(_influence_reduction,_cur_influ-3) , _run); - if (p_influence[_run][eFACTION.TYRANIDS] < 20){ - _planet_data.delete_feature(eP_FEATURES.GENE_STEALER_CULT); - } - } - } - if (p_pdf[_run]=0) and (pdf_with_player){ - if (!_planet_data.has_feature(eP_FEATURES.MONASTERY)) and (p_player[_run]<=0){ - p_owner[_run]=2; - dispo[_run]=-50; - } - } - } - if (guard_attack!="pdf") and (rand1>tempor){ - if (guard_attack="ork") then after_combat_ork_force-=1; - if (guard_attack="tau") then after_combat_tau-=1; - if (guard_attack="traitors") then after_combat_traitor-=1; - if (guard_attack="csm") then after_combat_csm-=1; - if (guard_attack="tyranids"){ - after_combat_tyranids-=1; - } - } - } - - // PDF attack - if ((pdf_score>0) and (pdf_attack!="")) or ((pdf_score>1) and (guard_score<0.5)){ - if (pdf_attack="ork") then tempor=planet_forces[eFACTION.ORK]; - if (pdf_attack="tau") then tempor=planet_forces[eFACTION.TAU]; - if (pdf_attack="traitors") then tempor=traitors_score; - if (pdf_attack="csm") then tempor=csm_score; - if (pdf_attack="guard") then tempor=guard_score; - if (pdf_attack="tyranids") then tempor=tyranids_score; - if (pdf_attack="sisters") then tempor=sisters_score; - - rand1=floor(random(pdf_score+tempor+2)) + if ((p_necrons[_run] > 0) && (stop != 1)) { + if ((p_traitors[_run] == 0) && (p_tau[_run] == 0) && (p_eldar[_run] == 0) && (p_orks[_run] == 0) && (p_chaos[_run] == 0)) { + necrons_attack = "imp"; + } rand = choose(1, 2, 3, 4, 5, 6); if ((rand == 1) && (necrons_attack == "imp")) { @@ -435,89 +368,10 @@ function scr_enemy_ai_a() { necrons_attack = "sisters"; } - rand2=(choose(1,2,3,4,5,6)*guard_score)*choose(1,1.25,2); - if (rand1>rand2){ - if (pdf_score<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.7); - if (pdf_score>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); - if (pdf_score>=4) and (p_guardsmen[_run]<15000) then p_guardsmen[_run]=0; - if (pdf_score>=3) and (p_guardsmen[_run]<5000) then p_guardsmen[_run]=0; - } - } - } - - // sisters attack - if (sisters_score>0) and (sisters_attack!="") and (sisters_attack!="player"){ - rand1=choose(2,3,4,5,6)*sisters_score; - - if (sisters_attack="tau"){ - rand2=(choose(2,3,4,5)*planet_forces[eFACTION.TAU])*choose(1,1.25); - if (rand1>rand2) then after_combat_tau-=1; - }else if(sisters_attack="ork"){ - rand2=(choose(2,3,4,5)*planet_forces[eFACTION.ORK])*choose(1,1.25); - if (rand1>rand2) then after_combat_ork_force-=1; - }else if(sisters_attack="traitors"){ - rand2=(choose(1,2,3,4,5)*traitors_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_traitor-=1; - }else if(sisters_attack="csm"){ - rand2=(choose(2,3,4,5,6)*csm_score)*choose(1,1.25); - if (csm_score=6.1) then rand2=999; - if (rand1>rand2) then after_combat_csm-=1; - }else if(sisters_attack="necrons"){ - rand2=(choose(4,5,6,7)*necrons_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_necrons-=1; - }else if(sisters_attack="tyranids"){ - rand2=(choose(3,4,5,6,7)*tyranids_score)*choose(1,1.25); - if (rand1>rand2) and (tyranids_score>=4) then after_combat_tyranids-=1; - }else if(sisters_attack="pdf"){ - rand2=(choose(1,2,3,4,5)*pdf_score)*choose(1,1.25); - if (rand1>rand2){ - if (csm_score>=6) then p_pdf[_run]=0; - if (csm_score<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.75+pdf_loss_reduction))); - if (csm_score>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.65+pdf_loss_reduction))); - if (csm_score>=4) and (p_pdf[_run]<60000) then p_pdf[_run]=0; - if (csm_score>=3) and (p_pdf[_run]<20000) then p_pdf[_run]=0; - if (csm_score>=2) and (p_pdf[_run]<3000) then p_pdf[_run]=0; - if (csm_score>=1) and (p_pdf[_run]<1000) then p_pdf[_run]=0; - } - } - - } - - // Tau attack - if (planet_forces[eFACTION.TAU]>0) and (tau_attack!="") and (tau_attack!="player"){ - rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.TAU]; - - if (tau_attack="ork"){ - rand2=(choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK])*choose(1,1.25); - if (rand1>rand2) then after_combat_ork_force-=1; - }else if (tau_attack="traitors"){ - rand2=(choose(1,2,3,4,5,6)*traitors_score)*choose(1,1.25); - if (rand1>rand2) and (traitors_score!=7) then after_combat_traitor-=1; - }else if (tau_attack="csm"){ - rand2=(choose(1,2,3,4,5,6)*csm_score)*choose(1,1.25); - if (csm_score=6.1) then rand2=999; - if (rand1>rand2) then after_combat_csm-=1; - }else if (tau_attack="guard"){ - rand2=(choose(1,2,3,4,5,6)*guard_score)*choose(1,1.25); - if (rand1>rand2){ - if (planet_forces[eFACTION.TAU]<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.7); - if (planet_forces[eFACTION.TAU]>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); - } - }else if (tau_attack="pdf"){ - rand2=(choose(1,2,3,4,5,6)*pdf_score)*choose(1,1.25); - if (rand1>rand2){ - if (planet_forces[eFACTION.TAU]<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.7+pdf_loss_reduction))); - if (planet_forces[eFACTION.TAU]>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.55+pdf_loss_reduction))); - } - }else if (tau_attack="sisters"){ - rand2=(choose(1,2,3,4,5,6)*sisters_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_sisters-=1; - } - } - - // ork attack - if (planet_forces[eFACTION.ORK]>0) and (ork_attack!="") and (ork_attack!="player"){ - rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.ORK]; + if ((necrons_attack == "") && (p_player[_run] > 0)) { + necrons_attack = "player"; + } + } if (!stop) { // Start stop @@ -569,7 +423,7 @@ function scr_enemy_ai_a() { var after_combat_sisters = sisters_score; var tempor = 0, rand1 = 0, rand2 = 0; - var _active_garrison = pdf_with_player && garrison.viable_garrison > 0; + var _active_garrison = pdf_with_player && _garrison.viable_garrison > 0; // Guard attack if ((guard_score > 0) && (guard_attack != "") && (guard_score > 0.5)) { LOGGER.debug($"{name}:{guard_attack}"); @@ -609,7 +463,7 @@ function scr_enemy_ai_a() { if (guard_attack == "pdf") { if (pdf_with_player) { - pdf_mod = irandom_range(1, 6 + garrison.total_garrison * 0.1); + pdf_mod = irandom_range(1, 6 + _garrison.total_garrison * 0.1); } else { pdf_mod = irandom(5) + 1; } @@ -922,18 +776,18 @@ function scr_enemy_ai_a() { _planet_data.pdf_defence_loss_to_orks(); if (_active_garrison) { - var tixt = $"Chapter Forces led by {garrison.garrison_leader.name_role()} on {name} {scr_roman_numerals()[_run - 1]} were unable to secure PDF victory chapter support requested"; - if (garrison.garrison_sustain_damages("loose") > 0) { - tixt += $". {garrison.garrison_sustain_damages("loose")} Marines Lost"; + var tixt = $"Chapter Forces led by {_garrison.garrison_leader.name_role()} on {name} {scr_roman_numerals()[_run - 1]} were unable to secure PDF victory chapter support requested"; + if (_garrison.garrison_sustain_damages("loose") > 0) { + tixt += $". {_garrison.garrison_sustain_damages("loose")} Marines Lost"; } scr_alert("red", "owner", tixt, x, y); - //garrison.determine_battle(false,rand2-rand1, eFACTION.ORK); + //_garrison.determine_battle(false,rand2-rand1, eFACTION.ORK); } } else { if (_active_garrison) { - var tixt = $"Chapter Forces led by {garrison.garrison_leader.name_role()} on {name} {scr_roman_numerals()[_run - 1]} secure PDF victory"; - if (garrison.garrison_sustain_damages("win") > 0) { - tixt += $". {garrison.garrison_sustain_damages("win")} Marines Lost"; + var tixt = $"Chapter Forces led by {_garrison.garrison_leader.name_role()} on {name} {scr_roman_numerals()[_run - 1]} secure PDF victory"; + if (_garrison.garrison_sustain_damages("win") > 0) { + tixt += $". {_garrison.garrison_sustain_damages("win")} Marines Lost"; } scr_alert("green", "owner", tixt, x, y); } @@ -998,9 +852,9 @@ function scr_enemy_ai_a() { } } else if (traitors_attack == "guard") { /*if (traitors_attack="eldar"){ - rand2=(choose(1,2,3,4,5)*eldar_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_csm-=1; - }*/ + rand2=(choose(1,2,3,4,5)*eldar_score)*choose(1,1.25); + if (rand1>rand2) then after_combat_csm-=1; + }*/ rand2 = (choose(1, 2, 3, 4, 5) * guard_score) * choose(1, 1.25); if (rand1 > rand2) { if (traitors_score <= 3) { @@ -1173,7 +1027,7 @@ function scr_enemy_ai_a() { rand2 = (choose(1, 2, 3, 4, 5) * guard_score) * choose(1, 1.25); if (rand1 > rand2) { /*if (tyranids_score<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); - if (tyranids_score>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.5);*/ + if (tyranids_score>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.5);*/ var onh = 0; if ((tyranids_score == 1) && (onh == 0)) { p_guardsmen[_run] -= 2000; From 58ef4840f756e8f66ff512970e1e10a2093c431d Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 25 Apr 2026 14:05:28 +0100 Subject: [PATCH 73/93] variable naming --- scripts/scr_apothecary_ground/scr_apothecary_ground.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/scr_apothecary_ground/scr_apothecary_ground.gml b/scripts/scr_apothecary_ground/scr_apothecary_ground.gml index ef10896698..a3f348a596 100644 --- a/scripts/scr_apothecary_ground/scr_apothecary_ground.gml +++ b/scripts/scr_apothecary_ground/scr_apothecary_ground.gml @@ -260,7 +260,7 @@ function process_specialist_points() { // Planet specific logic (Orbit is 0, Planets are 1-4) if (turn_end && _p > 0 && array_length(_star_inst.p_feature[_p]) > 0) { - if (array_length(p_feature[p])!=0){ + if (array_length(p_feature[_p])!=0){ var _planet_data = new PlanetData(_p, _star_inst); _planet_data.recover_starship(_cur_techs); _planet_data.planet_training(_pool.heal); From b686fe992ac2e7c1c3a1fa51dc288951ecf93b7a Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 25 Apr 2026 17:06:45 +0100 Subject: [PATCH 74/93] solve allreaining end turn issues --- objects/obj_star/Alarm_1.gml | 6 ++ objects/obj_star/Alarm_3.gml | 4 +- objects/obj_star/Create_0.gml | 1 - scripts/scr_PlanetData/scr_PlanetData.gml | 2 +- .../scr_apothecary_ground.gml | 7 +- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 27 +++++--- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 9 ++- scripts/scr_garrison/scr_garrison.gml | 64 ++++++++++--------- 8 files changed, 69 insertions(+), 51 deletions(-) diff --git a/objects/obj_star/Alarm_1.gml b/objects/obj_star/Alarm_1.gml index 345ca2f577..83981ddfd2 100644 --- a/objects/obj_star/Alarm_1.gml +++ b/objects/obj_star/Alarm_1.gml @@ -3,8 +3,14 @@ // If getting to max pop is very rare, it will be awful to recruit from // some planets may be better or worse than others depending on their max pop. // TODO refactor and improve logic +system_garrison = [0]; +system_sabatours = [0]; +system_datas = [0]; for (var i = 1; i <= planets; i++) { p_governor[i] = new GovernorProfile(); + array_push(system_garrison, new GarrisonForce(p_operatives[i], false)); + array_push(system_sabatours, new GarrisonForce(p_operatives[i], false, "sabotage")); + array_push(system_datas, new PlanetData(i, self)); } for (var i = 1; i <= planets; i++) { p_population[i] = 0; // 10B diff --git a/objects/obj_star/Alarm_3.gml b/objects/obj_star/Alarm_3.gml index a8451f5cf7..940e902bd6 100644 --- a/objects/obj_star/Alarm_3.gml +++ b/objects/obj_star/Alarm_3.gml @@ -53,8 +53,8 @@ try { } if (struct_exists(_data, "planet")) { obj_controller.selecting_planet = _data.planet; - if (obj_controller.selecting_planet > 0 && obj_controller.selecting_planet < 5) { - obj_star_select.garrison = new GarrisonForce(p_operatives[obj_controller.selecting_planet]); + if (obj_controller.selecting_planet > 0 && _data.planet < 5) { + obj_star_select.garrison = system_garrison.update(p_operatives[_data.planet]); } } obj_controller.selection_data = false; diff --git a/objects/obj_star/Create_0.gml b/objects/obj_star/Create_0.gml index b69c2e6e4a..43e0af74c4 100644 --- a/objects/obj_star/Create_0.gml +++ b/objects/obj_star/Create_0.gml @@ -76,7 +76,6 @@ p_timer = array_create_advanced(_planet_array_size, array_create(8, -1)); system_datas = array_create(8, 0); system_garrison = array_create(8, 0); - system_sabatours = array_create(8, 0) add_feature = function(planet, feature){ diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 1b4063798a..0d15957dbc 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -1471,7 +1471,7 @@ function PlanetData(planet, system) constructor{ exit; } } else if (!_loading){ - garrisons = new GarrisonForce(operatives); + garrisons.update(operatives); system.garrisons = garrisons.garrison_force; feature=""; buttons_selected=false; diff --git a/scripts/scr_apothecary_ground/scr_apothecary_ground.gml b/scripts/scr_apothecary_ground/scr_apothecary_ground.gml index a3f348a596..18b2e06d87 100644 --- a/scripts/scr_apothecary_ground/scr_apothecary_ground.gml +++ b/scripts/scr_apothecary_ground/scr_apothecary_ground.gml @@ -260,11 +260,12 @@ function process_specialist_points() { // Planet specific logic (Orbit is 0, Planets are 1-4) if (turn_end && _p > 0 && array_length(_star_inst.p_feature[_p]) > 0) { - if (array_length(p_feature[_p])!=0){ - var _planet_data = new PlanetData(_p, _star_inst); + if (array_length(_star_inst.p_feature[_p])!=0){ + var _planet_data = _star_inst.system_datas[_p]; + _planet_data.refresh_data(); _planet_data.recover_starship(_cur_techs); _planet_data.planet_training(_pool.heal); - _planet_data.search_old_battle_grounds(cur_units); + _planet_data.search_old_battle_grounds(_cur_units); } } } else if (_p == 0 && string_pos("ref instance", _cur_loc) > 0) { diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 73f1b4e401..a5fc51ed71 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -1,15 +1,22 @@ /// @mixin function scr_enemy_ai_a() { - system_garrison = []; - system__sabatours = []; - system_datas = [0]; - for (var i = 1; i <= planets; i++) { - var _garrison = new GarrisonForce(p_operatives[i], true); - var _sabatours = new GarrisonForce(p_operatives[i], true, "sabotage"); - array_push(system_garrison, _garrison); - array_push(system__sabatours, _sabatours); - array_push(system_datas, new PlanetData(i, self)); + var _ops = p_operatives[i]; + if (system_garrison[i] == false){ + system_garrison[i] = new GarrisonForce(_ops, true); + } else { + system_garrison[i].update(_ops, true) + } + if (system_sabatours[i] == false){ + system_sabatours[i] = new GarrisonForce(_ops, true, "sabotage"); + } else { + system_sabatours[i].update(_ops, true) + } + if (system_datas[i] == false){ + system_datas[i] = new PlanetData(i, self) + } else { + system_datas[i].refresh_data(); + } } // guardsmen hop from planet to planet //not sure we really need this as it's handled with tht navy fleet functions but fuck it updated it and leaving it fot the sec @@ -54,7 +61,7 @@ function scr_enemy_ai_a() { _planet_data = system_datas[_run]; _garrison = _planet_data.garrisons; _sabatours = _planet_data.sabatours; - _garrison_force = garrison_garrison_force; + _garrison_force = _garrison.garrison_force; stop = 0; ensure_no_planet_negatives(_run); diff --git a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml index ef4c8ae13d..db6db78143 100644 --- a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml +++ b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml @@ -536,12 +536,11 @@ function scr_enemy_ai_d() { // Local problems will go here var planet; for (var planet=1;planet<=planets;planet++){ - planet = planet + 1; if (planet < array_length(system_garrison)) { - var garrison = system_garrison[planet]; - if (garrison.garrison_force) { - if (garrison.garrison_disposition_change(self, planet) != "none") { - dispo[planet] += garrison.dispo_change; + var _garrison = system_garrison[planet]; + if (_garrison.garrison_force) { + if (_garrison.garrison_disposition_change(self, planet) != "none") { + dispo[planet] += _garrison.dispo_change; } } } diff --git a/scripts/scr_garrison/scr_garrison.gml b/scripts/scr_garrison/scr_garrison.gml index 59c284b264..7df099690a 100644 --- a/scripts/scr_garrison/scr_garrison.gml +++ b/scripts/scr_garrison/scr_garrison.gml @@ -28,7 +28,7 @@ function disposition_description_chart(dispo) { } } -function GarrisonForce(planet_operatives, turn_end = false, type = "garrison") constructor { +function GarrisonForce(operatives, turn_end = false, type = "garrison") constructor { garrison_squads = []; total_garrison = 0; garrison_leader = false; @@ -37,43 +37,49 @@ function GarrisonForce(planet_operatives, turn_end = false, type = "garrison") c time_on_planet = 0; viable_garrison = 0; var operative, unit, member; - for (var ops = 0; ops < array_length(planet_operatives); ops++) { - if (planet_operatives[ops].type == "squad") { - if (planet_operatives[ops].job == type) { - //marine garrison on planet - if (array_length(obj_ini.squads[planet_operatives[ops].reference].members) > 0) { - operative = obj_ini.squads[planet_operatives[ops].reference]; - array_push(garrison_squads, operative); - total_garrison += array_length(operative.members); - garrison_force = true; - for (var i = 0; i < array_length(operative.members); i++) { - member = operative.members[i]; - unit = fetch_unit([member[0], member[1]]); - if (!is_struct(unit)) { - continue; + self.type = type + + static update = function(operatives,turn_end){ + for (var ops = 0; ops < array_length(operatives); ops++) { + if (operatives[ops].type == "squad") { + if (operatives[ops].job == type) { + //marine garrison on planet + if (array_length(obj_ini.squads[operatives[ops].reference].members) > 0) { + operative = obj_ini.squads[operatives[ops].reference]; + array_push(garrison_squads, operative); + total_garrison += array_length(operative.members); + garrison_force = true; + for (var i = 0; i < array_length(operative.members); i++) { + member = operative.members[i]; + unit = fetch_unit([member[0], member[1]]); + if (!is_struct(unit)) { + continue; + } + if (unit.name() == "") { + continue; + } + array_push(members, unit); + if (unit.hp() > 0) { + viable_garrison++; + } } - if (unit.name() == "") { - continue; + if (turn_end) { + operatives[ops].task_time++; } - array_push(members, unit); - if (unit.hp() > 0) { - viable_garrison++; + if (operatives[ops].task_time > time_on_planet) { + time_on_planet = operatives[ops].task_time; } + } else { + array_delete(operatives, ops, 1); + ops--; } - if (turn_end) { - planet_operatives[ops].task_time++; - } - if (planet_operatives[ops].task_time > time_on_planet) { - time_on_planet = planet_operatives[ops].task_time; - } - } else { - array_delete(planet_operatives, ops, 1); - ops--; } } } } + update(operatives,turn_end); + static garrison_sustain_damages = function(win_or_loss) { var unit; var member_count = array_length(members); From ff2c0dfda8d7424ddd87608ab9a421afab8d2648 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 25 Apr 2026 17:47:14 +0100 Subject: [PATCH 75/93] fix fundamentals of battleground --- scripts/scr_cheatcode/scr_cheatcode.gml | 1 + .../scr_mission_functions.gml | 46 +++++++++++-------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 4e39431d56..b529cbcc99 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -469,6 +469,7 @@ function draw_planet_debug_features(){ draw_text(38, _y, _feat.name); if (point_and_click([38, _y, 337, _y + 20])) { var _new_feat = new NewPlanetFeature(_feat.e_num); + _new_feat.player_hidden = false; array_push(target.p_feature[obj_controller.selecting_planet], _new_feat); } } diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 5a88b13504..56fad7057d 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -678,20 +678,23 @@ function init_deliver_trophy_mission(){ { str1 : "Refuse and place the trophy into the Librarium", choice_func : function(){ - var _arti = scr_add_artifact("trophy", [], 0, ""); reset_popup_options(); - _arti.name = pop_data.trophy_name; + var _tag = ""; var _daemonic = roll_dice_chapter(1, 10, "low"); if (_daemonic == 10){ - _arti.add_tag("daemonic") - } + _tag = "daemonic"; + } + var _arti = scr_add_artifact("trophy", _tag, 0, ""); + _arti = fetch_artifact(_arti); + _arti.name = pop_data.trophy_name; _arti.set_loc(_pop_data.system); //base_type == choose("gear", "weapon", "trophy"); var _base_type = choose("weapon", "trophy"); if (_base_type == "weapon"){ _arti.update_type("Company Standard"); } - text = "Your Marines elect to keep the {pop_data.trophy_name} as for the chapter in it's honour"; + + text = "Your Marines elect to keep the {pop_data.trophy_name} for the chapter in it's honour!"; if (_base_type == "weapon"){ text += "The grisly remains have been fashioned into a make shift standard that is crude but fearsome to behold"; @@ -806,19 +809,7 @@ function deliver_trophy_end_turn_check(){ _text += "In return for your labour and in honour of your chapter the commander of the guard division has a brand new Rhino destined for the army diverted to your chapter"; scr_add_vehicle("Rhino"); } else if (_roll>=70 ){ - var _wanted_types = ["Ice","Desert","Agri","Lava","Death"]; - var _star = scr_get_stars(true,[],_wanted_types)[0]; - _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on {_star.name}."; - _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it before you do"; - - var _planet = scr_get_planet_with_type(_wanted_types); - var _battle_ground = new NewPlanetFeature(P_features.OldBattleGround); - - _battle_ground.player_hidden = false; - - _battle_ground.imperium_known = true; - - _star.add_feature(_planet,_battle_ground); + init_newly_revealed_battle_ground(); } scr_popup( "Trophy Delivered ", @@ -829,6 +820,25 @@ function deliver_trophy_end_turn_check(){ } } +function init_newly_revealed_battle_ground(){ + var _wanted_types = ["Ice","Desert","Agri","Lava","Death"]; + var _star = scr_get_stars(true,[],_wanted_types)[0]; + if (array_length(_star)){ + _star = _star[0] + } + _text += "During the concourse that follows with the fleet command your marines learn of a old battle ground discovered on {_star.name}."; + _text += "According too intel it appeared to be an old astartes battle ground from an unknown age, communications have been passed onto the adeptus mechanicus who will no doubt pick the site clean should they reach it before you do"; + + var _planet = scr_get_planet_with_type(_wanted_types); + var _battle_ground = new NewPlanetFeature(P_features.OLDBATTLEGROUND); + + _battle_ground.player_hidden = false; + + _battle_ground.imperium_known = true; + + _star.add_feature(_planet,_battle_ground); +} + //TODO allow most of these functions to be condensed and allow arrays of problems or planets and maybe increase filtering options //filtering options could be done via universal methods that all the filters to be passed to many other game systems From 07ab623edd72a13ba173a7637e23cc5fbda06b4b Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 25 Apr 2026 17:53:45 +0100 Subject: [PATCH 76/93] add epithet fromm deliver trophy mission --- scripts/scr_marine_struct/scr_marine_struct.gml | 2 ++ scripts/scr_mission_functions/scr_mission_functions.gml | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/scripts/scr_marine_struct/scr_marine_struct.gml b/scripts/scr_marine_struct/scr_marine_struct.gml index c71ebd21e7..1183b9c6c1 100644 --- a/scripts/scr_marine_struct/scr_marine_struct.gml +++ b/scripts/scr_marine_struct/scr_marine_struct.gml @@ -431,6 +431,8 @@ function TTRPG_stats(faction, comp, mar, class = "marine", other_spawn_data = {} return ""; }; + + //TODO build epithets in to marine profile static add_epithet = function(epithet){ if (is_string(epithet)){ epithet = { diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 56fad7057d..017f0c4189 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -802,6 +802,11 @@ function deliver_trophy_end_turn_check(){ var _text = "{_marine.role(name)} is able to rendevous with the imperial navy at {_meet_point.name}." _text += $" The guard regiments of {fleetevent_data.system} are overjoyed at the delivery of the trophy and find the beast that the head came from adorns many of the regiments banners."; var _marine_epithet = get_beast_epithet(fleetevent_data.planet_type); + + _marine.add_epithet({ + title : _marine_epithet, + story : $"Slew a mighty beast in {fleetevent_data.system} after harvesting the {pop_data.trophy_name} their exploits became legendary within the sector largly due the aderation of the {fleetevent_data.system} regiments"; + }) _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.name_role()} spreading far and wide amoung guard regiments and has garnered the epithet {_marine_epithet}."; var _roll = roll_dice_chapter(1, 100, "high"); if (_roll>30 && _roll<70){ From 5056797de3552c170cee20737c24ecf810188343 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 25 Apr 2026 17:58:05 +0100 Subject: [PATCH 77/93] fix non xenos chaos glitch --- objects/obj_controller/Alarm_1.gml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/objects/obj_controller/Alarm_1.gml b/objects/obj_controller/Alarm_1.gml index 099b0c8cc5..3a1034afc4 100644 --- a/objects/obj_controller/Alarm_1.gml +++ b/objects/obj_controller/Alarm_1.gml @@ -462,13 +462,13 @@ if (did) { } orkz += 3; n = array_length(_non_xenos_chaos); + _non_xenos_chaos = array_shuffle(_non_xenos_chaos); for (var j = 0; j < orkz && j < n; j++) { - _current_system = array_random_element(_non_xenos_chaos); + _current_system = array_pop(_non_xenos_chaos); _current_system.planet[1] = 1; _current_system.p_owner[1] = 90; _current_system.owner = 90; - array_delete(_non_xenos_chaos, i, 1); } } From 8b2c0e1d285e503a7a7d7c7705052c7ed5df4030 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 25 Apr 2026 18:03:45 +0100 Subject: [PATCH 78/93] more enum stuff that somehowslllipped passed me --- scripts/scr_random_event/scr_random_event.gml | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index 2645eec19d..79904a4613 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -28,8 +28,8 @@ function scr_random_event(execute_now) { force_inquisition_mission = true; } - if (force_inquisition_mission && random_event_next == EVENT.none) { - chosen_event = EVENT.inquisition_mission; + if (force_inquisition_mission && random_event_next == eEVENT.NONE) { + chosen_event = eEVENT.INQUISITION_MISSION; } else { if(execute_now) @@ -42,7 +42,7 @@ function scr_random_event(execute_now) { if ((turn-15) Date: Sat, 25 Apr 2026 19:15:08 +0100 Subject: [PATCH 79/93] flavour to battle ground trawl --- scripts/scr_PlanetData/scr_PlanetData.gml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 0d15957dbc..58a29193ed 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -674,8 +674,6 @@ function PlanetData(planet, system) constructor{ exit; } - - var _marines = []; for (var i=0;i 0){ if (_priests.number == _techmarines.number){ - text = "Without any technical staff wholly loyal to the chapter the TechPriests Quickly set too Work sequestering any valuable resources for the Omnissiah"; - text += - scr_popup("Mars Control"); + text = "Without any technical staff wholly loyal to the chapter the Tech Priests Quickly set too Work sequestering any valuable resources for the Omnissiah."; + text += "By the time you have begun working in earnest your forces become aware that the Tech Priests have already catalogued any and all items of interest and begun transmitting their findings to the mechanicus."; + text += "\n\nThere is nothing that can easily be done"; + scr_popup("Mars Control", text, "mechanicus"); } else { text = "After Unloading Marines too site it becomes clear there is discontent among the group.\n"; - text = "A contingent of the force comprised of Techpriests are unhappy with the decision.\n"; - scr_popup("Conflict of Interest",) + text = "A contingent of the force comprised of Techpriests are unhappy with the decision too take all of the items aboard the chapter ships without cataloguing the information for their Forge Worlds.\n"; + scr_popup("Conflict of Interest", text, ) } } } From 411efa48c70a36258935299d3c0cd9d216710f38 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Mon, 27 Apr 2026 16:25:36 +0100 Subject: [PATCH 80/93] chapter traits --- ChapterMaster.yyp | 6 +- objects/obj_creation/Create_0.gml | 117 +++++++++--------- .../scr_ChapterTraits/scr_ChapterTraits.gml | 23 ++-- scripts/scr_PlanetData/scr_PlanetData.gml | 13 +- .../scr_creation_draw_slides.gml | 3 + scripts/scr_governors/scr_governors.gml | 8 +- .../scr_mission_functions.gml | 2 +- .../scr_popup_functions.gml | 23 ++-- 8 files changed, 108 insertions(+), 87 deletions(-) diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index afb3253a7c..20880911b7 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -2,9 +2,9 @@ "$GMProject":"v1", "%Name":"ChapterMaster", "AudioGroups":[ - {"$GMAudioGroup":"","%Name":"audiogroup_default","name":"audiogroup_default","resourceType":"GMAudioGroup","resourceVersion":"2.0","targets":-1,}, - {"$GMAudioGroup":"","%Name":"audiogroup_sfx","name":"audiogroup_sfx","resourceType":"GMAudioGroup","resourceVersion":"2.0","targets":-1,}, - {"$GMAudioGroup":"","%Name":"audiogroup_music","name":"audiogroup_music","resourceType":"GMAudioGroup","resourceVersion":"2.0","targets":-1,}, + {"$GMAudioGroup":"v1","%Name":"audiogroup_default","exportDir":"","name":"audiogroup_default","resourceType":"GMAudioGroup","resourceVersion":"2.0","targets":-1,}, + {"$GMAudioGroup":"v1","%Name":"audiogroup_sfx","exportDir":"","name":"audiogroup_sfx","resourceType":"GMAudioGroup","resourceVersion":"2.0","targets":-1,}, + {"$GMAudioGroup":"v1","%Name":"audiogroup_music","exportDir":"","name":"audiogroup_music","resourceType":"GMAudioGroup","resourceVersion":"2.0","targets":-1,}, ], "configs":{ "children":[], diff --git a/objects/obj_creation/Create_0.gml b/objects/obj_creation/Create_0.gml index a1b20bf590..0d0c82235a 100644 --- a/objects/obj_creation/Create_0.gml +++ b/objects/obj_creation/Create_0.gml @@ -418,84 +418,79 @@ chapter_trait_meta = []; /// @type {Array} obj_creation.all_advantages = []; var all_advantages = [ - { - name: "", - description: "", - value: 0, - }, { name: "Ambushers", description: "Your chapter is especially trained with ambushing foes; they have a bonus to attack during the start of a battle.", - value: 30, + points: 30, }, { name: "Boarders", description: "Boarding other ships is the specialty of your chapter. Your chapter is more lethal when boarding ships, have dedicated boarding squads, and two extra strike cruisers.", - value: 30, + points: 30, }, { name: "Bolter Drilling", description: "Bolter drills are sacred to your chapter; all marines have increased attack with Bolter weaponry.", - value: 40, + points: 40, meta: ["Weapon Specialty"], }, { name: "Retinue of Renown", description: "Your chapter master is guarded by renown heroes of the chapter. You start with a larger well-equipped Honour Guard.", - value: 20, + points: 20, }, { name: "Crafters", description: "Your chapter views artifacts as sacred; you start with better gear and maintain all equipment with more ease.", - value: 40, + points: 40, meta: ["Gear Quality"], }, { name: "Ancient Armoury", description: "Your chapter is dedicated to preserving ancient wargear and as such have substantially higher amounts of rare Heresy-era armour and weapons than normal.", - value: 20, //I'm not sure, but it could be higher since now this trait will bring much more benefits. + points: 20, //I'm not sure, but it could be higher since now this trait will bring much more benefits. meta: ["Gear Quality"], }, { name: "Enemy: Eldar", description: "Eldar are particularly hated by your chapter. When fighting Eldar damage is increased.", - value: 20, + points: 20, meta: ["Main Enemy"], }, { name: "Enemy: Fallen", description: "Chaos Marines are particularly hated by your chapter. When fighting the traitors damage is increased.", - value: 20, + points: 20, meta: ["Main Enemy"], }, { name: "Enemy: Necrons", description: "Necrons are particularly hated by your chapter. When fighting Necrons damage is increased.", - value: 20, + points: 20, meta: ["Main Enemy"], }, { name: "Enemy: Orks", description: "Orks are particularly hated by your chapter. When fighting Orks damage is increased.", - value: 20, + points: 20, meta: ["Main Enemy"], }, { name: "Enemy: Tau", description: "Tau are particularly hated by your chapter. When fighting Tau damage is increased.", - value: 20, + points: 20, meta: ["Main Enemy"], }, { name: "Enemy: Tyranids", description: "Tyranids are particularly hated by your chapter. A large number of your veterans and marines are tyrannic war veterans and when fighting Tyranids damage is increased.", - value: 20, + points: 20, meta: ["Main Enemy"], }, { name: "Kings of Space", description: "Veterans of naval combat, your chapter fleet has bonuses to offense, defence, an additional battle barge, and may always be controlled regardless of whether or not the Chapter Master is present.", - value: 40, + points: 40, meta: ["Naval"], }, { @@ -506,19 +501,19 @@ var all_advantages = [ "Marines mmore likely spawn with lightning warrior trait", "3% increase to base boarding capabilities" ], - value: 30, + points: 30, meta: ["Doctrine"], }, { name: "Paragon", description: "You are a pale shadow of the primarchs. Larger, stronger, faster, your Chapter Master is on a higher level than most, gaining additional health and combat effectiveness.", - value: 10, + points: 10, meta: ["Chapter Master"], }, { name: "Warp Touched", //TODO: This is probably can be better handled as a positive seed mutation; description: "Psychic mutations run rampant in your chapter. You have more marines with high psychic rating and aspirants are also more likely to be capable of harnessing powers of the warp.", - value: 20, + points: 20, meta: [ "Psyker Views", "Librarians" @@ -527,12 +522,12 @@ var all_advantages = [ { name: "Favoured By The Warp", description: "Many marines in your chapter are favoured by the powers of the warp, making perils of the warp happen less frequently for them.", - value: 20, + points: 20, }, { name: "Reverent Guardians", description: "Your chapter places great faith in the Imperial Cult; you start with more Chaplains and any Ecclesiarchy disposition increases are enhanced.", - value: 20, + points: 20, meta: [ "Faith", "Imperium Trust" @@ -541,67 +536,74 @@ var all_advantages = [ { name: "Tech-Brothers", description: "Your chapter has better ties to the mechanicus; you have more techmarines and higher mechanicus disposition.", - value: 20, + points: 20, meta: ["Mechanicus Faith"], }, { name: "Tech-Scavengers", description: "Your Astartes have a knack for finding what has been lost. Items and wargear are periodically found and added to the Armamentarium.", - value: 30, + points: 30, }, { name: "Siege Masters", description: "Your chapter is familiar with the ins-and-outs of fortresses. They are better at defending and attacking fortifications. And better at garrisoning", - value: 20, + points: 20, }, { name: "Devastator Doctrine", description: "The steady advance of overwhelming firepower is your chapters combat doctrine each company has an additional Devastator squad, all infantry have boosted defence, and heavy weapons have increased attack.", - value: 40, + points: 40, meta: ["Doctrine"], }, { name: "Assault Doctrine", description: "Your chapter prefers quick close quarter assaults on the enemy each Company has an additional Assault Squad and your marines are more skilled in melee.", - value: 20, + points: 20, meta: ["Doctrine"], }, { name: "Venerable Ancients", description: "Even in death they still serve. Your chapter places a staunch reverence for its forebears and has a number of additional venerable dreadnoughts in service.", - value: 40, + points: 40, meta: ["Doctrine"], }, { name: "Medicae Primacy", description: "Your chapter reveres its Apothecarion above all of it's specialist; You start with more Apothecaries.", - value: 20, + points: 20, meta: ["Apothecaries"], }, { name: "Ryzan Patronage", description: "Your chapter has strong ties to the Forgeworld of Ryza as a result your Techmarines are privy to the secrets of their Techpriests enhancing your Plasma and Las weaponry.", - value: 40, + points: 40, meta: ["Weapon Specialty"], }, { name: "Elite Guard", description: "Your chapter is an elite fighting force comprised almost exclusively of Veterans. All Tactical Marines are replaced by Veterans.", - value: 150, + points: 150, meta: ["Specialists"], }, { name: "Great Luck", description: "This is actually really helpful and beneficial for your chapter. Trust me.", - value: 20, + points: 20, meta: ["Luck"], + }, + { + name: "Inquisitorial Mandate", + description: "Your Chapter performs some service to the inquisition that is of some specific value or mandate of the inquisition", + effects: "You will recieve less frequent inspections from the inquisition and actions that may not align with the inquisition will cause less aggressive losses of disposition with the Inquisition", + meta: ["Imperium Trust"], + points: 50 } ]; var new_adv, cur_adv; for (var i = 0; i < array_length(all_advantages); i++) { cur_adv = all_advantages[i]; - new_adv = new Advantage(i, cur_adv.name, cur_adv.description, cur_adv.value); + new_adv = new Advantage(cur_adv); if (struct_exists(cur_adv, "meta")) { new_adv.meta = cur_adv.meta; } @@ -615,123 +617,118 @@ for (var i = 0; i < array_length(all_advantages); i++) { /// @type {Array} var all_disadvantages = [ - { - name: "", - description: "", - value: 0, - }, { name: "Black Rage", description: "Your marines are susceptible to Black Rage, having a chance each battle to become Death Company. These units are locked as Assault Marines and are fairly suicidal.", - value: 30, + points: 30, }, { name: "Blood Debt", description: "Prevents your Chapter from recruiting new Astartes until enough of your marines, or enemies, have been killed. Incompatible with Penitent chapter types.", - value: 50, + points: 50, }, { name: "Depleted Gene-seed Stocks", description: "Your chapter has lost its gene-seed stocks in recent engagement. You start with no gene-seed.", - value: 20, + points: 20, }, { name: "Fresh Blood", description: "Due to being newly created your chapter has little special wargear or psykers.", - value: 20, + points: 20, meta: ["Status"], }, { name: "Never Forgive", description: "In the past traitors broke off from your chapter. They harbor incriminating secrets or heritical beliefs, and as thus, must be hunted down whenever possible.", - value: 20, + points: 20, }, { name: "Shitty Luck", description: "This is actually really bad for your chapter. Trust me.", - value: 20, + points: 20, meta: ["Luck"], }, { name: "Sieged", description: "A recent siege has reduced the number of your marines greatly. You retain a normal amount of equipment but some is damaged.", - value: 40, + points: 40, meta: ["Status"], }, { name: "Splintered", description: "Your marines are unorganized and splintered. You require greater time to respond to threats en masse.", - value: 10, + points: 10, meta: ["Location"], }, { name: "Suspicious", description: "Some of your chapter's past actions or current practices make the inquisition suspicious. Their disposition is lowered.", - value: 10, + points: 10, meta: ["Imperium Trust"], }, { name: "Tech-Heresy", description: "Your chapter does things that makes the Mechanicus upset. Mechanicus disposition is lowered and you have less Tech Marines. You start as a tech heretic tolerant chapter", - value: 20, + points: 20, meta: ["Mechanicus Faith"], }, { name: "Tolerant", description: "Your chapter is more lenient with xenos. All xeno disposition is slightly increased and all Imperial disposition is lowered.", - value: 10, + points: 10, }, { name: "Warp Tainted", description: "Your chapter is tainted by the warp. Many of your marines are afflicted with it, making getting caught in perils of the warp less likely, but when caught - the results are devastating.", - value: 20, + points: 20, }, { name: "Psyker Intolerant", description: "Witches are hated by your chapter. You cannot create Librarians but gain a little bonus attack against psykers.", - value: 30, + points: 30, meta: ["Psyker Views"], }, { name: "Obliterated", description: "A recent string of unfortunate events has left your chapter decimated. You have very little left, will your story continue?", - value: 80, + points: 80, meta: ["Status"], }, { name: "Poor Equipment", description: "Whether due to being cut off from forge worlds or bad luck, your chapter no longer has enough high quality gear to go around. Your elite troops will have to make do with standard armour.", - value: 10, + points: 10, meta: ["Gear Quality"], }, { name: "Enduring Angels", description: "The Chapter's journey thus far has been arduous & unforgiving leaving them severely understrength yet not out of the fight. You begin with 5 fewer company's", - value: 30, + points: 30, meta: ["Status"], }, { name: "Serpents Delight", description: "Sleeper cells infiltrated your chapter. When they rose up for the decapitation strike,they slew the 5 most experienced company's and many of the HQ staff before being defeated", - value: 50, + points: 50, meta: ["Status"], }, { name: "Weakened Apothecarion", description: "Many of your chapter's Apothecaries have fallen in recent battles whether due to their incompetence or deliberate targetting.", - value: 20, + points: 20, meta: ["Apothecaries"], }, { name: "Small Reclusiam", description: "Your chapter cares little for its reclusiam compared to other chapters fewer marines have shown the desire to be chaplains.", - value: 20, + points: 20, meta: ["Faith"], }, { name: "Barren Librarius", description: "Your chapter has a smaller Librarius compared to other chapters due to having fewer potent psykers.", - value: 20, + points: 20, meta: [ "Psyker Views", "Librarians" @@ -743,7 +740,7 @@ obj_creation.all_disadvantages = []; var new_dis, cur_dis; for (var i = 0; i < array_length(all_disadvantages); i++) { cur_dis = all_disadvantages[i]; - new_dis = new Disadvantage(i, cur_dis.name, cur_dis.description, cur_dis.value); + new_dis = new Disadvantage(cur_adv); if (struct_exists(cur_dis, "meta")) { new_dis.meta = cur_dis.meta; } diff --git a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml index b7cb511581..cc91794e8d 100644 --- a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml +++ b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml @@ -1,10 +1,9 @@ -function ChapterTrait(_id, _name, _description, _points_cost, _meta = []) constructor { - id = _id; - name = _name; - description = _description; - points = _points_cost; +function ChapterTrait(trait) constructor { + effects = ""; + meta = []; + move_data_to_current_scope(trait); disabled = false; - meta = _meta; + static add_meta = function() { for (var i = 0; i < array_length(meta); i++) { @@ -34,7 +33,11 @@ function ChapterTrait(_id, _name, _description, _points_cost, _meta = []) constr }; } -function Advantage(_id, _name, _description, _points_cost) : ChapterTrait(_id, _name, _description, _points_cost) constructor { +function Advantage(trait) : ChapterTrait(trait) constructor { + static id_start = 1 + LOGGER.info(id_start); + id = id_start; + id_start++; static add = function(slot) { obj_creation.adv[slot] = name; obj_creation.adv_num[slot] = id; @@ -63,7 +66,11 @@ function Advantage(_id, _name, _description, _points_cost) : ChapterTrait(_id, _ }; } -function Disadvantage(_id, _name, _description, _points_cost) : ChapterTrait(_id, _name, _description, _points_cost) constructor { +function Disadvantage(trait) : ChapterTrait(trait) constructor { + static id_start = 1 + LOGGER.info(id_start); + id = id_start; + id_start++; static add = function(slot) { obj_creation.dis[slot] = name; obj_creation.dis_num[slot] = id; diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 58a29193ed..2a2c69b9a5 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -112,6 +112,13 @@ function PlanetData(planet, system) constructor{ refresh_data(); + static new_governor = function(){ + + p_governor[planet] = new GovernorProfile(); + governor = p_governor[planet]; + return governor; + } + static total_corruption = function(){ return secret_corruption + corruption; } @@ -121,7 +128,7 @@ function PlanetData(planet, system) constructor{ player_forces = system.p_player[planet]; } - function add_operatives(new_ops){ + static add_operatives = function(new_ops){ array_push(system.p_operatives[planet], new_ops); operatives = system.p_operatives[planet]; } @@ -304,7 +311,7 @@ function PlanetData(planet, system) constructor{ //type 1 is install a sympathectic else it's a straight serf installation if (assaination_type == 1){ var _discovery_rate = 10; - set_player_disposition(70 + floor(random_range(5, 15)) + 1); + set_player_disposition(70 + irandom_range(75, 90)); var _text = $"Many of the successors for {name()} are removed or otherwise made indisposed. Your chapter ensures that the new Planetary Governor is sympathetic to your plight and more than willing to heed your advice. A powerful new ally may be in the making."; scr_event_log("", $"Planetary Governor of {name()} assassinated. A more suitable Governor is installed."); } else { @@ -696,7 +703,7 @@ function PlanetData(planet, system) constructor{ if (_priests.number > 0){ if (_priests.number == _techmarines.number){ - text = "Without any technical staff wholly loyal to the chapter the Tech Priests Quickly set too Work sequestering any valuable resources for the Omnissiah."; + text = "Without any technical staff wholly loyal to the chapter the Tech Priests Quickly set to Work sequestering any valuable resources for the Omnissiah."; text += "By the time you have begun working in earnest your forces become aware that the Tech Priests have already catalogued any and all items of interest and begun transmitting their findings to the mechanicus."; text += "\n\nThere is nothing that can easily be done"; scr_popup("Mars Control", text, "mechanicus"); diff --git a/scripts/scr_creation_draw_slides/scr_creation_draw_slides.gml b/scripts/scr_creation_draw_slides/scr_creation_draw_slides.gml index 84fc08bb5e..a43d4508b8 100644 --- a/scripts/scr_creation_draw_slides/scr_creation_draw_slides.gml +++ b/scripts/scr_creation_draw_slides/scr_creation_draw_slides.gml @@ -629,6 +629,9 @@ function draw_chapter_trait_select() { var cur_adv = obj_creation.all_advantages[adv_num[i]]; tooltip = $"{cur_adv.name} ({cur_adv.points} Points)"; tooltip2 = cur_adv.description; + if (cur_adv.effects != ""){ + tooltip2 += "\n\n" + cur_adv.effects; + } } if (advantage_click_allow && popup == "" && mouse_button_clicked()) { if ((points < maxpoints) && (adv_num[i] == 0)) { diff --git a/scripts/scr_governors/scr_governors.gml b/scripts/scr_governors/scr_governors.gml index c4ed4010a1..906f16b5cd 100644 --- a/scripts/scr_governors/scr_governors.gml +++ b/scripts/scr_governors/scr_governors.gml @@ -41,11 +41,11 @@ function GovernorProfile() constructor{ strength = 10; luck = 10; dexterity = 10; - wisdom = irandom_range(25, 50); - piety = irandom_range(25, 60); - charisma = irandom_range(25, 60); + wisdom = irandom_range(20, 50); + piety = irandom_range(20, 60); + charisma = irandom_range(20, 60); technology = irandom_range(10, 40); - intelligence = irandom_range(25, 50); + intelligence = irandom_range(20, 50); weapon_skill = 5; ballistic_skill = 5; diff --git a/scripts/scr_mission_functions/scr_mission_functions.gml b/scripts/scr_mission_functions/scr_mission_functions.gml index 017f0c4189..0ac7c8ed07 100644 --- a/scripts/scr_mission_functions/scr_mission_functions.gml +++ b/scripts/scr_mission_functions/scr_mission_functions.gml @@ -805,7 +805,7 @@ function deliver_trophy_end_turn_check(){ _marine.add_epithet({ title : _marine_epithet, - story : $"Slew a mighty beast in {fleetevent_data.system} after harvesting the {pop_data.trophy_name} their exploits became legendary within the sector largly due the aderation of the {fleetevent_data.system} regiments"; + story : $"Slew a mighty beast in {fleetevent_data.system} after harvesting the {pop_data.trophy_name} their exploits became legendary within the sector largly due the aderation of the {fleetevent_data.system} regiments" }) _text += $" While The task is for the most part thankless your chapters esteem has risen greatly with the exploits of {_marine.name_role()} spreading far and wide amoung guard regiments and has garnered the epithet {_marine_epithet}."; var _roll = roll_dice_chapter(1, 100, "high"); diff --git a/scripts/scr_popup_functions/scr_popup_functions.gml b/scripts/scr_popup_functions/scr_popup_functions.gml index af5024e945..5019ad08d5 100644 --- a/scripts/scr_popup_functions/scr_popup_functions.gml +++ b/scripts/scr_popup_functions/scr_popup_functions.gml @@ -437,7 +437,7 @@ function calculate_equipment_needs() { } return floor(all_good); } - +//TODO ensure all popups have an appropriate image assigned for flavour /// @mixin function default_popup_image_index() { var _img = -1; @@ -573,20 +573,27 @@ function default_popup_image_index() { /// @mixin function allow_governor_successor() { - var randa = roll_dice_chapter(1, 100, "high"); - var randa2 = roll_dice(1, 100); - p_data.set_player_disposition(obj_controller.disposition[2] + choose(-1, -2, -3, -4, 0, 1, 2, 3, 4)); + + var _randa = roll_dice_chapter(1, 100, "high"); + var _randa2 = roll_dice(1, 100); + + var _old_governor = p_data.governor; + + var _new_governor = p_data.new_governor(); + var _newdisp = 0; var _text_last = ""; - if (randa <= 3) { - var _newdisp = min(p_data.player_disposition, choose(1, 2, 3, 4, 5, 6) * 3); + if (_randa <= 3) { + _newdisp = min(p_data.player_disposition, irandom_range(3, 18)); p_data.set_player_disposition(_newdisp); _text_last = "Regrettably he has a dim view of your chapter"; } - if (randa >= 95) { - _newdisp = max(p_data.player_disposition, 60 + choose(1, 2, 3, 4, 5, 6) * 3); + else if (_randa >= 95) { + _newdisp = max(p_data.player_disposition, irandom_range(63, 78)); p_data.set_player_disposition(_newdisp); _text_last = "Fortunately you already have good relations with the new governor"; + } else { + p_data.set_player_disposition(obj_controller.disposition[2] + irandom_range(-8,8)); } scr_event_log("", $"Planetary Governor of {p_data.name()} assassinated. The next in line takes over."); From ff67aef8394871a2bf8e4f5e461a5c6993dde61c Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Tue, 28 Apr 2026 01:17:05 +0100 Subject: [PATCH 81/93] previously spotted typo --- scripts/scr_event_code/scr_event_code.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/scr_event_code/scr_event_code.gml b/scripts/scr_event_code/scr_event_code.gml index 2bfb2e7f66..0564e43375 100644 --- a/scripts/scr_event_code/scr_event_code.gml +++ b/scripts/scr_event_code/scr_event_code.gml @@ -38,7 +38,7 @@ function event_remove_player_serf(_event) { var _planet = _event.planet; if (_event_star != "none") { _event_star.dispo[_planet] = -10; // Resets - var twix = $"Inquisition executes Chapter Serf in control of {pllanet_numera_name(planet, _event_star)} and installs a new Planetary Governor."; + var twix = $"Inquisition executes Chapter Serf in control of {planet_numeral_name(_planet, _event_star)} and installs a new Planetary Governor."; if (_event_star.p_owner[_planet] == eFACTION.PLAYER) { _event_star.p_owner[_planet] = _event_star.p_first[_planet]; } From ad2257235e376612bcb4e943daa7a99257e48afc Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 2 May 2026 17:17:45 +0100 Subject: [PATCH 82/93] port unit group --- ChapterMaster.yyp | 3 +- scripts/is_specialist/is_specialist.gml | 243 ----------- scripts/macros/macros.gml | 8 +- .../scr_ChapterTraits/scr_ChapterTraits.gml | 2 +- scripts/scr_UnitGroup/scr_UnitGroup.gml | 412 ++++++++++++++++++ scripts/scr_UnitGroup/scr_UnitGroup.yy | 13 + .../scr_logging_functions.gml | 6 +- 7 files changed, 435 insertions(+), 252 deletions(-) create mode 100644 scripts/scr_UnitGroup/scr_UnitGroup.gml create mode 100644 scripts/scr_UnitGroup/scr_UnitGroup.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index 9c9f5eb452..c07c741619 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -600,7 +600,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.1400.5.1052", + "IDEVersion":"2024.1400.5.1055", }, "name":"ChapterMaster", "resources":[ @@ -968,6 +968,7 @@ {"id":{"name":"scr_unit_size","path":"scripts/scr_unit_size/scr_unit_size.yy",},}, {"id":{"name":"scr_unit_spawn_functions","path":"scripts/scr_unit_spawn_functions/scr_unit_spawn_functions.yy",},}, {"id":{"name":"scr_unit_traits","path":"scripts/scr_unit_traits/scr_unit_traits.yy",},}, + {"id":{"name":"scr_UnitGroup","path":"scripts/scr_UnitGroup/scr_UnitGroup.yy",},}, {"id":{"name":"scr_uuid_generate","path":"scripts/scr_uuid_generate/scr_uuid_generate.yy",},}, {"id":{"name":"scr_vehicle_count","path":"scripts/scr_vehicle_count/scr_vehicle_count.yy",},}, {"id":{"name":"scr_vehicle_helpers","path":"scripts/scr_vehicle_helpers/scr_vehicle_helpers.yy",},}, diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index 309f858676..bad2f29b03 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -209,246 +209,3 @@ function is_specialist(unit_role, type = SPECIALISTS_STANDARD, include_trainee = return array_contains(_specialists, unit_role); } - -//TODO write this out with proper formatting when i can be assed -//Used to quikcly collect groups of marines with given parameters -// group takes a string relating to options in the role_groups function, to ignore filtering by group use "all" -// can also pass an array to filter for mutiple groups -// location takes wther a string with a system name or an array with 3 parameters [,,] -// if opposite is true then then the roles defined in the group argument are ignored and all others collected -// search conditions -// companies, takes either an int or an arrat to define which companies to search in -// any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines -// job allows you to find marines forfuling certain tasks like garrison or forge etc - -function collect_role_group(group = SPECIALISTS_STANDARD, location = "", opposite = false, search_conditions = {companies: "all"}) { - var _units = [], unit, count = 0, _add = false, _is_special_group; - var _max_count = 0; - var _total_count = 0; - if (struct_exists(search_conditions, "max")) { - _max_count = search_conditions.max; - } - if (!struct_exists(search_conditions, "companies")) { - search_conditions.companies = "all"; - } - for (var com = 0; com <= 10; com++) { - if (_max_count > 0) { - if (array_length(_units) >= _max_count) { - break; - } - } - var _wanted_companies = search_conditions.companies; - if (_wanted_companies != "all") { - if (is_array(_wanted_companies)) { - if (!array_contains(_wanted_companies, com)) { - continue; - } - } else { - if (_wanted_companies != com) { - continue; - } - } - } - for (var i = 0; i < array_length(obj_ini.TTRPG[com]); i++) { - if (_max_count > 0) { - if (array_length(_units) >= _max_count) { - break; - } - } - if (array_length(_units)) { - _add = false; - } - unit = fetch_unit([com, i]); - if (unit.name() == "") { - continue; - } - if (group != "all") { - if (is_array(group)) { - if (array_length(group) == 3) { - _is_special_group = unit.IsSpecialist(group[0], group[1], group[2]); - } else { - _is_special_group = unit.IsSpecialist(group[0], group[1]); - } - } else { - _is_special_group = unit.IsSpecialist(group); - } - } else { - _is_special_group = true; - } - if ((_is_special_group && !opposite) || (!_is_special_group && opposite)) { - if (location == "") { - _add = true; - } else if (!is_array(location)) { - _add = unit.is_at_location(location); - } else { - _add = unit.is_at_location(location[0], location[1], location[2]); - } - } - if (_add) { - if (struct_exists(search_conditions, "stat")) { - _add = stat_valuator(search_conditions.stat, unit); - } - if (struct_exists(search_conditions, "job")) { - _add = unit.assignment() == search_conditions.job; - } - } - if (_add) { - array_push(_units, obj_ini.TTRPG[com][i]); - } - } - } - return _units; -} - -function stat_valuator(search_params, unit) { - var match = true; - for (var stat = 0; stat < array_length(search_params); stat++) { - var _stat_val = search_params[stat]; - if (!struct_exists(unit, _stat_val[0])) { - match = false; - break; - } - switch (_stat_val[2]) { - case "inmore": - case "more": - if (unit[$ _stat_val[0]] < _stat_val[1]) { - match = false; - break; - } - break; - - case "exmore": - if (unit[$ _stat_val[0]] <= _stat_val[1]) { - match = false; - break; - } - break; - - case "inless": - case "less": - if (unit[$ _stat_val[0]] > _stat_val[1]) { - match = false; - break; - } - break; - - case "exless": - if (unit[$ _stat_val[0]] >= _stat_val[1]) { - match = false; - break; - } - break; - } - } - return match; -} - -function collect_by_religeon(religion, sub_cult = "", location = "") { - var _units = [], unit, count = 0, _add = false; - for (var com = 0; com <= 10; com++) { - for (var i = 1; i < array_length(obj_ini.TTRPG[com]); i++) { - _add = false; - unit = obj_ini.TTRPG[com][i]; - if (unit.name() == "") { - continue; - } - if (unit.religion == religion) { - if (sub_cult != "") { - if (unit.religion_sub_cult != "sub_cult") { - continue; - } - } - if (location == "") { - _add = true; - } else if (unit.is_at_location(location)) { - _add = true; - } - } - if (_add) { - array_push(_units, obj_ini.TTRPG[com][i]); - } - } - } - return _units; -} - -/// @description Processes the selection of units based on group parameters and updates controller data -/// @param {array} group The array of units to process for selection -/// @param {struct} selection_data Data structure containing selection parameters and state - -enum eMISSION_SELECT_TYPE { - UNITS, - SQUADS, -} - -function group_selection(group, selection_data = {}) { - try { - var unit, s, unit_location; - obj_controller.selection_data = selection_data; - set_zoom_to_default(); - with (obj_controller) { - if (menu != eMENU.MANAGE) { - scr_toggle_manage(); - } else { - basic_manage_settings(); - } - - exit_button = new ShutterButton(); - proceed_button = new ShutterButton(); - selection_data.start_count = 0; - instance_destroy(obj_managment_panel); - if (!struct_exists(selection_data, "select_type")) { - selection_data.select_type = eMISSION_SELECT_TYPE.UNITS; - } - // Resets selections for next turn - scr_ui_refresh(); - managing = -1; - new_company_struct(); - var vehicles = []; - for (var i = 0; i < array_length(group); i++) { - if (!is_struct(group[i])) { - if (is_array(group[i])) { - array_push(vehicles, group[i]); - } - continue; - } - unit = group[i]; - add_man_to_manage_arrays(unit); - - if (selection_data.purpose_code == "forge_assignment") { - if (unit.job != "none") { - if (unit.job.type == "forge" && unit.job.planet == selection_data.planet) { - man_sel[array_length(display_unit) - 1] = 1; - man_size++; - selection_data.start_count++; - } - } - } - } - var last_vehicle = 0; - if (array_length(vehicles) > 0) { - for (var veh = 0; veh < array_length(vehicles); veh++) { - unit = vehicles[veh]; - add_vehicle_to_manage_arrays(unit); - } - } - other_manage_data(); - man_current = 0; - man_max = MANAGE_MAN_MAX; - - if (selection_data.select_type == eMISSION_SELECT_TYPE.SQUADS) { - new_company_struct(); - company_data.has_squads = true; - company_data.squad_location = selection_data.system.name; - company_data.squad_search(); - managing = -1; - } - } - LOGGER.debug($"manage_success {obj_controller.menu}"); - } - catch (_exception) { - //handle and send player back to map - handle_exception(_exception); - scr_toggle_manage(); - } -} diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index 8103ddab0b..4b123ab58a 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -2,10 +2,10 @@ #macro DEFAULT_TOOLTIP_VIEW_OFFSET 32 #macro DEFAULT_LINE_GAP -1 #macro LB_92 "############################################################################################" -#macro DATE_TIME_1 $"{current_day}-{current_month}-{current_year}-{format_time(current_hour)}{format_time(current_minute)}{format_time(format_time(current_second))}" -#macro DATE_TIME_2 $"{current_day}-{current_month}-{current_year}|{format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" -#macro DATE_TIME_3 $"{current_day}-{current_month}-{current_year} {format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" -#macro TIME_1 $"{format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" +#macro DATE_TIME_1 current_day"-"current_month"-"current_year"-"format_time(current_hour)""format_time(current_minute)""format_time(format_time(current_second))"" +#macro DATE_TIME_2 current_day"-"current_month"-"current_year"|"format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" +#macro DATE_TIME_3 current_day"-"current_month"-"current_year" "format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" +#macro TIME_1 format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" #macro CM_GREEN_COLOR #34bc75 #macro CM_RED_COLOR #bf4040 #macro COL_REQUISITION #2398F8 diff --git a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml index 5ad90d5020..0c818cccad 100644 --- a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml +++ b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml @@ -149,7 +149,7 @@ function ChapterTrait(trait) constructor { } if (suspicion != 0){ - _str += $"Suspicion: { string_plus_minus(suspicion) }{suspicion}\n"; + _str += $"Suspicion: { string_plus_minus(suspicion)}{suspicion}\n"; } if (array_length(character_spawn_increase)){ diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.gml b/scripts/scr_UnitGroup/scr_UnitGroup.gml new file mode 100644 index 0000000000..16021cc5d6 --- /dev/null +++ b/scripts/scr_UnitGroup/scr_UnitGroup.gml @@ -0,0 +1,412 @@ + +function UnitGroup(units) constructor{ + self.units = units; + + static number = function(){ + return array_length(units); + } + + static has_role = function(role){ + for (var i=0;i,,] +// if opposite is true then then the roles defined in the group argument are ignored and all others collected +// search conditions + // companies, takes either an int or an arrat to define which companies to search in + // any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines + // job allows you to find marines forfuling certain tasks like garrison or forge etc + +function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=false, search_conditions = {companies:"all"}){ + var _units = [], unit, count=0, _add=false, _is_special_group; + var _max_count = 0; + var _total_count = 0; + if (struct_exists(search_conditions, "max")){ + _max_count = search_conditions.max; + search_conditions.max_wanted = search_conditions.max; + } + search_conditions.group = group; + search_conditions.location = location; + search_conditions.opposite = opposite; + + var _conditions = new SearchConditions(search_conditions); + for (var com=0;com<=10;com++){ + if (_max_count>0){ + if (array_length(_units)>=_max_count){ + break; + } + } + var _wanted_companies = search_conditions.companies; + if (_wanted_companies!="all"){ + if (is_array(_wanted_companies)){ + if (!array_contains(_wanted_companies, com)){ + continue; + } + } else { + if (_wanted_companies != com){ + continue; + } + } + } + for (var i=0;i 0){ + found = 0; + } + + end_loop = false; + } + + update_constants(data); + + static oposite_switch = function(val){ + return opposite ? !val : val; + } + + static company_evaluate = function(){ + var _add = true; + if (search_companies){ + if (search_multiple_companies){ + if (!array_contains(_wanted_companies, unit.company)){ + _add = false; + } + } else { + if (_wanted_companies != unit.company){ + _add = false; + } + } + _add = oposite_switch(_add); + } + + return _add; + } + + static group_evaluate = function(){ + + var _add = true; + if (group!="all"){ + var _group = group; + if (group_is_array){ + if (group_search_heads) { + _add = unit.IsSpecialist(_group[0], _group[1], _group[2]); + } else { + _add = unit.IsSpecialist(_group[0], _group[1]); + } + } else { + _add = unit.IsSpecialist(_group); + } + _add = oposite_switch(_add); + } + return _add; + } + + static location_evaluate = function(){ + var _add = true; + if (location!=""){ + if (!complex_location){ + _add = unit.is_at_location(location); + } else { + _add = unit.is_at_location(location[0], location[1], location[2]); + } + _add = oposite_switch(_add); + } + + return _add; + } + + static checks_order = [ + company_evaluate, + group_evaluate, + location_evaluate + ]; + + + static evaluate = function(unit){ + self.unit = unit; + if (unit.name()==""){ + return false; + } + + var _add = true; + for (var i=0;i 0 && _add){ + found++; + if (found > max_wanted){ + _add = false; + end_loop = true; + } + } + + + return _add; + } + +} + +function stat_valuator(search_params, unit) { + var match = true; + for (var stat = 0; stat < array_length(search_params); stat++) { + var _stat_val = search_params[stat]; + if (!struct_exists(unit, _stat_val[0])) { + match = false; + break; + } + switch (_stat_val[2]) { + case "inmore": + case "more": + if (unit[$ _stat_val[0]] < _stat_val[1]) { + match = false; + break; + } + break; + + case "exmore": + if (unit[$ _stat_val[0]] <= _stat_val[1]) { + match = false; + break; + } + break; + + case "inless": + case "less": + if (unit[$ _stat_val[0]] > _stat_val[1]) { + match = false; + break; + } + break; + + case "exless": + if (unit[$ _stat_val[0]] >= _stat_val[1]) { + match = false; + break; + } + break; + } + } + return match; +} + +function collect_by_religeon(religion, sub_cult = "", location = "") { + var _units = [], unit, count = 0, _add = false; + for (var com = 0; com <= 10; com++) { + for (var i = 1; i < array_length(obj_ini.TTRPG[com]); i++) { + _add = false; + unit = obj_ini.TTRPG[com][i]; + if (unit.name() == "") { + continue; + } + if (unit.religion == religion) { + if (sub_cult != "") { + if (unit.religion_sub_cult != "sub_cult") { + continue; + } + } + if (location == "") { + _add = true; + } else if (unit.is_at_location(location)) { + _add = true; + } + } + if (_add) { + array_push(_units, obj_ini.TTRPG[com][i]); + } + } + } + return _units; +} + +/// @description Processes the selection of units based on group parameters and updates controller data +/// @param {array} group The array of units to process for selection +/// @param {struct} selection_data Data structure containing selection parameters and state + + +/// @description Processes the selection of units based on group parameters and updates controller data +/// @param {array} group The array of units to process for selection +/// @param {struct} selection_data Data structure containing selection parameters and state + +enum eMISSION_SELECT_TYPE { + UNITS, + SQUADS, +} + +function group_selection(group, selection_data = {}) { + try { + var unit, s, unit_location; + obj_controller.selection_data = selection_data; + set_zoom_to_default(); + with (obj_controller) { + if (menu != eMENU.MANAGE) { + scr_toggle_manage(); + } else { + basic_manage_settings(); + } + + exit_button = new ShutterButton(); + proceed_button = new ShutterButton(); + selection_data.start_count = 0; + instance_destroy(obj_managment_panel); + if (!struct_exists(selection_data, "select_type")) { + selection_data.select_type = eMISSION_SELECT_TYPE.UNITS; + } + // Resets selections for next turn + scr_ui_refresh(); + managing = -1; + new_company_struct(); + var vehicles = []; + for (var i = 0; i < array_length(group); i++) { + if (!is_struct(group[i])) { + if (is_array(group[i])) { + array_push(vehicles, group[i]); + } + continue; + } + unit = group[i]; + add_man_to_manage_arrays(unit); + + if (selection_data.purpose_code == "forge_assignment") { + if (unit.job != "none") { + if (unit.job.type == "forge" && unit.job.planet == selection_data.planet) { + man_sel[array_length(display_unit) - 1] = 1; + man_size++; + selection_data.start_count++; + } + } + } + } + var last_vehicle = 0; + if (array_length(vehicles) > 0) { + for (var veh = 0; veh < array_length(vehicles); veh++) { + unit = vehicles[veh]; + add_vehicle_to_manage_arrays(unit); + } + } + other_manage_data(); + man_current = 0; + man_max = MANAGE_MAN_MAX; + + if (selection_data.select_type == eMISSION_SELECT_TYPE.SQUADS) { + new_company_struct(); + company_data.has_squads = true; + company_data.squad_location = selection_data.system.name; + company_data.squad_search(); + managing = -1; + } + } + LOGGER.debug($"manage_success {obj_controller.menu}"); + } + catch (_exception) { + //handle and send player back to map + handle_exception(_exception); + scr_toggle_manage(); + } +} \ No newline at end of file diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.yy b/scripts/scr_UnitGroup/scr_UnitGroup.yy new file mode 100644 index 0000000000..bd7695ec27 --- /dev/null +++ b/scripts/scr_UnitGroup/scr_UnitGroup.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"scr_UnitGroup", + "isCompatibility":false, + "isDnD":false, + "name":"scr_UnitGroup", + "parent":{ + "name":"marines_and_profiles", + "path":"folders/Scripts/marines_and_profiles.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/scr_logging_functions/scr_logging_functions.gml b/scripts/scr_logging_functions/scr_logging_functions.gml index 7ac740d52f..85c9fb933f 100644 --- a/scripts/scr_logging_functions/scr_logging_functions.gml +++ b/scripts/scr_logging_functions/scr_logging_functions.gml @@ -1,7 +1,7 @@ -#macro STR_ERROR_MESSAGE_HEAD $"Your game just encountered and caught an error!" -#macro STR_ERROR_MESSAGE_HEAD2 $"Your game just encountered a critical error! :(" +#macro STR_ERROR_MESSAGE_HEAD Your game just encountered and caught an error! +#macro STR_ERROR_MESSAGE_HEAD2 Your game just encountered a critical error! :( #macro STR_ERROR_MESSAGE_HEAD3 "Your game just encountered and caught an error! ({0})" -#macro STR_ERROR_MESSAGE_PS $"P.S. You can ALT-TAB and try to continue playing, though it’s recommended to wait for a response in the bug-report forum." +#macro STR_ERROR_MESSAGE_PS P.S. You can ALT-TAB and try to continue playing, though it’s recommended to wait for a response in the bug-report forum. #macro ERR_LOG_DIRECTORY "Logs/" #macro ERR_PATH_LAST_MESSAGES "last_messages.log" From 0964a5fe07b8b363af77f6eb65926dfd060f2d7f Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 2 May 2026 17:21:35 +0100 Subject: [PATCH 83/93] marine grouop migrationo --- ChapterMaster.yyp | 3 +- .../scr_UnitGroup_and_group_selection.gml | 402 ------------------ .../scr_UnitGroup_and_group_selection.yy | 13 - 3 files changed, 1 insertion(+), 417 deletions(-) delete mode 100644 scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml delete mode 100644 scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index 12474171e5..332cf5aa51 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -600,7 +600,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.1400.5.1052", + "IDEVersion":"2024.1400.5.1055", }, "name":"ChapterMaster", "resources":[ @@ -973,7 +973,6 @@ {"id":{"name":"scr_unit_size","path":"scripts/scr_unit_size/scr_unit_size.yy",},}, {"id":{"name":"scr_unit_spawn_functions","path":"scripts/scr_unit_spawn_functions/scr_unit_spawn_functions.yy",},}, {"id":{"name":"scr_unit_traits","path":"scripts/scr_unit_traits/scr_unit_traits.yy",},}, - {"id":{"name":"scr_UnitGroup_and_group_selection","path":"scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy",},}, {"id":{"name":"scr_uuid_generate","path":"scripts/scr_uuid_generate/scr_uuid_generate.yy",},}, {"id":{"name":"scr_vehicle_count","path":"scripts/scr_vehicle_count/scr_vehicle_count.yy",},}, {"id":{"name":"scr_vehicle_helpers","path":"scripts/scr_vehicle_helpers/scr_vehicle_helpers.yy",},}, diff --git a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml deleted file mode 100644 index 9276fc9794..0000000000 --- a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.gml +++ /dev/null @@ -1,402 +0,0 @@ -//TODO write this out with proper formatting when i can be assed -//Used to quikcly collect groups of marines with given parameters -// group takes a string relating to options in the role_groups function, to ignore filtering by group use "all" - // can also pass an array to filter for mutiple groups -// location takes wther a string with a system name or an array with 3 parameters [,,] -// if opposite is true then then the roles defined in the group argument are ignored and all others collected -// search conditions - // companies, takes either an int or an arrat to define which companies to search in - // any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines - // job allows you to find marines forfuling certain tasks like garrison or forge etc - -function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=false, search_conditions = {companies:"all"}){ - var _units = [], unit, count=0, _add=false, _is_special_group; - var _max_count = 0; - var _total_count = 0; - if (struct_exists(search_conditions, "max")){ - _max_count = search_conditions.max; - search_conditions.max_wanted = search_conditions.max; - } - search_conditions.group = group; - search_conditions.location = location; - search_conditions.opposite = opposite; - - var _conditions = new SearchConditions(search_conditions); - for (var com=0;com<=10;com++){ - if (_max_count>0){ - if (array_length(_units)>=_max_count){ - break; - } - } - var _wanted_companies = search_conditions.companies; - if (_wanted_companies!="all"){ - if (is_array(_wanted_companies)){ - if (!array_contains(_wanted_companies, com)){ - continue; - } - } else { - if (_wanted_companies != com){ - continue; - } - } - } - for (var i=0;i 0){ - found = 0; - } - - end_loop = false; - } - - update_constants(data); - - static oposite_switch = function(val){ - return opposite ? !val : val; - } - - static company_evaluate = function(){ - var _add = true; - if (search_companies){ - if (search_multiple_companies){ - if (!array_contains(_wanted_companies, unit.company)){ - _add = false; - } - } else { - if (_wanted_companies != unit.company){ - _add = false; - } - } - _add = oposite_switch(_add); - } - - return _add; - } - - static group_evaluate = function(){ - - var _add = true; - if (group!="all"){ - var _group = group; - if (group_is_array){ - if (group_search_heads) { - _add = unit.IsSpecialist(_group[0], _group[1], _group[2]); - } else { - _add = unit.IsSpecialist(_group[0], _group[1]); - } - } else { - _add = unit.IsSpecialist(_group); - } - _add = oposite_switch(_add); - } - return _add; - } - - static location_evaluate = function(){ - var _add = true; - if (location!=""){ - if (!complex_location){ - _add=unit.is_at_location(location); - } else { - _add=unit.is_at_location(location[0], location[1], location[2]); - } - _add = oposite_switch(_add); - } - - return _add; - } - - static checks_order = [ - company_evaluate, - group_evaluate, - location_evaluate - ]; - - - static evaluate = function(unit){ - self.unit = unit; - if (unit.name()==""){ - return false; - } - - var _add = true; - for (var i=0;i 0 && _add){ - found++; - if (found > max_wanted){ - _add = false; - end_loop = true; - } - } - - - return _add; - } - -} - - -function UnitGroup(units) constructor{ - self.units = units; - - static number = function(){ - return array_length(units); - } - - static has_role = function(role){ - for (var i=0;i _stat_val[1]){ - match = false; - break; - } - break; - - case "exless": - if (unit[$ _stat_val[0]] >= _stat_val[1]){ - match = false; - break; - } - break; - } - } - return match; -} - -function collect_by_religeon(religion, sub_cult="", location=""){ - var _units = [], unit, count=0, _add=false; - for (var com=0;com<=10;com++){ - for (var i=1;i 0) { - for (var veh = 0; veh < array_length(vehicles); veh++) { - unit = vehicles[veh]; - add_vehicle_to_manage_arrays(unit); - } - } - other_manage_data(); - man_current = 0; - man_max = MANAGE_MAN_MAX; - - if (selection_data.select_type == MissionSelectType.Squads){ - new_company_struct(); - company_data.has_squads = true; - company_data.squad_location = selection_data.system.name; - company_data.squad_search(); - managing = -1; - } - } - } catch (_exception) { - //handle and send player back to map - handle_exception(_exception); - scr_toggle_manage(); - } -} \ No newline at end of file diff --git a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy b/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy deleted file mode 100644 index 2d2594c762..0000000000 --- a/scripts/scr_UnitGroup_and_group_selection/scr_UnitGroup_and_group_selection.yy +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$GMScript":"v1", - "%Name":"scr_UnitGroup_and_group_selection", - "isCompatibility":false, - "isDnD":false, - "name":"scr_UnitGroup_and_group_selection", - "parent":{ - "name":"marines_and_profiles", - "path":"folders/Scripts/marines_and_profiles.yy", - }, - "resourceType":"GMScript", - "resourceVersion":"2.0", -} \ No newline at end of file From 2b5e9243f5ccda5210fb00769c581cdc31aed2e2 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 2 May 2026 17:36:21 +0100 Subject: [PATCH 84/93] Revert "port unit group" This reverts commit ad2257235e376612bcb4e943daa7a99257e48afc. --- ChapterMaster.yyp | 3 +- scripts/is_specialist/is_specialist.gml | 243 +++++++++++ scripts/macros/macros.gml | 8 +- .../scr_ChapterTraits/scr_ChapterTraits.gml | 2 +- scripts/scr_UnitGroup/scr_UnitGroup.gml | 412 ------------------ scripts/scr_UnitGroup/scr_UnitGroup.yy | 13 - .../scr_logging_functions.gml | 6 +- 7 files changed, 252 insertions(+), 435 deletions(-) delete mode 100644 scripts/scr_UnitGroup/scr_UnitGroup.gml delete mode 100644 scripts/scr_UnitGroup/scr_UnitGroup.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index c07c741619..9c9f5eb452 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -600,7 +600,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.1400.5.1055", + "IDEVersion":"2024.1400.5.1052", }, "name":"ChapterMaster", "resources":[ @@ -968,7 +968,6 @@ {"id":{"name":"scr_unit_size","path":"scripts/scr_unit_size/scr_unit_size.yy",},}, {"id":{"name":"scr_unit_spawn_functions","path":"scripts/scr_unit_spawn_functions/scr_unit_spawn_functions.yy",},}, {"id":{"name":"scr_unit_traits","path":"scripts/scr_unit_traits/scr_unit_traits.yy",},}, - {"id":{"name":"scr_UnitGroup","path":"scripts/scr_UnitGroup/scr_UnitGroup.yy",},}, {"id":{"name":"scr_uuid_generate","path":"scripts/scr_uuid_generate/scr_uuid_generate.yy",},}, {"id":{"name":"scr_vehicle_count","path":"scripts/scr_vehicle_count/scr_vehicle_count.yy",},}, {"id":{"name":"scr_vehicle_helpers","path":"scripts/scr_vehicle_helpers/scr_vehicle_helpers.yy",},}, diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index bad2f29b03..309f858676 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -209,3 +209,246 @@ function is_specialist(unit_role, type = SPECIALISTS_STANDARD, include_trainee = return array_contains(_specialists, unit_role); } + +//TODO write this out with proper formatting when i can be assed +//Used to quikcly collect groups of marines with given parameters +// group takes a string relating to options in the role_groups function, to ignore filtering by group use "all" +// can also pass an array to filter for mutiple groups +// location takes wther a string with a system name or an array with 3 parameters [,,] +// if opposite is true then then the roles defined in the group argument are ignored and all others collected +// search conditions +// companies, takes either an int or an arrat to define which companies to search in +// any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines +// job allows you to find marines forfuling certain tasks like garrison or forge etc + +function collect_role_group(group = SPECIALISTS_STANDARD, location = "", opposite = false, search_conditions = {companies: "all"}) { + var _units = [], unit, count = 0, _add = false, _is_special_group; + var _max_count = 0; + var _total_count = 0; + if (struct_exists(search_conditions, "max")) { + _max_count = search_conditions.max; + } + if (!struct_exists(search_conditions, "companies")) { + search_conditions.companies = "all"; + } + for (var com = 0; com <= 10; com++) { + if (_max_count > 0) { + if (array_length(_units) >= _max_count) { + break; + } + } + var _wanted_companies = search_conditions.companies; + if (_wanted_companies != "all") { + if (is_array(_wanted_companies)) { + if (!array_contains(_wanted_companies, com)) { + continue; + } + } else { + if (_wanted_companies != com) { + continue; + } + } + } + for (var i = 0; i < array_length(obj_ini.TTRPG[com]); i++) { + if (_max_count > 0) { + if (array_length(_units) >= _max_count) { + break; + } + } + if (array_length(_units)) { + _add = false; + } + unit = fetch_unit([com, i]); + if (unit.name() == "") { + continue; + } + if (group != "all") { + if (is_array(group)) { + if (array_length(group) == 3) { + _is_special_group = unit.IsSpecialist(group[0], group[1], group[2]); + } else { + _is_special_group = unit.IsSpecialist(group[0], group[1]); + } + } else { + _is_special_group = unit.IsSpecialist(group); + } + } else { + _is_special_group = true; + } + if ((_is_special_group && !opposite) || (!_is_special_group && opposite)) { + if (location == "") { + _add = true; + } else if (!is_array(location)) { + _add = unit.is_at_location(location); + } else { + _add = unit.is_at_location(location[0], location[1], location[2]); + } + } + if (_add) { + if (struct_exists(search_conditions, "stat")) { + _add = stat_valuator(search_conditions.stat, unit); + } + if (struct_exists(search_conditions, "job")) { + _add = unit.assignment() == search_conditions.job; + } + } + if (_add) { + array_push(_units, obj_ini.TTRPG[com][i]); + } + } + } + return _units; +} + +function stat_valuator(search_params, unit) { + var match = true; + for (var stat = 0; stat < array_length(search_params); stat++) { + var _stat_val = search_params[stat]; + if (!struct_exists(unit, _stat_val[0])) { + match = false; + break; + } + switch (_stat_val[2]) { + case "inmore": + case "more": + if (unit[$ _stat_val[0]] < _stat_val[1]) { + match = false; + break; + } + break; + + case "exmore": + if (unit[$ _stat_val[0]] <= _stat_val[1]) { + match = false; + break; + } + break; + + case "inless": + case "less": + if (unit[$ _stat_val[0]] > _stat_val[1]) { + match = false; + break; + } + break; + + case "exless": + if (unit[$ _stat_val[0]] >= _stat_val[1]) { + match = false; + break; + } + break; + } + } + return match; +} + +function collect_by_religeon(religion, sub_cult = "", location = "") { + var _units = [], unit, count = 0, _add = false; + for (var com = 0; com <= 10; com++) { + for (var i = 1; i < array_length(obj_ini.TTRPG[com]); i++) { + _add = false; + unit = obj_ini.TTRPG[com][i]; + if (unit.name() == "") { + continue; + } + if (unit.religion == religion) { + if (sub_cult != "") { + if (unit.religion_sub_cult != "sub_cult") { + continue; + } + } + if (location == "") { + _add = true; + } else if (unit.is_at_location(location)) { + _add = true; + } + } + if (_add) { + array_push(_units, obj_ini.TTRPG[com][i]); + } + } + } + return _units; +} + +/// @description Processes the selection of units based on group parameters and updates controller data +/// @param {array} group The array of units to process for selection +/// @param {struct} selection_data Data structure containing selection parameters and state + +enum eMISSION_SELECT_TYPE { + UNITS, + SQUADS, +} + +function group_selection(group, selection_data = {}) { + try { + var unit, s, unit_location; + obj_controller.selection_data = selection_data; + set_zoom_to_default(); + with (obj_controller) { + if (menu != eMENU.MANAGE) { + scr_toggle_manage(); + } else { + basic_manage_settings(); + } + + exit_button = new ShutterButton(); + proceed_button = new ShutterButton(); + selection_data.start_count = 0; + instance_destroy(obj_managment_panel); + if (!struct_exists(selection_data, "select_type")) { + selection_data.select_type = eMISSION_SELECT_TYPE.UNITS; + } + // Resets selections for next turn + scr_ui_refresh(); + managing = -1; + new_company_struct(); + var vehicles = []; + for (var i = 0; i < array_length(group); i++) { + if (!is_struct(group[i])) { + if (is_array(group[i])) { + array_push(vehicles, group[i]); + } + continue; + } + unit = group[i]; + add_man_to_manage_arrays(unit); + + if (selection_data.purpose_code == "forge_assignment") { + if (unit.job != "none") { + if (unit.job.type == "forge" && unit.job.planet == selection_data.planet) { + man_sel[array_length(display_unit) - 1] = 1; + man_size++; + selection_data.start_count++; + } + } + } + } + var last_vehicle = 0; + if (array_length(vehicles) > 0) { + for (var veh = 0; veh < array_length(vehicles); veh++) { + unit = vehicles[veh]; + add_vehicle_to_manage_arrays(unit); + } + } + other_manage_data(); + man_current = 0; + man_max = MANAGE_MAN_MAX; + + if (selection_data.select_type == eMISSION_SELECT_TYPE.SQUADS) { + new_company_struct(); + company_data.has_squads = true; + company_data.squad_location = selection_data.system.name; + company_data.squad_search(); + managing = -1; + } + } + LOGGER.debug($"manage_success {obj_controller.menu}"); + } + catch (_exception) { + //handle and send player back to map + handle_exception(_exception); + scr_toggle_manage(); + } +} diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index 4b123ab58a..8103ddab0b 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -2,10 +2,10 @@ #macro DEFAULT_TOOLTIP_VIEW_OFFSET 32 #macro DEFAULT_LINE_GAP -1 #macro LB_92 "############################################################################################" -#macro DATE_TIME_1 current_day"-"current_month"-"current_year"-"format_time(current_hour)""format_time(current_minute)""format_time(format_time(current_second))"" -#macro DATE_TIME_2 current_day"-"current_month"-"current_year"|"format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" -#macro DATE_TIME_3 current_day"-"current_month"-"current_year" "format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" -#macro TIME_1 format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" +#macro DATE_TIME_1 $"{current_day}-{current_month}-{current_year}-{format_time(current_hour)}{format_time(current_minute)}{format_time(format_time(current_second))}" +#macro DATE_TIME_2 $"{current_day}-{current_month}-{current_year}|{format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" +#macro DATE_TIME_3 $"{current_day}-{current_month}-{current_year} {format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" +#macro TIME_1 $"{format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" #macro CM_GREEN_COLOR #34bc75 #macro CM_RED_COLOR #bf4040 #macro COL_REQUISITION #2398F8 diff --git a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml index 0c818cccad..5ad90d5020 100644 --- a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml +++ b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml @@ -149,7 +149,7 @@ function ChapterTrait(trait) constructor { } if (suspicion != 0){ - _str += $"Suspicion: { string_plus_minus(suspicion)}{suspicion}\n"; + _str += $"Suspicion: { string_plus_minus(suspicion) }{suspicion}\n"; } if (array_length(character_spawn_increase)){ diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.gml b/scripts/scr_UnitGroup/scr_UnitGroup.gml deleted file mode 100644 index 16021cc5d6..0000000000 --- a/scripts/scr_UnitGroup/scr_UnitGroup.gml +++ /dev/null @@ -1,412 +0,0 @@ - -function UnitGroup(units) constructor{ - self.units = units; - - static number = function(){ - return array_length(units); - } - - static has_role = function(role){ - for (var i=0;i,,] -// if opposite is true then then the roles defined in the group argument are ignored and all others collected -// search conditions - // companies, takes either an int or an arrat to define which companies to search in - // any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines - // job allows you to find marines forfuling certain tasks like garrison or forge etc - -function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=false, search_conditions = {companies:"all"}){ - var _units = [], unit, count=0, _add=false, _is_special_group; - var _max_count = 0; - var _total_count = 0; - if (struct_exists(search_conditions, "max")){ - _max_count = search_conditions.max; - search_conditions.max_wanted = search_conditions.max; - } - search_conditions.group = group; - search_conditions.location = location; - search_conditions.opposite = opposite; - - var _conditions = new SearchConditions(search_conditions); - for (var com=0;com<=10;com++){ - if (_max_count>0){ - if (array_length(_units)>=_max_count){ - break; - } - } - var _wanted_companies = search_conditions.companies; - if (_wanted_companies!="all"){ - if (is_array(_wanted_companies)){ - if (!array_contains(_wanted_companies, com)){ - continue; - } - } else { - if (_wanted_companies != com){ - continue; - } - } - } - for (var i=0;i 0){ - found = 0; - } - - end_loop = false; - } - - update_constants(data); - - static oposite_switch = function(val){ - return opposite ? !val : val; - } - - static company_evaluate = function(){ - var _add = true; - if (search_companies){ - if (search_multiple_companies){ - if (!array_contains(_wanted_companies, unit.company)){ - _add = false; - } - } else { - if (_wanted_companies != unit.company){ - _add = false; - } - } - _add = oposite_switch(_add); - } - - return _add; - } - - static group_evaluate = function(){ - - var _add = true; - if (group!="all"){ - var _group = group; - if (group_is_array){ - if (group_search_heads) { - _add = unit.IsSpecialist(_group[0], _group[1], _group[2]); - } else { - _add = unit.IsSpecialist(_group[0], _group[1]); - } - } else { - _add = unit.IsSpecialist(_group); - } - _add = oposite_switch(_add); - } - return _add; - } - - static location_evaluate = function(){ - var _add = true; - if (location!=""){ - if (!complex_location){ - _add = unit.is_at_location(location); - } else { - _add = unit.is_at_location(location[0], location[1], location[2]); - } - _add = oposite_switch(_add); - } - - return _add; - } - - static checks_order = [ - company_evaluate, - group_evaluate, - location_evaluate - ]; - - - static evaluate = function(unit){ - self.unit = unit; - if (unit.name()==""){ - return false; - } - - var _add = true; - for (var i=0;i 0 && _add){ - found++; - if (found > max_wanted){ - _add = false; - end_loop = true; - } - } - - - return _add; - } - -} - -function stat_valuator(search_params, unit) { - var match = true; - for (var stat = 0; stat < array_length(search_params); stat++) { - var _stat_val = search_params[stat]; - if (!struct_exists(unit, _stat_val[0])) { - match = false; - break; - } - switch (_stat_val[2]) { - case "inmore": - case "more": - if (unit[$ _stat_val[0]] < _stat_val[1]) { - match = false; - break; - } - break; - - case "exmore": - if (unit[$ _stat_val[0]] <= _stat_val[1]) { - match = false; - break; - } - break; - - case "inless": - case "less": - if (unit[$ _stat_val[0]] > _stat_val[1]) { - match = false; - break; - } - break; - - case "exless": - if (unit[$ _stat_val[0]] >= _stat_val[1]) { - match = false; - break; - } - break; - } - } - return match; -} - -function collect_by_religeon(religion, sub_cult = "", location = "") { - var _units = [], unit, count = 0, _add = false; - for (var com = 0; com <= 10; com++) { - for (var i = 1; i < array_length(obj_ini.TTRPG[com]); i++) { - _add = false; - unit = obj_ini.TTRPG[com][i]; - if (unit.name() == "") { - continue; - } - if (unit.religion == religion) { - if (sub_cult != "") { - if (unit.religion_sub_cult != "sub_cult") { - continue; - } - } - if (location == "") { - _add = true; - } else if (unit.is_at_location(location)) { - _add = true; - } - } - if (_add) { - array_push(_units, obj_ini.TTRPG[com][i]); - } - } - } - return _units; -} - -/// @description Processes the selection of units based on group parameters and updates controller data -/// @param {array} group The array of units to process for selection -/// @param {struct} selection_data Data structure containing selection parameters and state - - -/// @description Processes the selection of units based on group parameters and updates controller data -/// @param {array} group The array of units to process for selection -/// @param {struct} selection_data Data structure containing selection parameters and state - -enum eMISSION_SELECT_TYPE { - UNITS, - SQUADS, -} - -function group_selection(group, selection_data = {}) { - try { - var unit, s, unit_location; - obj_controller.selection_data = selection_data; - set_zoom_to_default(); - with (obj_controller) { - if (menu != eMENU.MANAGE) { - scr_toggle_manage(); - } else { - basic_manage_settings(); - } - - exit_button = new ShutterButton(); - proceed_button = new ShutterButton(); - selection_data.start_count = 0; - instance_destroy(obj_managment_panel); - if (!struct_exists(selection_data, "select_type")) { - selection_data.select_type = eMISSION_SELECT_TYPE.UNITS; - } - // Resets selections for next turn - scr_ui_refresh(); - managing = -1; - new_company_struct(); - var vehicles = []; - for (var i = 0; i < array_length(group); i++) { - if (!is_struct(group[i])) { - if (is_array(group[i])) { - array_push(vehicles, group[i]); - } - continue; - } - unit = group[i]; - add_man_to_manage_arrays(unit); - - if (selection_data.purpose_code == "forge_assignment") { - if (unit.job != "none") { - if (unit.job.type == "forge" && unit.job.planet == selection_data.planet) { - man_sel[array_length(display_unit) - 1] = 1; - man_size++; - selection_data.start_count++; - } - } - } - } - var last_vehicle = 0; - if (array_length(vehicles) > 0) { - for (var veh = 0; veh < array_length(vehicles); veh++) { - unit = vehicles[veh]; - add_vehicle_to_manage_arrays(unit); - } - } - other_manage_data(); - man_current = 0; - man_max = MANAGE_MAN_MAX; - - if (selection_data.select_type == eMISSION_SELECT_TYPE.SQUADS) { - new_company_struct(); - company_data.has_squads = true; - company_data.squad_location = selection_data.system.name; - company_data.squad_search(); - managing = -1; - } - } - LOGGER.debug($"manage_success {obj_controller.menu}"); - } - catch (_exception) { - //handle and send player back to map - handle_exception(_exception); - scr_toggle_manage(); - } -} \ No newline at end of file diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.yy b/scripts/scr_UnitGroup/scr_UnitGroup.yy deleted file mode 100644 index bd7695ec27..0000000000 --- a/scripts/scr_UnitGroup/scr_UnitGroup.yy +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$GMScript":"v1", - "%Name":"scr_UnitGroup", - "isCompatibility":false, - "isDnD":false, - "name":"scr_UnitGroup", - "parent":{ - "name":"marines_and_profiles", - "path":"folders/Scripts/marines_and_profiles.yy", - }, - "resourceType":"GMScript", - "resourceVersion":"2.0", -} \ No newline at end of file diff --git a/scripts/scr_logging_functions/scr_logging_functions.gml b/scripts/scr_logging_functions/scr_logging_functions.gml index 85c9fb933f..7ac740d52f 100644 --- a/scripts/scr_logging_functions/scr_logging_functions.gml +++ b/scripts/scr_logging_functions/scr_logging_functions.gml @@ -1,7 +1,7 @@ -#macro STR_ERROR_MESSAGE_HEAD Your game just encountered and caught an error! -#macro STR_ERROR_MESSAGE_HEAD2 Your game just encountered a critical error! :( +#macro STR_ERROR_MESSAGE_HEAD $"Your game just encountered and caught an error!" +#macro STR_ERROR_MESSAGE_HEAD2 $"Your game just encountered a critical error! :(" #macro STR_ERROR_MESSAGE_HEAD3 "Your game just encountered and caught an error! ({0})" -#macro STR_ERROR_MESSAGE_PS P.S. You can ALT-TAB and try to continue playing, though it’s recommended to wait for a response in the bug-report forum. +#macro STR_ERROR_MESSAGE_PS $"P.S. You can ALT-TAB and try to continue playing, though it’s recommended to wait for a response in the bug-report forum." #macro ERR_LOG_DIRECTORY "Logs/" #macro ERR_PATH_LAST_MESSAGES "last_messages.log" From 8543ec1cb150adf15d7733010bc175bc613f1f80 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sat, 2 May 2026 17:40:15 +0100 Subject: [PATCH 85/93] revert the revert withoout un-needed shit --- ChapterMaster.yyp | 3 +- scripts/is_specialist/is_specialist.gml | 243 ----------- scripts/macros/macros.gml | 8 +- .../scr_ChapterTraits/scr_ChapterTraits.gml | 2 +- scripts/scr_UnitGroup/scr_UnitGroup.gml | 412 ++++++++++++++++++ scripts/scr_UnitGroup/scr_UnitGroup.yy | 13 + .../scr_logging_functions.gml | 6 +- 7 files changed, 435 insertions(+), 252 deletions(-) create mode 100644 scripts/scr_UnitGroup/scr_UnitGroup.gml create mode 100644 scripts/scr_UnitGroup/scr_UnitGroup.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index 9c9f5eb452..c07c741619 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -600,7 +600,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.1400.5.1052", + "IDEVersion":"2024.1400.5.1055", }, "name":"ChapterMaster", "resources":[ @@ -968,6 +968,7 @@ {"id":{"name":"scr_unit_size","path":"scripts/scr_unit_size/scr_unit_size.yy",},}, {"id":{"name":"scr_unit_spawn_functions","path":"scripts/scr_unit_spawn_functions/scr_unit_spawn_functions.yy",},}, {"id":{"name":"scr_unit_traits","path":"scripts/scr_unit_traits/scr_unit_traits.yy",},}, + {"id":{"name":"scr_UnitGroup","path":"scripts/scr_UnitGroup/scr_UnitGroup.yy",},}, {"id":{"name":"scr_uuid_generate","path":"scripts/scr_uuid_generate/scr_uuid_generate.yy",},}, {"id":{"name":"scr_vehicle_count","path":"scripts/scr_vehicle_count/scr_vehicle_count.yy",},}, {"id":{"name":"scr_vehicle_helpers","path":"scripts/scr_vehicle_helpers/scr_vehicle_helpers.yy",},}, diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index 309f858676..bad2f29b03 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -209,246 +209,3 @@ function is_specialist(unit_role, type = SPECIALISTS_STANDARD, include_trainee = return array_contains(_specialists, unit_role); } - -//TODO write this out with proper formatting when i can be assed -//Used to quikcly collect groups of marines with given parameters -// group takes a string relating to options in the role_groups function, to ignore filtering by group use "all" -// can also pass an array to filter for mutiple groups -// location takes wther a string with a system name or an array with 3 parameters [,,] -// if opposite is true then then the roles defined in the group argument are ignored and all others collected -// search conditions -// companies, takes either an int or an arrat to define which companies to search in -// any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines -// job allows you to find marines forfuling certain tasks like garrison or forge etc - -function collect_role_group(group = SPECIALISTS_STANDARD, location = "", opposite = false, search_conditions = {companies: "all"}) { - var _units = [], unit, count = 0, _add = false, _is_special_group; - var _max_count = 0; - var _total_count = 0; - if (struct_exists(search_conditions, "max")) { - _max_count = search_conditions.max; - } - if (!struct_exists(search_conditions, "companies")) { - search_conditions.companies = "all"; - } - for (var com = 0; com <= 10; com++) { - if (_max_count > 0) { - if (array_length(_units) >= _max_count) { - break; - } - } - var _wanted_companies = search_conditions.companies; - if (_wanted_companies != "all") { - if (is_array(_wanted_companies)) { - if (!array_contains(_wanted_companies, com)) { - continue; - } - } else { - if (_wanted_companies != com) { - continue; - } - } - } - for (var i = 0; i < array_length(obj_ini.TTRPG[com]); i++) { - if (_max_count > 0) { - if (array_length(_units) >= _max_count) { - break; - } - } - if (array_length(_units)) { - _add = false; - } - unit = fetch_unit([com, i]); - if (unit.name() == "") { - continue; - } - if (group != "all") { - if (is_array(group)) { - if (array_length(group) == 3) { - _is_special_group = unit.IsSpecialist(group[0], group[1], group[2]); - } else { - _is_special_group = unit.IsSpecialist(group[0], group[1]); - } - } else { - _is_special_group = unit.IsSpecialist(group); - } - } else { - _is_special_group = true; - } - if ((_is_special_group && !opposite) || (!_is_special_group && opposite)) { - if (location == "") { - _add = true; - } else if (!is_array(location)) { - _add = unit.is_at_location(location); - } else { - _add = unit.is_at_location(location[0], location[1], location[2]); - } - } - if (_add) { - if (struct_exists(search_conditions, "stat")) { - _add = stat_valuator(search_conditions.stat, unit); - } - if (struct_exists(search_conditions, "job")) { - _add = unit.assignment() == search_conditions.job; - } - } - if (_add) { - array_push(_units, obj_ini.TTRPG[com][i]); - } - } - } - return _units; -} - -function stat_valuator(search_params, unit) { - var match = true; - for (var stat = 0; stat < array_length(search_params); stat++) { - var _stat_val = search_params[stat]; - if (!struct_exists(unit, _stat_val[0])) { - match = false; - break; - } - switch (_stat_val[2]) { - case "inmore": - case "more": - if (unit[$ _stat_val[0]] < _stat_val[1]) { - match = false; - break; - } - break; - - case "exmore": - if (unit[$ _stat_val[0]] <= _stat_val[1]) { - match = false; - break; - } - break; - - case "inless": - case "less": - if (unit[$ _stat_val[0]] > _stat_val[1]) { - match = false; - break; - } - break; - - case "exless": - if (unit[$ _stat_val[0]] >= _stat_val[1]) { - match = false; - break; - } - break; - } - } - return match; -} - -function collect_by_religeon(religion, sub_cult = "", location = "") { - var _units = [], unit, count = 0, _add = false; - for (var com = 0; com <= 10; com++) { - for (var i = 1; i < array_length(obj_ini.TTRPG[com]); i++) { - _add = false; - unit = obj_ini.TTRPG[com][i]; - if (unit.name() == "") { - continue; - } - if (unit.religion == religion) { - if (sub_cult != "") { - if (unit.religion_sub_cult != "sub_cult") { - continue; - } - } - if (location == "") { - _add = true; - } else if (unit.is_at_location(location)) { - _add = true; - } - } - if (_add) { - array_push(_units, obj_ini.TTRPG[com][i]); - } - } - } - return _units; -} - -/// @description Processes the selection of units based on group parameters and updates controller data -/// @param {array} group The array of units to process for selection -/// @param {struct} selection_data Data structure containing selection parameters and state - -enum eMISSION_SELECT_TYPE { - UNITS, - SQUADS, -} - -function group_selection(group, selection_data = {}) { - try { - var unit, s, unit_location; - obj_controller.selection_data = selection_data; - set_zoom_to_default(); - with (obj_controller) { - if (menu != eMENU.MANAGE) { - scr_toggle_manage(); - } else { - basic_manage_settings(); - } - - exit_button = new ShutterButton(); - proceed_button = new ShutterButton(); - selection_data.start_count = 0; - instance_destroy(obj_managment_panel); - if (!struct_exists(selection_data, "select_type")) { - selection_data.select_type = eMISSION_SELECT_TYPE.UNITS; - } - // Resets selections for next turn - scr_ui_refresh(); - managing = -1; - new_company_struct(); - var vehicles = []; - for (var i = 0; i < array_length(group); i++) { - if (!is_struct(group[i])) { - if (is_array(group[i])) { - array_push(vehicles, group[i]); - } - continue; - } - unit = group[i]; - add_man_to_manage_arrays(unit); - - if (selection_data.purpose_code == "forge_assignment") { - if (unit.job != "none") { - if (unit.job.type == "forge" && unit.job.planet == selection_data.planet) { - man_sel[array_length(display_unit) - 1] = 1; - man_size++; - selection_data.start_count++; - } - } - } - } - var last_vehicle = 0; - if (array_length(vehicles) > 0) { - for (var veh = 0; veh < array_length(vehicles); veh++) { - unit = vehicles[veh]; - add_vehicle_to_manage_arrays(unit); - } - } - other_manage_data(); - man_current = 0; - man_max = MANAGE_MAN_MAX; - - if (selection_data.select_type == eMISSION_SELECT_TYPE.SQUADS) { - new_company_struct(); - company_data.has_squads = true; - company_data.squad_location = selection_data.system.name; - company_data.squad_search(); - managing = -1; - } - } - LOGGER.debug($"manage_success {obj_controller.menu}"); - } - catch (_exception) { - //handle and send player back to map - handle_exception(_exception); - scr_toggle_manage(); - } -} diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index 8103ddab0b..4b123ab58a 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -2,10 +2,10 @@ #macro DEFAULT_TOOLTIP_VIEW_OFFSET 32 #macro DEFAULT_LINE_GAP -1 #macro LB_92 "############################################################################################" -#macro DATE_TIME_1 $"{current_day}-{current_month}-{current_year}-{format_time(current_hour)}{format_time(current_minute)}{format_time(format_time(current_second))}" -#macro DATE_TIME_2 $"{current_day}-{current_month}-{current_year}|{format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" -#macro DATE_TIME_3 $"{current_day}-{current_month}-{current_year} {format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" -#macro TIME_1 $"{format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" +#macro DATE_TIME_1 current_day"-"current_month"-"current_year"-"format_time(current_hour)""format_time(current_minute)""format_time(format_time(current_second))"" +#macro DATE_TIME_2 current_day"-"current_month"-"current_year"|"format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" +#macro DATE_TIME_3 current_day"-"current_month"-"current_year" "format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" +#macro TIME_1 format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" #macro CM_GREEN_COLOR #34bc75 #macro CM_RED_COLOR #bf4040 #macro COL_REQUISITION #2398F8 diff --git a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml index 5ad90d5020..0c818cccad 100644 --- a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml +++ b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml @@ -149,7 +149,7 @@ function ChapterTrait(trait) constructor { } if (suspicion != 0){ - _str += $"Suspicion: { string_plus_minus(suspicion) }{suspicion}\n"; + _str += $"Suspicion: { string_plus_minus(suspicion)}{suspicion}\n"; } if (array_length(character_spawn_increase)){ diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.gml b/scripts/scr_UnitGroup/scr_UnitGroup.gml new file mode 100644 index 0000000000..16021cc5d6 --- /dev/null +++ b/scripts/scr_UnitGroup/scr_UnitGroup.gml @@ -0,0 +1,412 @@ + +function UnitGroup(units) constructor{ + self.units = units; + + static number = function(){ + return array_length(units); + } + + static has_role = function(role){ + for (var i=0;i,,] +// if opposite is true then then the roles defined in the group argument are ignored and all others collected +// search conditions + // companies, takes either an int or an arrat to define which companies to search in + // any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines + // job allows you to find marines forfuling certain tasks like garrison or forge etc + +function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=false, search_conditions = {companies:"all"}){ + var _units = [], unit, count=0, _add=false, _is_special_group; + var _max_count = 0; + var _total_count = 0; + if (struct_exists(search_conditions, "max")){ + _max_count = search_conditions.max; + search_conditions.max_wanted = search_conditions.max; + } + search_conditions.group = group; + search_conditions.location = location; + search_conditions.opposite = opposite; + + var _conditions = new SearchConditions(search_conditions); + for (var com=0;com<=10;com++){ + if (_max_count>0){ + if (array_length(_units)>=_max_count){ + break; + } + } + var _wanted_companies = search_conditions.companies; + if (_wanted_companies!="all"){ + if (is_array(_wanted_companies)){ + if (!array_contains(_wanted_companies, com)){ + continue; + } + } else { + if (_wanted_companies != com){ + continue; + } + } + } + for (var i=0;i 0){ + found = 0; + } + + end_loop = false; + } + + update_constants(data); + + static oposite_switch = function(val){ + return opposite ? !val : val; + } + + static company_evaluate = function(){ + var _add = true; + if (search_companies){ + if (search_multiple_companies){ + if (!array_contains(_wanted_companies, unit.company)){ + _add = false; + } + } else { + if (_wanted_companies != unit.company){ + _add = false; + } + } + _add = oposite_switch(_add); + } + + return _add; + } + + static group_evaluate = function(){ + + var _add = true; + if (group!="all"){ + var _group = group; + if (group_is_array){ + if (group_search_heads) { + _add = unit.IsSpecialist(_group[0], _group[1], _group[2]); + } else { + _add = unit.IsSpecialist(_group[0], _group[1]); + } + } else { + _add = unit.IsSpecialist(_group); + } + _add = oposite_switch(_add); + } + return _add; + } + + static location_evaluate = function(){ + var _add = true; + if (location!=""){ + if (!complex_location){ + _add = unit.is_at_location(location); + } else { + _add = unit.is_at_location(location[0], location[1], location[2]); + } + _add = oposite_switch(_add); + } + + return _add; + } + + static checks_order = [ + company_evaluate, + group_evaluate, + location_evaluate + ]; + + + static evaluate = function(unit){ + self.unit = unit; + if (unit.name()==""){ + return false; + } + + var _add = true; + for (var i=0;i 0 && _add){ + found++; + if (found > max_wanted){ + _add = false; + end_loop = true; + } + } + + + return _add; + } + +} + +function stat_valuator(search_params, unit) { + var match = true; + for (var stat = 0; stat < array_length(search_params); stat++) { + var _stat_val = search_params[stat]; + if (!struct_exists(unit, _stat_val[0])) { + match = false; + break; + } + switch (_stat_val[2]) { + case "inmore": + case "more": + if (unit[$ _stat_val[0]] < _stat_val[1]) { + match = false; + break; + } + break; + + case "exmore": + if (unit[$ _stat_val[0]] <= _stat_val[1]) { + match = false; + break; + } + break; + + case "inless": + case "less": + if (unit[$ _stat_val[0]] > _stat_val[1]) { + match = false; + break; + } + break; + + case "exless": + if (unit[$ _stat_val[0]] >= _stat_val[1]) { + match = false; + break; + } + break; + } + } + return match; +} + +function collect_by_religeon(religion, sub_cult = "", location = "") { + var _units = [], unit, count = 0, _add = false; + for (var com = 0; com <= 10; com++) { + for (var i = 1; i < array_length(obj_ini.TTRPG[com]); i++) { + _add = false; + unit = obj_ini.TTRPG[com][i]; + if (unit.name() == "") { + continue; + } + if (unit.religion == religion) { + if (sub_cult != "") { + if (unit.religion_sub_cult != "sub_cult") { + continue; + } + } + if (location == "") { + _add = true; + } else if (unit.is_at_location(location)) { + _add = true; + } + } + if (_add) { + array_push(_units, obj_ini.TTRPG[com][i]); + } + } + } + return _units; +} + +/// @description Processes the selection of units based on group parameters and updates controller data +/// @param {array} group The array of units to process for selection +/// @param {struct} selection_data Data structure containing selection parameters and state + + +/// @description Processes the selection of units based on group parameters and updates controller data +/// @param {array} group The array of units to process for selection +/// @param {struct} selection_data Data structure containing selection parameters and state + +enum eMISSION_SELECT_TYPE { + UNITS, + SQUADS, +} + +function group_selection(group, selection_data = {}) { + try { + var unit, s, unit_location; + obj_controller.selection_data = selection_data; + set_zoom_to_default(); + with (obj_controller) { + if (menu != eMENU.MANAGE) { + scr_toggle_manage(); + } else { + basic_manage_settings(); + } + + exit_button = new ShutterButton(); + proceed_button = new ShutterButton(); + selection_data.start_count = 0; + instance_destroy(obj_managment_panel); + if (!struct_exists(selection_data, "select_type")) { + selection_data.select_type = eMISSION_SELECT_TYPE.UNITS; + } + // Resets selections for next turn + scr_ui_refresh(); + managing = -1; + new_company_struct(); + var vehicles = []; + for (var i = 0; i < array_length(group); i++) { + if (!is_struct(group[i])) { + if (is_array(group[i])) { + array_push(vehicles, group[i]); + } + continue; + } + unit = group[i]; + add_man_to_manage_arrays(unit); + + if (selection_data.purpose_code == "forge_assignment") { + if (unit.job != "none") { + if (unit.job.type == "forge" && unit.job.planet == selection_data.planet) { + man_sel[array_length(display_unit) - 1] = 1; + man_size++; + selection_data.start_count++; + } + } + } + } + var last_vehicle = 0; + if (array_length(vehicles) > 0) { + for (var veh = 0; veh < array_length(vehicles); veh++) { + unit = vehicles[veh]; + add_vehicle_to_manage_arrays(unit); + } + } + other_manage_data(); + man_current = 0; + man_max = MANAGE_MAN_MAX; + + if (selection_data.select_type == eMISSION_SELECT_TYPE.SQUADS) { + new_company_struct(); + company_data.has_squads = true; + company_data.squad_location = selection_data.system.name; + company_data.squad_search(); + managing = -1; + } + } + LOGGER.debug($"manage_success {obj_controller.menu}"); + } + catch (_exception) { + //handle and send player back to map + handle_exception(_exception); + scr_toggle_manage(); + } +} \ No newline at end of file diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.yy b/scripts/scr_UnitGroup/scr_UnitGroup.yy new file mode 100644 index 0000000000..bd7695ec27 --- /dev/null +++ b/scripts/scr_UnitGroup/scr_UnitGroup.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"scr_UnitGroup", + "isCompatibility":false, + "isDnD":false, + "name":"scr_UnitGroup", + "parent":{ + "name":"marines_and_profiles", + "path":"folders/Scripts/marines_and_profiles.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file diff --git a/scripts/scr_logging_functions/scr_logging_functions.gml b/scripts/scr_logging_functions/scr_logging_functions.gml index 7ac740d52f..85c9fb933f 100644 --- a/scripts/scr_logging_functions/scr_logging_functions.gml +++ b/scripts/scr_logging_functions/scr_logging_functions.gml @@ -1,7 +1,7 @@ -#macro STR_ERROR_MESSAGE_HEAD $"Your game just encountered and caught an error!" -#macro STR_ERROR_MESSAGE_HEAD2 $"Your game just encountered a critical error! :(" +#macro STR_ERROR_MESSAGE_HEAD Your game just encountered and caught an error! +#macro STR_ERROR_MESSAGE_HEAD2 Your game just encountered a critical error! :( #macro STR_ERROR_MESSAGE_HEAD3 "Your game just encountered and caught an error! ({0})" -#macro STR_ERROR_MESSAGE_PS $"P.S. You can ALT-TAB and try to continue playing, though it’s recommended to wait for a response in the bug-report forum." +#macro STR_ERROR_MESSAGE_PS P.S. You can ALT-TAB and try to continue playing, though it’s recommended to wait for a response in the bug-report forum. #macro ERR_LOG_DIRECTORY "Logs/" #macro ERR_PATH_LAST_MESSAGES "last_messages.log" From 9098f0b78ac85169717b99700cd9c501ff417942 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 3 May 2026 00:35:10 +0100 Subject: [PATCH 86/93] start to intergrate new helpers --- scripts/scr_UnitGroup/scr_UnitGroup.gml | 72 ++++++++++++++----- .../scr_mission_reward/scr_mission_reward.gml | 17 ++--- .../scr_player_ship_functions.gml | 50 ++++++------- 3 files changed, 78 insertions(+), 61 deletions(-) diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.gml b/scripts/scr_UnitGroup/scr_UnitGroup.gml index 16021cc5d6..5bb04455d9 100644 --- a/scripts/scr_UnitGroup/scr_UnitGroup.gml +++ b/scripts/scr_UnitGroup/scr_UnitGroup.gml @@ -6,9 +6,13 @@ function UnitGroup(units) constructor{ return array_length(units); } + static shuffle = function(){ + units = array_shuffle(units); + } + static has_role = function(role){ for (var i=0;i0){ if (array_length(_units)>=_max_count){ break; @@ -107,6 +135,9 @@ function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=fa } } } + if (return_as_UnitGroup){ + return new UnitGroup(_units); + } return _units; } @@ -133,7 +164,7 @@ function SearchConditions(data) constructor{ search_companies = !is_string(companies); if (search_companies){ - search_multiple_companies = is_array(search_companies); + search_multiple_companies = is_array(companies); } if (max_wanted > 0){ @@ -151,19 +182,22 @@ function SearchConditions(data) constructor{ static company_evaluate = function(){ var _add = true; - if (search_companies){ - if (search_multiple_companies){ - if (!array_contains(_wanted_companies, unit.company)){ - _add = false; - } - } else { - if (_wanted_companies != unit.company){ - _add = false; - } + if (!search_companies){ + return true; + } + + if (search_multiple_companies){ + if (!array_contains(companies, unit.company)){ + _add = false; + } + } else { + if (companies != unit.company){ + _add = false; } - _add = oposite_switch(_add); } + _add = oposite_switch(_add); + return _add; } @@ -172,7 +206,7 @@ function SearchConditions(data) constructor{ var _add = true; if (group!="all"){ var _group = group; - if (group_is_array){ + if (group_is_complex){ if (group_search_heads) { _add = unit.IsSpecialist(_group[0], _group[1], _group[2]); } else { @@ -296,9 +330,11 @@ function stat_valuator(search_params, unit) { return match; } + +//TOODO probably just roll this into other checks function collect_by_religeon(religion, sub_cult = "", location = "") { var _units = [], unit, count = 0, _add = false; - for (var com = 0; com <= 10; com++) { + for (var com = 0; com <= obj_ini.companies; com++) { for (var i = 1; i < array_length(obj_ini.TTRPG[com]); i++) { _add = false; unit = obj_ini.TTRPG[com][i]; diff --git a/scripts/scr_mission_reward/scr_mission_reward.gml b/scripts/scr_mission_reward/scr_mission_reward.gml index b90df8522b..b78e408c10 100644 --- a/scripts/scr_mission_reward/scr_mission_reward.gml +++ b/scripts/scr_mission_reward/scr_mission_reward.gml @@ -223,24 +223,15 @@ function scr_mission_reward(mission, star, planet) { } mech_disp_change = 0; var _text = "The Adeptus Mechanicus have finished experimenting on your marines"; - var _marines = collect_role_group("all", [star.name, planet, -1]); + var _marines = collect_role_group("all", [star.name, planet, -1], false, {}, true); if (result == "Marines Lost") { _text += "- unfortunantly none of them have survived. 150 Requisition has provided as weregild for each Astartes lost."; mech_disp_change = 2; - - for (var i = 0; i < array_length(_marines); i++) { - var _unit = _marines[i]; - obj_controller.requisition += 150; - - star.p_player[planet] -= _unit.get_unit_size(); - - kill_and_recover(_unit.company, _unit.marine_number, true, true); - - cleanup[_unit.company] = 1; - } + obj_controller.requisition += 150 * _marines.number(); + _marines.kill_percent(100); } - if (result == "Bionics" || result == "Requisition") { + else if (result == "Bionics" || result == "Requisition") { var _new_bionics = irandom_range(40, 100); obj_controller.disposition[3] += 1; mech_disp_change = 1; diff --git a/scripts/scr_player_ship_functions/scr_player_ship_functions.gml b/scripts/scr_player_ship_functions/scr_player_ship_functions.gml index 11be1b0746..381f17baab 100644 --- a/scripts/scr_player_ship_functions/scr_player_ship_functions.gml +++ b/scripts/scr_player_ship_functions/scr_player_ship_functions.gml @@ -32,71 +32,61 @@ function return_lost_ship() { var _return_defect = roll_dice_chapter(1, 100, "high"); var _text = $"The ship {obj_ini.ship[_return_id]} has returned to real space and is now orbiting the {_star.name} system\n"; + + static unit_effects = { + "geller_fail" : function(unit){ + unit.edit_corruption(max(0, irandom_range(20, 120) - _units[i].piety)); + }, + + } if (_return_defect < 90) { + var _units = collect_role_group("all", [_star.name, 0, _return_id], false, {}, true); + _units.shuffle(); + if (_return_defect > 80) { obj_ini.ship_hp[_return_id] *= random_range(0.2, 0.8); _text += $"Reports indicate it has suffered damage as a result of it's time in the warp"; } else if (_return_defect > 70) { - var techs = collect_role_group(SPECIALISTS_TECHS, [_star.name, 0, _return_id]); - if (array_length(techs)) { - _text += $"One of the ships main reactors sufered a malfunction and the ships tech staff died to a man attempting to contain the damage"; - for (var i = 0; i < array_length(techs); i++) { - var _tech = techs[i]; - kill_and_recover(_tech.company, _tech.marine_number); - } + var _techs = _units.get_from({group:SPECIALISTS_TECHS}); + if (bool(_techs.number)) { + _techs.kill_percent(100); } } else if (_return_defect > 60) { - var _units = collect_role_group("all", [_star.name, 0, _return_id]); - if (array_length(_units)) { + if (bool(_units.number())) { _text += $"While in the warp the geller fields temporarily went down leaving the ships crew to face the horror of the warp"; - for (var i = 0; i < array_length(_units); i++) { - _units[i].edit_corruption(max(0, irandom_range(20, 120) - _units[i].piety)); - } + _units.for_each(unit_effects.geller_fail); } } else if (_return_defect > 50) { - var _units = collect_role_group("all", [_star.name, 0, _return_id]); if (array_length(_units) > 1) { _text += $"The ship was stuck in the warp for many years so many that even the resolve of the marines began to breakdown, there was a mutiney as many marines thought they would be best to try their luck as renegades in the warp. Those who remained loyal to you prevailed but their geneseed was burnt for fear of corruption"; - _units = array_shuffle(_units); - for (var i = 0; i < floor(array_length(_units) / 2); i++) { - var _unit = _units[i]; - kill_and_recover(_unit.company, _unit.marine_number, true, false); - } + _units.kill_percent(50, true, false); } } else if (_return_defect > 40) { - var _units = collect_role_group("all", [_star.name, 0, _return_id]); if (array_length(_units) > 0) { _text += $"The ship is empty, what happened to the origional crew is a mystery"; - for (var i = 0; i < array_length(_units); i++) { - var _unit = _units[i]; - kill_and_recover(_unit.company, _unit.marine_number, false, false); - } + _units.kill_percent(100, false, false); } } else if (_return_defect > 20) { //This would be an awsome oppertunity and ideal kick off place to allow a redemtion arc either liberating the ship or some of your captured marines gene seed other bits _text += $"The fate of your ship {obj_ini.ship[_return_id]} has now become clear\n A Chaos fleet has warped into the {_star.name} system with your once prized ship now a part of it"; - var _units = collect_role_group("all", [_star.name, 0, _return_id]); if (array_length(_units) > 0) { _text += $"You must assume the worst for your crew"; - for (var i = 0; i < array_length(_units); i++) { - var _unit = _units[i]; - kill_and_recover(_unit.company, _unit.marine_number, false, false); - } + _units.kill_percent(100, false, false); } scr_kill_ship(_return_id); var _chaos_fleet = spawn_chaos_fleet_at_system(_star); - var fleet_strength = ((100 - roll_dice_chapter(1, 100, "low")) / 10) + 3; + var fleet_strength = floor(((100 - roll_dice_chapter(1, 100, "low")) / 10) + 3); distribute_strength_to_fleet(fleet_strength, _chaos_fleet); with (_new_fleet) { instance_destroy(); } } else { - var _units = collect_role_group("all", [_star.name, 0, _return_id]); _text += $"The fate of your ship {obj_ini.ship[_return_id]} has now become clear. While it did not survive it's travels through the warp and tore itself apart somewhere in the {_star.name} system. "; scr_kill_ship(_return_id); if (array_length(_units) > 0) { _text += "Some of your astartes may have been able to jetison and survive the ships destruction"; } + //TODO finish off the jettisoned marines logic } //More scenarios needed but this is a good start } From 22f969235881dde709190eb1a56add556bd70cdf Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Sun, 3 May 2026 00:42:19 +0100 Subject: [PATCH 87/93] 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 5bb04455d9..fea8cb2f0d 100644 --- a/scripts/scr_UnitGroup/scr_UnitGroup.gml +++ b/scripts/scr_UnitGroup/scr_UnitGroup.gml @@ -60,7 +60,7 @@ function UnitGroup(units) constructor{ i = 0; while(_killed < _kill_numb && i < number()){ var _unit = units[i]; - if (kill_decimal < 100 && _unit.role() == obj_ini.role[100][eROLE.CHAPTERMASTER]){ + if (kill_percent < 100 && _unit.role() == obj_ini.role[100][eROLE.CHAPTERMASTER]){ i++; continue; } From 4ded04ec9a8539194b29c5729b45d3e57d7190a2 Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Sun, 3 May 2026 00:42:51 +0100 Subject: [PATCH 88/93] 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.gml b/scripts/scr_UnitGroup/scr_UnitGroup.gml index fea8cb2f0d..b44b8de6cd 100644 --- a/scripts/scr_UnitGroup/scr_UnitGroup.gml +++ b/scripts/scr_UnitGroup/scr_UnitGroup.gml @@ -65,6 +65,7 @@ function UnitGroup(units) constructor{ continue; } kill_and_recover(_unit.company, _unit.marine_number, equipment, gene_seed_collect); + _killed++; i++; } } From e540331545f22e78761d0d989d0ba52b95eeeb82 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 3 May 2026 00:52:09 +0100 Subject: [PATCH 89/93] review tracker --- scripts/scr_UnitGroup/scr_UnitGroup.gml | 4 ++-- scripts/scr_mission_reward/scr_mission_reward.gml | 4 ++-- .../scr_player_ship_functions.gml | 14 ++++++++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/scr_UnitGroup/scr_UnitGroup.gml b/scripts/scr_UnitGroup/scr_UnitGroup.gml index b44b8de6cd..1ea46a0a02 100644 --- a/scripts/scr_UnitGroup/scr_UnitGroup.gml +++ b/scripts/scr_UnitGroup/scr_UnitGroup.gml @@ -55,9 +55,9 @@ function UnitGroup(units) constructor{ } static kill_percent = function(kill_percent, equipment = true, gene_seed_collect = true){ - var _kill_numb = floor((kill_decimal/100) * number()); + var _kill_numb = floor((kill_percent/100) * number()); var _killed = 0; - i = 0; + var i = 0; while(_killed < _kill_numb && i < number()){ var _unit = units[i]; if (kill_percent < 100 && _unit.role() == obj_ini.role[100][eROLE.CHAPTERMASTER]){ diff --git a/scripts/scr_mission_reward/scr_mission_reward.gml b/scripts/scr_mission_reward/scr_mission_reward.gml index b78e408c10..7635e35419 100644 --- a/scripts/scr_mission_reward/scr_mission_reward.gml +++ b/scripts/scr_mission_reward/scr_mission_reward.gml @@ -246,8 +246,8 @@ function scr_mission_reward(mission, star, planet) { obj_controller.requisition += req_gain; } var _limit = 0; - for (var i = 0; i < array_length(_marines); i++) { - var _unit = _marines[i]; + for (var i = 0; i < array_length(_marines.units); i++) { + var _unit = _marines.units[i]; if (_unit.bionics > 0) { _unit.update_health(irandom_range(2, 80)); diff --git a/scripts/scr_player_ship_functions/scr_player_ship_functions.gml b/scripts/scr_player_ship_functions/scr_player_ship_functions.gml index 381f17baab..99831b1f73 100644 --- a/scripts/scr_player_ship_functions/scr_player_ship_functions.gml +++ b/scripts/scr_player_ship_functions/scr_player_ship_functions.gml @@ -35,44 +35,46 @@ function return_lost_ship() { static unit_effects = { "geller_fail" : function(unit){ - unit.edit_corruption(max(0, irandom_range(20, 120) - _units[i].piety)); + unit.edit_corruption(max(0, irandom_range(20, 120) - unit.piety)); }, } if (_return_defect < 90) { var _units = collect_role_group("all", [_star.name, 0, _return_id], false, {}, true); _units.shuffle(); + var _bool_units = bool(_units.number()); if (_return_defect > 80) { obj_ini.ship_hp[_return_id] *= random_range(0.2, 0.8); _text += $"Reports indicate it has suffered damage as a result of it's time in the warp"; } else if (_return_defect > 70) { var _techs = _units.get_from({group:SPECIALISTS_TECHS}); - if (bool(_techs.number)) { + if (bool(_techs.number())) { _techs.kill_percent(100); } } else if (_return_defect > 60) { - if (bool(_units.number())) { + if (_bool_units) { _text += $"While in the warp the geller fields temporarily went down leaving the ships crew to face the horror of the warp"; _units.for_each(unit_effects.geller_fail); } } else if (_return_defect > 50) { - if (array_length(_units) > 1) { + if (_units.number() > 1) { _text += $"The ship was stuck in the warp for many years so many that even the resolve of the marines began to breakdown, there was a mutiney as many marines thought they would be best to try their luck as renegades in the warp. Those who remained loyal to you prevailed but their geneseed was burnt for fear of corruption"; _units.kill_percent(50, true, false); } } else if (_return_defect > 40) { - if (array_length(_units) > 0) { + if (_bool_units) { _text += $"The ship is empty, what happened to the origional crew is a mystery"; _units.kill_percent(100, false, false); } } else if (_return_defect > 20) { //This would be an awsome oppertunity and ideal kick off place to allow a redemtion arc either liberating the ship or some of your captured marines gene seed other bits _text += $"The fate of your ship {obj_ini.ship[_return_id]} has now become clear\n A Chaos fleet has warped into the {_star.name} system with your once prized ship now a part of it"; - if (array_length(_units) > 0) { + if (_bool_units) { _text += $"You must assume the worst for your crew"; _units.kill_percent(100, false, false); } + scr_kill_ship(_return_id); var _chaos_fleet = spawn_chaos_fleet_at_system(_star); var fleet_strength = floor(((100 - roll_dice_chapter(1, 100, "low")) / 10) + 3); From 6671d5799899fb410256407585dbf9e537d4d5b3 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 3 May 2026 08:17:52 +0100 Subject: [PATCH 90/93] final tweaks --- 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 1ea46a0a02..889fa0b810 100644 --- a/scripts/scr_UnitGroup/scr_UnitGroup.gml +++ b/scripts/scr_UnitGroup/scr_UnitGroup.gml @@ -60,7 +60,7 @@ function UnitGroup(units) constructor{ var i = 0; while(_killed < _kill_numb && i < number()){ var _unit = units[i]; - if (kill_percent < 100 && _unit.role() == obj_ini.role[100][eROLE.CHAPTERMASTER]){ + if (kill_percent < 100 && _unit.role() == active_roles()[eROLE.CHAPTERMASTER]){ i++; continue; } @@ -355,7 +355,7 @@ function collect_by_religeon(religion, sub_cult = "", location = "") { } } if (_add) { - array_push(_units, obj_ini.TTRPG[com][i]); + array_push(_units, unit); } } } From e76add51e5ed799c29896fb4f321ff4faddc0fdb Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Sun, 3 May 2026 08:22:16 +0100 Subject: [PATCH 91/93] fix mmacros because gm is ass --- scripts/macros/macros.gml | 8 ++++---- scripts/scr_logging_functions/scr_logging_functions.gml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index 4b123ab58a..8103ddab0b 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -2,10 +2,10 @@ #macro DEFAULT_TOOLTIP_VIEW_OFFSET 32 #macro DEFAULT_LINE_GAP -1 #macro LB_92 "############################################################################################" -#macro DATE_TIME_1 current_day"-"current_month"-"current_year"-"format_time(current_hour)""format_time(current_minute)""format_time(format_time(current_second))"" -#macro DATE_TIME_2 current_day"-"current_month"-"current_year"|"format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" -#macro DATE_TIME_3 current_day"-"current_month"-"current_year" "format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" -#macro TIME_1 format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" +#macro DATE_TIME_1 $"{current_day}-{current_month}-{current_year}-{format_time(current_hour)}{format_time(current_minute)}{format_time(format_time(current_second))}" +#macro DATE_TIME_2 $"{current_day}-{current_month}-{current_year}|{format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" +#macro DATE_TIME_3 $"{current_day}-{current_month}-{current_year} {format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" +#macro TIME_1 $"{format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" #macro CM_GREEN_COLOR #34bc75 #macro CM_RED_COLOR #bf4040 #macro COL_REQUISITION #2398F8 diff --git a/scripts/scr_logging_functions/scr_logging_functions.gml b/scripts/scr_logging_functions/scr_logging_functions.gml index 85c9fb933f..7ac740d52f 100644 --- a/scripts/scr_logging_functions/scr_logging_functions.gml +++ b/scripts/scr_logging_functions/scr_logging_functions.gml @@ -1,7 +1,7 @@ -#macro STR_ERROR_MESSAGE_HEAD Your game just encountered and caught an error! -#macro STR_ERROR_MESSAGE_HEAD2 Your game just encountered a critical error! :( +#macro STR_ERROR_MESSAGE_HEAD $"Your game just encountered and caught an error!" +#macro STR_ERROR_MESSAGE_HEAD2 $"Your game just encountered a critical error! :(" #macro STR_ERROR_MESSAGE_HEAD3 "Your game just encountered and caught an error! ({0})" -#macro STR_ERROR_MESSAGE_PS P.S. You can ALT-TAB and try to continue playing, though it’s recommended to wait for a response in the bug-report forum. +#macro STR_ERROR_MESSAGE_PS $"P.S. You can ALT-TAB and try to continue playing, though it’s recommended to wait for a response in the bug-report forum." #macro ERR_LOG_DIRECTORY "Logs/" #macro ERR_PATH_LAST_MESSAGES "last_messages.log" From 1dc66f73bf3e1c2c0c7d53fa05112dcf1269b375 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 14 May 2026 12:04:15 +0100 Subject: [PATCH 92/93] bump --- scripts/scr_ui_manage/scr_ui_manage.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/scr_ui_manage/scr_ui_manage.gml b/scripts/scr_ui_manage/scr_ui_manage.gml index 735fe00496..75a370129f 100644 --- a/scripts/scr_ui_manage/scr_ui_manage.gml +++ b/scripts/scr_ui_manage/scr_ui_manage.gml @@ -1574,4 +1574,4 @@ function draw_manage_selection_buttons(xx, yy) { } } } -} +} From 194e6d183f7be48aeb95cbfc72cb262d7a80b4d6 Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Thu, 14 May 2026 16:07:09 +0100 Subject: [PATCH 93/93] bump 2 --- scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml index 2486ff7122..02d6093800 100644 --- a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml +++ b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml @@ -1,5 +1,5 @@ // Script assets have changed for v2.3.0 see -// https : //help.yoyogames.com/hc/en-us/articles/360005277377 for more information +// https : //help.yoyogames.com/hc/en-us/articles/360005277377 for more information function UnitQuickFindPanel() constructor{ main_panel = new DataSlate(); garrison_log = {};