Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
55fec8e
Create scr_battle_count.gml
Frost-bit-jpg Mar 27, 2025
417e4bd
Create scr_battle_count.yy
Frost-bit-jpg Mar 27, 2025
4e7cc4d
Merge branch 'Adeptus-Dominus:main' into scr_battle_count
Frost-bit-jpg Mar 27, 2025
2532464
Update ChapterMaster.yyp
Frost-bit-jpg Mar 27, 2025
b52591b
Update Alarm_5.gml
Frost-bit-jpg Mar 27, 2025
e7f5175
Update scr_enemy_ai_a.gml
Frost-bit-jpg Mar 27, 2025
f9e4bc2
Update scr_battle_count.gml
Frost-bit-jpg Mar 27, 2025
7f6ff0d
Update scr_battle_count.gml
Frost-bit-jpg Mar 27, 2025
d93abb2
Update scr_battle_count.gml
Frost-bit-jpg Mar 27, 2025
fb55269
Update scr_enemy_ai_a.gml
Frost-bit-jpg Mar 27, 2025
a233b7d
Update scr_enemy_ai_a.gml
Frost-bit-jpg Mar 27, 2025
03d4573
Update scr_enemy_ai_a.gml
Frost-bit-jpg Mar 27, 2025
c5411af
Update Alarm_5.gml
Frost-bit-jpg Mar 27, 2025
8c32358
Update scr_battle_count.gml
Frost-bit-jpg Mar 27, 2025
f6c1228
Update scr_enemy_ai_a.gml
Frost-bit-jpg Mar 27, 2025
d48bb6a
Update Create_0.gml
Frost-bit-jpg Mar 27, 2025
c4f1acb
Update scr_load_controller.gml
Frost-bit-jpg Mar 27, 2025
fbde5da
Update scr_save_controller.gml
Frost-bit-jpg Mar 27, 2025
80c2456
Update scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml
Frost-bit-jpg Mar 27, 2025
605af3c
Update scripts/scr_battle_count/scr_battle_count.gml
Frost-bit-jpg Mar 27, 2025
8a5f5d9
Merge branch 'main' into scr_battle_count
Frost-bit-jpg Mar 28, 2025
ff1bab5
Update scripts/scr_battle_count/scr_battle_count.gml
Frost-bit-jpg Mar 28, 2025
2729420
Update scr_battle_count.gml
Frost-bit-jpg Mar 28, 2025
05d18eb
Update scr_battle_count.gml
Frost-bit-jpg Mar 28, 2025
b6c7cd0
Update scr_battle_count.gml
Frost-bit-jpg Mar 28, 2025
00e0d51
Update scripts/scr_battle_count/scr_battle_count.gml
Frost-bit-jpg Mar 28, 2025
85bf01a
Update scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml
Frost-bit-jpg Mar 28, 2025
18793de
fix: failed to check demonworlds as hostile
Frost-bit-jpg Mar 28, 2025
4312395
fix: scr_battle_count metadata
MCPO-Spartan-117 Mar 28, 2025
b300e25
fix: Proper comment
MCPO-Spartan-117 Mar 28, 2025
01aaa7a
fix: Remove diff symbols from bot
MCPO-Spartan-117 Mar 28, 2025
25b40e8
fix: Format and fix for loop
MCPO-Spartan-117 Mar 28, 2025
e398fb7
fix: Proper colors
MCPO-Spartan-117 Mar 28, 2025
2b8f6ab
refactor: Array and struct for readability and maintenance
MCPO-Spartan-117 Mar 28, 2025
9c47283
style: Auto changes
MCPO-Spartan-117 Mar 28, 2025
0b345ed
refactor: Use elses and some formatting
MCPO-Spartan-117 Mar 28, 2025
826bd9c
Merge pull request #2 from MCPO-Spartan-117/scr_battle_count
Frost-bit-jpg Mar 28, 2025
0df49ad
Update scripts/scr_battle_count/scr_battle_count.gml
OH296 Mar 28, 2025
869907b
Update scripts/scr_battle_count/scr_battle_count.gml
Frost-bit-jpg Mar 29, 2025
66738db
Merge branch 'main' into scr_battle_count
Frost-bit-jpg Mar 29, 2025
627d8d6
Merge branch 'main' into scr_battle_count
Frost-bit-jpg Mar 30, 2025
4b3ae9e
Merge branch 'main' into scr_battle_count
Frost-bit-jpg Mar 31, 2025
a8951d5
Merge branch 'main' into scr_battle_count
Frost-bit-jpg Apr 2, 2025
c655f4a
Revert "refactor: Use elses and some formatting"
MCPO-Spartan-117 Apr 2, 2025
63ee714
Revert "fix: failed to check demonworlds as hostile"
MCPO-Spartan-117 Apr 2, 2025
ea571a5
Merge pull request #7 from MCPO-Spartan-117/scr_battle_count
Frost-bit-jpg Apr 2, 2025
d4a15f6
Merge branch 'main' into scr_battle_count
Frost-bit-jpg Apr 12, 2025
fae1b8e
Update scripts/scr_load_controller/scr_load_controller.gml
Frost-bit-jpg Apr 12, 2025
14c4b91
Merge branch 'main' into scr_battle_count
Frost-bit-jpg May 11, 2025
a5de627
Merge branch 'main' into scr_battle_count
Frost-bit-jpg May 16, 2025
262bd45
Update scr_battle_count.gml
Frost-bit-jpg May 16, 2025
8aa0d3e
Update scr_battle_count.gml
Frost-bit-jpg May 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChapterMaster.yyp
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@
{"id":{"name":"scr_arti_descr","path":"scripts/scr_arti_descr/scr_arti_descr.yy",},},
{"id":{"name":"scr_audience","path":"scripts/scr_audience/scr_audience.yy",},},
{"id":{"name":"scr_battle_allies","path":"scripts/scr_battle_allies/scr_battle_allies.yy",},},
{"id":{"name":"scr_battle_count","path":"scripts/scr_battle_count/scr_battle_count.yy",},},
{"id":{"name":"scr_battle_roster","path":"scripts/scr_battle_roster/scr_battle_roster.yy",},},
{"id":{"name":"scr_battle_sort","path":"scripts/scr_battle_sort/scr_battle_sort.yy",},},
{"id":{"name":"scr_bionics_count","path":"scripts/scr_bionics_count/scr_bionics_count.yy",},},
Expand Down
1 change: 1 addition & 0 deletions objects/obj_controller/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ obj_controller.restart_strength=0;
obj_controller.restart_cooperation=0;
obj_controller.restart_purity=0;
obj_controller.restart_stability=0;
obj_controller.enemies_cleared_count = 0;

// ** Sets default equipement for roles **
// 100 is defaults, 101 is the allowable starting equipment
Expand Down
2 changes: 2 additions & 0 deletions objects/obj_ncombat/Alarm_5.gml
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ if (defeat=0) and (reduce_power=true){
p_owner[battle_planet] = eFACTION.Imperium
}
dispo[battle_planet] += 10;
obj_controller.enemies_cleared_count += 1;
scr_battle_count();
scr_event_log("", $"{who_cleansed} cleansed from {planet_string}", name);
scr_alert("green", "owner", $"{who_cleansed} cleansed from {planet_string}. Control returned to {who_return}", x, y);
if (dispo[battle_planet] >= 101) then p_owner[battle_planet] = 1;
Expand Down
41 changes: 41 additions & 0 deletions scripts/scr_battle_count/scr_battle_count.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
function scr_battle_count(){

// Check if the count is positive and a multiple of 10
if (obj_controller.enemies_cleared_count > 0 && (obj_controller.enemies_cleared_count % 10 == 0)) {

// --- ACTION TO PERFORM EVERY 10 CLEARS ---

// --- Randomly Choose Flavor Text ---
var _text_array = [
{
alert : "Word of your Chapter's tireless defence of the Sector reaches influential ears within the Imperium.",
log : "Imperial Factions note the Chapter's continued effectiveness in purging threats."
},
{
alert : "The efficiency of your recent purges has not gone unnoticed. Certain Imperial factions mark your Chapter's progress.",
log : "Imperial elements acknowledge the Chapter's effectiveness against sector threats."
},
{
alert : "Data-slate communiques confirm receipt of your operational summaries. Standard commendations issued.",
log : "Administratum logs successful anti-xenos/heretic operations by the Chapter."
},
{
alert : "Your Chapter's righteous fury against the enemies of Man strengthens the faith of nearby Imperial worlds.",
log : "Tales of the Chapter's victories inspire piety and bolster relations with the faithful."
},
{
alert : "Your Chapter continues its duties effectively.",
log : "Chapter effectiveness noted by Imperial factions."
}
]
var _text_choice = array_random_element(_text_array);

scr_alert(c_blue, $"{_text_choice.alert}");
scr_event_log(c_blue, $"{_text_choice.log}");

// --- Apply bonuses
obj_controller.loyalty+=5;
obj_controller.loyalty_hidden+=5;
// --- END ACTION TO PERFORM ---
}
}
13 changes: 13 additions & 0 deletions scripts/scr_battle_count/scr_battle_count.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

170 changes: 119 additions & 51 deletions scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml
Original file line number Diff line number Diff line change
Expand Up @@ -816,58 +816,126 @@ function scr_enemy_ai_a() {

// 135;

var planet_saved = ((p_player[_run] + p_raided[_run]) > 0 && p_orks[_run] = 0 && p_tyranids[_run] < 4 && p_chaos[_run] = 0 && p_traitors[_run] = 0 && p_necrons[_run] = 0 && p_tau[_run] = 0);

if (planet_saved){
var who_cleansed="";
var who_return="";
var make_alert = false;
var planet_string = $"{name} {scr_roman(_run)}";
if (p_owner[_run] = 7) {
who_cleansed="Orks"
make_alert=true;
}else if (p_owner[_run] = 8 && p_pdf[_run] = 0) {
who_cleansed="Tau"
make_alert=true;
}else if (p_owner[_run] = 13) {
who_cleansed="Necrons"
make_alert=true;
}else if (p_owner[_run] = 10) {
who_cleansed="Chaos"
make_alert=true;
} else if (planet_feature_bool(p_feature[_run], P_features.Gene_Stealer_Cult) && p_tyranids[_run] <= 0){
who_cleansed="Gene Stealer Cult"
make_alert=true;
delete_features(p_feature[_run], P_features.Gene_Stealer_Cult);
adjust_influence(eFACTION.Tyranids, -25, _run);
}
if (make_alert){
if (p_first[_run] = 1){
p_owner[_run] = eFACTION.Player;
who_return = "your";
} else if (p_first[_run] = 3 || p_type[_run]=="Forge"){
who_return="mechanicus";
obj_controller.disposition[3] += 10;
p_owner[_run] = eFACTION.Mechanicus
}else if (p_type[_run]!="Dead"){
who_return="the governor";
if (who_cleansed=="tau"){
who_return="a more suitable governer"
}
p_owner[_run] = eFACTION.Imperium;
}
dispo[_run] += 10;
scr_event_log("", $"{who_cleansed} cleansed from {planet_string}", name);
scr_alert("green", "owner", $"{who_cleansed} cleansed from {planet_string}. Control returned to {who_return}", x, y);
if (dispo[_run] >= 101) then p_owner[_run] = 1;
}

}

if (p_raided[_run] > 0) then p_raided[_run] = 0;
delete _planet_data;
} // end repeat here
// Determine if the planet qualifies as "saved" this turn.
// Conditions: Player forces must be present (or raided flag is set), AND
// all major non-Imperial ground threats (Orks, significant Tyranids, Chaos forces, Necrons, Tau) are eliminated.
var planet_saved = (
(p_player[_run] + p_raided[_run]) > 0 && // Player involved or planet was raided
p_orks[_run] == 0 && // No Orks
p_tyranids[_run] < 4 && // Tyranids below significant infestation level
p_chaos[_run] == 0 && // No Chaos Space Marines / Daemons
p_traitors[_run] == 0 && // No Heretics / Traitors
p_necrons[_run] == 0 && // No Necrons
p_tau[_run] == 0 // No Tau ground forces
);

// --- Apply Effects if Planet Was Saved ---
if (planet_saved) {
// --- Initialize variables for this saved planet ---
var who_cleansed = ""; // String: Describes the primary enemy cleansed
var who_return = ""; // String: Describes who regains control of the planet
var make_alert = false; // Boolean: Flag to trigger alerts and apply bonuses
var original_owner_before_cleanse = p_owner[_run]; // Store owner ID before potential changes
var planet_string = $"{name} {scr_roman(_run)}"; // Formatted planet name (e.g., "SystemName II")

// --- Determine which enemy faction was primarily defeated ---
// This logic primarily uses the owner just before cleansing as the indicator.
if (original_owner_before_cleanse == eFACTION.Ork) {
who_cleansed = "Orks";
make_alert = true;
} else if (original_owner_before_cleanse == eFACTION.Tau && p_pdf[_run] == 0) { // Special case: Tau considered cleansed only if their PDF is also gone?
who_cleansed = "Tau";
make_alert = true;
} else if (original_owner_before_cleanse == eFACTION.Necrons) {
who_cleansed = "Necrons";
make_alert = true;
} else if (original_owner_before_cleanse == eFACTION.Chaos) {
who_cleansed = "Chaos"; // Includes CSM, Daemons, possibly Traitors if owner flipped
make_alert = true;
// Check Tyranids/GSC based on previous owner OR if GSC feature was present and Nids are now low
} else if (original_owner_before_cleanse == eFACTION.Tyranids || (planet_feature_bool(p_feature[_run], P_features.Gene_Stealer_Cult) && p_tyranids[_run] <= 0)) {
who_cleansed = "Tyranid"; // Generic term initially

// Check specifically if a Genestealer Cult feature was present
if (planet_feature_bool(p_feature[_run], P_features.Gene_Stealer_Cult)) {
who_cleansed = "Genestealer Cult"; // More specific name
delete_features(p_feature[_run], P_features.Gene_Stealer_Cult); // Remove the cult feature
adjust_influence(eFACTION.Tyranids, -25, _run, self); // Reduce residual Tyranid influence (pass 'self' for star context)
}
make_alert = true; // Trigger alert for Tyranids or GSC
}

// --- Apply effects ONLY if an enemy was confirmed cleansed ---
if (make_alert) {

// --- Determine who gets control back based on original owner (p_first) ---
if (p_first[_run] == eFACTION.Player) { // If originally Player owned
p_owner[_run] = eFACTION.Player;
who_return = "your Chapter";
} else if (p_first[_run] == eFACTION.Mechanicus || p_type[_run] == "Forge") { // If originally Mechanicus or a Forge World
who_return = "the Adeptus Mechanicus";
obj_controller.disposition[eFACTION.Mechanicus] += 5; // FACTION disposition bonus
Comment on lines +875 to +877
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it possible to cheese all of these dispo/planet dispo rewards, by leaving a squad on the planet and waiting for a lvl 1 enemy to pop up?
I think there should be some kind of relation to the enemy power fought.

Also, population % from max should matter, perhaps.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, if you combine with SR rework, this would indeed become comedic as you take out a squad of orks, and imperials start to like you...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to game logic, those squad of orks if left unchecked will more than likely cause supply disruption and lots of problems in the local system otherwise they wouldn't be able at all to penetrate the defensive fleet yes? orks multiply very fast and if left unchecked will very quickly become a serious problem. Typically imperium response is so slow but to the plantery governor you are preserving otherwise very needed resources.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on experience - if there is some PDF left around, they generally should be capable to handle the ork invasion when it's strength is reduced. Say, SR 1 orks versus ~10'000 PDF troops. Bonus if they do get some fortifications, and your marine garrisons helping out.

But if PDF is 0, yeah, the player basically has no option but to wipe the invaders off the surface. The next turn, imperial control is restored and they rebuild the PDF.
And Imperial Guard fleets tend to be rare in terms of their rescue capabilities.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it possible to cheese all of these dispo/planet dispo rewards, by leaving a squad on the planet and waiting for a lvl 1 enemy to pop up? I think there should be some kind of relation to the enemy power fought.

Also, population % from max should matter, perhaps.

I'm trying to think of a way to avoid this i guess cooldown after cleaning the planet will suffice. my old method of making whatever you save somehow your responsibility is kinda bad.

p_owner[_run] = eFACTION.Mechanicus;
} else if (p_type[_run] != "Dead") { // If originally Imperial or other non-specific (and not dead)
who_return = "the planetary governor"; // Default return description
if (who_cleansed == "Tau") { who_return = "a loyal governor"; } // Special description for Tau cleanse

// Check if Sisters should get control or bonus
var _is_shrine_or_cathedral = (p_type[_run] == "Shrine" || planet_feature_bool(p_feature[_run], P_features.Sororitas_Cathedral));
if (p_first[_run] == eFACTION.Ecclesiarchy || _is_shrine_or_cathedral) {
// If originally Ecclesiarchy, give them control back
if (p_first[_run] == eFACTION.Ecclesiarchy) {
p_owner[_run] = eFACTION.Ecclesiarchy;
who_return = "the Ecclesiarchy";
}
// Always give faction bonus if it was their original world OR a holy site
obj_controller.disposition[eFACTION.Ecclesiarchy] += 5; // FACTION disposition bonus
} else { // If not originally Ecclesiarchy and not a holy site, defaults to Imperium
p_owner[_run] = eFACTION.Imperium;
}
} else { // If it's a dead world reverting
// If original owner wasn't Player/Mech/Eccl, default ownership to Imperium
if (p_first[_run] != eFACTION.Player && p_first[_run] != eFACTION.Mechanicus && p_first[_run] != eFACTION.Ecclesiarchy) {
p_owner[_run] = eFACTION.Imperium;
who_return = "Imperial Administration"; // Generic term for dead world
}
// Otherwise, it implies Player/Mech/Eccl originally owned the dead world,
// so the p_owner should have been set correctly by the p_first check earlier.
}

// --- Apply Generic Bonuses/Alerts if control returned meaningfully ---
if (who_return != "") {

// 1. Increase LOCAL governor disposition (capped)
dispo[_run] = clamp(dispo[_run] + 10, -90, 100);

// 2. Increment GLOBAL counter for enemies cleared
obj_controller.enemies_cleared_count += 1;

// 3. calls the function that handles the every-4-clears bonus
scr_battle_count();

// 4. Log the cleanse event
scr_event_log("green", $"{who_cleansed} cleansed from {planet_string}", name);

// 5. Create a screen alert message
scr_alert("green", "owner", $"{who_cleansed} cleansed from {planet_string}. Control returned to {who_return}.", x, y);

// 6. Check if high local disposition flips the planet to player control
if (dispo[_run] >= 100 && p_owner[_run] != eFACTION.Player && p_type[_run] != "Dead") {
p_owner[_run] = eFACTION.Player;
scr_alert(c_blue, "owner", $"The populace of {planet_string} pledges allegiance to your Chapter!", x, y);
}
} // End if (who_return != "")
} // End if (make_alert)
} // End if (planet_saved)

// Reset raided flag if it was set for this planet
if (p_raided[_run] > 0) { p_raided[_run] = 0; }

// IMPORTANT: Delete the PlanetData struct if it was used in this loop iteration
delete _planet_data; // Return allocated memory to the Omnissiah
} // end repeat here

// quene player battles here

Expand Down
1 change: 1 addition & 0 deletions scripts/scr_load_controller/scr_load_controller.gml
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ function scr_load_controller(save_id){
obj_ini.progenitor_disposition=ini_read_real("Controller","progenitor_disposition",0);
obj_ini.imperium_disposition=ini_read_real("Controller","imperium_disposition",0);
obj_controller.astartes_disposition=ini_read_real("Controller","astartes_disposition",0);
obj_controller.enemies_cleared_count = ini_read_real("Controller", "enemies_cleared_count", 0);

obj_controller.bat_devastator_column=ini_read_real("Controller","bat_devastator_column",1);
obj_controller.bat_assault_column=ini_read_real("Controller","bat_assault_column",4);
Expand Down
2 changes: 2 additions & 0 deletions scripts/scr_save_controller/scr_save_controller.gml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function scr_save_controller(save_id){
ini_write_string("Save","version",global.game_version);
ini_write_real("Save","play_time",play_time);
ini_write_real("Save","game_seed",global.game_seed);
ini_write_real("Save","use_custom_icon",obj_ini.use_custom_icon);

// obj_controller variables here
ini_write_real("boolean", "cheat_req", global.cheat_req);
Expand Down Expand Up @@ -173,6 +174,7 @@ function scr_save_controller(save_id){
ini_write_real("Controller","trial",obj_controller.recruit_trial);
ini_write_real("Controller","recruits",obj_controller.recruits);
ini_write_real("Controller","recruit_last",obj_controller.recruit_last);
ini_write_real("Controller", "enemies_cleared_count", obj_controller.enemies_cleared_count);
//
var g=-1;
repeat(30){g+=1;
Expand Down