Skip to content
Merged
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
20 changes: 13 additions & 7 deletions objects/obj_enunit/Alarm_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var leftest,charge=0,enemy2=0,chapter_fuck=1,unit;
// with(obj_pnunit){if (x<-4000) or (defenses=1) then instance_deactivate_object(id);}

if (!flank){
leftest=get_leftmost(obj_enunit);// Left most enunit
leftest=get_leftmost(obj_enunit, false);// Left most enunit
enemy=get_rightmost();// Right most enemy
enemy2=enemy;
if (enemy=="none"||leftest=="none"){
Expand All @@ -23,7 +23,7 @@ if (!flank){


if (leftest.id=self.id) and (!instance_exists(obj_nfort)){
if (position_empty(x-10,y)) and (point_distance(x,y,enemy.x,enemy.y)>10){
if (position_empty(x-10,y)) and (point_distance(x,y,enemy.x,enemy.y)>=10){
with(obj_enunit){
move_unit_block("west");
}
Expand Down Expand Up @@ -318,20 +318,24 @@ if __b__



var leftest,charge,enemy2;charge=0;enemy2=0;
var leftest,charge=0,enemy2=0;

with(obj_pnunit){if (x<-4000) then instance_deactivate_object(id);}
with(obj_pnunit){
if (x<-4000) then instance_deactivate_object(id);
}

if (flank=0){
leftest=get_leftmost(obj_enunit);// Left most enunit
leftest=get_leftmost(obj_enunit, false);// Left most enunit
enemy=instance_nearest(4000,y,obj_pnunit);// Right most enemy
enemy2=enemy;
// if (collision_point(x-10,y,obj_pnunit,0,1)) then engaged=1;
// if (!collision_point(x-10,y,obj_pnunit,0,1)) then engaged=0;
if (leftest.id=self.id) and (!instance_exists(obj_nfort)){
// instance_deactivate_object(obj_cursor);
if (position_empty(x-10,y)){
with(obj_enunit){x-=10;}
with(obj_enunit){
x-=10;
}
}
}
// instance_activate_object(obj_cursor);
Expand All @@ -341,7 +345,9 @@ if (flank=1){
enemy2=enemy;
// if (collision_point(x+10,y,obj_pnunit,0,1)) then engaged=1;
// if (!collision_point(x+10,y,obj_pnunit,0,1)) then engaged=0;
if (position_empty(x+10,y)) then x+=10;
if (position_empty(x+10,y)){
move_unit_block();
}

if (!position_empty(x+10,y)) then engaged=1;// Quick smash
// instance_activate_object(obj_cursor);
Expand Down
23 changes: 17 additions & 6 deletions objects/obj_ncombat/Alarm_2.gml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,27 @@ enemy_max=enemy_forces;

instance_activate_object(obj_enunit);

if (dropping=1){
repeat(10){
var mm=instance_nearest(5000,240,obj_pnunit);
if (!collision_point(mm.x+10,mm.y,obj_enunit,0,1)) then with(obj_pnunit){
x+=10;
if (dropping){
var _player_front_row=get_rightmost();
if (_player_front_row!="none"){
if (!collision_point(_player_front_row.x+10,_player_front_row.y,obj_enunit,0,1)) then with(obj_pnunit){
var _enemy_front = get_leftmost(obj_enunit, false);
if (_enemy_front!="none"){
_player_front_row.x = _enemy_front.x-10;
}
}
}
repeat(10){
with(obj_enunit){
if (!collision_point(x-10,y,obj_pnunit,0,1)) and (!collision_point(x-10,y,obj_enunit,0,1)) then x-=10;
if (!flank){
if (!collision_point(x-10,y,obj_pnunit,0,1)) and (!collision_point(x-10,y,obj_enunit,0,1)){
move_unit_block("west");
}
} else {
if (!collision_point(x+10,y,obj_pnunit,0,1)) and (!collision_point(x+10,y,obj_enunit,0,1)){
move_unit_block("east");
}
}
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions objects/obj_ncombat/Alarm_5.gml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ alarm[8]=999999;
// show_message("Final Deaths: "+string(final_deaths));


if (turn_count >= 50){
part1 = "Your forces make a fighting retreat \n"
}
// check for wounded marines here to finish off, if defeated defending
var roles = obj_ini.role[100];
var ground_mission = (instance_exists(obj_ground_mission));
if (final_deaths+final_command_deaths>0){
part1=$"Marines Lost: {final_deaths+final_command_deaths}";
part1+=$"Marines Lost: {final_deaths+final_command_deaths}";
if (units_saved > 0){
part1+=$" ({roles[Role.APOTHECARY]}{apothecaries_alive>1?"s":""} prevented the death of {units_saved})";
}
Expand All @@ -28,7 +31,10 @@ if (final_deaths+final_command_deaths>0){
part2=string_delete(part2,string_length(part2)-1,2);
part2+=".";i=0;

if (injured>0){newline=part8;scr_newtext();}
if (injured>0){
newline=part8;
scr_newtext();
}
newline=part1;
scr_newtext();
newline=part2;
Expand Down
9 changes: 6 additions & 3 deletions objects/obj_ncombat/Alarm_7.gml
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,15 @@ if (scr_role_count("Chapter Master","")=0){
}


if (turn_count < 20){
if (defeat=0) and (threat>=4) then scr_recent("battle_victory",string(battle_loc)+" "+scr_roman(battle_id),enemy);

if (defeat=0) and (threat>=4) then scr_recent("battle_victory",string(battle_loc)+" "+scr_roman(battle_id),enemy);



if (defeat=1) and (final_deaths+final_command_deaths>=10) then scr_recent("battle_defeat",string(enemy),final_deaths+final_command_deaths);
if (defeat=1) and (final_deaths+final_command_deaths>=10) then scr_recent("battle_defeat",string(enemy),final_deaths+final_command_deaths);
} else {
scr_recent("battle_defeat",string(enemy),final_deaths+final_command_deaths);
}



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 @@ -9,7 +9,7 @@ repeat(15){co+=1;i=-1;
}
}co=0;i=0;hue=0;


turn_count = 0;
debugl("Ground Combat Started");

audio_stop_sound(snd_royal);
Expand Down
9 changes: 9 additions & 0 deletions objects/obj_ncombat/KeyPress_13.gml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ if (started=3){

// if (done>=1) then exit;



if (turn_count >= 50){
started=2;
}
if ((started=2) or (started=4)){
instance_activate_object(obj_pnunit);
instance_activate_object(obj_enunit);
Expand Down Expand Up @@ -99,6 +104,7 @@ if (timer_stage=1) or (timer_stage=5){
if (instance_exists(obj_pnunit)){
obj_pnunit.alarm[3]=2;
obj_pnunit.alarm[1]=3;
turn_count++;
obj_pnunit.alarm[0]=4;
}
// alarm[9]=5;
Expand All @@ -111,6 +117,7 @@ if (timer_stage=1) or (timer_stage=5){
}
if (instance_exists(obj_pnunit)){
obj_pnunit.alarm[1]=1;
turn_count++;
}
}
messages=0;messages_to_show=8;largest=0;random_messages=0;priority=0;messages_shown=0;
Expand All @@ -127,6 +134,7 @@ else if (timer_stage=3){
if (enemy!=6){
if (instance_exists(obj_pnunit)){
obj_pnunit.alarm[1]=1;
turn_count++;
}
if (instance_exists(obj_enunit)){
obj_enunit.alarm[1]=2;
Expand All @@ -142,6 +150,7 @@ else if (timer_stage=3){
if (instance_exists(obj_pnunit)){
obj_pnunit.alarm[3]=2;
obj_pnunit.alarm[1]=3;
turn_count++;
obj_pnunit.alarm[0]=4;
turns+=1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ function scr_player_combat_weapon_stacks() {
if (defenses=1) then exit;


var i,g=0;men=0;dreads=0;
veh=0
for (i=1;i<array_length(att);i++) {
var i,g=0;
veh=0;
men=0;
dreads=0;
for (i=0;i<array_length(att);i++) {
// dudes[i]="";
dudes_num[i]=0;
// dudes_vehicle[i]=0;
Expand All @@ -120,8 +122,8 @@ function scr_player_combat_weapon_stacks() {
if (marine_casting[g]>=0) then marine_casting[g]=0;
if (marine_casting[g]<0) then marine_casting[g]+=1;//timer for libs to be able to cast

if ((marine_id[g]>0) or (ally[g]=true)) and (unit.hp()>0) then marine_dead[g]=0;
if ((marine_id[g]>0) or (ally[g]=true)) and (unit.hp()>0) and (marine_dead[g]!=1){
if (unit.hp()>0) then marine_dead[g]=0;
if (unit.hp()>0 && marine_dead[g]!=true){
var head_role = unit.IsSpecialist();
var armour_data = unit.get_armour_data();
var is_dreadnought = false;
Expand Down Expand Up @@ -183,7 +185,7 @@ function scr_player_combat_weapon_stacks() {
}

var j=0,good=0,open=0;// Counts the number and types of marines within this object
for (j=1;j<=40;j++){
for (j=0;j<=40;j++){
if (dudes[j]=="") and (open==0){
open=j;// Determine if vehicle here

Expand Down Expand Up @@ -258,7 +260,7 @@ function scr_player_combat_weapon_stacks() {
if (weapon_check!=""){
weapon=gear_weapon_data("weapon",weapon_check,"all", false, "standard");
if (is_struct(weapon)){
for (j=1;j<=40;j++){
for (j=0;j<=40;j++){
if (wep[j]==""||wep[j]==weapon.name){
add_data_to_stack(j,weapon);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ function block_has_armour(target){
return target.veh+target.dreads;
}

function get_leftmost(block_type=obj_pnunit){
function get_leftmost(block_type=obj_pnunit, include_flanking=true){
var left_most = "none";
if (instance_exists(block_type)){
with (block_type){
if (!include_flanking && flank) then continue;
if x<=0 then continue;
if (men+veh+dreads<=0){
x=-5000;
Expand Down