From e6040c919046b479878125d15a027667954dd3ff Mon Sep 17 00:00:00 2001 From: EttyKitty <20323032+EttyKitty@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:41:10 +0300 Subject: [PATCH 1/3] List enemy targets in flavor text --- objects/obj_ncombat/Alarm_3.gml | 1 + .../scr_array_functions.gml | 41 ++++++++++++++++- scripts/scr_clean/scr_clean.gml | 7 ++- scripts/scr_flavor2/scr_flavor2.gml | 44 ++++++++++++------- 4 files changed, 74 insertions(+), 19 deletions(-) diff --git a/objects/obj_ncombat/Alarm_3.gml b/objects/obj_ncombat/Alarm_3.gml index 64e15afd9e..595b3408ba 100644 --- a/objects/obj_ncombat/Alarm_3.gml +++ b/objects/obj_ncombat/Alarm_3.gml @@ -104,6 +104,7 @@ if ((messages>0) and (messages_shown<8)) and (messages_shown<=100){ if (message_priority[that]=135) then newline_color="blue"; if (message_priority[that]=136) then newline_color="blue"; + if (string_count("lost",newline)>0) then newline_color="red"; scr_newtext(); messages_shown+=1; diff --git a/scripts/scr_array_functions/scr_array_functions.gml b/scripts/scr_array_functions/scr_array_functions.gml index 1a8a505201..cbd05ca6a3 100644 --- a/scripts/scr_array_functions/scr_array_functions.gml +++ b/scripts/scr_array_functions/scr_array_functions.gml @@ -43,4 +43,43 @@ function array_random_element(choice_array){ function array_random_index(choice_array){ return irandom(array_length(choice_array) - 1); -} \ No newline at end of file +} + +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 += "s"; + } + + 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; +} diff --git a/scripts/scr_clean/scr_clean.gml b/scripts/scr_clean/scr_clean.gml index 2f00cddd4f..da4ad03d0e 100644 --- a/scripts/scr_clean/scr_clean.gml +++ b/scripts/scr_clean/scr_clean.gml @@ -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) { @@ -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 @@ -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); } } @@ -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]); @@ -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); } } diff --git a/scripts/scr_flavor2/scr_flavor2.gml b/scripts/scr_flavor2/scr_flavor2.gml index 8f3f2e3e91..891fbe5997 100644 --- a/scripts/scr_flavor2/scr_flavor2.gml +++ b/scripts/scr_flavor2/scr_flavor2.gml @@ -15,16 +15,17 @@ function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapo j4 = "your formation"; j5 = "your vehicles"; - var _hostile_range, _hostile_weapon, _hostile_shots; + var _hostile_range, _hostile_weapon, _hostile_shots, _target_type; _hostile_range = 0; _hostile_weapon = ""; _hostile_shots = 0; + _target_type = target_type; - if (target_type != "wall") { + if (_target_type != "wall") { _hostile_range = hostile_range; _hostile_weapon = hostile_weapon; _hostile_shots = hostile_shots; - } else if (target_type = "wall") and(instance_exists(obj_nfort)) { + } else if (_target_type = "wall") and(instance_exists(obj_nfort)) { var hehh; hehh = "the fortification"; @@ -39,6 +40,10 @@ function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapo _hostile_shots = obj_nfort.hostile_shots; } + if (is_array(_target_type)) { + _target_type = array_combine_strings(_target_type); + } + if (_hostile_weapon = "Fleshborer") then _hostile_shots = _hostile_shots * 10; if (hostile_splash = 1) then _hostile_shots = max(1, round(_hostile_shots / 3)); @@ -271,18 +276,17 @@ function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapo if (flavor == 0) { flavor = true; + show_debug_message(_target_type); + show_debug_message(lost_units_count); if (_hostile_shots == 1) { - if (lost_units_count == 0) { - m1 += $"{_hostile_weapon} strikes, but fails to inflict any casualties."; - } else { - m1 += $"{_hostile_weapon} strikes. "; - } + m1 += $"{_hostile_weapon} strikes at {_target_type}"; } else { - if (lost_units_count == 0) { - m1 += $"{_hostile_shots} {_hostile_weapon}s strike, but fail to inflict any casualties."; - } else { - m1 += $"{_hostile_shots} {_hostile_weapon}s strike. "; - } + m1 += $"{_hostile_shots} {_hostile_weapon}s strike at {_target_type}"; + } + if (lost_units_count == 0) { + m1 += $", but fails to inflict any casualties."; + } else { + m1 += $". "; } } @@ -290,7 +294,7 @@ function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapo // m2="Blah blah blah"; - if (target_type = "wall") { + if (target_type == "wall") { mes = m1 + m2 + m3; if (string_length(mes) > 3) { @@ -394,10 +398,18 @@ function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapo if (lost_units_count = 1) then m2 += " has been incapacitated."; } - mes = m1 + m2 + m3; // show_message(mes); - if (string_length(mes) > 3) { + if (string_length(m1) > 0) { + obj_ncombat.messages += 1; + obj_ncombat.message[obj_ncombat.messages] = m1; + obj_ncombat.message_sz[obj_ncombat.messages] = lost_units_count + (0.5 - (obj_ncombat.messages / 100)); + obj_ncombat.message_priority[obj_ncombat.messages] = 0; + obj_ncombat.alarm[3] = 2; + } + + mes = m2 + m3; + if (string_length(mes)) { obj_ncombat.messages += 1; obj_ncombat.message[obj_ncombat.messages] = mes; obj_ncombat.message_sz[obj_ncombat.messages] = lost_units_count + (0.5 - (obj_ncombat.messages / 100)); From 49506c4502abdeda6172f86f2d659f672ff144bd Mon Sep 17 00:00:00 2001 From: EttyKitty <20323032+EttyKitty@users.noreply.github.com> Date: Wed, 23 Oct 2024 22:48:32 +0300 Subject: [PATCH 2/3] Flavor text overhaul v2 --- objects/obj_ncombat/Alarm_3.gml | 77 ++-- objects/obj_ncombat/Alarm_8.gml | 32 +- objects/obj_ncombat/Create_0.gml | 2 +- objects/obj_ncombat/Draw_0.gml | 14 +- objects/obj_ncombat/KeyPress_13.gml | 6 +- objects/obj_ncombat/Step_0.gml | 2 +- .../scr_array_functions.gml | 2 +- scripts/scr_cheatcode/scr_cheatcode.gml | 3 - scripts/scr_flavor2/scr_flavor2.gml | 375 +++++++++--------- scripts/scr_string/scr_string.gml | 29 +- 10 files changed, 298 insertions(+), 244 deletions(-) diff --git a/objects/obj_ncombat/Alarm_3.gml b/objects/obj_ncombat/Alarm_3.gml index 595b3408ba..05e9ce0dd0 100644 --- a/objects/obj_ncombat/Alarm_3.gml +++ b/objects/obj_ncombat/Alarm_3.gml @@ -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; @@ -78,40 +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"; - if (string_count("lost",newline)>0) then newline_color="red"; - 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; } @@ -122,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; @@ -138,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)))+"%"; diff --git a/objects/obj_ncombat/Alarm_8.gml b/objects/obj_ncombat/Alarm_8.gml index f2260b42e9..848eb5b9da 100644 --- a/objects/obj_ncombat/Alarm_8.gml +++ b/objects/obj_ncombat/Alarm_8.gml @@ -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; + // } } diff --git a/objects/obj_ncombat/Create_0.gml b/objects/obj_ncombat/Create_0.gml index 865f4cb397..1a2cf0590d 100644 --- a/objects/obj_ncombat/Create_0.gml +++ b/objects/obj_ncombat/Create_0.gml @@ -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]=""; diff --git a/objects/obj_ncombat/Draw_0.gml b/objects/obj_ncombat/Draw_0.gml index 0e9aee451b..f917bec4f7 100644 --- a/objects/obj_ncombat/Draw_0.gml +++ b/objects/obj_ncombat/Draw_0.gml @@ -40,11 +40,11 @@ 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; @@ -52,8 +52,10 @@ repeat(45){l+=1; // 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); diff --git a/objects/obj_ncombat/KeyPress_13.gml b/objects/obj_ncombat/KeyPress_13.gml index f4aa2a6e88..1a41fa0ffb 100644 --- a/objects/obj_ncombat/KeyPress_13.gml +++ b/objects/obj_ncombat/KeyPress_13.gml @@ -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; } @@ -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; } @@ -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; } diff --git a/objects/obj_ncombat/Step_0.gml b/objects/obj_ncombat/Step_0.gml index dadfaa9fd5..0f5d82bece 100644 --- a/objects/obj_ncombat/Step_0.gml +++ b/objects/obj_ncombat/Step_0.gml @@ -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"; diff --git a/scripts/scr_array_functions/scr_array_functions.gml b/scripts/scr_array_functions/scr_array_functions.gml index cbd05ca6a3..647f9d293b 100644 --- a/scripts/scr_array_functions/scr_array_functions.gml +++ b/scripts/scr_array_functions/scr_array_functions.gml @@ -65,7 +65,7 @@ function array_combine_strings(arr) { for (var j = 0; j < _array_length; j++) { var item = uniqueItems[j]; if (itemCounts[j] > 1) { - item += "s"; + item = string_plural(item); } if (_array_length > 1) { diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 7a7b733f75..6513e1809f 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -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); } } \ No newline at end of file diff --git a/scripts/scr_flavor2/scr_flavor2.gml b/scripts/scr_flavor2/scr_flavor2.gml index 891fbe5997..dd8458c9f6 100644 --- a/scripts/scr_flavor2/scr_flavor2.gml +++ b/scripts/scr_flavor2/scr_flavor2.gml @@ -3,10 +3,9 @@ function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapo if (obj_ncombat.wall_destroyed = 1) then exit; - var m1, m2, m3, mes; - m1 = ""; - m2 = ""; - m3 = ""; + var _enemy_attack_text, _units_lost_text, mes; + _enemy_attack_text = ""; + _units_lost_text = ""; var j1, j2, j3, j4, j5; j1 = "your men"; @@ -66,168 +65,168 @@ function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapo if (_hostile_weapon = "Daemonette Melee") { flavor = 1; - if (_hostile_shots > 1) then m1 = string(_hostile_shots) + " Daemonettes rake and claw at " + string(j1) + ". "; - if (_hostile_shots = 1) then m1 = "A Daemonette rakes and claws at " + string(j1) + ". "; + if (_hostile_shots > 1) then _enemy_attack_text = string(_hostile_shots) + " Daemonettes rake and claw at " + string(j1) + ". "; + if (_hostile_shots = 1) then _enemy_attack_text = "A Daemonette rakes and claws at " + string(j1) + ". "; } if (_hostile_weapon = "Plaguebearer Melee") { flavor = 1; - if (_hostile_shots > 1) then m1 = string(_hostile_shots) + " Plague Swords slash into " + string(j1) + ". "; - if (_hostile_shots = 1) then m1 = "A Plaguesword is swung into " + string(j1) + ". "; + if (_hostile_shots > 1) then _enemy_attack_text = string(_hostile_shots) + " Plague Swords slash into " + string(j1) + ". "; + if (_hostile_shots = 1) then _enemy_attack_text = "A Plaguesword is swung into " + string(j1) + ". "; } if (_hostile_weapon = "Bloodletter Melee") { flavor = 1; - if (_hostile_shots > 1) then m1 = string(_hostile_shots) + " Hellblades hiss and slash into " + string(j1) + ". "; - if (_hostile_shots = 1) then m1 = "A Bloodletter swings a Hellblade into " + string(j1) + ". "; + if (_hostile_shots > 1) then _enemy_attack_text = string(_hostile_shots) + " Hellblades hiss and slash into " + string(j1) + ". "; + if (_hostile_shots = 1) then _enemy_attack_text = "A Bloodletter swings a Hellblade into " + string(j1) + ". "; } if (_hostile_weapon = "Nurgle Vomit") { flavor = 1; - if (_hostile_shots > 1) then m1 = string(_hostile_shots) + " putrid, corrosive streams of Daemonic vomit spew into " + string(j1) + ". "; - if (_hostile_shots = 1) then m1 = "A putrid, corrosive stream of Daemonic vomit spews into " + string(j1) + ". "; + if (_hostile_shots > 1) then _enemy_attack_text = string(_hostile_shots) + " putrid, corrosive streams of Daemonic vomit spew into " + string(j1) + ". "; + if (_hostile_shots = 1) then _enemy_attack_text = "A putrid, corrosive stream of Daemonic vomit spews into " + string(j1) + ". "; } if (_hostile_weapon = "Maulerfiend Claws") { flavor = 1; - if (_hostile_shots > 1) then m1 = string(_hostile_shots) + " Maulerfiends advance, wrenching and smashing their claws into " + string(j1) + ". "; - if (_hostile_shots = 1) then m1 = "A Maulerfiend advances, wrenching and smashing its claws into " + string(j1) + ". "; + if (_hostile_shots > 1) then _enemy_attack_text = string(_hostile_shots) + " Maulerfiends advance, wrenching and smashing their claws into " + string(j1) + ". "; + if (_hostile_shots = 1) then _enemy_attack_text = "A Maulerfiend advances, wrenching and smashing its claws into " + string(j1) + ". "; } if (hostile_range > 1) { if (_hostile_weapon = "Big Shoota") { - m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z roar and blast away at " + string(j1) + ". "; + _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z roar and blast away at " + string(j1) + ". "; flavor = 1; } if (_hostile_weapon = "Dakkagun") { - m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z scream and rattle, blasting into " + string(j2) + ". "; + _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z scream and rattle, blasting into " + string(j2) + ". "; flavor = 1; } if (_hostile_weapon = "Deffgun") { - m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z scream and rattle, blasting into " + string(j2) + ". "; + _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z scream and rattle, blasting into " + string(j2) + ". "; flavor = 1; } if (_hostile_weapon = "Snazzgun") { - m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z scream and rattle, blasting into " + string(j2) + ". "; + _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z scream and rattle, blasting into " + string(j2) + ". "; flavor = 1; } if (_hostile_weapon = "Grot Blasta") { - m1 = "The Gretchin fire their shoddy weapons and club at your " + string(j3) + ". "; + _enemy_attack_text = "The Gretchin fire their shoddy weapons and club at your " + string(j3) + ". "; flavor = 1; } if (_hostile_weapon = "Kannon") { flavor = 1; - if (_hostile_shots > 1) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z belch out large caliber shells. "; - if (_hostile_shots = 1) then m1 = "A " + string(_hostile_weapon) + "z belches out a large caliber shell. "; + if (_hostile_shots > 1) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z belch out large caliber shells. "; + if (_hostile_shots = 1) then _enemy_attack_text = "A " + string(_hostile_weapon) + "z belches out a large caliber shell. "; } if (_hostile_weapon = "Shoota") { flavor = 1; var ranz; ranz = choose(1, 2, 3, 4); - if (ranz = 1) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z fire away at " + string(j3) + ". "; - if (ranz = 2) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z spit lead at " + string(j3) + ". "; - if (ranz = 3) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z blast at " + string(j3) + ". "; - if (ranz = 4) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z roar and fire at " + string(j3) + ". "; + if (ranz = 1) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z fire away at " + string(j3) + ". "; + if (ranz = 2) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z spit lead at " + string(j3) + ". "; + if (ranz = 3) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z blast at " + string(j3) + ". "; + if (ranz = 4) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z roar and fire at " + string(j3) + ". "; } if (_hostile_weapon = "Burna") { - m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z spray napalm into " + string(j3) + ". "; + _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z spray napalm into " + string(j3) + ". "; flavor = 1; } if (_hostile_weapon = "Skorcha") { - m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z spray huge gouts of napalm into " + string(j3) + ". "; + _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z spray huge gouts of napalm into " + string(j3) + ". "; flavor = 1; } if (_hostile_weapon = "Rokkit Launcha") { flavor = 1; var ranz; ranz = choose(1, 2, 2, 3, 3); - if (ranz = 1) then m1 = string(_hostile_shots) + " rokkitz shoot at " + string(j4) + ", the explosions disrupting. "; - if (ranz = 2) then m1 = string(_hostile_shots) + " rokkitz scream upward and then fall upon " + string(j4) + ". "; - if (ranz = 3) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z roar and fire their payloads. "; + if (ranz = 1) then _enemy_attack_text = string(_hostile_shots) + " rokkitz shoot at " + string(j4) + ", the explosions disrupting. "; + if (ranz = 2) then _enemy_attack_text = string(_hostile_shots) + " rokkitz scream upward and then fall upon " + string(j4) + ". "; + if (ranz = 3) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z roar and fire their payloads. "; } if (_hostile_weapon = "Staff of Light Shooting") and(_hostile_shots = 1) { - m1 = "A Staff of Light crackles with energy and fires upon " + string(j1) + ". "; + _enemy_attack_text = "A Staff of Light crackles with energy and fires upon " + string(j1) + ". "; flavor = 1; } if (_hostile_weapon = "Staff of Light Shooting") and(_hostile_shots > 1) { - m1 = string(_hostile_shots) + " Staves of Light crackle with energy and fire upon " + string(j1) + ". "; + _enemy_attack_text = string(_hostile_shots) + " Staves of Light crackle with energy and fire upon " + string(j1) + ". "; flavor = 1; } if (_hostile_weapon = "Gauss Flayer") or(_hostile_weapon = "Gauss Blaster") or(_hostile_weapon = "Gauss Flayer Array") { flavor = 1; var ranz; ranz = choose(1, 2, 3, 4); - if (ranz = 1) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "s shoot at " + string(j3) + ". "; - if (ranz = 2) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "s crackle and fire at " + string(j3) + ". "; - if (ranz = 3) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "s discharge upon " + string(j3) + ". "; - if (ranz = 4) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "s spew green energy at " + string(j3) + ". "; + if (ranz = 1) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "s shoot at " + string(j3) + ". "; + if (ranz = 2) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "s crackle and fire at " + string(j3) + ". "; + if (ranz = 3) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "s discharge upon " + string(j3) + ". "; + if (ranz = 4) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "s spew green energy at " + string(j3) + ". "; } if (_hostile_weapon = "Gauss Cannon") or(_hostile_weapon = "Overcharged Gauss Cannon") or(_hostile_weapon = "Gauss Flux Arc") { flavor = 1; var ranz; ranz = choose(1, 2, 3); - if (ranz = 1) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "s charge and then blast at " + string(j3) + ". "; - if (ranz = 2) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "s crackle with a sick amount of energy before firing at " + string(j3) + ". "; - if (ranz = 3) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "s pulse with energy and then discharge upon " + string(j3) + ". "; + if (ranz = 1) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "s charge and then blast at " + string(j3) + ". "; + if (ranz = 2) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "s crackle with a sick amount of energy before firing at " + string(j3) + ". "; + if (ranz = 3) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "s pulse with energy and then discharge upon " + string(j3) + ". "; } if (_hostile_weapon = "Gauss Particle Cannon") { flavor = 1; - m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "s shine a sick green, pulsing with energy, and then blast solid beams of energy into " + string(j3) + ". "; + _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "s shine a sick green, pulsing with energy, and then blast solid beams of energy into " + string(j3) + ". "; } if (_hostile_weapon = "Particle Whip") { flavor = 1; - if (_hostile_shots = 1) then m1 = "The apex of the Monolith pulses with energy. An instant layer it fires, the solid beam of energy crashing into " + string(j3) + ". "; - if (_hostile_shots > 1) then m1 = "The apex of " + string(_hostile_shots) + " Monoliths pulse with energy. An instant later they fire, the solid beams of energy crashing into " + string(j3) + ". "; + if (_hostile_shots = 1) then _enemy_attack_text = "The apex of the Monolith pulses with energy. An instant layer it fires, the solid beam of energy crashing into " + string(j3) + ". "; + if (_hostile_shots > 1) then _enemy_attack_text = "The apex of " + string(_hostile_shots) + " Monoliths pulse with energy. An instant later they fire, the solid beams of energy crashing into " + string(j3) + ". "; } if (_hostile_weapon = "Doomsday Cannon") { flavor = 1; - if (_hostile_shots = 1) then m1 = "A Doomsday Arc crackles with energy and then fires. The resulting blast is blinding in intensity, the ground shaking before its might. "; - if (_hostile_shots > 1) then m1 = string(_hostile_shots) + " Doomsday Arcs crackle with energy and then fire. The resulting blasts are blinding in intensity, the ground shaking. "; + if (_hostile_shots = 1) then _enemy_attack_text = "A Doomsday Arc crackles with energy and then fires. The resulting blast is blinding in intensity, the ground shaking before its might. "; + if (_hostile_shots > 1) then _enemy_attack_text = string(_hostile_shots) + " Doomsday Arcs crackle with energy and then fire. The resulting blasts are blinding in intensity, the ground shaking. "; } if (_hostile_weapon = "Eldritch Fire") { flavor = 1; - if (_hostile_shots = 1) then m1 = "A Pink Horror spits out a globlet of bright energy. The bolt smashes into " + string(j3) + ". "; - if (_hostile_shots > 1) then m1 = string(_hostile_shots) + " Pink Horrors spit and throw bolts of warp energy into " + string(j3) + ". "; + if (_hostile_shots = 1) then _enemy_attack_text = "A Pink Horror spits out a globlet of bright energy. The bolt smashes into " + string(j3) + ". "; + if (_hostile_shots > 1) then _enemy_attack_text = string(_hostile_shots) + " Pink Horrors spit and throw bolts of warp energy into " + string(j3) + ". "; } } if (_hostile_shots > 0) { if (_hostile_weapon = "Choppa") { - m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z cleave into " + string(j2) + ". "; + _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z cleave into " + string(j2) + ". "; flavor = 1; } if (_hostile_weapon = "Power Klaw") { - m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z rip and tear at " + string(j4) + ". "; + _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z rip and tear at " + string(j4) + ". "; flavor = 1; } if (_hostile_weapon = "Venom Claws") { - if (_hostile_shots > 1) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + " rake at " + string(j4) + ". "; + if (_hostile_shots > 1) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + " rake at " + string(j4) + ". "; flavor = 1; - if (_hostile_shots = 1) then m1 = "The Spyrer rakes at " + string(j4) + " with his " + string(_hostile_weapon) + ". "; + if (_hostile_shots = 1) then _enemy_attack_text = "The Spyrer rakes at " + string(j4) + " with his " + string(_hostile_weapon) + ". "; flavor = 1; } if (_hostile_weapon = "Slugga") { flavor = 1; var ranz; ranz = choose(1, 2, 3, 4); - if (ranz = 1) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z fire away at " + string(j3) + ". "; - if (ranz = 2) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z spit lead at " + string(j3) + ". "; - if (ranz = 3) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z blast at " + string(j3) + ". "; - if (ranz = 4) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z roar and fire at " + string(j3) + ". "; + if (ranz = 1) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z fire away at " + string(j3) + ". "; + if (ranz = 2) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z spit lead at " + string(j3) + ". "; + if (ranz = 3) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z blast at " + string(j3) + ". "; + if (ranz = 4) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z roar and fire at " + string(j3) + ". "; } if (_hostile_weapon = "Tankbusta Bomb") { flavor = 1; var ranz; ranz = choose(1, 2, 3); - if (ranz = 1) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z are attached to " + string(j5) + ". "; - if (ranz = 2) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z are clamped onto " + string(j5) + ". "; - if (ranz = 3) then m1 = string(_hostile_shots) + " " + string(_hostile_weapon) + "z are flung into " + string(j2) + ". "; + if (ranz = 1) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z are attached to " + string(j5) + ". "; + if (ranz = 2) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z are clamped onto " + string(j5) + ". "; + if (ranz = 3) then _enemy_attack_text = string(_hostile_shots) + " " + string(_hostile_weapon) + "z are flung into " + string(j2) + ". "; } if (_hostile_weapon = "Melee1") and(enemy = 7) { flavor = 1; var ranz; ranz = choose(1, 2, 3); - if (ranz = 1) then m1 = string(_hostile_shots) + " Orks club and smash at " + string(j3) + ". "; - if (ranz = 2) then m1 = string(_hostile_shots) + " Orks shoot their Slugas and smash gunbarrels into " + string(j2) + ". "; - if (ranz = 3) then m1 = string(_hostile_shots) + " Orks claw and punch at " + string(j3) + ". "; + if (ranz = 1) then _enemy_attack_text = string(_hostile_shots) + " Orks club and smash at " + string(j3) + ". "; + if (ranz = 2) then _enemy_attack_text = string(_hostile_shots) + " Orks shoot their Slugas and smash gunbarrels into " + string(j2) + ". "; + if (ranz = 3) then _enemy_attack_text = string(_hostile_shots) + " Orks claw and punch at " + string(j3) + ". "; } if (_hostile_weapon = "Staff of Light") { @@ -235,67 +234,60 @@ function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapo if (_hostile_shots = 1) { var ranz; ranz = choose(1, 2, 3); - if (ranz = 1) then m1 = "A " + string(_hostile_weapon) + " crackles and is swung into " + string(j3) + ". "; - if (ranz = 2) then m1 = "A " + string(_hostile_weapon) + " pulses and smashes through " + string(j3) + ". "; - if (ranz = 3) then m1 = "A " + string(_hostile_weapon) + " crackles and smashes into " + string(j3) + ". "; + if (ranz = 1) then _enemy_attack_text = "A " + string(_hostile_weapon) + " crackles and is swung into " + string(j3) + ". "; + if (ranz = 2) then _enemy_attack_text = "A " + string(_hostile_weapon) + " pulses and smashes through " + string(j3) + ". "; + if (ranz = 3) then _enemy_attack_text = "A " + string(_hostile_weapon) + " crackles and smashes into " + string(j3) + ". "; } if (_hostile_shots > 1) { var ranz; ranz = choose(1, 2, 3); - if (ranz = 1) then m1 = string(_hostile_shots) + " Staves of Light strike at " + string(j3) + ". "; - if (ranz = 2) then m1 = string(_hostile_shots) + " Staves of Light smash at " + string(j3) + ". "; - if (ranz = 3) then m1 = string(_hostile_shots) + " Staves of Light swing into " + string(j3) + ". "; + if (ranz = 1) then _enemy_attack_text = string(_hostile_shots) + " Staves of Light strike at " + string(j3) + ". "; + if (ranz = 2) then _enemy_attack_text = string(_hostile_shots) + " Staves of Light smash at " + string(j3) + ". "; + if (ranz = 3) then _enemy_attack_text = string(_hostile_shots) + " Staves of Light swing into " + string(j3) + ". "; } } if (_hostile_weapon = "Warscythe") { flavor = 1; var ranz; ranz = choose(1, 2, 3); - if (ranz = 1) then m1 = string(_hostile_shots) + " Warscythes strike at " + string(j3) + ". "; - if (ranz = 2) then m1 = string(_hostile_shots) + " Warscythes of Light slice into " + string(j3) + ". "; - if (ranz = 3) then m1 = string(_hostile_shots) + " Warscythes of Light hew " + string(j3) + ". "; + if (ranz = 1) then _enemy_attack_text = string(_hostile_shots) + " Warscythes strike at " + string(j3) + ". "; + if (ranz = 2) then _enemy_attack_text = string(_hostile_shots) + " Warscythes of Light slice into " + string(j3) + ". "; + if (ranz = 3) then _enemy_attack_text = string(_hostile_shots) + " Warscythes of Light hew " + string(j3) + ". "; } if (_hostile_weapon = "Claws") { flavor = 1; if (_hostile_shots = 1) { var ranz; ranz = choose(1, 2, 3); - if (ranz = 1) then m1 = "A massive claw slices through " + string(j3) + ". "; - if (ranz = 2) then m1 = "A razor-sharp claw slashes into " + string(j3) + ". "; - if (ranz = 3) then m1 = "A large necron claw strikes at " + string(j3) + ". "; + if (ranz = 1) then _enemy_attack_text = "A massive claw slices through " + string(j3) + ". "; + if (ranz = 2) then _enemy_attack_text = "A razor-sharp claw slashes into " + string(j3) + ". "; + if (ranz = 3) then _enemy_attack_text = "A large necron claw strikes at " + string(j3) + ". "; } if (_hostile_shots > 1) { var ranz; ranz = choose(1, 2, 3); - if (ranz = 1) then m1 = string(_hostile_shots) + " massive claws strike and slice at " + string(j3) + ". "; - if (ranz = 2) then m1 = string(_hostile_shots) + " razor-sharp claws assault " + string(j3) + ". "; - if (ranz = 3) then m1 = string(_hostile_shots) + " large necron claws strike at and shred " + string(j3) + ". "; + if (ranz = 1) then _enemy_attack_text = string(_hostile_shots) + " massive claws strike and slice at " + string(j3) + ". "; + if (ranz = 2) then _enemy_attack_text = string(_hostile_shots) + " razor-sharp claws assault " + string(j3) + ". "; + if (ranz = 3) then _enemy_attack_text = string(_hostile_shots) + " large necron claws strike at and shred " + string(j3) + ". "; } } } if (flavor == 0) { flavor = true; - show_debug_message(_target_type); - show_debug_message(lost_units_count); if (_hostile_shots == 1) { - m1 += $"{_hostile_weapon} strikes at {_target_type}"; + _enemy_attack_text += $"{_hostile_weapon} strikes at {_target_type}..."; } else { - m1 += $"{_hostile_shots} {_hostile_weapon}s strike at {_target_type}"; - } - if (lost_units_count == 0) { - m1 += $", but fails to inflict any casualties."; - } else { - m1 += $". "; + _enemy_attack_text += $"{_hostile_shots} {string_plural(_hostile_weapon)} strike at {_target_type}..."; } } // show_message(mes); - // m2="Blah blah blah"; + // _units_lost_text="Blah blah blah"; if (target_type == "wall") { - mes = m1 + m2 + m3; + mes = _enemy_attack_text + _units_lost_text; if (string_length(mes) > 3) { obj_ncombat.messages += 1; @@ -315,106 +307,135 @@ function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapo } } exit; - } - - var marine_length = array_length(marine_type); - var s, him, special, unit, unit_role, units_lost, plural; - var lost_roles_count = array_length(lost); - for (var role_index = 0; role_index < lost_roles_count; role_index++) { - unit_role = lost[role_index]; - units_lost = lost_num[role_index]; - if (unit_role != "" && units_lost > 0) { - special = ( - is_specialist(unit_role, "heads") || - unit_role == "Chapter Master" || - unit_role == "Venerable " + string(obj_ini.role[100][6]) || - unit_role == obj_ini.role[100][5] || - obj_ncombat.player_max <= 6 - ); - - if (!special) { - plural = units_lost > 1 ? "s" : ""; - m2 += $"{units_lost} {unit_role}{plural}, "; - } else { - him = -1; // Find which unit this is - for (var marine = 0; marine < marine_length; marine++) { - if (marine_type[marine] == unit_role && marine_hp[marine] <= 0) { - him = marine; - break; // found the unit - } - } - - if (him != -1) { // found a valid unit - obj_ncombat.dead_jims += 1; - if (marine_type[him] == obj_ini.role[100][5]) { - obj_ncombat.dead_jim[obj_ncombat.dead_jims] = $"A {marine_type[him]} has been critically injured!"; - } else { - obj_ncombat.dead_jim[obj_ncombat.dead_jims] = $"{unit_struct[him].name_role()} has been critically injured!"; - } - } - } - } - } - - - var unce = 0; - - if (string_count(", ", m2) > 1) { - - // show_message(m2); - - var lis, y1, y2; - lis = string_rpos(", ", m2); - m2 = string_delete(m2, lis, 3); // This clears the last ', ' and replaces it with the end statement - if (lost_units_count > 1) then m2 += " have been lost."; - - // show_message(m2); - - lis = string_rpos(", ", m2); // Find the new last ', ' and replace it with the and part - m2 = string_delete(m2, lis, 2); - - // show_message(m2); - - if (string_count(",", m2) > 1) then m2 = string_insert(", and ", m2, lis); - if (string_count(",", m2) = 0) then m2 = string_insert(" and ", m2, lis); - - // show_message(m2); - - unce = 1; - } + } else if (lost_units_count > 0) { + var lost_roles_count = array_length(lost); + var marine_length = array_length(marine_type); + var s, him, special, unit, unit_role, units_lost; + _units_lost_text = $"..."; + for (var role_index = 0; role_index < lost_roles_count; role_index++) { + unit_role = lost[role_index]; + units_lost = lost_num[role_index]; + if (unit_role != "" && units_lost > 0) { + special = ( + is_specialist(unit_role, "heads") || + unit_role == "Chapter Master" || + unit_role == "Venerable " + string(obj_ini.role[100][6]) || + unit_role == obj_ini.role[100][5] || + obj_ncombat.player_max <= 6 + ); + + if (!special) { + var _unit_role_formatted = units_lost > 1 ? string_plural(unit_role) : unit_role; + _units_lost_text += $"{units_lost} {_unit_role_formatted}, "; + } else { + him = -1; // Find which unit this is + for (var marine = 0; marine < marine_length; marine++) { + if (marine_type[marine] == unit_role && marine_hp[marine] <= 0) { + him = marine; + break; // found the unit + } + } + + if (him != -1) { // found a valid unit + obj_ncombat.dead_jims += 1; + if (marine_type[him] == obj_ini.role[100][5]) { + obj_ncombat.dead_jim[obj_ncombat.dead_jims] = $"A {marine_type[him]} has been critically injured!"; + } else { + obj_ncombat.dead_jim[obj_ncombat.dead_jims] = $"{unit_struct[him].name_role()} has been critically injured!"; + } + } + } + } + } - if (string_count(", ", m2) = 1) and(unce = 0) and(hostile_weapon != "Web Spinner") { - var lis, y1, y2; - lis = string_rpos(", ", m2); - m2 = string_delete(m2, lis, 3); - if (lost_units_count > 1) then m2 += " have been lost."; - if (lost_units_count = 1) then m2 += " has been lost."; - } - if (string_count(", ", m2) = 1) and(unce = 0) and(hostile_weapon = "Web Spinner") { - var lis, y1, y2; - lis = string_rpos(", ", m2); - m2 = string_delete(m2, lis, 3); - if (lost_units_count > 1) then m2 += " have been incapacitated."; - if (lost_units_count = 1) then m2 += " has been incapacitated."; + var unce = 0; + if (string_count(", ", _units_lost_text) > 1) { + + // show_message(_units_lost_text); + + var lis, y1, y2; + lis = string_rpos(", ", _units_lost_text); + _units_lost_text = string_delete(_units_lost_text, lis, 3); // This clears the last ', ' and replaces it with the end statement + if (lost_units_count > 1) then _units_lost_text += " have been lost."; + + // show_message(_units_lost_text); + + lis = string_rpos(", ", _units_lost_text); // Find the new last ', ' and replace it with the and part + _units_lost_text = string_delete(_units_lost_text, lis, 2); + + // show_message(_units_lost_text); + + if (string_count(",", _units_lost_text) > 1) then _units_lost_text = string_insert(", and ", _units_lost_text, lis); + if (string_count(",", _units_lost_text) = 0) then _units_lost_text = string_insert(" and ", _units_lost_text, lis); + + // show_message(_units_lost_text); + + unce = 1; + } + + if (string_count(", ", _units_lost_text) = 1) and(unce = 0) and(hostile_weapon != "Web Spinner") { + var lis, y1, y2; + lis = string_rpos(", ", _units_lost_text); + _units_lost_text = string_delete(_units_lost_text, lis, 3); + if (lost_units_count > 1) then _units_lost_text += " have been lost."; + if (lost_units_count = 1) then _units_lost_text += " has been lost."; + } + if (string_count(", ", _units_lost_text) = 1) and(unce = 0) and(hostile_weapon = "Web Spinner") { + var lis, y1, y2; + lis = string_rpos(", ", _units_lost_text); + _units_lost_text = string_delete(_units_lost_text, lis, 3); + if (lost_units_count > 1) then _units_lost_text += " have been incapacitated."; + if (lost_units_count = 1) then _units_lost_text += " has been incapacitated."; + } + } else { + var ir = irandom(8); + switch (ir) { + case 0: + _units_lost_text = "... no damage was inflicted."; + break; + case 1: + _units_lost_text = "...the attack's impact was negligible."; + break; + case 2: + _units_lost_text = "...attack left no mark on the target."; + break; + case 3: + _units_lost_text = "...enemy's efforts were in vain."; + break; + case 4: + _units_lost_text = "...yet defences held firm."; + break; + case 5: + _units_lost_text = "... but didn't manage to damage its target."; + break; + case 6: + _units_lost_text = "...the target appears unscratched."; + break; + case 7: + _units_lost_text = "...no damage was inflicted in the fray."; + break; + case 8: + _units_lost_text = "...the attack yielded no damage."; + break; + } } // show_message(mes); - if (string_length(m1) > 0) { + if (string_length(_enemy_attack_text) > 0) { obj_ncombat.messages += 1; - obj_ncombat.message[obj_ncombat.messages] = m1; - obj_ncombat.message_sz[obj_ncombat.messages] = lost_units_count + (0.5 - (obj_ncombat.messages / 100)); + obj_ncombat.message[obj_ncombat.messages] = _enemy_attack_text + _units_lost_text + "unit_lost_text"; + obj_ncombat.message_sz[obj_ncombat.messages] = 2500; obj_ncombat.message_priority[obj_ncombat.messages] = 0; obj_ncombat.alarm[3] = 2; } - mes = m2 + m3; - if (string_length(mes)) { - obj_ncombat.messages += 1; - obj_ncombat.message[obj_ncombat.messages] = mes; - obj_ncombat.message_sz[obj_ncombat.messages] = lost_units_count + (0.5 - (obj_ncombat.messages / 100)); - obj_ncombat.message_priority[obj_ncombat.messages] = 0; - obj_ncombat.alarm[3] = 2; - } + // if (string_length(_units_lost_text) > 0) { + // obj_ncombat.messages += 1; + // obj_ncombat.message[obj_ncombat.messages] = _units_lost_text + "unit_lost_text"; + // obj_ncombat.message_sz[obj_ncombat.messages] = 2500; + // obj_ncombat.message_priority[obj_ncombat.messages] = 0; + // obj_ncombat.alarm[3] = 2; + // } } \ No newline at end of file diff --git a/scripts/scr_string/scr_string.gml b/scripts/scr_string/scr_string.gml index 266186bab6..5d7cd4b57b 100644 --- a/scripts/scr_string/scr_string.gml +++ b/scripts/scr_string/scr_string.gml @@ -18,9 +18,32 @@ function string_upper_first(_string) { return _modified_string; } catch(_exception) { - log_into_file(_exception.longMessage); - log_into_file(_exception.script); - log_into_file(_exception.stacktrace); + show_debug_message(_exception.longMessage); + } +} + +/// @function string_has_digits +/// @description Returns true if the string has any digits in it. +/// @param {string} +/// @returns {bool} +function string_has_digits(_string) { + try { + return string_length(string_digits(_string)) > 0; + } + catch(_exception) { + show_debug_message(_exception.longMessage); + } +} + +/// @function string_is_digits +/// @description Returns true if the string has only digits and no letters. +/// @param {string} +/// @returns {bool} +function string_is_digits(_string) { + try { + return string_length(string_digits(_string)) == string_length(_string); + } + catch(_exception) { show_debug_message(_exception.longMessage); } } \ No newline at end of file From b79b079c826738ab4e2dd31b3bf4bc08352e622c Mon Sep 17 00:00:00 2001 From: EttyKitty <20323032+EttyKitty@users.noreply.github.com> Date: Wed, 23 Oct 2024 22:48:45 +0300 Subject: [PATCH 3/3] Basic stitch config --- stitch.config.json | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 stitch.config.json diff --git a/stitch.config.json b/stitch.config.json new file mode 100644 index 0000000000..010eac541a --- /dev/null +++ b/stitch.config.json @@ -0,0 +1,48 @@ +{ + "gameConsoleStyle": { + "base": "color:#808080;", + "lines": [ + { + "pattern" : "^Warning : reference to extension macro", + "base" : "color:#808080;" + }, + { + "pattern" : "^WARNING: Could not find any events", + "base" : "color:#808080;" + }, + { + "pattern" : "^WARNING: Could not find animation", + "base" : "color:#808080;" + }, + { + "pattern" : "^Pause event has been", + "base" : "color:#4A4A4A;" + }, + { + "pattern" : "is cropped, sprites used by Spine must be uncropped$", + "base" : "color:#808080;" + }, + { + "pattern": "\\berror\\b", + "base": "color: #FF0000; font-weight: bold;" + }, + { + "pattern": "\\bwarn(ing)?\\b", + "base": "color: #FFD900" + }, + { + "base": "color: [#808080](https://github.com/bscotch/stitch/issues/808080);", + "description": "Bscotch Echo", + "pattern": "^(?(?struct)|(?Struct\\.(?[^|]+))|(?o_rumpus[^|]+)|(?o_http_controller)|(?o_[^|]+))\\|(?