Skip to content

Commit

Permalink
redundant check causing early end game
Browse files Browse the repository at this point in the history
  • Loading branch information
OH296 committed Jan 13, 2025
1 parent 7e9ce34 commit 5879090
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 30 deletions.
6 changes: 0 additions & 6 deletions objects/obj_ncombat/Alarm_7.gml
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,6 @@ try {

instance_activate_all();

if (scr_role_count("Chapter Master","")=0){
obj_controller.alarm[7]=1;
if (global.defeat<=1) then global.defeat=1;
if (enemy=1) or (enemy=2) or (enemy=5) then global.defeat=3;
}


if (turn_count < 20){
if (defeat=0) and (threat>=4) then scr_recent("battle_victory", $"{battle_loc} {scr_roman(battle_id)}",enemy);
Expand Down
2 changes: 1 addition & 1 deletion scripts/scr_kill_unit/scr_kill_unit.gml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function scr_kill_unit(company, unit_slot){
if (obj_ini.role[company][unit_slot]="Chapter Master"){
tek="c";
alarm[7]=5;
global.defeat=3;
global.defeat=1;
}
_unit = fetch_unit([company, unit_slot]);
if (_unit.weapon_one()=="Company Standard" || _unit.weapon_two()=="Company Standard"){
Expand Down
48 changes: 25 additions & 23 deletions scripts/scr_role_count/scr_role_count.gml
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,31 @@ function scr_role_count(target_role, search_location="", return_type="count") {
}


if (coom<0) then repeat(11){
for (var i=0;i<array_length(obj_ini.TTRPG[com]);i++){
match=false;
unit=obj_ini.TTRPG[com][i];
if (unit.name()=="")then continue;
if (unit.role()=target_role) and (search_location="") then match=true;
if (unit.role()=target_role) and (obj_ini.loc[com][i]=obj_ini.home_name) and (search_location="home") then match=true;
if (unit.role()=target_role) and (search_location="field") and ((obj_ini.loc[com][i]!=obj_ini.home_name) or (unit.ship_location>-1)) then match=true;

if (search_location!="home") and (search_location!="field"){
if (unit.role()=target_role){
var t1=string(obj_ini.loc[com][i])+"|"+string(unit.planet_location)+"|";
if (search_location=t1) then match=true;
}
}
if (match){
count++;
if (return_type=="units"){
array_push(units, unit);
}
}
}
com+=1;
if (coom<0) {
for (var com=0;com<=obj_ini.companies;com++)
{
for (var i=0;i<array_length(obj_ini.TTRPG[com]);i++){
match=false;
unit=fetch_unit([com, i]);
if (unit.name()=="")then continue;
if (unit.role()=target_role) and (search_location="") then match=true;
if (unit.role()=target_role) and (obj_ini.loc[com][i]=obj_ini.home_name) and (search_location="home") then match=true;
if (unit.role()=target_role) and (search_location="field") and ((obj_ini.loc[com][i]!=obj_ini.home_name) or (unit.ship_location>-1)) then match=true;

if (search_location!="home") and (search_location!="field"){
if (unit.role()=target_role){
var t1=string(obj_ini.loc[com][i])+"|"+string(unit.planet_location)+"|";
if (search_location=t1) then match=true;
}
}
if (match){
count++;
if (return_type=="units"){
array_push(units, unit);
}
}
}
}
}


Expand Down

0 comments on commit 5879090

Please sign in to comment.