Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
76 changes: 44 additions & 32 deletions objects/obj_ncombat/Alarm_3.gml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ i+=1;if (message[i]!="") then show_message(message[i]);
i+=1;if (message[i]!="") then show_message(message[i]);*/



repeat(100){
if (good=0){
changed=0;i=0;
Expand Down Expand Up @@ -78,39 +77,54 @@ repeat(100){
}


if ((messages > 0) and (messages_shown < messages_to_show)) {
show_debug_message("Message Received!");
var that_sz, that; // show_message("Largest Message");
that_sz = 0;
that = 0;


if ((messages>0) and (messages_shown<8)) and (messages_shown<=100){
var that_sz,that;// show_message("Largest Message");
that_sz=0;that=0;

i=0;repeat(60){
i+=1;
if (message[i]!="") and (message_sz[i]>that_sz){
that_sz=message_sz[i];that=i;
var i = 0;
repeat(100) {
i += 1;
if (message[i] != "") and(message_sz[i] > that_sz) {
that_sz = message_sz[i];
that = i;
}
}
if (that!=0) and (that_sz>0){
newline=message[that];
if (message_priority[that]>0) then newline_color="bright";
if (string_count(" casts '",newline)>0) then newline_color="blue";
if (string_count("Perils of the Warp!",newline)>0) then newline_color="red";
if (string_count("^",newline)>0){
newline=string_replace(newline,"^","");
newline_color="white";

if (that != 0) and(that_sz > 0) {
newline = message[that];

if (newline_color == "") {
if (string_count(" casts '", newline) > 0) then newline_color = "blue";
if (string_count("Perils of the Warp!", newline) > 0) then newline_color = "red";
if (string_count("confers knowledge", newline) > 0) then newline_color = "purple";
if (string_count("^", newline) > 0) {
newline_color = "white";
newline = string_replace(newline, "^", "");
}
if (string_count("unit_lost_text", newline) > 0) {
if (string_count("been lost", newline) > 0) {
newline_color = "red";
} else {
newline_color = c_gray;
}
newline = string_replace(newline, "unit_lost_text", "");
}
if (message_priority[that] > 0) then newline_color = "bright";
if (message_priority[that] = 2.1) then newline_color = "purple";
if (message_priority[that] = 135) then newline_color = "blue";
if (message_priority[that] = 136) then newline_color = "blue";
}
if (message_priority[that]=2.1) then newline_color="purple";
if (string_count("confers knowledge",newline)>0) then newline_color="purple";

if (message_priority[that]=135) then newline_color="blue";
if (message_priority[that]=136) then newline_color="blue";

scr_newtext();
messages_shown+=1;
largest+=1;
message[that]="";message_sz[that]=0;message_priority[that]=0;messages-=1;
messages_shown += 1;
largest += 1;
message[that] = "";
message_sz[that] = 0;
message_priority[that] = 0;
messages -= 1;
}

alarm[3]=2;
}

Expand All @@ -121,9 +135,7 @@ if ((messages>0) and (messages_shown<8)) and (messages_shown<=100){



if (messages=0) or (messages_shown>=8) then messages_shown=999;

if (messages=0) then messages_shown=999;
if (messages==0) or (messages_shown> messages_to_show) then messages_shown=999;

/*var noloss;noloss=instance_nearest(50,300,obj_pnunit);
if (!instance_exists(noloss)) then player_forces=0;
Expand All @@ -137,7 +149,7 @@ if (instance_exists(obj_pnunit)){
if (!instance_exists(obj_pnunit)) then player_forces=0;


if ((messages_shown=999) or (messages=0)) and (timer_stage=2){
if ((messages_shown=999) or (messages=0)){
newline_color="yellow";
if (obj_ncombat.enemy!=6){
if (enemy_forces>0) and (obj_ncombat.enemy!=30) then newline="Enemy Forces at "+string(max(1,round((enemy_forces/enemy_max)*100)))+"%";
Expand Down
32 changes: 16 additions & 16 deletions objects/obj_ncombat/Alarm_8.gml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@

if (enemy_forces!=0) and (player_forces!=0) and (battle_over=0){

if ((enemy=6)) and (timer_stage=2){
timer_stage=3;
// if ((enemy=6)) and (timer_stage=2){
// timer_stage=3;

messages=0;messages_to_show=8;largest=0;random_messages=0;priority=0;messages_shown=0;
}
// messages=0;messages_to_show=100;largest=0;random_messages=0;priority=0;messages_shown=0;
// }

if ((enemy!=6)) and (timer_stage=2){
timer_stage=3;
// if ((enemy!=6)) and (timer_stage=2){
// timer_stage=3;

messages=0;messages_to_show=8;largest=0;random_messages=0;priority=0;messages_shown=0;
}
// messages=0;messages_to_show=100;largest=0;random_messages=0;priority=0;messages_shown=0;
// }

if ((enemy=6)) and (timer_stage=4){
timer_stage=5;
// if ((enemy=6)) and (timer_stage=4){
// timer_stage=5;

messages=0;messages_to_show=8;largest=0;random_messages=0;priority=0;messages_shown=0;
}
// messages=0;messages_to_show=100;largest=0;random_messages=0;priority=0;messages_shown=0;
// }

if ((enemy!=6)) and (timer_stage=4){
timer_stage=5;
// if ((enemy!=6)) and (timer_stage=4){
// timer_stage=5;

messages=0;messages_to_show=8;largest=0;random_messages=0;priority=0;messages_shown=0;
}
// messages=0;messages_to_show=100;largest=0;random_messages=0;priority=0;messages_shown=0;
// }

}

Expand Down
2 changes: 1 addition & 1 deletion objects/obj_ncombat/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ player_defenses=0;player_silos=0;
enemy_forces=0;enemy_max=0;
hulk_forces=0;

i=-1;messages=0;messages_to_show=4;messages_shown=0;
i=-1;messages=0;messages_to_show=100;messages_shown=0;
largest=0;priority=0;random_messages=0;dead_enemies=0;
repeat(70){i+=1;
lines[i]="";
Expand Down
14 changes: 8 additions & 6 deletions objects/obj_ncombat/Draw_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,22 @@ repeat(45){l+=1;
// draw_text(x+6,y-10+(l*14),"."+string(lines[31-l]));
draw_set_color(38144);
if (lines_color[l]="red") then draw_set_color(255);
if (lines_color[l]="yellow") then draw_set_color(3055825);
if (lines_color[l]="purple") then draw_set_color(c_purple);
if (lines_color[l]="bright") then draw_set_color(65280);
if (lines_color[l]="white") then draw_set_color(c_silver);
if (lines_color[l]="blue"){
else if (lines_color[l]="yellow") then draw_set_color(3055825);
else if (lines_color[l]="purple") then draw_set_color(c_purple);
else if (lines_color[l]="bright") then draw_set_color(65280);
else if (lines_color[l]="white") then draw_set_color(c_silver);
else if (lines_color[l]="blue"){
var yep;yep=false;
if (scr_has_adv("Daemon Binders")){
yep=true;
}
// if (yep=false) then draw_set_color(16711680);
if (yep=false) then draw_set_color(16646566); // making non daemon binders have the same colour, to see the text easier
if (yep=true) then draw_set_color(16646566);
} else if (lines_color[l] != "") {
draw_set_color(lines_color[l]);
}
draw_text(x+6,y-10+(l*18),string_hash_to_newline(string(lines[l])));
draw_text_ext(x+6, y-10+(l*18)+string_height_ext(lines[l], 4, 790), string(lines[l]), 4, 795);
}

draw_set_color(38144);
Expand Down
6 changes: 3 additions & 3 deletions objects/obj_ncombat/KeyPress_13.gml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ if (timer_stage=1) or (timer_stage=5){
obj_pnunit.alarm[1]=1;
}
}
messages=0;messages_to_show=8;largest=0;random_messages=0;priority=0;messages_shown=0;
messages=0;messages_to_show=100;largest=0;random_messages=0;priority=0;messages_shown=0;
reset_combat_message_arrays();
timer_stage=2;timer=0;done=0;messages_shown=0;
}
Expand All @@ -134,7 +134,7 @@ else if (timer_stage=3){
obj_enunit.alarm[8]=4;
turns+=1;
}
var messages=0;messages_to_show=8;largest=0;random_messages=0;priority=0;messages_shown=0;
var messages=0;messages_to_show=100;largest=0;random_messages=0;priority=0;messages_shown=0;
reset_combat_message_arrays();
timer_stage=4;timer=0;done=0;messages_shown=0;
}
Expand All @@ -149,7 +149,7 @@ else if (timer_stage=3){
obj_enunit.alarm[1]=1;
}
// alarm[9]=5;
var i;i=0;messages=0;messages_to_show=8;largest=0;random_messages=0;priority=0;messages_shown=0;
var i;i=0;messages=0;messages_to_show=100;largest=0;random_messages=0;priority=0;messages_shown=0;
reset_combat_message_arrays();
timer_stage=4;timer=0;done=0;messages_shown=0;
}
Expand Down
2 changes: 1 addition & 1 deletion objects/obj_ncombat/Step_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ instance_activate_object(obj_centerline);
instance_activate_object(obj_cursor);


if ((fugg>=60) or (fugg2>=60)) and (messages_shown=0) and (messages_to_show=8) and (defeat_message=0){
if ((fugg>=60) or (fugg2>=60)) and (messages_shown=0) and (messages_to_show=100) and (defeat_message=0){
fugg=0;fugg2=0;
if ((messages_shown=999) or (messages=0)) and (timer_stage=2){
newline_color="yellow";
Expand Down
41 changes: 40 additions & 1 deletion scripts/scr_array_functions/scr_array_functions.gml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,43 @@ function array_random_element(choice_array){

function array_random_index(choice_array){
return irandom(array_length(choice_array) - 1);
}
}

function array_combine_strings(arr) {
var uniqueItems = [];
var itemCounts = [];

for (var i = 0; i < array_length(arr); i++) {
var item = arr[i];
if (!array_contains(uniqueItems, item)) {
array_push(uniqueItems, item);
array_push(itemCounts, 1);
} else {
var index = array_get_index(uniqueItems, item);
itemCounts[index]++;
}
}

var result = "";
var _array_length = array_length(uniqueItems);
for (var j = 0; j < _array_length; j++) {
var item = uniqueItems[j];
if (itemCounts[j] > 1) {
item = string_plural(item);
}

if (_array_length > 1) {
if (j == _array_length - 1) {
result += " and " + item;
} else if (j == _array_length - 2){
result += item;
} else {
result += item + ", ";
}
} else {
result = item;
}
}

return result;
}
3 changes: 0 additions & 3 deletions scripts/scr_cheatcode/scr_cheatcode.gml
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,6 @@ function scr_cheatcode(argument0) {
}
}
} catch(_exception) {
log_into_file(_exception.longMessage);
log_into_file(_exception.script);
log_into_file(_exception.stacktrace);
show_debug_message(_exception.longMessage);
}
}
7 changes: 5 additions & 2 deletions scripts/scr_clean/scr_clean.gml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function scr_clean(target_object, target_is_infantry, hostile_shots, hostile_dam
var vehicle_hits = 0;
var man_hits = 0;
var total_hits = hostile_shots;
var targets_hit = [];

// ### Vehicle Damage Processing ###
if (!target_is_infantry and veh > 0) {
Expand Down Expand Up @@ -51,6 +52,7 @@ function scr_clean(target_object, target_is_infantry, hostile_shots, hostile_dam
minus = 1;
}
veh_hp[you] -= minus;
array_push(targets_hit, veh_type[you]);
vehicle_hits++;

// Check if the vehicle is destroyed
Expand All @@ -75,7 +77,7 @@ function scr_clean(target_object, target_is_infantry, hostile_shots, hostile_dam

// Update flavor messages if required
if (vehicle_hits > 0) {
scr_flavor2(units_lost, "", hostile_range, hostile_weapon, vehicle_hits, hostile_splash);
scr_flavor2(units_lost, targets_hit, hostile_range, hostile_weapon, vehicle_hits, hostile_splash);
}
}

Expand Down Expand Up @@ -103,6 +105,7 @@ function scr_clean(target_object, target_is_infantry, hostile_shots, hostile_dam
var random_index = array_random_index(valid_marines);
var marine_index = valid_marines[random_index];
var marine = unit_struct[marine_index];
array_push(targets_hit, marine_type[marine_index]);

// Apply damage
var minus = hostile_damage - (2 * marine_ac[marine_index]);
Expand Down Expand Up @@ -167,7 +170,7 @@ function scr_clean(target_object, target_is_infantry, hostile_shots, hostile_dam

// After processing, update messages if any hits occurred
if (man_hits > 0) {
scr_flavor2(units_lost, "", hostile_range, hostile_weapon, man_hits, hostile_splash);
scr_flavor2(units_lost, targets_hit, hostile_range, hostile_weapon, man_hits, hostile_splash);
}
}

Expand Down
Loading