From 358d232162b8783c5ea1d19bdf1f0b6ea101f891 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 18:31:52 -0500 Subject: [PATCH 01/45] Cleared GM1017 suggestions, deprecated functions are replaced with maintained versions, and whitespace in touched files normalized. --- objects/obj_al_ship/Alarm_0.gml | 65 +- objects/obj_al_ship/Draw_0.gml | 7 +- objects/obj_al_ship/Step_0.gml | 26 +- objects/obj_en_ship/Alarm_0.gml | 165 ++-- objects/obj_en_ship/Draw_0.gml | 118 ++- objects/obj_en_ship/Step_0.gml | 903 +++++++++--------- objects/obj_mass_equip/Draw_0.gml | 20 +- objects/obj_mass_equip/Step_0.gml | 70 +- objects/obj_p1_bullet/Collision_obj_ork.gml | 4 +- .../__global_object_depths.gml | 16 +- scripts/object_get_depth/object_get_depth.gml | 17 +- 11 files changed, 707 insertions(+), 704 deletions(-) diff --git a/objects/obj_al_ship/Alarm_0.gml b/objects/obj_al_ship/Alarm_0.gml index e7bd72ed28..bd070b8318 100644 --- a/objects/obj_al_ship/Alarm_0.gml +++ b/objects/obj_al_ship/Alarm_0.gml @@ -42,8 +42,7 @@ if (class=="Apocalypse Class Battleship"){ weapon_dam[4]=14; weapon_range[4]=600; weapon_cooldown[4]=20; -}else -if (class=="Nemesis Class Fleet Carrier"){ +}else if (class=="Nemesis Class Fleet Carrier"){ sprite_index=spr_ship_nem; ship_size=3; name=""; @@ -75,8 +74,7 @@ if (class=="Nemesis Class Fleet Carrier"){ weapon_dam[3]=14; weapon_range[3]=300; weapon_cooldown[3]=30; -}else -if (class=="Avenger Class Grand Cruiser"){ +}else if (class=="Avenger Class Grand Cruiser"){ sprite_index=spr_ship_aven; ship_size=2; name=""; @@ -97,8 +95,7 @@ if (class=="Avenger Class Grand Cruiser"){ weapon_dam[1]=14; weapon_range[1]=300; weapon_cooldown[1]=25; -}else -if (class=="Sword Class Frigate"){ +}else if (class=="Sword Class Frigate"){ sprite_index=spr_ship_sword; ship_size=1; name=""; @@ -120,6 +117,7 @@ if (class=="Sword Class Frigate"){ weapon_range[1]=300; weapon_cooldown[1]=20; } + // ** Eldar ** if (class=="Void Stalker"){ sprite_index=spr_ship_void; @@ -153,8 +151,7 @@ if (class=="Void Stalker"){ weapon_dam[3]=10; weapon_range[3]=600; weapon_cooldown[3]=10; -}else -if (class=="Shadow Class"){ +}else if (class=="Shadow Class"){ sprite_index=spr_ship_shadow; ship_size=3; name=""; @@ -180,8 +177,7 @@ if (class=="Shadow Class"){ weapon_dam[2]=10; weapon_range[2]=450; weapon_cooldown[2]=30; -}else -if (class=="Hellebore"){ +}else if (class=="Hellebore"){ sprite_index=spr_ship_hellebore; ship_size=1; name=""; @@ -213,8 +209,7 @@ if (class=="Hellebore"){ weapon_range[3]=9999; weapon_cooldown[3]=90; weapon_ammo[1]=1; -}else -if (class=="Aconite"){ +}else if (class=="Aconite"){ sprite_index=spr_ship_aconite; ship_size=1; name=""; @@ -236,6 +231,7 @@ if (class=="Aconite"){ weapon_range[1]=450; weapon_cooldown[1]=30; } + // ** Orkz ** if (class=="Dethdeala"){ sprite_index=spr_ship_deth; @@ -278,8 +274,7 @@ if (class=="Dethdeala"){ weapon_dam[5]=0; weapon_range[5]=9999; weapon_cooldown[5]=90; -}else -if (class=="Gorbag's Revenge"){ +}else if (class=="Gorbag's Revenge"){ sprite_index=spr_ship_gorbag; ship_size=3; name=""; @@ -323,8 +318,7 @@ if (class=="Gorbag's Revenge"){ weapon_range[5]=9999; weapon_cooldown[5]=90; cooldown[5]=30; -}else -if (class=="Kroolboy") or (class=="Slamblasta"){ +}else if (class=="Kroolboy") or (class=="Slamblasta"){ ship_size=3; sprite_index=spr_ship_krool; if (class=="Kroolboy") then sprite_index=spr_ship_krool; @@ -358,8 +352,7 @@ if (class=="Kroolboy") or (class=="Slamblasta"){ weapon_dam[3]=12; weapon_range[3]=200; weapon_cooldown[3]=40; -}else -if (class=="Battlekroozer"){ +}else if (class=="Battlekroozer"){ sprite_index=spr_ship_kroozer; ship_size=3; name=""; @@ -403,8 +396,7 @@ if (class=="Battlekroozer"){ weapon_range[5]=9999; weapon_cooldown[5]=90; cooldown[5]=30; -}else -if (class=="Ravager"){ +}else if (class=="Ravager"){ sprite_index=spr_ship_ravager; ship_size=1; name=""; @@ -431,6 +423,7 @@ if (class=="Ravager"){ weapon_range[2]=300; weapon_cooldown[2]=120; } + // ** Tau ** if (class=="Custodian"){ sprite_index=spr_ship_custodian; @@ -470,8 +463,7 @@ if (class=="Custodian"){ weapon_range[4]=9999; weapon_cooldown[4]=90; weapon_ammo[4]=4; -}else -if (class=="Protector"){ +}else if (class=="Protector"){ sprite_index=spr_ship_protector; ship_size=2; name=""; @@ -508,8 +500,7 @@ if (class=="Protector"){ weapon_dam[4]=0;weapon_range[4]=9999; weapon_cooldown[4]=90; weapon_ammo[4]=2; -}else -if (class=="Emissary"){ +}else if (class=="Emissary"){ sprite_index=spr_ship_emissary; ship_size=2; name=""; @@ -547,8 +538,7 @@ if (class=="Emissary"){ weapon_range[4]=9999; weapon_cooldown[4]=90; weapon_ammo[4]=1; -}else -if (class=="Warden"){ +}else if (class=="Warden"){ sprite_index=spr_ship_warden; ship_size=1; name="";hp=100; @@ -573,8 +563,7 @@ if (class=="Warden"){ weapon_dam[2]=10; weapon_range[2]=300; weapon_cooldown[2]=60; -}else -if (class=="Castellan"){ +}else if (class=="Castellan"){ sprite_index=spr_ship_castellan; ship_size=1; name=""; @@ -602,6 +591,7 @@ if (class=="Castellan"){ weapon_range[2]=300; weapon_cooldown[2]=40; } + // ** Chaos ** if (class=="Desecrator"){ sprite_index=spr_ship_dese; @@ -644,8 +634,7 @@ if (class=="Desecrator"){ weapon_dam[5]=0; weapon_range[5]=9999; weapon_cooldown[5]=90; -}else -if (class=="Avenger"){ +}else if (class=="Avenger"){ sprite_index=spr_ship_veng; ship_size=2; name=""; @@ -671,8 +660,7 @@ if (class=="Avenger"){ weapon_dam[2]=12; weapon_range[2]=300; weapon_cooldown[2]=30; -}else -if (class=="Carnage") or (class="Daemon"){ +}else if (class=="Carnage" || class="Daemon"){ sprite_index=spr_ship_carnage; ship_size=2; name=""; @@ -707,8 +695,7 @@ if (class=="Carnage") or (class="Daemon"){ sprite_index=spr_ship_daemon; image_alpha=0.5; } -}else -if (class=="Iconoclast"){ +}else if (class=="Iconoclast"){ sprite_index=spr_ship_icono; ship_size=1; name=""; @@ -730,6 +717,7 @@ if (class=="Iconoclast"){ weapon_range[1]=300; weapon_cooldown[1]=30; } + // Tyranids if (class=="Leviathan"){ sprite_index=spr_ship_leviathan; @@ -767,8 +755,7 @@ if (class=="Leviathan"){ weapon_range[4]=9999; weapon_ammo[4]=6; weapon_cooldown[4]=120; -}else -if (class=="Razorfiend"){ +}else if (class=="Razorfiend"){ sprite_index=spr_ship_razorfiend; ship_size=2; name=""; @@ -799,8 +786,7 @@ if (class=="Razorfiend"){ weapon_dam[3]=20; weapon_range[3]=64; weapon_cooldown[3]=60; -}else -if (class=="Stalker"){ +}else if (class=="Stalker"){ sprite_index=spr_ship_stalker; ship_size=1; name=""; @@ -831,8 +817,7 @@ if (class=="Stalker"){ weapon_dam[3]=6; weapon_range[3]=200; weapon_cooldown[3]=60; -}else -if (class=="Prowler"){ +}else if (class=="Prowler"){ sprite_index=spr_ship_prowler; ship_size=1; name=""; diff --git a/objects/obj_al_ship/Draw_0.gml b/objects/obj_al_ship/Draw_0.gml index 956101b16d..a16cb2a378 100644 --- a/objects/obj_al_ship/Draw_0.gml +++ b/objects/obj_al_ship/Draw_0.gml @@ -3,13 +3,12 @@ var __b__; __b__ = action_if_variable(name, "", 0); if (!__b__){ { - draw_self(); - + draw_set_color(CM_GREEN_COLOR); draw_set_font(fnt_info); draw_set_halign(fa_center); - + if (shields<=0){ if (obj_controller.zoomed=0){ if (maxhp!=0) then draw_text(x,y-(sprite_height/2),string_hash_to_newline(string(floor((hp/maxhp)*100))+"%")); @@ -18,7 +17,7 @@ if (!__b__){ if (maxhp!=0) then draw_text_transformed(x,y-sprite_height,string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"),2,2,0); } } - + else if (shields>0){ draw_set_color(c_white); if (obj_controller.zoomed=0){ diff --git a/objects/obj_al_ship/Step_0.gml b/objects/obj_al_ship/Step_0.gml index ba28ac0751..543b48d77d 100644 --- a/objects/obj_al_ship/Step_0.gml +++ b/objects/obj_al_ship/Step_0.gml @@ -12,16 +12,16 @@ var explo; __b__ = action_if_variable(owner, 6, 0); if (!__b__){ image_angle=direction; - + if (obj_fleet.start!=5) then exit; - + if (class="Daemon") and (image_alpha<1) then image_alpha+=0.006; - + o_dist=0; spid=0; - + if (shields>0) and (shields0) and (shields0) then turret_cool-=1; - + targe=0; dist=9999; xx=x; diff --git a/objects/obj_en_ship/Alarm_0.gml b/objects/obj_en_ship/Alarm_0.gml index ce2ca6378e..1ae6a92776 100644 --- a/objects/obj_en_ship/Alarm_0.gml +++ b/objects/obj_en_ship/Alarm_0.gml @@ -12,9 +12,10 @@ cooldown[5]=0; -if (class="Apocalypse Class Battleship"){sprite_index=spr_ship_apoc; +if (class="Apocalypse Class Battleship"){ + sprite_index=spr_ship_apoc; ship_size=3; - + name=""; hp=1200; maxhp=1200; @@ -57,9 +58,10 @@ if (class="Apocalypse Class Battleship"){sprite_index=spr_ship_apoc; } -if (class="Nemesis Class Fleet Carrier"){sprite_index=spr_ship_nem; +if (class="Nemesis Class Fleet Carrier"){ + sprite_index=spr_ship_nem; ship_size=3; - + name=""; hp=1000; maxhp=1000; @@ -96,9 +98,10 @@ if (class="Nemesis Class Fleet Carrier"){sprite_index=spr_ship_nem; } -if (class="Avenger Class Grand Cruiser"){sprite_index=spr_ship_aven; +if (class="Avenger Class Grand Cruiser"){ + sprite_index=spr_ship_aven; ship_size=2; - + name=""; hp=1000; maxhp=1000; @@ -134,9 +137,10 @@ if (class="Avenger Class Grand Cruiser"){sprite_index=spr_ship_aven; } -if (class="Sword Class Frigate"){sprite_index=spr_ship_sword; +if (class="Sword Class Frigate"){ + sprite_index=spr_ship_sword; ship_size=1; - + name=""; hp=100; maxhp=100; @@ -164,9 +168,10 @@ if (class="Sword Class Frigate"){sprite_index=spr_ship_sword; // Eldar -if (class="Void Stalker"){sprite_index=spr_ship_void; +if (class="Void Stalker"){ + sprite_index=spr_ship_void; ship_size=3; - + name=""; hp=1000; maxhp=1000; @@ -209,9 +214,10 @@ if (class="Void Stalker"){sprite_index=spr_ship_void; } -if (class="Shadow Class"){sprite_index=spr_ship_shadow; +if (class="Shadow Class"){ + sprite_index=spr_ship_shadow; ship_size=3; - + name=""; hp=600; maxhp=600; @@ -241,9 +247,10 @@ if (class="Shadow Class"){sprite_index=spr_ship_shadow; } -if (class="Hellebore"){sprite_index=spr_ship_hellebore; +if (class="Hellebore"){ + sprite_index=spr_ship_hellebore; ship_size=1; - + name=""; hp=200; maxhp=200; @@ -280,9 +287,10 @@ if (class="Hellebore"){sprite_index=spr_ship_hellebore; } -if (class="Aconite"){sprite_index=spr_ship_aconite; +if (class="Aconite"){ + sprite_index=spr_ship_aconite; ship_size=1; - + name=""; hp=200; maxhp=200; @@ -311,9 +319,10 @@ if (class="Aconite"){sprite_index=spr_ship_aconite; // Orks -if (class="Dethdeala"){sprite_index=spr_ship_deth; +if (class="Dethdeala"){ + sprite_index=spr_ship_deth; ship_size=3; - + name=""; hp=1200; maxhp=1200; @@ -361,9 +370,10 @@ if (class="Dethdeala"){sprite_index=spr_ship_deth; } -if (class="Gorbag's Revenge"){sprite_index=spr_ship_gorbag; +if (class="Gorbag's Revenge"){ + sprite_index=spr_ship_gorbag; ship_size=3; - + name=""; hp=1200; maxhp=1200; @@ -414,9 +424,10 @@ if (class="Gorbag's Revenge"){sprite_index=spr_ship_gorbag; } -if (class="Kroolboy") or (class="Slamblasta"){ship_size=3; +if (class="Kroolboy") or (class="Slamblasta"){ + ship_size=3; sprite_index=spr_ship_krool; - + if (class="Kroolboy") then sprite_index=spr_ship_krool; if (class="Slamblasta") then sprite_index=spr_ship_slam; @@ -457,9 +468,10 @@ if (class="Kroolboy") or (class="Slamblasta"){ship_size=3; } -if (class="Battlekroozer"){sprite_index=spr_ship_kroozer; +if (class="Battlekroozer"){ + sprite_index=spr_ship_kroozer; ship_size=3; - + name=""; hp=1000; maxhp=1000; @@ -510,9 +522,10 @@ if (class="Battlekroozer"){sprite_index=spr_ship_kroozer; } -if (class="Ravager"){sprite_index=spr_ship_ravager; +if (class="Ravager"){ + sprite_index=spr_ship_ravager; ship_size=1; - + name=""; hp=100; maxhp=100; @@ -544,9 +557,10 @@ if (class="Ravager"){sprite_index=spr_ship_ravager; // Tau -if (class="Custodian"){sprite_index=spr_ship_custodian; +if (class="Custodian"){ + sprite_index=spr_ship_custodian; ship_size=3; - + name=""; hp=1000; maxhp=1000; @@ -590,9 +604,10 @@ if (class="Custodian"){sprite_index=spr_ship_custodian; } -if (class="Protector"){sprite_index=spr_ship_protector; +if (class="Protector"){ + sprite_index=spr_ship_protector; ship_size=2; - + name=""; hp=600; maxhp=600; @@ -636,9 +651,10 @@ if (class="Protector"){sprite_index=spr_ship_protector; } -if (class="Emissary"){sprite_index=spr_ship_emissary; +if (class="Emissary"){ + sprite_index=spr_ship_emissary; ship_size=2; - + name=""; hp=400; maxhp=400; @@ -682,9 +698,10 @@ if (class="Emissary"){sprite_index=spr_ship_emissary; } -if (class="Warden"){sprite_index=spr_ship_warden; +if (class="Warden"){ + sprite_index=spr_ship_warden; ship_size=1; - + name=""; hp=100; maxhp=100; @@ -714,9 +731,10 @@ if (class="Warden"){sprite_index=spr_ship_warden; } -if (class="Castellan"){sprite_index=spr_ship_castellan; +if (class="Castellan"){ + sprite_index=spr_ship_castellan; ship_size=1; - + name=""; hp=100; maxhp=100; @@ -749,9 +767,10 @@ if (class="Castellan"){sprite_index=spr_ship_castellan; // Chaos -if (class="Desecrator"){sprite_index=spr_ship_dese; +if (class="Desecrator"){ + sprite_index=spr_ship_dese; ship_size=3; - + name=""; hp=1200; maxhp=1200; @@ -799,9 +818,10 @@ if (class="Desecrator"){sprite_index=spr_ship_dese; } -if (class="Avenger"){sprite_index=spr_ship_veng; +if (class="Avenger"){ + sprite_index=spr_ship_veng; ship_size=2; - + name=""; hp=1000; maxhp=1000; @@ -831,9 +851,10 @@ if (class="Avenger"){sprite_index=spr_ship_veng; } -if (class="Carnage") or (class="Daemon"){sprite_index=spr_ship_carnage; +if (class="Carnage") or (class="Daemon"){ + sprite_index=spr_ship_carnage; ship_size=2; - + name=""; hp=1000; maxhp=1000; @@ -867,14 +888,16 @@ if (class="Carnage") or (class="Daemon"){sprite_index=spr_ship_carnage; weapon_range[3]=300; weapon_cooldown[3]=45; - if (class="Daemon"){sprite_index=spr_ship_daemon; + if (class="Daemon"){ + sprite_index=spr_ship_daemon; image_alpha=0.1; -} + } } -if (class="Iconoclast"){sprite_index=spr_ship_icono; +if (class="Iconoclast"){ + sprite_index=spr_ship_icono; ship_size=1; - + name=""; hp=100; maxhp=100; @@ -900,9 +923,10 @@ if (class="Iconoclast"){sprite_index=spr_ship_icono; // Tyranids -if (class="Leviathan"){sprite_index=spr_ship_leviathan; +if (class="Leviathan"){ + sprite_index=spr_ship_leviathan; ship_size=3; - + name=""; hp=1000; maxhp=1000; @@ -944,9 +968,10 @@ if (class="Leviathan"){sprite_index=spr_ship_leviathan; } -if (class="Razorfiend"){sprite_index=spr_ship_razorfiend; +if (class="Razorfiend"){ + sprite_index=spr_ship_razorfiend; ship_size=2; - + name=""; hp=600; maxhp=600; @@ -982,9 +1007,10 @@ if (class="Razorfiend"){sprite_index=spr_ship_razorfiend; } -if (class="Stalker"){sprite_index=spr_ship_stalker; +if (class="Stalker"){ + sprite_index=spr_ship_stalker; ship_size=1; - + name=""; hp=100; maxhp=100; @@ -1020,9 +1046,10 @@ if (class="Stalker"){sprite_index=spr_ship_stalker; } -if (class="Prowler"){sprite_index=spr_ship_prowler; +if (class="Prowler"){ + sprite_index=spr_ship_prowler; ship_size=1; - + name=""; hp=100; maxhp=100; @@ -1064,9 +1091,10 @@ if (owner = eFACTION.Tyranids){ if (obj_fleet.en_mutation[i]="Spore Clouds") then shields=shields+100; - if (obj_fleet.en_mutation[i]="Health"){hp=floor(hp*1.1); + if (obj_fleet.en_mutation[i]="Health"){ + hp=floor(hp*1.1); maxhp=hp; - } + } if (obj_fleet.en_mutation[i]="Armour") then armour_front+=1; if (obj_fleet.en_mutation[i]="Speed") then speed_bonus=speed_bonus*1.1; @@ -1084,9 +1112,10 @@ if (owner = eFACTION.Tyranids){ // Necrons -if (class="Cairn Class"){sprite_index=spr_ship_cairn; +if (class="Cairn Class"){ + sprite_index=spr_ship_cairn; ship_size=3; - + name=""; hp=1100; maxhp=1100; @@ -1122,9 +1151,10 @@ if (class="Cairn Class"){sprite_index=spr_ship_cairn; } -if (class="Reaper Class"){sprite_index=spr_ship_reaper; +if (class="Reaper Class"){ + sprite_index=spr_ship_reaper; ship_size=3; - + name=""; hp=900; maxhp=900; @@ -1160,9 +1190,10 @@ if (class="Reaper Class"){sprite_index=spr_ship_reaper; } -if (class="Shroud Class"){ship_size=2; +if (class="Shroud Class"){ + ship_size=2; sprite_index=spr_ship_shroud; - + name=""; hp=400; maxhp=400; @@ -1186,9 +1217,10 @@ if (class="Shroud Class"){ship_size=2; } -if (class="Jackal Class"){ship_size=2; +if (class="Jackal Class"){ + ship_size=2; sprite_index=spr_ship_jackal; - + name=""; hp=100; maxhp=100; @@ -1212,9 +1244,10 @@ if (class="Jackal Class"){ship_size=2; } -if (class="Dirge Class"){ship_size=2; +if (class="Dirge Class"){ + ship_size=2; sprite_index=spr_ship_dirge; - + name=""; hp=100; maxhp=100; diff --git a/objects/obj_en_ship/Draw_0.gml b/objects/obj_en_ship/Draw_0.gml index 11ad8d73c7..d9619fe019 100644 --- a/objects/obj_en_ship/Draw_0.gml +++ b/objects/obj_en_ship/Draw_0.gml @@ -1,65 +1,63 @@ var __b__; __b__ = action_if_variable(name, "", 0); -if !__b__ -{ -{ -draw_set_font(fnt_info); -draw_set_halign(fa_center); - -// 135; -/*if (action="broadside"){ - draw_set_color(c_blue);if (instance_exists(target_l)) then draw_line(x,y,target_l.x,target_l.y); - draw_set_color(c_red);if (instance_exists(target_r)) then draw_line(x,y,target_r.x,target_r.y); -}draw_set_color(CM_GREEN_COLOR);*/ - - -draw_set_alpha(1); - -if (lightning>01) and (instance_exists(target)){ - draw_set_color(c_lime);lightning-=1; - scr_bolt(x,y,target.x,target.y,0); -} -if (whip>0) and (instance_exists(target)){ - draw_set_color(c_lime);whip-=1; - scr_bolt(x,y,target.x,target.y,0); - scr_bolt(x-1,y+1,target.x-1,target.y+1,0); -} - -draw_set_color(CM_GREEN_COLOR); - -if (class!="Battlekroozer") then draw_self(); -if (class="Battlekroozer") then draw_sprite_ext(sprite_index,0,x,y,0.75,0.75,direction,c_white,1); - - - - -if (owner != eFACTION.Tau){ - if (shields<=0){ - if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_height/2),string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"));} - if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_height,string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"),2,2,0);} - } - - if (shields>0){ - draw_set_color(c_white); - if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_height/2),string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"));} - if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_height,string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"),2,2,0);} - } -} - -if (owner = eFACTION.Tau){ - if (shields<=0){ - if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_width/2),string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"));} - if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_width,string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"),2,2,0);} - } - - if (shields>0){ - draw_set_color(c_white); - if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_width/2),string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"));} - if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_width,string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"),2,2,0);} +if (!__b__) { + { + draw_set_font(fnt_info); + draw_set_halign(fa_center); + + // 135; + /*if (action="broadside"){ + draw_set_color(c_blue);if (instance_exists(target_l)) then draw_line(x,y,target_l.x,target_l.y); + draw_set_color(c_red);if (instance_exists(target_r)) then draw_line(x,y,target_r.x,target_r.y); + }draw_set_color(CM_GREEN_COLOR);*/ + + + draw_set_alpha(1); + + if (lightning>01) and (instance_exists(target)){ + draw_set_color(c_lime);lightning-=1; + scr_bolt(x,y,target.x,target.y,0); + } + if (whip>0) and (instance_exists(target)){ + draw_set_color(c_lime);whip-=1; + scr_bolt(x,y,target.x,target.y,0); + scr_bolt(x-1,y+1,target.x-1,target.y+1,0); + } + + draw_set_color(CM_GREEN_COLOR); + + if (class!="Battlekroozer") then draw_self(); + if (class="Battlekroozer") then draw_sprite_ext(sprite_index,0,x,y,0.75,0.75,direction,c_white,1); + + + + + if (owner != eFACTION.Tau){ + if (shields<=0){ + if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_height/2),string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"));} + if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_height,string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"),2,2,0);} + } + + if (shields>0){ + draw_set_color(c_white); + if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_height/2),string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"));} + if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_height,string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"),2,2,0);} + } + } + + if (owner = eFACTION.Tau){ + if (shields<=0){ + if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_width/2),string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"));} + if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_width,string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"),2,2,0);} + } + + if (shields>0){ + draw_set_color(c_white); + if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_width/2),string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"));} + if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_width,string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"),2,2,0);} + } + } + /* */ } } - -/* */ -} -} /* */ diff --git a/objects/obj_en_ship/Step_0.gml b/objects/obj_en_ship/Step_0.gml index 26a2e67635..1b2407627b 100644 --- a/objects/obj_en_ship/Step_0.gml +++ b/objects/obj_en_ship/Step_0.gml @@ -2,538 +2,531 @@ var __b__; __b__ = action_if_variable(owner, 6, 0); if !__b__ { -image_angle=direction; - -if (obj_fleet.start!=5) then exit; - -if (class="Daemon") and (image_alpha<1) then image_alpha+=0.006; - -var o_dist, dist, ch_rang, ex, spid;spid=0; - -if (shields>0) and (shieldspoint_distance(x,y,tp2.x,tp2.y)) then target=tp2; -} -if (!instance_exists(target)) then exit; - -if (hp<=0){ - var wh,gud;wh=0;gud=0; - repeat(5){wh+=1;if (obj_fleet.enemy[wh]=owner) then gud=wh;} - - if (size=3) then obj_fleet.en_capital_lost[gud]+=1; - if (size=2) then obj_fleet.en_frigate_lost[gud]+=1; - if (size=1) then obj_fleet.en_escort_lost[gud]+=1; - - image_alpha=0.5; - - - if (owner != eFACTION.Tyranids){ - // ex=instance_create(x,y,obj_explosion); - // ex.image_xscale=2;ex.image_yscale=2;ex.image_speed=0.75; - var husk;husk=instance_create(x,y,obj_en_husk); - husk.sprite_index=sprite_index;husk.direction=direction; - husk.image_angle=image_angle;husk.depth=depth;husk.image_speed=0; - repeat(choose(4,5,6)){ - var explo;explo=instance_create(x,y,obj_explosion); - explo.image_xscale=0.5;explo.image_yscale=0.5; - explo.x+=random_range(sprite_width*0.25,sprite_width*-0.25); - explo.y+=random_range(sprite_width*0.25,sprite_width*-0.25); - } - } - if (owner = eFACTION.Tyranids) then effect_create_above(ef_firework,x,y,1,c_purple); - instance_destroy(); -} - -if (hp>0) and (instance_exists(obj_p_ship)){ - - if (class="Apocalypse Class Battleship"){o_dist=500;action="attack";spid=20;} - if (class="Nemesis Class Fleet Carrier"){o_dist=1000;action="attack";spid=20;} - if (class="Leviathan"){o_dist=160;action="attack";spid=20;} - if (class="Battle Barge") or (class="Custodian"){o_dist=300;action="attack";spid=20;} - if (class="Desecrator"){o_dist=300;action="attack";spid=20;} - if (class="Razorfiend"){o_dist=100;action="attack";spid=25;} - if (class="Cairn Class") or (class="Reaper Class"){o_dist=199;action="attack";spid=25;if (class="Reaper Class") then spid=30;} - - if (class="Dethdeala") or (class="Protector") or (class="Emissary"){o_dist=200;action="attack";spid=20;} - if (class="Gorbag's Revenge"){o_dist=200;action="attack";spid=20;} - if (class="Kroolboy") or (class="Slamblasta"){o_dist=200;action="attack";spid=25;} - if (class="Battlekroozer"){o_dist=200;action="attack";spid=30;} - if (class="Avenger") or (class="Carnage") or (class="Daemon"){o_dist=200;action="attack";spid=20;} + image_angle=direction; - if (class="Ravager") or (class="Iconoclast") or (class="Castellan") or (class="Warden"){o_dist=300;action="attack";spid=35;} - if (class="Shroud Class"){o_dist=250;action="attack";spid=35;} + if (obj_fleet.start!=5) then exit; - if (class="Stalker") or (class="Sword Class Frigate"){o_dist=100;action="attack";spid=20;} - if (class="Prowler"){o_dist=100;action="attack";spid=35;} - if (class="Avenger Class Grand Cruiser"){o_dist=48;action="broadside";spid=20;} - if (class="Jackal Class"){o_dist=200;action="attack";spid=40;} - if (class="Dirge Class"){o_dist=200;action="attack";spid=45;} + if (class="Daemon") and (image_alpha<1) then image_alpha+=0.006; - // if (class!="big") then flank!!!! + var o_dist, dist, ch_rang, ex, spid;spid=0; + if (shields>0) and (shieldspoint_distance(x,y,tp2.x,tp2.y)) then target=tp2; } - if (target!=0) and (action="broadside") and (dist>o_dist){ - if (y>=target.y) then dist=point_distance(x,y,target.x+lengthdir_x(64,target.direction-180),target.y+lengthdir_y(128,target.direction-90))-(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))); - if (ytarget.y) and (dist>o_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2); - if (yo_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction+90),.2); - if (turn_bonus>1){ - if (yo_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction+90),.2); + if (!instance_exists(target)) then exit; + + if (hp<=0){ + var wh,gud;wh=0;gud=0; + repeat(5){wh+=1;if (obj_fleet.enemy[wh]=owner) then gud=wh;} + + if (size=3) then obj_fleet.en_capital_lost[gud]+=1; + if (size=2) then obj_fleet.en_frigate_lost[gud]+=1; + if (size=1) then obj_fleet.en_escort_lost[gud]+=1; + + image_alpha=0.5; + + + if (owner != eFACTION.Tyranids){ + // ex=instance_create(x,y,obj_explosion); + // ex.image_xscale=2;ex.image_yscale=2;ex.image_speed=0.75; + var husk;husk=instance_create(x,y,obj_en_husk); + husk.sprite_index=sprite_index;husk.direction=direction; + husk.image_angle=image_angle;husk.depth=depth;husk.image_speed=0; + repeat(choose(4,5,6)){ + var explo;explo=instance_create(x,y,obj_explosion); + explo.image_xscale=0.5;explo.image_yscale=0.5; + explo.x+=random_range(sprite_width*0.25,sprite_width*-0.25); + explo.y+=random_range(sprite_width*0.25,sprite_width*-0.25); + } } + if (owner = eFACTION.Tyranids) then effect_create_depth(-15000,ef_firework,x,y,1,c_purple); + instance_destroy(); } - - /*if (target!=0) and (action="broadside") and (o_dist>=dist){ - direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) - }*/ - - /*if (target!=0) and (action="broadside") and (o_dist>=dist){ - var re_deh;re_deh=relative_direction(direction,target.direction); + if (hp>0) and (instance_exists(obj_p_ship)){ - // if (re_deh<45) or (re_deh>315) or ((re_deh>135) and (re_deh<225)) then direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) + if (class="Apocalypse Class Battleship"){o_dist=500;action="attack";spid=20;} + if (class="Nemesis Class Fleet Carrier"){o_dist=1000;action="attack";spid=20;} + if (class="Leviathan"){o_dist=160;action="attack";spid=20;} + if (class="Battle Barge") or (class="Custodian"){o_dist=300;action="attack";spid=20;} + if (class="Desecrator"){o_dist=300;action="attack";spid=20;} + if (class="Razorfiend"){o_dist=100;action="attack";spid=25;} + if (class="Cairn Class") or (class="Reaper Class"){o_dist=199;action="attack";spid=25;if (class="Reaper Class") then spid=30;} - var wok; - wok=0; + if (class="Dethdeala") or (class="Protector") or (class="Emissary"){o_dist=200;action="attack";spid=20;} + if (class="Gorbag's Revenge"){o_dist=200;action="attack";spid=20;} + if (class="Kroolboy") or (class="Slamblasta"){o_dist=200;action="attack";spid=25;} + if (class="Battlekroozer"){o_dist=200;action="attack";spid=30;} + if (class="Avenger") or (class="Carnage") or (class="Daemon"){o_dist=200;action="attack";spid=20;} - if (!instance_exists(target_l)) then wok=2; - if (!instance_exists(target_r)) then wok=1; + if (class="Ravager") or (class="Iconoclast") or (class="Castellan") or (class="Warden"){o_dist=300;action="attack";spid=35;} + if (class="Shroud Class"){o_dist=250;action="attack";spid=35;} - if (instance_exists(target_l)) and (instance_exists(target_r)){ - if (point_distance(x,y,target_l.x,target_l.y))<(point_distance(x,y,target_r.x,target_r.y)) then wok=1; - else{wok=2;} - - } + if (class="Stalker") or (class="Sword Class Frigate"){o_dist=100;action="attack";spid=20;} + if (class="Prowler"){o_dist=100;action="attack";spid=35;} + if (class="Avenger Class Grand Cruiser"){o_dist=48;action="broadside";spid=20;} + if (class="Jackal Class"){o_dist=200;action="attack";spid=40;} + if (class="Dirge Class"){o_dist=200;action="attack";spid=45;} + // if (class!="big") then flank!!!! + + + spid=spid*speed_bonus; + + dist=point_distance(x,y,target.x,target.y)-(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))); - if (wok=1){ - direction=turn_towards_point(direction,x,y,x+lengthdir_x(256,90),y+lengthdir_y(256,90),.2) - } - if (wok=2){ - direction=turn_towards_point(direction,x,y,x+lengthdir_x(256,270),y+lengthdir_y(256,270),.2) + if (target!=0) and (action="attack"){ + direction=turn_towards_point(direction,x,y,target.x,target.y,.1); } + if (target!=0) and (action="broadside") and (dist>o_dist){ + if (y>=target.y) then dist=point_distance(x,y,target.x+lengthdir_x(64,target.direction-180),target.y+lengthdir_y(128,target.direction-90))-(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))); + if (ytarget.y) and (dist>o_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2); + if (yo_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction+90),.2); + if (turn_bonus>1){ + if (yo_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction+90),.2); + } + } + - // direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) + /*if (target!=0) and (action="broadside") and (o_dist>=dist){ + direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) + }*/ + /*if (target!=0) and (action="broadside") and (o_dist>=dist){ + var re_deh;re_deh=relative_direction(direction,target.direction); + + // if (re_deh<45) or (re_deh>315) or ((re_deh>135) and (re_deh<225)) then direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) + + var wok; + wok=0; + + if (!instance_exists(target_l)) then wok=2; + if (!instance_exists(target_r)) then wok=1; + + if (instance_exists(target_l)) and (instance_exists(target_r)){ + if (point_distance(x,y,target_l.x,target_l.y))<(point_distance(x,y,target_r.x,target_r.y)) then wok=1; + else{wok=2;} + + } + + + if (wok=1){ + direction=turn_towards_point(direction,x,y,x+lengthdir_x(256,90),y+lengthdir_y(256,90),.2) + } + + if (wok=2){ + direction=turn_towards_point(direction,x,y,x+lengthdir_x(256,270),y+lengthdir_y(256,270),.2) + } + + // direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) + + + + }*/ - }*/ - - - if (action="attack"){ - if (dist>o_dist) and (speed<((spid)/10)) then speed+=0.005; - if (dist0) then speed-=0.025; - } - if (action="broadside"){ - if (dist>o_dist) and (speed<((spid)/10)) then speed+=0.005; - if (dist0) then speed-=0.025; - } - - - if (speed<0) then speed=speed*0.9; - - if (cooldown[1]>0) then cooldown[1]-=1; - if (cooldown[2]>0) then cooldown[2]-=1; - if (cooldown[3]>0) then cooldown[3]-=1; - if (cooldown[4]>0) then cooldown[4]-=1; - if (cooldown[5]>0) then cooldown[5]-=1; - if (turret_cool>0) then turret_cool-=1; - - - - - var bull, targe, rdir, dirr, dist, xx, yy, ok; - targe=0;rdir=0;dirr="";dist=9999;xx=x;yy=y; - - - if (turrets>0) and (instance_exists(obj_p_small)) and (turret_cool=0){ - targe=instance_nearest(x,y,obj_p_small); - if (instance_exists(targe)) then dist=point_distance(x,y,targe.x,targe.y); - - if (dist>64) and (dist<300){ - bull=instance_create(x,y,obj_en_round);bull.direction=point_direction(x,y,targe.x,targe.y); - if (owner = eFACTION.Tyranids) then bull.sprite_index=spr_glob; - bull.speed=20;bull.dam=3;bull.image_xscale=0.5;bull.image_yscale=0.5;turret_cool=floor(60/turrets); - if (owner = eFACTION.Necrons){bull.sprite_index=spr_green_las;bull.image_yscale=1;} - bull.direction+=choose(random(10),1*-(random(10))); + if (action="attack"){ + if (dist>o_dist) and (speed<((spid)/10)) then speed+=0.005; + if (dist0) then speed-=0.025; + } + if (action="broadside"){ + if (dist>o_dist) and (speed<((spid)/10)) then speed+=0.005; + if (dist0) then speed-=0.025; } - } - targe=0;rdir=0;dirr="";dist=9999; - - - xx=lengthdir_x(64,direction+90); - yy=lengthdir_y(64,direction+90); - - var front, right, left, rear; - front=0;right=0;left=0;rear=0; - - targe=instance_nearest(xx,yy,obj_p_ship); - rdir=point_direction(x,y,target.x,target.y); - // if (rdir>45) and (rdir<=135) and (targe!=target){target_r=targe;right=1;} - // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} - target_l=instance_nearest(x+lengthdir_x(64,direction+90),y+lengthdir_y(64,direction+90),obj_p_ship); - target_r=instance_nearest(x+lengthdir_x(64,direction+270),y+lengthdir_y(64,direction+270),obj_p_ship); - - if (collision_line(x,y,x+lengthdir_x(2000,direction),y+lengthdir_y(2000,direction),obj_p_ship,0,1)) then front=1; - - - var f, facing, ammo, range, wep, dam, gg;f=0;facing="";ammo=0;range=0;wep="";dam=0;gg=0; - - lightning=0; - - repeat(weapons){ - gg+=1; - - ok=0;f+=1;facing="";ammo=0;range=0;wep=""; - - //weapon[gg]=0;weapon_ammo[gg]=0;weapon_range[gg]=0; - if (cooldown[gg]<=0) and (weapon[gg]!="") and (weapon_ammo[gg]>0) then ok=1; - if (ok=1){ - facing=weapon_facing[gg];ammo=weapon_ammo[gg];range=weapon_range[gg];} - - targe=target; - if (facing="front") and (front=1) then ok=2; - if (facing="most") then ok=2; - - - /* - if (facing="right") then targe=target_r; - if (facing="left") then targe=target_l; - if ((facing="front") or (facing="most")) and (front=1) then ok=2; - if (facing="right") or (facing="most") and (right=1) then ok=2; - if (facing="left") or (facing="most") and (left=1) then ok=2; - */ - if (facing="special") then ok=2; - if (!instance_exists(targe)) then exit; - dist=point_distance(x,y,targe.x,targe.y); - - if (facing="right") and (point_direction(x,y,target_r.x,target_r.y)<337) and (point_direction(x,y,target_r.x,target_r.y)>203) then ok=2; - if (facing="left") and (point_direction(x,y,target_r.x,target_r.y)>22) and (point_direction(x,y,target_r.x,target_r.y)<157) then ok=2; + if (speed<0) then speed=speed*0.9; + + if (cooldown[1]>0) then cooldown[1]-=1; + if (cooldown[2]>0) then cooldown[2]-=1; + if (cooldown[3]>0) then cooldown[3]-=1; + if (cooldown[4]>0) then cooldown[4]-=1; + if (cooldown[5]>0) then cooldown[5]-=1; + if (turret_cool>0) then turret_cool-=1; + + + + + var bull, targe, rdir, dirr, dist, xx, yy, ok; + targe=0;rdir=0;dirr="";dist=9999;xx=x;yy=y; + - /*var re_deh;re_deh=relative_direction(direction,target.direction); - if (re_deh<45) or (re_deh>315) or ((re_deh>135) and (re_deh<225)) then direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) - */ + if (turrets>0) and (instance_exists(obj_p_small)) and (turret_cool=0){ + targe=instance_nearest(x,y,obj_p_small); + if (instance_exists(targe)) then dist=point_distance(x,y,targe.x,targe.y); + if (dist>64) and (dist<300){ + bull=instance_create(x,y,obj_en_round);bull.direction=point_direction(x,y,targe.x,targe.y); + if (owner = eFACTION.Tyranids) then bull.sprite_index=spr_glob; + bull.speed=20;bull.dam=3;bull.image_xscale=0.5;bull.image_yscale=0.5;turret_cool=floor(60/turrets); + if (owner = eFACTION.Necrons){bull.sprite_index=spr_green_las;bull.image_yscale=1;} + bull.direction+=choose(random(10),1*-(random(10))); + } + } + targe=0;rdir=0;dirr="";dist=9999; + + + xx=lengthdir_x(64,direction+90); + yy=lengthdir_y(64,direction+90); + + var front, right, left, rear; + front=0;right=0;left=0;rear=0; + + targe=instance_nearest(xx,yy,obj_p_ship); + rdir=point_direction(x,y,target.x,target.y); + // if (rdir>45) and (rdir<=135) and (targe!=target){target_r=targe;right=1;} + // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} + target_l=instance_nearest(x+lengthdir_x(64,direction+90),y+lengthdir_y(64,direction+90),obj_p_ship); + target_r=instance_nearest(x+lengthdir_x(64,direction+270),y+lengthdir_y(64,direction+270),obj_p_ship); + + if (collision_line(x,y,x+lengthdir_x(2000,direction),y+lengthdir_y(2000,direction),obj_p_ship,0,1)) then front=1; + + var f, facing, ammo, range, wep, dam, gg;f=0;facing="";ammo=0;range=0;wep="";dam=0;gg=0; - if (ok=2) and (dist<(range+(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))))){ - if (ammo>0) and (ammo<900) then ammo-=1; - weapon_ammo[gg]=ammo;cooldown[gg]=weapon_cooldown[gg];wep=weapon[gg];dam=weapon_dam[gg]; + lightning=0; + + repeat(weapons){ + gg+=1; + + ok=0;f+=1;facing="";ammo=0;range=0;wep=""; + + //weapon[gg]=0;weapon_ammo[gg]=0;weapon_range[gg]=0; + + + if (cooldown[gg]<=0) and (weapon[gg]!="") and (weapon_ammo[gg]>0) then ok=1; + if (ok=1){ + facing=weapon_facing[gg];ammo=weapon_ammo[gg];range=weapon_range[gg];} + + targe=target; + if (facing="front") and (front=1) then ok=2; + if (facing="most") then ok=2; + - // if (f=3) and (ship_id=2) then show_message("ammo: "+string(ammo)+" | range: "+string(range)); + /* + if (facing="right") then targe=target_r; + if (facing="left") then targe=target_l; + if ((facing="front") or (facing="most")) and (front=1) then ok=2; + if (facing="right") or (facing="most") and (right=1) then ok=2; + if (facing="left") or (facing="most") and (left=1) then ok=2; + */ + if (facing="special") then ok=2; + if (!instance_exists(targe)) then exit; + dist=point_distance(x,y,targe.x,targe.y); - if (ammo<0) then ok=0; - ok=3; + if (facing="right") and (point_direction(x,y,target_r.x,target_r.y)<337) and (point_direction(x,y,target_r.x,target_r.y)>203) then ok=2; + if (facing="left") and (point_direction(x,y,target_r.x,target_r.y)>22) and (point_direction(x,y,target_r.x,target_r.y)<157) then ok=2; - if (string_count("orpedo",wep)=0) and (string_count("Interceptor",wep)=0) and (string_count("ommerz",wep)=0) and (string_count("Claws",wep)=0) and (string_count("endrils",wep)=0) and (ok=3) and (owner != eFACTION.Necrons){ - bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_en_round); - bull.speed=20;bull.dam=dam; - if (targe=target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); - if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} - if (string_count("ova",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("eavy Gunz",wep)=1){bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Lance",wep)=1){bull.sprite_index=spr_ground_las;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Ion",wep)=1){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Rail",wep)=1){bull.sprite_index=spr_railgun;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Gravitic",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("Plasma",wep)=1){bull.sprite_index=spr_ground_plasma;bull.image_xscale=2;bullimage_yscale=2;bull.speed=15;} - if (string_count("Pyro-Acid",wep)=1){bull.sprite_index=spr_glob;bull.image_xscale=2;bullimage_yscale=2;} + /*var re_deh;re_deh=relative_direction(direction,target.direction); + if (re_deh<45) or (re_deh>315) or ((re_deh>135) and (re_deh<225)) then direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) + */ + + + + if (ok=2) and (dist<(range+(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))))){ + if (ammo>0) and (ammo<900) then ammo-=1; + weapon_ammo[gg]=ammo;cooldown[gg]=weapon_cooldown[gg];wep=weapon[gg];dam=weapon_dam[gg]; - if (string_count("Weapons",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_ground_las;bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("Pulse",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} + // if (f=3) and (ship_id=2) then show_message("ammo: "+string(ammo)+" | range: "+string(range)); - } - if (string_count("orpedo",wep)=1) and (ok=3) and (owner != eFACTION.Necrons){ - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_round); + if (ammo<0) then ok=0; + ok=3; + + if (string_count("orpedo",wep)=0) and (string_count("Interceptor",wep)=0) and (string_count("ommerz",wep)=0) and (string_count("Claws",wep)=0) and (string_count("endrils",wep)=0) and (ok=3) and (owner != eFACTION.Necrons){ + bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_en_round); + bull.speed=20;bull.dam=dam; + if (targe=target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); + if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} + if (string_count("ova",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} + if (string_count("eavy Gunz",wep)=1){bull.image_xscale=1.5;bull.image_yscale=1.5;} + if (string_count("Lance",wep)=1){bull.sprite_index=spr_ground_las;bull.image_xscale=1.5;bull.image_yscale=1.5;} + if (string_count("Ion",wep)=1){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} + if (string_count("Rail",wep)=1){bull.sprite_index=spr_railgun;bull.image_xscale=1.5;bull.image_yscale=1.5;} + if (string_count("Gravitic",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} + if (string_count("Plasma",wep)=1){bull.sprite_index=spr_ground_plasma;bull.image_xscale=2;bullimage_yscale=2;bull.speed=15;} + if (string_count("Pyro-Acid",wep)=1){bull.sprite_index=spr_glob;bull.image_xscale=2;bullimage_yscale=2;} + + if (string_count("Weapons",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_ground_las;bull.image_xscale=2;bull.image_yscale=2;} + if (string_count("Pulse",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} + + } + if (string_count("orpedo",wep)=1) and (ok=3) and (owner != eFACTION.Necrons){ + if (class!="Ravager"){ + bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_round); + bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + } + bull=instance_create(x,y+lengthdir_y(-10,direction+90),obj_en_round); + bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + bull=instance_create(x,y+lengthdir_y(10,direction+90),obj_en_round); bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + + if (class!="Ravager"){ + bull=instance_create(x,y+lengthdir_y(30,direction+90),obj_en_round); + bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + } + } - bull=instance_create(x,y+lengthdir_y(-10,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - bull=instance_create(x,y+lengthdir_y(10,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(30,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + if (wep="Lightning Arc"){lightning=10; + if (target.shields>0){ + if (class="Cairn Class") or (class="Reaper Class") then target.shields-=20; + else{target.shields-=20;} + } + if (target.shields<=0){ + if (class="Cairn Class") or (class="Reaper Class") then target.hp-=10; + else{target.hp-=10;} + } + } + if (wep="Gauss Particle Whip"){whip=15; + if (target.shields>0) then target.shields-=dam; + if (target.shields<=0) then target.hp-=dam; + } + if (wep="Star Pulse Generator") and (ok=3) and (instance_exists(target)){ + bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_en_pulse); + bull.speed=20; + if (targe=target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); + if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} + bull.target_x=target.x;bull.target_y=target.y; } - } - - if (wep="Lightning Arc"){lightning=10; - if (target.shields>0){ - if (class="Cairn Class") or (class="Reaper Class") then target.shields-=20; - else{target.shields-=20;} + + + if ((string_count("Claws",wep)=1) or (string_count("endrils",wep)=1)) and (ok=3){ + if (target.shields<=0) then target.hp-=weapon_dam[wep]; + if (target.shields>0) then target.shields-=weapon_dam[wep]; } - if (target.shields<=0){ - if (class="Cairn Class") or (class="Reaper Class") then target.hp-=10; - else{target.hp-=10;} + if ((string_count("Interceptor",wep)=1) or (string_count("ommerz",wep)=1) or (string_count("Manta",wep)=1) or (string_count("Glands",wep)=1) or (string_count("Eldar Launch",wep)=1)) and (ok=3){ + bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_in);bull.direction=self.direction;bull.owner=self.owner; } } - if (wep="Gauss Particle Whip"){whip=15; - if (target.shields>0) then target.shields-=dam; - if (target.shields<=0) then target.hp-=dam; - } - if (wep="Star Pulse Generator") and (ok=3) and (instance_exists(target)){ - bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_en_pulse); - bull.speed=20; - if (targe=target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); - if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} - bull.target_x=target.x;bull.target_y=target.y; - } - - - - if ((string_count("Claws",wep)=1) or (string_count("endrils",wep)=1)) and (ok=3){ - if (target.shields<=0) then target.hp-=weapon_dam[wep]; - if (target.shields>0) then target.shields-=weapon_dam[wep]; - } - if ((string_count("Interceptor",wep)=1) or (string_count("ommerz",wep)=1) or (string_count("Manta",wep)=1) or (string_count("Glands",wep)=1) or (string_count("Eldar Launch",wep)=1)) and (ok=3){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_in);bull.direction=self.direction;bull.owner=self.owner; - } } } - - -} - - /* */ } + __b__ = action_if_variable(owner, 6, 0); if __b__ { -image_angle=direction; - -if (obj_fleet.start!=5) then exit; - -var o_dist, dist, ch_rang, ex, spid;spid=0; - -if (shields>0) and (shields0) and (instance_exists(obj_p_ship)){ - if (class="Void Stalker"){o_dist=300;action="swoop";spid=60;} - if (class="Shadow Class"){o_dist=200;action="swoop";spid=80;} - if (class="Hellebore") or (class="Aconite"){o_dist=200;action="swoop";spid=100;} + if (shields>0) and (shields700) then action="attack"; + if (hp<=0){ + var wh,gud;wh=0;gud=0; + repeat(5){wh+=1;if (obj_fleet.enemy[wh]=owner) then gud=wh;} + + if (size=3) then obj_fleet.en_capital_lost[gud]+=1; + if (size=2) then obj_fleet.en_frigate_lost[gud]+=1; + if (size=1) then obj_fleet.en_escort_lost[gud]+=1; + + image_alpha=0.5; + + // ex=instance_create(x,y,obj_explosion); + // ex.image_xscale=2;ex.image_yscale=2;ex.image_speed=0.75; + var husk;husk=instance_create(x,y,obj_en_husk); + husk.sprite_index=sprite_index;husk.direction=direction; + husk.image_angle=image_angle;husk.depth=depth;husk.image_speed=0; + repeat(choose(4,5,6)){ + var explo;explo=instance_create(x,y,obj_explosion); + explo.image_xscale=0.5;explo.image_yscale=0.5; + explo.x+=random_range(sprite_width*0.25,sprite_width*-0.25); + explo.y+=random_range(sprite_width*0.25,sprite_width*-0.25); } + + instance_destroy(); } - - if (y<-2000) or (y>room_height+2000) or (x<-2000) or (x>room_width+2000) then hp=-50; - - - if (cooldown[1]>0) then cooldown[1]-=1; - if (cooldown[2]>0) then cooldown[2]-=1; - if (cooldown[3]>0) then cooldown[3]-=1; - if (cooldown[4]>0) then cooldown[4]-=1; - if (cooldown[5]>0) then cooldown[5]-=1; - if (turret_cool>0) then turret_cool-=1; - - - var bull, targe, rdir, dirr, dist, xx, yy, ok; - targe=0;rdir=0;dirr="";dist=9999;xx=x;yy=y; - - - if (turrets>0) and (instance_exists(obj_p_small)) and (turret_cool=0){ - targe=instance_nearest(x,y,obj_p_small); - if (instance_exists(targe)) then dist=point_distance(x,y,targe.x,targe.y); - - if (dist>64) and (dist<300){ - bull=instance_create(x,y,obj_en_round);bull.direction=point_direction(x,y,targe.x,targe.y); - if (owner = eFACTION.Tyranids) then bull.sprite_index=spr_glob; - if (owner = eFACTION.Tau) or (owner = eFACTION.Eldar) then bull.sprite_index=spr_pulse; - bull.speed=20;bull.dam=3;bull.image_xscale=0.5;bull.image_yscale=0.5;turret_cool=floor(60/turrets); - bull.direction+=choose(random(10),1*-(random(10))); + if (hp>0) and (instance_exists(obj_p_ship)){ + if (class="Void Stalker"){o_dist=300;action="swoop";spid=60;} + if (class="Shadow Class"){o_dist=200;action="swoop";spid=80;} + if (class="Hellebore") or (class="Aconite"){o_dist=200;action="swoop";spid=100;} + + dist=point_distance(x,y,target.x,target.y)-(max(sprite_get_width(target.sprite_index),sprite_get_height(sprite_index))); + + + + + + + + if (target!=0){ + if (speed<((spid)/10)) then speed+=0.02; + + var dist, range; + if (instance_exists(target)){ + dist=point_distance(x,y,target.x,target.y); + + if (action="swoop"){direction=turn_towards_point(direction,x,y,target.x,target.y,5-ship_size);} + if (dist<=o_dist) and (collision_line(x,y,x+lengthdir_x(o_dist,direction),y+lengthdir_y(o_dist,direction),obj_p_ship,0,1)) then action="attack"; + if (dist<300) and (action="attack") then action="bank"; + if (action="bank") then direction=turn_towards_point(direction,x,y,room_width,room_height/2,5-ship_size); + if (action="bank") and (dist>700) then action="attack"; + } } - } - targe=0;rdir=0;dirr="";dist=9999; - - - xx=lengthdir_x(64,direction+90); - yy=lengthdir_y(64,direction+90); - - var front, right, left, rear; - front=0;right=0;left=0;rear=0; - - targe=instance_nearest(xx,yy,obj_p_ship); - rdir=point_direction(x,y,target.x,target.y); - // if (rdir>45) and (rdir<=135) and (targe!=target){target_r=targe;right=1;} - // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} - target_l=instance_nearest(x+lengthdir_x(64,direction+90),y+lengthdir_y(64,direction+90),obj_p_ship); - target_r=instance_nearest(x+lengthdir_x(64,direction+270),y+lengthdir_y(64,direction+270),obj_p_ship); - - if (collision_line(x,y,x+lengthdir_x(2000,direction),y+lengthdir_y(2000,direction),obj_p_ship,0,1)) then front=1; - - - var f, facing, ammo, range, wep, dam, gg;f=0;facing="";ammo=0;range=0;wep="";dam=0;gg=0; - - - repeat(weapons){ - gg+=1; - - ok=0;f+=1;facing="";ammo=0;range=0;wep=""; - - //weapon[gg]=0;weapon_ammo[gg]=0;weapon_range[gg]=0; - if (cooldown[gg]<=0) and (weapon[gg]!="") and (weapon_ammo[gg]>0) then ok=1; - if (ok=1){ - facing=weapon_facing[gg];ammo=weapon_ammo[gg];range=weapon_range[gg];} - - targe=target; - if (facing="front") and (front=1) then ok=2; - if (facing="most") then ok=2; - - - /* - if (facing="right") then targe=target_r; - if (facing="left") then targe=target_l; - if ((facing="front") or (facing="most")) and (front=1) then ok=2; - if (facing="right") or (facing="most") and (right=1) then ok=2; - if (facing="left") or (facing="most") and (left=1) then ok=2; - */ - if (facing="special") then ok=2; - if (!instance_exists(targe)) then exit; - dist=point_distance(x,y,targe.x,targe.y); - - if (facing="right") and (point_direction(x,y,target_r.x,target_r.y)<337) and (point_direction(x,y,target_r.x,target_r.y)>203) then ok=2; - if (facing="left") and (point_direction(x,y,target_r.x,target_r.y)>22) and (point_direction(x,y,target_r.x,target_r.y)<157) then ok=2; + if (y<-2000) or (y>room_height+2000) or (x<-2000) or (x>room_width+2000) then hp=-50; + + + if (cooldown[1]>0) then cooldown[1]-=1; + if (cooldown[2]>0) then cooldown[2]-=1; + if (cooldown[3]>0) then cooldown[3]-=1; + if (cooldown[4]>0) then cooldown[4]-=1; + if (cooldown[5]>0) then cooldown[5]-=1; + if (turret_cool>0) then turret_cool-=1; - /*var re_deh;re_deh=relative_direction(direction,target.direction); - if (re_deh<45) or (re_deh>315) or ((re_deh>135) and (re_deh<225)) then direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) - */ + + var bull, targe, rdir, dirr, dist, xx, yy, ok; + targe=0;rdir=0;dirr="";dist=9999;xx=x;yy=y; + + + if (turrets>0) and (instance_exists(obj_p_small)) and (turret_cool=0){ + targe=instance_nearest(x,y,obj_p_small); + if (instance_exists(targe)) then dist=point_distance(x,y,targe.x,targe.y); + if (dist>64) and (dist<300){ + bull=instance_create(x,y,obj_en_round);bull.direction=point_direction(x,y,targe.x,targe.y); + if (owner = eFACTION.Tyranids) then bull.sprite_index=spr_glob; + if (owner = eFACTION.Tau) or (owner = eFACTION.Eldar) then bull.sprite_index=spr_pulse; + bull.speed=20;bull.dam=3;bull.image_xscale=0.5;bull.image_yscale=0.5;turret_cool=floor(60/turrets); + bull.direction+=choose(random(10),1*-(random(10))); + } + } + targe=0;rdir=0;dirr="";dist=9999; + + + xx=lengthdir_x(64,direction+90); + yy=lengthdir_y(64,direction+90); + var front, right, left, rear; + front=0;right=0;left=0;rear=0; - if (ok=2) and (dist<(range+(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))))){ - if (ammo>0) and (ammo<900) then ammo-=1; - weapon_ammo[gg]=ammo;cooldown[gg]=weapon_cooldown[gg];wep=weapon[gg];dam=weapon_dam[gg]; + targe=instance_nearest(xx,yy,obj_p_ship); + rdir=point_direction(x,y,target.x,target.y); + // if (rdir>45) and (rdir<=135) and (targe!=target){target_r=targe;right=1;} + // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} + target_l=instance_nearest(x+lengthdir_x(64,direction+90),y+lengthdir_y(64,direction+90),obj_p_ship); + target_r=instance_nearest(x+lengthdir_x(64,direction+270),y+lengthdir_y(64,direction+270),obj_p_ship); + + if (collision_line(x,y,x+lengthdir_x(2000,direction),y+lengthdir_y(2000,direction),obj_p_ship,0,1)) then front=1; + + + var f, facing, ammo, range, wep, dam, gg;f=0;facing="";ammo=0;range=0;wep="";dam=0;gg=0; + + + repeat(weapons){ + gg+=1; + + ok=0;f+=1;facing="";ammo=0;range=0;wep=""; + + //weapon[gg]=0;weapon_ammo[gg]=0;weapon_range[gg]=0; + + + if (cooldown[gg]<=0) and (weapon[gg]!="") and (weapon_ammo[gg]>0) then ok=1; + if (ok=1){ + facing=weapon_facing[gg];ammo=weapon_ammo[gg];range=weapon_range[gg];} - // if (f=3) and (ship_id=2) then show_message("ammo: "+string(ammo)+" | range: "+string(range)); + targe=target; + if (facing="front") and (front=1) then ok=2; + if (facing="most") then ok=2; - if (ammo<0) then ok=0; - ok=3; - if (string_count("orpedo",wep)=0) and (string_count("Interceptor",wep)=0) and (string_count("ommerz",wep)=0) and (string_count("Claws",wep)=0) and (string_count("endrils",wep)=0) and (ok=3){ - bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_en_round); - bull.speed=20;bull.dam=dam; - if (targe=target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); - if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} - if (string_count("ova",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("eavy Gunz",wep)=1){bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Lance",wep)=1){bull.sprite_index=spr_ground_las;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Ion",wep)=1){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Rail",wep)=1){bull.sprite_index=spr_railgun;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Gravitic",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("Plasma",wep)=1){bull.sprite_index=spr_ground_plasma;bull.image_xscale=2;bullimage_yscale=2;bull.speed=15;} - if (string_count("Pyro-Acid",wep)=1){bull.sprite_index=spr_glob;bull.image_xscale=2;bullimage_yscale=2;} + /* + if (facing="right") then targe=target_r; + if (facing="left") then targe=target_l; + if ((facing="front") or (facing="most")) and (front=1) then ok=2; + if (facing="right") or (facing="most") and (right=1) then ok=2; + if (facing="left") or (facing="most") and (left=1) then ok=2; + */ + if (facing="special") then ok=2; + if (!instance_exists(targe)) then exit; + dist=point_distance(x,y,targe.x,targe.y); + + if (facing="right") and (point_direction(x,y,target_r.x,target_r.y)<337) and (point_direction(x,y,target_r.x,target_r.y)>203) then ok=2; + if (facing="left") and (point_direction(x,y,target_r.x,target_r.y)>22) and (point_direction(x,y,target_r.x,target_r.y)<157) then ok=2; + + /*var re_deh;re_deh=relative_direction(direction,target.direction); + if (re_deh<45) or (re_deh>315) or ((re_deh>135) and (re_deh<225)) then direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) + */ + + + + if (ok=2) and (dist<(range+(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))))){ + if (ammo>0) and (ammo<900) then ammo-=1; + weapon_ammo[gg]=ammo;cooldown[gg]=weapon_cooldown[gg];wep=weapon[gg];dam=weapon_dam[gg]; - if (string_count("Weapons",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_ground_las;bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("Pulse",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} + // if (f=3) and (ship_id=2) then show_message("ammo: "+string(ammo)+" | range: "+string(range)); - } - if (string_count("orpedo",wep)=1) and (ok=3){ - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - } - bull=instance_create(x,y+lengthdir_y(-10,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - bull=instance_create(x,y+lengthdir_y(10,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + if (ammo<0) then ok=0; + ok=3; - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(30,direction+90),obj_en_round); + if (string_count("orpedo",wep)=0) and (string_count("Interceptor",wep)=0) and (string_count("ommerz",wep)=0) and (string_count("Claws",wep)=0) and (string_count("endrils",wep)=0) and (ok=3){ + bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_en_round); + bull.speed=20;bull.dam=dam; + if (targe=target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); + if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} + if (string_count("ova",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} + if (string_count("eavy Gunz",wep)=1){bull.image_xscale=1.5;bull.image_yscale=1.5;} + if (string_count("Lance",wep)=1){bull.sprite_index=spr_ground_las;bull.image_xscale=1.5;bull.image_yscale=1.5;} + if (string_count("Ion",wep)=1){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} + if (string_count("Rail",wep)=1){bull.sprite_index=spr_railgun;bull.image_xscale=1.5;bull.image_yscale=1.5;} + if (string_count("Gravitic",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} + if (string_count("Plasma",wep)=1){bull.sprite_index=spr_ground_plasma;bull.image_xscale=2;bullimage_yscale=2;bull.speed=15;} + if (string_count("Pyro-Acid",wep)=1){bull.sprite_index=spr_glob;bull.image_xscale=2;bullimage_yscale=2;} + + if (string_count("Weapons",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_ground_las;bull.image_xscale=2;bull.image_yscale=2;} + if (string_count("Pulse",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} + + } + if (string_count("orpedo",wep)=1) and (ok=3){ + if (class!="Ravager"){ + bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_round); + bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + } + bull=instance_create(x,y+lengthdir_y(-10,direction+90),obj_en_round); bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + bull=instance_create(x,y+lengthdir_y(10,direction+90),obj_en_round); + bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + + if (class!="Ravager"){ + bull=instance_create(x,y+lengthdir_y(30,direction+90),obj_en_round); + bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + } + + } + if ((string_count("Claws",wep)=1) or (string_count("endrils",wep)=1)) and (ok=3){ + if (target.shields<=0) then target.hp-=weapon_dam[wep]; + if (target.shields>0) then target.shields-=weapon_dam[wep]; + } + if ((string_count("Interceptor",wep)=1) or (string_count("ommerz",wep)=1) or (string_count("Manta",wep)=1) or (string_count("Glands",wep)=1) or (string_count("Eldar Launch",wep)=1)) and (ok=3){ + bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_in);bull.direction=self.direction;bull.owner=self.owner; } - - } - if ((string_count("Claws",wep)=1) or (string_count("endrils",wep)=1)) and (ok=3){ - if (target.shields<=0) then target.hp-=weapon_dam[wep]; - if (target.shields>0) then target.shields-=weapon_dam[wep]; - } - if ((string_count("Interceptor",wep)=1) or (string_count("ommerz",wep)=1) or (string_count("Manta",wep)=1) or (string_count("Glands",wep)=1) or (string_count("Eldar Launch",wep)=1)) and (ok=3){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_in);bull.direction=self.direction;bull.owner=self.owner; } } } - - -} - - -/* */ + /* */ } /* */ diff --git a/objects/obj_mass_equip/Draw_0.gml b/objects/obj_mass_equip/Draw_0.gml index 239f7dbe21..01b0963cbb 100644 --- a/objects/obj_mass_equip/Draw_0.gml +++ b/objects/obj_mass_equip/Draw_0.gml @@ -25,7 +25,7 @@ if (total_role_number>0){ draw_rectangle(xx+114,yy+626,xx+560,yy+665,0);draw_set_alpha(1); if (scr_click_left()) and (good1+good2+good3+good4+good5=5){ engage=true;refresh=true; - effect_create_above(ef_firework,xx+800,yy+400,5,c_yellow); + effect_create_depth(-15000,ef_firework,xx+800,yy+400,5,c_yellow); } }draw_set_alpha(1); @@ -114,7 +114,7 @@ if (total_role_number > 0 && tab > -1) { false, // do not limit to available items ); } - + draw_set_color(0); draw_rectangle(xx + 1183, yy + 160, xx + 1506, yy + 747, 0); @@ -127,37 +127,37 @@ if (total_role_number > 0 && tab > -1) { var slot_name = get_slot_name(obj_controller.settings, tab); draw_text_transformed(xx + 1203, yy + 174, string_hash_to_newline($"Select {slot_name}"), 0.6, 0.6, 0); draw_set_font(fnt_40k_14b); - + var x3 = xx + 1205; // Starting x position for the first column var y3 = yy + 205; // Starting y position var space = 18; // Amount to move down for each item var items_per_column = 24; var column_width = 146; var column_gap = 3; - + for (var h = 0; h < array_length(item_name); h++) { if (h > 0 && h % items_per_column == 0) { x3 += column_width; y3 = yy + 205; } - + draw_set_color(c_gray); var scale = string_width(string_hash_to_newline(item_name[h])) >= 140 ? 0.75 : 1; draw_text_transformed(x3, y3, string_hash_to_newline(item_name[h]), scale, 1, 0); - + // keep track of the item's bottom right corner var item_x2 = x3 + (column_width - column_gap); var item_y2 = y3 + space - 1; - + if (scr_hit(x3, y3, item_x2, item_y2)) { draw_set_color(c_white); draw_set_alpha(0.2); draw_text_transformed(x3, y3, string_hash_to_newline(item_name[h]), scale, 1, 0); draw_set_alpha(1); - + if (scr_click_left()) { var buh = item_name[h] == ITEM_NAME_NONE ? "" : item_name[h]; - + switch (tab) { // slots case 0: obj_ini.wep1[100, role] = buh; break; @@ -178,7 +178,7 @@ if (total_role_number > 0 && tab > -1) { } y3 += space; } - + draw_set_halign(fa_center); draw_set_font(fnt_40k_14b); draw_set_color(c_gray); diff --git a/objects/obj_mass_equip/Step_0.gml b/objects/obj_mass_equip/Step_0.gml index 7b851188b1..5decb6ad81 100644 --- a/objects/obj_mass_equip/Step_0.gml +++ b/objects/obj_mass_equip/Step_0.gml @@ -2,11 +2,11 @@ try { if ((obj_controller.settings == 0) || (obj_controller.menu != 23)) { instance_destroy(); } - + var romanNumerals = scr_roman_numerals(); var unit; var unit_armour, complete; - + if (engage == true) { for (var co = 0; co <= obj_ini.companies; co++) { var i = 0; @@ -20,11 +20,11 @@ try { continue; } } - + // ** Start Armour ** var unit_armour = unit.get_armour_data(); var has_valid_armour = is_struct(unit_armour); - + // Check if unit_armour is a struct and evaluate tag-based or name-based compatibility if (has_valid_armour) { switch (req_armour) { @@ -38,21 +38,21 @@ try { has_valid_armour = req_armour == unit_armour.name; } } - + // Attempt to equip if not valid if (!has_valid_armour) { var result = unit.update_armour(req_armour); - + // Fallback: If request was for Power Armour but update failed, try Terminator if (result != "complete" && req_armour == STR_ANY_POWER_ARMOUR) { unit.update_armour(STR_ANY_TERMINATOR_ARMOUR); } - + // Refresh unit_armour after update unit_armour = unit.get_armour_data(); } // ** End Armour ** - + // ** Start Weapons ** if (unit.weapon_one() != req_wep1) { if (is_string(unit.weapon_one(true))) { @@ -72,7 +72,7 @@ try { if (is_string(unit.gear(true))) { unit.update_gear(req_gear); } - + // ** Start Mobility Items ** if (unit.mobility_item() != req_mobi) { var stop_mobi = false; @@ -92,7 +92,7 @@ try { } engage = false; } - + // ** Refreshing ** if ((refresh == true) && (obj_controller.settings > 0)) { total_role_number = 0; @@ -100,9 +100,9 @@ try { for (var i = 0; i < 11; i++) { role_number[i] = 0; } - + var _total_role_gear = new CountingMap(); - + all_equip = ""; req_armour = ""; req_armour_num = 0; @@ -124,18 +124,18 @@ try { good3 = 0; good4 = 0; good5 = 0; - + req_armour = obj_ini.armour[100, role]; req_wep1 = obj_ini.wep1[100, role]; req_wep2 = obj_ini.wep2[100, role]; req_gear = obj_ini.gear[100, role]; req_mobi = obj_ini.mobi[100, role]; - + for (var co = 0; co < 11; co++) { for (var i = 0; i < array_length(obj_ini.role[co]); i++) { if (obj_ini.role[co][i] == obj_ini.role[100, role]) { role_number[co] += 1; - + // Weapon1 var onc = 0; if ((string_count("&", obj_ini.wep1[co][i]) > 0) && (onc == 0)) { @@ -150,7 +150,7 @@ try { have_wep1_num += 1; onc = 1; } - + // Weapon2 onc = 0; if ((string_count("&", obj_ini.wep2[co][i]) > 0) && (onc == 0)) { @@ -165,10 +165,10 @@ try { have_wep2_num += 1; onc = 1; } - + if (req_armour != "") { var yes = false; - + if (req_armour == STR_ANY_POWER_ARMOUR) { if (array_contains(LIST_BASIC_POWER_ARMOUR, obj_ini.armour[co][i])) { yes = true; @@ -178,18 +178,18 @@ try { yes = true; } } - + if (string_count("&", obj_ini.armour[co][i]) > 0) { yes = true; } else if (obj_ini.armour[co][i] == req_armour) { yes = true; } - + if (yes == true) { have_armour_num += 1; } } - + if (req_gear != "") { if (string_count("&", obj_ini.gear[co][i]) == 0) { if (obj_ini.gear[co][i] == req_gear) { @@ -197,7 +197,7 @@ try { } } } - + if (req_mobi != "") { if (string_count("&", obj_ini.mobi[co][i]) == 0) { if (obj_ini.mobi[co][i] == req_mobi) { @@ -206,7 +206,7 @@ try { } } } - + if (obj_ini.role[co][i] == obj_ini.role[100, role]) { _total_role_gear.add(obj_ini.wep1[co][i]); _total_role_gear.add(obj_ini.wep2[co][i]); @@ -216,10 +216,10 @@ try { } } } - + have_wep1_num += scr_item_count(req_wep1); have_wep2_num += scr_item_count(req_wep2); - + if (req_armour == STR_ANY_POWER_ARMOUR) { for (var g = 0; g < array_length(LIST_BASIC_POWER_ARMOUR); g++) { have_armour_num += scr_item_count(LIST_BASIC_POWER_ARMOUR[g]); @@ -231,12 +231,12 @@ try { } else { have_armour_num += scr_item_count(req_armour); } - + have_gear_num += scr_item_count(req_gear); have_mobi_num += scr_item_count(req_mobi); - + total_role_number = 0; - + for (var i = 0; i < 11; i++) { if (role_number[i] > 0) { req_wep1_num += role_number[i]; @@ -252,18 +252,18 @@ try { total_roles = $"You currently have {total_role_number}x {obj_ini.role[100, role]} across all companies."; for (var i = 0; i < 11; i++) { var _company_name = i == 0 ? "HQ" : $"{romanNumerals[i - 1]} Company"; - + if ((role_number[i] > 0)) { total_roles += $" {_company_name}: {role_number[i]};"; } } } - + // Add up messages all_equip = $"In total they are equipped with: {_total_role_gear.get_total_string()}."; - + refresh = false; - + if (tab > -1) { item_name = []; var is_hand_slot = tab == 0 || tab == 1; @@ -274,16 +274,16 @@ try { is_hand_slot ? eENGAGEMENT.Any : eENGAGEMENT.None, true, // include company standard false, // show all regardless of inventory - + ); } - + good1 = 0; good2 = 0; good3 = 0; good4 = 0; good5 = 0; - + if ((req_wep1_num <= have_wep1_num) || (req_wep1 == "")) { good1 = 1; } diff --git a/objects/obj_p1_bullet/Collision_obj_ork.gml b/objects/obj_p1_bullet/Collision_obj_ork.gml index dfd703e388..2fa0fb3de7 100644 --- a/objects/obj_p1_bullet/Collision_obj_ork.gml +++ b/objects/obj_p1_bullet/Collision_obj_ork.gml @@ -19,7 +19,7 @@ if (sprite_index!=spr_flame2){ other.enemy_hp[t]-=d; if (other.enemies_alive=0){ - effect_create_above(ef_firework,other.x,other.y,1,c_green); + effect_create_depth(-15000,ef_firework,other.x,other.y,1,c_green); with(other){instance_destroy();} instance_destroy(); } @@ -52,7 +52,7 @@ if (sprite_index=spr_flame2) and (life=5){ other.enemy_hp[t]-=d; if (other.enemies_alive=0){ - effect_create_above(ef_firework,other.x,other.y,1,c_green); + effect_create_depth(-15000,ef_firework,other.x,other.y,1,c_green); with(other){instance_destroy();} } } diff --git a/scripts/__global_object_depths/__global_object_depths.gml b/scripts/__global_object_depths/__global_object_depths.gml index 288b2b6164..e86da6e7da 100644 --- a/scripts/__global_object_depths/__global_object_depths.gml +++ b/scripts/__global_object_depths/__global_object_depths.gml @@ -6,7 +6,7 @@ function __global_object_depths() { // Initialise the global array that allows the lookup of the depth of a given object // GM2.0 does not have a depth on objects so on import from 1.x a global array is created // NOTE: MacroExpansion is used to insert the array initialisation at import time - + // insert the generated arrays here global.__objectDepths[0] = -5000; // obj_fleet global.__objectDepths[1] = 0; // obj_circular @@ -96,8 +96,8 @@ function __global_object_depths() { global.__objectDepths[85] = -1; // obj_star_event global.__objectDepths[86] = -999999999; // obj_halp global.__objectDepths[87] = -11; // obj_fleet_show - - + + global.__objectNames[0] = "obj_fleet"; global.__objectNames[1] = "obj_circular"; global.__objectNames[2] = "obj_fleet_spawner"; @@ -186,10 +186,10 @@ function __global_object_depths() { global.__objectNames[85] = "obj_star_event"; global.__objectNames[86] = "obj_halp"; global.__objectNames[87] = "obj_fleet_show"; - - + + // create another array that has the correct entries - var len = array_length_1d(global.__objectDepths); + var len = array_length(global.__objectDepths); global.__objectID2Depth = []; for( var i=0; i= 0) && (objID < array_length_1d(global.__objectID2Depth)) { - ret = global.__objectID2Depth[objID]; - } // end if - return ret; - - -} + var objID = argument0; + var ret = 0; + if (objID >= 0) && (objID < array_length(global.__objectID2Depth)) { + ret = global.__objectID2Depth[objID]; + } // end if + return ret; +} \ No newline at end of file From f1bdb4332134a576541af8c252b4c4c655835d70 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 19:04:15 -0500 Subject: [PATCH 02/45] scr_Table whitespace cleanup --- scripts/scr_Table/scr_Table.gml | 225 ++++++++++++++++---------------- 1 file changed, 112 insertions(+), 113 deletions(-) diff --git a/scripts/scr_Table/scr_Table.gml b/scripts/scr_Table/scr_Table.gml index 9bf8884c25..6de9d2e837 100644 --- a/scripts/scr_Table/scr_Table.gml +++ b/scripts/scr_Table/scr_Table.gml @@ -1,114 +1,113 @@ function Table(data) constructor{ - headings = []; - row_data = []; - standard_loc_data(); - row_h = 12; - - column_widths = []; - - set_column_widths = []; - - row_key_draw = []; - - halign = fa_center; - - header_h = 0; - - col_spacing = 5; - - move_data_to_current_scope(data); - - update(); - - static update = function(data){ - move_data_to_current_scope(data); - w = 0; - column_widths = []; - header_h = 0; - for (var i=0; i0){ - array_push(column_widths, set_column_widths[i]); - } else{ - if (array_length(column_widths) <= i){ - array_push(column_widths, _heading.w) - } - if (column_widths[i] == 0){ - column_widths[i] = _heading.w; - } - } - - - _heading.update({ - max_width : column_widths[i], - x1 : x1+w +(column_widths[i]/2), - y1 : y1, - halign : halign - }); - - if (_heading.h > header_h){ - header_h = _heading.h; - } - - w += column_widths[i] + col_spacing; - } - } - - static draw = function(){ - add_draw_return_values(); - - draw_set_halign(halign); - draw_set_valign(fa_top); - - var _col_draw_x = x1; - for (var i=0;i y2 - row_h){ - break; - } - _col_draw_x = x1; - var _row = row_data[i]; - var _row_entered = scr_hit_dimensions(_col_draw_x,_row_level,w,row_h); - if (is_array(row_data[i])){ - for (var d=0;d0){ + array_push(column_widths, set_column_widths[i]); + } else{ + if (array_length(column_widths) <= i){ + array_push(column_widths, _heading.w) + } + if (column_widths[i] == 0){ + column_widths[i] = _heading.w; + } + } + + + _heading.update({ + max_width : column_widths[i], + x1 : x1+w +(column_widths[i]/2), + y1 : y1, + halign : halign + }); + + if (_heading.h > header_h){ + header_h = _heading.h; + } + + w += column_widths[i] + col_spacing; + } + } + + static draw = function(){ + add_draw_return_values(); + + draw_set_halign(halign); + draw_set_valign(fa_top); + + var _col_draw_x = x1; + for (var i=0;i y2 - row_h){ + break; + } + _col_draw_x = x1; + var _row = row_data[i]; + var _row_entered = scr_hit_dimensions(_col_draw_x,_row_level,w,row_h); + if (is_array(row_data[i])){ + for (var d=0;d Date: Fri, 26 Dec 2025 19:07:28 -0500 Subject: [PATCH 03/45] GM1020 error cleanup, function call does nothing but throw an error. --- scripts/scr_Table/scr_Table.gml | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/scr_Table/scr_Table.gml b/scripts/scr_Table/scr_Table.gml index 6de9d2e837..267dce2c7a 100644 --- a/scripts/scr_Table/scr_Table.gml +++ b/scripts/scr_Table/scr_Table.gml @@ -18,8 +18,6 @@ function Table(data) constructor{ move_data_to_current_scope(data); - update(); - static update = function(data){ move_data_to_current_scope(data); w = 0; From 3fb8f9f013ba2ccd757c653410ce4b3dac236846 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 19:15:34 -0500 Subject: [PATCH 04/45] Cleared GM1007 Error, local variable Space Marine luck stat was being overriden by the global luck enum. luck enum renamed to eLUCK, matching CODE_STYLE.md suggestion. Space Marine Luck stat potentially not working (properly) in past builds due to this overriding. --- scripts/macros/macros.gml | 4 ++-- scripts/scr_random_event/scr_random_event.gml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index 2815195514..965db1bad0 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -64,10 +64,10 @@ enum MENU { EventLog = 17, Diplomacy = 20, Settings = 21, - GameHelp = 30, + GameHelp = 30 } -enum luck { +enum eLUCK { bad = -1, neutral = 0, good = 1 diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index b02d9853b5..25b308f807 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -48,13 +48,13 @@ function scr_random_event(execute_now) { var player_luck; var luck_roll = roll_dice_chapter(1, 100, "low"); - if (luck_roll<=45) then player_luck=luck.good; - if (luck_roll>45) and (luck_roll<55) then player_luck=luck.neutral; - if (luck_roll>=55) then player_luck=luck.bad; + if (luck_roll<=45) then player_luck=eLUCK.good; + if (luck_roll>45) and (luck_roll<55) then player_luck=eLUCK.neutral; + if (luck_roll>=55) then player_luck=eLUCK.bad; var events; - if(player_luck == luck.good){ + if(player_luck == eLUCK.good){ events = [ EVENT.space_hulk, @@ -67,7 +67,7 @@ function scr_random_event(execute_now) { EVENT.mechanicus_mission ]; } - else if(player_luck == luck.neutral){ + else if(player_luck == eLUCK.neutral){ events = [ EVENT.strange_behavior, @@ -77,7 +77,7 @@ function scr_random_event(execute_now) { EVENT.random_fun, ]; } - else if(player_luck == luck.bad){ + else if(player_luck == eLUCK.bad){ events = [ EVENT.warp_storms, From 28074e8d05e1b53a16e389249abaa0328fc7b056 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 19:58:42 -0500 Subject: [PATCH 05/45] I have discovered the linter and have used it appropriately. Woops. --- objects/obj_al_ship/Alarm_0.gml | 1698 ++++++------ objects/obj_al_ship/Create_0.gml | 82 +- objects/obj_al_ship/Draw_0.gml | 38 +- objects/obj_al_ship/Step_0.gml | 1240 +++++---- objects/obj_en_ship/Alarm_0.gml | 2376 ++++++++--------- objects/obj_en_ship/Create_0.gml | 97 +- objects/obj_en_ship/Draw_0.gml | 106 +- objects/obj_en_ship/Step_0.gml | 1277 ++++++--- objects/obj_mass_equip/Create_0.gml | 66 +- objects/obj_mass_equip/Draw_0.gml | 204 +- objects/obj_mass_equip/Step_0.gml | 108 +- objects/obj_p1_bullet/Collision_obj_ork.gml | 138 +- objects/obj_p1_bullet/Create_0.gml | 22 +- objects/obj_p1_bullet/Step_0.gml | 49 +- .../__global_object_depths.gml | 16 +- scripts/object_get_depth/object_get_depth.gml | 4 +- scripts/scr_Table/scr_Table.gml | 113 +- scripts/scr_random_event/scr_random_event.gml | 1626 ++++++----- 18 files changed, 4948 insertions(+), 4312 deletions(-) diff --git a/objects/obj_al_ship/Alarm_0.gml b/objects/obj_al_ship/Alarm_0.gml index bd070b8318..1a5e264fd8 100644 --- a/objects/obj_al_ship/Alarm_0.gml +++ b/objects/obj_al_ship/Alarm_0.gml @@ -1,872 +1,888 @@ // Sets up the ships for each race -for(var i=1; i0){ + } else if (shields > 0) { draw_set_color(c_white); - if (obj_controller.zoomed=0){ - if (maxhp!=0) then draw_text(x,y-(sprite_height/2),string_hash_to_newline(string(floor((shields/maxshields)*100))+"%")); + if (obj_controller.zoomed == 0) { + if (maxhp != 0) { + draw_text(x, y - (sprite_height / 2), string_hash_to_newline(string(floor((shields / maxshields) * 100)) + "%")); + } } - if (obj_controller.zoomed=1){ - if (maxhp!=0) then draw_text_transformed(x,y-sprite_height,string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"),2,2,0); + if (obj_controller.zoomed == 1) { + if (maxhp != 0) { + draw_text_transformed(x, y - sprite_height, string_hash_to_newline(string(floor((shields / maxshields) * 100)) + "%"), 2, 2, 0); + } } } } -} \ No newline at end of file +} diff --git a/objects/obj_al_ship/Step_0.gml b/objects/obj_al_ship/Step_0.gml index 543b48d77d..93deda520f 100644 --- a/objects/obj_al_ship/Step_0.gml +++ b/objects/obj_al_ship/Step_0.gml @@ -1,157 +1,190 @@ // Manages space combat, checks if ships are destroyed and does the targeting and pointing of the ship var __b__; -var bull, ok, targe=0,rdir=0,dist=9999,xx=x,yy=y; -var front=0,right=0,left=0,rear=0; -var f=0,facing="",ammo=0,range=0,wep="",dam=0; -var o_dist=0, spid=0; -var gud=0; +var bull, ok, targe = 0, rdir = 0, dist = 9999, xx = x, yy = y; +var front = 0, right = 0, left = 0, rear = 0; +var f = 0, facing = "", ammo = 0, range = 0, wep = "", dam = 0; +var o_dist = 0, spid = 0; +var gud = 0; var husk; var explo; __b__ = action_if_variable(owner, 6, 0); -if (!__b__){ - image_angle=direction; - - if (obj_fleet.start!=5) then exit; - - if (class="Daemon") and (image_alpha<1) then image_alpha+=0.006; - - o_dist=0; - spid=0; - - if (shields>0) and (shields 0) && (shields < maxshields)) { + shields += 0.02; + } + // Need to every couple of seconds check this // with obj_en_ship if not big then disable, check nearest, and activate once more - if (instance_exists(obj_en_ship)) then target=instance_nearest(x,y,obj_en_ship); - if (!instance_exists(target)) then exit; + if (instance_exists(obj_en_ship)) { + target = instance_nearest(x, y, obj_en_ship); + } + if (!instance_exists(target)) { + exit; + } // Check if ship is destroyed - if (hp<=0){ - gud=0; - for(var wh=1; wh<=5; wh++){if (obj_fleet.enemy[wh]==owner) then gud=wh;} - - if (class=="Gorbag's Revenge" or (class=="Dethdeala") or (class=="Kroolboy") or (class=="Desecrator")) or (class=="Custodian") then obj_fleet.en_capital_lost[gud]+=1; - else if (class=="Battlekroozer") or (class=="Daemon") or (class=="Avenger Class Grand Cruiser") or (class=="Carnage") or (class=="Emissary") or (class=="Protector") then obj_fleet.en_frigate_lost[gud]+=1; - else if (class=="Ravager") or (class=="Iconoclast") or (class=="Warden") or (class=="Castellan") then obj_fleet.en_escort_lost[gud]+=1; - else if (class=="Leviathan") then obj_fleet.en_capital_lost[gud]+=1; - else if (class=="Razorfiend") then obj_fleet.en_frigate_lost[gud]+=1; - else if (class=="Stalker") or (class=="Prowler") or (class=="Sword Class Frigate") then obj_fleet.en_escort_lost[gud]+=1; - - image_alpha=0.5; - - if (owner != eFACTION.Tyranids){ - husk=instance_create(x,y,obj_en_husk); - husk.sprite_index=sprite_index; - husk.direction=direction; - husk.image_angle=image_angle; - husk.depth=depth; - husk.image_speed=0; - for(var i=0; i0) and (instance_exists(obj_en_ship)){ + if ((hp > 0) && instance_exists(obj_en_ship)) { // TODO on another PR we need to redo how combat works, currently its just "attack" perhaps we can have more precise choise based AI with // simpler patterns? - if (class=="Apocalypse Class Battleship"){ - o_dist=500; - action="attack"; - spid=20; - } - if (class=="Nemesis Class Fleet Carrier"){ - o_dist=1000; - action="attack"; - spid=20; - } - if (class=="Leviathan"){ - o_dist=160; - action="attack"; - spid=20; - } - if (class=="Battle Barge") or (class=="Custodian"){ - o_dist=300; - action="attack"; - spid=20; - } - if (class=="Desecrator"){ - o_dist=300; - action="attack"; - spid=20; - } - if (class=="Razorfiend"){ - o_dist=100; - action="attack"; - spid=25; - } - if (class=="Dethdeala") or (class=="Protector") or (class=="Emissary"){ - o_dist=200; - action="attack"; - spid=20; - } - if (class=="Gorbag's Revenge"){ - o_dist=200; - action="attack"; - spid=20; - } - if (class=="Kroolboy") or (class=="Slamblasta"){ - o_dist=200; - action="attack"; - spid=25; - } - if (class=="Battlekroozer"){ - o_dist=200; - action="attack"; - spid=30; - } - if (class=="Avenger") or (class=="Carnage") or (class=="Daemon"){ - o_dist=200; - action="attack"; - spid=20; - } - if (class=="Ravager") or (class=="Iconoclast") or (class=="Castellan") or (class=="Warden"){ - o_dist=300; - action="attack"; - spid=35; - } - if (class=="Stalker") or (class=="Sword Class Frigate"){ - o_dist=100; - action="attack"; - spid=20; - } - if (class=="Prowler"){ - o_dist=100; - action="attack"; - spid=35; - } - if (class=="Avenger Class Grand Cruiser"){ - o_dist=48; - action="broadside"; - spid=20; + if (class == "Apocalypse Class Battleship") { + o_dist = 500; + action = "attack"; + spid = 20; + } + if (class == "Nemesis Class Fleet Carrier") { + o_dist = 1000; + action = "attack"; + spid = 20; + } + if (class == "Leviathan") { + o_dist = 160; + action = "attack"; + spid = 20; + } + if ((class == "Battle Barge") || (class == "Custodian")) { + o_dist = 300; + action = "attack"; + spid = 20; + } + if (class == "Desecrator") { + o_dist = 300; + action = "attack"; + spid = 20; + } + if (class == "Razorfiend") { + o_dist = 100; + action = "attack"; + spid = 25; + } + if ((class == "Dethdeala") || (class == "Protector") || (class == "Emissary")) { + o_dist = 200; + action = "attack"; + spid = 20; + } + if (class == "Gorbag's Revenge") { + o_dist = 200; + action = "attack"; + spid = 20; + } + if ((class == "Kroolboy") || (class == "Slamblasta")) { + o_dist = 200; + action = "attack"; + spid = 25; + } + if (class == "Battlekroozer") { + o_dist = 200; + action = "attack"; + spid = 30; + } + if ((class == "Avenger") || (class == "Carnage") || (class == "Daemon")) { + o_dist = 200; + action = "attack"; + spid = 20; + } + if ((class == "Ravager") || (class == "Iconoclast") || (class == "Castellan") || (class == "Warden")) { + o_dist = 300; + action = "attack"; + spid = 35; + } + if ((class == "Stalker") || (class == "Sword Class Frigate")) { + o_dist = 100; + action = "attack"; + spid = 20; + } + if (class == "Prowler") { + o_dist = 100; + action = "attack"; + spid = 35; + } + if (class == "Avenger Class Grand Cruiser") { + o_dist = 48; + action = "broadside"; + spid = 20; } // if (class!="big") then flank!!!! - spid=spid*speed_bonus; - - dist=point_distance(x,y,target.x,target.y)-(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))); + spid = spid * speed_bonus; + + dist = point_distance(x, y, target.x, target.y) - max(sprite_get_width(sprite_index), sprite_get_height(sprite_index)); // For example here we could improve the options and how ships beheave... - if (target!=0) and (action=="attack"){ - direction=turn_towards_point(direction,x,y,target.x,target.y,.1); + if ((target != 0) && (action == "attack")) { + direction = turn_towards_point(direction, x, y, target.x, target.y, 0.1); } - if (target!=0) and (action=="broadside") and (dist>o_dist){ - if (y>=target.y) then dist=point_distance(x,y,target.x+lengthdir_x(64,target.direction-180),target.y+lengthdir_y(128,target.direction-90))-(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))); - if (ytarget.y) and (dist>o_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2); - if (yo_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction+90),.2); - if (turn_bonus>1){ - if (yo_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction+90),.2); + if ((target != 0) && (action == "broadside") && (dist > o_dist)) { + if (y >= target.y) { + dist = point_distance(x, y, target.x + lengthdir_x(64, target.direction - 180), target.y + lengthdir_y(128, target.direction - 90)) - max(sprite_get_width(sprite_index), sprite_get_height(sprite_index)); + } + if (y < target.y) { + dist = point_distance(x, y, target.x + lengthdir_x(64, target.direction - 180), target.y + lengthdir_y(128, target.direction + 90)) - max(sprite_get_width(sprite_index), sprite_get_height(sprite_index)); + } + if ((y > target.y) && (dist > o_dist)) { + direction = turn_towards_point(direction, x + lengthdir_x(64, target.direction - 180), y, target.x, target.y + lengthdir_y(128, target.direction - 90), 0.2); + } + if ((y < target.y) && (dist > o_dist)) { + direction = turn_towards_point(direction, x + lengthdir_x(64, target.direction - 180), y, target.x, target.y + lengthdir_y(128, target.direction + 90), 0.2); + } + if (turn_bonus > 1) { + if ((y < target.y) && (dist > o_dist)) { + direction = turn_towards_point(direction, x + lengthdir_x(64, target.direction - 180), y, target.x, target.y + lengthdir_y(128, target.direction + 90), 0.2); + } } } /*if (target!=0) and (action="broadside") and (o_dist>=dist){ @@ -178,90 +211,124 @@ if (!__b__){ // direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) }*/ // Controls speed based on action - if (action="attack"){ - if (dist>o_dist) and (speed<((spid)/10)) then speed+=0.005; - if (dist0) then speed-=0.025; + if (action == "attack") { + if ((dist > o_dist) && (speed < (spid / 10))) { + speed += 0.005; + } + if ((dist < o_dist) && (speed > 0)) { + speed -= 0.025; + } } - if (action="broadside"){ - if (dist>o_dist) and (speed<((spid)/10)) then speed+=0.005; - if (dist0) then speed-=0.025; + if (action == "broadside") { + if ((dist > o_dist) && (speed < (spid / 10))) { + speed += 0.005; + } + if ((dist < o_dist) && (speed > 0)) { + speed -= 0.025; + } + } + if (speed < 0) { + speed = speed * 0.9; } - if (speed<0) then speed=speed*0.9; // Weapon reloads - if (cooldown[1]>0) then cooldown[1]-=1; - if (cooldown[2]>0) then cooldown[2]-=1; - if (cooldown[3]>0) then cooldown[3]-=1; - if (cooldown[4]>0) then cooldown[4]-=1; - if (cooldown[5]>0) then cooldown[5]-=1; - if (turret_cool>0) then turret_cool-=1; - - targe=0; - rdir=0; - dist=9999; - xx=x; - yy=y; + if (cooldown[1] > 0) { + cooldown[1] -= 1; + } + if (cooldown[2] > 0) { + cooldown[2] -= 1; + } + if (cooldown[3] > 0) { + cooldown[3] -= 1; + } + if (cooldown[4] > 0) { + cooldown[4] -= 1; + } + if (cooldown[5] > 0) { + cooldown[5] -= 1; + } + if (turret_cool > 0) { + turret_cool -= 1; + } + + targe = 0; + rdir = 0; + dist = 9999; + xx = x; + yy = y; // Turret targetting - if (turrets>0) and (instance_exists(obj_en_in)) and (turret_cool=0){ - targe=instance_nearest(x,y,obj_en_in); - if (instance_exists(targe)) then dist=point_distance(x,y,targe.x,targe.y); - if (dist>64) and (dist<300){ - bull=instance_create(x,y,obj_al_round); - bull.direction=point_direction(x,y,targe.x,targe.y); - if (owner == eFACTION.Tyranids) then bull.sprite_index=spr_glob; - bull.speed=20; - bull.dam=3; - bull.image_xscale=0.5; - bull.image_yscale=0.5; - turret_cool=floor(60/turrets); - bull.direction+=choose(random(10),1*-(random(10))); - } - } - targe=0; - dist=9999; - xx=lengthdir_x(64,direction+90); - yy=lengthdir_y(64,direction+90); - + if ((turrets > 0) && instance_exists(obj_en_in) && (turret_cool == 0)) { + targe = instance_nearest(x, y, obj_en_in); + if (instance_exists(targe)) { + dist = point_distance(x, y, targe.x, targe.y); + } + if ((dist > 64) && (dist < 300)) { + bull = instance_create(x, y, obj_al_round); + bull.direction = point_direction(x, y, targe.x, targe.y); + if (owner == eFACTION.Tyranids) { + bull.sprite_index = spr_glob; + } + bull.speed = 20; + bull.dam = 3; + bull.image_xscale = 0.5; + bull.image_yscale = 0.5; + turret_cool = floor(60 / turrets); + bull.direction += choose(random(10), 1 * -random(10)); + } + } + targe = 0; + dist = 9999; + xx = lengthdir_x(64, direction + 90); + yy = lengthdir_y(64, direction + 90); + // TODO we could implement facing with stronger shields or other stuff - front=0; - right=0; - left=0; - rear=0; - - targe=instance_nearest(xx,yy,obj_en_ship); - rdir=point_direction(x,y,target.x,target.y); + front = 0; + right = 0; + left = 0; + rear = 0; + + targe = instance_nearest(xx, yy, obj_en_ship); + rdir = point_direction(x, y, target.x, target.y); // if (rdir>45) and (rdir<=135) and (targe!=target){target_r=targe;right=1;} - // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} - target_l=instance_nearest(x+lengthdir_x(64,direction+90),y+lengthdir_y(64,direction+90),obj_en_ship); - target_r=instance_nearest(x+lengthdir_x(64,direction+270),y+lengthdir_y(64,direction+270),obj_en_ship); - - if (collision_line(x,y,x+lengthdir_x(2000,direction),y+lengthdir_y(2000,direction),obj_en_ship,0,1)) then front=1; - - f=0; - facing=""; - ammo=0; - range=0; - wep=""; - dam=0; - - for(var gg=1; gg<=weapons; gg++){ + // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} + target_l = instance_nearest(x + lengthdir_x(64, direction + 90), y + lengthdir_y(64, direction + 90), obj_en_ship); + target_r = instance_nearest(x + lengthdir_x(64, direction + 270), y + lengthdir_y(64, direction + 270), obj_en_ship); + + if (collision_line(x, y, x + lengthdir_x(2000, direction), y + lengthdir_y(2000, direction), obj_en_ship, 0, 1)) { + front = 1; + } + + f = 0; + facing = ""; + ammo = 0; + range = 0; + wep = ""; + dam = 0; + + for (var gg = 1; gg <= weapons; gg++) { // Resets - ok=0; - f+=1; - facing=""; - ammo=0; - range=0; - wep=""; - - if (cooldown[gg]<=0) and (weapon[gg]!="") and (weapon_ammo[gg]>0) then ok=1; - if (ok==1){ - facing=weapon_facing[gg]; - ammo=weapon_ammo[gg]; - range=weapon_range[gg]; - } - - targe=target; - if (facing=="front") and (front==1) then ok=2; - if (facing=="most") then ok=2; + ok = 0; + f += 1; + facing = ""; + ammo = 0; + range = 0; + wep = ""; + + if ((cooldown[gg] <= 0) && (weapon[gg] != "") && (weapon_ammo[gg] > 0)) { + ok = 1; + } + if (ok == 1) { + facing = weapon_facing[gg]; + ammo = weapon_ammo[gg]; + range = weapon_range[gg]; + } + + targe = target; + if ((facing == "front") && (front == 1)) { + ok = 2; + } + if (facing == "most") { + ok = 2; + } /* if (facing="right") then targe=target_r; if (facing="left") then targe=target_l; @@ -269,116 +336,136 @@ if (!__b__){ if (facing="right") or (facing="most") and (right=1) then ok=2; if (facing="left") or (facing="most") and (left=1) then ok=2; */ - if (facing=="special") then ok=2; - if (!instance_exists(targe)) then exit; - dist=point_distance(x,y,targe.x,targe.y); - if (facing=="right") and (point_direction(x,y,target_r.x,target_r.y)<337) and (point_direction(x,y,target_r.x,target_r.y)>203) then ok=2; - if (facing=="left") and (point_direction(x,y,target_r.x,target_r.y)>22) and (point_direction(x,y,target_r.x,target_r.y)<157) then ok=2; + if (facing == "special") { + ok = 2; + } + if (!instance_exists(targe)) { + exit; + } + dist = point_distance(x, y, targe.x, targe.y); + if ((facing == "right") && (point_direction(x, y, target_r.x, target_r.y) < 337) && (point_direction(x, y, target_r.x, target_r.y) > 203)) { + ok = 2; + } + if ((facing == "left") && (point_direction(x, y, target_r.x, target_r.y) > 22) && (point_direction(x, y, target_r.x, target_r.y) < 157)) { + ok = 2; + } /*var re_deh;re_deh=relative_direction(direction,target.direction); if (re_deh<45) or (re_deh>315) or ((re_deh>135) and (re_deh<225)) then direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) */ - if (ok==2) and (dist<(range+(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))))){ - if (ammo>0) and (ammo<900) then ammo-=1; - weapon_ammo[gg]=ammo; - cooldown[gg]=weapon_cooldown[gg]; - wep=weapon[gg]; - dam=weapon_dam[gg]; + if ((ok == 2) && (dist < (range + max(sprite_get_width(sprite_index), sprite_get_height(sprite_index))))) { + if ((ammo > 0) && (ammo < 900)) { + ammo -= 1; + } + weapon_ammo[gg] = ammo; + cooldown[gg] = weapon_cooldown[gg]; + wep = weapon[gg]; + dam = weapon_dam[gg]; // if (f=3) and (ship_id=2) then show_message("ammo: "+string(ammo)+" | range: "+string(range)); - if (ammo<0) then ok=0; - ok=3; + if (ammo < 0) { + ok = 0; + } + ok = 3; // Weapons fire - if (string_count("orpedo",wep)==0) and (string_count("Interceptor",wep)==0) and (string_count("ommerz",wep)==0) and (string_count("Claws",wep)==0) and (string_count("endrils",wep)==0) and (ok==3){ - bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_al_round); - bull.speed=20; - bull.dam=dam; - if (targe==target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); - if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} - if (string_count("ova",wep)==1){ - bull.image_xscale=2; - bull.image_yscale=2; - } - if (string_count("eavy Gunz",wep)==1){ - bull.image_xscale=1.5; - bull.image_yscale=1.5; - } - if (string_count("Lance",wep)==1){ - bull.sprite_index=spr_ground_las; - bull.image_xscale=1.5; - bull.image_yscale=1.5; - } - if (string_count("Ion",wep)==1){ - bull.sprite_index=spr_pulse; - bull.image_xscale=1.5; - bull.image_yscale=1.5; - } - if (string_count("Rail",wep)==1){ - bull.sprite_index=spr_railgun; - bull.image_xscale=1.5; - bull.image_yscale=1.5; - } - if (string_count("Gravitic",wep)==1){ - bull.image_xscale=2; - bull.image_yscale=2; - } - if (string_count("Plasma",wep)==1){ - bull.sprite_index=spr_ground_plasma; - bull.image_xscale=2; - bullimage_yscale=2; - bull.speed=15; - } - if (string_count("Pyro-Acid",wep)==1){ - bull.sprite_index=spr_glob; - bull.image_xscale=2; - bullimage_yscale=2; - } - if (string_count("Weapons",wep)==1) and (owner == eFACTION.Eldar){ - bull.sprite_index=spr_ground_las; - bull.image_xscale=2; - bull.image_yscale=2; - } - if (string_count("Pulse",wep)==1) and (owner == eFACTION.Eldar){ - bull.sprite_index=spr_pulse; - bull.image_xscale=1.5; - bull.image_yscale=1.5; + if ((string_count("orpedo", wep) == 0) && (string_count("Interceptor", wep) == 0) && (string_count("ommerz", wep) == 0) && (string_count("Claws", wep) == 0) && (string_count("endrils", wep) == 0) && (ok == 3)) { + bull = instance_create(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), obj_al_round); + bull.speed = 20; + bull.dam = dam; + if (targe == target) { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); + } + if (facing != "front") { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); + } + if (string_count("ova", wep) == 1) { + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if (string_count("eavy Gunz", wep) == 1) { + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Lance", wep) == 1) { + bull.sprite_index = spr_ground_las; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Ion", wep) == 1) { + bull.sprite_index = spr_pulse; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Rail", wep) == 1) { + bull.sprite_index = spr_railgun; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Gravitic", wep) == 1) { + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if (string_count("Plasma", wep) == 1) { + bull.sprite_index = spr_ground_plasma; + bull.image_xscale = 2; + bullimage_yscale = 2; + bull.speed = 15; + } + if (string_count("Pyro-Acid", wep) == 1) { + bull.sprite_index = spr_glob; + bull.image_xscale = 2; + bullimage_yscale = 2; + } + if ((string_count("Weapons", wep) == 1) && (owner == eFACTION.Eldar)) { + bull.sprite_index = spr_ground_las; + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if ((string_count("Pulse", wep) == 1) && (owner == eFACTION.Eldar)) { + bull.sprite_index = spr_pulse; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; } } // Torpedo weapons - if (string_count("orpedo",wep)==1) and (ok==3){ - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_al_round); - bull.speed=10; - bull.direction=direction; - bull.sprite_index=spr_torpedo; - bull.dam=dam; - } - bull=instance_create(x,y+lengthdir_y(-10,direction+90),obj_al_round); - bull.speed=10; - bull.direction=direction; - bull.sprite_index=spr_torpedo; - bull.dam=dam; - bull=instance_create(x,y+lengthdir_y(10,direction+90),obj_al_round); - bull.speed=10; - bull.direction=direction; - bull.sprite_index=spr_torpedo; - bull.dam=dam; - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(30,direction+90),obj_al_round); - bull.speed=10; - bull.direction=direction; - bull.sprite_index=spr_torpedo; - bull.dam=dam; + if ((string_count("orpedo", wep) == 1) && (ok == 3)) { + if (class != "Ravager") { + bull = instance_create(x, y + lengthdir_y(-30, direction + 90), obj_al_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + } + bull = instance_create(x, y + lengthdir_y(-10, direction + 90), obj_al_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + bull = instance_create(x, y + lengthdir_y(10, direction + 90), obj_al_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + if (class != "Ravager") { + bull = instance_create(x, y + lengthdir_y(30, direction + 90), obj_al_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; } } // Melee ship weapons (nids) - if ((string_count("Claws",wep)==1) or (string_count("endrils",wep)==1)) and (ok==3){ - if (target.shields<=0) then target.hp-=weapon_dam[wep]; - if (target.shields>0) then target.shields-=weapon_dam[wep]; + if (((string_count("Claws", wep) == 1) || (string_count("endrils", wep) == 1)) && (ok == 3)) { + if (target.shields <= 0) { + target.hp -= weapon_dam[wep]; + } + if (target.shields > 0) { + target.shields -= weapon_dam[wep]; + } } // Special weapons - if ((string_count("Interceptor",wep)==1) or (string_count("ommerz",wep)==1) or (string_count("Manta",wep)==1) or (string_count("Glands",wep)==1) or (string_count("Eldar Launch",wep)==1)) and (ok==3){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_al_in); - bull.direction=self.direction; - bull.owner=self.owner; + if (((string_count("Interceptor", wep) == 1) || (string_count("ommerz", wep) == 1) || (string_count("Manta", wep) == 1) || (string_count("Glands", wep) == 1) || (string_count("Eldar Launch", wep) == 1)) && (ok == 3)) { + bull = instance_create(x, y + lengthdir_y(-30, direction + 90), obj_al_in); + bull.direction = self.direction; + bull.owner = self.owner; } } } @@ -386,156 +473,201 @@ if (!__b__){ } // Checks if the enemy fleet is Eldar __b__ = action_if_variable(owner, 6, 0); -if (__b__){ - image_angle=direction; - - if (obj_fleet.start!=5) then exit; - - o_dist=0; - spid=0; - - if (shields>0) and (shields 0) && (shields < maxshields)) { + shields += 0.03; + } // Need to every couple of seconds check this // with obj_en_ship if not big then disable, check nearest, and activate once more - if (instance_exists(obj_en_ship)) then target=instance_nearest(x,y,obj_en_ship); - - if (hp<=0){ - gud=0; - for(var wh=1; wh<=5; wh++){if (obj_fleet.enemy[wh]==owner) then gud=wh;} - - if (class=="Void Stalker") then obj_fleet.en_capital_lost[gud]+=1; - if (class=="Shadow Class") then obj_fleet.en_frigate_lost[gud]+=1; - if (class=="Hellebore") or (class=="Aconite") then obj_fleet.en_escort_lost[gud]+=1; - - image_alpha=0.5; - - husk=instance_create(x,y,obj_en_husk); - husk.sprite_index=sprite_index; - husk.direction=direction; - husk.image_angle=image_angle; - husk.depth=depth; - husk.image_speed=0; - - for(var i=0; i0) and (instance_exists(obj_en_ship)){ - if (class=="Void Stalker"){ - o_dist=300; - action="swoop"; - spid=60; - } - if (class=="Shadow Class"){ - o_dist=200; - action="swoop"; - spid=80; - } - if (class=="Hellebore") or (class=="Aconite"){ - o_dist=200; - action="swoop"; - spid=100; - } - - dist=point_distance(x,y,target.x,target.y)-(max(sprite_get_width(target.sprite_index),sprite_get_height(sprite_index))); - - if (target!=0){ - if (speed<((spid)/10)) then speed+=0.02; - if (instance_exists(target)){ - dist=point_distance(x,y,target.x,target.y); - - if (action=="swoop"){direction=turn_towards_point(direction,x,y,target.x,target.y,5-ship_size);} - if (dist<=o_dist) and (collision_line(x,y,x+lengthdir_x(o_dist,direction),y+lengthdir_y(o_dist,direction),obj_en_ship,0,1)) then action="attack"; - if (dist<300) and (action=="attack") then action="bank"; - if (action=="bank") then direction=turn_towards_point(direction,x,y,room_width,room_height/2,5-ship_size); - if (action=="bank") and (dist>700) then action="attack"; + if ((hp > 0) && instance_exists(obj_en_ship)) { + if (class == "Void Stalker") { + o_dist = 300; + action = "swoop"; + spid = 60; + } + if (class == "Shadow Class") { + o_dist = 200; + action = "swoop"; + spid = 80; + } + if ((class == "Hellebore") || (class == "Aconite")) { + o_dist = 200; + action = "swoop"; + spid = 100; + } + + dist = point_distance(x, y, target.x, target.y) - max(sprite_get_width(target.sprite_index), sprite_get_height(sprite_index)); + + if (target != 0) { + if (speed < (spid / 10)) { + speed += 0.02; + } + if (instance_exists(target)) { + dist = point_distance(x, y, target.x, target.y); + + if (action == "swoop") { + direction = turn_towards_point(direction, x, y, target.x, target.y, 5 - ship_size); + } + if ((dist <= o_dist) && collision_line(x, y, x + lengthdir_x(o_dist, direction), y + lengthdir_y(o_dist, direction), obj_en_ship, 0, 1)) { + action = "attack"; + } + if ((dist < 300) && (action == "attack")) { + action = "bank"; + } + if (action == "bank") { + direction = turn_towards_point(direction, x, y, room_width, room_height / 2, 5 - ship_size); + } + if ((action == "bank") && (dist > 700)) { + action = "attack"; + } } } - - if (y<-2000) or (y>room_height+2000) or (x<-2000) or (x>room_width+2000) then hp=-50; + + if ((y < -2000) || (y > room_height + 2000) || (x < -2000) || (x > room_width + 2000)) { + hp = -50; + } // Weapon and turret cooldown for (var i = 1; i < array_length(cooldown); i++) { - if (cooldown[i]>0){ + if (cooldown[i] > 0) { cooldown[i]--; } } - if (turret_cool>0) then turret_cool-=1; - - targe=0; - dist=9999; - xx=x; - yy=y; - - if (turrets>0) and (instance_exists(obj_en_in)) and (turret_cool==0){ - targe=instance_nearest(x,y,obj_en_in); - if (instance_exists(targe)) then dist=point_distance(x,y,targe.x,targe.y); - - if (dist>64) and (dist<300){ - bull=instance_create(x,y,obj_al_round); - bull.direction=point_direction(x,y,targe.x,targe.y); - if (owner = eFACTION.Tyranids) then bull.sprite_index=spr_glob; - if (owner = eFACTION.Tau) or (owner = eFACTION.Eldar) then bull.sprite_index=spr_pulse; - bull.speed=20; - bull.dam=3; - bull.image_xscale=0.5; - bull.image_yscale=0.5; - turret_cool=floor(60/turrets); - bull.direction+=choose(random(10),1*-(random(10))); - } - } - targe=0; - rdir=0; - dist=9999; - - xx=lengthdir_x(64,direction+90); - yy=lengthdir_y(64,direction+90); - - front=0; - right=0; - left=0; - rear=0; - - targe=instance_nearest(xx,yy,obj_en_ship); - rdir=point_direction(x,y,target.x,target.y); + if (turret_cool > 0) { + turret_cool -= 1; + } + + targe = 0; + dist = 9999; + xx = x; + yy = y; + + if ((turrets > 0) && instance_exists(obj_en_in) && (turret_cool == 0)) { + targe = instance_nearest(x, y, obj_en_in); + if (instance_exists(targe)) { + dist = point_distance(x, y, targe.x, targe.y); + } + + if ((dist > 64) && (dist < 300)) { + bull = instance_create(x, y, obj_al_round); + bull.direction = point_direction(x, y, targe.x, targe.y); + if (owner == eFACTION.Tyranids) { + bull.sprite_index = spr_glob; + } + if ((owner == eFACTION.Tau) || (owner == eFACTION.Eldar)) { + bull.sprite_index = spr_pulse; + } + bull.speed = 20; + bull.dam = 3; + bull.image_xscale = 0.5; + bull.image_yscale = 0.5; + turret_cool = floor(60 / turrets); + bull.direction += choose(random(10), 1 * -random(10)); + } + } + targe = 0; + rdir = 0; + dist = 9999; + + xx = lengthdir_x(64, direction + 90); + yy = lengthdir_y(64, direction + 90); + + front = 0; + right = 0; + left = 0; + rear = 0; + + targe = instance_nearest(xx, yy, obj_en_ship); + rdir = point_direction(x, y, target.x, target.y); // if (rdir>45) and (rdir<=135) and (targe!=target){target_r=targe;right=1;} - // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} - target_l=instance_nearest(x+lengthdir_x(64,direction+90),y+lengthdir_y(64,direction+90),obj_en_ship); - target_r=instance_nearest(x+lengthdir_x(64,direction+270),y+lengthdir_y(64,direction+270),obj_en_ship); - - if (collision_line(x,y,x+lengthdir_x(2000,direction),y+lengthdir_y(2000,direction),obj_en_ship,0,1)) then front=1; - - - f=0; - facing=""; - ammo=0; - range=0; - wep=""; - dam=0; - gg=0; - - for(var gg=1; gg<=weapons; gg++){ - ok=0; - f+=1; - facing=""; - ammo=0; - range=0; - wep=""; - - if (cooldown[gg]<=0) and (weapon[gg]!="") and (weapon_ammo[gg]>0) then ok=1; - if (ok==1){ - facing=weapon_facing[gg]; - ammo=weapon_ammo[gg]; - range=weapon_range[gg]; - } - - targe=target; - if (facing=="front") and (front==1) then ok=2; - if (facing=="most") then ok=2; + // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} + target_l = instance_nearest(x + lengthdir_x(64, direction + 90), y + lengthdir_y(64, direction + 90), obj_en_ship); + target_r = instance_nearest(x + lengthdir_x(64, direction + 270), y + lengthdir_y(64, direction + 270), obj_en_ship); + + if (collision_line(x, y, x + lengthdir_x(2000, direction), y + lengthdir_y(2000, direction), obj_en_ship, 0, 1)) { + front = 1; + } + + f = 0; + facing = ""; + ammo = 0; + range = 0; + wep = ""; + dam = 0; + gg = 0; + + for (var gg = 1; gg <= weapons; gg++) { + ok = 0; + f += 1; + facing = ""; + ammo = 0; + range = 0; + wep = ""; + + if ((cooldown[gg] <= 0) && (weapon[gg] != "") && (weapon_ammo[gg] > 0)) { + ok = 1; + } + if (ok == 1) { + facing = weapon_facing[gg]; + ammo = weapon_ammo[gg]; + range = weapon_range[gg]; + } + + targe = target; + if ((facing == "front") && (front == 1)) { + ok = 2; + } + if (facing == "most") { + ok = 2; + } /* if (facing="right") then targe=target_r; if (facing="left") then targe=target_l; @@ -543,115 +675,135 @@ if (__b__){ if (facing="right") or (facing="most") and (right=1) then ok=2; if (facing="left") or (facing="most") and (left=1) then ok=2; */ - if (facing=="special") then ok=2; - if (!instance_exists(targe)) then exit; - dist=point_distance(x,y,targe.x,targe.y); - - if (facing=="right") and (point_direction(x,y,target_r.x,target_r.y)<337) and (point_direction(x,y,target_r.x,target_r.y)>203) then ok=2; - if (facing=="left") and (point_direction(x,y,target_r.x,target_r.y)>22) and (point_direction(x,y,target_r.x,target_r.y)<157) then ok=2; + if (facing == "special") { + ok = 2; + } + if (!instance_exists(targe)) { + exit; + } + dist = point_distance(x, y, targe.x, targe.y); + + if ((facing == "right") && (point_direction(x, y, target_r.x, target_r.y) < 337) && (point_direction(x, y, target_r.x, target_r.y) > 203)) { + ok = 2; + } + if ((facing == "left") && (point_direction(x, y, target_r.x, target_r.y) > 22) && (point_direction(x, y, target_r.x, target_r.y) < 157)) { + ok = 2; + } /* var re_deh;re_deh=relative_direction(direction,target.direction); if (re_deh<45) or (re_deh>315) or ((re_deh>135) and (re_deh<225)) then direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) */ - if (ok==2) and (dist<(range+(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))))){ - if (ammo>0) and (ammo<900) then ammo-=1; - weapon_ammo[gg]=ammo; - cooldown[gg]=weapon_cooldown[gg]; - wep=weapon[gg]; - dam=weapon_dam[gg]; + if ((ok == 2) && (dist < (range + max(sprite_get_width(sprite_index), sprite_get_height(sprite_index))))) { + if ((ammo > 0) && (ammo < 900)) { + ammo -= 1; + } + weapon_ammo[gg] = ammo; + cooldown[gg] = weapon_cooldown[gg]; + wep = weapon[gg]; + dam = weapon_dam[gg]; // if (f=3) and (ship_id=2) then show_message("ammo: "+string(ammo)+" | range: "+string(range)); - if (ammo<0) then ok=0; - ok=3; + if (ammo < 0) { + ok = 0; + } + ok = 3; // Weapon types - if (string_count("orpedo",wep)==0) and (string_count("Interceptor",wep)==0) and (string_count("ommerz",wep)==0) and (string_count("Claws",wep)==0) and (string_count("endrils",wep)==0) and (ok==3){ - bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_al_round); - bull.speed=20; - bull.dam=dam; - if (targe==target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); - if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} - if (string_count("ova",wep)==1){ - bull.image_xscale=2; - bull.image_yscale=2; - } - if (string_count("eavy Gunz",wep)==1){ - bull.image_xscale=1.5; - bull.image_yscale=1.5; - } - if (string_count("Lance",wep)==1){ - bull.sprite_index=spr_ground_las; - bull.image_xscale=1.5; - bull.image_yscale=1.5; - } - if (string_count("Ion",wep)==1){ - bull.sprite_index=spr_pulse; - bull.image_xscale=1.5; - bull.image_yscale=1.5; - } - if (string_count("Rail",wep)==1){ - bull.sprite_index=spr_railgun; - bull.image_xscale=1.5; - bull.image_yscale=1.5; - } - if (string_count("Gravitic",wep)==1){ - bull.image_xscale=2; - bull.image_yscale=2; - } - if (string_count("Plasma",wep)==1){ - bull.sprite_index=spr_ground_plasma; - bull.image_xscale=2; - bullimage_yscale=2; - bull.speed=15; - } - if (string_count("Pyro-Acid",wep)==1){ - bull.sprite_index=spr_glob; - bull.image_xscale=2; - bullimage_yscale=2; - } - if (string_count("Weapons",wep)==1) and (owner = eFACTION.Eldar){ - bull.sprite_index=spr_ground_las; - bull.image_xscale=2; - bull.image_yscale=2; - } - if (string_count("Pulse",wep)==1) and (owner = eFACTION.Eldar){ - bull.sprite_index=spr_pulse; - bull.image_xscale=1.5; - bull.image_yscale=1.5; + if ((string_count("orpedo", wep) == 0) && (string_count("Interceptor", wep) == 0) && (string_count("ommerz", wep) == 0) && (string_count("Claws", wep) == 0) && (string_count("endrils", wep) == 0) && (ok == 3)) { + bull = instance_create(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), obj_al_round); + bull.speed = 20; + bull.dam = dam; + if (targe == target) { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); + } + if (facing != "front") { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); + } + if (string_count("ova", wep) == 1) { + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if (string_count("eavy Gunz", wep) == 1) { + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Lance", wep) == 1) { + bull.sprite_index = spr_ground_las; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Ion", wep) == 1) { + bull.sprite_index = spr_pulse; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Rail", wep) == 1) { + bull.sprite_index = spr_railgun; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Gravitic", wep) == 1) { + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if (string_count("Plasma", wep) == 1) { + bull.sprite_index = spr_ground_plasma; + bull.image_xscale = 2; + bullimage_yscale = 2; + bull.speed = 15; + } + if (string_count("Pyro-Acid", wep) == 1) { + bull.sprite_index = spr_glob; + bull.image_xscale = 2; + bullimage_yscale = 2; + } + if ((string_count("Weapons", wep) == 1) && (owner == eFACTION.Eldar)) { + bull.sprite_index = spr_ground_las; + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if ((string_count("Pulse", wep) == 1) && (owner == eFACTION.Eldar)) { + bull.sprite_index = spr_pulse; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; } } - if (string_count("orpedo",wep)==1) and (ok==3){ - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_al_round); - bull.speed=10; - bull.direction=direction; - bull.sprite_index=spr_torpedo; - bull.dam=dam; - } - bull=instance_create(x,y+lengthdir_y(-10,direction+90),obj_al_round); - bull.speed=10; - bull.direction=direction; - bull.sprite_index=spr_torpedo; - bull.dam=dam; - bull=instance_create(x,y+lengthdir_y(10,direction+90),obj_al_round); - bull.speed=10; - bull.direction=direction; - bull.sprite_index=spr_torpedo; - bull.dam=dam; - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(30,direction+90),obj_al_round); - bull.speed=10; - bull.direction=direction; - bull.sprite_index=spr_torpedo; - bull.dam=dam; + if ((string_count("orpedo", wep) == 1) && (ok == 3)) { + if (class != "Ravager") { + bull = instance_create(x, y + lengthdir_y(-30, direction + 90), obj_al_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + } + bull = instance_create(x, y + lengthdir_y(-10, direction + 90), obj_al_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + bull = instance_create(x, y + lengthdir_y(10, direction + 90), obj_al_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + if (class != "Ravager") { + bull = instance_create(x, y + lengthdir_y(30, direction + 90), obj_al_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; } } - if ((string_count("Claws",wep)==1) or (string_count("endrils",wep)==1)) and (ok==3){ - if (target.shields<=0) then target.hp-=weapon_dam[wep]; - if (target.shields>0) then target.shields-=weapon_dam[wep]; + if (((string_count("Claws", wep) == 1) || (string_count("endrils", wep) == 1)) && (ok == 3)) { + if (target.shields <= 0) { + target.hp -= weapon_dam[wep]; + } + if (target.shields > 0) { + target.shields -= weapon_dam[wep]; + } } - if ((string_count("Interceptor",wep)==1) or (string_count("ommerz",wep)==1) or (string_count("Manta",wep)==1) or (string_count("Glands",wep)==1) or (string_count("Eldar Launch",wep)==1)) and (ok==3){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_al_in); - bull.direction=self.direction; - bull.owner=self.owner; + if (((string_count("Interceptor", wep) == 1) || (string_count("ommerz", wep) == 1) || (string_count("Manta", wep) == 1) || (string_count("Glands", wep) == 1) || (string_count("Eldar Launch", wep) == 1)) && (ok == 3)) { + bull = instance_create(x, y + lengthdir_y(-30, direction + 90), obj_al_in); + bull.direction = self.direction; + bull.owner = self.owner; } } } diff --git a/objects/obj_en_ship/Alarm_0.gml b/objects/obj_en_ship/Alarm_0.gml index 1ae6a92776..bef955ccf3 100644 --- a/objects/obj_en_ship/Alarm_0.gml +++ b/objects/obj_en_ship/Alarm_0.gml @@ -1,1297 +1,1250 @@ - - -cooldown[1]=0; - -cooldown[2]=0; - -cooldown[3]=0; - -cooldown[4]=0; - -cooldown[5]=0; - - - -if (class="Apocalypse Class Battleship"){ - sprite_index=spr_ship_apoc; - ship_size=3; - - name=""; - hp=1200; - maxhp=1200; - conditions=""; - shields=400; - maxshields=400; - leadership=90; - - armour_front=6; - armour_other=5; - weapons=4; - turrets=4; - capacity=150; - carrying=0; - - weapon[1]="Lance Battery"; - weapon_facing[1]="left"; - weapon_dam[1]=14; - weapon_range[1]=300; - weapon_cooldown[1]=30; - - weapon[2]="Lance Battery"; - weapon_facing[2]="right"; - weapon_dam[2]=14; - weapon_range[2]=300; - weapon_cooldown[2]=30; - - weapon[3]="Nova Cannon"; - weapon_facing[3]="front"; - weapon_dam[3]=34; - weapon_range[3]=1500; - weapon_minrange[3]=300; - weapon_cooldown[3]=120; - - weapon[4]="Weapons Battery"; - weapon_facing[4]="most"; - weapon_dam[4]=14; - weapon_range[4]=600; - weapon_cooldown[4]=20; - +cooldown[1] = 0; + +cooldown[2] = 0; + +cooldown[3] = 0; + +cooldown[4] = 0; + +cooldown[5] = 0; + +if (class == "Apocalypse Class Battleship") { + sprite_index = spr_ship_apoc; + ship_size = 3; + + name = ""; + hp = 1200; + maxhp = 1200; + conditions = ""; + shields = 400; + maxshields = 400; + leadership = 90; + + armour_front = 6; + armour_other = 5; + weapons = 4; + turrets = 4; + capacity = 150; + carrying = 0; + + weapon[1] = "Lance Battery"; + weapon_facing[1] = "left"; + weapon_dam[1] = 14; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; + + weapon[2] = "Lance Battery"; + weapon_facing[2] = "right"; + weapon_dam[2] = 14; + weapon_range[2] = 300; + weapon_cooldown[2] = 30; + + weapon[3] = "Nova Cannon"; + weapon_facing[3] = "front"; + weapon_dam[3] = 34; + weapon_range[3] = 1500; + weapon_minrange[3] = 300; + weapon_cooldown[3] = 120; + + weapon[4] = "Weapons Battery"; + weapon_facing[4] = "most"; + weapon_dam[4] = 14; + weapon_range[4] = 600; + weapon_cooldown[4] = 20; } -if (class="Nemesis Class Fleet Carrier"){ - sprite_index=spr_ship_nem; - ship_size=3; - - name=""; - hp=1000; - maxhp=1000; - conditions=""; - shields=400; - maxshields=400; - leadership=85; - - armour_front=5; - armour_other=5; - weapons=3; - turrets=5; - capacity=100; - carrying=24; - - weapon[1]="Interceptor Launch Bays"; - weapon_facing[1]="special"; - weapon_range[1]=9999; - weapon_ammo[1]=6; - weapon_cooldown[1]=120; - - weapon[2]="Interceptor Launch Bays"; - weapon_facing[2]="special"; - weapon_range[2]=9999; - weapon_ammo[2]=6; - weapon_cooldown[2]=120; - cooldown[2]=30; - - weapon[3]="Lance Battery"; - weapon_facing[3]="front"; - weapon_dam[3]=14; - weapon_range[3]=300; - weapon_cooldown[3]=30; - +if (class == "Nemesis Class Fleet Carrier") { + sprite_index = spr_ship_nem; + ship_size = 3; + + name = ""; + hp = 1000; + maxhp = 1000; + conditions = ""; + shields = 400; + maxshields = 400; + leadership = 85; + + armour_front = 5; + armour_other = 5; + weapons = 3; + turrets = 5; + capacity = 100; + carrying = 24; + + weapon[1] = "Interceptor Launch Bays"; + weapon_facing[1] = "special"; + weapon_range[1] = 9999; + weapon_ammo[1] = 6; + weapon_cooldown[1] = 120; + + weapon[2] = "Interceptor Launch Bays"; + weapon_facing[2] = "special"; + weapon_range[2] = 9999; + weapon_ammo[2] = 6; + weapon_cooldown[2] = 120; + cooldown[2] = 30; + + weapon[3] = "Lance Battery"; + weapon_facing[3] = "front"; + weapon_dam[3] = 14; + weapon_range[3] = 300; + weapon_cooldown[3] = 30; } -if (class="Avenger Class Grand Cruiser"){ - sprite_index=spr_ship_aven; - ship_size=2; - - name=""; - hp=1000; - maxhp=1000; - conditions=""; - shields=300; - maxshields=300; - leadership=85; - - armour_front=5; - armour_other=5; - weapons=2; - turrets=3; - capacity=50; - carrying=0; - - weapon[1]="Lance Battery"; - weapon_facing[1]="most"; - weapon_dam[1]=14; - weapon_range[1]=300; - weapon_cooldown[1]=25; - +if (class == "Avenger Class Grand Cruiser") { + sprite_index = spr_ship_aven; + ship_size = 2; + + name = ""; + hp = 1000; + maxhp = 1000; + conditions = ""; + shields = 300; + maxshields = 300; + leadership = 85; + + armour_front = 5; + armour_other = 5; + weapons = 2; + turrets = 3; + capacity = 50; + carrying = 0; + + weapon[1] = "Lance Battery"; + weapon_facing[1] = "most"; + weapon_dam[1] = 14; + weapon_range[1] = 300; + weapon_cooldown[1] = 25; + // weapon[1]="Lance Battery"; - weapon_facing[1]="left"; - weapon_dam[1]=14; - weapon_range[1]=300; - weapon_cooldown[1]=25; - + weapon_facing[1] = "left"; + weapon_dam[1] = 14; + weapon_range[1] = 300; + weapon_cooldown[1] = 25; + // weapon[2]="Lance Battery"; - weapon_facing[2]="right"; - weapon_dam[2]=14; - weapon_range[2]=300; - weapon_cooldown[2]=25; - + weapon_facing[2] = "right"; + weapon_dam[2] = 14; + weapon_range[2] = 300; + weapon_cooldown[2] = 25; } -if (class="Sword Class Frigate"){ - sprite_index=spr_ship_sword; - ship_size=1; - - name=""; - hp=100; - maxhp=100; - conditions=""; - shields=100; - maxshields=100; - leadership=80; - - armour_front=5; - armour_other=5; - weapons=1; - turrets=2; - capacity=50; - carrying=0; - - weapon[1]="Weapons Battery"; - weapon_facing[1]="most"; - weapon_dam[1]=8; - weapon_range[1]=300; - weapon_cooldown[1]=20; - +if (class == "Sword Class Frigate") { + sprite_index = spr_ship_sword; + ship_size = 1; + + name = ""; + hp = 100; + maxhp = 100; + conditions = ""; + shields = 100; + maxshields = 100; + leadership = 80; + + armour_front = 5; + armour_other = 5; + weapons = 1; + turrets = 2; + capacity = 50; + carrying = 0; + + weapon[1] = "Weapons Battery"; + weapon_facing[1] = "most"; + weapon_dam[1] = 8; + weapon_range[1] = 300; + weapon_cooldown[1] = 20; } - - // Eldar -if (class="Void Stalker"){ - sprite_index=spr_ship_void; - ship_size=3; - - name=""; - hp=1000; - maxhp=1000; - conditions=""; - shields=300; - maxshields=300; - leadership=100; - - armour_front=5; - armour_other=4; - weapons=3; - turrets=4; - capacity=150; - carrying=0; - - weapon[1]="Eldar Launch Bay"; - weapon_facing[1]="special"; - weapon_dam[1]=0; - weapon_range[1]=9999; - weapon_cooldown[1]=90; - weapon_ammo[1]=4; - - weapon[2]="Weapons Battery"; - weapon_facing[2]="most"; - weapon_dam[2]=14; - weapon_range[2]=600; - weapon_cooldown[2]=30; - - weapon[3]="Pulsar Lances"; - weapon_facing[3]="most"; - weapon_dam[3]=10; - weapon_range[3]=600; - weapon_cooldown[3]=10; - +if (class == "Void Stalker") { + sprite_index = spr_ship_void; + ship_size = 3; + + name = ""; + hp = 1000; + maxhp = 1000; + conditions = ""; + shields = 300; + maxshields = 300; + leadership = 100; + + armour_front = 5; + armour_other = 4; + weapons = 3; + turrets = 4; + capacity = 150; + carrying = 0; + + weapon[1] = "Eldar Launch Bay"; + weapon_facing[1] = "special"; + weapon_dam[1] = 0; + weapon_range[1] = 9999; + weapon_cooldown[1] = 90; + weapon_ammo[1] = 4; + + weapon[2] = "Weapons Battery"; + weapon_facing[2] = "most"; + weapon_dam[2] = 14; + weapon_range[2] = 600; + weapon_cooldown[2] = 30; + + weapon[3] = "Pulsar Lances"; + weapon_facing[3] = "most"; + weapon_dam[3] = 10; + weapon_range[3] = 600; + weapon_cooldown[3] = 10; + // weapon[4]="Torpedoes"; - weapon_facing[4]="front"; - weapon_dam[4]=12; - weapon_range[4]=450; - weapon_cooldown[4]=90; - + weapon_facing[4] = "front"; + weapon_dam[4] = 12; + weapon_range[4] = 450; + weapon_cooldown[4] = 90; } -if (class="Shadow Class"){ - sprite_index=spr_ship_shadow; - ship_size=3; - - name=""; - hp=600; - maxhp=600; - conditions=""; - shields=200; - maxshields=200; - leadership=90; - - armour_front=5; - armour_other=4; - weapons=2; - turrets=3; - capacity=100; - carrying=0; - - weapon[1]="Torpedoes"; - weapon_facing[1]="front"; - weapon_dam[1]=12; - weapon_range[1]=450; - weapon_cooldown[1]=90; - - weapon[2]="Weapons Battery"; - weapon_facing[2]="front"; - weapon_dam[2]=10; - weapon_range[2]=450; - weapon_cooldown[2]=30; - +if (class == "Shadow Class") { + sprite_index = spr_ship_shadow; + ship_size = 3; + + name = ""; + hp = 600; + maxhp = 600; + conditions = ""; + shields = 200; + maxshields = 200; + leadership = 90; + + armour_front = 5; + armour_other = 4; + weapons = 2; + turrets = 3; + capacity = 100; + carrying = 0; + + weapon[1] = "Torpedoes"; + weapon_facing[1] = "front"; + weapon_dam[1] = 12; + weapon_range[1] = 450; + weapon_cooldown[1] = 90; + + weapon[2] = "Weapons Battery"; + weapon_facing[2] = "front"; + weapon_dam[2] = 10; + weapon_range[2] = 450; + weapon_cooldown[2] = 30; } -if (class="Hellebore"){ - sprite_index=spr_ship_hellebore; - ship_size=1; - - name=""; - hp=200; - maxhp=200; - conditions=""; - shields=200; - maxshields=200; - leadership=90; - - armour_front=5; - armour_other=4; - weapons=3; - turrets=2; - capacity=50; - carrying=0; - - weapon[1]="Pulsar Lances"; - weapon_facing[1]="front"; - weapon_dam[1]=10; - weapon_range[1]=450; - weapon_cooldown[1]=20; - - weapon[2]="Weapons Battery"; - weapon_facing[2]="front"; - weapon_dam[2]=8; - weapon_range[2]=450; - weapon_cooldown[2]=30; - - weapon[3]="Eldar Launch Bay"; - weapon_facing[3]="special"; - weapon_dam[3]=0; - weapon_range[3]=9999; - weapon_cooldown[3]=90; - weapon_ammo[1]=1; - +if (class == "Hellebore") { + sprite_index = spr_ship_hellebore; + ship_size = 1; + + name = ""; + hp = 200; + maxhp = 200; + conditions = ""; + shields = 200; + maxshields = 200; + leadership = 90; + + armour_front = 5; + armour_other = 4; + weapons = 3; + turrets = 2; + capacity = 50; + carrying = 0; + + weapon[1] = "Pulsar Lances"; + weapon_facing[1] = "front"; + weapon_dam[1] = 10; + weapon_range[1] = 450; + weapon_cooldown[1] = 20; + + weapon[2] = "Weapons Battery"; + weapon_facing[2] = "front"; + weapon_dam[2] = 8; + weapon_range[2] = 450; + weapon_cooldown[2] = 30; + + weapon[3] = "Eldar Launch Bay"; + weapon_facing[3] = "special"; + weapon_dam[3] = 0; + weapon_range[3] = 9999; + weapon_cooldown[3] = 90; + weapon_ammo[1] = 1; } -if (class="Aconite"){ - sprite_index=spr_ship_aconite; - ship_size=1; - - name=""; - hp=200; - maxhp=200; - conditions=""; - shields=200; - maxshields=200; - leadership=90; - - armour_front=5; - armour_other=4; - weapons=3; - turrets=2; - capacity=50; - carrying=0; - - weapon[1]="Weapons Battery"; - weapon_facing[1]="front"; - weapon_dam[1]=8; - weapon_range[1]=450; - weapon_cooldown[1]=30; - +if (class == "Aconite") { + sprite_index = spr_ship_aconite; + ship_size = 1; + + name = ""; + hp = 200; + maxhp = 200; + conditions = ""; + shields = 200; + maxshields = 200; + leadership = 90; + + armour_front = 5; + armour_other = 4; + weapons = 3; + turrets = 2; + capacity = 50; + carrying = 0; + + weapon[1] = "Weapons Battery"; + weapon_facing[1] = "front"; + weapon_dam[1] = 8; + weapon_range[1] = 450; + weapon_cooldown[1] = 30; } - - - // Orks -if (class="Dethdeala"){ - sprite_index=spr_ship_deth; - ship_size=3; - - name=""; - hp=1200; - maxhp=1200; - conditions=""; - shields=200; - maxshields=200; - leadership=100; - - armour_front=6; - armour_other=5; - weapons=5; - turrets=3; - capacity=250; - carrying=0; - - weapon[1]="Gunz Battery"; - weapon_facing[1]="left"; - weapon_dam[1]=8; - weapon_range[1]=300; - weapon_cooldown[1]=30; - - weapon[2]="Gunz Battery"; - weapon_facing[2]="right"; - weapon_dam[2]=8; - weapon_range[2]=300; - weapon_cooldown[2]=30; - - weapon[3]="Bombardment Cannon"; - weapon_facing[3]="front"; - weapon_dam[3]=12; - weapon_range[3]=450; - weapon_cooldown[3]=120; - - weapon[4]="Heavy Gunz"; - weapon_facing[4]="most"; - weapon_dam[4]=12; - weapon_range[4]=200; - weapon_cooldown[4]=40; - - weapon[5]="Fighta Bommerz"; - weapon_facing[5]="special"; - weapon_dam[5]=0; - weapon_range[5]=9999; - weapon_cooldown[5]=90; - +if (class == "Dethdeala") { + sprite_index = spr_ship_deth; + ship_size = 3; + + name = ""; + hp = 1200; + maxhp = 1200; + conditions = ""; + shields = 200; + maxshields = 200; + leadership = 100; + + armour_front = 6; + armour_other = 5; + weapons = 5; + turrets = 3; + capacity = 250; + carrying = 0; + + weapon[1] = "Gunz Battery"; + weapon_facing[1] = "left"; + weapon_dam[1] = 8; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; + + weapon[2] = "Gunz Battery"; + weapon_facing[2] = "right"; + weapon_dam[2] = 8; + weapon_range[2] = 300; + weapon_cooldown[2] = 30; + + weapon[3] = "Bombardment Cannon"; + weapon_facing[3] = "front"; + weapon_dam[3] = 12; + weapon_range[3] = 450; + weapon_cooldown[3] = 120; + + weapon[4] = "Heavy Gunz"; + weapon_facing[4] = "most"; + weapon_dam[4] = 12; + weapon_range[4] = 200; + weapon_cooldown[4] = 40; + + weapon[5] = "Fighta Bommerz"; + weapon_facing[5] = "special"; + weapon_dam[5] = 0; + weapon_range[5] = 9999; + weapon_cooldown[5] = 90; } -if (class="Gorbag's Revenge"){ - sprite_index=spr_ship_gorbag; - ship_size=3; - - name=""; - hp=1200; - maxhp=1200; - conditions=""; - shields=200; - maxshields=200; - leadership=100; - - armour_front=6; - armour_other=5; - weapons=5; - turrets=3; - capacity=250; - carrying=0; - - weapon[1]="Gunz Battery"; - weapon_facing[1]="front"; - weapon_dam[1]=8; - weapon_range[1]=450; - weapon_cooldown[1]=30; - - weapon[2]="Torpedoes"; - weapon_facing[2]="front"; - weapon_dam[2]=12; - weapon_range[2]=300; - weapon_cooldown[2]=120; - - weapon[3]="Heavy Gunz"; - weapon_facing[3]="most"; - weapon_dam[3]=12; - weapon_range[3]=200; - weapon_cooldown[3]=40; - - weapon[4]="Fighta Bommerz"; - weapon_facing[4]="special"; - weapon_dam[4]=0; - weapon_ammo[4]=3; - weapon_range[4]=9999; - weapon_cooldown[4]=90; - - weapon[5]="Fighta Bommerz"; - weapon_facing[5]="special"; - weapon_dam[5]=0; - weapon_ammo[5]=3; - weapon_range[5]=9999; - weapon_cooldown[5]=90; - cooldown[5]=30; - +if (class == "Gorbag's Revenge") { + sprite_index = spr_ship_gorbag; + ship_size = 3; + + name = ""; + hp = 1200; + maxhp = 1200; + conditions = ""; + shields = 200; + maxshields = 200; + leadership = 100; + + armour_front = 6; + armour_other = 5; + weapons = 5; + turrets = 3; + capacity = 250; + carrying = 0; + + weapon[1] = "Gunz Battery"; + weapon_facing[1] = "front"; + weapon_dam[1] = 8; + weapon_range[1] = 450; + weapon_cooldown[1] = 30; + + weapon[2] = "Torpedoes"; + weapon_facing[2] = "front"; + weapon_dam[2] = 12; + weapon_range[2] = 300; + weapon_cooldown[2] = 120; + + weapon[3] = "Heavy Gunz"; + weapon_facing[3] = "most"; + weapon_dam[3] = 12; + weapon_range[3] = 200; + weapon_cooldown[3] = 40; + + weapon[4] = "Fighta Bommerz"; + weapon_facing[4] = "special"; + weapon_dam[4] = 0; + weapon_ammo[4] = 3; + weapon_range[4] = 9999; + weapon_cooldown[4] = 90; + + weapon[5] = "Fighta Bommerz"; + weapon_facing[5] = "special"; + weapon_dam[5] = 0; + weapon_ammo[5] = 3; + weapon_range[5] = 9999; + weapon_cooldown[5] = 90; + cooldown[5] = 30; } -if (class="Kroolboy") or (class="Slamblasta"){ - ship_size=3; - sprite_index=spr_ship_krool; - - if (class="Kroolboy") then sprite_index=spr_ship_krool; - - if (class="Slamblasta") then sprite_index=spr_ship_slam; - - name=""; - hp=1200; - maxhp=1200; - conditions=""; - shields=200; - maxshields=200; - leadership=100; - - armour_front=6; - armour_other=5; - weapons=3; - turrets=3; - capacity=250; - carrying=0; - - weapon[1]="Fighta Bommerz"; - weapon_facing[1]="special"; - weapon_dam[1]=0; - weapon_ammo[1]=3; - weapon_range[1]=9999; - weapon_cooldown[1]=120; - - weapon[2]="Gunz Battery"; - weapon_facing[2]="most"; - weapon_dam[2]=8; - weapon_range[2]=300; - weapon_cooldown[2]=30; - - weapon[3]="Heavy Gunz"; - weapon_facing[3]="most"; - weapon_dam[3]=12; - weapon_range[3]=200; - weapon_cooldown[3]=40; - +if ((class == "Kroolboy") || (class == "Slamblasta")) { + ship_size = 3; + sprite_index = spr_ship_krool; + + if (class == "Kroolboy") { + sprite_index = spr_ship_krool; + } + + if (class == "Slamblasta") { + sprite_index = spr_ship_slam; + } + + name = ""; + hp = 1200; + maxhp = 1200; + conditions = ""; + shields = 200; + maxshields = 200; + leadership = 100; + + armour_front = 6; + armour_other = 5; + weapons = 3; + turrets = 3; + capacity = 250; + carrying = 0; + + weapon[1] = "Fighta Bommerz"; + weapon_facing[1] = "special"; + weapon_dam[1] = 0; + weapon_ammo[1] = 3; + weapon_range[1] = 9999; + weapon_cooldown[1] = 120; + + weapon[2] = "Gunz Battery"; + weapon_facing[2] = "most"; + weapon_dam[2] = 8; + weapon_range[2] = 300; + weapon_cooldown[2] = 30; + + weapon[3] = "Heavy Gunz"; + weapon_facing[3] = "most"; + weapon_dam[3] = 12; + weapon_range[3] = 200; + weapon_cooldown[3] = 40; } -if (class="Battlekroozer"){ - sprite_index=spr_ship_kroozer; - ship_size=3; - - name=""; - hp=1000; - maxhp=1000; - conditions=""; - shields=200; - maxshields=200; - leadership=100; - - armour_front=6; - armour_other=5; - weapons=5; - turrets=3; - capacity=250; - carrying=0; - - weapon[1]="Gunz Battery"; - weapon_facing[1]="most"; - weapon_dam[1]=8; - weapon_range[1]=450; - weapon_cooldown[1]=30; - - weapon[2]="Heavy Gunz"; - weapon_facing[2]="left"; - weapon_dam[2]=12; - weapon_range[2]=200; - weapon_cooldown[2]=40; - - weapon[3]="Heavy Gunz"; - weapon_facing[3]="right"; - weapon_dam[3]=12; - weapon_range[3]=200; - weapon_cooldown[3]=40; - - weapon[4]="Fighta Bommerz"; - weapon_facing[4]="special"; - weapon_dam[4]=0; - weapon_ammo[4]=3; - weapon_range[4]=9999; - weapon_cooldown[4]=90; - - weapon[5]="Fighta Bommerz"; - weapon_facing[5]="special"; - weapon_dam[5]=0; - weapon_ammo[5]=3; - weapon_range[5]=9999; - weapon_cooldown[5]=90; - cooldown[5]=30; - +if (class == "Battlekroozer") { + sprite_index = spr_ship_kroozer; + ship_size = 3; + + name = ""; + hp = 1000; + maxhp = 1000; + conditions = ""; + shields = 200; + maxshields = 200; + leadership = 100; + + armour_front = 6; + armour_other = 5; + weapons = 5; + turrets = 3; + capacity = 250; + carrying = 0; + + weapon[1] = "Gunz Battery"; + weapon_facing[1] = "most"; + weapon_dam[1] = 8; + weapon_range[1] = 450; + weapon_cooldown[1] = 30; + + weapon[2] = "Heavy Gunz"; + weapon_facing[2] = "left"; + weapon_dam[2] = 12; + weapon_range[2] = 200; + weapon_cooldown[2] = 40; + + weapon[3] = "Heavy Gunz"; + weapon_facing[3] = "right"; + weapon_dam[3] = 12; + weapon_range[3] = 200; + weapon_cooldown[3] = 40; + + weapon[4] = "Fighta Bommerz"; + weapon_facing[4] = "special"; + weapon_dam[4] = 0; + weapon_ammo[4] = 3; + weapon_range[4] = 9999; + weapon_cooldown[4] = 90; + + weapon[5] = "Fighta Bommerz"; + weapon_facing[5] = "special"; + weapon_dam[5] = 0; + weapon_ammo[5] = 3; + weapon_range[5] = 9999; + weapon_cooldown[5] = 90; + cooldown[5] = 30; } -if (class="Ravager"){ - sprite_index=spr_ship_ravager; - ship_size=1; - - name=""; - hp=100; - maxhp=100; - conditions=""; - shields=100; - maxshields=100; - leadership=80; - - armour_front=6; - armour_other=4; - weapons=2; - turrets=2; - capacity=50; - carrying=0; - - weapon[1]="Gunz Battery"; - weapon_facing[1]="front"; - weapon_dam[1]=8; - weapon_range[1]=300; - weapon_cooldown[1]=30; - - weapon[2]="Torpedoes"; - weapon_facing[2]="front"; - weapon_dam[2]=12; - weapon_range[2]=300; - weapon_cooldown[2]=120; - +if (class == "Ravager") { + sprite_index = spr_ship_ravager; + ship_size = 1; + + name = ""; + hp = 100; + maxhp = 100; + conditions = ""; + shields = 100; + maxshields = 100; + leadership = 80; + + armour_front = 6; + armour_other = 4; + weapons = 2; + turrets = 2; + capacity = 50; + carrying = 0; + + weapon[1] = "Gunz Battery"; + weapon_facing[1] = "front"; + weapon_dam[1] = 8; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; + + weapon[2] = "Torpedoes"; + weapon_facing[2] = "front"; + weapon_dam[2] = 12; + weapon_range[2] = 300; + weapon_cooldown[2] = 120; } // Tau -if (class="Custodian"){ - sprite_index=spr_ship_custodian; - ship_size=3; - - name=""; - hp=1000; - maxhp=1000; - conditions=""; - shields=200; - maxshields=200; - leadership=100; - - armour_front=6; - armour_other=5; - weapons=4; - turrets=5; - capacity=1000; - carrying=0; - - weapon[1]="Gravitic launcher"; - weapon_facing[1]="front"; - weapon_dam[1]=12; - weapon_range[1]=400; - weapon_minrange[1]=200; - weapon_cooldown[1]=30; - - weapon[2]="Railgun Battery"; - weapon_facing[2]="most"; - weapon_dam[2]=12; - weapon_range[2]=450; - weapon_cooldown[2]=30; - - weapon[3]="Ion Cannons"; - weapon_facing[3]="most"; - weapon_dam[3]=8; - weapon_range[3]=300; - weapon_cooldown[3]=15; - - weapon[4]="Manta Launch Bay"; - weapon_facing[4]="special"; - weapon_dam[4]=0; - weapon_range[4]=9999; - weapon_cooldown[4]=90; - weapon_ammo[4]=4; - +if (class == "Custodian") { + sprite_index = spr_ship_custodian; + ship_size = 3; + + name = ""; + hp = 1000; + maxhp = 1000; + conditions = ""; + shields = 200; + maxshields = 200; + leadership = 100; + + armour_front = 6; + armour_other = 5; + weapons = 4; + turrets = 5; + capacity = 1000; + carrying = 0; + + weapon[1] = "Gravitic launcher"; + weapon_facing[1] = "front"; + weapon_dam[1] = 12; + weapon_range[1] = 400; + weapon_minrange[1] = 200; + weapon_cooldown[1] = 30; + + weapon[2] = "Railgun Battery"; + weapon_facing[2] = "most"; + weapon_dam[2] = 12; + weapon_range[2] = 450; + weapon_cooldown[2] = 30; + + weapon[3] = "Ion Cannons"; + weapon_facing[3] = "most"; + weapon_dam[3] = 8; + weapon_range[3] = 300; + weapon_cooldown[3] = 15; + + weapon[4] = "Manta Launch Bay"; + weapon_facing[4] = "special"; + weapon_dam[4] = 0; + weapon_range[4] = 9999; + weapon_cooldown[4] = 90; + weapon_ammo[4] = 4; } -if (class="Protector"){ - sprite_index=spr_ship_protector; - ship_size=2; - - name=""; - hp=600; - maxhp=600; - conditions=""; - shields=200; - maxshields=200; - leadership=90; - - armour_front=6; - armour_other=5; - weapons=4; - turrets=3; - capacity=250; - carrying=0; - - weapon[1]="Gravitic launcher"; - weapon_facing[1]="front"; - weapon_dam[1]=12; - weapon_range[1]=400; - weapon_minrange[1]=200; - weapon_cooldown[1]=30; - - weapon[2]="Railgun Battery"; - weapon_facing[2]="most"; - weapon_dam[2]=10; - weapon_range[2]=450; - weapon_cooldown[2]=30; - - weapon[3]="Ion Cannons"; - weapon_facing[3]="most"; - weapon_dam[3]=8; - weapon_range[3]=300; - weapon_cooldown[3]=15; - - weapon[4]="Manta Launch Bay"; - weapon_facing[4]="special"; - weapon_dam[4]=0; - weapon_range[4]=9999; - weapon_cooldown[4]=90; - weapon_ammo[4]=2; - +if (class == "Protector") { + sprite_index = spr_ship_protector; + ship_size = 2; + + name = ""; + hp = 600; + maxhp = 600; + conditions = ""; + shields = 200; + maxshields = 200; + leadership = 90; + + armour_front = 6; + armour_other = 5; + weapons = 4; + turrets = 3; + capacity = 250; + carrying = 0; + + weapon[1] = "Gravitic launcher"; + weapon_facing[1] = "front"; + weapon_dam[1] = 12; + weapon_range[1] = 400; + weapon_minrange[1] = 200; + weapon_cooldown[1] = 30; + + weapon[2] = "Railgun Battery"; + weapon_facing[2] = "most"; + weapon_dam[2] = 10; + weapon_range[2] = 450; + weapon_cooldown[2] = 30; + + weapon[3] = "Ion Cannons"; + weapon_facing[3] = "most"; + weapon_dam[3] = 8; + weapon_range[3] = 300; + weapon_cooldown[3] = 15; + + weapon[4] = "Manta Launch Bay"; + weapon_facing[4] = "special"; + weapon_dam[4] = 0; + weapon_range[4] = 9999; + weapon_cooldown[4] = 90; + weapon_ammo[4] = 2; } -if (class="Emissary"){ - sprite_index=spr_ship_emissary; - ship_size=2; - - name=""; - hp=400; - maxhp=400; - conditions=""; - shields=100; - maxshields=100; - leadership=100; - - armour_front=6; - armour_other=5; - weapons=4; - turrets=2; - capacity=100; - carrying=0; - - weapon[1]="Gravitic launcher"; - weapon_facing[1]="front"; - weapon_dam[1]=12; - weapon_range[1]=400; - weapon_minrange[1]=200; - weapon_cooldown[1]=30; - - weapon[2]="Railgun Battery"; - weapon_facing[2]="most"; - weapon_dam[2]=10; - weapon_range[2]=450; - weapon_cooldown[2]=30; - - weapon[3]="Ion Cannons"; - weapon_facing[3]="most"; - weapon_dam[3]=8; - weapon_range[3]=300; - weapon_cooldown[3]=15; - - weapon[4]="Manta Launch Bay"; - weapon_facing[4]="special"; - weapon_dam[4]=0; - weapon_range[4]=9999; - weapon_cooldown[4]=90; - weapon_ammo[4]=1; - +if (class == "Emissary") { + sprite_index = spr_ship_emissary; + ship_size = 2; + + name = ""; + hp = 400; + maxhp = 400; + conditions = ""; + shields = 100; + maxshields = 100; + leadership = 100; + + armour_front = 6; + armour_other = 5; + weapons = 4; + turrets = 2; + capacity = 100; + carrying = 0; + + weapon[1] = "Gravitic launcher"; + weapon_facing[1] = "front"; + weapon_dam[1] = 12; + weapon_range[1] = 400; + weapon_minrange[1] = 200; + weapon_cooldown[1] = 30; + + weapon[2] = "Railgun Battery"; + weapon_facing[2] = "most"; + weapon_dam[2] = 10; + weapon_range[2] = 450; + weapon_cooldown[2] = 30; + + weapon[3] = "Ion Cannons"; + weapon_facing[3] = "most"; + weapon_dam[3] = 8; + weapon_range[3] = 300; + weapon_cooldown[3] = 15; + + weapon[4] = "Manta Launch Bay"; + weapon_facing[4] = "special"; + weapon_dam[4] = 0; + weapon_range[4] = 9999; + weapon_cooldown[4] = 90; + weapon_ammo[4] = 1; } -if (class="Warden"){ - sprite_index=spr_ship_warden; - ship_size=1; - - name=""; - hp=100; - maxhp=100; - conditions=""; - shields=100; - maxshields=100; - leadership=80; - - armour_front=5; - armour_other=4; - weapons=2; - turrets=1; - capacity=50; - carrying=0; - - weapon[1]="Ion Cannon"; - weapon_facing[1]="most"; - weapon_dam[1]=8; - weapon_range[1]=300; - weapon_cooldown[1]=50; - - weapon[2]="Railgun Battery"; - weapon_facing[2]="front"; - weapon_dam[2]=10; - weapon_range[2]=300; - weapon_cooldown[2]=60; - +if (class == "Warden") { + sprite_index = spr_ship_warden; + ship_size = 1; + + name = ""; + hp = 100; + maxhp = 100; + conditions = ""; + shields = 100; + maxshields = 100; + leadership = 80; + + armour_front = 5; + armour_other = 4; + weapons = 2; + turrets = 1; + capacity = 50; + carrying = 0; + + weapon[1] = "Ion Cannon"; + weapon_facing[1] = "most"; + weapon_dam[1] = 8; + weapon_range[1] = 300; + weapon_cooldown[1] = 50; + + weapon[2] = "Railgun Battery"; + weapon_facing[2] = "front"; + weapon_dam[2] = 10; + weapon_range[2] = 300; + weapon_cooldown[2] = 60; } -if (class="Castellan"){ - sprite_index=spr_ship_castellan; - ship_size=1; - - name=""; - hp=100; - maxhp=100; - conditions=""; - shields=100; - maxshields=100; - leadership=80; - - armour_front=5; - armour_other=4; - weapons=2; - turrets=2; - capacity=50; - carrying=0; - - weapon[1]="Gravitic launcher"; - weapon_facing[1]="front"; - weapon_dam[1]=12; - weapon_range[1]=400; - weapon_minrange[1]=200; - weapon_cooldown[1]=40; - - weapon[2]="Railgun Battery"; - weapon_facing[2]="front"; - weapon_dam[2]=10; - weapon_range[2]=300; - weapon_cooldown[2]=40; - +if (class == "Castellan") { + sprite_index = spr_ship_castellan; + ship_size = 1; + + name = ""; + hp = 100; + maxhp = 100; + conditions = ""; + shields = 100; + maxshields = 100; + leadership = 80; + + armour_front = 5; + armour_other = 4; + weapons = 2; + turrets = 2; + capacity = 50; + carrying = 0; + + weapon[1] = "Gravitic launcher"; + weapon_facing[1] = "front"; + weapon_dam[1] = 12; + weapon_range[1] = 400; + weapon_minrange[1] = 200; + weapon_cooldown[1] = 40; + + weapon[2] = "Railgun Battery"; + weapon_facing[2] = "front"; + weapon_dam[2] = 10; + weapon_range[2] = 300; + weapon_cooldown[2] = 40; } // Chaos -if (class="Desecrator"){ - sprite_index=spr_ship_dese; - ship_size=3; - - name=""; - hp=1200; - maxhp=1200; - conditions=""; - shields=400; - maxshields=400; - leadership=90; - - armour_front=7; - armour_other=5; - weapons=5; - turrets=4; - capacity=150; - carrying=0; - - weapon[1]="Lance Battery"; - weapon_facing[1]="left"; - weapon_dam[1]=12; - weapon_range[1]=300; - weapon_cooldown[1]=30; - - weapon[2]="Lance Battery"; - weapon_facing[2]="right"; - weapon_dam[2]=12; - weapon_range[2]=300; - weapon_cooldown[2]=30; - - weapon[3]="Weapons Battery"; - weapon_facing[3]="front"; - weapon_dam[3]=18; - weapon_range[3]=600; - weapon_cooldown[3]=60; - - weapon[4]="Torpedoes"; - weapon_facing[4]="front"; - weapon_dam[4]=18; - weapon_range[4]=450; - weapon_cooldown[4]=120; - - weapon[5]="Fighta Bommerz"; - weapon_facing[5]="special"; - weapon_dam[5]=0; - weapon_range[5]=9999; - weapon_cooldown[5]=90; - +if (class == "Desecrator") { + sprite_index = spr_ship_dese; + ship_size = 3; + + name = ""; + hp = 1200; + maxhp = 1200; + conditions = ""; + shields = 400; + maxshields = 400; + leadership = 90; + + armour_front = 7; + armour_other = 5; + weapons = 5; + turrets = 4; + capacity = 150; + carrying = 0; + + weapon[1] = "Lance Battery"; + weapon_facing[1] = "left"; + weapon_dam[1] = 12; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; + + weapon[2] = "Lance Battery"; + weapon_facing[2] = "right"; + weapon_dam[2] = 12; + weapon_range[2] = 300; + weapon_cooldown[2] = 30; + + weapon[3] = "Weapons Battery"; + weapon_facing[3] = "front"; + weapon_dam[3] = 18; + weapon_range[3] = 600; + weapon_cooldown[3] = 60; + + weapon[4] = "Torpedoes"; + weapon_facing[4] = "front"; + weapon_dam[4] = 18; + weapon_range[4] = 450; + weapon_cooldown[4] = 120; + + weapon[5] = "Fighta Bommerz"; + weapon_facing[5] = "special"; + weapon_dam[5] = 0; + weapon_range[5] = 9999; + weapon_cooldown[5] = 90; } -if (class="Avenger"){ - sprite_index=spr_ship_veng; - ship_size=2; - - name=""; - hp=1000; - maxhp=1000; - conditions=""; - shields=300; - maxshields=300; - leadership=85; - - armour_front=5; - armour_other=5; - weapons=2; - turrets=3; - capacity=50; - carrying=0; - - weapon[1]="Lance Battery"; - weapon_facing[1]="left"; - weapon_dam[1]=12; - weapon_range[1]=300; - weapon_cooldown[1]=30; - - weapon[2]="Lance Battery"; - weapon_facing[2]="right"; - weapon_dam[2]=12; - weapon_range[2]=300; - weapon_cooldown[2]=30; - +if (class == "Avenger") { + sprite_index = spr_ship_veng; + ship_size = 2; + + name = ""; + hp = 1000; + maxhp = 1000; + conditions = ""; + shields = 300; + maxshields = 300; + leadership = 85; + + armour_front = 5; + armour_other = 5; + weapons = 2; + turrets = 3; + capacity = 50; + carrying = 0; + + weapon[1] = "Lance Battery"; + weapon_facing[1] = "left"; + weapon_dam[1] = 12; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; + + weapon[2] = "Lance Battery"; + weapon_facing[2] = "right"; + weapon_dam[2] = 12; + weapon_range[2] = 300; + weapon_cooldown[2] = 30; } -if (class="Carnage") or (class="Daemon"){ - sprite_index=spr_ship_carnage; - ship_size=2; - - name=""; - hp=1000; - maxhp=1000; - conditions=""; - shields=300; - maxshields=300; - leadership=85; - - armour_front=5; - armour_other=5; - weapons=3; - turrets=3; - capacity=50; - carrying=0; - - weapon[1]="Lance Battery"; - weapon_facing[1]="most"; - weapon_dam[1]=12; - weapon_range[1]=450; - weapon_cooldown[1]=30; - - weapon[2]="Weapons Battery"; - weapon_facing[2]="left"; - weapon_dam[2]=12; - weapon_range[2]=300; - weapon_cooldown[2]=45; - - weapon[3]="Weapons Battery"; - weapon_facing[3]="right"; - weapon_dam[3]=12; - weapon_range[3]=300; - weapon_cooldown[3]=45; - - if (class="Daemon"){ - sprite_index=spr_ship_daemon; - image_alpha=0.1; +if ((class == "Carnage") || (class == "Daemon")) { + sprite_index = spr_ship_carnage; + ship_size = 2; + + name = ""; + hp = 1000; + maxhp = 1000; + conditions = ""; + shields = 300; + maxshields = 300; + leadership = 85; + + armour_front = 5; + armour_other = 5; + weapons = 3; + turrets = 3; + capacity = 50; + carrying = 0; + + weapon[1] = "Lance Battery"; + weapon_facing[1] = "most"; + weapon_dam[1] = 12; + weapon_range[1] = 450; + weapon_cooldown[1] = 30; + + weapon[2] = "Weapons Battery"; + weapon_facing[2] = "left"; + weapon_dam[2] = 12; + weapon_range[2] = 300; + weapon_cooldown[2] = 45; + + weapon[3] = "Weapons Battery"; + weapon_facing[3] = "right"; + weapon_dam[3] = 12; + weapon_range[3] = 300; + weapon_cooldown[3] = 45; + + if (class == "Daemon") { + sprite_index = spr_ship_daemon; + image_alpha = 0.1; } } -if (class="Iconoclast"){ - sprite_index=spr_ship_icono; - ship_size=1; - - name=""; - hp=100; - maxhp=100; - conditions=""; - shields=100; - maxshields=100; - leadership=80; - - armour_front=7; - armour_other=4; - weapons=1; - turrets=2; - capacity=50; - carrying=0; - - weapon[1]="Weapons Battery"; - weapon_facing[1]="most"; - weapon_dam[1]=8; - weapon_range[1]=300; - weapon_cooldown[1]=30; - +if (class == "Iconoclast") { + sprite_index = spr_ship_icono; + ship_size = 1; + + name = ""; + hp = 100; + maxhp = 100; + conditions = ""; + shields = 100; + maxshields = 100; + leadership = 80; + + armour_front = 7; + armour_other = 4; + weapons = 1; + turrets = 2; + capacity = 50; + carrying = 0; + + weapon[1] = "Weapons Battery"; + weapon_facing[1] = "most"; + weapon_dam[1] = 8; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; } // Tyranids -if (class="Leviathan"){ - sprite_index=spr_ship_leviathan; - ship_size=3; - - name=""; - hp=1000; - maxhp=1000; - conditions=""; - shields=300; - maxshields=300; - leadership=100; - - armour_front=7; - armour_other=5; - weapons=5; - turrets=3; - capacity=0; - carrying=0; - - weapon[1]="Feeder Tendrils"; - weapon_facing[1]="most"; - weapon_dam[1]=12; - weapon_range[1]=160; - weapon_cooldown[1]=30; - - weapon[2]="Bio-Plasma Discharge"; - weapon_facing[2]="most"; - weapon_dam[2]=10; - weapon_range[2]=260; - weapon_cooldown[2]=30; - - weapon[3]="Pyro-Acid Battery"; - weapon_facing[3]="front"; - weapon_dam[3]=18; - weapon_range[3]=500; - weapon_cooldown[3]=40; - - weapon[4]="Launch Glands"; - weapon_facing[4]="special"; - weapon_range[4]=9999; - weapon_ammo[4]=6; - weapon_cooldown[4]=120; - +if (class == "Leviathan") { + sprite_index = spr_ship_leviathan; + ship_size = 3; + + name = ""; + hp = 1000; + maxhp = 1000; + conditions = ""; + shields = 300; + maxshields = 300; + leadership = 100; + + armour_front = 7; + armour_other = 5; + weapons = 5; + turrets = 3; + capacity = 0; + carrying = 0; + + weapon[1] = "Feeder Tendrils"; + weapon_facing[1] = "most"; + weapon_dam[1] = 12; + weapon_range[1] = 160; + weapon_cooldown[1] = 30; + + weapon[2] = "Bio-Plasma Discharge"; + weapon_facing[2] = "most"; + weapon_dam[2] = 10; + weapon_range[2] = 260; + weapon_cooldown[2] = 30; + + weapon[3] = "Pyro-Acid Battery"; + weapon_facing[3] = "front"; + weapon_dam[3] = 18; + weapon_range[3] = 500; + weapon_cooldown[3] = 40; + + weapon[4] = "Launch Glands"; + weapon_facing[4] = "special"; + weapon_range[4] = 9999; + weapon_ammo[4] = 6; + weapon_cooldown[4] = 120; } -if (class="Razorfiend"){ - sprite_index=spr_ship_razorfiend; - ship_size=2; - - name=""; - hp=600; - maxhp=600; - conditions=""; - shields=200; - maxshields=200; - leadership=100; - - armour_front=5; - armour_other=4; - weapons=3; - turrets=2; - capacity=0; - carrying=0; - - weapon[1]="Pyro-Acid Battery"; - weapon_facing[1]="front"; - weapon_dam[1]=12; - weapon_range[1]=300; - weapon_cooldown[1]=30; - - weapon[2]="Feeder Tendrils"; - weapon_facing[2]="most"; - weapon_dam[2]=8; - weapon_range[2]=100; - weapon_cooldown[2]=30; - - weapon[3]="Massive Claws"; - weapon_facing[3]="most"; - weapon_dam[3]=20; - weapon_range[3]=64; - weapon_cooldown[3]=60; - +if (class == "Razorfiend") { + sprite_index = spr_ship_razorfiend; + ship_size = 2; + + name = ""; + hp = 600; + maxhp = 600; + conditions = ""; + shields = 200; + maxshields = 200; + leadership = 100; + + armour_front = 5; + armour_other = 4; + weapons = 3; + turrets = 2; + capacity = 0; + carrying = 0; + + weapon[1] = "Pyro-Acid Battery"; + weapon_facing[1] = "front"; + weapon_dam[1] = 12; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; + + weapon[2] = "Feeder Tendrils"; + weapon_facing[2] = "most"; + weapon_dam[2] = 8; + weapon_range[2] = 100; + weapon_cooldown[2] = 30; + + weapon[3] = "Massive Claws"; + weapon_facing[3] = "most"; + weapon_dam[3] = 20; + weapon_range[3] = 64; + weapon_cooldown[3] = 60; } -if (class="Stalker"){ - sprite_index=spr_ship_stalker; - ship_size=1; - - name=""; - hp=100; - maxhp=100; - conditions=""; - shields=100; - maxshields=100; - leadership=100; - - armour_front=5; - armour_other=4; - weapons=1; - turrets=0; - capacity=0; - carrying=0; - - weapon[1]="Pyro-Acid Battery"; - weapon_facing[1]="front"; - weapon_dam[1]=8; - weapon_range[1]=300; - weapon_cooldown[1]=60; - - weapon[2]="Feeder Tendrils"; - weapon_facing[2]="most"; - weapon_dam[2]=8; - weapon_range[2]=100; - weapon_cooldown[2]=30; - - weapon[3]="Bio-Plasma Discharge"; - weapon_facing[3]="front"; - weapon_dam[3]=6; - weapon_range[3]=200; - weapon_cooldown[3]=60; - +if (class == "Stalker") { + sprite_index = spr_ship_stalker; + ship_size = 1; + + name = ""; + hp = 100; + maxhp = 100; + conditions = ""; + shields = 100; + maxshields = 100; + leadership = 100; + + armour_front = 5; + armour_other = 4; + weapons = 1; + turrets = 0; + capacity = 0; + carrying = 0; + + weapon[1] = "Pyro-Acid Battery"; + weapon_facing[1] = "front"; + weapon_dam[1] = 8; + weapon_range[1] = 300; + weapon_cooldown[1] = 60; + + weapon[2] = "Feeder Tendrils"; + weapon_facing[2] = "most"; + weapon_dam[2] = 8; + weapon_range[2] = 100; + weapon_cooldown[2] = 30; + + weapon[3] = "Bio-Plasma Discharge"; + weapon_facing[3] = "front"; + weapon_dam[3] = 6; + weapon_range[3] = 200; + weapon_cooldown[3] = 60; } -if (class="Prowler"){ - sprite_index=spr_ship_prowler; - ship_size=1; - - name=""; - hp=100; - maxhp=100; - conditions=""; - shields=100; - maxshields=100; - leadership=100; - - armour_front=5; - armour_other=4; - weapons=1; - turrets=0; - capacity=0; - carrying=0; - - weapon[1]="Pyro-acid Battery"; - weapon_facing[1]="most"; - weapon_dam[1]=8; - weapon_range[1]=300; - weapon_cooldown[1]=30; - - weapon[2]="Feeder Tendrils"; - weapon_facing[2]="most"; - weapon_dam[2]=8; - weapon_range[2]=100; - weapon_cooldown[1]=30; - +if (class == "Prowler") { + sprite_index = spr_ship_prowler; + ship_size = 1; + + name = ""; + hp = 100; + maxhp = 100; + conditions = ""; + shields = 100; + maxshields = 100; + leadership = 100; + + armour_front = 5; + armour_other = 4; + weapons = 1; + turrets = 0; + capacity = 0; + carrying = 0; + + weapon[1] = "Pyro-acid Battery"; + weapon_facing[1] = "most"; + weapon_dam[1] = 8; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; + + weapon[2] = "Feeder Tendrils"; + weapon_facing[2] = "most"; + weapon_dam[2] = 8; + weapon_range[2] = 100; + weapon_cooldown[1] = 30; } +if (owner == eFACTION.Tyranids) { + var i; + i = 0; + repeat (2) { + i += 1; - -if (owner = eFACTION.Tyranids){ - var i; - i=0; - - repeat(2){ - i+=1; - - if (obj_fleet.en_mutation[i]="Spore Clouds") then shields=shields+100; - - if (obj_fleet.en_mutation[i]="Health"){ - hp=floor(hp*1.1); - maxhp=hp; + if (obj_fleet.en_mutation[i] == "Spore Clouds") { + shields = shields + 100; } - if (obj_fleet.en_mutation[i]="Armour") then armour_front+=1; - - if (obj_fleet.en_mutation[i]="Speed") then speed_bonus=speed_bonus*1.1; - - if (obj_fleet.en_mutation[i]="Turn") then turn_bonus=1.2; - - if (obj_fleet.en_mutation[i]="Turret") then turrets+=1; - - } -} - + if (obj_fleet.en_mutation[i] == "Health") { + hp = floor(hp * 1.1); + maxhp = hp; + } + if (obj_fleet.en_mutation[i] == "Armour") { + armour_front += 1; + } + if (obj_fleet.en_mutation[i] == "Speed") { + speed_bonus = speed_bonus * 1.1; + } + if (obj_fleet.en_mutation[i] == "Turn") { + turn_bonus = 1.2; + } + if (obj_fleet.en_mutation[i] == "Turret") { + turrets += 1; + } + } +} // Necrons -if (class="Cairn Class"){ - sprite_index=spr_ship_cairn; - ship_size=3; - - name=""; - hp=1100; - maxhp=1100; - conditions=""; - shields=550; - maxshields=550; - leadership=100; - - armour_front=5; - armour_other=5; - weapons=3; - turrets=5; - capacity=800; - carrying=0; - - weapon[1]="Lightning Arc"; - weapon_facing[1]="most"; - weapon_dam[1]=0; - weapon_range[1]=300; - weapon_cooldown[1]=15; - - weapon[2]="Star Pulse Generator"; - weapon_facing[2]="front"; - weapon_dam[2]=0; - weapon_range[2]=220; - weapon_cooldown[2]=210; - - weapon[3]="Gauss Particle Whip"; - weapon_facing[3]="front"; - weapon_dam[3]=30; - weapon_range[3]=450; - weapon_cooldown[3]=90; - +if (class == "Cairn Class") { + sprite_index = spr_ship_cairn; + ship_size = 3; + + name = ""; + hp = 1100; + maxhp = 1100; + conditions = ""; + shields = 550; + maxshields = 550; + leadership = 100; + + armour_front = 5; + armour_other = 5; + weapons = 3; + turrets = 5; + capacity = 800; + carrying = 0; + + weapon[1] = "Lightning Arc"; + weapon_facing[1] = "most"; + weapon_dam[1] = 0; + weapon_range[1] = 300; + weapon_cooldown[1] = 15; + + weapon[2] = "Star Pulse Generator"; + weapon_facing[2] = "front"; + weapon_dam[2] = 0; + weapon_range[2] = 220; + weapon_cooldown[2] = 210; + + weapon[3] = "Gauss Particle Whip"; + weapon_facing[3] = "front"; + weapon_dam[3] = 30; + weapon_range[3] = 450; + weapon_cooldown[3] = 90; } -if (class="Reaper Class"){ - sprite_index=spr_ship_reaper; - ship_size=3; - - name=""; - hp=900; - maxhp=900; - conditions=""; - shields=450; - maxshields=450; - leadership=100; - - armour_front=5; - armour_other=5; - weapons=3; - turrets=4; - capacity=500; - carrying=0; - - weapon[1]="Lightning Arc"; - weapon_facing[1]="most"; - weapon_dam[1]=0; - weapon_range[1]=300; - weapon_cooldown[1]=15; - - weapon[2]="Star Pulse Generator"; - weapon_facing[2]="front"; - weapon_dam[2]=0; - weapon_range[2]=220; - weapon_cooldown[2]=210; - - weapon[3]="Gauss Particle Whip"; - weapon_facing[3]="front"; - weapon_dam[3]=30; - weapon_range[3]=450; - weapon_cooldown[3]=90; - +if (class == "Reaper Class") { + sprite_index = spr_ship_reaper; + ship_size = 3; + + name = ""; + hp = 900; + maxhp = 900; + conditions = ""; + shields = 450; + maxshields = 450; + leadership = 100; + + armour_front = 5; + armour_other = 5; + weapons = 3; + turrets = 4; + capacity = 500; + carrying = 0; + + weapon[1] = "Lightning Arc"; + weapon_facing[1] = "most"; + weapon_dam[1] = 0; + weapon_range[1] = 300; + weapon_cooldown[1] = 15; + + weapon[2] = "Star Pulse Generator"; + weapon_facing[2] = "front"; + weapon_dam[2] = 0; + weapon_range[2] = 220; + weapon_cooldown[2] = 210; + + weapon[3] = "Gauss Particle Whip"; + weapon_facing[3] = "front"; + weapon_dam[3] = 30; + weapon_range[3] = 450; + weapon_cooldown[3] = 90; } -if (class="Shroud Class"){ - ship_size=2; - sprite_index=spr_ship_shroud; - - name=""; - hp=400; - maxhp=400; - conditions=""; - shields=200; - maxshields=200; - leadership=100; - - armour_front=5; - armour_other=5; - weapons=1; - turrets=2; - capacity=250; - carrying=0; - - weapon[1]="Lightning Arc"; - weapon_facing[1]="most"; - weapon_dam[1]=0; - weapon_range[1]=300; - weapon_cooldown[1]=15; - +if (class == "Shroud Class") { + ship_size = 2; + sprite_index = spr_ship_shroud; + + name = ""; + hp = 400; + maxhp = 400; + conditions = ""; + shields = 200; + maxshields = 200; + leadership = 100; + + armour_front = 5; + armour_other = 5; + weapons = 1; + turrets = 2; + capacity = 250; + carrying = 0; + + weapon[1] = "Lightning Arc"; + weapon_facing[1] = "most"; + weapon_dam[1] = 0; + weapon_range[1] = 300; + weapon_cooldown[1] = 15; } -if (class="Jackal Class"){ - ship_size=2; - sprite_index=spr_ship_jackal; - - name=""; - hp=100; - maxhp=100; - conditions=""; - shields=100; - maxshields=100; - leadership=100; - - armour_front=4; - armour_other=4; - weapons=1; - turrets=2; - capacity=25; - carrying=0; - - weapon[1]="Lightning Arc"; - weapon_facing[1]="most"; - weapon_dam[1]=0; - weapon_range[1]=250; - weapon_cooldown[1]=15; - +if (class == "Jackal Class") { + ship_size = 2; + sprite_index = spr_ship_jackal; + + name = ""; + hp = 100; + maxhp = 100; + conditions = ""; + shields = 100; + maxshields = 100; + leadership = 100; + + armour_front = 4; + armour_other = 4; + weapons = 1; + turrets = 2; + capacity = 25; + carrying = 0; + + weapon[1] = "Lightning Arc"; + weapon_facing[1] = "most"; + weapon_dam[1] = 0; + weapon_range[1] = 250; + weapon_cooldown[1] = 15; } -if (class="Dirge Class"){ - ship_size=2; - sprite_index=spr_ship_dirge; - - name=""; - hp=100; - maxhp=100; - conditions=""; - shields=100; - maxshields=100; - leadership=100; - - armour_front=4; - armour_other=4; - weapons=1; - turrets=2; - capacity=25; - carrying=0; - - weapon[1]="Lightning Arc"; - weapon_facing[1]="most"; - weapon_dam[1]=0; - weapon_range[1]=250; - weapon_cooldown[1]=15; - +if (class == "Dirge Class") { + ship_size = 2; + sprite_index = spr_ship_dirge; + + name = ""; + hp = 100; + maxhp = 100; + conditions = ""; + shields = 100; + maxshields = 100; + leadership = 100; + + armour_front = 4; + armour_other = 4; + weapons = 1; + turrets = 2; + capacity = 25; + carrying = 0; + + weapon[1] = "Lightning Arc"; + weapon_facing[1] = "most"; + weapon_dam[1] = 0; + weapon_range[1] = 250; + weapon_cooldown[1] = 15; } - - - - - - - - - - - - -if (owner != eFACTION.Eldar) and (owner != eFACTION.Necrons){ - hp=hp/2; - maxhp=hp; - shields=shields/2; - maxshields=shields; - +if ((owner != eFACTION.Eldar) && (owner != eFACTION.Necrons)) { + hp = hp / 2; + maxhp = hp; + shields = shields / 2; + maxshields = shields; } -bridge=maxhp; +bridge = maxhp; /* if (obj_fleet.enemy == 2) { @@ -1302,18 +1255,13 @@ if (obj_fleet.enemy == 2) { } */ // hp=1; -shields=1; - - +shields = 1; // if (obj_fleet.enemy="orks") then name=global.name_generator.generate_ork_ship_name(); -name="sdagdsagdasg"; - - +name = "sdagdsagdasg"; // show_message(string(class)); - /* */ /* */ diff --git a/objects/obj_en_ship/Create_0.gml b/objects/obj_en_ship/Create_0.gml index 7c83962b6c..9e4bebed9d 100644 --- a/objects/obj_en_ship/Create_0.gml +++ b/objects/obj_en_ship/Create_0.gml @@ -1,54 +1,53 @@ +ship_id = 0; +owner = 0; -ship_id=0; -owner=0; - -action=""; -direction=180; +action = ""; +direction = 180; // if (instance_exists(obj_p_ship)){target=instance_nearest(x,y,obj_p_ship);} -target_l=0; -target_r=0; -target=0; -hostile=1; -lightning=0; -whip=0; -bridge=0; - -cooldown[0]=0; -cooldown[1]=0; -cooldown[2]=0; -cooldown[3]=0; -cooldown[4]=0; -cooldown[5]=0; -turret_cool=0; - - -name=""; -class=""; -size=0; -hp=0; -maxhp=0; -conditions=""; -shields=1; -maxshields=1; -armour_front=0; -armour_other=0; -weapons=0; -turrets=0; - -turn_bonus=1; -speed_bonus=1; - - -var i;i=-1; -repeat(6){i+=1; - weapon[i]=""; - weapon_facing[i]=""; - weapon_cooldown[i]=0; - weapon_hp[i]=0; - weapon_dam[i]=0; - weapon_ammo[i]=999; - weapon_range[i]=0; - weapon_minrange[i]=0; +target_l = 0; +target_r = 0; +target = 0; +hostile = 1; +lightning = 0; +whip = 0; +bridge = 0; + +cooldown[0] = 0; +cooldown[1] = 0; +cooldown[2] = 0; +cooldown[3] = 0; +cooldown[4] = 0; +cooldown[5] = 0; +turret_cool = 0; + +name = ""; +class = ""; +size = 0; +hp = 0; +maxhp = 0; +conditions = ""; +shields = 1; +maxshields = 1; +armour_front = 0; +armour_other = 0; +weapons = 0; +turrets = 0; + +turn_bonus = 1; +speed_bonus = 1; + +var i; +i = -1; +repeat (6) { + i += 1; + weapon[i] = ""; + weapon_facing[i] = ""; + weapon_cooldown[i] = 0; + weapon_hp[i] = 0; + weapon_dam[i] = 0; + weapon_ammo[i] = 999; + weapon_range[i] = 0; + weapon_minrange[i] = 0; } action_set_alarm(1, 0); diff --git a/objects/obj_en_ship/Draw_0.gml b/objects/obj_en_ship/Draw_0.gml index d9619fe019..445006c413 100644 --- a/objects/obj_en_ship/Draw_0.gml +++ b/objects/obj_en_ship/Draw_0.gml @@ -4,57 +4,91 @@ if (!__b__) { { draw_set_font(fnt_info); draw_set_halign(fa_center); - + // 135; /*if (action="broadside"){ draw_set_color(c_blue);if (instance_exists(target_l)) then draw_line(x,y,target_l.x,target_l.y); draw_set_color(c_red);if (instance_exists(target_r)) then draw_line(x,y,target_r.x,target_r.y); }draw_set_color(CM_GREEN_COLOR);*/ - - + draw_set_alpha(1); - - if (lightning>01) and (instance_exists(target)){ - draw_set_color(c_lime);lightning-=1; - scr_bolt(x,y,target.x,target.y,0); + + if ((lightning > 1) && instance_exists(target)) { + draw_set_color(c_lime); + lightning -= 1; + scr_bolt(x, y, target.x, target.y, 0); } - if (whip>0) and (instance_exists(target)){ - draw_set_color(c_lime);whip-=1; - scr_bolt(x,y,target.x,target.y,0); - scr_bolt(x-1,y+1,target.x-1,target.y+1,0); + if ((whip > 0) && instance_exists(target)) { + draw_set_color(c_lime); + whip -= 1; + scr_bolt(x, y, target.x, target.y, 0); + scr_bolt(x - 1, y + 1, target.x - 1, target.y + 1, 0); } - + draw_set_color(CM_GREEN_COLOR); - - if (class!="Battlekroozer") then draw_self(); - if (class="Battlekroozer") then draw_sprite_ext(sprite_index,0,x,y,0.75,0.75,direction,c_white,1); - - - - - if (owner != eFACTION.Tau){ - if (shields<=0){ - if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_height/2),string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"));} - if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_height,string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"),2,2,0);} + + if (class != "Battlekroozer") { + draw_self(); + } + if (class == "Battlekroozer") { + draw_sprite_ext(sprite_index, 0, x, y, 0.75, 0.75, direction, c_white, 1); + } + + if (owner != eFACTION.Tau) { + if (shields <= 0) { + if (obj_controller.zoomed == 0) { + if (maxhp != 0) { + draw_text(x, y - (sprite_height / 2), string_hash_to_newline(string(floor((hp / maxhp) * 100)) + "%")); + } + } + if (obj_controller.zoomed == 1) { + if (maxhp != 0) { + draw_text_transformed(x, y - sprite_height, string_hash_to_newline(string(floor((hp / maxhp) * 100)) + "%"), 2, 2, 0); + } + } } - - if (shields>0){ + + if (shields > 0) { draw_set_color(c_white); - if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_height/2),string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"));} - if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_height,string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"),2,2,0);} + if (obj_controller.zoomed == 0) { + if (maxhp != 0) { + draw_text(x, y - (sprite_height / 2), string_hash_to_newline(string(floor((shields / maxshields) * 100)) + "%")); + } + } + if (obj_controller.zoomed == 1) { + if (maxhp != 0) { + draw_text_transformed(x, y - sprite_height, string_hash_to_newline(string(floor((shields / maxshields) * 100)) + "%"), 2, 2, 0); + } + } } } - - if (owner = eFACTION.Tau){ - if (shields<=0){ - if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_width/2),string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"));} - if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_width,string_hash_to_newline(string(floor((hp/maxhp)*100))+"%"),2,2,0);} + + if (owner == eFACTION.Tau) { + if (shields <= 0) { + if (obj_controller.zoomed == 0) { + if (maxhp != 0) { + draw_text(x, y - (sprite_width / 2), string_hash_to_newline(string(floor((hp / maxhp) * 100)) + "%")); + } + } + if (obj_controller.zoomed == 1) { + if (maxhp != 0) { + draw_text_transformed(x, y - sprite_width, string_hash_to_newline(string(floor((hp / maxhp) * 100)) + "%"), 2, 2, 0); + } + } } - - if (shields>0){ + + if (shields > 0) { draw_set_color(c_white); - if (obj_controller.zoomed=0){if (maxhp!=0) then draw_text(x,y-(sprite_width/2),string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"));} - if (obj_controller.zoomed=1){if (maxhp!=0) then draw_text_transformed(x,y-sprite_width,string_hash_to_newline(string(floor((shields/maxshields)*100))+"%"),2,2,0);} + if (obj_controller.zoomed == 0) { + if (maxhp != 0) { + draw_text(x, y - (sprite_width / 2), string_hash_to_newline(string(floor((shields / maxshields) * 100)) + "%")); + } + } + if (obj_controller.zoomed == 1) { + if (maxhp != 0) { + draw_text_transformed(x, y - sprite_width, string_hash_to_newline(string(floor((shields / maxshields) * 100)) + "%"), 2, 2, 0); + } + } } } /* */ diff --git a/objects/obj_en_ship/Step_0.gml b/objects/obj_en_ship/Step_0.gml index 1b2407627b..2afa96d12f 100644 --- a/objects/obj_en_ship/Step_0.gml +++ b/objects/obj_en_ship/Step_0.gml @@ -1,111 +1,231 @@ var __b__; __b__ = action_if_variable(owner, 6, 0); -if !__b__ -{ - image_angle=direction; - - if (obj_fleet.start!=5) then exit; - - if (class="Daemon") and (image_alpha<1) then image_alpha+=0.006; - - var o_dist, dist, ch_rang, ex, spid;spid=0; - - if (shields>0) and (shields 0) && (shields < maxshields)) { + shields += 0.02; + } + // Need to every couple of seconds check this // with obj_en_ship if not big then disable, check nearest, and activate once more - - - if (instance_exists(obj_p_ship)) and (!instance_exists(obj_al_ship)) then target=instance_nearest(x,y,obj_p_ship); - if (!instance_exists(obj_p_ship)) and (instance_exists(obj_al_ship)) then target=instance_nearest(x,y,obj_al_ship); - if (instance_exists(obj_p_ship)) and (instance_exists(obj_al_ship)){ - var tp1,tp2; - tp1=instance_nearest(x,y,obj_p_ship);tp2=instance_nearest(x,y,obj_al_ship); - if (point_distance(x,y,tp1.x,tp1.y)<=point_distance(x,y,tp2.x,tp2.y)) then target=tp1; - if (point_distance(x,y,tp1.x,tp1.y)>point_distance(x,y,tp2.x,tp2.y)) then target=tp2; + + if (instance_exists(obj_p_ship) && (!instance_exists(obj_al_ship))) { + target = instance_nearest(x, y, obj_p_ship); } - if (!instance_exists(target)) then exit; - - if (hp<=0){ - var wh,gud;wh=0;gud=0; - repeat(5){wh+=1;if (obj_fleet.enemy[wh]=owner) then gud=wh;} - - if (size=3) then obj_fleet.en_capital_lost[gud]+=1; - if (size=2) then obj_fleet.en_frigate_lost[gud]+=1; - if (size=1) then obj_fleet.en_escort_lost[gud]+=1; - - image_alpha=0.5; - - - if (owner != eFACTION.Tyranids){ + if ((!instance_exists(obj_p_ship)) && instance_exists(obj_al_ship)) { + target = instance_nearest(x, y, obj_al_ship); + } + if (instance_exists(obj_p_ship) && instance_exists(obj_al_ship)) { + var tp1, tp2; + tp1 = instance_nearest(x, y, obj_p_ship); + tp2 = instance_nearest(x, y, obj_al_ship); + if (point_distance(x, y, tp1.x, tp1.y) <= point_distance(x, y, tp2.x, tp2.y)) { + target = tp1; + } + if (point_distance(x, y, tp1.x, tp1.y) > point_distance(x, y, tp2.x, tp2.y)) { + target = tp2; + } + } + if (!instance_exists(target)) { + exit; + } + + if (hp <= 0) { + var wh, gud; + wh = 0; + gud = 0; + repeat (5) { + wh += 1; + if (obj_fleet.enemy[wh] == owner) { + gud = wh; + } + } + + if (size == 3) { + obj_fleet.en_capital_lost[gud] += 1; + } + if (size == 2) { + obj_fleet.en_frigate_lost[gud] += 1; + } + if (size == 1) { + obj_fleet.en_escort_lost[gud] += 1; + } + + image_alpha = 0.5; + + if (owner != eFACTION.Tyranids) { // ex=instance_create(x,y,obj_explosion); // ex.image_xscale=2;ex.image_yscale=2;ex.image_speed=0.75; - var husk;husk=instance_create(x,y,obj_en_husk); - husk.sprite_index=sprite_index;husk.direction=direction; - husk.image_angle=image_angle;husk.depth=depth;husk.image_speed=0; - repeat(choose(4,5,6)){ - var explo;explo=instance_create(x,y,obj_explosion); - explo.image_xscale=0.5;explo.image_yscale=0.5; - explo.x+=random_range(sprite_width*0.25,sprite_width*-0.25); - explo.y+=random_range(sprite_width*0.25,sprite_width*-0.25); + var husk; + husk = instance_create(x, y, obj_en_husk); + husk.sprite_index = sprite_index; + husk.direction = direction; + husk.image_angle = image_angle; + husk.depth = depth; + husk.image_speed = 0; + repeat (choose(4, 5, 6)) { + var explo; + explo = instance_create(x, y, obj_explosion); + explo.image_xscale = 0.5; + explo.image_yscale = 0.5; + explo.x += random_range(sprite_width * 0.25, sprite_width * -0.25); + explo.y += random_range(sprite_width * 0.25, sprite_width * -0.25); } } - if (owner = eFACTION.Tyranids) then effect_create_depth(-15000,ef_firework,x,y,1,c_purple); + if (owner == eFACTION.Tyranids) { + effect_create_depth(-15000, ef_firework, x, y, 1, c_purple); + } instance_destroy(); } - - if (hp>0) and (instance_exists(obj_p_ship)){ - - if (class="Apocalypse Class Battleship"){o_dist=500;action="attack";spid=20;} - if (class="Nemesis Class Fleet Carrier"){o_dist=1000;action="attack";spid=20;} - if (class="Leviathan"){o_dist=160;action="attack";spid=20;} - if (class="Battle Barge") or (class="Custodian"){o_dist=300;action="attack";spid=20;} - if (class="Desecrator"){o_dist=300;action="attack";spid=20;} - if (class="Razorfiend"){o_dist=100;action="attack";spid=25;} - if (class="Cairn Class") or (class="Reaper Class"){o_dist=199;action="attack";spid=25;if (class="Reaper Class") then spid=30;} - - if (class="Dethdeala") or (class="Protector") or (class="Emissary"){o_dist=200;action="attack";spid=20;} - if (class="Gorbag's Revenge"){o_dist=200;action="attack";spid=20;} - if (class="Kroolboy") or (class="Slamblasta"){o_dist=200;action="attack";spid=25;} - if (class="Battlekroozer"){o_dist=200;action="attack";spid=30;} - if (class="Avenger") or (class="Carnage") or (class="Daemon"){o_dist=200;action="attack";spid=20;} - - if (class="Ravager") or (class="Iconoclast") or (class="Castellan") or (class="Warden"){o_dist=300;action="attack";spid=35;} - if (class="Shroud Class"){o_dist=250;action="attack";spid=35;} - - if (class="Stalker") or (class="Sword Class Frigate"){o_dist=100;action="attack";spid=20;} - if (class="Prowler"){o_dist=100;action="attack";spid=35;} - if (class="Avenger Class Grand Cruiser"){o_dist=48;action="broadside";spid=20;} - if (class="Jackal Class"){o_dist=200;action="attack";spid=40;} - if (class="Dirge Class"){o_dist=200;action="attack";spid=45;} - + + if ((hp > 0) && instance_exists(obj_p_ship)) { + if (class == "Apocalypse Class Battleship") { + o_dist = 500; + action = "attack"; + spid = 20; + } + if (class == "Nemesis Class Fleet Carrier") { + o_dist = 1000; + action = "attack"; + spid = 20; + } + if (class == "Leviathan") { + o_dist = 160; + action = "attack"; + spid = 20; + } + if ((class == "Battle Barge") || (class == "Custodian")) { + o_dist = 300; + action = "attack"; + spid = 20; + } + if (class == "Desecrator") { + o_dist = 300; + action = "attack"; + spid = 20; + } + if (class == "Razorfiend") { + o_dist = 100; + action = "attack"; + spid = 25; + } + if ((class == "Cairn Class") || (class == "Reaper Class")) { + o_dist = 199; + action = "attack"; + spid = 25; + if (class == "Reaper Class") { + spid = 30; + } + } + + if ((class == "Dethdeala") || (class == "Protector") || (class == "Emissary")) { + o_dist = 200; + action = "attack"; + spid = 20; + } + if (class == "Gorbag's Revenge") { + o_dist = 200; + action = "attack"; + spid = 20; + } + if ((class == "Kroolboy") || (class == "Slamblasta")) { + o_dist = 200; + action = "attack"; + spid = 25; + } + if (class == "Battlekroozer") { + o_dist = 200; + action = "attack"; + spid = 30; + } + if ((class == "Avenger") || (class == "Carnage") || (class == "Daemon")) { + o_dist = 200; + action = "attack"; + spid = 20; + } + + if ((class == "Ravager") || (class == "Iconoclast") || (class == "Castellan") || (class == "Warden")) { + o_dist = 300; + action = "attack"; + spid = 35; + } + if (class == "Shroud Class") { + o_dist = 250; + action = "attack"; + spid = 35; + } + + if ((class == "Stalker") || (class == "Sword Class Frigate")) { + o_dist = 100; + action = "attack"; + spid = 20; + } + if (class == "Prowler") { + o_dist = 100; + action = "attack"; + spid = 35; + } + if (class == "Avenger Class Grand Cruiser") { + o_dist = 48; + action = "broadside"; + spid = 20; + } + if (class == "Jackal Class") { + o_dist = 200; + action = "attack"; + spid = 40; + } + if (class == "Dirge Class") { + o_dist = 200; + action = "attack"; + spid = 45; + } + // if (class!="big") then flank!!!! - - - spid=spid*speed_bonus; - - dist=point_distance(x,y,target.x,target.y)-(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))); - - - if (target!=0) and (action="attack"){ - direction=turn_towards_point(direction,x,y,target.x,target.y,.1); - } - if (target!=0) and (action="broadside") and (dist>o_dist){ - if (y>=target.y) then dist=point_distance(x,y,target.x+lengthdir_x(64,target.direction-180),target.y+lengthdir_y(128,target.direction-90))-(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))); - if (ytarget.y) and (dist>o_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2); - if (yo_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction+90),.2); - if (turn_bonus>1){ - if (yo_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction+90),.2); - } - } - - + + spid = spid * speed_bonus; + + dist = point_distance(x, y, target.x, target.y) - max(sprite_get_width(sprite_index), sprite_get_height(sprite_index)); + + if ((target != 0) && (action == "attack")) { + direction = turn_towards_point(direction, x, y, target.x, target.y, 0.1); + } + if ((target != 0) && (action == "broadside") && (dist > o_dist)) { + if (y >= target.y) { + dist = point_distance(x, y, target.x + lengthdir_x(64, target.direction - 180), target.y + lengthdir_y(128, target.direction - 90)) - max(sprite_get_width(sprite_index), sprite_get_height(sprite_index)); + } + if (y < target.y) { + dist = point_distance(x, y, target.x + lengthdir_x(64, target.direction - 180), target.y + lengthdir_y(128, target.direction + 90)) - max(sprite_get_width(sprite_index), sprite_get_height(sprite_index)); + } + if ((y > target.y) && (dist > o_dist)) { + direction = turn_towards_point(direction, x + lengthdir_x(64, target.direction - 180), y, target.x, target.y + lengthdir_y(128, target.direction - 90), 0.2); + } + if ((y < target.y) && (dist > o_dist)) { + direction = turn_towards_point(direction, x + lengthdir_x(64, target.direction - 180), y, target.x, target.y + lengthdir_y(128, target.direction + 90), 0.2); + } + if (turn_bonus > 1) { + if ((y < target.y) && (dist > o_dist)) { + direction = turn_towards_point(direction, x + lengthdir_x(64, target.direction - 180), y, target.x, target.y + lengthdir_y(128, target.direction + 90), 0.2); + } + } + } + /*if (target!=0) and (action="broadside") and (o_dist>=dist){ direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) }*/ - + /*if (target!=0) and (action="broadside") and (o_dist>=dist){ var re_deh;re_deh=relative_direction(direction,target.direction); @@ -137,86 +257,144 @@ if !__b__ }*/ - - - if (action="attack"){ - if (dist>o_dist) and (speed<((spid)/10)) then speed+=0.005; - if (dist0) then speed-=0.025; - } - if (action="broadside"){ - if (dist>o_dist) and (speed<((spid)/10)) then speed+=0.005; - if (dist0) then speed-=0.025; - } - - - if (speed<0) then speed=speed*0.9; - - if (cooldown[1]>0) then cooldown[1]-=1; - if (cooldown[2]>0) then cooldown[2]-=1; - if (cooldown[3]>0) then cooldown[3]-=1; - if (cooldown[4]>0) then cooldown[4]-=1; - if (cooldown[5]>0) then cooldown[5]-=1; - if (turret_cool>0) then turret_cool-=1; - - - - + + if (action == "attack") { + if ((dist > o_dist) && (speed < (spid / 10))) { + speed += 0.005; + } + if ((dist < o_dist) && (speed > 0)) { + speed -= 0.025; + } + } + if (action == "broadside") { + if ((dist > o_dist) && (speed < (spid / 10))) { + speed += 0.005; + } + if ((dist < o_dist) && (speed > 0)) { + speed -= 0.025; + } + } + + if (speed < 0) { + speed = speed * 0.9; + } + + if (cooldown[1] > 0) { + cooldown[1] -= 1; + } + if (cooldown[2] > 0) { + cooldown[2] -= 1; + } + if (cooldown[3] > 0) { + cooldown[3] -= 1; + } + if (cooldown[4] > 0) { + cooldown[4] -= 1; + } + if (cooldown[5] > 0) { + cooldown[5] -= 1; + } + if (turret_cool > 0) { + turret_cool -= 1; + } + var bull, targe, rdir, dirr, dist, xx, yy, ok; - targe=0;rdir=0;dirr="";dist=9999;xx=x;yy=y; - - - if (turrets>0) and (instance_exists(obj_p_small)) and (turret_cool=0){ - targe=instance_nearest(x,y,obj_p_small); - if (instance_exists(targe)) then dist=point_distance(x,y,targe.x,targe.y); - - if (dist>64) and (dist<300){ - bull=instance_create(x,y,obj_en_round);bull.direction=point_direction(x,y,targe.x,targe.y); - if (owner = eFACTION.Tyranids) then bull.sprite_index=spr_glob; - bull.speed=20;bull.dam=3;bull.image_xscale=0.5;bull.image_yscale=0.5;turret_cool=floor(60/turrets); - if (owner = eFACTION.Necrons){bull.sprite_index=spr_green_las;bull.image_yscale=1;} - bull.direction+=choose(random(10),1*-(random(10))); - } - } - targe=0;rdir=0;dirr="";dist=9999; - - - xx=lengthdir_x(64,direction+90); - yy=lengthdir_y(64,direction+90); - + targe = 0; + rdir = 0; + dirr = ""; + dist = 9999; + xx = x; + yy = y; + + if ((turrets > 0) && instance_exists(obj_p_small) && (turret_cool == 0)) { + targe = instance_nearest(x, y, obj_p_small); + if (instance_exists(targe)) { + dist = point_distance(x, y, targe.x, targe.y); + } + + if ((dist > 64) && (dist < 300)) { + bull = instance_create(x, y, obj_en_round); + bull.direction = point_direction(x, y, targe.x, targe.y); + if (owner == eFACTION.Tyranids) { + bull.sprite_index = spr_glob; + } + bull.speed = 20; + bull.dam = 3; + bull.image_xscale = 0.5; + bull.image_yscale = 0.5; + turret_cool = floor(60 / turrets); + if (owner == eFACTION.Necrons) { + bull.sprite_index = spr_green_las; + bull.image_yscale = 1; + } + bull.direction += choose(random(10), 1 * -random(10)); + } + } + targe = 0; + rdir = 0; + dirr = ""; + dist = 9999; + + xx = lengthdir_x(64, direction + 90); + yy = lengthdir_y(64, direction + 90); + var front, right, left, rear; - front=0;right=0;left=0;rear=0; - - targe=instance_nearest(xx,yy,obj_p_ship); - rdir=point_direction(x,y,target.x,target.y); + front = 0; + right = 0; + left = 0; + rear = 0; + + targe = instance_nearest(xx, yy, obj_p_ship); + rdir = point_direction(x, y, target.x, target.y); // if (rdir>45) and (rdir<=135) and (targe!=target){target_r=targe;right=1;} - // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} - target_l=instance_nearest(x+lengthdir_x(64,direction+90),y+lengthdir_y(64,direction+90),obj_p_ship); - target_r=instance_nearest(x+lengthdir_x(64,direction+270),y+lengthdir_y(64,direction+270),obj_p_ship); - - if (collision_line(x,y,x+lengthdir_x(2000,direction),y+lengthdir_y(2000,direction),obj_p_ship,0,1)) then front=1; - - - var f, facing, ammo, range, wep, dam, gg;f=0;facing="";ammo=0;range=0;wep="";dam=0;gg=0; - - lightning=0; - - repeat(weapons){ - gg+=1; - - ok=0;f+=1;facing="";ammo=0;range=0;wep=""; - + // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} + target_l = instance_nearest(x + lengthdir_x(64, direction + 90), y + lengthdir_y(64, direction + 90), obj_p_ship); + target_r = instance_nearest(x + lengthdir_x(64, direction + 270), y + lengthdir_y(64, direction + 270), obj_p_ship); + + if (collision_line(x, y, x + lengthdir_x(2000, direction), y + lengthdir_y(2000, direction), obj_p_ship, 0, 1)) { + front = 1; + } + + var f, facing, ammo, range, wep, dam, gg; + f = 0; + facing = ""; + ammo = 0; + range = 0; + wep = ""; + dam = 0; + gg = 0; + + lightning = 0; + + repeat (weapons) { + gg += 1; + + ok = 0; + f += 1; + facing = ""; + ammo = 0; + range = 0; + wep = ""; + //weapon[gg]=0;weapon_ammo[gg]=0;weapon_range[gg]=0; - - - if (cooldown[gg]<=0) and (weapon[gg]!="") and (weapon_ammo[gg]>0) then ok=1; - if (ok=1){ - facing=weapon_facing[gg];ammo=weapon_ammo[gg];range=weapon_range[gg];} - - targe=target; - if (facing="front") and (front=1) then ok=2; - if (facing="most") then ok=2; - - + + if ((cooldown[gg] <= 0) && (weapon[gg] != "") && (weapon_ammo[gg] > 0)) { + ok = 1; + } + if (ok == 1) { + facing = weapon_facing[gg]; + ammo = weapon_ammo[gg]; + range = weapon_range[gg]; + } + + targe = target; + if ((facing == "front") && (front == 1)) { + ok = 2; + } + if (facing == "most") { + ok = 2; + } + /* if (facing="right") then targe=target_r; if (facing="left") then targe=target_l; @@ -224,236 +402,415 @@ if !__b__ if (facing="right") or (facing="most") and (right=1) then ok=2; if (facing="left") or (facing="most") and (left=1) then ok=2; */ - if (facing="special") then ok=2; - if (!instance_exists(targe)) then exit; - dist=point_distance(x,y,targe.x,targe.y); - - if (facing="right") and (point_direction(x,y,target_r.x,target_r.y)<337) and (point_direction(x,y,target_r.x,target_r.y)>203) then ok=2; - if (facing="left") and (point_direction(x,y,target_r.x,target_r.y)>22) and (point_direction(x,y,target_r.x,target_r.y)<157) then ok=2; - + if (facing == "special") { + ok = 2; + } + if (!instance_exists(targe)) { + exit; + } + dist = point_distance(x, y, targe.x, targe.y); + + if ((facing == "right") && (point_direction(x, y, target_r.x, target_r.y) < 337) && (point_direction(x, y, target_r.x, target_r.y) > 203)) { + ok = 2; + } + if ((facing == "left") && (point_direction(x, y, target_r.x, target_r.y) > 22) && (point_direction(x, y, target_r.x, target_r.y) < 157)) { + ok = 2; + } + /*var re_deh;re_deh=relative_direction(direction,target.direction); if (re_deh<45) or (re_deh>315) or ((re_deh>135) and (re_deh<225)) then direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) */ - - - - if (ok=2) and (dist<(range+(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))))){ - if (ammo>0) and (ammo<900) then ammo-=1; - weapon_ammo[gg]=ammo;cooldown[gg]=weapon_cooldown[gg];wep=weapon[gg];dam=weapon_dam[gg]; - + + if ((ok == 2) && (dist < (range + max(sprite_get_width(sprite_index), sprite_get_height(sprite_index))))) { + if ((ammo > 0) && (ammo < 900)) { + ammo -= 1; + } + weapon_ammo[gg] = ammo; + cooldown[gg] = weapon_cooldown[gg]; + wep = weapon[gg]; + dam = weapon_dam[gg]; + // if (f=3) and (ship_id=2) then show_message("ammo: "+string(ammo)+" | range: "+string(range)); - - if (ammo<0) then ok=0; - ok=3; - - if (string_count("orpedo",wep)=0) and (string_count("Interceptor",wep)=0) and (string_count("ommerz",wep)=0) and (string_count("Claws",wep)=0) and (string_count("endrils",wep)=0) and (ok=3) and (owner != eFACTION.Necrons){ - bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_en_round); - bull.speed=20;bull.dam=dam; - if (targe=target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); - if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} - if (string_count("ova",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("eavy Gunz",wep)=1){bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Lance",wep)=1){bull.sprite_index=spr_ground_las;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Ion",wep)=1){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Rail",wep)=1){bull.sprite_index=spr_railgun;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Gravitic",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("Plasma",wep)=1){bull.sprite_index=spr_ground_plasma;bull.image_xscale=2;bullimage_yscale=2;bull.speed=15;} - if (string_count("Pyro-Acid",wep)=1){bull.sprite_index=spr_glob;bull.image_xscale=2;bullimage_yscale=2;} - - if (string_count("Weapons",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_ground_las;bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("Pulse",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} - + + if (ammo < 0) { + ok = 0; } - if (string_count("orpedo",wep)=1) and (ok=3) and (owner != eFACTION.Necrons){ - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - } - bull=instance_create(x,y+lengthdir_y(-10,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - bull=instance_create(x,y+lengthdir_y(10,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(30,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - } - + ok = 3; + + if ((string_count("orpedo", wep) == 0) && (string_count("Interceptor", wep) == 0) && (string_count("ommerz", wep) == 0) && (string_count("Claws", wep) == 0) && (string_count("endrils", wep) == 0) && (ok == 3) && (owner != eFACTION.Necrons)) { + bull = instance_create(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), obj_en_round); + bull.speed = 20; + bull.dam = dam; + if (targe == target) { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); + } + if (facing != "front") { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); + } + if (string_count("ova", wep) == 1) { + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if (string_count("eavy Gunz", wep) == 1) { + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Lance", wep) == 1) { + bull.sprite_index = spr_ground_las; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Ion", wep) == 1) { + bull.sprite_index = spr_pulse; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Rail", wep) == 1) { + bull.sprite_index = spr_railgun; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Gravitic", wep) == 1) { + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if (string_count("Plasma", wep) == 1) { + bull.sprite_index = spr_ground_plasma; + bull.image_xscale = 2; + bullimage_yscale = 2; + bull.speed = 15; + } + if (string_count("Pyro-Acid", wep) == 1) { + bull.sprite_index = spr_glob; + bull.image_xscale = 2; + bullimage_yscale = 2; + } + + if ((string_count("Weapons", wep) == 1) && (owner == eFACTION.Eldar)) { + bull.sprite_index = spr_ground_las; + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if ((string_count("Pulse", wep) == 1) && (owner == eFACTION.Eldar)) { + bull.sprite_index = spr_pulse; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } } - - if (wep="Lightning Arc"){lightning=10; - if (target.shields>0){ - if (class="Cairn Class") or (class="Reaper Class") then target.shields-=20; - else{target.shields-=20;} + if ((string_count("orpedo", wep) == 1) && (ok == 3) && (owner != eFACTION.Necrons)) { + if (class != "Ravager") { + bull = instance_create(x, y + lengthdir_y(-30, direction + 90), obj_en_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; } - if (target.shields<=0){ - if (class="Cairn Class") or (class="Reaper Class") then target.hp-=10; - else{target.hp-=10;} + bull = instance_create(x, y + lengthdir_y(-10, direction + 90), obj_en_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + bull = instance_create(x, y + lengthdir_y(10, direction + 90), obj_en_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + + if (class != "Ravager") { + bull = instance_create(x, y + lengthdir_y(30, direction + 90), obj_en_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; } } - if (wep="Gauss Particle Whip"){whip=15; - if (target.shields>0) then target.shields-=dam; - if (target.shields<=0) then target.hp-=dam; + + if (wep == "Lightning Arc") { + lightning = 10; + if (target.shields > 0) { + if ((class == "Cairn Class") || (class == "Reaper Class")) { + target.shields -= 20; + } else { + target.shields -= 20; + } + } + if (target.shields <= 0) { + if ((class == "Cairn Class") || (class == "Reaper Class")) { + target.hp -= 10; + } else { + target.hp -= 10; + } + } } - if (wep="Star Pulse Generator") and (ok=3) and (instance_exists(target)){ - bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_en_pulse); - bull.speed=20; - if (targe=target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); - if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} - bull.target_x=target.x;bull.target_y=target.y; + if (wep == "Gauss Particle Whip") { + whip = 15; + if (target.shields > 0) { + target.shields -= dam; + } + if (target.shields <= 0) { + target.hp -= dam; + } } - - - - if ((string_count("Claws",wep)=1) or (string_count("endrils",wep)=1)) and (ok=3){ - if (target.shields<=0) then target.hp-=weapon_dam[wep]; - if (target.shields>0) then target.shields-=weapon_dam[wep]; + if ((wep == "Star Pulse Generator") && (ok == 3) && instance_exists(target)) { + bull = instance_create(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), obj_en_pulse); + bull.speed = 20; + if (targe == target) { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); + } + if (facing != "front") { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); + } + bull.target_x = target.x; + bull.target_y = target.y; } - if ((string_count("Interceptor",wep)=1) or (string_count("ommerz",wep)=1) or (string_count("Manta",wep)=1) or (string_count("Glands",wep)=1) or (string_count("Eldar Launch",wep)=1)) and (ok=3){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_in);bull.direction=self.direction;bull.owner=self.owner; + + if (((string_count("Claws", wep) == 1) || (string_count("endrils", wep) == 1)) && (ok == 3)) { + if (target.shields <= 0) { + target.hp -= weapon_dam[wep]; + } + if (target.shields > 0) { + target.shields -= weapon_dam[wep]; + } + } + if (((string_count("Interceptor", wep) == 1) || (string_count("ommerz", wep) == 1) || (string_count("Manta", wep) == 1) || (string_count("Glands", wep) == 1) || (string_count("Eldar Launch", wep) == 1)) && (ok == 3)) { + bull = instance_create(x, y + lengthdir_y(-30, direction + 90), obj_en_in); + bull.direction = self.direction; + bull.owner = self.owner; } } } } -/* */ + /* */ } __b__ = action_if_variable(owner, 6, 0); -if __b__ -{ - image_angle=direction; - - if (obj_fleet.start!=5) then exit; - - var o_dist, dist, ch_rang, ex, spid;spid=0; - - if (shields>0) and (shields 0) && (shields < maxshields)) { + shields += 0.03; + } + // Need to every couple of seconds check this // with obj_en_ship if not big then disable, check nearest, and activate once more - if (instance_exists(obj_p_ship)) then target=instance_nearest(x,y,obj_p_ship); - - if (hp<=0){ - var wh,gud;wh=0;gud=0; - repeat(5){wh+=1;if (obj_fleet.enemy[wh]=owner) then gud=wh;} - - if (size=3) then obj_fleet.en_capital_lost[gud]+=1; - if (size=2) then obj_fleet.en_frigate_lost[gud]+=1; - if (size=1) then obj_fleet.en_escort_lost[gud]+=1; - - image_alpha=0.5; - + if (instance_exists(obj_p_ship)) { + target = instance_nearest(x, y, obj_p_ship); + } + + if (hp <= 0) { + var wh, gud; + wh = 0; + gud = 0; + repeat (5) { + wh += 1; + if (obj_fleet.enemy[wh] == owner) { + gud = wh; + } + } + + if (size == 3) { + obj_fleet.en_capital_lost[gud] += 1; + } + if (size == 2) { + obj_fleet.en_frigate_lost[gud] += 1; + } + if (size == 1) { + obj_fleet.en_escort_lost[gud] += 1; + } + + image_alpha = 0.5; + // ex=instance_create(x,y,obj_explosion); // ex.image_xscale=2;ex.image_yscale=2;ex.image_speed=0.75; - var husk;husk=instance_create(x,y,obj_en_husk); - husk.sprite_index=sprite_index;husk.direction=direction; - husk.image_angle=image_angle;husk.depth=depth;husk.image_speed=0; - repeat(choose(4,5,6)){ - var explo;explo=instance_create(x,y,obj_explosion); - explo.image_xscale=0.5;explo.image_yscale=0.5; - explo.x+=random_range(sprite_width*0.25,sprite_width*-0.25); - explo.y+=random_range(sprite_width*0.25,sprite_width*-0.25); - } - + var husk; + husk = instance_create(x, y, obj_en_husk); + husk.sprite_index = sprite_index; + husk.direction = direction; + husk.image_angle = image_angle; + husk.depth = depth; + husk.image_speed = 0; + repeat (choose(4, 5, 6)) { + var explo; + explo = instance_create(x, y, obj_explosion); + explo.image_xscale = 0.5; + explo.image_yscale = 0.5; + explo.x += random_range(sprite_width * 0.25, sprite_width * -0.25); + explo.y += random_range(sprite_width * 0.25, sprite_width * -0.25); + } + instance_destroy(); } - - if (hp>0) and (instance_exists(obj_p_ship)){ - if (class="Void Stalker"){o_dist=300;action="swoop";spid=60;} - if (class="Shadow Class"){o_dist=200;action="swoop";spid=80;} - if (class="Hellebore") or (class="Aconite"){o_dist=200;action="swoop";spid=100;} - - dist=point_distance(x,y,target.x,target.y)-(max(sprite_get_width(target.sprite_index),sprite_get_height(sprite_index))); - - - - - - - - if (target!=0){ - if (speed<((spid)/10)) then speed+=0.02; - + + if ((hp > 0) && instance_exists(obj_p_ship)) { + if (class == "Void Stalker") { + o_dist = 300; + action = "swoop"; + spid = 60; + } + if (class == "Shadow Class") { + o_dist = 200; + action = "swoop"; + spid = 80; + } + if ((class == "Hellebore") || (class == "Aconite")) { + o_dist = 200; + action = "swoop"; + spid = 100; + } + + dist = point_distance(x, y, target.x, target.y) - max(sprite_get_width(target.sprite_index), sprite_get_height(sprite_index)); + + if (target != 0) { + if (speed < (spid / 10)) { + speed += 0.02; + } + var dist, range; - if (instance_exists(target)){ - dist=point_distance(x,y,target.x,target.y); - - if (action="swoop"){direction=turn_towards_point(direction,x,y,target.x,target.y,5-ship_size);} - if (dist<=o_dist) and (collision_line(x,y,x+lengthdir_x(o_dist,direction),y+lengthdir_y(o_dist,direction),obj_p_ship,0,1)) then action="attack"; - if (dist<300) and (action="attack") then action="bank"; - if (action="bank") then direction=turn_towards_point(direction,x,y,room_width,room_height/2,5-ship_size); - if (action="bank") and (dist>700) then action="attack"; - } - } - - - if (y<-2000) or (y>room_height+2000) or (x<-2000) or (x>room_width+2000) then hp=-50; - - - if (cooldown[1]>0) then cooldown[1]-=1; - if (cooldown[2]>0) then cooldown[2]-=1; - if (cooldown[3]>0) then cooldown[3]-=1; - if (cooldown[4]>0) then cooldown[4]-=1; - if (cooldown[5]>0) then cooldown[5]-=1; - if (turret_cool>0) then turret_cool-=1; - - + if (instance_exists(target)) { + dist = point_distance(x, y, target.x, target.y); + + if (action == "swoop") { + direction = turn_towards_point(direction, x, y, target.x, target.y, 5 - ship_size); + } + if ((dist <= o_dist) && collision_line(x, y, x + lengthdir_x(o_dist, direction), y + lengthdir_y(o_dist, direction), obj_p_ship, 0, 1)) { + action = "attack"; + } + if ((dist < 300) && (action == "attack")) { + action = "bank"; + } + if (action == "bank") { + direction = turn_towards_point(direction, x, y, room_width, room_height / 2, 5 - ship_size); + } + if ((action == "bank") && (dist > 700)) { + action = "attack"; + } + } + } + + if ((y < -2000) || (y > room_height + 2000) || (x < -2000) || (x > room_width + 2000)) { + hp = -50; + } + + if (cooldown[1] > 0) { + cooldown[1] -= 1; + } + if (cooldown[2] > 0) { + cooldown[2] -= 1; + } + if (cooldown[3] > 0) { + cooldown[3] -= 1; + } + if (cooldown[4] > 0) { + cooldown[4] -= 1; + } + if (cooldown[5] > 0) { + cooldown[5] -= 1; + } + if (turret_cool > 0) { + turret_cool -= 1; + } + var bull, targe, rdir, dirr, dist, xx, yy, ok; - targe=0;rdir=0;dirr="";dist=9999;xx=x;yy=y; - - - if (turrets>0) and (instance_exists(obj_p_small)) and (turret_cool=0){ - targe=instance_nearest(x,y,obj_p_small); - if (instance_exists(targe)) then dist=point_distance(x,y,targe.x,targe.y); - - if (dist>64) and (dist<300){ - bull=instance_create(x,y,obj_en_round);bull.direction=point_direction(x,y,targe.x,targe.y); - if (owner = eFACTION.Tyranids) then bull.sprite_index=spr_glob; - if (owner = eFACTION.Tau) or (owner = eFACTION.Eldar) then bull.sprite_index=spr_pulse; - bull.speed=20;bull.dam=3;bull.image_xscale=0.5;bull.image_yscale=0.5;turret_cool=floor(60/turrets); - bull.direction+=choose(random(10),1*-(random(10))); - } - } - targe=0;rdir=0;dirr="";dist=9999; - - - xx=lengthdir_x(64,direction+90); - yy=lengthdir_y(64,direction+90); - + targe = 0; + rdir = 0; + dirr = ""; + dist = 9999; + xx = x; + yy = y; + + if ((turrets > 0) && instance_exists(obj_p_small) && (turret_cool == 0)) { + targe = instance_nearest(x, y, obj_p_small); + if (instance_exists(targe)) { + dist = point_distance(x, y, targe.x, targe.y); + } + + if ((dist > 64) && (dist < 300)) { + bull = instance_create(x, y, obj_en_round); + bull.direction = point_direction(x, y, targe.x, targe.y); + if (owner == eFACTION.Tyranids) { + bull.sprite_index = spr_glob; + } + if ((owner == eFACTION.Tau) || (owner == eFACTION.Eldar)) { + bull.sprite_index = spr_pulse; + } + bull.speed = 20; + bull.dam = 3; + bull.image_xscale = 0.5; + bull.image_yscale = 0.5; + turret_cool = floor(60 / turrets); + bull.direction += choose(random(10), 1 * -random(10)); + } + } + targe = 0; + rdir = 0; + dirr = ""; + dist = 9999; + + xx = lengthdir_x(64, direction + 90); + yy = lengthdir_y(64, direction + 90); + var front, right, left, rear; - front=0;right=0;left=0;rear=0; - - targe=instance_nearest(xx,yy,obj_p_ship); - rdir=point_direction(x,y,target.x,target.y); + front = 0; + right = 0; + left = 0; + rear = 0; + + targe = instance_nearest(xx, yy, obj_p_ship); + rdir = point_direction(x, y, target.x, target.y); // if (rdir>45) and (rdir<=135) and (targe!=target){target_r=targe;right=1;} - // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} - target_l=instance_nearest(x+lengthdir_x(64,direction+90),y+lengthdir_y(64,direction+90),obj_p_ship); - target_r=instance_nearest(x+lengthdir_x(64,direction+270),y+lengthdir_y(64,direction+270),obj_p_ship); - - if (collision_line(x,y,x+lengthdir_x(2000,direction),y+lengthdir_y(2000,direction),obj_p_ship,0,1)) then front=1; - - - var f, facing, ammo, range, wep, dam, gg;f=0;facing="";ammo=0;range=0;wep="";dam=0;gg=0; - - - repeat(weapons){ - gg+=1; - - ok=0;f+=1;facing="";ammo=0;range=0;wep=""; - + // if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} + target_l = instance_nearest(x + lengthdir_x(64, direction + 90), y + lengthdir_y(64, direction + 90), obj_p_ship); + target_r = instance_nearest(x + lengthdir_x(64, direction + 270), y + lengthdir_y(64, direction + 270), obj_p_ship); + + if (collision_line(x, y, x + lengthdir_x(2000, direction), y + lengthdir_y(2000, direction), obj_p_ship, 0, 1)) { + front = 1; + } + + var f, facing, ammo, range, wep, dam, gg; + f = 0; + facing = ""; + ammo = 0; + range = 0; + wep = ""; + dam = 0; + gg = 0; + + repeat (weapons) { + gg += 1; + + ok = 0; + f += 1; + facing = ""; + ammo = 0; + range = 0; + wep = ""; + //weapon[gg]=0;weapon_ammo[gg]=0;weapon_range[gg]=0; - - - if (cooldown[gg]<=0) and (weapon[gg]!="") and (weapon_ammo[gg]>0) then ok=1; - if (ok=1){ - facing=weapon_facing[gg];ammo=weapon_ammo[gg];range=weapon_range[gg];} - - targe=target; - if (facing="front") and (front=1) then ok=2; - if (facing="most") then ok=2; - - + + if ((cooldown[gg] <= 0) && (weapon[gg] != "") && (weapon_ammo[gg] > 0)) { + ok = 1; + } + if (ok == 1) { + facing = weapon_facing[gg]; + ammo = weapon_ammo[gg]; + range = weapon_range[gg]; + } + + targe = target; + if ((facing == "front") && (front == 1)) { + ok = 2; + } + if (facing == "most") { + ok = 2; + } + /* if (facing="right") then targe=target_r; if (facing="left") then targe=target_l; @@ -461,68 +818,140 @@ if __b__ if (facing="right") or (facing="most") and (right=1) then ok=2; if (facing="left") or (facing="most") and (left=1) then ok=2; */ - if (facing="special") then ok=2; - if (!instance_exists(targe)) then exit; - dist=point_distance(x,y,targe.x,targe.y); - - if (facing="right") and (point_direction(x,y,target_r.x,target_r.y)<337) and (point_direction(x,y,target_r.x,target_r.y)>203) then ok=2; - if (facing="left") and (point_direction(x,y,target_r.x,target_r.y)>22) and (point_direction(x,y,target_r.x,target_r.y)<157) then ok=2; - + if (facing == "special") { + ok = 2; + } + if (!instance_exists(targe)) { + exit; + } + dist = point_distance(x, y, targe.x, targe.y); + + if ((facing == "right") && (point_direction(x, y, target_r.x, target_r.y) < 337) && (point_direction(x, y, target_r.x, target_r.y) > 203)) { + ok = 2; + } + if ((facing == "left") && (point_direction(x, y, target_r.x, target_r.y) > 22) && (point_direction(x, y, target_r.x, target_r.y) < 157)) { + ok = 2; + } + /*var re_deh;re_deh=relative_direction(direction,target.direction); if (re_deh<45) or (re_deh>315) or ((re_deh>135) and (re_deh<225)) then direction=turn_towards_point(direction,x+lengthdir_x(128,target.direction-90),y,target.x,target.y+lengthdir_y(128,target.direction-90),.2) */ - - - - if (ok=2) and (dist<(range+(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))))){ - if (ammo>0) and (ammo<900) then ammo-=1; - weapon_ammo[gg]=ammo;cooldown[gg]=weapon_cooldown[gg];wep=weapon[gg];dam=weapon_dam[gg]; - + + if ((ok == 2) && (dist < (range + max(sprite_get_width(sprite_index), sprite_get_height(sprite_index))))) { + if ((ammo > 0) && (ammo < 900)) { + ammo -= 1; + } + weapon_ammo[gg] = ammo; + cooldown[gg] = weapon_cooldown[gg]; + wep = weapon[gg]; + dam = weapon_dam[gg]; + // if (f=3) and (ship_id=2) then show_message("ammo: "+string(ammo)+" | range: "+string(range)); - - if (ammo<0) then ok=0; - ok=3; - - if (string_count("orpedo",wep)=0) and (string_count("Interceptor",wep)=0) and (string_count("ommerz",wep)=0) and (string_count("Claws",wep)=0) and (string_count("endrils",wep)=0) and (ok=3){ - bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_en_round); - bull.speed=20;bull.dam=dam; - if (targe=target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); - if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} - if (string_count("ova",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("eavy Gunz",wep)=1){bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Lance",wep)=1){bull.sprite_index=spr_ground_las;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Ion",wep)=1){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Rail",wep)=1){bull.sprite_index=spr_railgun;bull.image_xscale=1.5;bull.image_yscale=1.5;} - if (string_count("Gravitic",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("Plasma",wep)=1){bull.sprite_index=spr_ground_plasma;bull.image_xscale=2;bullimage_yscale=2;bull.speed=15;} - if (string_count("Pyro-Acid",wep)=1){bull.sprite_index=spr_glob;bull.image_xscale=2;bullimage_yscale=2;} - - if (string_count("Weapons",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_ground_las;bull.image_xscale=2;bull.image_yscale=2;} - if (string_count("Pulse",wep)=1) and (owner = eFACTION.Eldar){bull.sprite_index=spr_pulse;bull.image_xscale=1.5;bull.image_yscale=1.5;} - + + if (ammo < 0) { + ok = 0; + } + ok = 3; + + if ((string_count("orpedo", wep) == 0) && (string_count("Interceptor", wep) == 0) && (string_count("ommerz", wep) == 0) && (string_count("Claws", wep) == 0) && (string_count("endrils", wep) == 0) && (ok == 3)) { + bull = instance_create(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), obj_en_round); + bull.speed = 20; + bull.dam = dam; + if (targe == target) { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); + } + if (facing != "front") { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); + } + if (string_count("ova", wep) == 1) { + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if (string_count("eavy Gunz", wep) == 1) { + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Lance", wep) == 1) { + bull.sprite_index = spr_ground_las; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Ion", wep) == 1) { + bull.sprite_index = spr_pulse; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Rail", wep) == 1) { + bull.sprite_index = spr_railgun; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } + if (string_count("Gravitic", wep) == 1) { + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if (string_count("Plasma", wep) == 1) { + bull.sprite_index = spr_ground_plasma; + bull.image_xscale = 2; + bullimage_yscale = 2; + bull.speed = 15; + } + if (string_count("Pyro-Acid", wep) == 1) { + bull.sprite_index = spr_glob; + bull.image_xscale = 2; + bullimage_yscale = 2; + } + + if ((string_count("Weapons", wep) == 1) && (owner == eFACTION.Eldar)) { + bull.sprite_index = spr_ground_las; + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if ((string_count("Pulse", wep) == 1) && (owner == eFACTION.Eldar)) { + bull.sprite_index = spr_pulse; + bull.image_xscale = 1.5; + bull.image_yscale = 1.5; + } } - if (string_count("orpedo",wep)=1) and (ok=3){ - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - } - bull=instance_create(x,y+lengthdir_y(-10,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - bull=instance_create(x,y+lengthdir_y(10,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - - if (class!="Ravager"){ - bull=instance_create(x,y+lengthdir_y(30,direction+90),obj_en_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; - } - + if ((string_count("orpedo", wep) == 1) && (ok == 3)) { + if (class != "Ravager") { + bull = instance_create(x, y + lengthdir_y(-30, direction + 90), obj_en_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + } + bull = instance_create(x, y + lengthdir_y(-10, direction + 90), obj_en_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + bull = instance_create(x, y + lengthdir_y(10, direction + 90), obj_en_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + + if (class != "Ravager") { + bull = instance_create(x, y + lengthdir_y(30, direction + 90), obj_en_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + } } - if ((string_count("Claws",wep)=1) or (string_count("endrils",wep)=1)) and (ok=3){ - if (target.shields<=0) then target.hp-=weapon_dam[wep]; - if (target.shields>0) then target.shields-=weapon_dam[wep]; + if (((string_count("Claws", wep) == 1) || (string_count("endrils", wep) == 1)) && (ok == 3)) { + if (target.shields <= 0) { + target.hp -= weapon_dam[wep]; + } + if (target.shields > 0) { + target.shields -= weapon_dam[wep]; + } } - if ((string_count("Interceptor",wep)=1) or (string_count("ommerz",wep)=1) or (string_count("Manta",wep)=1) or (string_count("Glands",wep)=1) or (string_count("Eldar Launch",wep)=1)) and (ok=3){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_en_in);bull.direction=self.direction;bull.owner=self.owner; + if (((string_count("Interceptor", wep) == 1) || (string_count("ommerz", wep) == 1) || (string_count("Manta", wep) == 1) || (string_count("Glands", wep) == 1) || (string_count("Eldar Launch", wep) == 1)) && (ok == 3)) { + bull = instance_create(x, y + lengthdir_y(-30, direction + 90), obj_en_in); + bull.direction = self.direction; + bull.owner = self.owner; } } } diff --git a/objects/obj_mass_equip/Create_0.gml b/objects/obj_mass_equip/Create_0.gml index 6d290e7d66..7626e9aa05 100644 --- a/objects/obj_mass_equip/Create_0.gml +++ b/objects/obj_mass_equip/Create_0.gml @@ -1,46 +1,44 @@ +tab = -1; +role = obj_controller.settings; +refresh = true; +engage = false; -tab=-1; -role=obj_controller.settings; -refresh=true; -engage=false; - -total_role_number=0; -total_roles=""; +total_role_number = 0; +total_roles = ""; role_number = []; -armour_equip=""; -wep1_equip=""; -wep2_equip=""; -mobi_equip=""; -gear_equip=""; -all_equip=""; +armour_equip = ""; +wep1_equip = ""; +wep2_equip = ""; +mobi_equip = ""; +gear_equip = ""; +all_equip = ""; -req_armour=""; -req_armour_num=0; -have_armour_num=0; +req_armour = ""; +req_armour_num = 0; +have_armour_num = 0; -req_wep1=""; -req_wep1_num=0; -have_wep1_num=0; +req_wep1 = ""; +req_wep1_num = 0; +have_wep1_num = 0; -req_wep2=""; -req_wep2_num=0; -have_wep2_num=0; +req_wep2 = ""; +req_wep2_num = 0; +have_wep2_num = 0; -req_gear=""; -req_gear_num=0; -have_gear_num=0; +req_gear = ""; +req_gear_num = 0; +have_gear_num = 0; -req_mobi=""; -req_mobi_num=0; -have_mobi_num=0; +req_mobi = ""; +req_mobi_num = 0; +have_mobi_num = 0; -good1=0; -good2=0; -good3=0; -good4=0; -good5=0; +good1 = 0; +good2 = 0; +good3 = 0; +good4 = 0; +good5 = 0; item_name = []; - diff --git a/objects/obj_mass_equip/Draw_0.gml b/objects/obj_mass_equip/Draw_0.gml index 01b0963cbb..dc586e618e 100644 --- a/objects/obj_mass_equip/Draw_0.gml +++ b/objects/obj_mass_equip/Draw_0.gml @@ -1,65 +1,108 @@ +var xx, yy; +xx = __view_get(e__VW.XView, 0) + 0; +yy = __view_get(e__VW.YView, 0) + 0; -var xx,yy; -xx=__view_get( e__VW.XView, 0 )+0; -yy=__view_get( e__VW.YView, 0 )+0; - -if (total_role_number>0){ +if (total_role_number > 0) { draw_set_color(c_gray); draw_set_halign(fa_left); draw_set_font(fnt_40k_30b); draw_set_alpha(1); - - draw_text_ext_transformed(xx+107,yy+160,string_hash_to_newline(string(total_roles)),-1,471*1.66,0.6,0.6,0); - - - draw_text_ext_transformed(xx+107,yy+190+(string_height_ext(string_hash_to_newline(total_roles),-1,471*1.66)*0.6),string_hash_to_newline(string(all_equip)),-1,471*1.66,0.6,0.6,0); - - + + draw_text_ext_transformed(xx + 107, yy + 160, string_hash_to_newline(string(total_roles)), -1, 471 * 1.66, 0.6, 0.6, 0); + + draw_text_ext_transformed(xx + 107, yy + 190 + (string_height_ext(string_hash_to_newline(total_roles), -1, 471 * 1.66) * 0.6), string_hash_to_newline(string(all_equip)), -1, 471 * 1.66, 0.6, 0.6, 0); + draw_set_alpha(1); - if (good1+good2+good3+good4+good5!=5) then draw_set_alpha(0.5);draw_set_font(fnt_40k_14b); - draw_set_halign(fa_center);draw_set_color(c_gray); - draw_rectangle(xx+114,yy+626,xx+560,yy+665,0); - draw_set_color(0);draw_text(xx+333,yy+636,string_hash_to_newline("Requip All "+string(obj_ini.role[100,role])+" With Default Items")); - if (scr_hit(xx+114,yy+626,xx+560,yy+665)=true){ - draw_set_color(c_white);draw_set_alpha(0.2);if (good1+good2+good3+good4+good5!=5) then draw_set_alpha(0.1); - draw_rectangle(xx+114,yy+626,xx+560,yy+665,0);draw_set_alpha(1); - if (scr_click_left()) and (good1+good2+good3+good4+good5=5){ - engage=true;refresh=true; - effect_create_depth(-15000,ef_firework,xx+800,yy+400,5,c_yellow); - } - }draw_set_alpha(1); - - draw_set_font(fnt_40k_30b);draw_set_halign(fa_left); - - if (req_wep1!=""){ - draw_set_color(c_gray);if (req_wep1_num>have_wep1_num) then draw_set_color(c_red); - if (req_wep1_num>have_wep1_num) then draw_text_transformed(xx+154,yy+670,string_hash_to_newline("-Not enough "+string(req_wep1)+" (Have "+string(have_wep1_num)+", Need "+string(req_wep1_num)+")"),0.6,0.6,0); - if (req_wep1_num<=have_wep1_num) then draw_text_transformed(xx+154,yy+670,string_hash_to_newline("-"+string(req_wep1)+" (Have "+string(have_wep1_num)+", Need "+string(req_wep1_num)+")"),0.6,0.6,0); + if (good1 + good2 + good3 + good4 + good5 != 5) { + draw_set_alpha(0.5); } - if (req_wep2!=""){ - draw_set_color(c_gray);if (req_wep2_num>have_wep2_num) then draw_set_color(c_red); - if (req_wep2_num>have_wep2_num) then draw_text_transformed(xx+154,yy+698,string_hash_to_newline("-Not enough "+string(req_wep2)+" (Have "+string(have_wep2_num)+", Need "+string(req_wep2_num)+")"),0.6,0.6,0); - if (req_wep2_num<=have_wep2_num) then draw_text_transformed(xx+154,yy+698,string_hash_to_newline("-"+string(req_wep2)+" (Have "+string(have_wep2_num)+", Need "+string(req_wep2_num)+")"),0.6,0.6,0); + draw_set_font(fnt_40k_14b); + draw_set_halign(fa_center); + draw_set_color(c_gray); + draw_rectangle(xx + 114, yy + 626, xx + 560, yy + 665, 0); + draw_set_color(0); + draw_text(xx + 333, yy + 636, string_hash_to_newline("Requip All " + string(obj_ini.role[100][role]) + " With Default Items")); + if (scr_hit(xx + 114, yy + 626, xx + 560, yy + 665) == true) { + draw_set_color(c_white); + draw_set_alpha(0.2); + if (good1 + good2 + good3 + good4 + good5 != 5) { + draw_set_alpha(0.1); + } + draw_rectangle(xx + 114, yy + 626, xx + 560, yy + 665, 0); + draw_set_alpha(1); + if (scr_click_left() && (good1 + good2 + good3 + good4 + good5 == 5)) { + engage = true; + refresh = true; + effect_create_depth(-15000, ef_firework, xx + 800, yy + 400, 5, c_yellow); + } } - if (req_armour!=""){ - draw_set_color(c_gray);if (req_armour_num>have_armour_num) then draw_set_color(c_red); - if (req_armour_num>have_armour_num) then draw_text_transformed(xx+154,yy+726,string_hash_to_newline("-Not enough "+string(req_armour)+" (Have "+string(have_armour_num)+", Need "+string(req_armour_num)+")"),0.6,0.6,0); - if (req_armour_num<=have_armour_num) then draw_text_transformed(xx+154,yy+726,string_hash_to_newline("-"+string(req_armour)+" (Have "+string(have_armour_num)+", Need "+string(req_armour_num)+")"),0.6,0.6,0); + draw_set_alpha(1); + + draw_set_font(fnt_40k_30b); + draw_set_halign(fa_left); + + if (req_wep1 != "") { + draw_set_color(c_gray); + if (req_wep1_num > have_wep1_num) { + draw_set_color(c_red); + } + if (req_wep1_num > have_wep1_num) { + draw_text_transformed(xx + 154, yy + 670, string_hash_to_newline("-Not enough " + string(req_wep1) + " (Have " + string(have_wep1_num) + ", Need " + string(req_wep1_num) + ")"), 0.6, 0.6, 0); + } + if (req_wep1_num <= have_wep1_num) { + draw_text_transformed(xx + 154, yy + 670, string_hash_to_newline("-" + string(req_wep1) + " (Have " + string(have_wep1_num) + ", Need " + string(req_wep1_num) + ")"), 0.6, 0.6, 0); + } } - if (req_gear!=""){ - draw_set_color(c_gray);if (req_gear_num>have_gear_num) then draw_set_color(c_red); - if (req_gear_num>have_gear_num) then draw_text_transformed(xx+154,yy+754,string_hash_to_newline("-Not enough "+string(req_gear)+" (Have "+string(have_gear_num)+", Need "+string(req_gear_num)+")"),0.6,0.6,0); - if (req_gear_num<=have_gear_num) then draw_text_transformed(xx+154,yy+754,string_hash_to_newline("-"+string(req_gear)+" (Have "+string(have_gear_num)+", Need "+string(req_gear_num)+")"),0.6,0.6,0); + if (req_wep2 != "") { + draw_set_color(c_gray); + if (req_wep2_num > have_wep2_num) { + draw_set_color(c_red); + } + if (req_wep2_num > have_wep2_num) { + draw_text_transformed(xx + 154, yy + 698, string_hash_to_newline("-Not enough " + string(req_wep2) + " (Have " + string(have_wep2_num) + ", Need " + string(req_wep2_num) + ")"), 0.6, 0.6, 0); + } + if (req_wep2_num <= have_wep2_num) { + draw_text_transformed(xx + 154, yy + 698, string_hash_to_newline("-" + string(req_wep2) + " (Have " + string(have_wep2_num) + ", Need " + string(req_wep2_num) + ")"), 0.6, 0.6, 0); + } } - if (req_mobi!=""){ - draw_set_color(c_gray);if (req_mobi_num>have_mobi_num) then draw_set_color(c_red); - if (req_mobi_num>have_mobi_num) then draw_text_transformed(xx+154,yy+782,string_hash_to_newline("-Not enough "+string(req_mobi)+" (Have "+string(have_mobi_num)+", Need "+string(req_mobi_num)+")"),0.6,0.6,0); - if (req_mobi_num<=have_mobi_num) then draw_text_transformed(xx+154,yy+782,string_hash_to_newline("-"+string(req_mobi)+" (Have "+string(have_mobi_num)+", Need "+string(req_mobi_num)+")"),0.6,0.6,0); + if (req_armour != "") { + draw_set_color(c_gray); + if (req_armour_num > have_armour_num) { + draw_set_color(c_red); + } + if (req_armour_num > have_armour_num) { + draw_text_transformed(xx + 154, yy + 726, string_hash_to_newline("-Not enough " + string(req_armour) + " (Have " + string(have_armour_num) + ", Need " + string(req_armour_num) + ")"), 0.6, 0.6, 0); + } + if (req_armour_num <= have_armour_num) { + draw_text_transformed(xx + 154, yy + 726, string_hash_to_newline("-" + string(req_armour) + " (Have " + string(have_armour_num) + ", Need " + string(req_armour_num) + ")"), 0.6, 0.6, 0); + } + } + if (req_gear != "") { + draw_set_color(c_gray); + if (req_gear_num > have_gear_num) { + draw_set_color(c_red); + } + if (req_gear_num > have_gear_num) { + draw_text_transformed(xx + 154, yy + 754, string_hash_to_newline("-Not enough " + string(req_gear) + " (Have " + string(have_gear_num) + ", Need " + string(req_gear_num) + ")"), 0.6, 0.6, 0); + } + if (req_gear_num <= have_gear_num) { + draw_text_transformed(xx + 154, yy + 754, string_hash_to_newline("-" + string(req_gear) + " (Have " + string(have_gear_num) + ", Need " + string(req_gear_num) + ")"), 0.6, 0.6, 0); + } + } + if (req_mobi != "") { + draw_set_color(c_gray); + if (req_mobi_num > have_mobi_num) { + draw_set_color(c_red); + } + if (req_mobi_num > have_mobi_num) { + draw_text_transformed(xx + 154, yy + 782, string_hash_to_newline("-Not enough " + string(req_mobi) + " (Have " + string(have_mobi_num) + ", Need " + string(req_mobi_num) + ")"), 0.6, 0.6, 0); + } + if (req_mobi_num <= have_mobi_num) { + draw_text_transformed(xx + 154, yy + 782, string_hash_to_newline("-" + string(req_mobi) + " (Have " + string(have_mobi_num) + ", Need " + string(req_mobi_num) + ")"), 0.6, 0.6, 0); + } } } - - if (total_role_number > 0 && tab > -1) { item_name = []; var infanty_roles = [ @@ -80,26 +123,27 @@ if (total_role_number > 0 && tab > -1) { eROLE.Librarian, eROLE.Sergeant, eROLE.VeteranSergeant, - eROLE.Dreadnought, + eROLE.Dreadnought ]; // hand slots - if ((tab == 0 || tab ==1) && array_get_index(infanty_roles, obj_controller.settings) >= 0) { + if ((tab == 0 || tab == 1) && array_get_index(infanty_roles, obj_controller.settings) >= 0) { // Get all available hand weapons scr_get_item_names( item_name, obj_controller.settings, // eROLE 0, // slot eENGAGEMENT.Any, - true, // include the company standard - false, // do not limit to available items + true, // include the company standard + false, // do not limit to available items + ); scr_get_item_names( item_name, obj_controller.settings, // eROLE 1, // slot - eENGAGEMENT.Any, - false, // include the company standard - false, // do not limit to available items + eENGAGEMENT.Any, + false, // include the company standard + false, // do not limit to available items false, // not only mastercrafted true // put none in the list only once ); @@ -110,67 +154,76 @@ if (total_role_number > 0 && tab > -1) { obj_controller.settings, // eROLE tab, // slot eENGAGEMENT.None, // doesn't matter to non infantry/non hand slots - true, // include the company standard - false, // do not limit to available items + true, // include the company standard + false, // do not limit to available items + ); } - + draw_set_color(0); draw_rectangle(xx + 1183, yy + 160, xx + 1506, yy + 747, 0); - + draw_set_color(c_gray); draw_rectangle(xx + 1184, yy + 161, xx + 1505, yy + 746, 1); draw_rectangle(xx + 1185, yy + 162, xx + 1504, yy + 745, 1); draw_rectangle(xx + 1186, yy + 163, xx + 1503, yy + 744, 1); - + draw_set_font(fnt_40k_30b); var slot_name = get_slot_name(obj_controller.settings, tab); draw_text_transformed(xx + 1203, yy + 174, string_hash_to_newline($"Select {slot_name}"), 0.6, 0.6, 0); draw_set_font(fnt_40k_14b); - + var x3 = xx + 1205; // Starting x position for the first column var y3 = yy + 205; // Starting y position var space = 18; // Amount to move down for each item var items_per_column = 24; var column_width = 146; var column_gap = 3; - + for (var h = 0; h < array_length(item_name); h++) { if (h > 0 && h % items_per_column == 0) { x3 += column_width; y3 = yy + 205; } - + draw_set_color(c_gray); var scale = string_width(string_hash_to_newline(item_name[h])) >= 140 ? 0.75 : 1; draw_text_transformed(x3, y3, string_hash_to_newline(item_name[h]), scale, 1, 0); - + // keep track of the item's bottom right corner var item_x2 = x3 + (column_width - column_gap); var item_y2 = y3 + space - 1; - + if (scr_hit(x3, y3, item_x2, item_y2)) { draw_set_color(c_white); draw_set_alpha(0.2); draw_text_transformed(x3, y3, string_hash_to_newline(item_name[h]), scale, 1, 0); draw_set_alpha(1); - + if (scr_click_left()) { var buh = item_name[h] == ITEM_NAME_NONE ? "" : item_name[h]; - + switch (tab) { // slots - case 0: obj_ini.wep1[100, role] = buh; break; - case 1: obj_ini.wep2[100, role] = buh; break; + case 0: + obj_ini.wep1[100][role] = buh; + break; + case 1: + obj_ini.wep2[100][role] = buh; + break; case 2: - obj_ini.armour[100, role] = buh; + obj_ini.armour[100][role] = buh; // No bikes or jump packs for Terminators if (array_contains(LIST_TERMINATOR_ARMOUR, buh) || buh == STR_ANY_TERMINATOR_ARMOUR) { - obj_ini.mobi[100, role] = ""; + obj_ini.mobi[100][role] = ""; } break; - case 3: obj_ini.gear[100, role] = buh; break; - case 4: obj_ini.mobi[100, role] = buh; break; + case 3: + obj_ini.gear[100][role] = buh; + break; + case 4: + obj_ini.mobi[100][role] = buh; + break; } tab = -1; refresh = true; @@ -178,7 +231,7 @@ if (total_role_number > 0 && tab > -1) { } y3 += space; } - + draw_set_halign(fa_center); draw_set_font(fnt_40k_14b); draw_set_color(c_gray); @@ -197,6 +250,5 @@ if (total_role_number > 0 && tab > -1) { draw_set_alpha(1); } - /* */ /* */ diff --git a/objects/obj_mass_equip/Step_0.gml b/objects/obj_mass_equip/Step_0.gml index 5decb6ad81..8688569b1e 100644 --- a/objects/obj_mass_equip/Step_0.gml +++ b/objects/obj_mass_equip/Step_0.gml @@ -2,29 +2,34 @@ try { if ((obj_controller.settings == 0) || (obj_controller.menu != 23)) { instance_destroy(); } - + var romanNumerals = scr_roman_numerals(); var unit; var unit_armour, complete; - + if (engage == true) { for (var co = 0; co <= obj_ini.companies; co++) { var i = 0; if (role_number[co] > 0) { for (i = 0; i < array_length(obj_ini.role[co]); i++) { - if (obj_ini.role[co][i] == obj_ini.role[100, role]) { - unit = fetch_unit([co, i]); + if (obj_ini.role[co][i] == obj_ini.role[100][role]) { + unit = fetch_unit( + [ + co, + i + ] + ); if (unit.squad != "none") { var _squad = fetch_squad(unit.squad); if (!_squad.allow_bulk_swap) { continue; } } - + // ** Start Armour ** var unit_armour = unit.get_armour_data(); var has_valid_armour = is_struct(unit_armour); - + // Check if unit_armour is a struct and evaluate tag-based or name-based compatibility if (has_valid_armour) { switch (req_armour) { @@ -38,21 +43,21 @@ try { has_valid_armour = req_armour == unit_armour.name; } } - + // Attempt to equip if not valid if (!has_valid_armour) { var result = unit.update_armour(req_armour); - + // Fallback: If request was for Power Armour but update failed, try Terminator if (result != "complete" && req_armour == STR_ANY_POWER_ARMOUR) { unit.update_armour(STR_ANY_TERMINATOR_ARMOUR); } - + // Refresh unit_armour after update unit_armour = unit.get_armour_data(); } // ** End Armour ** - + // ** Start Weapons ** if (unit.weapon_one() != req_wep1) { if (is_string(unit.weapon_one(true))) { @@ -72,11 +77,20 @@ try { if (is_string(unit.gear(true))) { unit.update_gear(req_gear); } - + // ** Start Mobility Items ** if (unit.mobility_item() != req_mobi) { var stop_mobi = false; - if (is_struct(unit_armour) && unit_armour.has_tags(["terminator", "dreadnought"])) { + if ( + is_struct(unit_armour) + && unit_armour + .has_tags( + [ + "terminator", + "dreadnought" + ] + ) + ) { unit.update_mobility_item(""); } else { unit.update_mobility_item(req_mobi); @@ -92,7 +106,7 @@ try { } engage = false; } - + // ** Refreshing ** if ((refresh == true) && (obj_controller.settings > 0)) { total_role_number = 0; @@ -100,9 +114,9 @@ try { for (var i = 0; i < 11; i++) { role_number[i] = 0; } - + var _total_role_gear = new CountingMap(); - + all_equip = ""; req_armour = ""; req_armour_num = 0; @@ -124,18 +138,18 @@ try { good3 = 0; good4 = 0; good5 = 0; - - req_armour = obj_ini.armour[100, role]; - req_wep1 = obj_ini.wep1[100, role]; - req_wep2 = obj_ini.wep2[100, role]; - req_gear = obj_ini.gear[100, role]; - req_mobi = obj_ini.mobi[100, role]; - + + req_armour = obj_ini.armour[100][role]; + req_wep1 = obj_ini.wep1[100][role]; + req_wep2 = obj_ini.wep2[100][role]; + req_gear = obj_ini.gear[100][role]; + req_mobi = obj_ini.mobi[100][role]; + for (var co = 0; co < 11; co++) { for (var i = 0; i < array_length(obj_ini.role[co]); i++) { - if (obj_ini.role[co][i] == obj_ini.role[100, role]) { + if (obj_ini.role[co][i] == obj_ini.role[100][role]) { role_number[co] += 1; - + // Weapon1 var onc = 0; if ((string_count("&", obj_ini.wep1[co][i]) > 0) && (onc == 0)) { @@ -150,7 +164,7 @@ try { have_wep1_num += 1; onc = 1; } - + // Weapon2 onc = 0; if ((string_count("&", obj_ini.wep2[co][i]) > 0) && (onc == 0)) { @@ -165,10 +179,10 @@ try { have_wep2_num += 1; onc = 1; } - + if (req_armour != "") { var yes = false; - + if (req_armour == STR_ANY_POWER_ARMOUR) { if (array_contains(LIST_BASIC_POWER_ARMOUR, obj_ini.armour[co][i])) { yes = true; @@ -178,18 +192,18 @@ try { yes = true; } } - + if (string_count("&", obj_ini.armour[co][i]) > 0) { yes = true; } else if (obj_ini.armour[co][i] == req_armour) { yes = true; } - + if (yes == true) { have_armour_num += 1; } } - + if (req_gear != "") { if (string_count("&", obj_ini.gear[co][i]) == 0) { if (obj_ini.gear[co][i] == req_gear) { @@ -197,7 +211,7 @@ try { } } } - + if (req_mobi != "") { if (string_count("&", obj_ini.mobi[co][i]) == 0) { if (obj_ini.mobi[co][i] == req_mobi) { @@ -206,8 +220,8 @@ try { } } } - - if (obj_ini.role[co][i] == obj_ini.role[100, role]) { + + if (obj_ini.role[co][i] == obj_ini.role[100][role]) { _total_role_gear.add(obj_ini.wep1[co][i]); _total_role_gear.add(obj_ini.wep2[co][i]); _total_role_gear.add(obj_ini.armour[co][i]); @@ -216,10 +230,10 @@ try { } } } - + have_wep1_num += scr_item_count(req_wep1); have_wep2_num += scr_item_count(req_wep2); - + if (req_armour == STR_ANY_POWER_ARMOUR) { for (var g = 0; g < array_length(LIST_BASIC_POWER_ARMOUR); g++) { have_armour_num += scr_item_count(LIST_BASIC_POWER_ARMOUR[g]); @@ -231,12 +245,12 @@ try { } else { have_armour_num += scr_item_count(req_armour); } - + have_gear_num += scr_item_count(req_gear); have_mobi_num += scr_item_count(req_mobi); - + total_role_number = 0; - + for (var i = 0; i < 11; i++) { if (role_number[i] > 0) { req_wep1_num += role_number[i]; @@ -249,21 +263,21 @@ try { } total_roles = ""; if (total_role_number > 0) { - total_roles = $"You currently have {total_role_number}x {obj_ini.role[100, role]} across all companies."; + total_roles = $"You currently have {total_role_number}x {obj_ini.role[100][role]} across all companies."; for (var i = 0; i < 11; i++) { var _company_name = i == 0 ? "HQ" : $"{romanNumerals[i - 1]} Company"; - - if ((role_number[i] > 0)) { + + if (role_number[i] > 0) { total_roles += $" {_company_name}: {role_number[i]};"; } } } - + // Add up messages all_equip = $"In total they are equipped with: {_total_role_gear.get_total_string()}."; - + refresh = false; - + if (tab > -1) { item_name = []; var is_hand_slot = tab == 0 || tab == 1; @@ -274,16 +288,16 @@ try { is_hand_slot ? eENGAGEMENT.Any : eENGAGEMENT.None, true, // include company standard false, // show all regardless of inventory - + ); } - + good1 = 0; good2 = 0; good3 = 0; good4 = 0; good5 = 0; - + if ((req_wep1_num <= have_wep1_num) || (req_wep1 == "")) { good1 = 1; } diff --git a/objects/obj_p1_bullet/Collision_obj_ork.gml b/objects/obj_p1_bullet/Collision_obj_ork.gml index 2fa0fb3de7..72b92b04ea 100644 --- a/objects/obj_p1_bullet/Collision_obj_ork.gml +++ b/objects/obj_p1_bullet/Collision_obj_ork.gml @@ -1,64 +1,108 @@ - -if (sprite_index!=spr_flame2){ - var i,a,t,d;i=0;a=0;t=0;d=0; - repeat(10){i+=1; - if (projectile_damage[i]>0){t=0;a=0; - repeat(41){a+=1; - if (other.enemy[a]=1) and (t=0) then t=a; +if (sprite_index != spr_flame2) { + var i, a, t, d; + i = 0; + a = 0; + t = 0; + d = 0; + repeat (10) { + i += 1; + if (projectile_damage[i] > 0) { + t = 0; + a = 0; + repeat (41) { + a += 1; + if ((other.enemy[a] == 1) && (t == 0)) { + t = a; + } } - - if (t>0){ - if (projectile_arp[i]=-1) then d=(projectile_damage[i]*other.enemy_dr[t])-other.enemy_ac[t]*6; - if (projectile_arp[i]=0) then d=(projectile_damage[i]*other.enemy_dr[t])-other.enemy_ac[t]; - if (projectile_arp[i]=1) then d=projectile_damage[i]*other.enemy_dr[t]; - - if (d<0) then d=0; - if (other.enemy_hp[t]>0) and ((other.enemy_hp[t]-d)<0){ - other.enemy[t]=-1;other.enemies_alive-=1; + + if (t > 0) { + if (projectile_arp[i] == -1) { + d = (projectile_damage[i] * other.enemy_dr[t]) - other.enemy_ac[t] * 6; + } + if (projectile_arp[i] == 0) { + d = (projectile_damage[i] * other.enemy_dr[t]) - other.enemy_ac[t]; + } + if (projectile_arp[i] == 1) { + d = projectile_damage[i] * other.enemy_dr[t]; + } + + if (d < 0) { + d = 0; + } + if ((other.enemy_hp[t] > 0) && ((other.enemy_hp[t] - d) < 0)) { + other.enemy[t] = -1; + other.enemies_alive -= 1; } - other.enemy_hp[t]-=d; - - if (other.enemies_alive=0){ - effect_create_depth(-15000,ef_firework,other.x,other.y,1,c_green); - with(other){instance_destroy();} + other.enemy_hp[t] -= d; + + if (other.enemies_alive == 0) { + effect_create_depth(-15000, ef_firework, other.x, other.y, 1, c_green); + with (other) { + instance_destroy(); + } instance_destroy(); } } - - if (t=0){instance_destroy();exit;} + + if (t == 0) { + instance_destroy(); + exit; + } } } - + instance_destroy(); } - -if (sprite_index=spr_flame2) and (life=5){ - var i,a,t,d;i=0;a=0;t=0;d=0; - repeat(10){i+=1; - if (projectile_damage[i]>0){t=0;a=0; - repeat(41){a+=1; - if (other.enemy[a]=1) and (t=0) then t=a; +if ((sprite_index == spr_flame2) && (life == 5)) { + var i, a, t, d; + i = 0; + a = 0; + t = 0; + d = 0; + repeat (10) { + i += 1; + if (projectile_damage[i] > 0) { + t = 0; + a = 0; + repeat (41) { + a += 1; + if ((other.enemy[a] == 1) && (t == 0)) { + t = a; + } } - if (t>0){ - if (projectile_arp[i]=-1) then d=(projectile_damage[i]*other.enemy_dr[t])-other.enemy_ac[t]*6; - if (projectile_arp[i]=0) then d=(projectile_damage[i]*other.enemy_dr[t])-other.enemy_ac[t]; - if (projectile_arp[i]=1) then d=projectile_damage[i]*other.enemy_dr[t]; - - if (d<0) then d=0; - if (other.enemy_hp[t]>0) and ((other.enemy_hp[t]-d)<0){ - other.enemy[t]=-1;other.enemies_alive-=1; + if (t > 0) { + if (projectile_arp[i] == -1) { + d = (projectile_damage[i] * other.enemy_dr[t]) - other.enemy_ac[t] * 6; + } + if (projectile_arp[i] == 0) { + d = (projectile_damage[i] * other.enemy_dr[t]) - other.enemy_ac[t]; + } + if (projectile_arp[i] == 1) { + d = projectile_damage[i] * other.enemy_dr[t]; + } + + if (d < 0) { + d = 0; } - other.enemy_hp[t]-=d; - - if (other.enemies_alive=0){ - effect_create_depth(-15000,ef_firework,other.x,other.y,1,c_green); - with(other){instance_destroy();} + if ((other.enemy_hp[t] > 0) && ((other.enemy_hp[t] - d) < 0)) { + other.enemy[t] = -1; + other.enemies_alive -= 1; + } + other.enemy_hp[t] -= d; + + if (other.enemies_alive == 0) { + effect_create_depth(-15000, ef_firework, other.x, other.y, 1, c_green); + with (other) { + instance_destroy(); + } } } - - if (t=0){exit;} + + if (t == 0) { + exit; + } } } } - diff --git a/objects/obj_p1_bullet/Create_0.gml b/objects/obj_p1_bullet/Create_0.gml index 69950f2239..e61c9d9033 100644 --- a/objects/obj_p1_bullet/Create_0.gml +++ b/objects/obj_p1_bullet/Create_0.gml @@ -1,13 +1,13 @@ +projectile_infos = 0; +life = 0; +owner = 0; -projectile_infos=0; -life=0; -owner=0; - -var i;i=-1; -repeat(11){i+=1; - projectile_damage[i]=0; - projectile_arp[i]=0; - projectile_splash[i]=0; - projectile_range[i]=0; +var i; +i = -1; +repeat (11) { + i += 1; + projectile_damage[i] = 0; + projectile_arp[i] = 0; + projectile_splash[i] = 0; + projectile_range[i] = 0; } - diff --git a/objects/obj_p1_bullet/Step_0.gml b/objects/obj_p1_bullet/Step_0.gml index 1e2200e092..c5d64eb874 100644 --- a/objects/obj_p1_bullet/Step_0.gml +++ b/objects/obj_p1_bullet/Step_0.gml @@ -1,33 +1,36 @@ +if ((life == 1) && (projectile_infos == 0)) { + instance_destroy(); +} -if (life=1) and (projectile_infos=0) then instance_destroy(); - -life+=1; +life += 1; -if (sprite_index=spr_flame2){ - if (instance_exists(owner)){ - if (owner.x>0) and (owner.x0) and (owner.y 0) && (owner.x < room_width) && (owner.y > 0) && (owner.y < room_height)) { + x = owner.x + 23; + y = owner.y - 24; } } - if (life>8) then instance_destroy(); -} - -if (life=2) and (sprite_index!=spr_flame2){ - var miss;miss=floor(random(100))+1; - - if (miss<=10){ - var rep;rep=instance_create(x,y,obj_p1_bullet_miss); - rep.sprite_index=sprite_index; - rep.image_index=image_index; - rep.image_speed=image_speed; - rep.direction=direction; - rep.speed=speed; + if (life > 8) { instance_destroy(); } } -image_angle=direction; -image_speed=0; +if ((life == 2) && (sprite_index != spr_flame2)) { + var miss; + miss = floor(random(100)) + 1; + if (miss <= 10) { + var rep; + rep = instance_create(x, y, obj_p1_bullet_miss); + rep.sprite_index = sprite_index; + rep.image_index = image_index; + rep.image_speed = image_speed; + rep.direction = direction; + rep.speed = speed; + instance_destroy(); + } +} +image_angle = direction; +image_speed = 0; diff --git a/scripts/__global_object_depths/__global_object_depths.gml b/scripts/__global_object_depths/__global_object_depths.gml index e86da6e7da..2892a12dee 100644 --- a/scripts/__global_object_depths/__global_object_depths.gml +++ b/scripts/__global_object_depths/__global_object_depths.gml @@ -6,7 +6,7 @@ function __global_object_depths() { // Initialise the global array that allows the lookup of the depth of a given object // GM2.0 does not have a depth on objects so on import from 1.x a global array is created // NOTE: MacroExpansion is used to insert the array initialisation at import time - + // insert the generated arrays here global.__objectDepths[0] = -5000; // obj_fleet global.__objectDepths[1] = 0; // obj_circular @@ -96,8 +96,7 @@ function __global_object_depths() { global.__objectDepths[85] = -1; // obj_star_event global.__objectDepths[86] = -999999999; // obj_halp global.__objectDepths[87] = -11; // obj_fleet_show - - + global.__objectNames[0] = "obj_fleet"; global.__objectNames[1] = "obj_circular"; global.__objectNames[2] = "obj_fleet_spawner"; @@ -186,15 +185,14 @@ function __global_object_depths() { global.__objectNames[85] = "obj_star_event"; global.__objectNames[86] = "obj_halp"; global.__objectNames[87] = "obj_fleet_show"; - - + // create another array that has the correct entries var len = array_length(global.__objectDepths); global.__objectID2Depth = []; - for( var i=0; i= 0) { - global.__objectID2Depth[ objID ] = global.__objectDepths[i]; + global.__objectID2Depth[objID] = global.__objectDepths[i]; } // end if } // end for -} \ No newline at end of file +} diff --git a/scripts/object_get_depth/object_get_depth.gml b/scripts/object_get_depth/object_get_depth.gml index e6c4174c56..369392a0b2 100644 --- a/scripts/object_get_depth/object_get_depth.gml +++ b/scripts/object_get_depth/object_get_depth.gml @@ -4,8 +4,8 @@ function object_get_depth(argument0) { var objID = argument0; var ret = 0; - if (objID >= 0) && (objID < array_length(global.__objectID2Depth)) { + if ((objID >= 0) && (objID < array_length(global.__objectID2Depth))) { ret = global.__objectID2Depth[objID]; } // end if return ret; -} \ No newline at end of file +} diff --git a/scripts/scr_Table/scr_Table.gml b/scripts/scr_Table/scr_Table.gml index 267dce2c7a..428684256c 100644 --- a/scripts/scr_Table/scr_Table.gml +++ b/scripts/scr_Table/scr_Table.gml @@ -1,111 +1,112 @@ -function Table(data) constructor{ +function Table(data) constructor { headings = []; row_data = []; standard_loc_data(); row_h = 12; - + column_widths = []; - - set_column_widths = []; - + + set_column_widths = []; + row_key_draw = []; - + halign = fa_center; - + header_h = 0; - + col_spacing = 5; - + move_data_to_current_scope(data); - - static update = function(data){ + + static update = function(data) { move_data_to_current_scope(data); - w = 0; + w = 0; column_widths = []; header_h = 0; - for (var i=0; i0){ + + if (i < array_length(set_column_widths) && set_column_widths[i] > 0) { array_push(column_widths, set_column_widths[i]); - } else{ - if (array_length(column_widths) <= i){ - array_push(column_widths, _heading.w) + } else { + if (array_length(column_widths) <= i) { + array_push(column_widths, _heading.w); } - if (column_widths[i] == 0){ + if (column_widths[i] == 0) { column_widths[i] = _heading.w; } } - - - _heading.update({ - max_width : column_widths[i], - x1 : x1+w +(column_widths[i]/2), - y1 : y1, - halign : halign - }); - - if (_heading.h > header_h){ + + _heading + .update({ + max_width: column_widths[i], + x1: x1 + w + (column_widths[i] / 2), + y1: y1, + halign: halign, + }); + + if (_heading.h > header_h) { header_h = _heading.h; } - + w += column_widths[i] + col_spacing; } - } - - static draw = function(){ + }; + + static draw = function() { add_draw_return_values(); - + draw_set_halign(halign); draw_set_valign(fa_top); - + var _col_draw_x = x1; - for (var i=0;i y2 - row_h){ + if (_row_level > y2 - row_h) { break; } _col_draw_x = x1; var _row = row_data[i]; - var _row_entered = scr_hit_dimensions(_col_draw_x,_row_level,w,row_h); - if (is_array(row_data[i])){ - for (var d=0;d=-10) and (string_count("Eldar",obj_ini.strin)=0){ + log_message("RE: Eldar Mission 1"); + // Need something else here that prevents them from asking missions when they are pissed + + obj_turn_end.audiences+=1;// obj_turn_end.audiences+=1; + obj_turn_end.audience_stack[obj_turn_end.audiences]=6; + + // if (obj_controller.known[eFACTION.Eldar]>2) then obj_turn_end.audien_topic[obj_turn_end.audiences]="mission";// Random mission? + if (obj_controller.known[eFACTION.Eldar]=2){ + scr_audience(eFACTION.Eldar, "mission1", 0, "", 0, 2.2); + scr_quest(0,"fund_elder",6,24); + } + + exit; + } + }*/ + var chosen_event; - var _evented = false; - /*This is some eldar mission, it should be fixed - var rando4=floor(random(200))+1; - if (obj_controller.turns_ignored[6]<=0) and (obj_controller.faction_gender[6]=2) then rando4-=2; - if (obj_controller.turns_ignored[6]<=0) and (rando4<=3) and execute_now and (faction_defeated[6]=0){ - if (obj_controller.known[eFACTION.Eldar]=2) and (obj_controller.disposition[6]>=-10) and (string_count("Eldar",obj_ini.strin)=0){ - log_message("RE: Eldar Mission 1"); - // Need something else here that prevents them from asking missions when they are pissed - - obj_turn_end.audiences+=1;// obj_turn_end.audiences+=1; - obj_turn_end.audience_stack[obj_turn_end.audiences]=6; - - // if (obj_controller.known[eFACTION.Eldar]>2) then obj_turn_end.audien_topic[obj_turn_end.audiences]="mission";// Random mission? - if (obj_controller.known[eFACTION.Eldar]=2){ - scr_audience(eFACTION.Eldar, "mission1", 0, "", 0, 2.2); - scr_quest(0,"fund_elder",6,24); - } - - exit; - } - }*/ - var chosen_event; - - var inquisition_mission_roll = irandom(100); - var force_inquisition_mission = false; - if (((last_mission+50) <= turn) && (inquisition_mission_roll <= 5) && (known[eFACTION.Inquisition] != 0) && (obj_controller.faction_status[eFACTION.Inquisition] != "War")){ - force_inquisition_mission = true; - } - - if (force_inquisition_mission && random_event_next == EVENT.none) { - chosen_event = EVENT.inquisition_mission; - } - else { - if(execute_now) - { - var random_event_roll = irandom(100); - if ((last_event+30)<=turn) then random_event_roll=1;// If 30 turns without random event then do one - if (random_event_roll>5) then exit;// Frequency of events - if ((turn-15)45) and (luck_roll<55) then player_luck=eLUCK.neutral; - if (luck_roll>=55) then player_luck=eLUCK.bad; - - - var events; - if(player_luck == eLUCK.good){ - events = - [ - EVENT.space_hulk, - EVENT.promotion, - EVENT.strange_building, - EVENT.sororitas, - EVENT.rogue_trader, - EVENT.inquisition_mission, - EVENT.inquisition_planet, - EVENT.mechanicus_mission - ]; - } - else if(player_luck == eLUCK.neutral){ - events = - [ - EVENT.strange_behavior, - EVENT.fleet_delay, - EVENT.harlequins, - EVENT.succession_war, - EVENT.random_fun, - ]; - } - else if(player_luck == eLUCK.bad){ - events = - [ - EVENT.warp_storms, - EVENT.enemy_forces, - EVENT.crusade, // Reportly breaks often because of lack of imperial fleets and eats player ships // TODO LOW CRUSADE_EVENT // fix - EVENT.enemy, // Save-scumming event, Should probably base this on something else than tech-scavs - EVENT.mutation, - EVENT.ship_lost, // Another save-scumming event, mainly due to rarity of player ships - //EVENT.chaos_invasion, // Spawns Chaos fleets way too close to player owned worlds with no warning and usually lots of big ships, save-scum galore and encourages fleet-based chapters // TODO LOW INVASION_EVENT // Make them spawn way farther with more warning, make them have a different goal or remove this event entirely - EVENT.necron_awaken, // Inquisitor check for this is inverted - EVENT.fallen, // Event mission cannot be completed and never expires // TODO LOW FALLEN_EVENT // fix - ]; - } - - var events_count = array_length(events); - var events_total = events_count; - var events_share = array_create(events_count, 1); - - for(var i = 0; i < events_count; i++){ - var curr_event = events[i]; - - //DEBUG-INI (EVENTS DEBUG CODE - 1) - //Comment/delete this when not debugging events - //List of possible events above - /*curr_event = EVENT.necron_awaken - events_count = 1 - events_total = events_count; - events_share = array_create(events_count, 1);*/ - //DEBUG-FIN (EVENTS DEBUG CODE - 1) - - switch (curr_event){ - case EVENT.inquisition_planet: - if (known[eFACTION.Inquisition]==0 || obj_controller.faction_status[eFACTION.Inquisition]=="War") { - events_share[i] -= 1; - events_total -= 1; - } - break; - case EVENT.inquisition_mission: - if (known[eFACTION.Inquisition]==0 || obj_controller.disposition[4] < 0 || obj_controller.faction_status[eFACTION.Inquisition] == "War") { - events_share[i] -= 1; - events_total -= 1; - } - break; - case EVENT.mechanicus_mission: - if (known[eFACTION.Mechanicus] == 0 || obj_controller.disposition[3] < 50 || obj_controller.faction_status[eFACTION.Mechanicus] == "War") { - events_share[i] -= 1; - events_total -= 1; - } - else if(scr_has_adv("Tech-Brothers")){ - events_share[i] += 2; - events_total += 2; - } - break; - case EVENT.enemy: - if(scr_has_adv("Scavangers")){ - events_share[i] += 2; - events_total += 2; - } - break; - case EVENT.mutation: - if(gene_seed < 5){ - events_share[i] -= 1; - events_total -= 1; - } - break; - case EVENT.necron_awaken: - if((known[eFACTION.Inquisition] == 0)){ - events_share[i] -= 1; - events_total -= 1; - } - break; - case EVENT.crusade: - if (obj_controller.faction_status[eFACTION.Imperium] == "War"){ - events_share[i] -= 1; - events_total -= 1; - } - break; - case EVENT.fleet_delay: - var has_moving_fleet = false; - with(obj_p_fleet){ - if(action=="move") - { - has_moving_fleet = true; - break; - } - } - if(!has_moving_fleet){ - events_share[i] -= 1; - events_total -= 1; - } - break; - case EVENT.ship_lost: - var has_moving_fleet = false; - with(obj_p_fleet){ - if(action=="move") - { - has_moving_fleet = true; - break; - } - } - if(!has_moving_fleet){ - events_share[i] -= 1; - events_total -= 1; - } - break; - case EVENT.fallen: - if(!scr_has_disadv("Never Forgive")) - { - events_share[i] -= 1; - events_total -= 1; - } - } - } - - chosen_event = irandom(events_total); - for(var i = 0; i < events_count; i++){ - chosen_event -= events_share[i]; - if(chosen_event <= 0) - { - chosen_event = events[i]; - break; - } - } - //DEBUG-INI (EVENTS DEBUG CODE - 2) - //Comment/delete this when not debugging events - //If event on the switch above, (EVENTS DEBUG CODE - 1) var should be set to event too. - /*chosen_event = EVENT.necron_awaken*/ - //DEBUG-FIN (EVENTS DEBUG CODE - 2) - } - } - - if (!execute_now){ - random_event_next = chosen_event; - exit; - } - - if (chosen_event == EVENT.strange_behavior){ - //TODO this event currenlty dose'nt do anything but now we have marine structs there is lots of potential here - init_marine_acting_strange() - _evented=true; - } - - else if (chosen_event == EVENT.space_hulk){ - - log_message("RE: Space Hulk"); - var own=choose(1,1,2); - - var star_id = scr_random_find(own,true,"",""); - if(star_id == undefined && own == 1){ - // find the nearest star to a player fleet and user that one, dukecode did that - // we could also try to find to find another star but this one is owned by the imperium and not the player, this code is doing that - own = 2; - star_id = scr_random_find(own,true,"",""); - } - if(star_id == undefined && own == 2){ - star_id = scr_random_find(0,true,"",""); // try for litteraly any star - } - - if(star_id == undefined){ - log_error("RE: Space Hulk, couldn't find a star for the spacehulk"); - exit; - } - else { - var positionFound = false; - var spaceHulkX, spaceHulkY, tries_to_place_space_hulk; - tries_to_place_space_hulk = 0; - while(!positionFound && tries_to_place_space_hulk < 50){ - spaceHulkX=star_id.x+(choose(-1,1)*irandom_range(50,60)); - spaceHulkY=star_id.y+(choose(-1,1)*irandom_range(50,80)); - spaceHulkY = max(spaceHulkY,40); - var distanceToNearestStarOk = point_distance(spaceHulkX,spaceHulkY,instance_nearest(spaceHulkX,spaceHulkY,obj_star).x,instance_nearest(spaceHulkX,spaceHulkY,obj_star).y)>=70 - if (distanceToNearestStarOk){ - positionFound=true; - } - tries_to_place_space_hulk++; - } - if(tries_to_place_space_hulk >= 50) - { - // its possible for there to be no good spot for the space hulk at a star, if there are too many stars in close proximity - log_error($"RE: Space Hulk, couldn't find a spot for the spacehulk at the {star_id.name} system"); - exit; - } - try{ - var spaceHulk = scr_create_space_hulk(spaceHulkX,spaceHulkY); - - scr_alert(own?"red":"green","space_hulk",$"The Space Hulk {spaceHulk.name} appears near the {star_id.name} system.",spaceHulkX,spaceHulkY); - - scr_event_log("",$"The Space Hulk {spaceHulk.name} appears near the {star_id.name} system.",star_id.name); - _evented = true; - } - catch(_exception){ - handle_exception(_exception); - } - } - } - - else if (chosen_event == EVENT.promotion){ - log_message("RE: Promotion"); - var marine_and_company = scr_random_marine([obj_ini.role[100][8],obj_ini.role[100][12],obj_ini.role[100][9],obj_ini.role[100][10]],0); - if(marine_and_company == "none") - { - log_error("RE: Promotion, couldn't pick a space marine"); - exit; - } - var marine=marine_and_company[1]; - var company=marine_and_company[0]; - var _unit = obj_ini.TTRPG[company][marine]; - var role=_unit.role(); - var text = _unit.name_role(); - var company_text = scr_convert_company_to_string(company); - //var company_text = scr_company_string(company); - if(company_text != ""){ - company_text = "("+company_text+")"; - } - text += company_text; - text += " has distinguished himself.##He åis up for review to be promoted."; - - if (company != 10){ - _unit.add_exp(10); - } - else { - _unit.add_exp(max(20, _unit.experience)); - } - - scr_popup("Promotions!",text,"distinguished",""); - scr_event_log("green",text); - _evented = true; - } - - else if (chosen_event == EVENT.strange_building){ - _evented = strange_build_event(); - } - - else if (chosen_event == EVENT.sororitas){ - log_message("RE: Sororitas Company"); - var own; - own=choose(1,2); - var star_id = scr_random_find(own,true,"",""); - - if(star_id == undefined && own == 1){ - own = 2; - star_id = scr_random_find(own,true,"",""); - } - - if(star_id == undefined){ - log_error("RE: Sororitas Company, couldn't find a star for the company"); - exit; - } - else{ - var eligible_planets = []; - for(var i = 1; i <= star_id.planets;i++){ - if(star_id.p_type[i] != "Dead"){ - array_push(eligible_planets,i); - } - } - if(array_length(eligible_planets) == 0){ - log_error("RE: Sororitas Company, couldn't find a planet on the " + star_id.name + " system for the company"); - exit; - } - - var planet = eligible_planets[irandom(array_length(eligible_planets)-1)]; - ++(star_id.p_sisters[planet]); - _evented = true; - - if ((own!=1) && (star_id.p_player[planet]<=0) && (star_id.present_fleet[1]==0)){ - scr_alert("green","sororitas","Sororitas place a company of sisters on "+string(star_id.name)+" "+string(planet)+".",star_id.x,star_id.y); - } - else{ - scr_popup("Sororitas","The Ecclesiarchy have placed a company of sisters on "+string(star_id.name)+" "+string(planet)+".","sororitas",""); - if (known[eFACTION.Ecclesiarchy]==0){ - known[eFACTION.Ecclesiarchy]=1; // this seesms like a thing another part of code already does, not sure tho - } - } - } - - } else if (chosen_event == EVENT.mechanicus_mission) { - evented = spawn_mechanicus_mission(); - - } - - else if (chosen_event == EVENT.inquisition_planet || chosen_event == EVENT.inquisition_mission) { - scr_inquisition_mission(chosen_event); - _evented = true; - } - - else if (chosen_event == EVENT.rogue_trader){ - log_message("RE: Rogue Trader"); - var eligible_stars = []; - with(obj_star) { - for(var i = 0; i <= 4; i++) { - //feather sometimes thinks the Player part is an object..silly feather - if(p_owner[i] == eFACTION.Player) { - array_push(eligible_stars,self); - break; - } - } - } - with(obj_p_fleet) { - if(capital_number>0 && action=="") { - var star = instance_nearest(x,y,obj_star) - array_push(eligible_stars,star); - } - } - - var stars_count = array_length(eligible_stars); - if(stars_count == 0) { - log_error("RE: Rogue Trader, couldn't find a star"); - exit; - } - - var star = eligible_stars[irandom(stars_count - 1)]; - var text = "A Rogue Trader fleet has arrived in the "; + var inquisition_mission_roll = irandom(100); + var force_inquisition_mission = false; + if (((last_mission + 50) <= turn) && (inquisition_mission_roll <= 5) && (known[eFACTION.Inquisition] != 0) && (obj_controller.faction_status[eFACTION.Inquisition] != "War")) { + force_inquisition_mission = true; + } + + if (force_inquisition_mission && random_event_next == EVENT.none) { + chosen_event = EVENT.inquisition_mission; + } else { + if (execute_now) { + var random_event_roll = irandom(100); + if ((last_event + 30) <= turn) { + random_event_roll = 1; + } // If 30 turns without random event then do one + if (random_event_roll > 5) { + exit; + } // Frequency of events + if ((turn - 15) < last_event) { + exit; + } // Minimum interval between + } + + if (random_event_next != EVENT.none) { + chosen_event = random_event_next; + } else { + var player_luck; + var luck_roll = roll_dice_chapter(1, 100, "low"); + + if (luck_roll <= 45) { + player_luck = eLUCK.good; + } + if ((luck_roll > 45) && (luck_roll < 55)) { + player_luck = eLUCK.neutral; + } + if (luck_roll >= 55) { + player_luck = eLUCK.bad; + } + + var events; + if (player_luck == eLUCK.good) { + events = [ + EVENT.space_hulk, + EVENT.promotion, + EVENT.strange_building, + EVENT.sororitas, + EVENT.rogue_trader, + EVENT.inquisition_mission, + EVENT.inquisition_planet, + EVENT.mechanicus_mission + ]; + } else if (player_luck == eLUCK.neutral) { + events = [ + EVENT.strange_behavior, + EVENT.fleet_delay, + EVENT.harlequins, + EVENT.succession_war, + EVENT.random_fun + ]; + } else if (player_luck == eLUCK.bad) { + events = [ + EVENT.warp_storms, + EVENT.enemy_forces, + EVENT.crusade, // Reportly breaks often because of lack of imperial fleets and eats player ships // TODO LOW CRUSADE_EVENT // fix + EVENT.enemy, // Save-scumming event, Should probably base this on something else than tech-scavs + EVENT.mutation, + EVENT.ship_lost, // Another save-scumming event, mainly due to rarity of player ships + //EVENT.chaos_invasion, // Spawns Chaos fleets way too close to player owned worlds with no warning and usually lots of big ships, save-scum galore and encourages fleet-based chapters // TODO LOW INVASION_EVENT // Make them spawn way farther with more warning, make them have a different goal or remove this event entirely + EVENT.necron_awaken, // Inquisitor check for this is inverted + EVENT.fallen // Event mission cannot be completed and never expires // TODO LOW FALLEN_EVENT // fix + ]; + } + + var events_count = array_length(events); + var events_total = events_count; + var events_share = array_create(events_count, 1); + + for (var i = 0; i < events_count; i++) { + var curr_event = events[i]; + + //DEBUG-INI (EVENTS DEBUG CODE - 1) + //Comment/delete this when not debugging events + //List of possible events above + /*curr_event = EVENT.necron_awaken + events_count = 1 + events_total = events_count; + events_share = array_create(events_count, 1);*/ + //DEBUG-FIN (EVENTS DEBUG CODE - 1) + + switch (curr_event) { + case EVENT.inquisition_planet: + if (known[eFACTION.Inquisition] == 0 || obj_controller.faction_status[eFACTION.Inquisition] == "War") { + events_share[i] -= 1; + events_total -= 1; + } + break; + case EVENT.inquisition_mission: + if (known[eFACTION.Inquisition] == 0 || obj_controller.disposition[4] < 0 || obj_controller.faction_status[eFACTION.Inquisition] == "War") { + events_share[i] -= 1; + events_total -= 1; + } + break; + case EVENT.mechanicus_mission: + if (known[eFACTION.Mechanicus] == 0 || obj_controller.disposition[3] < 50 || obj_controller.faction_status[eFACTION.Mechanicus] == "War") { + events_share[i] -= 1; + events_total -= 1; + } else if (scr_has_adv("Tech-Brothers")) { + events_share[i] += 2; + events_total += 2; + } + break; + case EVENT.enemy: + if (scr_has_adv("Scavangers")) { + events_share[i] += 2; + events_total += 2; + } + break; + case EVENT.mutation: + if (gene_seed < 5) { + events_share[i] -= 1; + events_total -= 1; + } + break; + case EVENT.necron_awaken: + if (known[eFACTION.Inquisition] == 0) { + events_share[i] -= 1; + events_total -= 1; + } + break; + case EVENT.crusade: + if (obj_controller.faction_status[eFACTION.Imperium] == "War") { + events_share[i] -= 1; + events_total -= 1; + } + break; + case EVENT.fleet_delay: + var has_moving_fleet = false; + with (obj_p_fleet) { + if (action == "move") { + has_moving_fleet = true; + break; + } + } + if (!has_moving_fleet) { + events_share[i] -= 1; + events_total -= 1; + } + break; + case EVENT.ship_lost: + var has_moving_fleet = false; + with (obj_p_fleet) { + if (action == "move") { + has_moving_fleet = true; + break; + } + } + if (!has_moving_fleet) { + events_share[i] -= 1; + events_total -= 1; + } + break; + case EVENT.fallen: + if (!scr_has_disadv("Never Forgive")) { + events_share[i] -= 1; + events_total -= 1; + } + } + } + + chosen_event = irandom(events_total); + for (var i = 0; i < events_count; i++) { + chosen_event -= events_share[i]; + if (chosen_event <= 0) { + chosen_event = events[i]; + break; + } + } + //DEBUG-INI (EVENTS DEBUG CODE - 2) + //Comment/delete this when not debugging events + //If event on the switch above, (EVENTS DEBUG CODE - 1) var should be set to event too. + /*chosen_event = EVENT.necron_awaken*/ + //DEBUG-FIN (EVENTS DEBUG CODE - 2) + } + } + + if (!execute_now) { + random_event_next = chosen_event; + exit; + } + + if (chosen_event == EVENT.strange_behavior) { + //TODO this event currenlty dose'nt do anything but now we have marine structs there is lots of potential here + init_marine_acting_strange(); + _evented = true; + } else if (chosen_event == EVENT.space_hulk) { + log_message("RE: Space Hulk"); + var own = choose(1, 1, 2); + + var star_id = scr_random_find(own, true, "", ""); + if (star_id == undefined && own == 1) { + // find the nearest star to a player fleet and user that one, dukecode did that + // we could also try to find to find another star but this one is owned by the imperium and not the player, this code is doing that + own = 2; + star_id = scr_random_find(own, true, "", ""); + } + if (star_id == undefined && own == 2) { + star_id = scr_random_find(0, true, "", ""); // try for litteraly any star + } + + if (star_id == undefined) { + log_error("RE: Space Hulk, couldn't find a star for the spacehulk"); + exit; + } else { + var positionFound = false; + var spaceHulkX, spaceHulkY, tries_to_place_space_hulk; + tries_to_place_space_hulk = 0; + while (!positionFound && tries_to_place_space_hulk < 50) { + spaceHulkX = star_id.x + (choose(-1, 1) * irandom_range(50, 60)); + spaceHulkY = star_id.y + (choose(-1, 1) * irandom_range(50, 80)); + spaceHulkY = max(spaceHulkY, 40); + var distanceToNearestStarOk = point_distance(spaceHulkX, spaceHulkY, instance_nearest(spaceHulkX, spaceHulkY, obj_star).x, instance_nearest(spaceHulkX, spaceHulkY, obj_star).y) >= 70; + if (distanceToNearestStarOk) { + positionFound = true; + } + tries_to_place_space_hulk++; + } + if (tries_to_place_space_hulk >= 50) { + // its possible for there to be no good spot for the space hulk at a star, if there are too many stars in close proximity + log_error($"RE: Space Hulk, couldn't find a spot for the spacehulk at the {star_id.name} system"); + exit; + } + try { + var spaceHulk = scr_create_space_hulk(spaceHulkX, spaceHulkY); + + scr_alert(own ? "red" : "green", "space_hulk", $"The Space Hulk {spaceHulk.name} appears near the {star_id.name} system.", spaceHulkX, spaceHulkY); + + scr_event_log("", $"The Space Hulk {spaceHulk.name} appears near the {star_id.name} system.", star_id.name); + _evented = true; + } catch (_exception) { + handle_exception(_exception); + } + } + } else if (chosen_event == EVENT.promotion) { + log_message("RE: Promotion"); + var marine_and_company = scr_random_marine( + [ + obj_ini.role[100][8], + obj_ini.role[100][12], + obj_ini.role[100][9], + obj_ini.role[100][10] + ], + 0 + ); + if (marine_and_company == "none") { + log_error("RE: Promotion, couldn't pick a space marine"); + exit; + } + var marine = marine_and_company[1]; + var company = marine_and_company[0]; + var _unit = obj_ini.TTRPG[company][marine]; + var role = _unit.role(); + var text = _unit.name_role(); + var company_text = scr_convert_company_to_string(company); + //var company_text = scr_company_string(company); + if (company_text != "") { + company_text = "(" + company_text + ")"; + } + text += company_text; + text += " has distinguished himself.##He åis up for review to be promoted."; + + if (company != 10) { + _unit.add_exp(10); + } else { + _unit.add_exp(max(20, _unit.experience)); + } + + scr_popup("Promotions!", text, "distinguished", ""); + scr_event_log("green", text); + _evented = true; + } else if (chosen_event == EVENT.strange_building) { + _evented = strange_build_event(); + } else if (chosen_event == EVENT.sororitas) { + log_message("RE: Sororitas Company"); + var own; + own = choose(1, 2); + var star_id = scr_random_find(own, true, "", ""); + + if (star_id == undefined && own == 1) { + own = 2; + star_id = scr_random_find(own, true, "", ""); + } + + if (star_id == undefined) { + log_error("RE: Sororitas Company, couldn't find a star for the company"); + exit; + } else { + var eligible_planets = []; + for (var i = 1; i <= star_id.planets; i++) { + if (star_id.p_type[i] != "Dead") { + array_push(eligible_planets, i); + } + } + if (array_length(eligible_planets) == 0) { + log_error("RE: Sororitas Company, couldn't find a planet on the " + star_id.name + " system for the company"); + exit; + } + + var planet = eligible_planets[irandom(array_length(eligible_planets) - 1)]; + ++star_id.p_sisters[planet]; + _evented = true; + + if ((own != 1) && (star_id.p_player[planet] <= 0) && (star_id.present_fleet[1] == 0)) { + scr_alert("green", "sororitas", "Sororitas place a company of sisters on " + string(star_id.name) + " " + string(planet) + ".", star_id.x, star_id.y); + } else { + scr_popup("Sororitas", "The Ecclesiarchy have placed a company of sisters on " + string(star_id.name) + " " + string(planet) + ".", "sororitas", ""); + if (known[eFACTION.Ecclesiarchy] == 0) { + known[eFACTION.Ecclesiarchy] = 1; // this seesms like a thing another part of code already does, not sure tho + } + } + } + } else if (chosen_event == EVENT.mechanicus_mission) { + evented = spawn_mechanicus_mission(); + } else if (chosen_event == EVENT.inquisition_planet || chosen_event == EVENT.inquisition_mission) { + scr_inquisition_mission(chosen_event); + _evented = true; + } else if (chosen_event == EVENT.rogue_trader) { + log_message("RE: Rogue Trader"); + var eligible_stars = []; + with (obj_star) { + for (var i = 0; i <= 4; i++) { + //feather sometimes thinks the Player part is an object..silly feather + if (p_owner[i] == eFACTION.Player) { + array_push(eligible_stars, self); + break; + } + } + } + with (obj_p_fleet) { + if (capital_number > 0 && action == "") { + var star = instance_nearest(x, y, obj_star); + array_push(eligible_stars, star); + } + } + + var stars_count = array_length(eligible_stars); + if (stars_count == 0) { + log_error("RE: Rogue Trader, couldn't find a star"); + exit; + } + + var star = eligible_stars[irandom(stars_count - 1)]; + var text = "A Rogue Trader fleet has arrived in the "; text += star.name; - text += " system to trade. "; - var owns_planet_on_star = false; - for(var i = 0; i <= 4; i++) { - if(star.p_owner[i] == eFACTION.Player){ - owns_planet_on_star = true; - break; - } - } - if (owns_planet_on_star) { - text+="Wargear is slightly cheaper for the duration of their visit."; - } - else { - text+="Present Battle Barges will have access to cheaper wargear for the duration of their visit."; - } - scr_popup("Rogue Trader", text, "rogue_trader", ""); - star.trader += choose(3,4,5); + text += " system to trade. "; + var owns_planet_on_star = false; + for (var i = 0; i <= 4; i++) { + if (star.p_owner[i] == eFACTION.Player) { + owns_planet_on_star = true; + break; + } + } + if (owns_planet_on_star) { + text += "Wargear is slightly cheaper for the duration of their visit."; + } else { + text += "Present Battle Barges will have access to cheaper wargear for the duration of their visit."; + } + scr_popup("Rogue Trader", text, "rogue_trader", ""); + star.trader += choose(3, 4, 5); var star_alert; - star_alert = instance_create(star.x+16,star.y-24,obj_star_event); - star_alert.image_alpha = 1; - star_alert.image_speed = 1; + star_alert = instance_create(star.x + 16, star.y - 24, obj_star_event); + star_alert.image_alpha = 1; + star_alert.image_speed = 1; + _evented = true; + } else if (chosen_event == EVENT.fleet_delay) { + log_message("RE: Fleet Delay"); + var eligible_fleets = []; + with (obj_p_fleet) { + if (action == "move") { + array_push(eligible_fleets, id); + } + } + + var fleet_count = array_length(eligible_fleets); + if (fleet_count == 0) { + log_error("RE: Fleet Delay, couldn't pick a fleet"); + exit; + } + + var fleet = eligible_fleets[irandom(fleet_count - 1)]; + + if (fleet.action == "move") { + var targ, delay; + targ = 0; + delay = 0; + if (instance_exists(fleet)) { + delay = choose(1, 2, 2, 3); + fleet.action_eta += delay; + var text = "Eldar pirates have attacked your fleet destined for "; + var target_star = instance_nearest(fleet.action_x, fleet.action_y, obj_star); // isn't there a better way? + var fleet_destination; + if (instance_exists(target_star)) { + fleet_destination = target_star.name; + text += string(fleet_destination) + ". Damage was minimal but the voyage has been delayed by " + string(delay) + " months."; + } else { + text = "Eldar pirates have attacked your fleet. Damage was minimal but the voyage has been delayed by " + string(delay) + " months."; + } + scr_popup("Fleet Attacked", text, "", ""); + _evented = true; + var star_alert = instance_create(fleet.x + 16, fleet.y - 24, obj_star_event); + star_alert.image_alpha = 1; + star_alert.image_speed = 1; + star_alert.col = "red"; + } + } + } else if (chosen_event == EVENT.harlequins) { + log_message("RE: Harlequins"); + var owner = choose(1, 2, 2, 2, 3); + var star = scr_random_find(owner, true, "", ""); + if (!instance_exists(star) && owner != 2) { + owner = 2; + star = scr_random_find(owner, true, "", ""); + } + if (!instance_exists(star)) { + log_error("RE: Harlequins, couldn't find star"); + exit; + } + + var planet = irandom_range(1, star.planets); + if (add_new_problem(planet, "harlequins", irandom_range(2, 5), star)) { + var text = "Eldar Harlequins have been seen on planet " + string(star.name) + " " + scr_roman(planet) + ". Their purposes are unknown."; + scr_popup("Harlequin Troupe", text, "harlequin", ""); + var star_alert = instance_create(star.x + 16, star.y - 24, obj_star_event); + star_alert.image_alpha = 1; + star_alert.image_speed = 1; + star_alert.col = "green"; + } + } else if (chosen_event == EVENT.succession_war) { + log_message("RE: Succession War"); + var eligible_stars = []; + with (obj_star) { + for (var planet = 1; planet <= planets; planet++) { + if (p_owner[planet] == eFACTION.Imperium && p_type[planet] != "Dead" && p_type[planet] != "Ice" && p_type[planet] != "Lava") { + array_push(eligible_stars, id); + break; + } + } + } + var star_count = array_length(eligible_stars); + if (star_count == 0) { + log_error("RE: Succession War, couldn't find a star"); + exit; + } + + var star = eligible_stars[irandom(star_count - 1)]; + var planet; + for (var i = 1; i <= star.planets; i++) { + if (star.p_owner[i] == eFACTION.Imperium && star.p_type[i] != "Dead" && star.p_type[i] != "Ice" && star.p_type[i] != "Lava") { + planet = i; + break; + } + } + + array_push(star.p_feature[planet], new NewPlanetFeature(P_features.Succession_War)); + add_new_problem(planet, "succession", irandom(6) + 4, star); + star.dispo[planet] = -5000; + + var text = string(star.name) + scr_roman(planet); + scr_popup("War of Succession", "The planetary governor of " + string(text) + " has died. Several subordinates and other parties each claim to be the true heir and successor- war has erupted across the planet as a result. Heresy thrives in chaos.", "succession", ""); + var star_alert = instance_create(star.x + 16, star.y - 24, obj_star_event); + star_alert.image_alpha = 1; + star_alert.image_speed = 1; + star_alert.col = "red"; + scr_event_log("red", "War of Succession on " + string(text)); _evented = true; - } - - else if (chosen_event == EVENT.fleet_delay){ - log_message("RE: Fleet Delay"); - var eligible_fleets = []; - with(obj_p_fleet) { - if (action == "move") - { - array_push(eligible_fleets, id); - } - } - - var fleet_count = array_length(eligible_fleets); - if(fleet_count == 0) { - log_error("RE: Fleet Delay, couldn't pick a fleet"); - exit; - } - - var fleet = eligible_fleets[irandom(fleet_count - 1)]; - - - if (fleet.action="move"){ - var targ,delay;targ=0;delay=0; - if (instance_exists(fleet)){ - delay=choose(1,2,2,3); - fleet.action_eta += delay; - var text = "Eldar pirates have attacked your fleet destined for "; - var target_star = instance_nearest(fleet.action_x, fleet.action_y,obj_star); // isn't there a better way? - var fleet_destination; - if(instance_exists(target_star)){ - fleet_destination = target_star.name; - text += string(fleet_destination) + ". Damage was minimal but the voyage has been delayed by " + string(delay)+ " months."; - } - else { - text = "Eldar pirates have attacked your fleet. Damage was minimal but the voyage has been delayed by " + string(delay)+ " months."; - } - scr_popup("Fleet Attacked",text,"",""); - _evented = true; - var star_alert =instance_create(fleet.x+16,fleet.y-24,obj_star_event); - star_alert.image_alpha=1; - star_alert.image_speed=1; - star_alert.col = "red"; - } - } - } - - else if (chosen_event == EVENT.harlequins) { - log_message("RE: Harlequins"); - var owner = choose(1,2,2,2,3); - var star = scr_random_find(owner,true,"",""); - if(!instance_exists(star) && owner != 2) { - owner = 2; - star = scr_random_find(owner,true,"",""); - } - if(!instance_exists(star)){ - log_error("RE: Harlequins, couldn't find star"); - exit; - } - - var planet=irandom_range(1,star.planets); - if ( add_new_problem(planet, "harlequins", irandom_range(2,5),star)){ - var text="Eldar Harlequins have been seen on planet " + string(star.name) + " " + scr_roman(planet) + ". Their purposes are unknown."; - scr_popup("Harlequin Troupe",text,"harlequin",""); - var star_alert = instance_create(star.x+16,star.y-24,obj_star_event); - star_alert.image_alpha=1; - star_alert.image_speed=1; - star_alert.col="green"; - } - } - - else if (chosen_event == EVENT.succession_war){ - log_message("RE: Succession War"); - var eligible_stars=[]; - with(obj_star){ - for(var planet = 1; planet <= planets; planet++){ - if(p_owner[planet] == eFACTION.Imperium && p_type[planet] != "Dead" && p_type[planet] != "Ice" &&p_type[planet] != "Lava") { - array_push(eligible_stars,id); - break; - } - } - } - var star_count = array_length(eligible_stars); - if(star_count == 0) - { - log_error("RE: Succession War, couldn't find a star"); - exit; - } - - var star = eligible_stars[irandom(star_count-1)]; - var planet; - for(var i = 1; i <= star.planets; i++){ - if(star.p_owner[i] == eFACTION.Imperium && star.p_type[i] != "Dead" && star.p_type[i] != "Ice" && star.p_type[i] != "Lava") { - planet = i; - break; - } - } - - array_push(star.p_feature[planet], new NewPlanetFeature(P_features.Succession_War)); - add_new_problem(planet, "succession",irandom(6) + 4, star); - star.dispo[planet] = -5000; - - var text = string(star.name) + scr_roman(planet); - scr_popup("War of Succession","The planetary governor of "+string(text)+" has died. Several subordinates and other parties each claim to be the true heir and successor- war has erupted across the planet as a result. Heresy thrives in chaos.","succession",""); - var star_alert=instance_create(star.x+16,star.y-24,obj_star_event); - star_alert.image_alpha=1; - star_alert.image_speed=1; - star_alert.col="red"; - scr_event_log("red","War of Succession on "+string(text)); - _evented = true; - } - - // Flavor text/events - else if (chosen_event == EVENT.random_fun){ - log_message("RE: Random"); - var text; - var situation = irandom(4); - var place = irandom(9); - - switch(situation) { - case 0: - text="Alien contamination in "; - break; - case 1: - text="Servitors misbehaving at "; - break; - case 2: - text="Nonhuman presence detected at "; - break; - case 3: - text="Critical malfunction in "; - break; - case 4: - text="Abnormal warp flux in "; - break; - } - - switch (place){ - case 0: - text +="the Fortress Monastery."; - break; - case 1: - text +="the Refectory."; - break; - case 2: - text +="the Armamentarium."; - break; - case 3: - text +="the Librarium."; - break; - case 4: - text +="the Apothecarium."; - break; - case 5: - text +="the Command sanctum."; - break; - case 6: - text +="the Xenos Bestiarium."; - break; - case 7: - text +="the Hall of Trophies."; - break; - case 8: - text +="the Chapter Crypt."; - break; - case 9: - text +="the Chapter Garage."; - break; - } - scr_alert("color","lol",text,0,0); - scr_event_log("red",text); - _evented = true; - } - - else if (chosen_event == EVENT.warp_storms){ - log_message("RE: Warp Storm"); - var own,time,him; - - time=irandom_range(6,24); - if (scr_has_disadv("Shitty Luck")){ - own=choose(1,2,0,0,0); - } else if (scr_has_adv("Great Luck")) { - own=choose(1,1,2,2,0); - } else { - own=choose(1,1,2,0,0); - } - - var star_id = scr_random_find(own,true,"",""); - if(star_id == undefined && own == 1){ - own = 2; - star_id = scr_random_find(own,true,"",""); - } - if(star_id == undefined && own == 2){ - own = 0; - star_id = scr_random_find(own,true,"",""); - } - - if(star_id == undefined){ - log_error("RE: Warp Storm, couldn't pick a star for the warp storm"); - exit; - } - else{ - star_id.storm += time; - _evented = true; - var _col = own == 1 ? "red" : "green"; - scr_alert(_col, "Warp", $"Warp Storms rage across the {star_id.name} system.", star_id.x, star_id.y); - scr_event_log(_col, $"Warp Storms rage across the {star_id.name} system."); - } - } - - else if (chosen_event == EVENT.enemy_forces){ - log_message("RE: Enemy Forces"); - var own; - if (scr_has_disadv("Shitty Luck")){ - own=choose(1,1,1,1,1,1,2,2,3); - } else if (scr_has_adv("Great Luck")) { - own=choose(1,1,1,2,2,2,2,3,3); - } else { - own=choose(1,1,1,2,2,3); - } - - var star_id = scr_random_find(own,true,"",""); - if(star_id == undefined && own == 1){ - own = 2; - star_id = scr_random_find(own,true,"",""); - } - if(star_id == undefined && own == 2){ - own = 3; - star_id = scr_random_find(own,true,"",""); - } - - if(star_id == undefined) - { - log_error("RE: Enemy Forces, couldn't find a star for the enemy"); - exit; - } - else{ - var eligible_planets = []; - for(var i = 1; i <= star_id.planets; i++){ - if(star_id.p_type[i] != "Dead") - { - array_push(eligible_planets,i); - } - } - if(array_length(eligible_planets) == 0){ - log_error("RE: Enemy Forces, couldn't find a planet in the " + star_id.name +" system for the enemy"); - exit; - } - var planet = eligible_planets[irandom(array_length(eligible_planets) - 1)]; - //var enemy = choose(7,8,9,10,13); - var enemy = choose(7,8,9); - var text; - var max_enemies_on_planet = 5; // I don't know the actual value, i need to change it; - switch(enemy) - { - case 7: - text = "Orks"; - star_id.p_orks[planet] += 4; - star_id.p_orks[planet] = min(star_id.p_orks[planet], max_enemies_on_planet); - break; - case 8: - text = "Tau"; - star_id.p_tau[planet] += 4; - star_id.p_tau[planet] = min(star_id.p_tau[planet], max_enemies_on_planet); - break; - case 9: - text = "Tyranids"; - star_id.p_tyranids[planet] += 5; - star_id.p_tyranids[planet] = min(star_id.p_tyranids[planet], max_enemies_on_planet); - break; - //case 10: this doesn't work - // text = "Heretics"; - // star_id.p_heretics[planet] = 4; - // star_id.p_heretics[planet] = min(star_id.p_heretics[planet], max_enemies_on_planet); - // break; - //case 13: - // text = "Necron"; // I don't know if its a good idea to spawn necrons from this event, leaving it in for now - // star_id.p_necron[planet] = 4; - // star_id.p_necron[planet] = min(star_id.p_necron[planet], max_enemies_on_planet); - // break; - default: - log_error("RE: Enemy Forces, couldn't pick an enemy faction"); - exit; - } - scr_alert("red","enemy", $"{text} forces suddenly appear at {star_id.name} {planet}!",star_id.x,star_id.y); - scr_event_log("red",$"{text} forces suddenly appear at {star_id.name} {planet}!"); - _evented = true; - } - } - - else if ((chosen_event == EVENT.crusade)){ - //i think all events should be hanlded like this then we have far more options on when to call them and how they work - _evented = launch_crusade(); - } - - else if (chosen_event == EVENT.enemy) { - _evented = make_faction_enemy_event(); - } - - else if ((chosen_event == EVENT.mutation)) { - //TODO make reprocussions to ignoring this - log_message("RE: Gene-Seed Mutation"); - var text = "The Chapter's gene-seed has mutated! Apothecaries are scrambling to control the damage and prevent further contamination. What is thy will?"; - var _opt1 = "Dispose of "; - var _percent_remove = 0; - if (obj_controller.gene_seed <= 30) { - _opt1 += "100% of the gene-seed."; - _percent_remove = 100; - } - if ((obj_controller.gene_seed > 30) && (obj_controller.gene_seed < 60)) { - _opt1 += "50% of all gene-seed."; - _percent_remove = 50; - } - if (obj_controller.gene_seed >= 60) { - _opt1 += "33% of all gene-seed."; - _percent_remove = 33; - } - - var _opt2 = "Tell the apothecaries to let it be."; - - - var _pop_data = { - percent_remove : _percent_remove, - options : [ - { - str1:_opt1, - choice_func : event_dispose_of_mutated_gene, - }, - { - str1:_opt2, - choice_func : function(){ - scr_loyalty("Mutant Gene-Seed", "+"); - popup_default_close(); - } - }, - ] - } - - scr_popup("Gene-Seed Mutated!",text,"gene_bad",_pop_data); - _evented = true; - scr_event_log("red","The Chapter Gene-Seed has mutated."); - } - - else if (chosen_event == EVENT.ship_lost){ - loose_ship_to_warp_event(); - } - - else if (chosen_event == EVENT.chaos_invasion){ - log_message("RE: Chaos Invasion"); - - add_event({ - e_id : "chaos_invasion", - duration : 1 - }) - - var psyker_intolerant = scr_has_disadv("Psyker Intolerant"); - var has_chief_psyker = scr_role_count("Chief "+string(obj_ini.role[100,17]),"") >= 1; - var cm_is_psyker = false; - for(var i = 1; i < 100; i++){ - if (obj_ini.role[0,i] == obj_ini.role[100][eROLE.ChapterMaster] && string_count("0",obj_ini.spe[0,i]) > 0) { - cm_is_psyker = true; - break; - } - } - - if ((!psyker_intolerant) && (has_chief_psyker)) { - scr_popup("The Maw of the Warp Yawns Wide","Chief "+string(obj_ini.role[100,17])+" "+string(obj_ini.name[0,5])+" reports that the barrier between the realm of man and the Immaterium feels thin and tested.","Warp",""); - } - else if ((psyker_intolerant || !has_chief_psyker) && (cm_is_psyker)) { - scr_popup("The Maw of the Warp Yawns Wide","The barrier between the realm of man and the Immaterium feels thin and tested to you. Dark forces are afoot.","Warp",""); - } - - } - - else if (chosen_event == EVENT.necron_awaken){ - _evented = awaken_tomb_event(); - } - - else if(chosen_event == EVENT.fallen){ - event_fallen(); - _evented = true; - } - - if(_evented) { - if(force_inquisition_mission && chosen_event == EVENT.inquisition_mission) { - last_mission=turn; - } - else { - last_event=turn; - if (random_event_next != EVENT.none){ - random_event_next = EVENT.none; - } - } - } - - - // these shouldn't be needed anymore, the old code moved object to hide them sometimes - //instance_activate_object(obj_p_fleet); - //with(obj_p_fleet){if (x<-10000){x+=20000;y+=20000;}} - //with(obj_en_fleet){if (x<-10000){x+=20000;y+=20000;}} - //with(obj_star){if (x<-10000){x+=20000;y+=20000;}} + } else if (chosen_event == EVENT.random_fun) { + // Flavor text/events + log_message("RE: Random"); + var text; + var situation = irandom(4); + var place = irandom(9); + + switch (situation) { + case 0: + text = "Alien contamination in "; + break; + case 1: + text = "Servitors misbehaving at "; + break; + case 2: + text = "Nonhuman presence detected at "; + break; + case 3: + text = "Critical malfunction in "; + break; + case 4: + text = "Abnormal warp flux in "; + break; + } + + switch (place) { + case 0: + text += "the Fortress Monastery."; + break; + case 1: + text += "the Refectory."; + break; + case 2: + text += "the Armamentarium."; + break; + case 3: + text += "the Librarium."; + break; + case 4: + text += "the Apothecarium."; + break; + case 5: + text += "the Command sanctum."; + break; + case 6: + text += "the Xenos Bestiarium."; + break; + case 7: + text += "the Hall of Trophies."; + break; + case 8: + text += "the Chapter Crypt."; + break; + case 9: + text += "the Chapter Garage."; + break; + } + scr_alert("color", "lol", text, 0, 0); + scr_event_log("red", text); + _evented = true; + } else if (chosen_event == EVENT.warp_storms) { + log_message("RE: Warp Storm"); + var own, time, him; + + time = irandom_range(6, 24); + if (scr_has_disadv("Shitty Luck")) { + own = choose(1, 2, 0, 0, 0); + } else if (scr_has_adv("Great Luck")) { + own = choose(1, 1, 2, 2, 0); + } else { + own = choose(1, 1, 2, 0, 0); + } + + var star_id = scr_random_find(own, true, "", ""); + if (star_id == undefined && own == 1) { + own = 2; + star_id = scr_random_find(own, true, "", ""); + } + if (star_id == undefined && own == 2) { + own = 0; + star_id = scr_random_find(own, true, "", ""); + } + + if (star_id == undefined) { + log_error("RE: Warp Storm, couldn't pick a star for the warp storm"); + exit; + } else { + star_id.storm += time; + _evented = true; + var _col = own == 1 ? "red" : "green"; + scr_alert(_col, "Warp", $"Warp Storms rage across the {star_id.name} system.", star_id.x, star_id.y); + scr_event_log(_col, $"Warp Storms rage across the {star_id.name} system."); + } + } else if (chosen_event == EVENT.enemy_forces) { + log_message("RE: Enemy Forces"); + var own; + if (scr_has_disadv("Shitty Luck")) { + own = choose(1, 1, 1, 1, 1, 1, 2, 2, 3); + } else if (scr_has_adv("Great Luck")) { + own = choose(1, 1, 1, 2, 2, 2, 2, 3, 3); + } else { + own = choose(1, 1, 1, 2, 2, 3); + } + + var star_id = scr_random_find(own, true, "", ""); + if (star_id == undefined && own == 1) { + own = 2; + star_id = scr_random_find(own, true, "", ""); + } + if (star_id == undefined && own == 2) { + own = 3; + star_id = scr_random_find(own, true, "", ""); + } + if (star_id == undefined) { + log_error("RE: Enemy Forces, couldn't find a star for the enemy"); + exit; + } else { + var eligible_planets = []; + for (var i = 1; i <= star_id.planets; i++) { + if (star_id.p_type[i] != "Dead") { + array_push(eligible_planets, i); + } + } + if (array_length(eligible_planets) == 0) { + log_error("RE: Enemy Forces, couldn't find a planet in the " + star_id.name + " system for the enemy"); + exit; + } + var planet = eligible_planets[irandom(array_length(eligible_planets) - 1)]; + //var enemy = choose(7,8,9,10,13); + var enemy = choose(7, 8, 9); + var text; + var max_enemies_on_planet = 5; // I don't know the actual value, i need to change it; + switch (enemy) { + case 7: + text = "Orks"; + star_id.p_orks[planet] += 4; + star_id.p_orks[planet] = min(star_id.p_orks[planet], max_enemies_on_planet); + break; + case 8: + text = "Tau"; + star_id.p_tau[planet] += 4; + star_id.p_tau[planet] = min(star_id.p_tau[planet], max_enemies_on_planet); + break; + case 9: + text = "Tyranids"; + star_id.p_tyranids[planet] += 5; + star_id.p_tyranids[planet] = min(star_id.p_tyranids[planet], max_enemies_on_planet); + break; + //case 10: this doesn't work + // text = "Heretics"; + // star_id.p_heretics[planet] = 4; + // star_id.p_heretics[planet] = min(star_id.p_heretics[planet], max_enemies_on_planet); + // break; + //case 13: + // text = "Necron"; // I don't know if its a good idea to spawn necrons from this event, leaving it in for now + // star_id.p_necron[planet] = 4; + // star_id.p_necron[planet] = min(star_id.p_necron[planet], max_enemies_on_planet); + // break; + default: + log_error("RE: Enemy Forces, couldn't pick an enemy faction"); + exit; + } + scr_alert("red", "enemy", $"{text} forces suddenly appear at {star_id.name} {planet}!", star_id.x, star_id.y); + scr_event_log("red", $"{text} forces suddenly appear at {star_id.name} {planet}!"); + _evented = true; + } + } else if (chosen_event == EVENT.crusade) { + //i think all events should be hanlded like this then we have far more options on when to call them and how they work + _evented = launch_crusade(); + } else if (chosen_event == EVENT.enemy) { + _evented = make_faction_enemy_event(); + } else if (chosen_event == EVENT.mutation) { + //TODO make reprocussions to ignoring this + log_message("RE: Gene-Seed Mutation"); + var text = "The Chapter's gene-seed has mutated! Apothecaries are scrambling to control the damage and prevent further contamination. What is thy will?"; + var _opt1 = "Dispose of "; + var _percent_remove = 0; + if (obj_controller.gene_seed <= 30) { + _opt1 += "100% of the gene-seed."; + _percent_remove = 100; + } + if ((obj_controller.gene_seed > 30) && (obj_controller.gene_seed < 60)) { + _opt1 += "50% of all gene-seed."; + _percent_remove = 50; + } + if (obj_controller.gene_seed >= 60) { + _opt1 += "33% of all gene-seed."; + _percent_remove = 33; + } + var _opt2 = "Tell the apothecaries to let it be."; + + var _pop_data = { + percent_remove: _percent_remove, + options: [ + { + str1: _opt1, + choice_func: event_dispose_of_mutated_gene, + }, + { + str1: _opt2, + choice_func: function() { + scr_loyalty("Mutant Gene-Seed", "+"); + popup_default_close(); + }, + } + ], + }; + + scr_popup("Gene-Seed Mutated!", text, "gene_bad", _pop_data); + _evented = true; + scr_event_log("red", "The Chapter Gene-Seed has mutated."); + } else if (chosen_event == EVENT.ship_lost) { + loose_ship_to_warp_event(); + } else if (chosen_event == EVENT.chaos_invasion) { + log_message("RE: Chaos Invasion"); + + add_event({ + e_id: "chaos_invasion", + duration: 1, + }); + + var psyker_intolerant = scr_has_disadv("Psyker Intolerant"); + var has_chief_psyker = scr_role_count("Chief " + string(obj_ini.role[100][17]), "") >= 1; + var cm_is_psyker = false; + for (var i = 1; i < 100; i++) { + if (obj_ini.role[0][i] == obj_ini.role[100][eROLE.ChapterMaster] && string_count("0", obj_ini.spe[0][i]) > 0) { + cm_is_psyker = true; + break; + } + } + + if ((!psyker_intolerant) && has_chief_psyker) { + scr_popup("The Maw of the Warp Yawns Wide", "Chief " + string(obj_ini.role[100][17]) + " " + string(obj_ini.name[0][5]) + " reports that the barrier between the realm of man and the Immaterium feels thin and tested.", "Warp", ""); + } else if ((psyker_intolerant || !has_chief_psyker) && cm_is_psyker) { + scr_popup("The Maw of the Warp Yawns Wide", "The barrier between the realm of man and the Immaterium feels thin and tested to you. Dark forces are afoot.", "Warp", ""); + } + } else if (chosen_event == EVENT.necron_awaken) { + _evented = awaken_tomb_event(); + } else if (chosen_event == EVENT.fallen) { + event_fallen(); + _evented = true; + } + + if (_evented) { + if (force_inquisition_mission && chosen_event == EVENT.inquisition_mission) { + last_mission = turn; + } else { + last_event = turn; + if (random_event_next != EVENT.none) { + random_event_next = EVENT.none; + } + } + } + + // these shouldn't be needed anymore, the old code moved object to hide them sometimes + //instance_activate_object(obj_p_fleet); + //with(obj_p_fleet){if (x<-10000){x+=20000;y+=20000;}} + //with(obj_en_fleet){if (x<-10000){x+=20000;y+=20000;}} + //with(obj_star){if (x<-10000){x+=20000;y+=20000;}} } +function event_fallen() { + log_message("RE: Hunt the Fallen"); + var stars = scr_get_stars(); + var valid_stars = scr_get_stars(false, [eFACTION.Imperium]); + + if (array_length(valid_stars) == 0) { + log_error("RE: Hunt the Fallen, coulnd't find a star"); + exit; + } + log_message($"Fallen: valid_stars {valid_stars}"); + + var star = choose_array(stars); + var planet = scr_get_planet_with_owner(star, eFACTION.Imperium); + var eta = scr_mission_eta(star.x, star.y, 1); + + if (planet > 0) { + log_message($"Fallen: found star {star.name} planet {planet} as candidate"); + + var assigned_problem = add_new_problem(planet, "fallen", eta, star); + log_message($"assigned_problem {assigned_problem}"); -function event_fallen(){ - log_message("RE: Hunt the Fallen"); - var stars = scr_get_stars(); - var valid_stars = scr_get_stars(false, [eFACTION.Imperium]); - - if (array_length(valid_stars) == 0){ - log_error("RE: Hunt the Fallen, coulnd't find a star"); - exit; - } - log_message($"Fallen: valid_stars {valid_stars}") - - var star = choose_array(stars); - var planet = scr_get_planet_with_owner(star,eFACTION.Imperium); - var eta = scr_mission_eta(star.x,star.y, 1); - - if (planet>0){ - log_message($"Fallen: found star {star.name} planet {planet} as candidate") - - var assigned_problem = add_new_problem(planet, "fallen", eta,star) - log_message($"assigned_problem {assigned_problem}") - - if (!assigned_problem) { - log_error("RE: Hunt the Fallen, coulnd't assign a problem to the planet"); - return; - } - - var text = "Sources indicate one of the Fallen may be upon "+string(star.name)+" "+string(scr_roman(planet))+". We have "+string(eta)+" months to send out a strike team and scour the planet. Any longer and any Fallen that might be there will have escaped."; - scr_popup("Hunt the Fallen",text,"fallen",""); - scr_event_log("","Sources indicate one of the Fallen may be upon "+string(star.name)+" "+string(scr_roman(planet))+". We have "+string(eta)+" months to investigate."); - var star_alert = instance_create(star.x+16,star.y-24,obj_star_event); - star_alert.image_alpha=1; - star_alert.image_speed=1; - star_alert.col="purple"; - } + if (!assigned_problem) { + log_error("RE: Hunt the Fallen, coulnd't assign a problem to the planet"); + return; + } + var text = "Sources indicate one of the Fallen may be upon " + string(star.name) + " " + string(scr_roman(planet)) + ". We have " + string(eta) + " months to send out a strike team and scour the planet. Any longer and any Fallen that might be there will have escaped."; + scr_popup("Hunt the Fallen", text, "fallen", ""); + scr_event_log("", "Sources indicate one of the Fallen may be upon " + string(star.name) + " " + string(scr_roman(planet)) + ". We have " + string(eta) + " months to investigate."); + var star_alert = instance_create(star.x + 16, star.y - 24, obj_star_event); + star_alert.image_alpha = 1; + star_alert.image_speed = 1; + star_alert.col = "purple"; + } } From 81440879715dfb0df3e87dc25ec189b86d6ed8c4 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 20:55:49 -0500 Subject: [PATCH 06/45] Silence GM1021 Error in scr_buttons by initializing bind_method as an empty function instead of a string. --- scripts/scr_buttons/scr_buttons.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/scr_buttons/scr_buttons.gml b/scripts/scr_buttons/scr_buttons.gml index 357b0afc34..6c481c70ff 100644 --- a/scripts/scr_buttons/scr_buttons.gml +++ b/scripts/scr_buttons/scr_buttons.gml @@ -295,7 +295,7 @@ function UnitButtonObject(data = false) constructor { keystroke = false; active = true; tooltip = ""; - bind_method = ""; + bind_method = void(); bind_scope = false; set_width = false; style = "standard"; From f3454ae24c6945709c206c3356c1f80fff892746 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 20:56:38 -0500 Subject: [PATCH 07/45] linted scr_buttons --- scripts/scr_buttons/scr_buttons.gml | 243 +++++++++++++++++++++------- 1 file changed, 183 insertions(+), 60 deletions(-) diff --git a/scripts/scr_buttons/scr_buttons.gml b/scripts/scr_buttons/scr_buttons.gml index 6c481c70ff..5bd1dec933 100644 --- a/scripts/scr_buttons/scr_buttons.gml +++ b/scripts/scr_buttons/scr_buttons.gml @@ -70,7 +70,7 @@ function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor { max_width = -1; h = 0; w = 0; - scale_text=false; + scale_text = false; move_data_to_current_scope(data); @@ -82,14 +82,14 @@ function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor { draw_set_valign(valign); if (max_width > -1) { - if (!scale_text){ + if (!scale_text) { w = string_width_ext(text, -1, max_width); h = string_height_ext(text, -1, max_width); x2 = x1 + w; y2 = y1 + h; - } else{ + } else { w = max_width; - scale = calc_text_scale_confines(text,max_width); + scale = calc_text_scale_confines(text, max_width); h = string_height(text) * scale; } } else { @@ -113,10 +113,10 @@ function ReactiveString(text, x1 = 0, y1 = 0, data = false) constructor { draw_set_color(colour); if (max_width > -1) { - if (!scale_text){ + if (!scale_text) { draw_text_ext_outline(x1, y1, text, -1, max_width, c_black, colour); - }else{ - draw_text_transformed(x1, y1, text, scale, scale, 0) + } else { + draw_text_transformed(x1, y1, text, scale, scale, 0); } } else { draw_text_outline(x1, y1, text, c_black, colour); @@ -204,8 +204,21 @@ function LabeledIcon(icon, text, x1 = 0, y1 = 0, data = false) constructor { /// @param {array} [scale=[1,1]] Scale factors [x,y]. /// @param {sprite} [hover_sprite=-1] Optional hover sprite. /// @returns {array} [x1, y1, x2, y2] bounding box. -function draw_sprite_as_button(position, choice_sprite, scale = [1, 1], hover_sprite = -1) { - var _pos = [position[0], position[1], position[0] + (sprite_get_width(choice_sprite) * scale[0]), position[1] + (sprite_get_height(choice_sprite) * scale[1])]; +function draw_sprite_as_button( + position, + choice_sprite, + scale = [ + 1, + 1 + ], + hover_sprite = -1 +) { + var _pos = [ + position[0], + position[1], + position[0] + (sprite_get_width(choice_sprite) * scale[0]), + position[1] + (sprite_get_height(choice_sprite) * scale[1]) + ]; draw_sprite_ext(choice_sprite, 0, position[0], position[1], scale[0], scale[1], 0, c_white, scr_hit(_pos) ? 1 : 0.9); return _pos; } @@ -222,7 +235,20 @@ function draw_sprite_as_button(position, choice_sprite, scale = [1, 1], hover_sp /// @param {bool} [bg=false] Draw background rectangle. /// @param {color} [bg_color=c_black] Background color. /// @returns {array} [x1, y1, x2, y2] bounding box. -function draw_unit_buttons(position, text, size_mod = [1.5, 1.5], colour = c_gray, _halign = fa_center, font = fnt_40k_14b, alpha_mult = 1, bg = false, bg_color = c_black) { +function draw_unit_buttons( + position, + text, + size_mod = [ + 1.5, + 1.5 + ], + colour = c_gray, + _halign = fa_center, + font = fnt_40k_14b, + alpha_mult = 1, + bg = false, + bg_color = c_black +) { // TODO: fix halign usage // Store current state of all global vars add_draw_return_values(); @@ -262,10 +288,15 @@ function draw_unit_buttons(position, text, size_mod = [1.5, 1.5], colour = c_gra // Reset all global vars to their previous state pop_draw_return_values(); - return [position[0], position[1], x2, y2]; + return [ + position[0], + position[1], + x2, + y2 + ]; } -function standard_loc_data(){ +function standard_loc_data() { x1 = 0; y1 = 0; y2 = 0; @@ -361,16 +392,41 @@ function UnitButtonObject(data = false) constructor { static draw = function(allow_click = true) { add_draw_return_values(); - var _button_click_area; + var _button_click_area; if (style == "standard") { var _temp_alpha = alpha; if (disabled) { _temp_alpha = 0.5; allow_click = false; } - _button_click_area = draw_unit_buttons(w > 0 ? [x1, y1, x2, y2] : [x1, y1], label, [text_scale, text_scale], active ? color : inactive_col,, font, _temp_alpha); + _button_click_area = draw_unit_buttons( + w > 0 + ? [ + x1, + y1, + x2, + y2 + ] + : [ + x1, + y1 + ], + label, + [ + text_scale, + text_scale + ], + active ? color : inactive_col, +, + font, + _temp_alpha + ); } else if (style == "pixel") { - var _widths = [sprite_get_width(spr_pixel_button_left), sprite_get_width(spr_pixel_button_middle), sprite_get_width(spr_pixel_button_right)]; + var _widths = [ + sprite_get_width(spr_pixel_button_left), + sprite_get_width(spr_pixel_button_middle), + sprite_get_width(spr_pixel_button_right) + ]; var height_scale = h / sprite_get_height(spr_pixel_button_left); _widths[0] *= height_scale; @@ -391,7 +447,12 @@ function UnitButtonObject(data = false) constructor { x2 = x1 + array_sum(_widths); y2 = y1 + h; - _button_click_area = [x1, y1, x2, y2]; + _button_click_area = [ + x1, + y1, + x2, + y2 + ]; } if (scr_hit(x1, y1, x2, y2) && tooltip != "") { @@ -433,7 +494,23 @@ function PurchaseButton(req) : UnitButtonObject() constructor { static draw = function(allow_click = true) { add_draw_return_values(); - var _but = draw_unit_buttons([x1, y1, x2, y2], label, [1, 1], color,,, alpha); + var _but = draw_unit_buttons( + [ + x1, + y1, + x2, + y2 + ], + label, + [ + 1, + 1 + ], + color, +, +, + alpha + ); var _sh = sprite_get_height(spr_requisition); var _scale = (y2 - y1) / _sh; draw_sprite_ext(spr_requisition, 0, x1, y2, _scale, _scale, 0, c_white, 1); @@ -464,7 +541,10 @@ function slider_bar() constructor { y1 = 0; w = 102; h = 15; - value_limits = [0, 0]; + value_limits = [ + 0, + 0 + ]; value_increments = 1; value = 0; dragging = false; @@ -485,7 +565,12 @@ function slider_bar() constructor { if (dragging) { dragging = mouse_check_button(mb_left); } - var _rect = [x1, y1, x1 + w, y1 + h]; + var _rect = [ + x1, + y1, + x1 + w, + y1 + h + ]; draw_rectangle_array(_rect, 1); width_increments = w / ((value_limits[1] - value_limits[0]) / value_increments); var __rel_cur_pos = increments * (value - value_limits[0]); @@ -562,7 +647,12 @@ function TextBarArea(XX, YY, Max_width = 400, requires_input = false) constructo } } string_h = string_height("LOL"); - var rect = [xx - (bar_wid / 2), yy, xx + (bar_wid / 2), yy - 8 + string_h]; + var rect = [ + xx - (bar_wid / 2), + yy, + xx + (bar_wid / 2), + yy - 8 + string_h + ]; background.XX = rect[0]; background.YY = rect[1]; background.width = rect[2] - rect[0]; @@ -613,7 +703,18 @@ function TextBarArea(XX, YY, Max_width = 400, requires_input = false) constructo function drop_down(selection, draw_x, draw_y, options, open_marker) { add_draw_return_values(); if (selection != "") { - var drop_down_area = draw_unit_buttons([draw_x, draw_y], selection, [1, 1], c_green); + var drop_down_area = draw_unit_buttons( + [ + draw_x, + draw_y + ], + selection, + [ + 1, + 1 + ], + c_green + ); draw_set_color(c_red); if (array_length(options) > 1) { if (scr_hit(drop_down_area)) { @@ -623,7 +724,22 @@ function drop_down(selection, draw_x, draw_y, options, open_marker) { if (options[col] == selection) { continue; } - var cur_option = draw_unit_buttons([draw_x, draw_y + roll_down_offset], options[col], [1, 1], c_red,,,, true); + var cur_option = draw_unit_buttons( + [ + draw_x, + draw_y + roll_down_offset + ], + options[col], + [ + 1, + 1 + ], + c_red, +, +, +, + true + ); if (point_and_click(cur_option)) { selection = options[col]; open_marker = false; @@ -641,7 +757,10 @@ function drop_down(selection, draw_x, draw_y, options, open_marker) { } } } - return [selection, open_marker]; + return [ + selection, + open_marker + ]; pop_draw_return_values(); } @@ -1165,78 +1284,82 @@ function list_traveler(list, cur_val, move_up_coords, move_down_coords) { return _new_val; } - -function MainMenuButton(sprite=spr_ui_but_1, sprite_hover=spr_ui_hov_1, xx=0, yy=0, Hot_key=-1, Click_function=false) constructor{ - mouse_enter=0; +function MainMenuButton(sprite = spr_ui_but_1, sprite_hover = spr_ui_hov_1, xx = 0, yy = 0, Hot_key = -1, Click_function = false) constructor { + mouse_enter = 0; base_sprite = sprite; hover_sprite = sprite_hover; ossilate = 24; ossilate_down = true; - hover_alpha=0; - XX=xx; - YY=yy; + hover_alpha = 0; + XX = xx; + YY = yy; hot_key = Hot_key; - clicked=false; + clicked = false; click_function = Click_function; - static draw = function(xx=XX,yy=YY,text="", x_scale=1, y_scale=1, width=108, height=42){ + + static draw = function(xx = XX, yy = YY, text = "", x_scale = 1, y_scale = 1, width = 108, height = 42) { draw_set_valign(fa_top); draw_set_halign(fa_left); add_draw_return_values(); - clicked=false; - height *=y_scale - width *=x_scale; - if (scr_hit(xx, yy, xx+width, yy+height)){ - if (ossilate>0){ - ossilate-=1; + clicked = false; + height *= y_scale; + width *= x_scale; + if (scr_hit(xx, yy, xx + width, yy + height)) { + if (ossilate > 0) { + ossilate -= 1; } - if (ossilate<0){ - ossilate=0; + if (ossilate < 0) { + ossilate = 0; } - if (hover_alpha<1){ - hover_alpha+=0.42 + if (hover_alpha < 1) { + hover_alpha += 0.42; } draw_set_blend_mode(bm_add); draw_set_alpha(hover_alpha); - draw_sprite(hover_sprite,0,xx,yy); + draw_sprite(hover_sprite, 0, xx, yy); draw_set_blend_mode(bm_normal); ossilate_down = true; - clicked = device_mouse_check_button_pressed(0,mb_left); + clicked = device_mouse_check_button_pressed(0, mb_left); } else { - if (ossilate_down){ - if (ossilate<24)then ossilate+=0.2; - if (ossilate==24) then ossilate_down=false; + if (ossilate_down) { + if (ossilate < 24) { + ossilate += 0.2; + } + if (ossilate == 24) { + ossilate_down = false; + } } else { - if (ossilate>8){ - ossilate-=0.2; + if (ossilate > 8) { + ossilate -= 0.2; } - if (ossilate==8){ - ossilate_down=true; + if (ossilate == 8) { + ossilate_down = true; } } - if (hover_alpha>0){ - hover_alpha-=0.04 + if (hover_alpha > 0) { + hover_alpha -= 0.04; draw_set_blend_mode(bm_add); draw_set_alpha(hover_alpha); - draw_sprite(hover_sprite,0,xx,yy); + draw_sprite(hover_sprite, 0, xx, yy); draw_set_blend_mode(bm_normal); } } - if (hot_key!=-1 && !clicked){ - clicked = press_with_held(hot_key,vk_alt); + if (hot_key != -1 && !clicked) { + clicked = press_with_held(hot_key, vk_alt); //show_debug_message($"{clicked}"); } draw_set_alpha(1); - draw_sprite(base_sprite,floor(ossilate),xx,yy); + draw_sprite(base_sprite, floor(ossilate), xx, yy); draw_set_color(c_white); draw_set_halign(fa_center); draw_set_font(fnt_cul_14); - draw_text_ext(xx+(width/2),yy+4, text, 18*y_scale, width-(15*x_scale)); - if (clicked){ - if (click_function){ + draw_text_ext(xx + (width / 2), yy + 4, text, 18 * y_scale, width - (15 * x_scale)); + if (clicked) { + if (click_function) { click_function(); } } pop_draw_return_values(); return clicked; - } + }; } From 70a9ac366ed67410b8860917c7bf3b12d020f0a3 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 20:59:47 -0500 Subject: [PATCH 08/45] Silence other GM1021 Errors --- scripts/scr_buttons/scr_buttons.gml | 4 ++-- scripts/scr_controller_helpers/scr_controller_helpers.gml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/scr_buttons/scr_buttons.gml b/scripts/scr_buttons/scr_buttons.gml index 5bd1dec933..0285f5525c 100644 --- a/scripts/scr_buttons/scr_buttons.gml +++ b/scripts/scr_buttons/scr_buttons.gml @@ -780,7 +780,7 @@ function MultiSelect(options_array, title, data = {}) constructor { y1 = 0; x2 = 0; y2 = 0; - on_change = false; + on_change = void(); active_col = CM_GREEN_COLOR; inactive_col = c_gray; max_width = 0; @@ -1284,7 +1284,7 @@ function list_traveler(list, cur_val, move_up_coords, move_down_coords) { return _new_val; } -function MainMenuButton(sprite = spr_ui_but_1, sprite_hover = spr_ui_hov_1, xx = 0, yy = 0, Hot_key = -1, Click_function = false) constructor { +function MainMenuButton(sprite = spr_ui_but_1, sprite_hover = spr_ui_hov_1, xx = 0, yy = 0, Hot_key = -1, Click_function = void()) constructor { mouse_enter = 0; base_sprite = sprite; hover_sprite = sprite_hover; diff --git a/scripts/scr_controller_helpers/scr_controller_helpers.gml b/scripts/scr_controller_helpers/scr_controller_helpers.gml index de456d5257..3673e552ab 100644 --- a/scripts/scr_controller_helpers/scr_controller_helpers.gml +++ b/scripts/scr_controller_helpers/scr_controller_helpers.gml @@ -61,7 +61,7 @@ function scr_menu_clear_up(specific_area_function) { return false; } -function scr_change_menu(wanted_menu, specific_area_function=false) { +function scr_change_menu(wanted_menu, specific_area_function=void()) { var continue_sequence = false; if (obj_controller.menu_lock){ return false; From 9db9acc2652127f96752c1b6bd6a354bd4a94373 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 21:01:03 -0500 Subject: [PATCH 09/45] linted scr_controller --- .../scr_controller_helpers.gml | 164 +++++++++--------- 1 file changed, 79 insertions(+), 85 deletions(-) diff --git a/scripts/scr_controller_helpers/scr_controller_helpers.gml b/scripts/scr_controller_helpers/scr_controller_helpers.gml index 3673e552ab..d949869095 100644 --- a/scripts/scr_controller_helpers/scr_controller_helpers.gml +++ b/scripts/scr_controller_helpers/scr_controller_helpers.gml @@ -1,7 +1,7 @@ //TODO make enum to store menu area codes function scr_menu_clear_up(specific_area_function) { var spec_func = specific_area_function; - with(obj_controller) { + with (obj_controller) { var menu_action_allowed = action_if_number(obj_saveload, 0, 0) && action_if_number(obj_drop_select, 0, 0) && action_if_number(obj_popup_dialogue, 0, 0) && action_if_number(obj_ncombat, 0, 0); if (menu_action_allowed) { @@ -17,7 +17,7 @@ function scr_menu_clear_up(specific_area_function) { if (instance_exists(obj_turn_end) && (obj_controller.complex_event != true) && (!instance_exists(obj_temp_meeting)) && array_length(obj_turn_end.audience_stack) == 0) { if ((obj_turn_end.popups_end == 1) && (audience == 0) && (cooldown <= 0)) { - with(obj_turn_end) { + with (obj_turn_end) { instance_destroy(); } } @@ -61,46 +61,46 @@ function scr_menu_clear_up(specific_area_function) { return false; } -function scr_change_menu(wanted_menu, specific_area_function=void()) { +function scr_change_menu(wanted_menu, specific_area_function = void()) { var continue_sequence = false; - if (obj_controller.menu_lock){ + if (obj_controller.menu_lock) { return false; } - if (wanted_menu == obj_controller.menu){ + if (wanted_menu == obj_controller.menu) { main_map_defaults(); return true; } - with(obj_controller) { + with (obj_controller) { main_map_defaults(); set_zoom_to_default(); continue_sequence = scr_menu_clear_up(function() { //if ((zoomed == 0) && (diplomacy == 0)) { - return true; + return true; //} }); if (continue_sequence) { - with(obj_fleet_select) { + with (obj_fleet_select) { instance_destroy(); } - if (close_popups){ - with(obj_popup) { + if (close_popups) { + with (obj_popup) { instance_destroy(); } } close_popups = true; - if (is_callable(specific_area_function)){ + if (is_callable(specific_area_function)) { specific_area_function(); } } } } -function main_map_defaults(){ - with (obj_controller){ +function main_map_defaults() { + with (obj_controller) { menu = MENU.Default; hide_banner = 0; location_viewer.update_garrison_log(); - managing = 0; + managing = 0; managing = 0; menu_adept = 0; view_squad = false; @@ -114,8 +114,8 @@ function main_map_defaults(){ } function scr_in_game_help() { - scr_change_menu(MENU.GameHelp,function() { - with(obj_controller) { + scr_change_menu(MENU.GameHelp, function() { + with (obj_controller) { if ((zoomed == 0) && (!instance_exists(obj_ingame_menu)) && (!instance_exists(obj_popup))) { set_zoom_to_default(); if (menu != 30) { @@ -126,14 +126,14 @@ function scr_in_game_help() { instance_activate_object(obj_event_log); obj_event_log.top = 1; obj_event_log.help = 1; - } + } } } }); } function scr_in_game_menu() { - scr_change_menu(-1,function() { + scr_change_menu(-1, function() { if ((!instance_exists(obj_ingame_menu)) && (!instance_exists(obj_popup)) && (!obj_controller.zoomed)) { // Main MENU set_zoom_to_default(); @@ -143,7 +143,7 @@ function scr_in_game_menu() { } function basic_manage_settings() { - with (obj_controller){ + with (obj_controller) { menu = MENU.Manage; popup = 0; selected = 0; @@ -154,36 +154,35 @@ function basic_manage_settings() { } } -function init_manage_buttons(){ +function init_manage_buttons() { management_buttons = { squad_toggle: new UnitButtonObject({ style: "pixel", label: "Squad View", - tooltip: "Click here or press S to toggle Squad View." + tooltip: "Click here or press S to toggle Squad View.", }), profile_toggle: new UnitButtonObject({ style: "pixel", label: "Show Profile", - tooltip: "Click here or press P to show unit profile." + tooltip: "Click here or press P to show unit profile.", }), bio_toggle: new UnitButtonObject({ style: "pixel", label: "Show Bio", - tooltip: "Click here or press B to Toggle Unit Biography." + tooltip: "Click here or press B to Toggle Unit Biography.", }), capture_image: new UnitButtonObject({ style: "pixel", label: "Capture Image", - tooltip: "Click to create a local png of the given marine in the game folder." + tooltip: "Click to create a local png of the given marine in the game folder.", }), - - company_namer : new TextBarArea(800, 108, 600, false), + company_namer: new TextBarArea(800, 108, 600, false), }; } function scr_toggle_manage() { - scr_change_menu(MENU.Manage,function() { - with(obj_controller) { + scr_change_menu(MENU.Manage, function() { + with (obj_controller) { if (menu != MENU.Manage) { hide_banner = 1; basic_manage_settings(); @@ -194,14 +193,14 @@ function scr_toggle_manage() { } function scr_toggle_setting() { - scr_change_menu(MENU.Settings,function() { - with(obj_controller) { + scr_change_menu(MENU.Settings, function() { + with (obj_controller) { if (menu != MENU.Settings) { menu = MENU.Settings; popup = 0; selected = 0; hide_banner = 1; - } else if (settings) { + } else if (settings) { menu = MENU.Settings; cooldown = 8000; click = 1; @@ -212,8 +211,8 @@ function scr_toggle_setting() { } function scr_toggle_apothecarion() { - scr_change_menu(MENU.Apothecarion,function() { - with(obj_controller) { + scr_change_menu(MENU.Apothecarion, function() { + with (obj_controller) { menu_adept = 0; hide_banner = 1; if (scr_role_count("Master of the Apothecarion", "0") == 0) { @@ -229,8 +228,8 @@ function scr_toggle_apothecarion() { } function scr_toggle_reclu() { - scr_change_menu(MENU.Reclusiam,function() { - with(obj_controller) { + scr_change_menu(MENU.Reclusiam, function() { + with (obj_controller) { menu_adept = 0; hide_banner = 1; if (scr_role_count("Master of Sanctity", "0") == 0) { @@ -255,14 +254,14 @@ function scr_toggle_reclu() { } } } - } + } } }); } function scr_toggle_lib() { - scr_change_menu(MENU.Librarium,function() { - with(obj_controller) { + scr_change_menu(MENU.Librarium, function() { + with (obj_controller) { menu_adept = 0; hide_banner = 1; if (scr_role_count("Chief " + string(obj_ini.role[100][17]), "0") == 0) { @@ -283,20 +282,20 @@ function scr_toggle_lib() { artifact_namer = new TextBarArea(xx + 622, yy + 460, 350); set_chapter_arti_data(); artifact_slate = new DataSlate({ - set_width : true, - XX : 392, - YY : 500, - width : 460, - height : 240, - }) - } + set_width: true, + XX: 392, + YY: 500, + width: 460, + height: 240, + }); + } } }); } function scr_toggle_armamentarium() { - scr_change_menu(MENU.Armamentarium,function() { - with(obj_controller) { + scr_change_menu(MENU.Armamentarium, function() { + with (obj_controller) { if (menu != MENU.Armamentarium) { if (scr_role_count("Forge Master", "0") == 0) { menu_adept = 1; @@ -309,14 +308,13 @@ function scr_toggle_armamentarium() { } function scr_toggle_recruiting() { - scr_change_menu(MENU.Recruiting,function() { - with(obj_controller) { - var geh = 0, - good = 0; + scr_change_menu(MENU.Recruiting, function() { + with (obj_controller) { + var geh = 0, good = 0; for (geh = 1; geh <= 50; geh++) { geh += 1; if (good == 0) { - if ((obj_ini.role[10, geh] == obj_ini.role[100][5]) && (obj_ini.name[10, geh] == obj_ini.recruiter_name)) { + if ((obj_ini.role[10][geh] == obj_ini.role[100][5]) && (obj_ini.name[10][geh] == obj_ini.recruiter_name)) { good = geh; } } @@ -325,20 +323,19 @@ function scr_toggle_recruiting() { if (menu != MENU.Recruiting) { set_up_recruitment_view(); hide_banner = 1; - } + } } }); } function scr_toggle_fleet_area() { - scr_change_menu(MENU.Fleet,function() { - with(obj_controller) { + scr_change_menu(MENU.Fleet, function() { + with (obj_controller) { menu_adept = 0; - var geh = 0, - good = 0; + var geh = 0, good = 0; for (geh = 1; geh <= 50; geh++) { if (good == 0) { - if ((obj_ini.role[4, geh] == obj_ini.role[100][5]) && (obj_ini.name[10, geh] == obj_ini.lord_admiral_name)) { + if ((obj_ini.role[4][geh] == obj_ini.role[100][5]) && (obj_ini.name[10][geh] == obj_ini.lord_admiral_name)) { good = geh; } } @@ -358,10 +355,7 @@ function scr_toggle_fleet_area() { temp[i] = ""; } - var g = 0, - u = 0, - m = 0, - d = 0; + var g = 0, u = 0, m = 0, d = 0; temp[37] = 0; temp[38] = 0; temp[39] = 0; @@ -413,7 +407,7 @@ function scr_toggle_fleet_area() { function scr_toggle_diplomacy() { scr_change_menu(MENU.Diplomacy, function() { - with(obj_controller) { + with (obj_controller) { if (menu != MENU.Diplomacy) { set_up_diplomacy_buttons(); menu = MENU.Diplomacy; @@ -421,15 +415,15 @@ function scr_toggle_diplomacy() { diplomacy = 0; hide_banner = 1; character_diplomacy = false; - show_debug_message("set_diplo") + show_debug_message("set_diplo"); } } }); } function scr_toggle_event_log() { - scr_change_menu(MENU.EventLog,function() { - with(obj_controller) { + scr_change_menu(MENU.EventLog, function() { + with (obj_controller) { if (menu != MENU.EventLog) { menu = MENU.EventLog; @@ -442,11 +436,11 @@ function scr_toggle_event_log() { } function scr_end_turn() { - if (instance_exists(obj_turn_end)){ + if (instance_exists(obj_turn_end)) { return false; } - scr_change_menu(-1,function() { - with(obj_controller) { + scr_change_menu(-1, function() { + with (obj_controller) { if ((menu == MENU.Default) && (cooldown <= 0)) { if (location_viewer.hide_sequence == 0) { location_viewer.hide_sequence++; @@ -464,40 +458,40 @@ function scr_end_turn() { }*/ if (ok == 1) { - if(settings_autosave == true){ + if (settings_autosave == true) { // Autosave - if(obj_controller.turn % 10 == 0){// save every 10 turns - if(!instance_exists(obj_saveload)){ - instance_create(0,0,obj_saveload); + if (obj_controller.turn % 10 == 0) { + // save every 10 turns + if (!instance_exists(obj_saveload)) { + instance_create(0, 0, obj_saveload); } obj_saveload.autosaving = true; - scr_save(0,0,true); - obj_controller.menu=0; - obj_controller.zui=0; - obj_controller.invis=false; - with(obj_saveload){ + scr_save(0, 0, true); + obj_controller.menu = 0; + obj_controller.zui = 0; + obj_controller.invis = false; + with (obj_saveload) { instance_destroy(); } } - } obj_controller.end_turn_insights = {}; - with(obj_turn_end) { + with (obj_turn_end) { instance_destroy(); } - with(obj_star_event) { + with (obj_star_event) { instance_destroy(); } audio_play_sound(snd_end_turn, -50, 0); audio_sound_gain(snd_end_turn, master_volume * effect_volume, 0); turn += 1; - with(obj_star) { + with (obj_star) { for (var i = 0; i <= 21; i++) { present_fleet[i] = 0; } } - with(obj_p_fleet) { + with (obj_p_fleet) { if ((action == "move") && (obj_controller.faction_status[eFACTION.Imperium] == "War")) { var him = instance_nearest(action_x, action_y, obj_star); if (point_distance(action_x, action_y, him.x, him.y) < 10) { @@ -505,7 +499,7 @@ function scr_end_turn() { } } } - with(obj_en_fleet) { + with (obj_en_fleet) { if ((action == "move") && (owner > 5)) { var him = instance_nearest(action_x, action_y, obj_star); if (point_distance(action_x, action_y, him.x, him.y) < 10) { @@ -530,7 +524,7 @@ function scr_end_turn() { gene_tithe -= 1; // Do that after the combats and all of that crap - with(obj_star) { + with (obj_star) { ai_a = 2; ai_b = 3; ai_c = 4; From 48ed9c40efc4a974f7e134960fca362ca526cd26 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 21:09:22 -0500 Subject: [PATCH 10/45] Silenced GM2047 suggestions about unreachable code by commenting them out for review of if they are meant to be reachable before the return statement, or if they can simply be deleted. Though the one unreachable return line could probably be safely deleted. --- scripts/scr_DataSlate/scr_DataSlate.gml | 2 +- scripts/scr_buttons/scr_buttons.gml | 4 ++-- scripts/scr_culture_visuals/scr_culture_visuals.gml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/scr_DataSlate/scr_DataSlate.gml b/scripts/scr_DataSlate/scr_DataSlate.gml index 26cdec1676..6baaa960e1 100644 --- a/scripts/scr_DataSlate/scr_DataSlate.gml +++ b/scripts/scr_DataSlate/scr_DataSlate.gml @@ -517,7 +517,7 @@ function ShutterButton() constructor{ } else { return false; } - pop_draw_return_values(); + // pop_draw_return_values(); // Unreachable, commented to silence compiler message GM2047 } } diff --git a/scripts/scr_buttons/scr_buttons.gml b/scripts/scr_buttons/scr_buttons.gml index 0285f5525c..68351ad2ef 100644 --- a/scripts/scr_buttons/scr_buttons.gml +++ b/scripts/scr_buttons/scr_buttons.gml @@ -532,7 +532,7 @@ function PurchaseButton(req) : UnitButtonObject() constructor { pop_draw_return_values(); return false; } - pop_draw_return_values(); + //pop_draw_return_values(); // Unreachable, commented to silence compiler message GM2047 }; } @@ -761,7 +761,7 @@ function drop_down(selection, draw_x, draw_y, options, open_marker) { selection, open_marker ]; - pop_draw_return_values(); + //pop_draw_return_values(); // Unreachable, commented to silence compiler message GM2047 } /// @function MultiSelect(options_array, title, data) diff --git a/scripts/scr_culture_visuals/scr_culture_visuals.gml b/scripts/scr_culture_visuals/scr_culture_visuals.gml index 41aef98130..3df7aa37c9 100644 --- a/scripts/scr_culture_visuals/scr_culture_visuals.gml +++ b/scripts/scr_culture_visuals/scr_culture_visuals.gml @@ -1736,7 +1736,7 @@ function scr_get_body_data (body_item_key,body_slot="none"){ } return item_key_map; } - return false; + // return false; // Unreachable, commented to silence compiler message GM2047 } From 9153bb3b33697a2d2cd030b14fad00d92356a1bb Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 21:10:55 -0500 Subject: [PATCH 11/45] linted scr_DataSlate and scr_culture_visuals --- scripts/scr_DataSlate/scr_DataSlate.gml | 1025 ++-- .../scr_culture_visuals.gml | 5417 +++++++++-------- 2 files changed, 3466 insertions(+), 2976 deletions(-) diff --git a/scripts/scr_DataSlate/scr_DataSlate.gml b/scripts/scr_DataSlate/scr_DataSlate.gml index 6baaa960e1..5086b80b0b 100644 --- a/scripts/scr_DataSlate/scr_DataSlate.gml +++ b/scripts/scr_DataSlate/scr_DataSlate.gml @@ -1,525 +1,548 @@ -function DataSlate(data={}) constructor{ - static_line=1; - title=""; - sub_title=""; - body_text = ""; - inside_method = ""; - XX=0; - YY=0; - width=0; - height=0; - percent_cut=0; - set_width = false; - - draggable = false; - cherub = false; - - top_anchor = [340, 14]; - - style = "default"; - - tooltip_drawing = []; - - blend_col = 5998382; - draw_top_piece = true; - move_data_to_current_scope(data, true); - - drag_engaged = false; - - top_piece_style = "aquila"; - - draw_offsets = []; - - decoration_scale = 0; - - - static entered = function(){ - var _hit = (scr_hit(XX-4,YY,XX + width,YY + height)); - if (!_hit && cherub){ - _hit = hit_cherub(); - } - return _hit || drag_engaged; - } - - static draw_with_dimensions = function(xx = -1,yy = -1, Width=-1 , Height=-1){ - if (Width != -1){ - width = Width; - } - if (Height != -1){ - height = Height; - } - var _scale_x = width/860; - var _scale_y = height/850; - draw(xx,yy, _scale_x, _scale_y); - } - - static hit_cherub = function(){ - var _box_aug = 80*(decoration_scale*2.5); - var _x_loc = XX+(width/2); - var _y_loc = YY; - return (scr_hit_dimensions(_x_loc-(_box_aug), _y_loc-_box_aug, _box_aug*2, _box_aug)); - } - - static drag_logic = function(){ - if (!drag_engaged){ - if (hit_cherub()){ - drag_engaged = (device_mouse_check_button_pressed(0,mb_left)); - var _mouse_consts = return_mouse_consts(); - draw_offsets = [_mouse_consts[0]-XX,_mouse_consts[1]-YY]; - } - } else { - drag_engaged = !(device_mouse_check_button_released(0,mb_left)); - } - - if (drag_engaged){ - var _mouse_consts = return_mouse_consts(); - XX = _mouse_consts[0] - draw_offsets[0]; - YY = _mouse_consts[1] - draw_offsets[1]; - } - } - - static draw = function(xx= -1,yy = -1, scale_x=1, scale_y=1){ - if (xx != -1){ - XX=xx; - } - if (yy != -1){ - YY=yy; - } - - if (!set_width){ - width = 860*scale_x; - height = 850*scale_y; - } - - decoration_scale = min(scale_x, scale_y) - - if (cherub){ - var _x_loc = XX+(width/2); - var _y_loc = YY; - draw_sprite_ext(spr_pixel_cherub, 0, _x_loc, _y_loc , decoration_scale*2.5, decoration_scale*2.5, 0, c_white, 1); - if (draggable){ - drag_logic(); - } - } - - /*if (draggable && scr_hit(XX+(width/2)-(60*decoration_scale,) YY-(60*decoration_scale) ,XX+(width/2)+(60*decoration_scale),YY)){ +function DataSlate(data = {}) constructor { + static_line = 1; + title = ""; + sub_title = ""; + body_text = ""; + inside_method = ""; + XX = 0; + YY = 0; + width = 0; + height = 0; + percent_cut = 0; + set_width = false; + + draggable = false; + cherub = false; + + top_anchor = [ + 340, + 14 + ]; + + style = "default"; + + tooltip_drawing = []; + + blend_col = 5998382; + draw_top_piece = true; + move_data_to_current_scope(data, true); + + drag_engaged = false; + + top_piece_style = "aquila"; + + draw_offsets = []; + + decoration_scale = 0; + + static entered = function() { + var _hit = scr_hit(XX - 4, YY, XX + width, YY + height); + if (!_hit && cherub) { + _hit = hit_cherub(); + } + return _hit || drag_engaged; + }; + + static draw_with_dimensions = function(xx = -1, yy = -1, Width = -1, Height = -1) { + if (Width != -1) { + width = Width; + } + if (Height != -1) { + height = Height; + } + var _scale_x = width / 860; + var _scale_y = height / 850; + draw(xx, yy, _scale_x, _scale_y); + }; + + static hit_cherub = function() { + var _box_aug = 80 * (decoration_scale * 2.5); + var _x_loc = XX + (width / 2); + var _y_loc = YY; + return scr_hit_dimensions(_x_loc - _box_aug, _y_loc - _box_aug, _box_aug * 2, _box_aug); + }; + + static drag_logic = function() { + if (!drag_engaged) { + if (hit_cherub()) { + drag_engaged = device_mouse_check_button_pressed(0, mb_left); + var _mouse_consts = return_mouse_consts(); + draw_offsets = [ + _mouse_consts[0] - XX, + _mouse_consts[1] - YY + ]; + } + } else { + drag_engaged = !device_mouse_check_button_released(0, mb_left); + } + + if (drag_engaged) { + var _mouse_consts = return_mouse_consts(); + XX = _mouse_consts[0] - draw_offsets[0]; + YY = _mouse_consts[1] - draw_offsets[1]; + } + }; + + static draw = function(xx = -1, yy = -1, scale_x = 1, scale_y = 1) { + if (xx != -1) { + XX = xx; + } + if (yy != -1) { + YY = yy; + } + + if (!set_width) { + width = 860 * scale_x; + height = 850 * scale_y; + } + + decoration_scale = min(scale_x, scale_y); + + if (cherub) { + var _x_loc = XX + (width / 2); + var _y_loc = YY; + draw_sprite_ext(spr_pixel_cherub, 0, _x_loc, _y_loc, decoration_scale * 2.5, decoration_scale * 2.5, 0, c_white, 1); + if (draggable) { + drag_logic(); + } + } + + /*if (draggable && scr_hit(XX+(width/2)-(60*decoration_scale,) YY-(60*decoration_scale) ,XX+(width/2)+(60*decoration_scale),YY)){ }*/ - switch (style){ - case "default": - draw_sprite_ext(spr_slate_featureless,1, XX,YY, scale_x, scale_y, 0, c_white, 1); - break; - case "decorated": - draw_sprite_stretched(spr_data_slate_back, 0, XX,YY, width, height); - draw_sprite_stretched(spr_slate_side, 0, XX,YY, width, height); - draw_rectangle_color_simple(XX,YY, XX+width,YY+height, 0, blend_col, 0.05); - break; - - case "plain": - draw_sprite_stretched(spr_data_slate_back, 0, XX,YY, width, height); - draw_rectangle_color_simple(XX,YY, XX+width,YY+height, 0, blend_col, 0.05); - break; - } - - if (is_callable(inside_method)){ - inside_method(); - } - if (static_line<=10) then draw_set_alpha(static_line/10); - if (static_line>10) then draw_set_alpha(1-((static_line-10)/10)); - draw_set_color(5998382); - var line_move = YY+(70*scale_y)+((36*scale_y)*static_line); - draw_line(XX+(30*scale_x),line_move,XX+(820*scale_x),line_move); - draw_set_alpha(1); - if (irandom(75)=0 && static_line>1){static_line--;} - else{ - static_line+=0.1; - } - if (static_line>20) then static_line=1; - draw_set_color(c_gray); - draw_set_halign(fa_center); - var draw_height = 5; - if (title!=""){ - draw_text_transformed(XX+(0.5*width), YY+(50*scale_y), title, 3*scale_x, 3*scale_y, 0); - draw_height += (string_height(title)*3)*scale_y; - } - if (sub_title!=""){ - draw_text_transformed(XX+(0.5*width), YY+(50*scale_y)+draw_height, sub_title, 2*scale_x, 2*scale_y, 0); - draw_height+=(25*scale_y) +(string_height(sub_title)*2)*scale_y; - } - if (body_text!=""){ - draw_text_ext(XX+(0.5*width), YY+(50*scale_y)+draw_height, string_hash_to_newline(body_text), -1, width-60); - } - switch (style){ - case "decorated": - var _slate_scalex = width/sprite_get_width(spr_slate_side); - var _slate_scaley = height/sprite_get_height(spr_slate_side); - draw_sprite(spr_data_slate_corner_decoration, 0,XX+width - (70*_slate_scalex), YY + (7*_slate_scaley)); - break; - case "default": - if (draw_top_piece){ - if (top_piece_style == "aquila"){ - draw_sprite_ext(spr_slate_top,1, XX+(top_anchor[0]*scale_x),YY + (top_anchor[1] * scale_y ), decoration_scale, decoration_scale, 0, c_white, 1); - } - - } - break; - - } - x2 = XX+width; - y2 = YY+height; - } - - static draw_cut = function(xx,yy, scale_x=1, scale_y=1, middle_percent=percent_cut){ - XX=xx; - YY=yy; - draw_sprite_part_ext(spr_data_slate,1, 0, 0, 850, 69, XX, YY, scale_x, scale_y, c_white, 1); - draw_sprite_part_ext(spr_data_slate,1, 0, 69, 850, 683*(middle_percent/100), XX, YY+(69*scale_y), scale_x, scale_y, c_white, 1); - draw_sprite_part_ext(spr_data_slate,1, 0, 752, 850, 98, XX, YY+(69+683*((middle_percent/100)))*scale_y, scale_x, scale_y, c_white, 1); - width = 860*scale_x; - height = (69+(683*(middle_percent/100))+98 )*scale_y; - if (is_callable(inside_method)){ - inside_method(); - } - } - - static percent_mod_draw_cut = function(xx,yy, scale_x=1, scale_y=1, mod_edit=1){ - percent_cut = min(percent_cut+mod_edit, 100); - if (!percent_cut) then percent_cut=0; - draw_cut(xx,yy, scale_x, scale_y); - } + switch (style) { + case "default": + draw_sprite_ext(spr_slate_featureless, 1, XX, YY, scale_x, scale_y, 0, c_white, 1); + break; + case "decorated": + draw_sprite_stretched(spr_data_slate_back, 0, XX, YY, width, height); + draw_sprite_stretched(spr_slate_side, 0, XX, YY, width, height); + draw_rectangle_color_simple(XX, YY, XX + width, YY + height, 0, blend_col, 0.05); + break; + + case "plain": + draw_sprite_stretched(spr_data_slate_back, 0, XX, YY, width, height); + draw_rectangle_color_simple(XX, YY, XX + width, YY + height, 0, blend_col, 0.05); + break; + } + + if (is_callable(inside_method)) { + inside_method(); + } + if (static_line <= 10) { + draw_set_alpha(static_line / 10); + } + if (static_line > 10) { + draw_set_alpha(1 - ((static_line - 10) / 10)); + } + draw_set_color(5998382); + var line_move = YY + (70 * scale_y) + ((36 * scale_y) * static_line); + draw_line(XX + (30 * scale_x), line_move, XX + (820 * scale_x), line_move); + draw_set_alpha(1); + if (irandom(75) == 0 && static_line > 1) { + static_line--; + } else { + static_line += 0.1; + } + if (static_line > 20) { + static_line = 1; + } + draw_set_color(c_gray); + draw_set_halign(fa_center); + var draw_height = 5; + if (title != "") { + draw_text_transformed(XX + (0.5 * width), YY + (50 * scale_y), title, 3 * scale_x, 3 * scale_y, 0); + draw_height += (string_height(title) * 3) * scale_y; + } + if (sub_title != "") { + draw_text_transformed(XX + (0.5 * width), YY + (50 * scale_y) + draw_height, sub_title, 2 * scale_x, 2 * scale_y, 0); + draw_height += (25 * scale_y) + (string_height(sub_title) * 2) * scale_y; + } + if (body_text != "") { + draw_text_ext(XX + (0.5 * width), YY + (50 * scale_y) + draw_height, string_hash_to_newline(body_text), -1, width - 60); + } + switch (style) { + case "decorated": + var _slate_scalex = width / sprite_get_width(spr_slate_side); + var _slate_scaley = height / sprite_get_height(spr_slate_side); + draw_sprite(spr_data_slate_corner_decoration, 0, XX + width - (70 * _slate_scalex), YY + (7 * _slate_scaley)); + break; + case "default": + if (draw_top_piece) { + if (top_piece_style == "aquila") { + draw_sprite_ext(spr_slate_top, 1, XX + (top_anchor[0] * scale_x), YY + (top_anchor[1] * scale_y), decoration_scale, decoration_scale, 0, c_white, 1); + } + } + break; + } + x2 = XX + width; + y2 = YY + height; + }; + + static draw_cut = function(xx, yy, scale_x = 1, scale_y = 1, middle_percent = percent_cut) { + XX = xx; + YY = yy; + draw_sprite_part_ext(spr_data_slate, 1, 0, 0, 850, 69, XX, YY, scale_x, scale_y, c_white, 1); + draw_sprite_part_ext(spr_data_slate, 1, 0, 69, 850, 683 * (middle_percent / 100), XX, YY + (69 * scale_y), scale_x, scale_y, c_white, 1); + draw_sprite_part_ext(spr_data_slate, 1, 0, 752, 850, 98, XX, YY + (69 + 683 * (middle_percent / 100)) * scale_y, scale_x, scale_y, c_white, 1); + width = 860 * scale_x; + height = (69 + (683 * (middle_percent / 100)) + 98) * scale_y; + if (is_callable(inside_method)) { + inside_method(); + } + }; + + static percent_mod_draw_cut = function(xx, yy, scale_x = 1, scale_y = 1, mod_edit = 1) { + percent_cut = min(percent_cut + mod_edit, 100); + if (!percent_cut) { + percent_cut = 0; + } + draw_cut(xx, yy, scale_x, scale_y); + }; } - - - - -function draw_building_builder(xx, yy, req_require, building_sprite){ - var clicked =false; - draw_sprite_ext(building_sprite, 0, xx, yy, 0.5, 0.5, 0, c_white, 1); - var image_bottom = yy+50; - var image_middle = xx-15; - if (obj_controller.requisition>=req_require){ - if (scr_hit(image_middle+30, image_bottom+28, image_middle+78, image_bottom+44)){ - draw_sprite_ext(spr_slate_2, 5, image_middle-10, image_bottom, 1, 1, 0, c_white, 1); - if (scr_click_left()){ - clicked=true; - } - } else { - draw_sprite_ext(spr_slate_2, 3, image_middle-10, image_bottom, 1, 1, 0, c_white, 1); - } - } else { - draw_sprite_ext(spr_slate_2, 7, image_middle-10, image_bottom, 1, 1, 0, c_white, 1); - } - draw_sprite_ext(spr_requisition,0,image_middle+65,image_bottom+30,1,1,0,c_white,1); - draw_set_halign(fa_left); - draw_text(image_middle+32, image_bottom+30, req_require); - return clicked; +function draw_building_builder(xx, yy, req_require, building_sprite) { + var clicked = false; + draw_sprite_ext(building_sprite, 0, xx, yy, 0.5, 0.5, 0, c_white, 1); + var image_bottom = yy + 50; + var image_middle = xx - 15; + if (obj_controller.requisition >= req_require) { + if (scr_hit(image_middle + 30, image_bottom + 28, image_middle + 78, image_bottom + 44)) { + draw_sprite_ext(spr_slate_2, 5, image_middle - 10, image_bottom, 1, 1, 0, c_white, 1); + if (scr_click_left()) { + clicked = true; + } + } else { + draw_sprite_ext(spr_slate_2, 3, image_middle - 10, image_bottom, 1, 1, 0, c_white, 1); + } + } else { + draw_sprite_ext(spr_slate_2, 7, image_middle - 10, image_bottom, 1, 1, 0, c_white, 1); + } + draw_sprite_ext(spr_requisition, 0, image_middle + 65, image_bottom + 30, 1, 1, 0, c_white, 1); + draw_set_halign(fa_left); + draw_text(image_middle + 32, image_bottom + 30, req_require); + return clicked; } -function DataSlateMKTwo()constructor{ - height=0; - width=0; - XX=0; - YY=0; - static entered = function(){ - return scr_hit(XX, YY, XX+width, YY+height); - } - static draw = function(xx,yy,x_scale=1, y_scale=1){ - XX=xx; - YY=yy; - height = 250*y_scale; - width=365*x_scale; - draw_sprite_ext(spr_slate_2, 1, xx, yy, x_scale, y_scale, 0, c_white, 1); - draw_sprite_ext(spr_slate_2, 0, xx, yy, x_scale, y_scale, 0, c_white, 1); - draw_sprite_ext(spr_slate_2, 2, xx, yy, x_scale, y_scale, 0, c_white, 1); - //draw_sprite_ext(spr_slate_2, 0, xx, yy, 1, 1, 0, c_white, 1) - } +function DataSlateMKTwo() constructor { + height = 0; + width = 0; + XX = 0; + YY = 0; + + static entered = function() { + return scr_hit(XX, YY, XX + width, YY + height); + }; + + static draw = function(xx, yy, x_scale = 1, y_scale = 1) { + XX = xx; + YY = yy; + height = 250 * y_scale; + width = 365 * x_scale; + draw_sprite_ext(spr_slate_2, 1, xx, yy, x_scale, y_scale, 0, c_white, 1); + draw_sprite_ext(spr_slate_2, 0, xx, yy, x_scale, y_scale, 0, c_white, 1); + draw_sprite_ext(spr_slate_2, 2, xx, yy, x_scale, y_scale, 0, c_white, 1); + //draw_sprite_ext(spr_slate_2, 0, xx, yy, 1, 1, 0, c_white, 1) + }; } -function RackAndPinion(Type="forward", scale = 1) constructor{ - reverse =false; - rack_y=0; - rotation = 360; - type=Type - if (type="forward"){ - draw = function(x, y, freeze=false, Reverse=""){ - x+=19; - if (!freeze){ - if (Reverse != ""){ - if (Reverse){ - reverse=true; - } else { - reverse=false; - } - } - draw_sprite_ext(spr_cog_pinion, 0, x, y, 1, 1, rotation, c_white, 1) - if (!reverse){ - rotation-=4; - } else { - rotation+=4; - } - rack_y = (75.3982236862/360)*(360-rotation); - if (rack_y > 70){ - reverse = true; - } else if (rack_y < 2){ - reverse = false; - } - draw_sprite_ext(spr_rack, 0, x-13, y-rack_y, 1, 1, 0, c_white, 1) - } else { - draw_sprite_ext(spr_cog_pinion, 0, x, y, 1, 1, rotation, c_white, 1) - draw_sprite_ext(spr_rack, 0, x-13, y-rack_y, 1, 1, 0, c_white, 1) - } - } - } else if (type="backward"){ - draw = function(x, y, freeze=false, Reverse=""){ - x-=19; - if (!freeze){ - if (Reverse != ""){ - if (Reverse){ - reverse=true; - } else { - reverse=false; - } - } - draw_sprite_ext(spr_cog_pinion, 0, x, y, 1, 1, rotation, c_white, 1) - if (!reverse){ - rotation+=4; - } else { - rotation-=4; - } - rack_y = (75.3982236862/360)*(360-rotation) - if (rack_y > 70){ - reverse = true; - } else if (rack_y < 2){ - reverse = false; - } - draw_sprite_ext(spr_rack, 0, x+13, y+rack_y, -1, 1, 0, c_white, 1) - } else { - draw_sprite_ext(spr_cog_pinion, 0, x, y, 1, 1, rotation, c_white, 1) - draw_sprite_ext(spr_rack, 0, x+13, y+rack_y, -1, 1, 0, c_white, 1) - } - } - } +function RackAndPinion(Type = "forward", scale = 1) constructor { + reverse = false; + rack_y = 0; + rotation = 360; + type = Type; + if (type == "forward") { + draw = function(x, y, freeze = false, Reverse = "") { + x += 19; + if (!freeze) { + if (Reverse != "") { + if (Reverse) { + reverse = true; + } else { + reverse = false; + } + } + draw_sprite_ext(spr_cog_pinion, 0, x, y, 1, 1, rotation, c_white, 1); + if (!reverse) { + rotation -= 4; + } else { + rotation += 4; + } + rack_y = (75.3982236862 / 360) * (360 - rotation); + if (rack_y > 70) { + reverse = true; + } else if (rack_y < 2) { + reverse = false; + } + draw_sprite_ext(spr_rack, 0, x - 13, y - rack_y, 1, 1, 0, c_white, 1); + } else { + draw_sprite_ext(spr_cog_pinion, 0, x, y, 1, 1, rotation, c_white, 1); + draw_sprite_ext(spr_rack, 0, x - 13, y - rack_y, 1, 1, 0, c_white, 1); + } + }; + } else if (type == "backward") { + draw = function(x, y, freeze = false, Reverse = "") { + x -= 19; + if (!freeze) { + if (Reverse != "") { + if (Reverse) { + reverse = true; + } else { + reverse = false; + } + } + draw_sprite_ext(spr_cog_pinion, 0, x, y, 1, 1, rotation, c_white, 1); + if (!reverse) { + rotation += 4; + } else { + rotation -= 4; + } + rack_y = (75.3982236862 / 360) * (360 - rotation); + if (rack_y > 70) { + reverse = true; + } else if (rack_y < 2) { + reverse = false; + } + draw_sprite_ext(spr_rack, 0, x + 13, y + rack_y, -1, 1, 0, c_white, 1); + } else { + draw_sprite_ext(spr_cog_pinion, 0, x, y, 1, 1, rotation, c_white, 1); + draw_sprite_ext(spr_rack, 0, x + 13, y + rack_y, -1, 1, 0, c_white, 1); + } + }; + } } -function SpeedingDot(XX,YY, limit) constructor{ - bottom_limit = limit; - stack = 0; - yyy=YY; - xxx=XX; - draw = function(xx,yy){ - if (bottom_limit+(48*0.7)0 ? 36-stack :0; - var bottom_cut = bottom_limit 0 ? 36 - stack : 0; + var bottom_cut = bottom_limit < stack ? 46 - stack - bottom_limit : 46; + draw_sprite_part_ext(spr_research_bar, 2, 0, top_cut, 200, bottom_cut, xx - 105, yy + stack, 1, 0.7, c_white, 1); + stack += 3; + }; + current_y = function() { + return yy + stack; + }; } -function GlowDot() constructor{ - flash = 0 - flash_size = 5; - flash_modifier = 1; - one_flash_finished = true; - draw = function(xx, yy){ - draw_set_color(c_green); - for (var i=0; i<=flash_size;i++){ - draw_set_alpha(1 - ((1/40)*i)) - draw_circle(xx, yy, (i/3), 1); - } - if (flash==0){ - if (flash_size * flash_modifier<40*flash_modifier){ - flash_size+=flash_modifier; - } else { - flash = 1; - flash_size-=flash_modifier; - } - } else { - if (flash_size * flash_modifier > 1*flash_modifier){ - flash_size-=flash_modifier; - }else { - flash_size+=flash_modifier; - flash = 0; - } - } - draw_set_alpha(1); - } - draw_one_flash = function(xx, yy){ - if (one_flash_finished) then exit; - draw_set_color(c_green); - for (var i=0; i<=flash_size;i++){ - draw_set_alpha(1 - ((1/40)*i)) - draw_circle(xx, yy, (i/3), 1); - } - if (flash==0){ - if (flash_size<40){ - flash_size++; - } else { - flash = 1; - flash_size--; - } - } else { - if (flash_size > 1){ - flash_size--; - }else { - flash_size++; - flash = 0; - one_flash_finished = true; - } - } - } + +function GlowDot() constructor { + flash = 0; + flash_size = 5; + flash_modifier = 1; + one_flash_finished = true; + draw = function(xx, yy) { + draw_set_color(c_green); + for (var i = 0; i <= flash_size; i++) { + draw_set_alpha(1 - ((1 / 40) * i)); + draw_circle(xx, yy, (i / 3), 1); + } + if (flash == 0) { + if (flash_size * flash_modifier < 40 * flash_modifier) { + flash_size += flash_modifier; + } else { + flash = 1; + flash_size -= flash_modifier; + } + } else { + if (flash_size * flash_modifier > 1 * flash_modifier) { + flash_size -= flash_modifier; + } else { + flash_size += flash_modifier; + flash = 0; + } + } + draw_set_alpha(1); + }; + draw_one_flash = function(xx, yy) { + if (one_flash_finished) { + exit; + } + draw_set_color(c_green); + for (var i = 0; i <= flash_size; i++) { + draw_set_alpha(1 - ((1 / 40) * i)); + draw_circle(xx, yy, (i / 3), 1); + } + if (flash == 0) { + if (flash_size < 40) { + flash_size++; + } else { + flash = 1; + flash_size--; + } + } else { + if (flash_size > 1) { + flash_size--; + } else { + flash_size++; + flash = 0; + one_flash_finished = true; + } + } + }; } -function ShutterButton() constructor{ - time_open = 0; - click_timer = 0; - Width = 315; - Height = 90; - XX=0; - YY=0; - width=0; - height=0; - cover_text = ""; - tooltip = ""; - - /*cover_sprite = spr_shutter_button_cover; +function ShutterButton() constructor { + time_open = 0; + click_timer = 0; + Width = 315; + Height = 90; + XX = 0; + YY = 0; + width = 0; + height = 0; + cover_text = ""; + tooltip = ""; + + /*cover_sprite = spr_shutter_button_cover; static make_custom_cover(){ }*/ - right_rack = new RackAndPinion(); - left_rack = new RackAndPinion("backward"); - background = new DataSlate(); - - static hit = function(){ - return scr_hit(XX, YY, XX+width, YY+height); - } - background.inside_method = function(){ - var yy = YY; - var xx = XX; - var text_draw = xx+(width/2)-(string_width(text)*(3*scale)/2); - if (hit()){ - draw_rectangle_color_simple(xx, yy, xx+width, yy+height, false, CM_GREEN_COLOR, 0.35) - } - draw_set_halign(fa_left); - draw_set_color(c_red); - if (click_timer>0){ - draw_text_transformed(text_draw, yy+(24*scale), text, 3*scale, 3*scale, 0); - } else { - draw_text_transformed(text_draw, yy+(20*scale), text, 3*scale, 3*scale, 0); - } - } - - background.style = "plain"; - style = "plain"; - - /*draw_with_dimensions = function(xx,yy, ,width, entered){ + right_rack = new RackAndPinion(); + left_rack = new RackAndPinion("backward"); + background = new DataSlate(); + + static hit = function() { + return scr_hit(XX, YY, XX + width, YY + height); + }; + + background.inside_method = function() { + var yy = YY; + var xx = XX; + var text_draw = xx + (width / 2) - (string_width(text) * (3 * scale) / 2); + if (hit()) { + draw_rectangle_color_simple(xx, yy, xx + width, yy + height, false, CM_GREEN_COLOR, 0.35); + } + draw_set_halign(fa_left); + draw_set_color(c_red); + if (click_timer > 0) { + draw_text_transformed(text_draw, yy + (24 * scale), text, 3 * scale, 3 * scale, 0); + } else { + draw_text_transformed(text_draw, yy + (20 * scale), text, 3 * scale, 3 * scale, 0); + } + }; + + background.style = "plain"; + style = "plain"; + + /*draw_with_dimensions = function(xx,yy, ,width, entered){ draw_shutter(); }*/ - inside_method = function(){ - var yy = YY; - var xx = XX; - var text_draw = xx+(width/2)-(string_width(text)*(3*scale)/2); - if (point_and_click([XX, YY, XX+width, YY+height]) || click_timer>0 ){ - shutter_backdrop = 7; - click_timer++; - } else { - shutter_backdrop = 6; - } - draw_sprite_ext(spr_shutter_button, shutter_backdrop, XX, YY, scale, scale, 0, c_white, 1); - draw_set_halign(fa_left); - draw_set_color(c_red); - if (click_timer>0){ - draw_text_transformed(text_draw, yy+(24*scale), text, 3*scale, 3*scale, 0); - } else { - draw_text_transformed(text_draw, yy+(20*scale), text, 3*scale, 3*scale, 0); - } - } - - draw_shutter = function(xx=-1,yy=-1,text, scale=1, entered = ""){ - add_draw_return_values(); - if (xx != -1){ - XX=xx; - } - if (yy != -1){ - YY=yy; - } + inside_method = function() { + var yy = YY; + var xx = XX; + var text_draw = xx + (width / 2) - (string_width(text) * (3 * scale) / 2); + if ( + point_and_click( + [ + XX, + YY, + XX + width, + YY + height + ] + ) + || click_timer > 0 + ) { + shutter_backdrop = 7; + click_timer++; + } else { + shutter_backdrop = 6; + } + draw_sprite_ext(spr_shutter_button, shutter_backdrop, XX, YY, scale, scale, 0, c_white, 1); + draw_set_halign(fa_left); + draw_set_color(c_red); + if (click_timer > 0) { + draw_text_transformed(text_draw, yy + (24 * scale), text, 3 * scale, 3 * scale, 0); + } else { + draw_text_transformed(text_draw, yy + (20 * scale), text, 3 * scale, 3 * scale, 0); + } + }; + + draw_shutter = function(xx = -1, yy = -1, text, scale = 1, entered = "") { + add_draw_return_values(); + if (xx != -1) { + XX = xx; + } + if (yy != -1) { + YY = yy; + } draw_set_alpha(1); self.scale = scale; self.text = text; draw_set_font(fnt_40k_12); draw_set_halign(fa_left); - draw_set_color(c_gray); - width = Width *scale; - height = Height *scale; - if (text=="") then entered = false; - - if (entered==""){ - entered = scr_hit(xx, yy, xx+width, yy+height); - } else { - entered=entered; - } - - if (tooltip!= "" && scr_hit(xx, yy, xx+width, yy+height)){ - tooltip_draw(tooltip); - } - var shutter_backdrop = 6; - if (entered || click_timer>0){ - if (time_open<24){ - time_open++; - right_rack.draw(xx+width, yy, false, false); - left_rack.draw(xx, yy, false, false); - } else { - right_rack.draw(xx+width, yy, true); - left_rack.draw(xx, yy, true); - } - } else if (time_open>0){ - time_open--; - right_rack.draw(xx+width, yy, false, true); - left_rack.draw(xx, yy, false, true); - } else { - right_rack.draw(xx+width, yy, true); - left_rack.draw(xx, yy, true); - } - - var main_sprite = 0; - if (time_open<2){ - draw_sprite_ext(spr_shutter_button, main_sprite, xx, yy, scale, scale, 0, c_white, 1); - if (cover_text != ""){ - draw_set_valign(fa_top); - draw_set_font(fnt_Embossed_metal); - var _cover_scale = 3*scale; - while (string_width(cover_text) * _cover_scale > width-(5*scale)){ - _cover_scale -= 0.1; - } - var text_draw = xx+(width/2)-((string_width(cover_text)*(_cover_scale))/2); - draw_set_color(c_black); - draw_text_transformed(text_draw, yy+(_cover_scale*1), cover_text, _cover_scale, _cover_scale, 0); - } - } else if (time_open>=2){ - - main_sprite=floor(time_open/6) + 1; - - if (style == "plain"){ - inside_method(); - } else if (style == "slate"){ - background.draw_with_dimensions(xx, yy, width, height); - } - draw_sprite_ext(spr_shutter_button, main_sprite, xx, yy, scale, scale, 0, c_white, 1); - } - draw_set_color(c_grey); - if (click_timer>7){ - click_timer = 0; - return true; - } else { - return false; - } - // pop_draw_return_values(); // Unreachable, commented to silence compiler message GM2047 - } + draw_set_color(c_gray); + width = Width * scale; + height = Height * scale; + if (text == "") { + entered = false; + } + + if (entered == "") { + entered = scr_hit(xx, yy, xx + width, yy + height); + } else { + entered = entered; + } + + if (tooltip != "" && scr_hit(xx, yy, xx + width, yy + height)) { + tooltip_draw(tooltip); + } + var shutter_backdrop = 6; + if (entered || click_timer > 0) { + if (time_open < 24) { + time_open++; + right_rack.draw(xx + width, yy, false, false); + left_rack.draw(xx, yy, false, false); + } else { + right_rack.draw(xx + width, yy, true); + left_rack.draw(xx, yy, true); + } + } else if (time_open > 0) { + time_open--; + right_rack.draw(xx + width, yy, false, true); + left_rack.draw(xx, yy, false, true); + } else { + right_rack.draw(xx + width, yy, true); + left_rack.draw(xx, yy, true); + } + + var main_sprite = 0; + if (time_open < 2) { + draw_sprite_ext(spr_shutter_button, main_sprite, xx, yy, scale, scale, 0, c_white, 1); + if (cover_text != "") { + draw_set_valign(fa_top); + draw_set_font(fnt_Embossed_metal); + var _cover_scale = 3 * scale; + while (string_width(cover_text) * _cover_scale > width - (5 * scale)) { + _cover_scale -= 0.1; + } + var text_draw = xx + (width / 2) - ((string_width(cover_text) * _cover_scale) / 2); + draw_set_color(c_black); + draw_text_transformed(text_draw, yy + (_cover_scale * 1), cover_text, _cover_scale, _cover_scale, 0); + } + } else if (time_open >= 2) { + main_sprite = floor(time_open / 6) + 1; + + if (style == "plain") { + inside_method(); + } else if (style == "slate") { + background.draw_with_dimensions(xx, yy, width, height); + } + draw_sprite_ext(spr_shutter_button, main_sprite, xx, yy, scale, scale, 0, c_white, 1); + } + draw_set_color(c_grey); + if (click_timer > 7) { + click_timer = 0; + return true; + } else { + return false; + } + // pop_draw_return_values(); // Unreachable, commented to silence compiler message GM2047 + }; } - - - diff --git a/scripts/scr_culture_visuals/scr_culture_visuals.gml b/scripts/scr_culture_visuals/scr_culture_visuals.gml index 3df7aa37c9..09bd5f2fb9 100644 --- a/scripts/scr_culture_visuals/scr_culture_visuals.gml +++ b/scripts/scr_culture_visuals/scr_culture_visuals.gml @@ -1,21 +1,20 @@ -function load_visual_sets(){ +function load_visual_sets() { var _vis_set_directory = working_directory + "\\main\\visual_sets"; - if (directory_exists(_vis_set_directory)){ - + if (directory_exists(_vis_set_directory)) { var _file_buffer = buffer_load($"{_vis_set_directory}\\use_sets.json"); if (_file_buffer == -1) { - throw ("Could not open file"); + throw "Could not open file"; } var _json_string = buffer_read(_file_buffer, buffer_string); buffer_delete(_file_buffer); var _raw_data = json_parse(_json_string); - if (!is_array(_raw_data)){ - throw ("use_sets.json File Wrong Format"); + if (!is_array(_raw_data)) { + throw "use_sets.json File Wrong Format"; } - for (var i=0;i=0;g--){ + for (var s = 0; s < array_length(_subs); s++) { + var _sub_group = _subs[s]; + for (var g = array_length(_sub_group) - 1; g >= 0; g--) { var _found_sprite = false; var _subimg = _sub_group[g]; - if (!is_string(_subimg)){ - if (!sprite_exists(_subimg)){ - array_delete(_sub_group,g,1); + if (!is_string(_subimg)) { + if (!sprite_exists(_subimg)) { + array_delete(_sub_group, g, 1); } continue; } - if (_subimg == "blank"){ + if (_subimg == "blank") { _item.subcomponents[s][g] = spr_blank; _found_sprite = true; } else { - for (var m=0;m 0 ? livery_picker.role_set :eROLE.Tactical]; - }else { + }; + + static role = function() { + with (obj_creation) { + if (obj_creation.livery_selection_options.current_selection == 2) { + return role[100][livery_picker.role_set > 0 ? livery_picker.role_set : eROLE.Tactical]; + } else { return role[100][eROLE.Tactical]; } } - } - static weapon_one = function(){ - with (obj_creation){ - return wep1[100][livery_picker.role_set > 0 ? livery_picker.role_set :eROLE.Tactical]; + }; + + static weapon_one = function() { + with (obj_creation) { + return wep1[100][livery_picker.role_set > 0 ? livery_picker.role_set : eROLE.Tactical]; } - } - static race = function(){ + }; + + static race = function() { return "1"; - } - static weapon_two = function(){ - with (obj_creation){ - return wep2[100][livery_picker.role_set > 0 ? livery_picker.role_set :eROLE.Tactical]; + }; + + static weapon_two = function() { + with (obj_creation) { + return wep2[100][livery_picker.role_set > 0 ? livery_picker.role_set : eROLE.Tactical]; } - } + }; + last_armour = "MK7 Aquila"; - static armour = function(){ + + static armour = function() { var armours = LIST_BASIC_POWER_ARMOUR; var _last_armour = last_armour; - with (obj_creation){ - if (!livery_picker.freeze_armour){ - var _armour = armour[100][livery_picker.role_set > 0 ? livery_picker.role_set : eROLE.Tactical]; - if (array_contains(armours, _armour) || _armour == STR_ANY_POWER_ARMOUR){ - _armour = array_random_element(armours); - } else if(array_contains(LIST_TERMINATOR_ARMOUR, _armour)|| _armour == STR_ANY_POWER_ARMOUR){ + with (obj_creation) { + if (!livery_picker.freeze_armour) { + var _armour = armour[100][livery_picker.role_set > 0 ? livery_picker.role_set : eROLE.Tactical]; + if (array_contains(armours, _armour) || _armour == STR_ANY_POWER_ARMOUR) { + _armour = array_random_element(armours); + } else if (array_contains(LIST_TERMINATOR_ARMOUR, _armour) || _armour == STR_ANY_POWER_ARMOUR) { _armour = array_random_element(LIST_TERMINATOR_ARMOUR); } - if (_armour == "Power Armour"){ - _armour = "MK7 Aquila"; + if (_armour == "Power Armour") { + _armour = "MK7 Aquila"; } } else { _armour = _last_armour; } - if (obj_creation.livery_selection_options.current_selection == 2){ - if (!array_contains(armours, _armour)){ - _armour = "MK7 Aquila"; + if (obj_creation.livery_selection_options.current_selection == 2) { + if (!array_contains(armours, _armour)) { + _armour = "MK7 Aquila"; } } } last_armour = _armour; return _armour; - } - static gear = function(){ - with (obj_creation){ - return gear[100][livery_picker.role_set > 0 ? livery_picker.role_set :eROLE.Tactical]; + }; + + static gear = function() { + with (obj_creation) { + return gear[100][livery_picker.role_set > 0 ? livery_picker.role_set : eROLE.Tactical]; } - } - static mobility_item = function(){ - with (obj_creation){ - return mobi[100][livery_picker.role_set > 0 ? livery_picker.role_set :eROLE.Tactical]; + }; + + static mobility_item = function() { + with (obj_creation) { + return mobi[100][livery_picker.role_set > 0 ? livery_picker.role_set : eROLE.Tactical]; } - } - static IsSpecialist = function(search_type=SPECIALISTS_STANDARD,include_trainee=false, include_heads=true){ - return is_specialist(role(), search_type,include_trainee, include_heads); - } + }; + + static IsSpecialist = function(search_type = SPECIALISTS_STANDARD, include_trainee = false, include_heads = true) { + return is_specialist(role(), search_type, include_trainee, include_heads); + }; + static has_trait = marine_has_trait; - static is_dreadnought = function(){ + + static is_dreadnought = function() { var _arm_data = gear_weapon_data("armour", last_armour); - if (is_struct(_arm_data)){ - if (_arm_data.has_tag("dreadnought")){ - return true + if (is_struct(_arm_data)) { + if (_arm_data.has_tag("dreadnought")) { + return true; } } return false; - } + }; + experience = 120; + //get equipment data methods by deafult they garb all equipment data and return an equipment struct e.g new EquipmentStruct(item_data, core_type,quality="none") static get_armour_data = function(type = "all") { return gear_weapon_data("armour", armour(), type, false); @@ -1682,9 +2049,9 @@ function DummyMarine()constructor{ return gear_weapon_data("weapon", weapon_two(), type, false); }; - static equipment_has_tag = function(tag, area){ + static equipment_has_tag = function(tag, area) { var tags = []; - switch (area){ + switch (area) { case "wep1": tags = get_weapon_one_data("tags"); break; @@ -1699,135 +2066,159 @@ function DummyMarine()constructor{ break; case "gear": tags = get_gear_data("tags"); - break; + break; } - if (!is_array(tags) || array_length(tags) == 0){ + if (!is_array(tags) || array_length(tags) == 0) { return false; } else { return array_contains(tags, tag); } - } + }; } -function scr_get_body_data (body_item_key,body_slot="none"){ - if (body_slot!="none"){ - if (struct_exists(body, body_slot)){ - if (struct_exists(body[$ body_slot], body_item_key)){ - return body[$ body_slot][$ body_item_key] +function scr_get_body_data(body_item_key, body_slot = "none") { + if (body_slot != "none") { + if (struct_exists(body, body_slot)) { + if (struct_exists(body[$ body_slot], body_item_key)) { + return body[$ body_slot][$ body_item_key]; } else { return false; } - }else { + } else { return "invalid body area"; } } else { var item_key_map = {}; - var body_part_area_keys + var body_part_area_keys; var _body_parts = ARR_body_parts; - for (var i=0;i Date: Fri, 26 Dec 2025 21:48:55 -0500 Subject: [PATCH 12/45] Resolve deprecated draw_line camera calls for objects to silence some GM1024 warnings --- objects/obj_controller/Draw_64.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/obj_controller/Draw_64.gml b/objects/obj_controller/Draw_64.gml index f012982139..a690b128b8 100644 --- a/objects/obj_controller/Draw_64.gml +++ b/objects/obj_controller/Draw_64.gml @@ -217,7 +217,7 @@ function draw_line(x1, y1, y_slide, variable) { l_why = min(variable - 96, 11); } - draw_line(view_xview[0] + variable + x1, view_yview[0] + 10 + 1 + l_why, view_xview[0] + variable + x1, view_yview[0] + 10 + 37 - l_why); + draw_line(camera_get_view_x(view_camera[0]) + variable + x1, camera_get_view_y(view_camera[0]) + 10 + 1 + l_why, camera_get_view_x(view_camera[0]) + variable + x1, camera_get_view_y(view_camera[0]) + 10 + 37 - l_why); } } From 217fa01c51ad28f5f6e81ab4985e90ded905b1cc Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 21:49:18 -0500 Subject: [PATCH 13/45] Make the rabbit happy. --- objects/obj_en_ship/Step_0.gml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/objects/obj_en_ship/Step_0.gml b/objects/obj_en_ship/Step_0.gml index 2afa96d12f..9fe8438375 100644 --- a/objects/obj_en_ship/Step_0.gml +++ b/objects/obj_en_ship/Step_0.gml @@ -413,7 +413,7 @@ if (!__b__) { if ((facing == "right") && (point_direction(x, y, target_r.x, target_r.y) < 337) && (point_direction(x, y, target_r.x, target_r.y) > 203)) { ok = 2; } - if ((facing == "left") && (point_direction(x, y, target_r.x, target_r.y) > 22) && (point_direction(x, y, target_r.x, target_r.y) < 157)) { + if ((facing == "left") && (point_direction(x, y, target_l.x, target_l.y) > 22) && (point_direction(x, y, target_l.x, target_l.y) < 157)) { ok = 2; } @@ -432,9 +432,9 @@ if (!__b__) { // if (f=3) and (ship_id=2) then show_message("ammo: "+string(ammo)+" | range: "+string(range)); - if (ammo < 0) { - ok = 0; - } + //if (ammo < 0) { + //ok = 0; + //} ok = 3; if ((string_count("orpedo", wep) == 0) && (string_count("Interceptor", wep) == 0) && (string_count("ommerz", wep) == 0) && (string_count("Claws", wep) == 0) && (string_count("endrils", wep) == 0) && (ok == 3) && (owner != eFACTION.Necrons)) { @@ -477,13 +477,13 @@ if (!__b__) { if (string_count("Plasma", wep) == 1) { bull.sprite_index = spr_ground_plasma; bull.image_xscale = 2; - bullimage_yscale = 2; + bull.image_yscale = 2; bull.speed = 15; } if (string_count("Pyro-Acid", wep) == 1) { bull.sprite_index = spr_glob; bull.image_xscale = 2; - bullimage_yscale = 2; + bull.image_yscale = 2; } if ((string_count("Weapons", wep) == 1) && (owner == eFACTION.Eldar)) { @@ -566,10 +566,10 @@ if (!__b__) { if (((string_count("Claws", wep) == 1) || (string_count("endrils", wep) == 1)) && (ok == 3)) { if (target.shields <= 0) { - target.hp -= weapon_dam[wep]; + target.hp -= dam; } if (target.shields > 0) { - target.shields -= weapon_dam[wep]; + target.shields -= dam; } } if (((string_count("Interceptor", wep) == 1) || (string_count("ommerz", wep) == 1) || (string_count("Manta", wep) == 1) || (string_count("Glands", wep) == 1) || (string_count("Eldar Launch", wep) == 1)) && (ok == 3)) { @@ -829,7 +829,7 @@ if (__b__) { if ((facing == "right") && (point_direction(x, y, target_r.x, target_r.y) < 337) && (point_direction(x, y, target_r.x, target_r.y) > 203)) { ok = 2; } - if ((facing == "left") && (point_direction(x, y, target_r.x, target_r.y) > 22) && (point_direction(x, y, target_r.x, target_r.y) < 157)) { + if ((facing == "left") && (point_direction(x, y, target_l.x, target_l.y) > 22) && (point_direction(x, y, target_l.x, target_l.y) < 157)) { ok = 2; } @@ -848,9 +848,9 @@ if (__b__) { // if (f=3) and (ship_id=2) then show_message("ammo: "+string(ammo)+" | range: "+string(range)); - if (ammo < 0) { - ok = 0; - } + //if (ammo < 0) { + //ok = 0; + //} ok = 3; if ((string_count("orpedo", wep) == 0) && (string_count("Interceptor", wep) == 0) && (string_count("ommerz", wep) == 0) && (string_count("Claws", wep) == 0) && (string_count("endrils", wep) == 0) && (ok == 3)) { @@ -893,13 +893,13 @@ if (__b__) { if (string_count("Plasma", wep) == 1) { bull.sprite_index = spr_ground_plasma; bull.image_xscale = 2; - bullimage_yscale = 2; + bull.image_yscale = 2; bull.speed = 15; } if (string_count("Pyro-Acid", wep) == 1) { bull.sprite_index = spr_glob; bull.image_xscale = 2; - bullimage_yscale = 2; + bull.image_yscale = 2; } if ((string_count("Weapons", wep) == 1) && (owner == eFACTION.Eldar)) { @@ -942,10 +942,10 @@ if (__b__) { } if (((string_count("Claws", wep) == 1) || (string_count("endrils", wep) == 1)) && (ok == 3)) { if (target.shields <= 0) { - target.hp -= weapon_dam[wep]; + target.hp -= dam; } if (target.shields > 0) { - target.shields -= weapon_dam[wep]; + target.shields -= dam; } } if (((string_count("Interceptor", wep) == 1) || (string_count("ommerz", wep) == 1) || (string_count("Manta", wep) == 1) || (string_count("Glands", wep) == 1) || (string_count("Eldar Launch", wep) == 1)) && (ok == 3)) { From d985ca8423902401be4408f7f97d87df53e56699 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 21:55:58 -0500 Subject: [PATCH 14/45] Lint obj_controller --- objects/obj_controller/Alarm_0.gml | 5 +- objects/obj_controller/Alarm_1.gml | 552 +++--- objects/obj_controller/Alarm_2.gml | 6 +- objects/obj_controller/Alarm_3.gml | 2 +- objects/obj_controller/Alarm_4.gml | 6 +- objects/obj_controller/Alarm_5.gml | 1141 ++++++----- objects/obj_controller/Alarm_6.gml | 513 +++-- objects/obj_controller/Alarm_7.gml | 16 +- objects/obj_controller/Alarm_8.gml | 55 +- objects/obj_controller/CleanUp_0.gml | 12 +- objects/obj_controller/Create_0.gml | 2514 ++++++++++++++---------- objects/obj_controller/Draw_0.gml | 54 +- objects/obj_controller/Draw_64.gml | 291 +-- objects/obj_controller/KeyPress_13.gml | 1 - objects/obj_controller/KeyPress_32.gml | 14 +- objects/obj_controller/KeyPress_73.gml | 8 - objects/obj_controller/KeyPress_80.gml | 6 +- objects/obj_controller/Keyboard_84.gml | 5 +- objects/obj_controller/Mouse_50.gml | 295 +-- objects/obj_controller/Mouse_56.gml | 4 +- objects/obj_controller/Mouse_60.gml | 36 +- objects/obj_controller/Mouse_61.gml | 42 +- objects/obj_controller/Step_0.gml | 65 +- objects/obj_controller/Step_1.gml | 8 +- objects/obj_controller/Step_2.gml | 5 - 25 files changed, 3215 insertions(+), 2441 deletions(-) diff --git a/objects/obj_controller/Alarm_0.gml b/objects/obj_controller/Alarm_0.gml index 60e6a70f2d..469df2591a 100644 --- a/objects/obj_controller/Alarm_0.gml +++ b/objects/obj_controller/Alarm_0.gml @@ -1,7 +1,6 @@ - instance_activate_object(obj_star); -if (instance_exists(obj_ini)) and (global.load==-1){ - alarm[1]=2; +if (instance_exists(obj_ini) && (global.load == -1)) { + alarm[1] = 2; instance_activate_object(obj_star); instance_activate_all(); } diff --git a/objects/obj_controller/Alarm_1.gml b/objects/obj_controller/Alarm_1.gml index 278dd034d1..4502adcc85 100644 --- a/objects/obj_controller/Alarm_1.gml +++ b/objects/obj_controller/Alarm_1.gml @@ -8,15 +8,19 @@ instance_activate_all(); // Lots of damn tyranids // Some damn orks and a few genestealer cults -var field="" +var field = ""; -field="both"//("orks","tyranids","both"); -if (global.chapter_name="Lamenters") then field="both"; -if (is_test_map=true) then field="orks"; +field = "both"; //("orks","tyranids","both"); +if (global.chapter_name == "Lamenters") { + field = "both"; +} +if (is_test_map == true) { + field = "orks"; +} -good_log=1; +good_log = 1; -var xx,yy,ok=0,did=0,_current_system=0,px=0,py=0,rando=0; +var xx, yy, ok = 0, did = 0, _current_system = 0, px = 0, py = 0, rando = 0; // Set player set _current_system = find_player_spawn_star(); @@ -24,52 +28,56 @@ instance_activate_object(obj_star); var _player_star; // Set player homeworld did = instance_exists(_current_system); -if (did){ +if (did) { _player_star = _current_system.id; - if (obj_ini.fleet_type==ePlayerBase.home_world){ + if (obj_ini.fleet_type == ePlayerBase.home_world) { set_player_homeworld_star(_current_system); } // Crusade and fleet based - if (obj_ini.fleet_type!=ePlayerBase.home_world){ - with (_current_system){ + if (obj_ini.fleet_type != ePlayerBase.home_world) { + with (_current_system) { set_player_recruit_planet(irandom_range(1, _current_system.planets)); } } - with(_current_system){ - for(var f=1; f<=4; f++){ - if (array_length( search_planet_features(p_feature[f], P_features.Monastery)) >0)and (array_length( search_planet_features(p_feature[f], P_features.Recruiting_World)) >0){ - if (p_owner[f]==eFACTION.Player) then p_owner[f]=eFACTION.Imperium; + with (_current_system) { + for (var f = 1; f <= 4; f++) { + if ((array_length(search_planet_features(p_feature[f], P_features.Monastery)) > 0) && (array_length(search_planet_features(p_feature[f], P_features.Recruiting_World)) > 0)) { + if (p_owner[f] == eFACTION.Player) { + p_owner[f] = eFACTION.Imperium; + } } - if (array_length( search_planet_features(p_feature[f], P_features.Monastery)) >0){ - if (p_owner[f]!=eFACTION.Player) then p_owner[f]=eFACTION.Player; - owner = eFACTION.Player; + if (array_length(search_planet_features(p_feature[f], P_features.Monastery)) > 0) { + if (p_owner[f] != eFACTION.Player) { + p_owner[f] = eFACTION.Player; + } + owner = eFACTION.Player; } } } - if (obj_ini.veh_loc[1,1]=="random") or (obj_ini.veh_loc[1,1]=="Random"){ - for(var coh=0; coh<11; coh++){ - for(var iy=1; iy<=60; iy++){ - obj_ini.veh_loc[coh,iy]=_current_system.name; + if ((obj_ini.veh_loc[1][1] == "random") || (obj_ini.veh_loc[1][1] == "Random")) { + for (var coh = 0; coh < 11; coh++) { + for (var iy = 1; iy <= 60; iy++) { + obj_ini.veh_loc[coh][iy] = _current_system.name; } } - _current_system.p_player[2]+=obj_ini.man_size; + _current_system.p_player[2] += obj_ini.man_size; } - - var fleet=instance_create(_current_system.x,_current_system.y,obj_p_fleet); - fleet.owner = eFACTION.Player; - - for(var f=0; f0){ - scr_start_load(fleet,_current_system,obj_ini.load_to_ships); - with(obj_p_fleet){ - instance_create(x,y,obj_fleet_show); + + if (obj_ini.load_to_ships[0] > 0) { + scr_start_load(fleet, _current_system, obj_ini.load_to_ships); + with (obj_p_fleet) { + instance_create(x, y, obj_fleet_show); } } @@ -80,21 +88,21 @@ if (did){ yy = py; instance_activate_object(obj_star); instance_deactivate_object(_current_system); - with (obj_star){ - if (system_feature_bool(p_feature, P_features.Recruiting_World)){ + with (obj_star) { + if (system_feature_bool(p_feature, P_features.Recruiting_World)) { instance_deactivate_object(id); break; } } - - _current_system=instance_nearest(px,py,obj_star); - _current_system.star="white2"; - _current_system.planet[1]=1; - _current_system.planet[2]=1; - _current_system.image_index=4; - _current_system.p_type[1]="Forge"; - _current_system.p_type[2]="Ice"; - /* + + _current_system = instance_nearest(px, py, obj_star); + _current_system.star = "white2"; + _current_system.planet[1] = 1; + _current_system.planet[2] = 1; + _current_system.image_index = 4; + _current_system.p_type[1] = "Forge"; + _current_system.p_type[2] = "Ice"; + /* _current_system.p_owner[1]=3; _current_system.p_owner[2]=3; _current_system.p_owner[3]=3; @@ -105,14 +113,17 @@ if (did){ _current_system.p_first[4]=3; */ _current_system.owner = eFACTION.Mechanicus; - _current_system.p_owner = array_create(5, _current_system.owner) - _current_system.p_first = array_create(5, _current_system.owner) - - if (_current_system.planets<2) then _current_system.planets=2; - - with(_current_system){// with _current_system - var a=99,b=99,c=99,d=99,e="",f=0; - for(var i=0; i<10; i++){ + _current_system.p_owner = array_create(5, _current_system.owner); + _current_system.p_first = array_create(5, _current_system.owner); + + if (_current_system.planets < 2) { + _current_system.planets = 2; + } + + with (_current_system) { + // with _current_system + var a = 99, b = 99, c = 99, d = 99, e = "", f = 0; + for (var i = 0; i < 10; i++) { e = p_type[1]; switch (e) { case "Lava": @@ -234,216 +245,242 @@ if (did){ break; } - if (d=1) or (_current_system.p_type[1]!="Dead"){ - stop=0; + if ((_current_system.planets >= 1) || (_current_system.p_type[1] != "Dead")) { + stop = 0; + } + if (stop == 0) { + stop = 5; } - if (stop==0) then stop=5; } } - - with (_current_system){ - planet[1]=1; - p_owner[1]= eFACTION.Tau; - p_type[1]="Desert"; - xx=x; - yy=y; - tau[1]=choose(3,4); - p_influence[1][eFACTION.Tau]=70; + + with (_current_system) { + planet[1] = 1; + p_owner[1] = eFACTION.Tau; + p_type[1] = "Desert"; + xx = x; + yy = y; + tau[1] = choose(3, 4); + p_influence[1][eFACTION.Tau] = 70; } instance_deactivate_object(_current_system); - - var tau_start_size = irandom(4)+5; - for (var i=0;i<=tau_start_size;i++){ - rando=1; - _current_system=instance_nearest(xx,yy,obj_star); - with (_current_system){ - if (planets>0) and (_current_system.p_type[1]!="Dead") and (_current_system.owner == eFACTION.Imperium){ + + var tau_start_size = irandom(4) + 5; + for (var i = 0; i <= tau_start_size; i++) { + rando = 1; + _current_system = instance_nearest(xx, yy, obj_star); + with (_current_system) { + if ((planets > 0) && (_current_system.p_type[1] != "Dead") && (_current_system.owner == eFACTION.Imperium)) { p_owner[1] = eFACTION.Tau; owner = eFACTION.Tau; - p_influence[1][eFACTION.Tau]=70; + p_influence[1][eFACTION.Tau] = 70; } } instance_deactivate_object(_current_system); } - + instance_activate_object(obj_star); } // Chaos - repeat(2+irandom(4)){ - xx=floor(random(1152))+64; - yy=floor(random(748))+64; - _current_system=instance_nearest(xx,yy,obj_star); - with (_current_system){ - if (planets>0) and (owner == eFACTION.Imperium){ - planet[1]=1; - p_owner[1]=10; + repeat (2 + irandom(4)) { + xx = floor(random(1152)) + 64; + yy = floor(random(748)) + 64; + _current_system = instance_nearest(xx, yy, obj_star); + with (_current_system) { + if ((planets > 0) && (owner == eFACTION.Imperium)) { + planet[1] = 1; + p_owner[1] = 10; owner = eFACTION.Chaos; } } instance_deactivate_object(_current_system); } // More sneaky this way; you have to be noted of rising heresy or something, or have a ship in the system - var hell_holes = ["Badab", "Hellsiris","Vraks","Isstvan","Stygies","Stygia","Nostromo","Jhanna","Gangrenous Rot"]; - with(obj_star){ - if (array_contains(hell_holes, name)){ - rando=choose(1,1); // make 1's 0's if you want less chaos - if (rando==1){ - + var hell_holes = [ + "Badab", + "Hellsiris", + "Vraks", + "Isstvan", + "Stygies", + "Stygia", + "Nostromo", + "Jhanna", + "Gangrenous Rot" + ]; + with (obj_star) { + if (array_contains(hell_holes, name)) { + rando = choose(1, 1); // make 1's 0's if you want less chaos + if (rando == 1) { owner = eFACTION.Chaos; - p_owner = array_create(5, owner); - for (var i=1;i<=planets;i++){ - p_heresy[i]=floor(random_range(75,100)); - if (p_type[i]=="Dead") then p_type[i]=choose("Hive","Temperate","Desert","Ice"); + p_owner = array_create(5, owner); + for (var i = 1; i <= planets; i++) { + p_heresy[i] = floor(random_range(75, 100)); + if (p_type[i] == "Dead") { + p_type[i] = choose("Hive", "Temperate", "Desert", "Ice"); + } - if (p_type[i]!="Dead") then p_traitors[i]=6; + if (p_type[i] != "Dead") { + p_traitors[i] = 6; + } // give them big defences - if (p_type[i]!="Dead") then p_fortified[i]=choose(4,5,5,4,4,3,6); + if (p_type[i] != "Dead") { + p_fortified[i] = choose(4, 5, 5, 4, 4, 3, 6); + } } } } } - + // Ork planets here var _imperial_planets = []; var _non_xenos_chaos = []; - with(obj_star){ - if (is_dead_star() || planets==0){ + with (obj_star) { + if (is_dead_star() || planets == 0) { continue; } - if (owner == eFACTION.Imperium){ + if (owner == eFACTION.Imperium) { //this object simply acts as a counter of imperium owned planets array_push(_imperial_planets, id); } - } - - var ed2,n,i,orkz=choose(4,5,6)+5; - if (field=="orks") then orkz+=20; - if (field=="both") then orkz+=15; - /*if (obj_ini.fleet_type==ePlayerBase.penitent) then orkz+=2;*/ - if (is_test_map==true) then orkz=4; - - n=array_length(_imperial_planets); - for(var j=0; j0) and (_current_system.owner == eFACTION.Imperium){ - var forge_planet = irandom(_current_system.planets-1)+1; - _current_system.plant[forge_planet]=1; - _current_system.p_type[forge_planet]="Forge"; + repeat (choose(3, 4, 5)) { + xx = floor(random(1152 + 640)) + 64; + yy = floor(random(748 + 480)) + 64; + _current_system = instance_nearest(xx, yy, obj_star); + if ((_current_system.planets > 0) && (_current_system.owner == eFACTION.Imperium)) { + var forge_planet = irandom(_current_system.planets - 1) + 1; + _current_system.plant[forge_planet] = 1; + _current_system.p_type[forge_planet] = "Forge"; _current_system.owner = eFACTION.Mechanicus; _current_system.p_owner[forge_planet] = _current_system.owner; _current_system.p_first[forge_planet] = _current_system.owner; @@ -452,71 +489,84 @@ if (did){ } } - -x=px; -y=py; +x = px; +y = py; instance_activate_object(obj_star); -if (did==0) then alarm[1]=5; -if (did!=0) then obj_star.alarm[1]=1; +if (did == 0) { + alarm[1] = 5; +} +if (did != 0) { + obj_star.alarm[1] = 1; +} // Eldar craftworld here -var go=0,xx=0,yy=0; +var go = 0, xx = 0, yy = 0; -craftworld=1; +craftworld = 1; -for(var i=0; i<100; i++){ - if (go==0){ - xx=floor(random(1152+600))+104; - yy=floor(random(748+440))+104; - if (point_distance(room_width/2,room_height/2,xx,yy)>=50) then go=1; - me=instance_nearest(xx,yy,obj_star); - if (go==1) and (point_distance(me.x,me.y,xx,yy)>=150) then go=2; - if (go==1) then go=0; - if (xx>=1050+640) or (yy<=300+480) then go=0; +for (var i = 0; i < 100; i++) { + if (go == 0) { + xx = floor(random(1152 + 600)) + 104; + yy = floor(random(748 + 440)) + 104; + if (point_distance(room_width / 2, room_height / 2, xx, yy) >= 50) { + go = 1; + } + me = instance_nearest(xx, yy, obj_star); + if ((go == 1) && (point_distance(me.x, me.y, xx, yy) >= 150)) { + go = 2; + } + if (go == 1) { + go = 0; + } + if ((xx >= 1050 + 640) || (yy <= 300 + 480)) { + go = 0; + } } - if (go==2){ - var craft=instance_create(xx,yy,obj_star); - craft.craftworld=1; - go=999; - array_push(craft.p_feature[1],new NewPlanetFeature(P_features.Warlord6)); - - var elforce=instance_create(xx,yy,obj_en_fleet); - elforce.sprite_index=spr_fleet_eldar; + if (go == 2) { + var craft = instance_create(xx, yy, obj_star); + craft.craftworld = 1; + go = 999; + array_push(craft.p_feature[1], new NewPlanetFeature(P_features.Warlord6)); + + var elforce = instance_create(xx, yy, obj_en_fleet); + elforce.sprite_index = spr_fleet_eldar; elforce.owner = eFACTION.Eldar; - elforce.capital_number=choose(2,3); - elforce.frigate_number=choose(4,5,6); - elforce.escort_number=floor(random_range(7,11))+1; - elforce.image_alpha=0; - elforce.orbiting=craft; + elforce.capital_number = choose(2, 3); + elforce.frigate_number = choose(4, 5, 6); + elforce.escort_number = floor(random_range(7, 11)) + 1; + elforce.image_alpha = 0; + elforce.orbiting = craft; } } // End craftworld -if (!instance_exists(obj_saveload)) and (instance_exists(obj_creation)) and (global.load==-1){ - for(var i=1; i<=10; i++){ - if (obj_creation.world[i]!=""){ +if ((!instance_exists(obj_saveload)) && instance_exists(obj_creation) && (global.load == -1)) { + for (var i = 1; i <= 10; i++) { + if (obj_creation.world[i] != "") { var _wanted_worlds = []; - with(obj_star){ - for(var run=1; run<=4; run++){ - if (p_type[run]=obj_creation.world_type[i]){ + with (obj_star) { + for (var run = 1; run <= 4; run++) { + if (p_type[run] == obj_creation.world_type[i]) { array_push(_wanted_worlds, id); } } } - - var _chosen_world=array_random_element(_wanted_worlds); - - if (instance_exists(_chosen_world)){ - for(var run=1; run<=4; run++){ - if (_chosen_world.p_type[run]=obj_creation.world_type[i]){ - _chosen_world.name=obj_creation.world[i]; - if (obj_creation.world_feature[i]!="") then _chosen_world.p_feature[run]=[]; - obj_creation.world[i]=""; - obj_creation.world_type[i]=""; - obj_creation.world_feature[i]=""; + + var _chosen_world = array_random_element(_wanted_worlds); + + if (instance_exists(_chosen_world)) { + for (var run = 1; run <= 4; run++) { + if (_chosen_world.p_type[run] == obj_creation.world_type[i]) { + _chosen_world.name = obj_creation.world[i]; + if (obj_creation.world_feature[i] != "") { + _chosen_world.p_feature[run] = []; + } + obj_creation.world[i] = ""; + obj_creation.world_type[i] = ""; + obj_creation.world_feature[i] = ""; } } instance_deactivate_object(_chosen_world); @@ -526,7 +576,7 @@ if (!instance_exists(obj_saveload)) and (instance_exists(obj_creation)) and (glo } instance_activate_all(); -with(obj_creation){ +with (obj_creation) { instance_destroy(); } @@ -555,8 +605,8 @@ scr_add_artifact("good","daemonic",0,obj_ini.ship[0],501);*/ // scr_add_item("Cyclonic Torpedo",5); // scr_add_item("Exterminatus",5); - -if (is_test_map==true){ + +if (is_test_map == true) { // scr_add_item("Exterminatus",5); /*scr_add_artifact("good","",0,obj_ini.ship[0],501); scr_add_artifact("good","",0,obj_ini.ship[0],501); @@ -567,22 +617,26 @@ if (is_test_map==true){ scr_add_artifact("good","",0,obj_ini.ship[0],501);*/ } -with(obj_temp7){instance_destroy();} +with (obj_temp7) { + instance_destroy(); +} //for tau fleets, if it is stationed on a system it owns, make a temp7 obj -with(obj_en_fleet){ - if (owner == eFACTION.Tau) and (instance_nearest(x,y,obj_star).owner == eFACTION.Tau) then instance_create(x,y,obj_temp7); +with (obj_en_fleet) { + if ((owner == eFACTION.Tau) && (instance_nearest(x, y, obj_star).owner == eFACTION.Tau)) { + instance_create(x, y, obj_temp7); + } } //if any temp objects exist, find the one nearest to the center of the room and set your direction to //the angle to the room center -if (instance_exists(obj_temp7)){ - var t1=instance_nearest(room_width/2,room_height/2,obj_temp7); - with(t1) { - other.terra_direction = point_direction(x,y,room_width/2,room_height/2) - } +if (instance_exists(obj_temp7)) { + var t1 = instance_nearest(room_width / 2, room_height / 2, obj_temp7); + with (t1) { + other.terra_direction = point_direction(x, y, room_width / 2, room_height / 2); + } } /*with(obj_star){ scr_star_ownership(false); }*/ -// x=0;y=0; +// x=0;y=0; diff --git a/objects/obj_controller/Alarm_2.gml b/objects/obj_controller/Alarm_2.gml index f3ae57b680..93d0c17da3 100644 --- a/objects/obj_controller/Alarm_2.gml +++ b/objects/obj_controller/Alarm_2.gml @@ -1,6 +1,6 @@ // initialize combat -menu=0; -instance_create(0,0,obj_ncombat); +menu = 0; +instance_create(0, 0, obj_ncombat); exit; -//instance_create(0,0,obj_fleet); +//instance_create(0,0,obj_fleet); diff --git a/objects/obj_controller/Alarm_3.gml b/objects/obj_controller/Alarm_3.gml index 4fd76921d6..4981b22530 100644 --- a/objects/obj_controller/Alarm_3.gml +++ b/objects/obj_controller/Alarm_3.gml @@ -1,2 +1,2 @@ -script_execute(scr_income,0,0,0,0,0); +script_execute(scr_income, 0, 0, 0, 0, 0); create_start_imperial_fleets(); diff --git a/objects/obj_controller/Alarm_4.gml b/objects/obj_controller/Alarm_4.gml index 3ca03e45a0..d4237d842d 100644 --- a/objects/obj_controller/Alarm_4.gml +++ b/objects/obj_controller/Alarm_4.gml @@ -1,6 +1,6 @@ income_last = income; -if (born_leader>0){ - income_leader=round(income/10); - income+=income_leader; +if (born_leader > 0) { + income_leader = round(income / 10); + income += income_leader; } diff --git a/objects/obj_controller/Alarm_5.gml b/objects/obj_controller/Alarm_5.gml index 2dc4e54fd1..f037e40873 100644 --- a/objects/obj_controller/Alarm_5.gml +++ b/objects/obj_controller/Alarm_5.gml @@ -1,567 +1,736 @@ -// TODO script description: This is the turn management in general +// TODO script description: This is the turn management in general // TODO refactor -try_and_report_loop("final end turn alarm 5",function(){ -var recruit_count=0; -var random_marine, marine_position; -var eq1=1,eq2=1,eq3=1,t=0,r=0; -var marine_company=0; -var warn="",w5=0; -var g1=0,g2=0; -var onceh=0,stahp=0; -var disc=0,droll=0; -var rund=0; -var spikky=0; -var roll=0; -var novice_type=""; -var unit; - - -try_and_report_loop("chaos_spread", function(){ - var times=max(1,round(turn/150)); - if (known[eFACTION.Chaos]==2) and (faction_defeated[eFACTION.Chaos]==0) then times+=1; - var xx3, yy3, plani, _star; - xx3=irandom(room_width)+1; - yy3=irandom(room_height)+1; - _star=instance_nearest(xx3,yy3,obj_star); - plani=floor(random(_star.planets))+1; - - // ** Chaos influence / corruption ** - if (faction_gender[eFACTION.Chaos]==1) and (faction_defeated[eFACTION.Chaos]==0) and (turn>=chaos_turn) then repeat(times){ - if (_star.p_type[plani]!="Dead") and (_star.planets>0) and (turn>=20){ - var cathedral=0; - if (planet_feature_bool(_star.p_feature[plani], P_features.Sororitas_Cathedral)==1) then cathedral=choose(0,1,1); - - if (cathedral=0){ - if (_star.p_heresy[plani]>=0) and (_star.p_heresy[plani]<10){ - _star.p_heresy[plani]+=choose(0,0,0,0,0,0,0,0,5); - }else if (_star.p_heresy[plani]>=10) and (_star.p_heresy[plani]<20){ - _star.p_heresy[plani]+=choose(-2,-2,-2,5,10,15); - }else if(_star.p_heresy[plani]>=20) and (_star.p_heresy[plani]<40){ - _star.p_heresy[plani]+=choose(-2,-1,0,0,0,0,0,0,5,10); - }else if(_star.p_heresy[plani]>=40) and (_star.p_heresy[plani]<60){ - _star.p_heresy[plani]+=choose(-2,-1,0,0,0,0,0,0,5,10,15); - }else if(_star.p_heresy[plani]>=60) and (_star.p_heresy[plani]<100){ - _star.p_heresy[plani]+=choose(-1,0,0,0,0,5,10,15); +try_and_report_loop("final end turn alarm 5", function() { + var recruit_count = 0; + var random_marine, marine_position; + var eq1 = 1, eq2 = 1, eq3 = 1, t = 0, r = 0; + var marine_company = 0; + var warn = "", w5 = 0; + var g1 = 0, g2 = 0; + var onceh = 0, stahp = 0; + var disc = 0, droll = 0; + var rund = 0; + var spikky = 0; + var roll = 0; + var novice_type = ""; + var unit; + + try_and_report_loop("chaos_spread", function() { + var times = max(1, round(turn / 150)); + if ((known[eFACTION.Chaos] == 2) && (faction_defeated[eFACTION.Chaos] == 0)) { + times += 1; + } + var xx3, yy3, plani, _star; + xx3 = irandom(room_width) + 1; + yy3 = irandom(room_height) + 1; + _star = instance_nearest(xx3, yy3, obj_star); + plani = floor(random(_star.planets)) + 1; + + // ** Chaos influence / corruption ** + if ((faction_gender[eFACTION.Chaos] == 1) && (faction_defeated[eFACTION.Chaos] == 0) && (turn >= chaos_turn)) { + repeat (times) { + if ((_star.p_type[plani] != "Dead") && (_star.planets > 0) && (turn >= 20)) { + var cathedral = 0; + if (planet_feature_bool(_star.p_feature[plani], P_features.Sororitas_Cathedral) == 1) { + cathedral = choose(0, 1, 1); + } + + if (cathedral == 0) { + if ((_star.p_heresy[plani] >= 0) && (_star.p_heresy[plani] < 10)) { + _star.p_heresy[plani] += choose(0, 0, 0, 0, 0, 0, 0, 0, 5); + } else if ((_star.p_heresy[plani] >= 10) && (_star.p_heresy[plani] < 20)) { + _star.p_heresy[plani] += choose(-2, -2, -2, 5, 10, 15); + } else if ((_star.p_heresy[plani] >= 20) && (_star.p_heresy[plani] < 40)) { + _star.p_heresy[plani] += choose(-2, -1, 0, 0, 0, 0, 0, 0, 5, 10); + } else if ((_star.p_heresy[plani] >= 40) && (_star.p_heresy[plani] < 60)) { + _star.p_heresy[plani] += choose(-2, -1, 0, 0, 0, 0, 0, 0, 5, 10, 15); + } else if ((_star.p_heresy[plani] >= 60) && (_star.p_heresy[plani] < 100)) { + _star.p_heresy[plani] += choose(-1, 0, 0, 0, 0, 5, 10, 15); + } + } + if (_star.p_heresy[plani] < 0) { + _star.p_heresy[plani] = 0; + } } } - if (_star.p_heresy[plani]<0) then _star.p_heresy[plani]=0; } - } - instance_activate_object(obj_star); -}); - -// ** Build new Imperial Ships ** -build_planet_defence_fleets(); + instance_activate_object(obj_star); + }); -apothecary_training(); -chaplain_training(); -librarian_training(); -techmarine_training(); + // ** Build new Imperial Ships ** + build_planet_defence_fleets(); + apothecary_training(); + chaplain_training(); + librarian_training(); + techmarine_training(); -if (obj_ini.fleet_type!=1){ - with(obj_temp5){instance_destroy();} - with(obj_p_fleet){ - if (action!="") then instance_create(x,y,obj_temp5); - if (x<0) or (x>room_width) or (y<0) or (y>room_height) then instance_create(x,y,obj_temp5); + if (obj_ini.fleet_type != 1) { + with (obj_temp5) { + instance_destroy(); + } + with (obj_p_fleet) { + if (action != "") { + instance_create(x, y, obj_temp5); + } + if ((x < 0) || (x > room_width) || (y < 0) || (y > room_height)) { + instance_create(x, y, obj_temp5); + } + } + if (instance_number(obj_temp5) >= instance_number(obj_p_fleet)) { + stahp = 1; + } + with (obj_temp5) { + instance_destroy(); + } } - if (instance_number(obj_temp5)>=instance_number(obj_p_fleet)) then stahp=1; - with(obj_temp5){instance_destroy();} -} -var recruits_finished=0,recruit_first=""; - -var total_recruits = 0; -var i=0; -while (i1){ - scr_alert("green","recruitment",$"{recruits_finished}x {obj_ini.role[100][12]} have joined X Company.",0,0); -} + var recruits_finished = 0, recruit_first = ""; + var total_recruits = 0; + var i = 0; + while (i < array_length(recruit_name)) { + if (recruit_name[i] == "") { + i++; + continue; + } + if (recruit_distance[i] <= 0) { + recruit_training[i] -= 1; + } + if (recruit_training[i] <= 0) { + scr_add_man(obj_ini.role[100][12], 10, recruit_exp[i], recruit_name[i], recruit_corruption[i], false, "default", recruit_data[i]); + if (recruit_first == "") { + recruit_first = recruit_name[i]; + } + recruits_finished += 1; + array_delete(recruit_name, i, 1); + array_delete(recruit_corruption, i, 1); + array_delete(recruit_distance, i, 1); + array_delete(recruit_training, i, 1); + array_delete(recruit_exp, i, 1); + array_delete(recruit_data, i, 1); + continue; + } else { + total_recruits++; + } + i++; + } + with (obj_ini) { + scr_company_order(10); + } + if (recruits_finished == 1) { + scr_alert("green", "recruitment", $"{obj_ini.role[100][12]} {recruit_first} has joined X Company.", 0, 0); + } else if (recruits_finished > 1) { + scr_alert("green", "recruitment", $"{recruits_finished}x {obj_ini.role[100][12]} have joined X Company.", 0, 0); + } -recruits=total_recruits; + recruits = total_recruits; -/* TODO implement Lamenters get Black Rage and story + /* TODO implement Lamenters get Black Rage and story if (turn=240) and (global.chapter_name="Lamenters"){ obj_ini.strin2+="Black Rage"; scr_popup("Geneseed Mutation","Your Chapter has begun to have visions and nightmares of Sanguinius' fall. The less mentally disciplined of your battle-brothers no longer are able to sleep soundly, waking from sleep in a screaming, frothing rage. It appears the Black Rage has returned.","black_rage",""); } */ -// ** Battlefield Loot ** -if (scr_has_adv("Tech-Scavengers")){ - var lroll1,lroll2,loot=""; - lroll1=roll_dice_chapter(1, 100, "low"); - lroll2=roll_dice_chapter(1, 100, "low"); - if (lroll1<=5){ - loot=choose("Chainsword","Bolt Pistol","Combat Knife","Narthecium"); - if (lroll2<=80) then loot=choose("Power Sword","Storm Bolter"); - if (lroll2<=60) then loot=choose("Plasma Pistol","Chainfist","Lascannon","Heavy Bolter","Assault Cannon","Bike"); - if (lroll2<=30) then loot=choose("Artificer Armour","Plasma Gun","Chainfist","Rosarius","Psychic Hood"); - if (lroll2<=10) then loot=choose("Terminator Armour","Artificer Armour","Dreadnought","Plasma Gun","Power Fist","Thunder Hammer","Iron Halo"); - var tix="A "+string(loot)+" has been gifted to the Chapter."; - tix=string_replace(tix,"A A","An A"); - tix=string_replace(tix,"A E","An E"); - tix=string_replace(tix,"A I","An I"); - tix=string_replace(tix,"A O","An O"); - scr_add_item(string(loot),1); - scr_alert("","loot",tix,0,0); - } -} -imperial_navy_fleet_construction(); - -// ** Adeptus Mechanicus Geneseed Tithe ** -if (gene_tithe==0) and (faction_status[eFACTION.Imperium]!="War"){ - gene_tithe=24; - - var expected,txt="",mech_mad=false; - var onceh=0; - expected=max(1,round(obj_controller.gene_seed/20)); - if (obj_controller.faction_status[eFACTION.Mechanicus]=="War") then mech_mad=true; - - if (obj_controller.gene_seed<=0) or (mech_mad==true){ - onceh=2; - gene_iou+=1; - loyalty-=2; - loyalty_hidden-=2; - txt="No Gene-Seed for Adeptus Mechanicus tithe. High Lords of Terra IOU increased to "+string(gene_iou)+"."; - } - if (mech_mad==false){ - if (obj_controller.gene_seed>0) and (und_gene_vaults==0) and (onceh==0){ - obj_controller.gene_seed-=expected; - onceh=1; - if (obj_controller.gene_seed>=gene_iou) and (gene_iou>0){ - expected+=gene_iou; - obj_controller.gene_seed-=gene_iou; - gene_iou=0; - onceh=3; - } - for(var i=0; i<50; i++){ - if (obj_controller.gene_seed0) and (gene_iou>0){ - expected+=1; - obj_controller.gene_seed-=1; - gene_iou-=1; - if (gene_iou==0) then onceh=3; - } + // ** Battlefield Loot ** + if (scr_has_adv("Tech-Scavengers")) { + var lroll1, lroll2, loot = ""; + lroll1 = roll_dice_chapter(1, 100, "low"); + lroll2 = roll_dice_chapter(1, 100, "low"); + if (lroll1 <= 5) { + loot = choose("Chainsword", "Bolt Pistol", "Combat Knife", "Narthecium"); + if (lroll2 <= 80) { + loot = choose("Power Sword", "Storm Bolter"); } + if (lroll2 <= 60) { + loot = choose("Plasma Pistol", "Chainfist", "Lascannon", "Heavy Bolter", "Assault Cannon", "Bike"); + } + if (lroll2 <= 30) { + loot = choose("Artificer Armour", "Plasma Gun", "Chainfist", "Rosarius", "Psychic Hood"); + } + if (lroll2 <= 10) { + loot = choose("Terminator Armour", "Artificer Armour", "Dreadnought", "Plasma Gun", "Power Fist", "Thunder Hammer", "Iron Halo"); + } + var tix = "A " + string(loot) + " has been gifted to the Chapter."; + tix = string_replace(tix, "A A", "An A"); + tix = string_replace(tix, "A E", "An E"); + tix = string_replace(tix, "A I", "An I"); + tix = string_replace(tix, "A O", "An O"); + scr_add_item(string(loot), 1); + scr_alert("", "loot", tix, 0, 0); + } + } + imperial_navy_fleet_construction(); - if (gene_iou<0) then gene_iou=0; + // ** Adeptus Mechanicus Geneseed Tithe ** + if ((gene_tithe == 0) && (faction_status[eFACTION.Imperium] != "War")) { + gene_tithe = 24; - txt=string(expected)+" Gene-Seed sent to Adeptus Mechanicus for tithe."; - if (gene_iou>0) then txt+=" IOU remains at "+string(gene_iou)+"."; - if (onceh==3) then txt+=" IOU has been payed off."; + var expected, txt = "", mech_mad = false; + var onceh = 0; + expected = max(1, round(obj_controller.gene_seed / 20)); + if (obj_controller.faction_status[eFACTION.Mechanicus] == "War") { + mech_mad = true; } - if (obj_controller.gene_seed>0) and (und_gene_vaults>0) and (onceh==0){ - expected=1; - obj_controller.gene_seed-=expected; - onceh=1; + if ((obj_controller.gene_seed <= 0) || (mech_mad == true)) { + onceh = 2; + gene_iou += 1; + loyalty -= 2; + loyalty_hidden -= 2; + txt = "No Gene-Seed for Adeptus Mechanicus tithe. High Lords of Terra IOU increased to " + string(gene_iou) + "."; + } + if (mech_mad == false) { + if ((obj_controller.gene_seed > 0) && (und_gene_vaults == 0) && (onceh == 0)) { + obj_controller.gene_seed -= expected; + onceh = 1; + if ((obj_controller.gene_seed >= gene_iou) && (gene_iou > 0)) { + expected += gene_iou; + obj_controller.gene_seed -= gene_iou; + gene_iou = 0; + onceh = 3; + } + for (var i = 0; i < 50; i++) { + if ((obj_controller.gene_seed < gene_iou) && (obj_controller.gene_seed > 0) && (gene_iou > 0)) { + expected += 1; + obj_controller.gene_seed -= 1; + gene_iou -= 1; + if (gene_iou == 0) { + onceh = 3; + } + } + } + + if (gene_iou < 0) { + gene_iou = 0; + } - if (obj_controller.gene_seed0) and (gene_iou>0){ - expected+=1; - obj_controller.gene_seed-=1; - gene_iou-=1; - if (gene_iou==0) then onceh=3; + txt = string(expected) + " Gene-Seed sent to Adeptus Mechanicus for tithe."; + if (gene_iou > 0) { + txt += " IOU remains at " + string(gene_iou) + "."; + } + if (onceh == 3) { + txt += " IOU has been payed off."; + } } - if (gene_iou<0) then gene_iou=0; + if ((obj_controller.gene_seed > 0) && (und_gene_vaults > 0) && (onceh == 0)) { + expected = 1; + obj_controller.gene_seed -= expected; + onceh = 1; + + if ((obj_controller.gene_seed < gene_iou) && (obj_controller.gene_seed > 0) && (gene_iou > 0)) { + expected += 1; + obj_controller.gene_seed -= 1; + gene_iou -= 1; + if (gene_iou == 0) { + onceh = 3; + } + } - txt=string(expected)+" Gene-Seed sent to Adeptus Mechanicus for tithe."; - if (gene_iou>0) then txt+=" IOU remains at "+string(gene_iou)+"."; - if (onceh==3) then txt+=" IOU has been payed off."; - } + if (gene_iou < 0) { + gene_iou = 0; + } - if (onceh!=2){ - scr_alert("green","tithes",txt,0,0); - scr_event_log("",txt); - } - if (onceh==2){ - scr_alert("red","tithes",txt,0,0); - scr_event_log("red",txt); + txt = string(expected) + " Gene-Seed sent to Adeptus Mechanicus for tithe."; + if (gene_iou > 0) { + txt += " IOU remains at " + string(gene_iou) + "."; + } + if (onceh == 3) { + txt += " IOU has been payed off."; + } + } + + if (onceh != 2) { + scr_alert("green", "tithes", txt, 0, 0); + scr_event_log("", txt); + } + if (onceh == 2) { + scr_alert("red", "tithes", txt, 0, 0); + scr_event_log("red", txt); + } } } -} -if (gene_sold>0){ - disc=0; - droll=0; - gene_sold=floor(gene_sold*75)/100; - - if (gene_sold<1) then gene_sold=0; - if (gene_sold>=50){ - disc=round(gene_sold/7); - droll=floor(random(100))+1; - - // Inquisition takes notice - if (droll<=disc) and (obj_controller.known[eFACTION.Inquisition]!=0){ - var disp_change=-3; - if (gene_sold>=100) then disp_change=-5; - if (gene_sold>=200) then disp_change=-7; - if (gene_sold>=400) then disp_change=-10; - gene_sold=0; - scr_audience(4,"gene_trade",disp_change,"",2,0); + if (gene_sold > 0) { + disc = 0; + droll = 0; + gene_sold = floor(gene_sold * 75) / 100; + + if (gene_sold < 1) { + gene_sold = 0; + } + if (gene_sold >= 50) { + disc = round(gene_sold / 7); + droll = floor(random(100)) + 1; + + // Inquisition takes notice + if ((droll <= disc) && (obj_controller.known[eFACTION.Inquisition] != 0)) { + var disp_change = -3; + if (gene_sold >= 100) { + disp_change = -5; + } + if (gene_sold >= 200) { + disp_change = -7; + } + if (gene_sold >= 400) { + disp_change = -10; + } + gene_sold = 0; + scr_audience(4, "gene_trade", disp_change, "", 2, 0); + } } } -} -if (gene_xeno>0){ - disc=0; - droll=0; - gene_xeno=floor(gene_xeno*90)/100; - - if (gene_xeno<1) then gene_xeno=0; - if (gene_xeno>=5){ - disc=round(gene_xeno/5); - droll=floor(random(100))+1; + if (gene_xeno > 0) { + disc = 0; + droll = 0; + gene_xeno = floor(gene_xeno * 90) / 100; - // Inquisition takes notice - if (droll<=disc) and (obj_controller.known[eFACTION.Inquisition]!=0){ - gene_xeno=99999; - alarm[8]=1; + if (gene_xeno < 1) { + gene_xeno = 0; + } + if (gene_xeno >= 5) { + disc = round(gene_xeno / 5); + droll = floor(random(100)) + 1; + + // Inquisition takes notice + if ((droll <= disc) && (obj_controller.known[eFACTION.Inquisition] != 0)) { + gene_xeno = 99999; + alarm[8] = 1; + } } } -} -var p=0,penitorium=0, unit; -for (var c = 0; c < 11; c++){ - for (var e = 0; e < array_length(obj_ini.god[c]); e++){ - if (obj_ini.god[c][e] == 10){ - unit=fetch_unit([c,e]); - p+=1; - penit_co[p]=c; - penit_id[p]=e; - penitorium+=1; - unit.alter_loyalty(-1); - if (unit.corruption<90) and (unit.corruption>0){ - var heresy_old=0,heresy_new=0; - heresy_old=round((unit.corruption*unit.corruption)/50)-0.5; - heresy_new=(heresy_old*50)/unit.corruption; - unit.corruption=max(0,heresy_new); + var p = 0, penitorium = 0, unit; + for (var c = 0; c < 11; c++) { + for (var e = 0; e < array_length(obj_ini.god[c]); e++) { + if (obj_ini.god[c][e] == 10) { + unit = fetch_unit( + [ + c, + e + ] + ); + p += 1; + penit_co[p] = c; + penit_id[p] = e; + penitorium += 1; + unit.alter_loyalty(-1); + if ((unit.corruption < 90) && (unit.corruption > 0)) { + var heresy_old = 0, heresy_new = 0; + heresy_old = round((unit.corruption * unit.corruption) / 50) - 0.5; + heresy_new = (heresy_old * 50) / unit.corruption; + unit.corruption = max(0, heresy_new); + } } } } -} -// STC Bonuses -if (obj_controller.stc_ships>=6){ - //self healing ships logic - for (var v=0; v= 6) { + //self healing ships logic + for (var v = 0; v < array_length(obj_ini.ship_hp); v++) { + if (obj_ini.ship[v] == "" || obj_ini.ship_hp[v] < 0) { + continue; + } + if (obj_ini.ship_hp[v] < obj_ini.ship_maxhp[v]) { + var _max = obj_ini.ship_maxhp[v]; + obj_ini.ship_hp[v] = min(_max, obj_ini.ship_hp[v] + round(_max * 0.06)); + } } } -} -try_and_report_loop("Secret Chaos Warlord spawn", function(){ - if (turn==5) and (faction_gender[eFACTION.Chaos]==1) {// show_message("Turn 100"); - - var _star_found = false; - var _choice_star = noone; - var _stars = scr_get_stars(true); - for (var i=0;i 0) { + penitent_turnly = 0; + } + penitent_current += penitent_turnly; + if (penitent_current <= 0) { + penitent = 0; + alarm[8] = 1; + } + if (penitent_end < 30000) { + penitent_end += 41000; + } + if ((penitent_current >= penitent_max) || (((obj_controller.millenium * 1000) + obj_controller.year) >= penitent_end)) { + penitent = 0; + if ((known[eFACTION.Inquisition] == 2) || (known[eFACTION.Inquisition] >= 4)) { + scr_audience(4, "penitent_end", 0, "", 0, 0); + } + if (known[eFACTION.Ecclesiarchy] >= 2) { + scr_audience(5, "penitent_end", 0, "", 0, 0); + } + disposition[eFACTION.Imperium] += 20; + disposition[eFACTION.Mechanicus] += 15; + disposition[eFACTION.Inquisition] += 20; + disposition[eFACTION.Ecclesiarchy] += 20; + var o = 0; + if (scr_has_adv("Reverent Guardians")) { + o = 500; + } + if (o > 100) { + obj_controller.disposition[eFACTION.Ecclesiarchy] += 10; + } + scr_event_log("", "Blood Debt payed off. You may once more recruit Astartes."); } } -}); -// * Blood debt end * -if (blood_debt==1) and (penitent==1){ - penitent_turn+=1; - // was -60 - penitent_turnly=((penitent_turn*penitent_turn)-512)*-1; - if (penitent_turnly>0) then penitent_turnly=0; - penitent_current+=penitent_turnly; - if (penitent_current<=0){ - penitent=0; - alarm[8]=1; - } - if (penitent_end<30000) then penitent_end+=41000; - if (penitent_current>=penitent_max) or (((obj_controller.millenium*1000)+obj_controller.year)>=penitent_end){ - penitent=0; - if (known[eFACTION.Inquisition]==2) or (known[eFACTION.Inquisition]>=4) then scr_audience(4,"penitent_end",0,"",0,0); - if (known[eFACTION.Ecclesiarchy]>=2) then scr_audience(5,"penitent_end",0,"",0,0); - disposition[eFACTION.Imperium]+=20; - disposition[eFACTION.Mechanicus]+=15; - disposition[eFACTION.Inquisition]+=20; - disposition[eFACTION.Ecclesiarchy]+=20; - var o=0; - if (scr_has_adv("Reverent Guardians")) then o=500; - if (o>100) then obj_controller.disposition[eFACTION.Ecclesiarchy]+=10; - scr_event_log("","Blood Debt payed off. You may once more recruit Astartes."); + // * Penitent Crusade end * + if ((penitent == 1) && (blood_debt == 0)) { + penitent_turn += 1; + penitent_current += 1; + penitent_turnly = 0; + + if (penitent_current <= 0) { + penitent = 0; + alarm[8] = 1; + } + if (penitent_current >= penitent_max) { + penitent = 0; + if ((known[eFACTION.Inquisition] == 2) || (known[eFACTION.Inquisition] >= 4)) { + scr_audience(4, "penitent_end", 0, "", 0, 0); + } + if (known[eFACTION.Ecclesiarchy] >= 2) { + scr_audience(5, "penitent_end", 0, "", 0, 0); + } + disposition[eFACTION.Imperium] += 20; + disposition[eFACTION.Mechanicus] += 15; + disposition[eFACTION.Imperium] += 20; + disposition[eFACTION.Ecclesiarchy] += 20; + var o = 0; + if (scr_has_adv("Reverent Guardians")) { + o = 500; + } + if (o > 100) { + obj_controller.disposition[eFACTION.Ecclesiarchy] += 10; + } + scr_event_log("", "Penitent Crusade ends. You may once more recruit Astartes."); + } } -} -// * Penitent Crusade end * -if (penitent==1) and (blood_debt==0){ - penitent_turn+=1; - penitent_current+=1; - penitent_turnly=0; - - if (penitent_current<=0){ - penitent=0; - alarm[8]=1; - } - if (penitent_current>=penitent_max){ - penitent=0; - if (known[eFACTION.Inquisition]==2) or (known[eFACTION.Inquisition]>=4) then scr_audience(4,"penitent_end",0,"",0,0); - if (known[eFACTION.Ecclesiarchy]>=2) then scr_audience(5,"penitent_end",0,"",0,0); - disposition[eFACTION.Imperium]+=20; - disposition[eFACTION.Mechanicus]+=15; - disposition[eFACTION.Imperium]+=20; - disposition[eFACTION.Ecclesiarchy]+=20; - var o=0; - if (scr_has_adv("Reverent Guardians")) then o=500; - if (o>100) then obj_controller.disposition[eFACTION.Ecclesiarchy]+=10; - scr_event_log("","Penitent Crusade ends. You may once more recruit Astartes."); + // ** Ork WAAAAGH ** + if (((turn >= irandom(200) + 100) || (obj_ini.fleet_type == eFACTION.Mechanicus)) && (faction_defeated[eFACTION.Ork] == 0)) {} + + if (known[eFACTION.Ecclesiarchy] == 1) { + spikky = choose(0, 1, 1); + if (spikky) { + var _topic = faction_status[eFACTION.Ecclesiarchy] == "War" ? "declare_war" : "intro"; + scr_audience(eFACTION.Ecclesiarchy, _topic); + } + } + if ((known[eFACTION.Eldar] == 1) && (faction_defeated[eFACTION.Eldar] == 0)) { + spikky = choose(0, 1); + if (spikky == 1) { + scr_audience(eFACTION.Eldar, "intro1"); + } + } + if ((known[eFACTION.Ork] == 0.5) && (faction_defeated[eFACTION.Ork] == 0)) { + if (1 == irandom(7)) { + scr_audience(eFACTION.Ork, "intro"); + } + } + if ((known[eFACTION.Tau] == 1) && (faction_defeated[eFACTION.Tau] == 0)) { + scr_audience(eFACTION.Tau, "intro"); + } + // ** Quests here ** + // 135 ; quests + for (var i = 1; i <= 40; i++) { + if ((quest_end[i] <= turn) && (quest[i] != "")) { + scr_quest(1, quest[i], quest_faction[i], 0); + quest[i] = ""; + } + if ((quest[i] == "") && (quest[i + 1] != "")) { + quest[i] = quest[i + 1]; + quest_faction[i] = quest_faction[i + 1]; + quest_end[i] = quest_end[i + 1]; + quest[i + 1] += ""; + quest_faction[i + 1] = 0; + quest_end[i + 1] = 0; + } + } + // ** Inquisition stuff here ** + if (disposition[eFACTION.Eldar] >= 60) { + scr_loyalty("Xeno Associate", "+"); + } + if (disposition[eFACTION.Ork] >= 60) { + scr_loyalty("Xeno Associate", "+"); + } + if (disposition[eFACTION.Tau] >= 60) { + scr_loyalty("Xeno Associate", "+"); } -} -// ** Ork WAAAAGH ** -if ((turn>=irandom(200)+100) or (obj_ini.fleet_type==eFACTION.Mechanicus)) and (faction_defeated[eFACTION.Ork]==0){ -} + var loyalty_counter = 0; + loyalty_counter = scr_role_count(obj_ini.role[100][15], ""); + if (loyalty_counter == 0) { + scr_loyalty("Lack of Apothecary", "+"); + } -if (known[eFACTION.Ecclesiarchy]==1){ - spikky=choose(0,1,1); - if (spikky){ - var _topic = faction_status[eFACTION.Ecclesiarchy]=="War" ? "declare_war" : "intro"; - scr_audience(eFACTION.Ecclesiarchy, _topic); + loyalty_counter = scr_role_count(obj_ini.role[100][14], ""); + if (loyalty_counter == 0) { + scr_loyalty("Undevout", "+"); } -} -if (known[eFACTION.Eldar]==1) and (faction_defeated[eFACTION.Eldar]==0){ - spikky=choose(0,1); - if (spikky==1){ - scr_audience(eFACTION.Eldar, "intro1"); + // TODO in another PR rework how Non-Codex Size is determined, perhaps the inquisition needs to pass some checks or do an investigation event + // which you could eventually interrupt (kill the team) and cover it up? + if (marines >= 1050) { + scr_loyalty("Non-Codex Size", "+"); } -} -if (known[eFACTION.Ork]==0.5) and (faction_defeated[eFACTION.Ork]==0){ - if (1==irandom(7)){ - scr_audience(eFACTION.Ork, "intro"); + + var last_inquisitor_inspection = 0; + if (obj_ini.fleet_type == ePlayerBase.home_world) { + last_inquisitor_inspection = last_world_inspection; } -} -if (known[eFACTION.Tau]==1) and (faction_defeated[eFACTION.Tau]==0){ - scr_audience(eFACTION.Tau, "intro"); -} -// ** Quests here ** -// 135 ; quests -for(var i=1; i<=40; i++){ - if (quest_end[i]<=turn) and (quest[i]!=""){ - scr_quest(1,quest[i],quest_faction[i],0); - quest[i]=""; - } - if (quest[i]=="") and (quest[i+1]!=""){ - quest[i]=quest[i+1]; - quest_faction[i]=quest_faction[i+1]; - quest_end[i]=quest_end[i+1]; - quest[i+1]+=""; - quest_faction[i+1]=0; - quest_end[i+1]=0; + if (obj_ini.fleet_type != ePlayerBase.home_world) { + last_inquisitor_inspection = last_fleet_inspection; } -} -// ** Inquisition stuff here ** -if (disposition[eFACTION.Eldar]>=60) then scr_loyalty("Xeno Associate","+"); -if (disposition[eFACTION.Ork]>=60) then scr_loyalty("Xeno Associate","+"); -if (disposition[eFACTION.Tau]>=60) then scr_loyalty("Xeno Associate","+"); - -var loyalty_counter=0; -loyalty_counter=scr_role_count(obj_ini.role[100][15],""); -if (loyalty_counter==0) then scr_loyalty("Lack of Apothecary","+"); - -loyalty_counter=scr_role_count(obj_ini.role[100][14],""); -if (loyalty_counter==0) then scr_loyalty("Undevout","+"); -// TODO in another PR rework how Non-Codex Size is determined, perhaps the inquisition needs to pass some checks or do an investigation event -// which you could eventually interrupt (kill the team) and cover it up? -if (marines>=1050) then scr_loyalty("Non-Codex Size","+"); - -var last_inquisitor_inspection=0; -if (obj_ini.fleet_type=ePlayerBase.home_world) then last_inquisitor_inspection=last_world_inspection; -if (obj_ini.fleet_type != ePlayerBase.home_world) then last_inquisitor_inspection=last_fleet_inspection; - -var inspec=false; -if (loyalty>=85) and ((last_inquisitor_inspection+59)=70) and (loyalty<85) and ((last_inquisitor_inspection+47)=50) and (loyalty<70) and ((last_inquisitor_inspection+35)room_width) or (obj_p_fleet.y<0) or (obj_p_fleet.y>room_height) then inspec=false; - } - if (instance_number(obj_p_fleet)==0) then inspec=false; -} -instance_activate_object(obj_p_fleet); -//setup inquisitor inspections -var inquisitor_fleet_count = 0; -with(obj_fleet){if (owner==eFACTION.Inquisition) then inquisitor_fleet_count++} + var inspec = false; + if ((loyalty >= 85) && ((last_inquisitor_inspection + 59) < turn)) { + inspec = true; + } + if ((loyalty >= 70) && (loyalty < 85) && ((last_inquisitor_inspection + 47) < turn)) { + inspec = true; + } + if ((loyalty >= 50) && (loyalty < 70) && ((last_inquisitor_inspection + 35) < turn)) { + inspec = true; + } + if ((loyalty < 50) && ((last_inquisitor_inspection + 11 + choose(1, 2, 3, 4)) < turn)) { + inspec = true; + } -inspec = (inspec && faction_status[eFACTION.Inquisition]!="War" &&inquisitor_fleet_count==0); -if (inspec) { - new_inquisitor_inspection(); -} + if (obj_ini.fleet_type != ePlayerBase.home_world) { + if ((instance_number(obj_p_fleet) == 1) && (obj_ini.fleet_type == ePlayerBase.home_world)) { + // Might be crusading, right? + if ((obj_p_fleet.x < 0) || (obj_p_fleet.x > room_width) || (obj_p_fleet.y < 0) || (obj_p_fleet.y > room_height)) { + inspec = false; + } + } + if (instance_number(obj_p_fleet) == 0) { + inspec = false; + } + } + instance_activate_object(obj_p_fleet); -with(obj_temp6){instance_destroy();} + //setup inquisitor inspections + var inquisitor_fleet_count = 0; + with (obj_fleet) { + if (owner == eFACTION.Inquisition) { + inquisitor_fleet_count++; + } + } -for(var i=1; i<=10; i++){ - if (turns_ignored[i]==0) and (annoyed[i]>0) then annoyed[i]-=1; -} + inspec = inspec && faction_status[eFACTION.Inquisition] != "War" && inquisitor_fleet_count == 0; + if (inspec) { + new_inquisitor_inspection(); + } -// ** Various checks for imperium and faction relations ** -try{ - event_end_turn_action(); -} catch(_exception){ - handle_exception(_exception); -} -// Right here need to sort the battles within the obj_turn_end -with(obj_turn_end){scr_battle_sort();} + with (obj_temp6) { + instance_destroy(); + } -for(var i=1; i<=10; i++){ - if (turns_ignored[i]>0) and (turns_ignored[i]<500) then turns_ignored[i]-=1; -} -if (known[eFACTION.Eldar]>=2) and (faction_gender[6]==2) and (turn%10==0) then turns_ignored[6]+=floor(random_range(0,6)); + for (var i = 1; i <= 10; i++) { + if ((turns_ignored[i] == 0) && (annoyed[i] > 0)) { + annoyed[i] -= 1; + } + } -with(obj_ground_mission){instance_destroy();} -scr_random_event(true); + // ** Various checks for imperium and faction relations ** + try { + event_end_turn_action(); + } catch (_exception) { + handle_exception(_exception); + } + // Right here need to sort the battles within the obj_turn_end + with (obj_turn_end) { + scr_battle_sort(); + } -// ** Random events here ** -if (hurssy_time>0) and (hurssy>0) then hurssy_time-=1; -if (hurssy_time==0) and (hurssy>0){hurssy_time=-1;hurssy=0;} -with(obj_p_fleet){ - if (hurssy_time>0) and (hurssy>0) then hurssy_time-=1; - if (hurssy_time==0) and (hurssy>0){hurssy_time=-1;hurssy=0;} -} -with(obj_star){ - if (p_hurssy_time[1]>0) and (p_hurssy[1]>0) then p_hurssy_time[1]-=1; - if (p_hurssy_time[1]==0) and (p_hurssy[1]>0){ - p_hurssy_time[1]=-1; - p_hurssy[1]=0; - } - if (p_hurssy_time[2]>0) and (p_hurssy[2]>0) then p_hurssy_time[2]-=1; - if (p_hurssy_time[2]==0) and (p_hurssy[2]>0){ - p_hurssy_time[2]=-1; - p_hurssy[2]=0; - } - if (p_hurssy_time[3]>0) and (p_hurssy[3]>0) then p_hurssy_time[3]-=1; - if (p_hurssy_time[3]=0) and (p_hurssy[3]>0){ - p_hurssy_time[3]=-1; - p_hurssy[3]=0; - } - if (p_hurssy_time[4]>0) and (p_hurssy[4]>0) then p_hurssy_time[4]-=1; - if (p_hurssy_time[4]==0) and (p_hurssy[4]>0){ - p_hurssy_time[4]=-1; - p_hurssy[4]=0; + for (var i = 1; i <= 10; i++) { + if ((turns_ignored[i] > 0) && (turns_ignored[i] < 500)) { + turns_ignored[i] -= 1; + } + } + if ((known[eFACTION.Eldar] >= 2) && (faction_gender[6] == 2) && (turn % 10 == 0)) { + turns_ignored[6] += floor(random_range(0, 6)); } -} -if (turn==2){ - if (obj_ini.master_name=="Zakis Randi") or (global.chapter_name=="Knights Inductor") and (obj_controller.faction_status[eFACTION.Imperium]!="War") then alarm[8]=1; -} -// ** Player-set events ** -if (fest_scheduled>0) and (fest_repeats>0){ - var lock="",cm_present=false; - fest_repeats-=1; - lock=scr_master_loc(); + with (obj_ground_mission) { + instance_destroy(); + } + scr_random_event(true); + + // ** Random events here ** + if ((hurssy_time > 0) && (hurssy > 0)) { + hurssy_time -= 1; + } + if ((hurssy_time == 0) && (hurssy > 0)) { + hurssy_time = -1; + hurssy = 0; + } + with (obj_p_fleet) { + if ((hurssy_time > 0) && (hurssy > 0)) { + hurssy_time -= 1; + } + if ((hurssy_time == 0) && (hurssy > 0)) { + hurssy_time = -1; + hurssy = 0; + } + } + with (obj_star) { + if ((p_hurssy_time[1] > 0) && (p_hurssy[1] > 0)) { + p_hurssy_time[1] -= 1; + } + if ((p_hurssy_time[1] == 0) && (p_hurssy[1] > 0)) { + p_hurssy_time[1] = -1; + p_hurssy[1] = 0; + } + if ((p_hurssy_time[2] > 0) && (p_hurssy[2] > 0)) { + p_hurssy_time[2] -= 1; + } + if ((p_hurssy_time[2] == 0) && (p_hurssy[2] > 0)) { + p_hurssy_time[2] = -1; + p_hurssy[2] = 0; + } + if ((p_hurssy_time[3] > 0) && (p_hurssy[3] > 0)) { + p_hurssy_time[3] -= 1; + } + if ((p_hurssy_time[3] == 0) && (p_hurssy[3] > 0)) { + p_hurssy_time[3] = -1; + p_hurssy[3] = 0; + } + if ((p_hurssy_time[4] > 0) && (p_hurssy[4] > 0)) { + p_hurssy_time[4] -= 1; + } + if ((p_hurssy_time[4] == 0) && (p_hurssy[4] > 0)) { + p_hurssy_time[4] = -1; + p_hurssy[4] = 0; + } + } - if (fest_sid>0) and (obj_ini.ship[fest_sid]=lock) then cm_present=true; - if (fest_wid>0) and (string(fest_star)+"."+string(fest_wid)=lock) then cm_present=true; + if (turn == 2) { + if ((obj_ini.master_name == "Zakis Randi") || (global.chapter_name == "Knights Inductor") && (obj_controller.faction_status[eFACTION.Imperium] != "War")) { + alarm[8] = 1; + } + } + // ** Player-set events ** + if ((fest_scheduled > 0) && (fest_repeats > 0)) { + var lock = "", cm_present = false; + fest_repeats -= 1; + lock = scr_master_loc(); + + if ((fest_sid > 0) && (obj_ini.ship[fest_sid] == lock)) { + cm_present = true; + } + if ((fest_wid > 0) && (string(fest_star) + "." + string(fest_wid) == lock)) { + cm_present = true; + } - if (cm_present==true){ - var imag=""; + if (cm_present == true) { + var imag = ""; - if (fest_type=="Great Feast") then imag="event_feast"; - if (fest_type=="Tournament") then imag="event_tournament"; - if (fest_type=="Deathmatch") then imag="event_deathmatch"; - if (fest_type=="Imperial Mass") then imag="event_mass"; - if (fest_type=="Cult Sermon") then imag="event_ccult"; - if (fest_type=="Chapter Relic") then imag="event_ccrelic"; - if (fest_type=="Triumphal March") then imag="event_march"; + if (fest_type == "Great Feast") { + imag = "event_feast"; + } + if (fest_type == "Tournament") { + imag = "event_tournament"; + } + if (fest_type == "Deathmatch") { + imag = "event_deathmatch"; + } + if (fest_type == "Imperial Mass") { + imag = "event_mass"; + } + if (fest_type == "Cult Sermon") { + imag = "event_ccult"; + } + if (fest_type == "Chapter Relic") { + imag = "event_ccrelic"; + } + if (fest_type == "Triumphal March") { + imag = "event_march"; + } - if (fest_wid>0) then scr_popup("Scheduled Event","Your "+string(fest_type)+" takes place on "+string(fest_star)+" "+scr_roman(fest_wid)+". Would you like to spectate the event?",imag,""); - if (fest_sid>0) then scr_popup("Scheduled Event","Your "+string(fest_type)+" takes place on the ship '"+string(obj_ini.ship[fest_sid])+". Would you like to spectate the event?",imag,""); + if (fest_wid > 0) { + scr_popup("Scheduled Event", "Your " + string(fest_type) + " takes place on " + string(fest_star) + " " + scr_roman(fest_wid) + ". Would you like to spectate the event?", imag, ""); + } + if (fest_sid > 0) { + scr_popup("Scheduled Event", "Your " + string(fest_type) + " takes place on the ship '" + string(obj_ini.ship[fest_sid]) + ". Would you like to spectate the event?", imag, ""); + } + } } -} -// ** Income ** -// if (income_controlled_planets>0){ - -// var tithe_string = income_controlled_planets==1? $"-{income_tribute} Requisition granted by tithes from 1 planet.": $"-{income_tribute} Requisition granted by tithes from {income_controlled_planets} planets."; -// scr_alert("yellow", "planet_tithe", tithe_string); -// instance_activate_object(obj_p_fleet); - -// with(obj_star){ -// if (x<-10000){ -// x+=20000; -// y+=20000; -// } -// } -// } - -//research and forge related actions - -research_end(); -merge_ork_fleets(); -location_viewer.update_mission_log(); -init_ork_waagh(); -return_lost_ships_chance(); -//complex route plotting for player fleets -with (obj_p_fleet){ - if (array_length(complex_route)>0 && action == ""){ - set_new_player_fleet_course(complex_route); + // ** Income ** + // if (income_controlled_planets>0){ + + // var tithe_string = income_controlled_planets==1? $"-{income_tribute} Requisition granted by tithes from 1 planet.": $"-{income_tribute} Requisition granted by tithes from {income_controlled_planets} planets."; + // scr_alert("yellow", "planet_tithe", tithe_string); + // instance_activate_object(obj_p_fleet); + + // with(obj_star){ + // if (x<-10000){ + // x+=20000; + // y+=20000; + // } + // } + // } + + //research and forge related actions + + research_end(); + merge_ork_fleets(); + location_viewer.update_mission_log(); + init_ork_waagh(); + return_lost_ships_chance(); + //complex route plotting for player fleets + with (obj_p_fleet) { + if (array_length(complex_route) > 0 && action == "") { + set_new_player_fleet_course(complex_route); + } } -} - }); -if (helpful_places != false){ +if (helpful_places != false) { helpful_places = new HelpfulPlaces(); } - instance_activate_object(obj_star); instance_activate_object(obj_en_fleet); - diff --git a/objects/obj_controller/Alarm_6.gml b/objects/obj_controller/Alarm_6.gml index 039a9cc5e3..38f100b605 100644 --- a/objects/obj_controller/Alarm_6.gml +++ b/objects/obj_controller/Alarm_6.gml @@ -1,215 +1,338 @@ // Shows the selected units to land or raid a planet -if (menu==1) and (managing>0){ +if ((menu == 1) && (managing > 0)) { // TODO look to serialize the vars in here and in the rest of the code with a data structure. - // marine types - var cap=0,apo=0,chap=0,bear=0,tct=0,assa=0,dev=0,sco=0,hon=0,ve=0,ter=0,oth=0,drea=0,vdrea=0,codi=0,lexi=0,lib=0,tech=0,sgt=0,vet_sgt=0,champ=0; + // marine types + var cap = 0, apo = 0, chap = 0, bear = 0, tct = 0, assa = 0, dev = 0, sco = 0, hon = 0, ve = 0, ter = 0, oth = 0, drea = 0, vdrea = 0, codi = 0, lexi = 0, lib = 0, tech = 0, sgt = 0, vet_sgt = 0, champ = 0; // vehicle types - var rhi=0,pre=0,lrad=0,lspi=0,whi=0,unit; + var rhi = 0, pre = 0, lrad = 0, lspi = 0, whi = 0, unit; // non chapter units - otha=0; - - var manz=0,vanz=0,stahp=0; - sel_promoting=1; - for(var f=0; f 0) { + stahp = 1; } - - if (ma_role[f]=="Ork Sniper") or (ma_role[f]=="Flash Git") or (ma_role[f]=="Crusader") or (ma_role[f]=="Skitarii") then otha=1; - if (ma_role[f]=="Sister of Battle") or (ma_role[f]=="Sister Hospitaler") or (ma_role[f]=="Ranger") then otha=1; - if (otha>0) then stahp=1; - + // sets up count for the marines - if (man[f]=="man"){ - manz+=1; - if (unit.role()==obj_ini.role[100][5]) { cap+=1;} - else if (unit.role()==obj_ini.role[100][15]) { apo+=1;} - else if (unit.role()==obj_ini.role[100][14]) { chap+=1;} - else if (unit.role()==obj_ini.role[100][17]) { lib+=1;} - else if (unit.role()==obj_ini.role[100][16]) { tech+=1;} - else if (unit.role()==obj_ini.role[100][6]) { drea+=1;} - else if (unit.role()==$"Venerable {obj_ini.role[100][6]}"){ vdrea+=1;} - else if (unit.role()==obj_ini.role[100][11]) { bear+=1;} - else if (unit.role()==obj_ini.role[100][8]) { tct+=1;} - else if (unit.role()==obj_ini.role[100][10]) { assa+=1;} - else if (unit.role()==obj_ini.role[100][9]) { dev+=1;} - else if (unit.role()==obj_ini.role[100][12]) { sco+=1;} - else if (unit.role()==obj_ini.role[100][2]) { hon+=1;} - else if (unit.role()==obj_ini.role[100][3]) { ve+=1;} - else if (unit.role()==obj_ini.role[100][4]) { ter+=1;} - else if (unit.role()==obj_ini.role[100][18]) { sgt++;} - else if (unit.role()==obj_ini.role[100][19]) { vet_sgt++;} - else if (unit.role()=="Codiciery") { codi+=1;} - else if (unit.role()=="Lexicanum") { lexi+=1;} - else if (unit.role()==obj_ini.role[100][eROLE.Ancient]) { champ+=1;} + if (man[f] == "man") { + manz += 1; + if (unit.role() == obj_ini.role[100][5]) { + cap += 1; + } else if (unit.role() == obj_ini.role[100][15]) { + apo += 1; + } else if (unit.role() == obj_ini.role[100][14]) { + chap += 1; + } else if (unit.role() == obj_ini.role[100][17]) { + lib += 1; + } else if (unit.role() == obj_ini.role[100][16]) { + tech += 1; + } else if (unit.role() == obj_ini.role[100][6]) { + drea += 1; + } else if (unit.role() == $"Venerable {obj_ini.role[100][6]}") { + vdrea += 1; + } else if (unit.role() == obj_ini.role[100][11]) { + bear += 1; + } else if (unit.role() == obj_ini.role[100][8]) { + tct += 1; + } else if (unit.role() == obj_ini.role[100][10]) { + assa += 1; + } else if (unit.role() == obj_ini.role[100][9]) { + dev += 1; + } else if (unit.role() == obj_ini.role[100][12]) { + sco += 1; + } else if (unit.role() == obj_ini.role[100][2]) { + hon += 1; + } else if (unit.role() == obj_ini.role[100][3]) { + ve += 1; + } else if (unit.role() == obj_ini.role[100][4]) { + ter += 1; + } else if (unit.role() == obj_ini.role[100][18]) { + sgt++; + } else if (unit.role() == obj_ini.role[100][19]) { + vet_sgt++; + } else if (unit.role() == "Codiciery") { + codi += 1; + } else if (unit.role() == "Lexicanum") { + lexi += 1; + } else if (unit.role() == obj_ini.role[100][eROLE.Ancient]) { + champ += 1; + } } // sets up count for the vehicles // TODO This needs to be extended to accomodate the selection text like the man ones - if (man[f]="vehicle"){ - vanz+=1; - if (ma_role[f]="Land Raider") then lrad+=1; - if (ma_role[f]="Rhino") then rhi+=1; - if (ma_role[f]="Predator") then pre+=1; - if (ma_role[f]="Land Speeder") then lspi+=1; - if (ma_role[f]="Whirlwind") then whi+=1; + if (man[f] == "vehicle") { + vanz += 1; + if (ma_role[f] == "Land Raider") { + lrad += 1; + } + if (ma_role[f] == "Rhino") { + rhi += 1; + } + if (ma_role[f] == "Predator") { + pre += 1; + } + if (ma_role[f] == "Land Speeder") { + lspi += 1; + } + if (ma_role[f] == "Whirlwind") { + whi += 1; + } } } } - - selecting_dudes=""; + + selecting_dudes = ""; // Infantry text - if (cap>0){ - selecting_dudes+=string(cap)+" "+string(obj_ini.role[100][5]); - if (cap>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (chap>0){ - selecting_dudes+=string(chap)+" "+string(obj_ini.role[100][14]); - if (chap>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (champ>0){ - selecting_dudes+=$"{champ} {obj_ini.role[100][eROLE.Ancient]}"; - if (chap>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (apo>0){ - selecting_dudes+=string(apo)+" "+string(obj_ini.role[100][15]); - if (apo>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (lib>0){ - selecting_dudes+=string(lib)+" "+string(obj_ini.role[100,17]); - if (lib>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (codi>0){ - selecting_dudes+=string(codi)+" Codiciery"; - if (codi>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (lexi>0){ - selecting_dudes+=string(lexi)+" Lexicanum"; - if (lexi>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (bear>0){ - selecting_dudes+=string(bear)+" "+string(obj_ini.role[100][11]); - if (bear>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (hon>0){ - selecting_dudes+=string(hon)+" "+string(obj_ini.role[100][2]); - if (hon>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (tech>0){ - selecting_dudes+=string(tech)+" "+string(obj_ini.role[100][16]); - if (tech>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (ter>0){ - selecting_dudes+=string(ter)+" Terminator"; - if (ter>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (ve>0){ - selecting_dudes+=string(ve)+" "+string(obj_ini.role[100][3]); - if (ve>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (tct>0){ - selecting_dudes+=string(tct)+" "+string(obj_ini.role[100][8]); - if (tct>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (dev>0){ - selecting_dudes+=string(dev)+" "+string(obj_ini.role[100][9]); - if (dev>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (assa>0){ - selecting_dudes+=string(assa)+" "+string(obj_ini.role[100][eROLE.Assault]); - if (sgt>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (sco>0){ - selecting_dudes+=string(sco)+" "+string(obj_ini.role[100][12]); - if (sco>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (drea>0){ - selecting_dudes+=string(drea)+" "+string(obj_ini.role[100][6]); - if (drea>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (sgt>0){ - selecting_dudes+=string(sgt)+" "+string(obj_ini.role[100][18]); - if (sgt>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (vet_sgt>0){ - selecting_dudes+=string(vet_sgt)+" "+string(obj_ini.role[100][19]); - if (vet_sgt>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } + if (cap > 0) { + selecting_dudes += string(cap) + " " + string(obj_ini.role[100][5]); + if (cap > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (chap > 0) { + selecting_dudes += string(chap) + " " + string(obj_ini.role[100][14]); + if (chap > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (champ > 0) { + selecting_dudes += $"{champ} {obj_ini.role[100][eROLE.Ancient]}"; + if (chap > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (apo > 0) { + selecting_dudes += string(apo) + " " + string(obj_ini.role[100][15]); + if (apo > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (lib > 0) { + selecting_dudes += string(lib) + " " + string(obj_ini.role[100][17]); + if (lib > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (codi > 0) { + selecting_dudes += string(codi) + " Codiciery"; + if (codi > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (lexi > 0) { + selecting_dudes += string(lexi) + " Lexicanum"; + if (lexi > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (bear > 0) { + selecting_dudes += string(bear) + " " + string(obj_ini.role[100][11]); + if (bear > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (hon > 0) { + selecting_dudes += string(hon) + " " + string(obj_ini.role[100][2]); + if (hon > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (tech > 0) { + selecting_dudes += string(tech) + " " + string(obj_ini.role[100][16]); + if (tech > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (ter > 0) { + selecting_dudes += string(ter) + " Terminator"; + if (ter > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (ve > 0) { + selecting_dudes += string(ve) + " " + string(obj_ini.role[100][3]); + if (ve > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (tct > 0) { + selecting_dudes += string(tct) + " " + string(obj_ini.role[100][8]); + if (tct > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (dev > 0) { + selecting_dudes += string(dev) + " " + string(obj_ini.role[100][9]); + if (dev > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (assa > 0) { + selecting_dudes += string(assa) + " " + string(obj_ini.role[100][eROLE.Assault]); + if (sgt > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (sco > 0) { + selecting_dudes += string(sco) + " " + string(obj_ini.role[100][12]); + if (sco > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (drea > 0) { + selecting_dudes += string(drea) + " " + string(obj_ini.role[100][6]); + if (drea > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (sgt > 0) { + selecting_dudes += string(sgt) + " " + string(obj_ini.role[100][18]); + if (sgt > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (vet_sgt > 0) { + selecting_dudes += string(vet_sgt) + " " + string(obj_ini.role[100][19]); + if (vet_sgt > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } // Vehicle text - if (lrad>0){ - selecting_dudes+=string(lrad)+" Land Raider"; - if (lrad>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (pre>0){ - selecting_dudes+=string(pre)+" Predator"; - if (pre>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (rhi>0){ - selecting_dudes+=string(rhi)+" Rhino"; - if (rhi>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (whi>0){ - selecting_dudes+=string(whi)+" Whirlwind"; - if (whi>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - if (lspi>0){ - selecting_dudes+=string(lspi)+" Land Speeder"; - if (lspi>1) then selecting_dudes+="s"; - selecting_dudes+=", "; - } - - if (string_length(selecting_dudes)>0) then selecting_dudes=string_delete(selecting_dudes,string_length(selecting_dudes),2); - - if (man_size==0) then selecting_location=""; - - if (vanz>0) and (manz==0) and (stahp==0){ - sel_promoting=1; - alarm[6]=15; + if (lrad > 0) { + selecting_dudes += string(lrad) + " Land Raider"; + if (lrad > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (pre > 0) { + selecting_dudes += string(pre) + " Predator"; + if (pre > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (rhi > 0) { + selecting_dudes += string(rhi) + " Rhino"; + if (rhi > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (whi > 0) { + selecting_dudes += string(whi) + " Whirlwind"; + if (whi > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + if (lspi > 0) { + selecting_dudes += string(lspi) + " Land Speeder"; + if (lspi > 1) { + selecting_dudes += "s"; + } + selecting_dudes += ", "; + } + + if (string_length(selecting_dudes) > 0) { + selecting_dudes = string_delete(selecting_dudes, string_length(selecting_dudes), 2); + } + + if (man_size == 0) { + selecting_location = ""; + } + + if ((vanz > 0) && (manz == 0) && (stahp == 0)) { + sel_promoting = 1; + alarm[6] = 15; exit; } - if ((drea+vdrea)>0) then sel_promoting=-1; - if ((cap+apo+chap+bear+tct+assa+dev+sco+hon+ve+ter+oth+lib+codi+lexi+tech)>=1) and (sel_promoting!=-1) then sel_promoting=1; - if (manz>0) and (vanz>0) then sel_promoting=-1; - if (man_size==0) then sel_promoting=-1; - - if (lib>0) and ((lexi+codi+cap+apo+chap+bear+tct+assa+dev+sco+hon+ve+ter+oth+drea+vdrea+tech)>0) then sel_promoting=-1; - if (lib>1) then sel_promoting=-1; - if (codi>0) and ((lexi+lib+cap+apo+chap+bear+tct+assa+dev+sco+hon+ve+ter+oth+drea+vdrea+tech)>0) then sel_promoting=-1; - if (codi>1) then sel_promoting=-1; - if (lexi>0) and ((codi+lib+cap+apo+chap+bear+tct+assa+dev+sco+hon+ve+ter+oth+drea+vdrea+tech)>0) then sel_promoting=-1; - if (lexi>1) then sel_promoting=-1; - if (apo>0) and ((lib+lexi+codi+cap+chap+bear+tct+assa+dev+sco+hon+ve+ter+oth+drea+vdrea+tech)>0) then sel_promoting=-1; - if (apo>1) then sel_promoting=-1; - if (chap>0) and ((lib+lexi+codi+cap+apo+bear+tct+assa+dev+sco+hon+ve+ter+oth+drea+vdrea+tech)>0) then sel_promoting=-1; - if (chap>1) then sel_promoting=-1; + if ((drea + vdrea) > 0) { + sel_promoting = -1; + } + if (((cap + apo + chap + bear + tct + assa + dev + sco + hon + ve + ter + oth + lib + codi + lexi + tech) >= 1) && (sel_promoting != -1)) { + sel_promoting = 1; + } + if ((manz > 0) && (vanz > 0)) { + sel_promoting = -1; + } + if (man_size == 0) { + sel_promoting = -1; + } - if (stahp>0) then sel_promoting-=1; - - if (sel_promoting=-1) then sel_promoting=0; - alarm[6]=7; + if ((lib > 0) && ((lexi + codi + cap + apo + chap + bear + tct + assa + dev + sco + hon + ve + ter + oth + drea + vdrea + tech) > 0)) { + sel_promoting = -1; + } + if (lib > 1) { + sel_promoting = -1; + } + if ((codi > 0) && ((lexi + lib + cap + apo + chap + bear + tct + assa + dev + sco + hon + ve + ter + oth + drea + vdrea + tech) > 0)) { + sel_promoting = -1; + } + if (codi > 1) { + sel_promoting = -1; + } + if ((lexi > 0) && ((codi + lib + cap + apo + chap + bear + tct + assa + dev + sco + hon + ve + ter + oth + drea + vdrea + tech) > 0)) { + sel_promoting = -1; + } + if (lexi > 1) { + sel_promoting = -1; + } + if ((apo > 0) && ((lib + lexi + codi + cap + chap + bear + tct + assa + dev + sco + hon + ve + ter + oth + drea + vdrea + tech) > 0)) { + sel_promoting = -1; + } + if (apo > 1) { + sel_promoting = -1; + } + if ((chap > 0) && ((lib + lexi + codi + cap + apo + bear + tct + assa + dev + sco + hon + ve + ter + oth + drea + vdrea + tech) > 0)) { + sel_promoting = -1; + } + if (chap > 1) { + sel_promoting = -1; + } + + if (stahp > 0) { + sel_promoting -= 1; + } + + if (sel_promoting == -1) { + sel_promoting = 0; + } + alarm[6] = 7; } diff --git a/objects/obj_controller/Alarm_7.gml b/objects/obj_controller/Alarm_7.gml index 6d2b278c80..8d3c660ed0 100644 --- a/objects/obj_controller/Alarm_7.gml +++ b/objects/obj_controller/Alarm_7.gml @@ -2,13 +2,19 @@ log_message("Player Defeated; Exited to Defeat Screen"); audio_stop_sound(snd_royal); -audio_play_sound(snd_defeat,0,true); +audio_play_sound(snd_defeat, 0, true); audio_sound_gain(snd_defeat, 0, 0); -var nope=false; -if (master_volume==0) or (music_volume==0) then nope=true; -if (!nope){audio_sound_gain(snd_defeat,1*master_volume*music_volume,2000);} +var nope = false; +if ((master_volume == 0) || (music_volume == 0)) { + nope = true; +} +if (!nope) { + audio_sound_gain(snd_defeat, 1 * master_volume * music_volume, 2000); +} -if (obj_controller.marines+obj_controller.command<=50) and (global.defeat!=2) then global.defeat=0; +if ((obj_controller.marines + obj_controller.command <= 50) && (global.defeat != 2)) { + global.defeat = 0; +} room_goto(Defeat); diff --git a/objects/obj_controller/Alarm_8.gml b/objects/obj_controller/Alarm_8.gml index 3131d23158..eb76c33ef0 100644 --- a/objects/obj_controller/Alarm_8.gml +++ b/objects/obj_controller/Alarm_8.gml @@ -1,41 +1,44 @@ // Excommunicatus Traitorus instance_activate_object(obj_star); -var witch=obj_controller; -if (instance_exists(obj_turn_end)) then witch=obj_turn_end; - +var witch = obj_controller; +if (instance_exists(obj_turn_end)) { + witch = obj_turn_end; +} -decare_war_on_imperium_audiences() +decare_war_on_imperium_audiences(); -if (obj_controller.faction_gender[10]==1) and (obj_controller.known[eFACTION.Chaos]==0) and (obj_controller.faction_defeated[10]==0){ +if ((obj_controller.faction_gender[10] == 1) && (obj_controller.known[eFACTION.Chaos] == 0) && (obj_controller.faction_defeated[10] == 0)) { scr_audience(10, "intro"); } -with(obj_star){ - if (p_owner[1]==1) or (p_owner[2]==1) or (p_owner[3]==1) or (p_owner[4]==1){ - var heh=instance_create(x,y,obj_crusade); - heh.radius=64; - heh.duration=9999; - heh.show=false; - heh.placing=false; - heh.alarm[1]=-1; - if (p_owner[1]==1){ - p_pdf[1]+=p_guardsmen[1]; - p_guardsmen[1]=0; +with (obj_star) { + if ((p_owner[1] == 1) || (p_owner[2] == 1) || (p_owner[3] == 1) || (p_owner[4] == 1)) { + var heh = instance_create(x, y, obj_crusade); + heh.radius = 64; + heh.duration = 9999; + heh.show = false; + heh.placing = false; + heh.alarm[1] = -1; + if (p_owner[1] == 1) { + p_pdf[1] += p_guardsmen[1]; + p_guardsmen[1] = 0; } - if (p_owner[2]==1){ - p_pdf[2]+=p_guardsmen[2]; - p_guardsmen[2]=0; + if (p_owner[2] == 1) { + p_pdf[2] += p_guardsmen[2]; + p_guardsmen[2] = 0; } - if (p_owner[3]==1){ - p_pdf[3]+=p_guardsmen[3]; - p_guardsmen[3]=0; + if (p_owner[3] == 1) { + p_pdf[3] += p_guardsmen[3]; + p_guardsmen[3] = 0; } - if (p_owner[4]==1){ - p_pdf[4]+=p_guardsmen[4]; - p_guardsmen[4]=0; + if (p_owner[4] == 1) { + p_pdf[4] += p_guardsmen[4]; + p_guardsmen[4] = 0; } } } -if (instance_exists(obj_fleet)) then instance_deactivate_object(obj_star); +if (instance_exists(obj_fleet)) { + instance_deactivate_object(obj_star); +} diff --git a/objects/obj_controller/CleanUp_0.gml b/objects/obj_controller/CleanUp_0.gml index e43d58b1e2..fb194912e4 100644 --- a/objects/obj_controller/CleanUp_0.gml +++ b/objects/obj_controller/CleanUp_0.gml @@ -1,12 +1,12 @@ global.name_generator = new NameGenerator(); var _star_arrays = []; -ds_map_values_to_array(global.star_sprites,_star_arrays); +ds_map_values_to_array(global.star_sprites, _star_arrays); -for (var i=0;i 0) { + born_leader = 1; } - - if (string_count(obj_ini.spe[0,1],"$")>0) then born_leader=1; } // ** Resets marines and other vars ** -for(var i=0; i<501; i++){ - - if (i<=50){ - penit_co[i]=0; - penit_id[i]=0; +for (var i = 0; i < 501; i++) { + if (i <= 50) { + penit_co[i] = 0; + penit_id[i] = 0; } } event = []; // ship management arrays // they are used to display a paginated subset of ships // at a particular location for the load to ship screen. -sh_ide = [] -sh_uid = [] -sh_name = [] -sh_class = [] -sh_loc = [] -sh_hp = [] -sh_cargo = [] -sh_cargo_max = [] +sh_ide = []; +sh_uid = []; +sh_name = []; +sh_class = []; +sh_loc = []; +sh_hp = []; +sh_cargo = []; +sh_cargo_max = []; reset_manage_arrays(); -alll=0; +alll = 0; // -popup=0;// 1: fleet, 2: other, 3: system -selected=0; -sel_owner=0; -sel_system_x=0; -sel_system_y=0; -popup_master_crafted=0; +popup = 0; // 1: fleet, 2: other, 3: system +selected = 0; +sel_owner = 0; +sel_system_x = 0; +sel_system_y = 0; +popup_master_crafted = 0; close_popups = true; unit_manage_image = false; // ** Sets starting turn ** -turn=1; +turn = 1; // turn=40; // ** Sets events and missions ** -last_event=0; -last_mission=0; +last_event = 0; +last_mission = 0; // ** Inquisition inspection ** -last_world_inspection=0;// Duhuhu -last_fleet_inspection=0; +last_world_inspection = 0; // Duhuhu +last_fleet_inspection = 0; // chaos_turn=100+((floor(random(10))+1)*choose(-1,1)); // ** Sets when chaos will arrive ** -chaos_turn=2; +chaos_turn = 2; // ** Sets fleets** -chaos_fleets=0; -tau_fleets=0; -tau_stars=0; -tau_messenger=0; -imp_ships=0; -cooldown=8; -exit_all=0; +chaos_fleets = 0; +tau_fleets = 0; +tau_stars = 0; +tau_messenger = 0; +imp_ships = 0; +cooldown = 8; +exit_all = 0; // ** Sets diplomacy and trading ** -diplomacy=0; -trading=0; -trading_artifact=0; -trading_enemy_demand=0; -trading_demand=0; -trade_likely=""; -questing=0; -liscensing=0; -audience=0; -force_goodbye=0; -trade_req=0; -trade_gene=0; -trade_chip=0; -trade_info=0; -zui=0; +diplomacy = 0; +trading = 0; +trading_artifact = 0; +trading_enemy_demand = 0; +trading_demand = 0; +trade_likely = ""; +questing = 0; +liscensing = 0; +audience = 0; +force_goodbye = 0; +trade_req = 0; +trade_gene = 0; +trade_chip = 0; +trade_info = 0; +zui = 0; // Variables for management var array_size = 9001; temp = array_create(array_size, 0); @@ -704,20 +801,20 @@ temp[90] = 0; temp[9000] = ""; // ** Resets all audiences ** audience_stack = []; -audiences=0; +audiences = 0; // ** Sets default recruiting vars ** -recruits=0; -recruiting_worlds=""; -recruit_trial=eTrials.BLOODDUEL; -recruit_last=0; - -recruit_name[0]=""; -recruit_corruption[0]=0; -recruit_distance[0]=0; -recruit_training[0]=0; -recruit_exp[0]=0; -recruit_data[0]={}; +recruits = 0; +recruiting_worlds = ""; +recruit_trial = eTrials.BLOODDUEL; +recruit_last = 0; + +recruit_name[0] = ""; +recruit_corruption[0] = 0; +recruit_distance[0] = 0; +recruit_training[0] = 0; +recruit_exp[0] = 0; +recruit_data[0] = {}; // ** Sets loyalty variables ** loyal = array_create(51, ""); @@ -741,17 +838,17 @@ for (var i = 0, l = array_length(inquisitor_gender); i < l; i++) { } // ** Sets diplomacy variables ** -diplo_last=""; -diplo_text=""; -diplo_txt=""; -diplo_char=0; +diplo_last = ""; +diplo_text = ""; +diplo_txt = ""; +diplo_char = 0; diplo_option = []; -diplo_alpha=0; +diplo_alpha = 0; // ** Sets combat to not true ** -combat=0; +combat = 0; random_event_next = EVENT.none; -useful_info=""; +useful_info = ""; // ** Sets the reason for loss of loyalty ** var loyalReasons = [ @@ -760,7 +857,6 @@ var loyalReasons = [ "Traitorous Marines", "Use of Sorcery", "Mutant Gene-Seed", - "Non-Codex Arming", "Non-Codex Size", "Lack of Apothecary", @@ -770,84 +866,81 @@ var loyalReasons = [ "Unvigilant", "Conduct Unbecoming", "Refusing to Crusade", - "Eldar Contact", "Ork Contact", "Tau Contact", "Xeno Trade", "Xeno Associate", - "Inquisitor Killer", "Crossing the Inquisition", "Avoiding Inspections", "Lost Standard" ]; -for(var i=0; i< array_length(loyalReasons); i++){ - loyal[i+1]=loyalReasons[i]; +for (var i = 0; i < array_length(loyalReasons); i++) { + loyal[i + 1] = loyalReasons[i]; } -inqis_flag_lair=0; -inqis_flag_gene=0; +inqis_flag_lair = 0; +inqis_flag_gene = 0; -faction_justmet=0; +faction_justmet = 0; // ** Sets up starting requisition ** -requisition=500; -if (instance_exists(obj_ini)){ - if ( - (obj_ini.progenitor == ePROGENITOR.NONE) && - (global.chapter_name != "Doom Benefactors") - ) { - requisition=2000; +requisition = 500; +if (instance_exists(obj_ini)) { + if ((obj_ini.progenitor == ePROGENITOR.NONE) && (global.chapter_name != "Doom Benefactors")) { + requisition = 2000; } } -if (is_test_map==true) then requisition=50000; +if (is_test_map == true) { + requisition = 50000; +} chapter_master = new scr_chapter_master(); trade_attempt = false; // ** Sets income ** -income=0; -income_last=0; +income = 0; +income_last = 0; /*income-=obj_ini.battle_barges; income-=obj_ini.strike_cruisers/2; income-=(obj_ini.gladius+obj_ini.hunters)/10;*/ -income_base=0; -income_home=0; -income_forge=0; -income_agri=0; -income_training=0; -income_fleet=0; -income_trade=0; -income_leader=0; -income_tribute=0; -income_controlled_planets=0; +income_base = 0; +income_home = 0; +income_forge = 0; +income_agri = 0; +income_training = 0; +income_fleet = 0; +income_trade = 0; +income_leader = 0; +income_tribute = 0; +income_controlled_planets = 0; // ** Extra variables ** -info_chips=0; -inspection_passes=0; -recruiting_worlds_bought=0; +info_chips = 0; +inspection_passes = 0; +recruiting_worlds_bought = 0; // ** BATTLE FORMATIONS ** -for(var i=0; i<16; i++){ - bat_formation[i]=""; - bat_formation_type[i]=0; - bat_deva_for[i]=1; - bat_assa_for[i]=4; - bat_tact_for[i]=2; - bat_vete_for[i]=2; - bat_hire_for[i]=3; - bat_libr_for[i]=3; - bat_comm_for[i]=3; - bat_tech_for[i]=3; - bat_term_for[i]=3; - bat_hono_for[i]=3; - bat_drea_for[i]=5; - bat_rhin_for[i]=6; - bat_pred_for[i]=7; - bat_landraid_for[i]=7; - bat_landspee_for[i]=4; - bat_whirl_for[i]=1; - bat_scou_for[i]=1; +for (var i = 0; i < 16; i++) { + bat_formation[i] = ""; + bat_formation_type[i] = 0; + bat_deva_for[i] = 1; + bat_assa_for[i] = 4; + bat_tact_for[i] = 2; + bat_vete_for[i] = 2; + bat_hire_for[i] = 3; + bat_libr_for[i] = 3; + bat_comm_for[i] = 3; + bat_tech_for[i] = 3; + bat_term_for[i] = 3; + bat_hono_for[i] = 3; + bat_drea_for[i] = 5; + bat_rhin_for[i] = 6; + bat_pred_for[i] = 7; + bat_landraid_for[i] = 7; + bat_landspee_for[i] = 4; + bat_whirl_for[i] = 1; + bat_scou_for[i] = 1; } // ground=1 raid=2 // 1: Attack type=1 @@ -857,145 +950,166 @@ for(var i=0; i<16; i++){ default_bat_formation(); // Defaults formations end here -bat_devastator_column=1; -bat_assault_column=4; -bat_tactical_column=2; -bat_veteran_column=2; -bat_hire_column=3; -bat_librarian_column=3; -bat_command_column=3; -bat_techmarine_column=3; -bat_terminator_column=3; -bat_honor_column=3; -bat_dreadnought_column=5; -bat_rhino_column=6; -bat_predator_column=7; -bat_landraider_column=7; -bat_whirlwind_column=1; -bat_landspeeder_column=4; -bat_scout_column=1; +bat_devastator_column = 1; +bat_assault_column = 4; +bat_tactical_column = 2; +bat_veteran_column = 2; +bat_hire_column = 3; +bat_librarian_column = 3; +bat_command_column = 3; +bat_techmarine_column = 3; +bat_terminator_column = 3; +bat_honor_column = 3; +bat_dreadnought_column = 5; +bat_rhino_column = 6; +bat_predator_column = 7; +bat_landraider_column = 7; +bat_whirlwind_column = 1; +bat_landspeeder_column = 4; +bat_scout_column = 1; // ** Sets up disposition per faction ** - imperial_factions = [ eFACTION.Imperium, eFACTION.Mechanicus, eFACTION.Inquisition, - eFACTION.Ecclesiarchy, -] -faction[0]=""; -disposition[0]=0; -faction[eFACTION.Player]="Player"; -disposition[1]=0; -faction[eFACTION.Imperium]="Imperium"; -disposition[3]=0; -faction[3]="Mechanicus"; -disposition[4]=0; -faction[4]="Inquisition"; -disposition[4]=0; -faction[5]="Ecclesiarchy"; -disposition[5]=0; + eFACTION.Ecclesiarchy +]; +faction[0] = ""; +disposition[0] = 0; +faction[eFACTION.Player] = "Player"; +disposition[1] = 0; +faction[eFACTION.Imperium] = "Imperium"; +disposition[3] = 0; +faction[3] = "Mechanicus"; +disposition[4] = 0; +faction[4] = "Inquisition"; +disposition[4] = 0; +faction[5] = "Ecclesiarchy"; +disposition[5] = 0; // ** Initial disposition for Imperial factions ** -if (instance_exists(obj_ini)){ - faction[2]="Imperium"; - disposition[2]=obj_ini.imperium_disposition; - faction[3]="Mechanicus"; - disposition[3]=obj_ini.mechanicus_disposition; - faction[4]="Inquisition"; - disposition[4]=obj_ini.inquisition_disposition; - faction[5]="Ecclesiarchy"; - disposition[5]=obj_ini.ecclesiarchy_disposition; +if (instance_exists(obj_ini)) { + faction[2] = "Imperium"; + disposition[2] = obj_ini.imperium_disposition; + faction[3] = "Mechanicus"; + disposition[3] = obj_ini.mechanicus_disposition; + faction[4] = "Inquisition"; + disposition[4] = obj_ini.inquisition_disposition; + faction[5] = "Ecclesiarchy"; + disposition[5] = obj_ini.ecclesiarchy_disposition; } // ** Initial disposition for non Imperials ** -faction[6]="Eldar"; -disposition[6]=-10; -faction[7]="Ork"; -disposition[7]=-40; -faction[8]="Tau"; -disposition[8]=0; -faction[9]="Tyranids"; -disposition[9] = irandom_range(40,100) = 1;// use this to countdown genestealer cults, create one at the end -faction[10]="Chaos"; -disposition[10]=-70; -faction[11]="Heretics"; -disposition[10]=-70; -faction[12]=""; -disposition[12]=0; -faction[13]="Necrons"; -disposition[13]=-20; +faction[6] = "Eldar"; +disposition[6] = -10; +faction[7] = "Ork"; +disposition[7] = -40; +faction[8] = "Tau"; +disposition[8] = 0; +faction[9] = "Tyranids"; +disposition[9] = irandom_range(40, 100) == 1; // use this to countdown genestealer cults, create one at the end +faction[10] = "Chaos"; +disposition[10] = -70; +faction[11] = "Heretics"; +disposition[10] = -70; +faction[12] = ""; +disposition[12] = 0; +faction[13] = "Necrons"; +disposition[13] = -20; // ** Max disposition ** disposition_max = array_create(14, 0); -disposition_max[2]=40; -disposition_max[3]=40; -disposition_max[4]=40; -disposition_max[5]=40; -if (instance_exists(obj_ini)){ - disposition_max[2]=40+obj_ini.imperium_disposition; - if (disposition_max[2]>100) then disposition_max[2]=100; - disposition_max[3]=40+obj_ini.mechanicus_disposition; - if (disposition_max[3]>100) then disposition_max[3]=100; - disposition_max[4]=40+obj_ini.inquisition_disposition; - if (disposition_max[4]>100) then disposition_max[4]=100; - disposition_max[5]=40+obj_ini.ecclesiarchy_disposition; - if (disposition_max[5]>100) then disposition_max[5]=100; +disposition_max[2] = 40; +disposition_max[3] = 40; +disposition_max[4] = 40; +disposition_max[5] = 40; +if (instance_exists(obj_ini)) { + disposition_max[2] = 40 + obj_ini.imperium_disposition; + if (disposition_max[2] > 100) { + disposition_max[2] = 100; + } + disposition_max[3] = 40 + obj_ini.mechanicus_disposition; + if (disposition_max[3] > 100) { + disposition_max[3] = 100; + } + disposition_max[4] = 40 + obj_ini.inquisition_disposition; + if (disposition_max[4] > 100) { + disposition_max[4] = 100; + } + disposition_max[5] = 40 + obj_ini.ecclesiarchy_disposition; + if (disposition_max[5] > 100) { + disposition_max[5] = 100; + } } // ** Sets up faction leader names as well as player faction stuff ** faction_leader = array_create(14, ""); faction_title = array_create(14, ""); faction_status = array_create(14, ""); // Sector Command faction -faction_leader[eFACTION.Imperium]=global.name_generator.generate_imperial_name(); -faction_title[eFACTION.Imperium]="Sector Commander"; -faction_status[eFACTION.Imperium]="Allied"; +faction_leader[eFACTION.Imperium] = global.name_generator.generate_imperial_name(); +faction_title[eFACTION.Imperium] = "Sector Commander"; +faction_status[eFACTION.Imperium] = "Allied"; // Mechanicus faction -faction_leader[eFACTION.Mechanicus]=global.name_generator.generate_imperial_name(); -faction_title[eFACTION.Mechanicus]="Magos"; -faction_status[eFACTION.Mechanicus]="Allied"; -if (faction_leader[eFACTION.Mechanicus]==faction_leader[eFACTION.Imperium]) then faction_leader[eFACTION.Mechanicus]=global.name_generator.generate_space_marine_name(); +faction_leader[eFACTION.Mechanicus] = global.name_generator.generate_imperial_name(); +faction_title[eFACTION.Mechanicus] = "Magos"; +faction_status[eFACTION.Mechanicus] = "Allied"; +if (faction_leader[eFACTION.Mechanicus] == faction_leader[eFACTION.Imperium]) { + faction_leader[eFACTION.Mechanicus] = global.name_generator.generate_space_marine_name(); +} // Inquisition faction -faction_leader[eFACTION.Inquisition]=global.name_generator.generate_imperial_name(); -if (faction_leader[eFACTION.Inquisition]==faction_leader[eFACTION.Mechanicus]) then faction_leader[eFACTION.Inquisition]=global.name_generator.generate_imperial_name(); -faction_title[eFACTION.Inquisition]="Inquisitor Lord"; -faction_status[eFACTION.Inquisition]="Allied"; +faction_leader[eFACTION.Inquisition] = global.name_generator.generate_imperial_name(); +if (faction_leader[eFACTION.Inquisition] == faction_leader[eFACTION.Mechanicus]) { + faction_leader[eFACTION.Inquisition] = global.name_generator.generate_imperial_name(); +} +faction_title[eFACTION.Inquisition] = "Inquisitor Lord"; +faction_status[eFACTION.Inquisition] = "Allied"; // Sisters faction -faction_leader[eFACTION.Ecclesiarchy]=global.name_generator.generate_imperial_name(false); -faction_title[eFACTION.Ecclesiarchy]="Prioress"; -faction_status[eFACTION.Ecclesiarchy]="Allied"; +faction_leader[eFACTION.Ecclesiarchy] = global.name_generator.generate_imperial_name(false); +faction_title[eFACTION.Ecclesiarchy] = "Prioress"; +faction_status[eFACTION.Ecclesiarchy] = "Allied"; // Eldar faction -faction_leader[eFACTION.Eldar]=global.name_generator.generate_eldar_name(2); -faction_title[eFACTION.Eldar]="Farseer"; -faction_status[eFACTION.Eldar]="Antagonism";// If disposition = 0 then instead set it to "Antagonism" +faction_leader[eFACTION.Eldar] = global.name_generator.generate_eldar_name(2); +faction_title[eFACTION.Eldar] = "Farseer"; +faction_status[eFACTION.Eldar] = "Antagonism"; // If disposition = 0 then instead set it to "Antagonism" // Orkz faction -faction_leader[eFACTION.Ork]=global.name_generator.generate_ork_name(); -faction_title[eFACTION.Ork]="Warboss"; -faction_status[eFACTION.Ork]="War"; +faction_leader[eFACTION.Ork] = global.name_generator.generate_ork_name(); +faction_title[eFACTION.Ork] = "Warboss"; +faction_status[eFACTION.Ork] = "War"; // Tau faction faction_leader[eFACTION.Tau] = global.name_generator.generate_tau_leader_name(); -faction_title[eFACTION.Tau]="Diplomat"; -faction_status[eFACTION.Tau]="Antagonism"; +faction_title[eFACTION.Tau] = "Diplomat"; +faction_status[eFACTION.Tau] = "Antagonism"; // Other factions unkown to player -faction_status[eFACTION.Tyranids]="War"; -faction_title[eFACTION.Chaos]="Chaos Lord"; -faction_status[eFACTION.Chaos]="War"; -faction_status[eFACTION.Heretics]="War"; -faction_status[eFACTION.Genestealer]="War"; -faction_status[eFACTION.Necrons]="War"; +faction_status[eFACTION.Tyranids] = "War"; +faction_title[eFACTION.Chaos] = "Chaos Lord"; +faction_status[eFACTION.Chaos] = "War"; +faction_status[eFACTION.Heretics] = "War"; +faction_status[eFACTION.Genestealer] = "War"; +faction_status[eFACTION.Necrons] = "War"; // ** Sets faction gender for names ** faction_gender = array_create(14, 1); -faction_gender[6]=choose(1,2); -faction_gender[8]=choose(1,1,2); -if (faction_gender[4]=2) then faction_leader[eFACTION.Inquisition]=global.name_generator.generate_imperial_name(false); -faction_gender[10]=choose(1,1,1,2,2); -if (faction_gender[10]==1) then faction_leader[eFACTION.Chaos]=choose("1","1","1","2"); -if (faction_gender[10]==2) then faction_leader[eFACTION.Chaos]=choose("1","2","2","2"); -if (faction_leader[eFACTION.Chaos]=="1") then faction_leader[eFACTION.Chaos]=global.name_generator.generate_space_marine_name(); -if (faction_leader[eFACTION.Chaos]=="2") then faction_leader[eFACTION.Chaos]=global.name_generator.generate_chaos_name(); +faction_gender[6] = choose(1, 2); +faction_gender[8] = choose(1, 1, 2); +if (faction_gender[4] == 2) { + faction_leader[eFACTION.Inquisition] = global.name_generator.generate_imperial_name(false); +} +faction_gender[10] = choose(1, 1, 1, 2, 2); +if (faction_gender[10] == 1) { + faction_leader[eFACTION.Chaos] = choose("1", "1", "1", "2"); +} +if (faction_gender[10] == 2) { + faction_leader[eFACTION.Chaos] = choose("1", "2", "2", "2"); +} +if (faction_leader[eFACTION.Chaos] == "1") { + faction_leader[eFACTION.Chaos] = global.name_generator.generate_space_marine_name(); +} +if (faction_leader[eFACTION.Chaos] == "2") { + faction_leader[eFACTION.Chaos] = global.name_generator.generate_chaos_name(); +} known = array_create(14, 0); -known[0]=2; -known[eFACTION.Player]=999; -known[eFACTION.Imperium]=1; -known[eFACTION.Mechanicus]=1; +known[0] = 2; +known[eFACTION.Player] = 999; +known[eFACTION.Imperium] = 1; +known[eFACTION.Mechanicus] = 1; // UI testing // known[eFACTION.Inquisition]=1;known[eFACTION.Ecclesiarchy]=1;known[eFACTION.Eldar]=1;known[eFACTION.Ork]=1;known[eFACTION.Tau]=1;known[eFACTION.Tyranids]=1;known[eFACTION.Chaos]=1; @@ -1009,146 +1123,145 @@ annoyed = array_create(14, 0); // ** Sets diplomacy ignore status ** ignore = array_create(14, 0); // ** Sets diplomacy turns to be ignored ** -turns_ignored[0]=0; -turns_ignored[1]=0; -turns_ignored[2]=0; -turns_ignored[3]=0; -turns_ignored[4]=0; -turns_ignored[5]=0; -turns_ignored[6]=0; -turns_ignored[7]=0; -turns_ignored[8]=0; -turns_ignored[9]=0; -turns_ignored[10]=0; -turns_ignored[11]=0; -turns_ignored[12]=0; -turns_ignored[13]=0; +turns_ignored[0] = 0; +turns_ignored[1] = 0; +turns_ignored[2] = 0; +turns_ignored[3] = 0; +turns_ignored[4] = 0; +turns_ignored[5] = 0; +turns_ignored[6] = 0; +turns_ignored[7] = 0; +turns_ignored[8] = 0; +turns_ignored[9] = 0; +turns_ignored[10] = 0; +turns_ignored[11] = 0; +turns_ignored[12] = 0; +turns_ignored[13] = 0; // ** Sets faction defeated ** -faction_defeated[0]=0; -faction_defeated[1]=0; -faction_defeated[2]=0; -faction_defeated[3]=0; -faction_defeated[4]=0; -faction_defeated[5]=0; -faction_defeated[6]=0; -faction_defeated[7]=0; -faction_defeated[8]=0; -faction_defeated[9]=0; -faction_defeated[10]=0; -faction_defeated[11]=0; -faction_defeated[12]=0; -faction_defeated[13]=0; +faction_defeated[0] = 0; +faction_defeated[1] = 0; +faction_defeated[2] = 0; +faction_defeated[3] = 0; +faction_defeated[4] = 0; +faction_defeated[5] = 0; +faction_defeated[6] = 0; +faction_defeated[7] = 0; +faction_defeated[8] = 0; +faction_defeated[9] = 0; +faction_defeated[10] = 0; +faction_defeated[11] = 0; +faction_defeated[12] = 0; +faction_defeated[13] = 0; // **** CHAPTER CREATION VARS **** // ** Sets up Chapter configuration variables ** -battle_cry="For the Emperor"; -fortress_name=""; -flagship_name=""; -home_name=""; -home_type=""; -recruiting_name=""; -recruiting_type=""; +battle_cry = "For the Emperor"; +fortress_name = ""; +flagship_name = ""; +home_name = ""; +home_type = ""; +recruiting_name = ""; +recruiting_type = ""; // ** Sets up chapter colors ** -main_color=0; -secondary_color=0; -main_trim=0; -left_pauldron=0; -right_pauldron=0; -lens_color=0; -weapon_color=0; -col_special=0; -trim=0; -// ** Sets up names, progenitor, successors and mutations ** -adept_name=""; -recruiter_name=""; -progenitor=ePROGENITOR.NONE; -successor_chapters=0; -mutation=""; +main_color = 0; +secondary_color = 0; +main_trim = 0; +left_pauldron = 0; +right_pauldron = 0; +lens_color = 0; +weapon_color = 0; +col_special = 0; +trim = 0; +// ** Sets up names, progenitor, successors and mutations ** +adept_name = ""; +recruiter_name = ""; +progenitor = ePROGENITOR.NONE; +successor_chapters = 0; +mutation = ""; // ** Sets up disposition among imperial factions ** -progenitor_disposition=0; -astartes_disposition=0; -astartes_max=0; -imperium_disposition=0; -imperium_max=0; -guard_disposition=0; -guard_max=0; -inquisition_disposition=0; -inquisition_max=0; -ecclesiarchy_disposition=0; -ecclesiarchy_max=0; -mechanicus_disposition=0; -mechanicus_max=0; -other1_disposition=0; -other1=""; +progenitor_disposition = 0; +astartes_disposition = 0; +astartes_max = 0; +imperium_disposition = 0; +imperium_max = 0; +guard_disposition = 0; +guard_max = 0; +inquisition_disposition = 0; +inquisition_max = 0; +ecclesiarchy_disposition = 0; +ecclesiarchy_max = 0; +mechanicus_disposition = 0; +mechanicus_max = 0; +other1_disposition = 0; +other1 = ""; // ** Sets up bonuses once chapter is created ** -if (instance_exists(obj_ini)){ +if (instance_exists(obj_ini)) { // General setup - if (global.load==-1){ + if (global.load == -1) { // Tolerant trait if (scr_has_disadv("Tolerant")) { - obj_controller.disposition[6]+=5; - obj_controller.disposition[7]+=5; - obj_controller.disposition[8]+=10; + obj_controller.disposition[6] += 5; + obj_controller.disposition[7] += 5; + obj_controller.disposition[8] += 10; } if (scr_has_adv("Enemy: Eldar")) { - faction_status[eFACTION.Eldar]="War"; + faction_status[eFACTION.Eldar] = "War"; } // Founding Chapter STC Bonuses here - if (global.chapter_name=="Salamanders"){ - stc_wargear=4; - stc_bonus[1]=3; - stc_bonus[2]=3; + if (global.chapter_name == "Salamanders") { + stc_wargear = 4; + stc_bonus[1] = 3; + stc_bonus[2] = 3; } - if (global.chapter_name=="Iron Hands"){ - stc_wargear=2; - stc_bonus[1]=5; - stc_vehicles=2; - stc_bonus[3]=3; + if (global.chapter_name == "Iron Hands") { + stc_wargear = 2; + stc_bonus[1] = 5; + stc_vehicles = 2; + stc_bonus[3] = 3; } - if (global.chapter_name=="Blood Ravens"){ - for(var i=0; i<3; i++){ - scr_add_artifact("random_nodemon","",0,obj_ini.ship[0],501); + if (global.chapter_name == "Blood Ravens") { + for (var i = 0; i < 3; i++) { + scr_add_artifact("random_nodemon", "", 0, obj_ini.ship[0], 501); } } // TODO should add special bonus to different chapters based on lore - adept_name=global.name_generator.generate_space_marine_name(); - recruiter_name=obj_ini.recruiter_name; - progenitor=obj_ini.progenitor; - successor_chapters=obj_ini.successors; - mutation=""; - main_color=obj_ini.main_color; - secondary_color=obj_ini.secondary_color; - main_trim=obj_ini.main_trim; - left_pauldron=obj_ini.left_pauldron; - right_pauldron=obj_ini.right_pauldron; - lens_color=obj_ini.lens_color; - weapon_color=obj_ini.weapon_color; - col_special=obj_ini.col_special; - trim=obj_ini.trim; - recruit_trial=obj_ini.recruit_trial; - homeworld_rule=obj_ini.homeworld_rule; - + adept_name = global.name_generator.generate_space_marine_name(); + recruiter_name = obj_ini.recruiter_name; + progenitor = obj_ini.progenitor; + successor_chapters = obj_ini.successors; + mutation = ""; + main_color = obj_ini.main_color; + secondary_color = obj_ini.secondary_color; + main_trim = obj_ini.main_trim; + left_pauldron = obj_ini.left_pauldron; + right_pauldron = obj_ini.right_pauldron; + lens_color = obj_ini.lens_color; + weapon_color = obj_ini.weapon_color; + col_special = obj_ini.col_special; + trim = obj_ini.trim; + recruit_trial = obj_ini.recruit_trial; + homeworld_rule = obj_ini.homeworld_rule; + scr_colors_initialize(); scr_shader_initialize(); - instance_create(-100,-100,obj_event_log); + instance_create(-100, -100, obj_event_log); log_message("New Game"); } } //Set player colour -try{ - global.star_name_colors[1] = make_color_rgb(body_colour_replace[0],body_colour_replace[1],body_colour_replace[2]); -} -catch(_exception){ - global.star_name_colors[1] = make_color_rgb(col_r[1],col_g[1],col_b[1]); +try { + global.star_name_colors[1] = make_color_rgb(body_colour_replace[0], body_colour_replace[1], body_colour_replace[2]); +} catch (_exception) { + global.star_name_colors[1] = make_color_rgb(col_r[1], col_g[1], col_b[1]); } -#region save/load serialization +#region save/load serialization -/// Called from save function to take all object variables and convert them to a json savable format and return it -serialize = function(){ +/// Called from save function to take all object variables and convert them to a json savable format and return it +serialize = function() { var object_controller = self; - + var save_data = { obj: object_get_name(object_index), x, @@ -1164,35 +1277,54 @@ serialize = function(){ loyalty, spec_train_data, forge_queue: specialist_point_handler.forge_queue, - chapter_master_data : chapter_master - - } - var excluded_from_save = ["temp", "serialize", "deserialize", "build_chaos_gods", "company_data","menu_buttons", - "location_viewer", "production_research_pathways", "specialist_point_handler", "spec_train_data", "tooltips", "last_unit", "unit_manage_constants", "unit_manage_image"]; + chapter_master_data: chapter_master, + }; + var excluded_from_save = [ + "temp", + "serialize", + "deserialize", + "build_chaos_gods", + "company_data", + "menu_buttons", + "location_viewer", + "production_research_pathways", + "specialist_point_handler", + "spec_train_data", + "tooltips", + "last_unit", + "unit_manage_constants", + "unit_manage_image" + ]; var excluded_from_save_start = ["restart_"]; copy_serializable_fields(object_controller, save_data, excluded_from_save, excluded_from_save_start); return save_data; -} +}; // Deserialization is done within scr_load #endregion // ** Loads the game ** -if (global.load>=0){ - load_game=global.load; - successor_chapters=0; - instance_create(0,0,obj_saveload); - with(obj_ini){instance_destroy();} - instance_create(0,0,obj_ini); +if (global.load >= 0) { + load_game = global.load; + successor_chapters = 0; + instance_create(0, 0, obj_saveload); + with (obj_ini) { + instance_destroy(); + } + instance_create(0, 0, obj_ini); // obj_saveload.menu=2; - obj_saveload.alarm[0]=1; - obj_saveload.load_part=1; - obj_cursor.image_alpha=0; + obj_saveload.alarm[0] = 1; + obj_saveload.load_part = 1; + obj_cursor.image_alpha = 0; scr_colors_initialize(); - if (global.restart==0) then log_message("Loading Game"); - if (global.restart>0) then log_message("Restarting Game"); + if (global.restart == 0) { + log_message("Loading Game"); + } + if (global.restart > 0) { + log_message("Restarting Game"); + } exit; } @@ -1205,102 +1337,156 @@ if (global.load>=0){ ///! ************************************************************ */ ///! ************************************************************ */ - - - -var xx,yy,me,dist,go,planet; -global.custom=eCHAPTER_TYPE.RANDOM; +var xx, yy, me, dist, go, planet; +global.custom = eCHAPTER_TYPE.RANDOM; // ** Sets up base training level and trainees at game start ** -training_apothecary=0; -apothecary_recruit_points=0; -apothecary_aspirant=0; -training_chaplain=0; -chaplain_points=0; -chaplain_aspirant=0; -training_psyker=0; -psyker_points=0; -psyker_aspirant=0; -training_techmarine=0; -tech_points=0; -tech_aspirant=0; -recruiting=0; -penitorium=0; +training_apothecary = 0; +apothecary_recruit_points = 0; +apothecary_aspirant = 0; +training_chaplain = 0; +chaplain_points = 0; +chaplain_aspirant = 0; +training_psyker = 0; +psyker_points = 0; +psyker_aspirant = 0; +training_techmarine = 0; +tech_points = 0; +tech_aspirant = 0; +recruiting = 0; +penitorium = 0; end_turn_insights = {}; spec_train_data = [ { - name : "Techmarine", - min_exp : 30, - coord_offset : [0, 0], - req : [["technology",34, "exmore"]] + name: "Techmarine", + min_exp: 30, + coord_offset: [ + 0, + 0 + ], + req: [ + [ + "technology", + 34, + "exmore" + ] + ], }, { - name : "Librarian", - min_exp : 0, - coord_offset : [0, -7], - req : [["psionic", 1, "exmore"]] + name: "Librarian", + min_exp: 0, + coord_offset: [ + 0, + -7 + ], + req: [ + [ + "psionic", + 1, + "exmore" + ] + ], }, { - name : "Chaplain", - min_exp : 60, - coord_offset : [7, -7], - req : [["piety", 34, "exmore"], ["charisma", 29, "exmore"]] + name: "Chaplain", + min_exp: 60, + coord_offset: [ + 7, + -7 + ], + req: [ + [ + "piety", + 34, + "exmore" + ], + [ + "charisma", + 29, + "exmore" + ] + ], }, { - name : "Apothecary", - min_exp : 60, - coord_offset : [7, 0], - req : [["technology", 29, "exmore"], ["intelligence",44, "exmore"]] - }, + name: "Apothecary", + min_exp: 60, + coord_offset: [ + 7, + 0 + ], + req: [ + [ + "technology", + 29, + "exmore" + ], + [ + "intelligence", + 44, + "exmore" + ] + ], + } ]; // Redefines training based on chapter -if (instance_exists(obj_ini)){ - if (scr_has_disadv("Psyker Intolerant")) then training_psyker=0; - if (global.chapter_name="Space Wolves") then training_chaplain=0; +if (instance_exists(obj_ini)) { + if (scr_has_disadv("Psyker Intolerant")) { + training_psyker = 0; + } + if (global.chapter_name == "Space Wolves") { + training_chaplain = 0; + } } // 0: none 1: management // 11: apothecary 12: chaplain 13: librarium 14: armamentarium // ** Sets the star for the chapter ? ** -instance_create(irandom_range(400,room_width-400),irandom_range(400,room_height-400),obj_star); -planet=floor(random(5))+19; -planet=30*1.5; -planet=100; +instance_create(irandom_range(400, room_width - 400), irandom_range(400, room_height - 400), obj_star); +planet = floor(random(5)) + 19; +planet = 30 * 1.5; +planet = 100; -if (is_test_map=true) then planet=20; +if (is_test_map == true) { + planet = 20; +} var xx, yy, nearest_star, repeats; -mask_index = spr_star -while(instance_number(obj_star) 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][16], techa)}"; -if (old_dudes > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][14], old_dudes)}"; -if (apotha > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][15], apotha)}"; -if (libra > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100,17], libra)}"; -if (coda > 0) then temp[njm] += $", {string_plural_count("Codiciery", coda)}"; -if (lexa > 0) then temp[njm] += $", {string_plural_count("Lexicanum", lexa)}."; +if (techa > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][16], techa)}"; +} +if (old_dudes > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][14], old_dudes)}"; +} +if (apotha > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][15], apotha)}"; +} +if (libra > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][17], libra)}"; +} +if (coda > 0) { + temp[njm] += $", {string_plural_count("Codiciery", coda)}"; +} +if (lexa > 0) { + temp[njm] += $", {string_plural_count("Lexicanum", lexa)}."; +} -vih=string_pos(",",temp[njm]); -temp[njm]=string_delete(temp[njm],vih,1); +vih = string_pos(",", temp[njm]); +temp[njm] = string_delete(temp[njm], vih, 1); -if (honoh>0) then temp[njm]+=$"\n\nHonour Guard, having the {honoh} most veteran {string_plural("marine", honoh)} of your chapter serving in it."; +if (honoh > 0) { + temp[njm] += $"\n\nHonour Guard, having the {honoh} most veteran {string_plural("marine", honoh)} of your chapter serving in it."; +} -for(var company=0; company<10; company++){ +for (var company = 0; company < 10; company++) { njm++; com++; - fisted=0; - techa=0; - termi=0; - veter=0; - capt=0; - chap=0; - apoth=0; - stand=0; - dread=0; - champ=0; - tact=0; - assa=0; - deva=0; - rhino=0; - speeder=0; - raider=0; - standard=0; - bike=0; - scou=0; - whirl=0; - pred=0; - lib=0; - serg=0; - vet_serg=0; - for(var mm=1; mm<=400; mm++){ - if (obj_ini.role[com,mm]==obj_ini.role[100][3]) then veter+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][4]) then termi+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][5]) then capt+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][6]) then dread+=1; - if (obj_ini.role[com,mm]=="Venerable "+string(obj_ini.role[100][6])) then dread+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][7]) then champ+=1; - - if (obj_ini.role[com,mm]==obj_ini.role[100][8]) then tact+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][9]) then deva+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][10]) then assa+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][11]) then standard+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][12]) then scou+=1; - - if (obj_ini.role[com,mm]==obj_ini.role[100][14]) then chap+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][15]) then apoth+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][16]) then techa+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][17]) then lib+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][18]) then serg+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][19]) then vet_serg+=1; - } - for(vih=1; vih<=100; vih++){ - if (obj_ini.veh_role[com,vih]=="Land Raider") then raider+=1; - if (obj_ini.veh_role[com,vih]=="Rhino") then rhino+=1; - if (obj_ini.veh_role[com,vih]=="Land Speeder") then speeder+=1; - if (obj_ini.veh_role[com,vih]=="Bike") then bike+=1; - if (obj_ini.veh_role[com,vih]=="Predator") then pred+=1; - if (obj_ini.veh_role[com,vih]=="Whirlwind") then whirl+=1; + fisted = 0; + techa = 0; + termi = 0; + veter = 0; + capt = 0; + chap = 0; + apoth = 0; + stand = 0; + dread = 0; + champ = 0; + tact = 0; + assa = 0; + deva = 0; + rhino = 0; + speeder = 0; + raider = 0; + standard = 0; + bike = 0; + scou = 0; + whirl = 0; + pred = 0; + lib = 0; + serg = 0; + vet_serg = 0; + for (var mm = 1; mm <= 400; mm++) { + if (obj_ini.role[com][mm] == obj_ini.role[100][3]) { + veter += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][4]) { + termi += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][5]) { + capt += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][6]) { + dread += 1; + } + if (obj_ini.role[com][mm] == "Venerable " + string(obj_ini.role[100][6])) { + dread += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][7]) { + champ += 1; + } + + if (obj_ini.role[com][mm] == obj_ini.role[100][8]) { + tact += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][9]) { + deva += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][10]) { + assa += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][11]) { + standard += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][12]) { + scou += 1; + } + + if (obj_ini.role[com][mm] == obj_ini.role[100][14]) { + chap += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][15]) { + apoth += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][16]) { + techa += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][17]) { + lib += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][18]) { + serg += 1; + } + if (obj_ini.role[com][mm] == obj_ini.role[100][19]) { + vet_serg += 1; + } } - - if (com > 0){ - if (veter+termi+stand+dread+tact+assa+deva+rhino+raider+standard+scou+whirl>0) then temp[njm]=$"{integer_to_words(com, true, true)} company made of"; - else{temp[njm]="";} + for (vih = 1; vih <= 100; vih++) { + if (obj_ini.veh_role[com][vih] == "Land Raider") { + raider += 1; + } + if (obj_ini.veh_role[com][vih] == "Rhino") { + rhino += 1; + } + if (obj_ini.veh_role[com][vih] == "Land Speeder") { + speeder += 1; + } + if (obj_ini.veh_role[com][vih] == "Bike") { + bike += 1; + } + if (obj_ini.veh_role[com][vih] == "Predator") { + pred += 1; + } + if (obj_ini.veh_role[com][vih] == "Whirlwind") { + whirl += 1; + } } - - if (capt > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][5], capt)}"; - if (chap > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][14], chap)}"; - if (apoth > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][15], apoth)}"; - if (techa > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][16], techa)}"; - if (standard > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][11], standard)}"; - if (champ > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][7], champ)}"; - if (lib > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][17], lib)}"; - - if (serg > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][18], serg)}"; - if (vet_serg > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][19], vet_serg)}"; - if (termi > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][4], termi)}"; - if (veter > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][3], veter)}"; - if (tact > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][8], tact)}"; - if (assa > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][10], assa)}"; - if (deva > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][9], deva)}"; - if (scou > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][12], scou)}"; - if (dread > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][6], dread)}"; - - if (raider > 0) then temp[njm] += $", {string_plural_count("Land Raider", raider)}"; - if (pred > 0) then temp[njm] += $", {string_plural_count("Predator", pred)}"; - if (whirl > 0) then temp[njm] += $", {string_plural_count("Whirlwind", whirl)}"; - if (rhino > 0) then temp[njm] += $", {string_plural_count("Rhino", rhino)}"; - if (speeder > 0) then temp[njm] += $", {string_plural_count("Land Speeder", speeder)}"; - if (bike > 0) then temp[njm] += $", {string_plural_count("Attack Bike", bike)}"; - - if (string_length(temp[njm])>0) then temp[njm]+="."; - - if (njm!=0){ - vih=string_pos(",",temp[njm]); - temp[njm]=string_delete(temp[njm],vih,1); + + if (com > 0) { + if (veter + termi + stand + dread + tact + assa + deva + rhino + raider + standard + scou + whirl > 0) { + temp[njm] = $"{integer_to_words(com, true, true)} company made of"; + } else { + temp[njm] = ""; + } + } + + if (capt > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][5], capt)}"; + } + if (chap > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][14], chap)}"; + } + if (apoth > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][15], apoth)}"; + } + if (techa > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][16], techa)}"; + } + if (standard > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][11], standard)}"; + } + if (champ > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][7], champ)}"; + } + if (lib > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][17], lib)}"; + } + + if (serg > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][18], serg)}"; + } + if (vet_serg > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][19], vet_serg)}"; + } + if (termi > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][4], termi)}"; + } + if (veter > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][3], veter)}"; + } + if (tact > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][8], tact)}"; + } + if (assa > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][10], assa)}"; + } + if (deva > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][9], deva)}"; + } + if (scou > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][12], scou)}"; + } + if (dread > 0) { + temp[njm] += $", {string_plural_count(obj_ini.role[100][6], dread)}"; + } + + if (raider > 0) { + temp[njm] += $", {string_plural_count("Land Raider", raider)}"; + } + if (pred > 0) { + temp[njm] += $", {string_plural_count("Predator", pred)}"; + } + if (whirl > 0) { + temp[njm] += $", {string_plural_count("Whirlwind", whirl)}"; + } + if (rhino > 0) { + temp[njm] += $", {string_plural_count("Rhino", rhino)}"; + } + if (speeder > 0) { + temp[njm] += $", {string_plural_count("Land Speeder", speeder)}"; + } + if (bike > 0) { + temp[njm] += $", {string_plural_count("Attack Bike", bike)}"; + } + + if (string_length(temp[njm]) > 0) { + temp[njm] += "."; + } + + if (njm != 0) { + vih = string_pos(",", temp[njm]); + temp[njm] = string_delete(temp[njm], vih, 1); } } @@ -1493,18 +1834,17 @@ temp[59] = $"CLASSIFICATION: SECTOR LOGISTICAE#++++++++++DATE: {temp[30]}#++++++ temp[60] = $"{temp[59]}\n\n{temp[34]}\n\n{temp[35]}##{temp[36]}##{temp[37]}##{temp[38]}##{temp[39]}##{temp[40]}##{temp[41]}##{temp[42]}##{temp[43]}##{temp[44]}##{temp[45]}"; - -temp[61]="\n\nYour armamentarium contains some spare equipment- \n"; +temp[61] = "\n\nYour armamentarium contains some spare equipment- \n"; temp[61] += equipment_struct_to_string(obj_ini.equipment, true, true); +temp[62] = "##Your fleet contains "; -temp[62]="##Your fleet contains "; - -var bb=0,sk=0,glad=0,hunt=0,ships=0,bb_names=[],sk_names=[],glad_names=[],hunt_names=[]; +var bb = 0, sk = 0, glad = 0, hunt = 0, ships = 0, bb_names = [], sk_names = [], glad_names = [], hunt_names = []; -codex[0]="";codex_discovered[0]=0; -for(var mm=0; mm 0) { temp[62] += "\n"; } - // show_message(temp[61]); // show_message(temp[62]); // 61 : equipment // 62 : ships -var lol=240; +var lol = 240; draw_set_font(fnt_small); -welcome_pages=string_height(string_hash_to_newline(string(temp[60])+string(temp[61])+string(temp[62]))); -welcome_pages-=260; -welcome_pages=(welcome_pages/lol)+1; +welcome_pages = string_height(string_hash_to_newline(string(temp[60]) + string(temp[61]) + string(temp[62]))); +welcome_pages -= 260; +welcome_pages = (welcome_pages / lol) + 1; -if (floor(welcome_pages)=1){ - for(var i=0; i<4000; i++){ - if (string_height(string_hash_to_newline(temp[65]))>260){ - lig=string_length(temp[65]); - temp[65]=string_delete(temp[65],lig,1); +if (welcome_pages >= 1) { + for (var i = 0; i < 4000; i++) { + if (string_height(string_hash_to_newline(temp[65])) > 260) { + lig = string_length(temp[65]); + temp[65] = string_delete(temp[65], lig, 1); } } } -remov=string_length(string(temp[65]))+1; - -if (welcome_pages>=2){ - temp[66]=string_delete(temp[66],1,remov); - for(var i=0; i<4000; i++){ - if (string_height(string_hash_to_newline(temp[66]))>lol){ - lig=string_length(temp[66]); - temp[66]=string_delete(temp[66],lig,1); +remov = string_length(string(temp[65])) + 1; + +if (welcome_pages >= 2) { + temp[66] = string_delete(temp[66], 1, remov); + for (var i = 0; i < 4000; i++) { + if (string_height(string_hash_to_newline(temp[66])) > lol) { + lig = string_length(temp[66]); + temp[66] = string_delete(temp[66], lig, 1); } } } -remov=string_length(string(temp[65])+string(temp[66]))+1; +remov = string_length(string(temp[65]) + string(temp[66])) + 1; // show_message(remov); -if (welcome_pages>=3){ - temp[67]=string_delete(temp[67],1,remov); - for(var i=0; i<4000; i++){ - if (string_height(string_hash_to_newline(temp[67]))>lol){ - lig=string_length(temp[67]); - temp[67]=string_delete(temp[67],lig,1); +if (welcome_pages >= 3) { + temp[67] = string_delete(temp[67], 1, remov); + for (var i = 0; i < 4000; i++) { + if (string_height(string_hash_to_newline(temp[67])) > lol) { + lig = string_length(temp[67]); + temp[67] = string_delete(temp[67], lig, 1); } } } -remov=string_length(string(temp[65])+string(temp[66])+string(temp[67]))+1; +remov = string_length(string(temp[65]) + string(temp[66]) + string(temp[67])) + 1; -if (welcome_pages<4) then temp[68]=""; -if (welcome_pages>=4){ - temp[68]=string_delete(temp[68],1,remov); - for(var i=0; i<4000; i++){ - if (string_height(string_hash_to_newline(temp[68]))>lol){ - lig=string_length(temp[68]); - temp[68]=string_delete(temp[68],lig,1); +if (welcome_pages < 4) { + temp[68] = ""; +} +if (welcome_pages >= 4) { + temp[68] = string_delete(temp[68], 1, remov); + for (var i = 0; i < 4000; i++) { + if (string_height(string_hash_to_newline(temp[68])) > lol) { + lig = string_length(temp[68]); + temp[68] = string_delete(temp[68], lig, 1); } } } -remov=string_length(string(temp[65])+string(temp[66])+string(temp[67])+string(temp[68]))+1; +remov = string_length(string(temp[65]) + string(temp[66]) + string(temp[67]) + string(temp[68])) + 1; -if (welcome_pages<5) then temp[69]=""; -if (welcome_pages>=5){ - temp[69]=string_delete(temp[69],1,remov); - for(var i=0; i<4000; i++){ - if (string_height(string_hash_to_newline(temp[69]))>lol){ - lig=string_length(temp[69]); - temp[69]=string_delete(temp[69],lig,1); +if (welcome_pages < 5) { + temp[69] = ""; +} +if (welcome_pages >= 5) { + temp[69] = string_delete(temp[69], 1, remov); + for (var i = 0; i < 4000; i++) { + if (string_height(string_hash_to_newline(temp[69])) > lol) { + lig = string_length(temp[69]); + temp[69] = string_delete(temp[69], lig, 1); } } } -remov=string_length(string(temp[65])+string(temp[66])+string(temp[67])+string(temp[68])+string(temp[69]))+1; +remov = string_length(string(temp[65]) + string(temp[66]) + string(temp[67]) + string(temp[68]) + string(temp[69])) + 1; -instance_create(0,0,obj_tooltip ); +instance_create(0, 0, obj_tooltip); action_set_alarm(2, 0); - -//**! DO NOT PUT THINGS AT THE BOTTOM OF THIS FILE IF YOU NEED THEM TO WORK AFTER LOADING FROM A SAVE, SEE LINE 1550 -ish */ \ No newline at end of file +//**! DO NOT PUT THINGS AT THE BOTTOM OF THIS FILE IF YOU NEED THEM TO WORK AFTER LOADING FROM A SAVE, SEE LINE 1550 -ish */ diff --git a/objects/obj_controller/Draw_0.gml b/objects/obj_controller/Draw_0.gml index c162cbd167..02cf79792e 100644 --- a/objects/obj_controller/Draw_0.gml +++ b/objects/obj_controller/Draw_0.gml @@ -1,41 +1,51 @@ - //TODO almost all of this can be handled in the gui layer -try{ +try { scr_ui_manage(); -} catch(_exception){ +} catch (_exception) { handle_exception(_exception); main_map_defaults(); } -try{ +try { scr_ui_advisors(); -} catch(_exception){ +} catch (_exception) { handle_exception(_exception); - main_map_defaults(); + main_map_defaults(); } - if (menu == MENU.Diplomacy){ - try{ - /*if (audience > 0 && instance_exists(obj_turn_end)){ +if (menu == MENU.Diplomacy) { + try { + /*if (audience > 0 && instance_exists(obj_turn_end)){ menu = 20; }*/ scr_ui_diplomacy(); - } catch(_exception){ - handle_exception(_exception); - main_map_defaults(); - } - } -try{ + } catch (_exception) { + handle_exception(_exception); + main_map_defaults(); + } +} +try { scr_ui_settings(); - scr_ui_popup(); -} catch(_exception){ + scr_ui_popup(); +} catch (_exception) { handle_exception(_exception); - main_map_defaults(); + main_map_defaults(); } //star fleet edbug options spawn -if (global.cheat_debug == true && mouse_check_button_pressed(mb_right)){ - if (!instances_exist_any([obj_turn_end,obj_ncombat,obj_fleet,obj_fleet_select,obj_popup,obj_star_select])){ - new_system_debug_popup(); +if (global.cheat_debug == true && mouse_check_button_pressed(mb_right)) { + if ( + !instances_exist_any( + [ + obj_turn_end, + obj_ncombat, + obj_fleet, + obj_fleet_select, + obj_popup, + obj_star_select + ] + ) + ) { + new_system_debug_popup(); } -} \ No newline at end of file +} diff --git a/objects/obj_controller/Draw_64.gml b/objects/obj_controller/Draw_64.gml index a690b128b8..429ebd5819 100644 --- a/objects/obj_controller/Draw_64.gml +++ b/objects/obj_controller/Draw_64.gml @@ -1,21 +1,31 @@ /// @description Insert description here // You can write your code in this editor // Draws the main UI menu. The function is used to highlight if you selected something in the menu -if instance_exists -var l_hei=37,l_why=0; - -if (instance_exists(obj_saveload)) then exit; -if (instance_exists(obj_ncombat)) then exit; -if (instance_exists(obj_fleet)) then exit; -if (global.load>=0) then exit; -if (invis==true) then exit; +if (instance_exists) { + var l_hei = 37, l_why = 0; +} +if (instance_exists(obj_saveload)) { + exit; +} +if (instance_exists(obj_ncombat)) { + exit; +} +if (instance_exists(obj_fleet)) { + exit; +} +if (global.load >= 0) { + exit; +} +if (invis == true) { + exit; +} add_draw_return_values(); -if (is_test_map==true){ +if (is_test_map == true) { draw_set_color(c_yellow); draw_set_alpha(0.5); - draw_line_width(room_width/2,room_height/2,(room_width/2)+lengthdir_x(3000,terra_direction),(room_height/2)+lengthdir_y(3000,terra_direction),4); + draw_line_width(room_width / 2, room_height / 2, (room_width / 2) + lengthdir_x(3000, terra_direction), (room_height / 2) + lengthdir_y(3000, terra_direction), 4); draw_set_alpha(1); } // if (instance_exists(obj_turn_end)) then exit; @@ -24,178 +34,211 @@ draw_set_valign(fa_top); draw_set_halign(fa_left); var xx = 0; var yy = 0; -if (menu == MENU.Diplomacy){ +if (menu == MENU.Diplomacy) { add_draw_return_values(); - if (diplomacy > 0){ + if (diplomacy > 0) { draw_diplomacy_diplo_text(); - if (trading==true){ - if ((diplomacy>1) && is_struct(trade_attempt)){ + if (trading == true) { + if ((diplomacy > 1) && is_struct(trade_attempt)) { try { trade_attempt.draw_trade_screen(); - } catch(_exception){ - handle_exception(_exception); - delete trade_attempt; - trading = false; - + } catch (_exception) { + handle_exception(_exception); + delete trade_attempt; + trading = false; } } - } else if (diplomacy!=10.1){ - draw_character_diplomacy_base_page() + } else if (diplomacy != 10.1) { + draw_character_diplomacy_base_page(); } - } else if (diplomacy == -1){ - if (is_struct(character_diplomacy)){ + } else if (diplomacy == -1) { + if (is_struct(character_diplomacy)) { draw_character_diplomacy(); } } pop_draw_return_values(); } // Main UI -if (!zoomed && !zui){ +if (!zoomed && !zui) { add_draw_return_values(); - if (menu == MENU.Default){ + if (menu == MENU.Default) { location_viewer.draw(); - helpful_places_button.update({x1 : 1451,y1:62+sprite_get_height(spr_new_banner)}); - - if (helpful_places_button.draw()){ + helpful_places_button + .update({ + x1: 1451, + y1: 62 + sprite_get_height(spr_new_banner), + }); - if (helpful_places == false){ + if (helpful_places_button.draw()) { + if (helpful_places == false) { helpful_places = new HelpfulPlaces(); - } else{ + } else { helpful_places = false; } } - if (helpful_places != false){ - if (!instances_exist_any([obj_turn_end,obj_ncombat,obj_fleet,obj_fleet_select,obj_popup,obj_star_select])){ + if (helpful_places != false) { + if ( + !instances_exist_any( + [ + obj_turn_end, + obj_ncombat, + obj_fleet, + obj_fleet_select, + obj_popup, + obj_star_select + ] + ) + ) { helpful_places.draw(); } } } - draw_sprite(spr_new_ui,menu==0,0,0); + draw_sprite(spr_new_ui, menu == 0, 0, 0); draw_set_color(c_white); - if (!instance_exists(obj_popup)){ - menu_buttons.chapter_manage.draw(34,838+y_slide, "Chapter Management",1,1,145) - menu_buttons.chapter_settings.draw(179,838+y_slide, "Chapter Settings",1,1,145) - menu_buttons.apoth.draw(357,838+y_slide, "Apothecarium") - menu_buttons.reclu.draw(473,838+y_slide, "Reclusium") - menu_buttons.lib.draw(590,838+y_slide, "Librarium") - menu_buttons.arm.draw(706,838+y_slide, "Armamentarium") - menu_buttons.recruit.draw(822,838+y_slide, "Recruitment") - menu_buttons.fleet.draw(938,838+y_slide, "Fleet") - menu_buttons.diplo.draw(1130,838+y_slide, "Diplomacy",1,1,145) - menu_buttons.event.draw(1275,838+y_slide, "Event Log",1,1,145) - menu_buttons.end_turn.draw(1420,838+y_slide, "End Turn",1,1,145); - menu_buttons.help.draw(1374,8+y_slide, "Help"); - menu_buttons.menu.draw(1484,8+y_slide, "Menu"); + if (!instance_exists(obj_popup)) { + menu_buttons.chapter_manage.draw(34, 838 + y_slide, "Chapter Management", 1, 1, 145); + menu_buttons.chapter_settings.draw(179, 838 + y_slide, "Chapter Settings", 1, 1, 145); + menu_buttons.apoth.draw(357, 838 + y_slide, "Apothecarium"); + menu_buttons.reclu.draw(473, 838 + y_slide, "Reclusium"); + menu_buttons.lib.draw(590, 838 + y_slide, "Librarium"); + menu_buttons.arm.draw(706, 838 + y_slide, "Armamentarium"); + menu_buttons.recruit.draw(822, 838 + y_slide, "Recruitment"); + menu_buttons.fleet.draw(938, 838 + y_slide, "Fleet"); + menu_buttons.diplo.draw(1130, 838 + y_slide, "Diplomacy", 1, 1, 145); + menu_buttons.event.draw(1275, 838 + y_slide, "Event Log", 1, 1, 145); + menu_buttons.end_turn.draw(1420, 838 + y_slide, "End Turn", 1, 1, 145); + menu_buttons.help.draw(1374, 8 + y_slide, "Help"); + menu_buttons.menu.draw(1484, 8 + y_slide, "Menu"); + } + + if (y_slide > 0) { + draw_set_alpha((100 - (y_slide * 2)) / 100); } - - - if (y_slide>0) then draw_set_alpha((100-(y_slide*2))/100); draw_set_alpha(1); - draw_sprite(spr_new_banner,0,1439+new_banner_x,62); - draw_sprite(spr_new_ui_cover,0,0,(900-17)); - - var sprx = 1451+new_banner_x, - spry = 73, - sprw = 141, - sprh = 141; - - if (sprite_exists(global.chapter_icon.sprite)){ + draw_sprite(spr_new_banner, 0, 1439 + new_banner_x, 62); + draw_sprite(spr_new_ui_cover, 0, 0, (900 - 17)); + + var sprx = 1451 + new_banner_x, spry = 73, sprw = 141, sprh = 141; + + if (sprite_exists(global.chapter_icon.sprite)) { draw_sprite_stretched(global.chapter_icon.sprite, 0, sprx, spry, sprw, sprh); } - - + draw_set_color(CM_GREEN_COLOR); draw_set_font(fnt_menu); draw_set_halign(fa_center); draw_set_valign(fa_top); // Draws the sector name var _sector_string = $"Sector {obj_ini.sector_name ?? "Terra Nova"}"; - draw_text(775,17,_sector_string); - draw_text(775.5,17.5,_sector_string); - + draw_text(775, 17, _sector_string); + draw_text(775.5, 17.5, _sector_string); + // Checks if you are penitent - if (obj_controller.faction_status[eFACTION.Imperium]!="War"){ - if (penitent_max==0){ - draw_text(998,17,string_hash_to_newline("Loyal")); - draw_text(998,17.5,string_hash_to_newline("Loyal")); + if (obj_controller.faction_status[eFACTION.Imperium] != "War") { + if (penitent_max == 0) { + draw_text(998, 17, string_hash_to_newline("Loyal")); + draw_text(998, 17.5, string_hash_to_newline("Loyal")); } - if (penitent_max>0){ - var endb=0,endb2=""; - endb=min(0,(((penitent_turn+1)*(penitent_turn+1))-120)*-1); - if (endb<0) then endb2=" "+string(endb); + if (penitent_max > 0) { + var endb = 0, endb2 = ""; + endb = min(0, (((penitent_turn + 1) * (penitent_turn + 1)) - 120) * -1); + if (endb < 0) { + endb2 = " " + string(endb); + } draw_set_color(c_red); - draw_text(998,17,string_hash_to_newline(string(min(100,floor((penitent_current/penitent_max)*100)))+"% Penitent")); - draw_text(998,17.5,string_hash_to_newline(string(min(100,floor((penitent_current/penitent_max)*100)))+"% Penitent")); + draw_text(998, 17, string_hash_to_newline(string(min(100, floor((penitent_current / penitent_max) * 100))) + "% Penitent")); + draw_text(998, 17.5, string_hash_to_newline(string(min(100, floor((penitent_current / penitent_max) * 100))) + "% Penitent")); draw_set_color(CM_GREEN_COLOR); // TODO Need a tooltip for here to display the actual amounts } } // Sets you to renegade - if (obj_controller.faction_status[eFACTION.Imperium]=="War"){ + if (obj_controller.faction_status[eFACTION.Imperium] == "War") { draw_set_color(255); - draw_text(998,17,string_hash_to_newline("Renegade")); - draw_text(998,17.5,string_hash_to_newline("Renegade")); + draw_text(998, 17, string_hash_to_newline("Renegade")); + draw_text(998, 17.5, string_hash_to_newline("Renegade")); draw_set_color(CM_GREEN_COLOR); } - if (menu==0){ - if (obj_controller.imp_ships == 0 && obj_controller.turn<2){ + if (menu == 0) { + if (obj_controller.imp_ships == 0 && obj_controller.turn < 2) { sector_imperial_fleet_strength(); } draw_text(850, 60, $"Sector Fleet Strength {imp_ships}/{max_fleet_strength}"); - if (scr_hit([700, 60, 1000, 80])){ - tooltip_draw("The relative strength of the imperial navy and defence fleet forces and their max supported strength. Increase The number of imperial aligned planets and active forge worlds to increase the limit") + if ( + scr_hit( + [ + 700, + 60, + 1000, + 80 + ] + ) + ) { + tooltip_draw("The relative strength of the imperial navy and defence fleet forces and their max supported strength. Increase The number of imperial aligned planets and active forge worlds to increase the limit"); + } + } // Checks if the chapter name is less than 140 chars, adjusts chapter_master_name_width accordingly + var chapter_master_name_width = 1; + for (var i = 0; i < 10; i++) { + if ((string_width(string_hash_to_newline(string(global.chapter_name))) * chapter_master_name_width) > 140) { + chapter_master_name_width -= 0.1; } - } // Checks if the chapter name is less than 140 chars, adjusts chapter_master_name_width accordingly - var chapter_master_name_width=1; - for(var i=0; i<10; i++){ - if ((string_width(string_hash_to_newline(string(global.chapter_name)))*chapter_master_name_width)>140) then chapter_master_name_width-=0.1; } - draw_text_transformed(1520+new_banner_x,208,string_hash_to_newline(string(global.chapter_name)),chapter_master_name_width,1,0); - draw_text_transformed(1520.5+new_banner_x,208.5,string_hash_to_newline(string(global.chapter_name)),chapter_master_name_width,1,0); + draw_text_transformed(1520 + new_banner_x, 208, string_hash_to_newline(string(global.chapter_name)), chapter_master_name_width, 1, 0); + draw_text_transformed(1520.5 + new_banner_x, 208.5, string_hash_to_newline(string(global.chapter_name)), chapter_master_name_width, 1, 0); // Shows the date to be displayed - var yf=""; - if (year_fraction<10) then yf="00"+string(year_fraction); - if (year_fraction>=10) and (year_fraction<100) then yf="0"+string(year_fraction); - if (year_fraction>=100) then yf=string(year_fraction); - draw_text(1520+new_banner_x,228,string_hash_to_newline(string(check_number)+" "+string(yf)+" "+string(year)+".M"+string(millenium))); + var yf = ""; + if (year_fraction < 10) { + yf = "00" + string(year_fraction); + } + if ((year_fraction >= 10) && (year_fraction < 100)) { + yf = "0" + string(year_fraction); + } + if (year_fraction >= 100) { + yf = string(year_fraction); + } + draw_text(1520 + new_banner_x, 228, string_hash_to_newline(string(check_number) + " " + string(yf) + " " + string(year) + ".M" + string(millenium))); // Shows the income on the menu - var inc=""; - if (income_last>0) then inc="+"+string(round(income_last)); - if (income_last<0) then inc=string(round(income_last)); + var inc = ""; + if (income_last > 0) { + inc = "+" + string(round(income_last)); + } + if (income_last < 0) { + inc = string(round(income_last)); + } draw_set_font(fnt_40k_14); draw_set_halign(fa_left); // Draws the requisition amount - draw_sprite(spr_new_resource,0,14,16); + draw_sprite(spr_new_resource, 0, 14, 16); draw_set_color(16291875); - draw_text(36,16,string_hash_to_newline(string(floor(requisition))+string(inc))); - draw_text(36.5,16.5,string_hash_to_newline(string(floor(requisition))+string(inc))); + draw_text(36, 16, string_hash_to_newline(string(floor(requisition)) + string(inc))); + draw_text(36.5, 16.5, string_hash_to_newline(string(floor(requisition)) + string(inc))); // Draws forge points - draw_sprite_ext(spr_forge_points_icon, 0, 160, 15, 0.3, 0.3, 0, c_white, 1) - draw_set_color(#af5a00) - draw_text(180,16, string(forge_points)); - draw_text(180.5,16.5, string(forge_points)); + draw_sprite_ext(spr_forge_points_icon, 0, 160, 15, 0.3, 0.3, 0, c_white, 1); + draw_set_color(#af5a00); + draw_text(180, 16, string(forge_points)); + draw_text(180.5, 16.5, string(forge_points)); // Draws apothecary points - var _apoth_string = ($"apothecary points : {specialist_point_handler.apothecary_points}"); - draw_text(180,32, _apoth_string); - draw_text(180.5,32.5, _apoth_string); + var _apoth_string = $"apothecary points : {specialist_point_handler.apothecary_points}"; + draw_text(180, 32, _apoth_string); + draw_text(180.5, 32.5, _apoth_string); // Draws the current loyalty - draw_sprite(spr_new_resource,1,267,17); + draw_sprite(spr_new_resource, 1, 267, 17); draw_set_color(1164001); - draw_text(290,16,string_hash_to_newline(string(loyalty))); - draw_text(290.5,16.5,string_hash_to_newline(string(loyalty))); + draw_text(290, 16, string_hash_to_newline(string(loyalty))); + draw_text(290.5, 16.5, string_hash_to_newline(string(loyalty))); // Draws the current gene seed - draw_sprite(spr_new_resource,2,355,17); + draw_sprite(spr_new_resource, 2, 355, 17); draw_set_color(c_red); - draw_text(370,16,string_hash_to_newline(string(gene_seed))); - draw_text(370.5,16.5,string_hash_to_newline(string(gene_seed))); + draw_text(370, 16, string_hash_to_newline(string(gene_seed))); + draw_text(370.5, 16.5, string_hash_to_newline(string(gene_seed))); // Draws the current marines in your command - draw_sprite(spr_new_resource,3,475-10,17); + draw_sprite(spr_new_resource, 3, 475 - 10, 17); draw_set_color(16291875); - draw_text(495-10,16,string(marines)+"/"+string(command)); - draw_text(495.5-10,16.5,string(marines)+"/"+string(command)); + draw_text(495 - 10, 16, string(marines) + "/" + string(command)); + draw_text(495.5 - 10, 16.5, string(marines) + "/" + string(command)); pop_draw_return_values(); } draw_set_font(fnt_40k_14b); @@ -203,7 +246,7 @@ draw_set_color(c_red); draw_set_halign(fa_left); draw_set_alpha(1); // Sets up debut mode -if (global.cheat_debug == true){ +if (global.cheat_debug == true) { draw_text(1124, 7, "DEBUG MODE"); } @@ -221,31 +264,25 @@ function draw_line(x1, y1, y_slide, variable) { } } - -try{ +try { if (menu == MENU.Manage) { - if (managing != 0){ + if (managing != 0) { draw_sprite_and_unit_equip_data(); } - if (managing == -1){ + if (managing == -1) { scr_manage_task_selector(); } - if (managing > 0){ + if (managing > 0) { company_specific_management(); } - } else if (menu == MENU.Armamentarium) { scr_draw_armentarium_gui(); - } else if (menu == MENU.Librarium){ + } else if (menu == MENU.Librarium) { scr_librarium_gui(); } -} catch(_exception){ +} catch (_exception) { handle_exception(_exception); menu = MENU.Default; } - pop_draw_return_values(); - - - diff --git a/objects/obj_controller/KeyPress_13.gml b/objects/obj_controller/KeyPress_13.gml index 43c48a9719..f308c78a21 100644 --- a/objects/obj_controller/KeyPress_13.gml +++ b/objects/obj_controller/KeyPress_13.gml @@ -1,4 +1,3 @@ - /*var onceh;onceh=0; if (new_buttons_hide=0) and (onceh=0){onceh=1;new_buttons_hide=1;} if (new_buttons_hide=1) and (onceh=0){onceh=1;new_buttons_hide=0;} diff --git a/objects/obj_controller/KeyPress_32.gml b/objects/obj_controller/KeyPress_32.gml index 5381787553..bfe2d78973 100644 --- a/objects/obj_controller/KeyPress_32.gml +++ b/objects/obj_controller/KeyPress_32.gml @@ -1,13 +1,15 @@ // Manages zoom level var __b__ = action_if_number(obj_ncombat, 0, 0); -if (__b__){ +if (__b__) { __b__ = action_if_number(obj_popup, 0, 0); - if (__b__){ + if (__b__) { __b__ = action_if_variable(cooldown, 500, 1); - if (__b__){ - if (obj_controller.menu==0 && !instance_exists(obj_popup_dialogue)) or ((obj_controller.menu==999) and (instance_exists(obj_ncombat))){ - if (instance_exists(obj_ncombat)){ - if (obj_ncombat.start==7) then exit; + if (__b__) { + if ((obj_controller.menu == 0 && !instance_exists(obj_popup_dialogue)) || ((obj_controller.menu == 999) && instance_exists(obj_ncombat))) { + if (instance_exists(obj_ncombat)) { + if (obj_ncombat.start == 7) { + exit; + } } scr_zoom(); } diff --git a/objects/obj_controller/KeyPress_73.gml b/objects/obj_controller/KeyPress_73.gml index c5aceeb6cc..876a6afc51 100644 --- a/objects/obj_controller/KeyPress_73.gml +++ b/objects/obj_controller/KeyPress_73.gml @@ -1,4 +1,3 @@ - /*var onceh;onceh=0; if (audio_is_playing(snd_royal)=true) then scr_music("blood",2000); if (audio_is_playing(snd_blood)=true) then scr_music("royal",2000); @@ -8,11 +7,8 @@ if (audio_is_playing(snd_blood)=true) then scr_music("royal",2000); scr_dialogue("lol"); */ - - // alarm[7]=1; - /*with(obj_star){ var balh;balh=0; if (string_count("WL10",p_feature[1])>0) then balh=1; @@ -24,7 +20,6 @@ scr_dialogue("lol"); // loyalty=0;loyalty_hidden=0; - // show_message(string(obj_ini.ship[0])+" location: "+string(obj_ini.ship_location[0])); // alarm[8]=1; @@ -32,12 +27,9 @@ scr_dialogue("lol"); // menu=20; // diplomacy=-5.3; - - // show_message(cooldown); // instance_activate_object(obj_enunit); - /* */ /* */ diff --git a/objects/obj_controller/KeyPress_80.gml b/objects/obj_controller/KeyPress_80.gml index 6a04698217..13fcc4ba30 100644 --- a/objects/obj_controller/KeyPress_80.gml +++ b/objects/obj_controller/KeyPress_80.gml @@ -1,5 +1,5 @@ -if (menu == false && managing == false && formating == false) -{ - if (!instance_number(obj_saveload) && !instance_number(obj_credits)&& !instance_number(obj_popup_dialogue)&& !instance_number(obj_star_select)) +if (menu == false && managing == false && formating == false) { + if (!instance_number(obj_saveload) && !instance_number(obj_credits) && !instance_number(obj_popup_dialogue) && !instance_number(obj_star_select)) { get_diag_string("Enter a cheatcode", "controller", "controller", 1); + } } diff --git a/objects/obj_controller/Keyboard_84.gml b/objects/obj_controller/Keyboard_84.gml index cedd5ce3aa..0b10fb9fa9 100644 --- a/objects/obj_controller/Keyboard_84.gml +++ b/objects/obj_controller/Keyboard_84.gml @@ -1,5 +1,4 @@ // Fleet movement on turn end -if (action_if_number(obj_saveload, 0, 0) && (action_if_number(obj_fleet, 0, 0)) && (action_if_number(obj_ncombat, 0, 0)) -&& (action_if_variable(menu, 0, 0)) && (action_if_variable(managing, 0, 0))){ - scr_end_turn() +if (action_if_number(obj_saveload, 0, 0) && action_if_number(obj_fleet, 0, 0) && action_if_number(obj_ncombat, 0, 0) && action_if_variable(menu, 0, 0) && action_if_variable(managing, 0, 0)) { + scr_end_turn(); } diff --git a/objects/obj_controller/Mouse_50.gml b/objects/obj_controller/Mouse_50.gml index a373429b3c..874218a7e2 100644 --- a/objects/obj_controller/Mouse_50.gml +++ b/objects/obj_controller/Mouse_50.gml @@ -1,82 +1,82 @@ // This script handles left click interactions throught the main menus of the game var xx, yy; -xx=__view_get( e__VW.XView, 0 ); -yy=__view_get( e__VW.YView, 0 ); +xx = __view_get(e__VW.XView, 0); +yy = __view_get(e__VW.YView, 0); -if (trading>0) and (force_goodbye!=0) then trading=0; +if ((trading > 0) && (force_goodbye != 0)) { + trading = 0; +} // ** Reclusium Jail Marines** -if (menu==12) and (cooldown<=0) and (penitorium>0){ - var behav=0,r_eta=0,re=0; - for(var qp=1; qp<=min(36,penitorium); qp++){ - if (qp<=penitorium) and (mouse_y>=yy+100+((qp-1)*20)) and (mouse_y=xx+1433) and (mouse_x 0)) { + var behav = 0, r_eta = 0, re = 0; + for (var qp = 1; qp <= min(36, penitorium); qp++) { + if ((qp <= penitorium) && (mouse_y >= yy + 100 + ((qp - 1) * 20)) && (mouse_y < yy + 100 + (qp * 20))) { + if ((mouse_x >= xx + 1433) && (mouse_x < xx + 1497)) { + cooldown = 20; + var c = penit_co[qp], e = penit_id[qp]; - if (obj_ini.role[c,e]==obj_ini.role[100][eROLE.ChapterMaster]){ - tek="c"; - alarm[7]=5; - global.defeat=3; + if (obj_ini.role[c][e] == obj_ini.role[100][eROLE.ChapterMaster]) { + tek = "c"; + alarm[7] = 5; + global.defeat = 3; } // TODO Needs to be based on role - kill_and_recover(c,e); - diplo_char=c; - with(obj_ini){ + kill_and_recover(c, e); + diplo_char = c; + with (obj_ini) { scr_company_order(obj_controller.diplo_char); } - re=1; - diplo_char=0; + re = 1; + diplo_char = 0; } - if (mouse_x>=xx+1508) and (mouse_x= xx + 1508) && (mouse_x < xx + 1567)) { + cooldown = 20; + var c = penit_co[qp], e = penit_id[qp]; + obj_ini.god[c][e] -= 10; + re = 1; } } } - if (re==1){ - for(var g=1; g<=100; g++){ - penit_co[g]=0; - penit_id[g]=0; + if (re == 1) { + for (var g = 1; g <= 100; g++) { + penit_co[g] = 0; + penit_id[g] = 0; } - penitorium=0; - var p=0; - for (var c = 0; c < 11; c++){ - for (var e = 0; e < array_length(obj_ini.god[c]); e++){ - if (obj_ini.god[c,e] == 10){ - p+=1; - penit_co[p]=c; - penit_id[p]=e; - penitorium+=1; + penitorium = 0; + var p = 0; + for (var c = 0; c < 11; c++) { + for (var e = 0; e < array_length(obj_ini.god[c]); e++) { + if (obj_ini.god[c][e] == 10) { + p += 1; + penit_co[p] = c; + penit_id[p] = e; + penitorium += 1; } } } } -} - -// ** Recruitement ** -else if (menu==15) and (cooldown<=0){ - if (mouse_x>=xx+748) and (mouse_x=yy+355) and (mouse_y0) and (obj_ini.doomed==0) and (penitent==0){ - cooldown=8000; - recruiting+=1; +} else // ** Recruitement ** +if ((menu == 15) && (cooldown <= 0)) { + if ((mouse_x >= xx + 748) && (mouse_x < xx + 772)) { + if ((mouse_y >= yy + 355) && (mouse_y < yy + 373) && (recruiting < 1) && (gene_seed > 0) && (obj_ini.doomed == 0) && (penitent == 0)) { + cooldown = 8000; + recruiting += 1; scr_income(); } - if (mouse_y>=yy+395) and (mouse_y= yy + 395) && (mouse_y < yy + 413) && (training_apothecary < 6)) { + cooldown = 8000; + training_apothecary += 1; scr_income(); } - if (mouse_y>=yy+415) and (mouse_y= yy + 415) && (mouse_y < yy + 433) && (training_chaplain < 6) && (global.chapter_name != "Space Wolves") && (global.chapter_name != "Iron Hands")) { + cooldown = 8000; + training_chaplain += 1; scr_income(); } - if (mouse_y>=yy+435) and (mouse_y= yy + 435) && (mouse_y < yy + 452) && (training_psyker < 6) && (!scr_has_disadv("Psyker Intolerant"))) { + cooldown = 8000; + training_psyker += 1; scr_income(); } if ((mouse_y >= yy + 455) && (mouse_y < yy + 473) && (training_techmarine < 6)) { @@ -96,46 +96,50 @@ else if (menu==15) and (cooldown<=0){ } } } - if (mouse_x>=xx+726) and (mouse_x=yy+355) and (mouse_y0){ - cooldown=8000; - recruiting-=1; + if ((mouse_x >= xx + 726) && (mouse_x < xx + 745)) { + if ((mouse_y >= yy + 355) && (mouse_y < yy + 373) && (recruiting > 0)) { + cooldown = 8000; + recruiting -= 1; scr_income(); } - if (mouse_y>=yy+395) and (mouse_y0){ - cooldown=8000; - training_apothecary-=1; + if ((mouse_y >= yy + 395) && (mouse_y < yy + 413) && (training_apothecary > 0)) { + cooldown = 8000; + training_apothecary -= 1; scr_income(); } - if (mouse_y>=yy+415) and (mouse_y0){ - cooldown=8000; - training_chaplain-=1; + if ((mouse_y >= yy + 415) && (mouse_y < yy + 433) && (training_chaplain > 0)) { + cooldown = 8000; + training_chaplain -= 1; scr_income(); } - if (mouse_y>=yy+435) and (mouse_y0){ - cooldown=8000; - training_psyker-=1; + if ((mouse_y >= yy + 435) && (mouse_y < yy + 452) && (training_psyker > 0)) { + cooldown = 8000; + training_psyker -= 1; scr_income(); } - if (mouse_y>=yy+455) and (mouse_y0){ - cooldown=8000; - training_techmarine-=1; + if ((mouse_y >= yy + 455) && (mouse_y < yy + 473) && (training_techmarine > 0)) { + cooldown = 8000; + training_techmarine -= 1; scr_income(); } } // Change trial type - if (mouse_y>=yy+518) and (mouse_y<=yy+542){ - var onceh=0; - if (mouse_x>=xx+713) and (mouse_x<=xx+752){ - cooldown=8000; + if ((mouse_y >= yy + 518) && (mouse_y <= yy + 542)) { + var onceh = 0; + if ((mouse_x >= xx + 713) && (mouse_x <= xx + 752)) { + cooldown = 8000; recruit_trial++; - if (recruit_trial==eTrials.num) then recruit_trial=0; + if (recruit_trial == eTrials.num) { + recruit_trial = 0; + } } - if (mouse_x>=xx+492) and (mouse_x<=xx+528){ - cooldown=8000; + if ((mouse_x >= xx + 492) && (mouse_x <= xx + 528)) { + cooldown = 8000; recruit_trial--; - if (recruit_trial<0) then recruit_trial=eTrials.num-1; + if (recruit_trial < 0) { + recruit_trial = eTrials.num - 1; + } } } } @@ -167,26 +171,26 @@ else if (menu==15) and (cooldown<=0){ } } */ - // ** Diplomacy ** -if (menu==MENU.Diplomacy) and (diplomacy>0) or ((diplomacy<-5) and (diplomacy>-6)) and (cooldown<=0) and (diplomacy<10){ - if (trading==0) and (valid_diplomacy_options()){ - if (force_goodbye==0) and (cooldown<=0){ - - } - if (force_goodbye!=0) and (cooldown<=0){// Want to check to see if the deal went fine here - if (trading_artifact!=0){ - click2=1; +if ((menu == MENU.Diplomacy) && (diplomacy > 0) || ((diplomacy < -5) && (diplomacy > -6)) && (cooldown <= 0) && (diplomacy < 10)) { + if ((trading == 0) && valid_diplomacy_options()) { + if ((force_goodbye == 0) && (cooldown <= 0)) {} + if ((force_goodbye != 0) && (cooldown <= 0)) { + // Want to check to see if the deal went fine here + if (trading_artifact != 0) { + click2 = 1; clear_diplo_choices(); - diplomacy=0; - menu=0; - force_goodbye=0; - with(obj_popup){instance_destroy();} - if (trading_artifact!=2){ - obj_ground_mission.alarm[1]=1; + diplomacy = 0; + menu = 0; + force_goodbye = 0; + with (obj_popup) { + instance_destroy(); + } + if (trading_artifact != 2) { + obj_ground_mission.alarm[1] = 1; } - if (trading_artifact == 2 && instance_exists(obj_ground_mission)){ - with (obj_ground_mission){ + if (trading_artifact == 2 && instance_exists(obj_ground_mission)) { + with (obj_ground_mission) { recieve_artifact_in_discussion(); } } @@ -196,79 +200,78 @@ if (menu==MENU.Diplomacy) and (diplomacy>0) or ((diplomacy<-5) and (diplomacy>-6 } } // Diplomacy -if (zoomed==0) and (cooldown<=0) and (menu==MENU.Diplomacy) and (diplomacy==0){ - xx+=55; - yy-=20; - var onceh=0 - // Daemon emmissary - if (point_in_rectangle(mouse_x, mouse_y, xx+688,yy+181,xx+1028,yy+281)){ - diplomacy=10.1; - diplomacy_pathway="intro"; +if ((zoomed == 0) && (cooldown <= 0) && (menu == MENU.Diplomacy) && (diplomacy == 0)) { + xx += 55; + yy -= 20; + var onceh = 0; + // Daemon emmissary + if (point_in_rectangle(mouse_x, mouse_y, xx + 688, yy + 181, xx + 1028, yy + 281)) { + diplomacy = 10.1; + diplomacy_pathway = "intro"; scr_dialogue(diplomacy_pathway); - onceh=1; + onceh = 1; cooldown = 1; - } + } } +// End Turn +scr_menu_clear_up(function() { + if ((zoomed == 0) && (menu == 40) && (cooldown <= 0)) { + xx = xx + 0; + yy = yy + 0; - // End Turn -scr_menu_clear_up(function(){ - if (zoomed==0) and (menu==40) and (cooldown<=0){ - xx=xx+0; - yy=yy+0; - - if (mouse_x>=xx+73) and (mouse_y>=yy+69) and (mouse_x= xx + 73) && (mouse_y >= yy + 69) && (mouse_x < xx + 305) && (mouse_y < yy + 415)) { + menu = 41; + cooldown = 8000; } - if (mouse_x>=xx+336) and (mouse_y>=yy+69) and (mouse_x= xx + 336) && (mouse_y >= yy + 69) && (mouse_x < xx + 568) && (mouse_y < yy + 415)) { + menu = 42; + cooldown = 8000; } } // This is the back button at LOADING TO SHIPS - if (zoomed==0) and (menu==30) and (managing>0||managing==-1) and (cooldown<=0){ - xx=xx+0; - yy=yy+0; + if ((zoomed == 0) && (menu == 30) && (managing > 0 || managing == -1) && (cooldown <= 0)) { + xx = xx + 0; + yy = yy + 0; - if (mouse_x>=xx+22) and (mouse_y>=yy+84) and (mouse_x= xx + 22) && (mouse_y >= yy + 84) && (mouse_x < xx + 98) && (mouse_y < yy + 126)) { + menu = MENU.Manage; + cooldown = 8000; } } // Selecting individual marines - if (menu=MENU.Manage) and (managing>0) || (managing<0) and (!view_squad || !company_report){ - var unit; - var eventing=false, bb=""; - xx=__view_get( e__VW.XView, 0 )+0; - yy=__view_get( e__VW.YView, 0 )+0; - var top=man_current,sel,temp1="",temp2="",temp3="",temp4="",temp5="", squad_sel=0; - var stop=0; + if ((menu == MENU.Manage) && (managing > 0) || (managing < 0) && (!view_squad || !company_report)) { + var unit; + var eventing = false, bb = ""; + xx = __view_get(e__VW.XView, 0) + 0; + yy = __view_get(e__VW.YView, 0) + 0; + var top = man_current, sel, temp1 = "", temp2 = "", temp3 = "", temp4 = "", temp5 = "", squad_sel = 0; + var stop = 0; - if (man_size==0) then alll=0; + if (man_size == 0) { + alll = 0; + } - if (cooldown<=0){ + if (cooldown <= 0) { // selecting all - if (point_in_rectangle(mouse_x,mouse_y,xx+1281,yy+607,xx+1409,yy+636)){ - cooldown=8; - if (alll==0){ + if (point_in_rectangle(mouse_x, mouse_y, xx + 1281, yy + 607, xx + 1409, yy + 636)) { + cooldown = 8; + if (alll == 0) { scr_load_all(true); - selecting_types="%!@"; - } else if (alll==1){ + selecting_types = "%!@"; + } else if (alll == 1) { scr_load_all(false); - selecting_types=""; + selecting_types = ""; } - } - + } } - } - if (menu==50) and (managing>0) and (cooldown<=0){ - if (mouse_x>=xx+217) and (mouse_y>=yy+28) and (mouse_x 0) && (cooldown <= 0)) { + if ((mouse_x >= xx + 217) && (mouse_y >= yy + 28) && (mouse_x < xx + 250) && (mouse_y < yy + 59)) { + cooldown = 8; + menu = MENU.Manage; + click = 1; } } }); diff --git a/objects/obj_controller/Mouse_56.gml b/objects/obj_controller/Mouse_56.gml index 78732caee1..cb36e5a665 100644 --- a/objects/obj_controller/Mouse_56.gml +++ b/objects/obj_controller/Mouse_56.gml @@ -1,8 +1,8 @@ // Resets cooldown var __b__ = action_if_variable(cooldown, 0, 2); -if (__b__){ +if (__b__) { __b__ = action_if_variable(cooldown, 9000, 1); - if (__b__) { + if (__b__) { cooldown = 0; } } diff --git a/objects/obj_controller/Mouse_60.gml b/objects/obj_controller/Mouse_60.gml index 436a0f4480..69cf560c3d 100644 --- a/objects/obj_controller/Mouse_60.gml +++ b/objects/obj_controller/Mouse_60.gml @@ -1,20 +1,36 @@ // Manages ship and unit selection depending on menus var __b__ = action_if_number(obj_popup, 0, 0); -if (__b__){ - if (menu == 1 && (managing > 0 || managing = -1) && man_max > 0) { - if (man_current > 0) { man_current-=1; } - if (man_current > 0) { man_current-=1; } +if (__b__) { + if (menu == 1 && (managing > 0 || managing == -1) && man_max > 0) { + if (man_current > 0) { + man_current -= 1; + } + if (man_current > 0) { + man_current -= 1; + } } if (menu == 30 && managing > 0 && man_max >= 10) { - if (ship_current > 0) { ship_current-=1; } - if (ship_current > 0) { ship_current-=1; } + if (ship_current > 0) { + ship_current -= 1; + } + if (ship_current > 0) { + ship_current -= 1; + } } if (menu == 30 && managing > 0 && man_max >= 50) { - if (ship_current > 0) { ship_current-=1; } - if (ship_current > 0) { ship_current-=1; } + if (ship_current > 0) { + ship_current -= 1; + } + if (ship_current > 0) { + ship_current -= 1; + } } if (menu == 16) { - if (man_current > 0) { man_current-=1; } - if (man_current > 0) { man_current-=1; } + if (man_current > 0) { + man_current -= 1; + } + if (man_current > 0) { + man_current -= 1; + } } } diff --git a/objects/obj_controller/Mouse_61.gml b/objects/obj_controller/Mouse_61.gml index a4e2dbc59a..fa66185fea 100644 --- a/objects/obj_controller/Mouse_61.gml +++ b/objects/obj_controller/Mouse_61.gml @@ -1,20 +1,36 @@ // Manages ship and unit selection depending on menus var __b__ = action_if_number(obj_popup, 0, 0); -if (__b__){ - if (menu==1) and (managing>0 || managing=-1) and (man_max>0){ - if ((man_current+MANAGE_MAN_SEE+1) 0 || managing == -1) && (man_max > 0)) { + if ((man_current + MANAGE_MAN_SEE + 1) < man_max) { + man_current += 1; + } + if ((man_current + MANAGE_MAN_SEE + 1) < man_max) { + man_current += 1; + } } - if (menu==30) and (managing>0) and (man_max>=10){ - if ((ship_current+ship_see+1) 0) && (man_max >= 10)) { + if ((ship_current + ship_see + 1) < ship_max) { + ship_current += 1; + } + if ((ship_current + ship_see + 1) < ship_max) { + ship_current += 1; + } } - if (menu==30) and (managing>0) and (man_max>=50){ - if ((ship_current+ship_see+1) 0) && (man_max >= 50)) { + if ((ship_current + ship_see + 1) < ship_max) { + ship_current += 1; + } + if ((ship_current + ship_see + 1) < ship_max) { + ship_current += 1; + } } - if (menu==16) and (man_max>MANAGE_MAN_SEE){ - if ((man_current+MANAGE_MAN_SEE+1) MANAGE_MAN_SEE)) { + if ((man_current + MANAGE_MAN_SEE + 1) < man_max) { + man_current += 1; + } + if ((man_current + MANAGE_MAN_SEE + 1) < man_max) { + man_current += 1; + } } } diff --git a/objects/obj_controller/Step_0.gml b/objects/obj_controller/Step_0.gml index 10b599d842..22c4b5b739 100644 --- a/objects/obj_controller/Step_0.gml +++ b/objects/obj_controller/Step_0.gml @@ -1,7 +1,16 @@ try { // Handles most logic for main menus, audio and checks if cheats are enabled // TODO refactor will wait untill squads PR (#76) is merged - if (menu == 0 && zoomed == 0 && !instances_exist_any([obj_ingame_menu,obj_ncombat])){ + if ( + menu == 0 + && zoomed == 0 + && !instances_exist_any( + [ + obj_ingame_menu, + obj_ncombat + ] + ) + ) { scr_zoom_keys(); } if (double_click >= 0) { @@ -47,10 +56,10 @@ try { } if (instance_exists(obj_formation_bar) && ((menu != 24) || (formating <= 0))) { - with(obj_formation_bar) { + with (obj_formation_bar) { instance_destroy(); } - with(obj_temp8) { + with (obj_temp8) { instance_destroy(); } formating = 0; @@ -161,19 +170,19 @@ try { if (obj_temp_build.isnew == 1) { menu = 60; } - with(obj_shop) { + with (obj_shop) { instance_destroy(); } - with(obj_managment_panel) { + with (obj_managment_panel) { instance_destroy(); } - with(obj_drop_select) { + with (obj_drop_select) { instance_destroy(); } - with(obj_star_select) { + with (obj_star_select) { instance_destroy(); } - with(obj_fleet_select) { + with (obj_fleet_select) { instance_destroy(); } } @@ -184,13 +193,13 @@ try { instance_create(obj_temp_build.x, obj_temp_build.y, obj_star_select); obj_star_select.loading_name = obj_controller.selected.name; popup = 3; - with(obj_temp_build) { + with (obj_temp_build) { instance_destroy(); } } // REMOVE if ((menu != 60) && instance_exists(obj_temp_build)) { - with(obj_temp_build) { + with (obj_temp_build) { instance_destroy(); } } @@ -213,7 +222,7 @@ try { // For testing purposes if (is_test_map == true) { - with(obj_en_fleet) { + with (obj_en_fleet) { if (owner == eFACTION.Imperium) { capital_number = 0; frigate_number = 1; @@ -402,7 +411,7 @@ try { instance_create(0, 0, obj_shop); } if ((menu != 14) && instance_exists(obj_shop)) { - with(obj_shop) { + with (obj_shop) { instance_destroy(); } } @@ -413,8 +422,7 @@ try { // Default view if (menu == 1 && (managing > 0 || managing < 0)) { if (!view_squad) { - var c = 0, - fx = ""; + var c = 0, fx = ""; var xx, yy, bb = ""; xx = __view_get(e__VW.XView, 0) + 0; yy = __view_get(e__VW.YView, 0) + 0; @@ -426,22 +434,19 @@ try { c = managing - 10; } - var top, sel, temp1 = "", - temp2 = "", - temp3 = "", - temp4 = "", - temp5 = "", - force_tool = 0; + var top, sel, temp1 = "", temp2 = "", temp3 = "", temp4 = "", temp5 = "", force_tool = 0; top = man_current; sel = top; yy += 77; } if (is_struct(unit_focus)) { - // Checks if the marine is not hidden var _unit = unit_focus; if (!is_array(last_unit)) { - last_unit = [-1, -1]; + last_unit = [ + -1, + -1 + ]; } if ((_unit.base_group != "none") && (last_unit[1] != _unit.marine_number || last_unit[0] != _unit.company)) { reset_manage_unit_constants(_unit); @@ -511,7 +516,7 @@ try { pip.image = "shipyard"; pip.cooldown = 15; - with(obj_p_fleet) { + with (obj_p_fleet) { if ((capital_health < 100) && (capital_number > 0)) { acted = 2; } @@ -585,7 +590,7 @@ try { sel_loading = -1; man_size = 0; unload = 0; - with(obj_star_select) { + with (obj_star_select) { instance_destroy(); } } @@ -594,8 +599,16 @@ try { reset_manage_selections(); } - if (menu == 0 && !instances_exist_any([obj_ncombat,obj_fleet_controller])){ - if (!array_contains(obj_ini.role[0],obj_ini.role[100][eROLE.ChapterMaster]) && (alarm[7] == -1)){ + if ( + menu == 0 + && !instances_exist_any( + [ + obj_ncombat, + obj_fleet_controller + ] + ) + ) { + if (!array_contains(obj_ini.role[0], obj_ini.role[100][eROLE.ChapterMaster]) && (alarm[7] == -1)) { alarm[7] = 15; } } diff --git a/objects/obj_controller/Step_1.gml b/objects/obj_controller/Step_1.gml index 4f1add4565..d67a62c92f 100644 --- a/objects/obj_controller/Step_1.gml +++ b/objects/obj_controller/Step_1.gml @@ -4,9 +4,5 @@ //global.default_view_height = display_get_height(); map_scale = scr_map_scale(); scale_mod = 1 / map_scale; -obj_cursor.image_xscale=1; -obj_cursor.image_yscale=1; - - - - +obj_cursor.image_xscale = 1; +obj_cursor.image_yscale = 1; diff --git a/objects/obj_controller/Step_2.gml b/objects/obj_controller/Step_2.gml index 3c3bc77f79..631261657b 100644 --- a/objects/obj_controller/Step_2.gml +++ b/objects/obj_controller/Step_2.gml @@ -1,6 +1 @@ /// @description Insert description here - - - - - From 998c57af35859b461862d9b34faa574d98080f1f Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 22:16:08 -0500 Subject: [PATCH 15/45] Add back in the update() function to the Table but in the correct place. --- scripts/scr_Table/scr_Table.gml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/scr_Table/scr_Table.gml b/scripts/scr_Table/scr_Table.gml index 428684256c..aef057f512 100644 --- a/scripts/scr_Table/scr_Table.gml +++ b/scripts/scr_Table/scr_Table.gml @@ -61,6 +61,8 @@ function Table(data) constructor { } }; + update(data); + static draw = function() { add_draw_return_values(); From 80220306ad4d4ca1f07697b8bd444c0e7b049c6c Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 22:20:04 -0500 Subject: [PATCH 16/45] Small correction for overzealous linter. --- scripts/scr_buttons/scr_buttons.gml | 46 +++++------------------------ 1 file changed, 8 insertions(+), 38 deletions(-) diff --git a/scripts/scr_buttons/scr_buttons.gml b/scripts/scr_buttons/scr_buttons.gml index 68351ad2ef..a369fdac24 100644 --- a/scripts/scr_buttons/scr_buttons.gml +++ b/scripts/scr_buttons/scr_buttons.gml @@ -399,35 +399,10 @@ function UnitButtonObject(data = false) constructor { _temp_alpha = 0.5; allow_click = false; } - _button_click_area = draw_unit_buttons( - w > 0 - ? [ - x1, - y1, - x2, - y2 - ] - : [ - x1, - y1 - ], - label, - [ - text_scale, - text_scale - ], - active ? color : inactive_col, -, - font, - _temp_alpha - ); + _button_click_area = draw_unit_buttons(w > 0 ? [x1, y1, x2, y2] : [x1, y1], label, [text_scale, text_scale], active ? color : inactive_col,, font, _temp_alpha); } else if (style == "pixel") { - var _widths = [ - sprite_get_width(spr_pixel_button_left), - sprite_get_width(spr_pixel_button_middle), - sprite_get_width(spr_pixel_button_right) - ]; - + var _widths = [sprite_get_width(spr_pixel_button_left), sprite_get_width(spr_pixel_button_middle), sprite_get_width(spr_pixel_button_right)]; + var height_scale = h / sprite_get_height(spr_pixel_button_left); _widths[0] *= height_scale; _widths[2] *= height_scale; @@ -442,23 +417,18 @@ function UnitButtonObject(data = false) constructor { draw_set_halign(fa_center); draw_set_valign(fa_middle); draw_set_color(color); - + draw_text_transformed(_text_position_x, y1 + ((h * height_scale) / 2), label, text_scale, text_scale, 0); - + x2 = x1 + array_sum(_widths); y2 = y1 + h; - _button_click_area = [ - x1, - y1, - x2, - y2 - ]; + _button_click_area = [x1, y1, x2, y2]; } - + if (scr_hit(x1, y1, x2, y2) && tooltip != "") { tooltip_draw(tooltip); } - + if (allow_click && active) { var clicked = point_and_click(_button_click_area) || keystroke; if (clicked) { From 60cb85f119d5a08a00191ecf704db55761f1413e Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Fri, 26 Dec 2025 22:25:38 -0500 Subject: [PATCH 17/45] Correctly set framerate with fleet objects. --- objects/obj_fleet/Alarm_5.gml | 2 +- objects/obj_fleet/Draw_64.gml | 2 +- objects/obj_fleet/KeyPress_13.gml | 2 +- objects/obj_fleet/Mouse_56.gml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/objects/obj_fleet/Alarm_5.gml b/objects/obj_fleet/Alarm_5.gml index efd08644de..6d7b74c073 100644 --- a/objects/obj_fleet/Alarm_5.gml +++ b/objects/obj_fleet/Alarm_5.gml @@ -1,4 +1,4 @@ -if (combat_end=170) then room_speed=30; +if (combat_end=170) then game_set_speed(30, gamespeed_fps); diff --git a/objects/obj_fleet/Draw_64.gml b/objects/obj_fleet/Draw_64.gml index dd80258628..08117b7403 100644 --- a/objects/obj_fleet/Draw_64.gml +++ b/objects/obj_fleet/Draw_64.gml @@ -51,7 +51,7 @@ if (start==0) { } // fast forward icon -if (room_speed != 90 && start == 5) { +if (gamespeed_fps != 90 && start == 5) { draw_set_alpha(1); var _ff_h = sprite_get_height(spr_fast_forward); draw_sprite(spr_fast_forward, 0, 12, (_surface_h / 2) - (_ff_h / 2)); diff --git a/objects/obj_fleet/KeyPress_13.gml b/objects/obj_fleet/KeyPress_13.gml index 5b3cc5e72e..52e27d6828 100644 --- a/objects/obj_fleet/KeyPress_13.gml +++ b/objects/obj_fleet/KeyPress_13.gml @@ -29,7 +29,7 @@ if __b__ // End battle crap here instance_activate_all(); -room_speed=30; +game_set_speed(30, gamespeed_fps); alarm[7]=1; diff --git a/objects/obj_fleet/Mouse_56.gml b/objects/obj_fleet/Mouse_56.gml index 9d4a7d0548..56954481b2 100644 --- a/objects/obj_fleet/Mouse_56.gml +++ b/objects/obj_fleet/Mouse_56.gml @@ -36,10 +36,10 @@ if (instance_exists(obj_p_ship)) and (control=1){ } if (start=5) and (obj_controller.zoomed=0){ - if (mouse_x>=__view_get( e__VW.XView, 0 )+12) and (mouse_y>=__view_get( e__VW.YView, 0 )+436) and (mouse_x<__view_get( e__VW.XView, 0 )+48) and (mouse_y<__view_get( e__VW.YView, 0 )+480) and (room_speed<90) then room_speed+=30; + if (mouse_x>=__view_get( e__VW.XView, 0 )+12) and (mouse_y>=__view_get( e__VW.YView, 0 )+436) and (mouse_x<__view_get( e__VW.XView, 0 )+48) and (mouse_y<__view_get( e__VW.YView, 0 )+480) and (gamespeed_fps<90) then game_set_speed(gamespeed_fps+30, gamespeed_fps); } if (start=5) and (obj_controller.zoomed=1){ - if (mouse_x>24) and (mouse_y>872) and (mouse_x<90) and (mouse_y<960) and (room_speed<90) then room_speed+=30; + if (mouse_x>24) and (mouse_y>872) and (mouse_x<90) and (mouse_y<960) and (gamespeed_fps<90) then game_set_speed(gamespeed_fps+30, gamespeed_fps); } From 32a32095e4ff27faf88025f2a0da3585c5acae0c Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 10:54:59 -0500 Subject: [PATCH 18/45] We are converting these Real's to bools for the sake of math, so we might as well make that clearer via using the bool() function instead of 'git add objects/obj_fleet/Draw_64.gml' (which the ettybitty linter throws an error at anyways because who would do it like this? Sure it's the same logic in a way but it's a lot more prone to unintential behavior or being confusing to read through). --- objects/obj_fleet/Draw_64.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/obj_fleet/Draw_64.gml b/objects/obj_fleet/Draw_64.gml index 08117b7403..bca3eebfd7 100644 --- a/objects/obj_fleet/Draw_64.gml +++ b/objects/obj_fleet/Draw_64.gml @@ -117,7 +117,7 @@ if (combat_end <= 120){ if (start == 7) { // ## todo: calculate all of this once at the end of the battle ## - var _margin_categories = max(!!capital_max + !!frigate_max + !!escort_max, 1); + var _margin_categories = max(bool(capital_max) + bool(frigate_max) + bool(escort_max), 1); var _margin_percent = ( (max(capital, 0) / max(1, capital_max)) + (max(frigate, 0) / max(1, frigate_max)) + From 39b1e6d082e0f83345161bfad4354283d194b744 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 10:57:13 -0500 Subject: [PATCH 19/45] Linted obj_fleet --- objects/obj_fleet/Alarm_0.gml | 12 +- objects/obj_fleet/Alarm_1.gml | 514 ++++++++++++++++++++---------- objects/obj_fleet/Alarm_2.gml | 390 +++++++++++++---------- objects/obj_fleet/Alarm_3.gml | 14 +- objects/obj_fleet/Alarm_4.gml | 118 ++++--- objects/obj_fleet/Alarm_5.gml | 7 +- objects/obj_fleet/Alarm_6.gml | 162 ++++++---- objects/obj_fleet/Alarm_7.gml | 329 +++++++++++-------- objects/obj_fleet/Create_0.gml | 305 +++++++++--------- objects/obj_fleet/Draw_64.gml | 39 +-- objects/obj_fleet/KeyPress_13.gml | 46 ++- objects/obj_fleet/KeyPress_32.gml | 8 +- objects/obj_fleet/KeyPress_67.gml | 1 - objects/obj_fleet/Mouse_53.gml | 21 +- objects/obj_fleet/Mouse_56.gml | 78 ++--- objects/obj_fleet/Step_0.gml | 83 ++--- 16 files changed, 1256 insertions(+), 871 deletions(-) diff --git a/objects/obj_fleet/Alarm_0.gml b/objects/obj_fleet/Alarm_0.gml index a5c46ed6e7..7449e0ba71 100644 --- a/objects/obj_fleet/Alarm_0.gml +++ b/objects/obj_fleet/Alarm_0.gml @@ -1,11 +1,9 @@ - //scr_dead_marines(1); +start = 7; -start=7; - - -with(obj_controller){ - if (zoomed=1) then scr_zoom(); +with (obj_controller) { + if (zoomed == 1) { + scr_zoom(); + } } - diff --git a/objects/obj_fleet/Alarm_1.gml b/objects/obj_fleet/Alarm_1.gml index e4450c8a7c..ad405efc5b 100644 --- a/objects/obj_fleet/Alarm_1.gml +++ b/objects/obj_fleet/Alarm_1.gml @@ -1,125 +1,217 @@ +// if (csm_exp!=0) then show_message(string(csm_exp)); +if (control == 1) { + instance_activate_object(obj_cursor); +} -// if (csm_exp!=0) then show_message(string(csm_exp)); +if (enemy == 2) { + if (en_escort > 0) { + en_column[4] = "Sword Class Frigate"; + en_num[4] = en_escort; + en_size[4] = 1; + } + if (en_frigate > 0) { + en_column[3] = "Avenger Class Grand Cruiser"; + en_num[3] = en_frigate; + en_size[3] = 2; + } -if (control=1) then instance_activate_object(obj_cursor); - - -if (enemy=2){ - if (en_escort>0){en_column[4]="Sword Class Frigate";en_num[4]=en_escort;en_size[4]=1;} - - if (en_frigate>0){en_column[3]="Avenger Class Grand Cruiser";en_num[3]=en_frigate;en_size[3]=2;} - - var i;i=0;i=en_capital; - if (i>0){ - en_column[2]="Apocalypse Class Battleship";en_num[2]=floor(random(i))+1; - if (en_num[2]<(en_capital*0.6)) then en_num[2]=round(en_capital*0.6); - i-=en_num[2];en_size[2]=3; - } - - if (i>0){en_column[1]="Nemesis Class Fleet Carrier";en_num[1]=i;i-=en_num[1];en_size[1]=3;} -} - - - -if (enemy=6){ - if (en_escort>0){en_column[4]="Aconite";en_num[4]=max(1,floor(en_escort/2));en_size[4]=1;} - if (en_escort>1){en_column[3]="Hellebore";en_num[3]=max(1,floor(en_escort/2));en_size[3]=1;} - if (en_frigate>0){en_column[2]="Shadow Class";en_num[2]=en_frigate;en_size[2]=2;} - if (en_capital>0){en_column[1]="Void Stalker";en_num[1]=en_capital;en_size[1]=3;} -} - - - - -if (enemy=7){ - var i=en_capital; - - if (i>0){ - en_column[1]="Dethdeala"; - en_num[1]=irandom_range(1, i); - i-=en_num[1]; - en_size[1]=3; - } - - if (i>0){ - en_column[2]="Gorbag's Revenge"; - en_num[2]=irandom_range(1, i); - i-=en_num[2]; - en_size[2]=3; - }// en_num[2]+=en_num[1]+1; - - if (i>0){ - en_column[3]="Kroolboy"; - en_num[3]=i; - i-=en_num[3]; - en_size[3]=3; - }// en_num[3]+=en_num[2]+1; - - if (en_frigate>0){ - en_column[4]="Battlekroozer"; - en_num[4]=en_frigate; - en_size[4]=2; - }// en_num[4]+=en_num[3]+1; - - if (en_escort>0){ - en_column[5]="Ravager"; - en_num[5]=en_escort; - en_size[5]=1; - }// en_num[5]+=en_num[4]+1; -} - -if (enemy=8){ - var i;i=0;i=en_frigate; - - if (en_capital>0){en_column[1]="Custodian";en_num[1]=en_capital;en_size[1]=3;} - - if (i>0){en_column[2]="Emissary";en_num[2]=1;i-=en_num[2];en_size[2]=2;} - - if (i>0){en_column[3]="Protector";en_num[3]=i;i-=en_num[3];en_size[3]=2;}// en_num[3]+=en_num[2]+1; - - if (en_escort>0){en_column[4]="Castellan";en_num[4]=round((en_escort/3)*2);en_size[4]=1;} - - if (en_escort>2){en_column[5]="Warden";en_num[5]=en_escort-en_num[5];en_size[5]=1;} -} - -if (enemy=9){ - var i;i=0;i=en_escort; - - if (en_capital>0){en_column[1]="Leviathan";en_num[1]=en_capital;en_size[1]=3;} - - if (i>0){en_column[2]="Stalker";en_num[2]=floor(i/3)+1;i-=en_num[2];en_size[2]=1;} - - if (en_frigate>0){en_column[3]="Razorfiend";en_num[3]=en_frigate;en_size[3]=2;}// en_num[2]+=en_num[1]+1; - - if (i>0){en_column[4]="Prowler";en_num[4]=i;en_size[4]=1;}// en_num[5]+=en_num[4]+1; -} - -if (enemy=10){ - var i;i=0;i=en_frigate; - - if (en_capital>0){en_column[1]="Desecrator";en_num[1]=en_capital;en_size[1]=3;} - - if (i>0){en_column[2]="Avenger";en_num[2]=floor(random(i))+1;i-=en_num[2];en_size[2]=2;} - - if (i>0){en_column[3]="Carnage";en_num[3]=floor(random(i))+1;i-=en_num[3];en_size[3]=2;}// en_num[2]+=en_num[1]+1; - - if (i>0){en_column[4]="Daemon";en_num[4]=i;i-=en_num[4];en_size[4]=2;}// en_num[3]+=en_num[2]+1; - - if (en_escort>0){en_column[5]="Iconoclast";en_num[5]=en_escort;en_size[5]=1;}// en_num[5]+=en_num[4]+1; + var i; + i = 0; + i = en_capital; + if (i > 0) { + en_column[2] = "Apocalypse Class Battleship"; + en_num[2] = floor(random(i)) + 1; + if (en_num[2] < (en_capital * 0.6)) { + en_num[2] = round(en_capital * 0.6); + } + i -= en_num[2]; + en_size[2] = 3; + } + + if (i > 0) { + en_column[1] = "Nemesis Class Fleet Carrier"; + en_num[1] = i; + i -= en_num[1]; + en_size[1] = 3; + } } +if (enemy == 6) { + if (en_escort > 0) { + en_column[4] = "Aconite"; + en_num[4] = max(1, floor(en_escort / 2)); + en_size[4] = 1; + } + if (en_escort > 1) { + en_column[3] = "Hellebore"; + en_num[3] = max(1, floor(en_escort / 2)); + en_size[3] = 1; + } + if (en_frigate > 0) { + en_column[2] = "Shadow Class"; + en_num[2] = en_frigate; + en_size[2] = 2; + } + if (en_capital > 0) { + en_column[1] = "Void Stalker"; + en_num[1] = en_capital; + en_size[1] = 3; + } +} -// show_message("Dethdeala "+string(en_num[1])+" | Gorbag "+string(en_num[2])+" | Kroolboy "+string(en_num[3])+" | Frigate "+string(en_num[4])+" | Escort "+string(en_num[5])); +if (enemy == 7) { + var i = en_capital; + + if (i > 0) { + en_column[1] = "Dethdeala"; + en_num[1] = irandom_range(1, i); + i -= en_num[1]; + en_size[1] = 3; + } + if (i > 0) { + en_column[2] = "Gorbag's Revenge"; + en_num[2] = irandom_range(1, i); + i -= en_num[2]; + en_size[2] = 3; + } // en_num[2]+=en_num[1]+1; + + if (i > 0) { + en_column[3] = "Kroolboy"; + en_num[3] = i; + i -= en_num[3]; + en_size[3] = 3; + } // en_num[3]+=en_num[2]+1; + + if (en_frigate > 0) { + en_column[4] = "Battlekroozer"; + en_num[4] = en_frigate; + en_size[4] = 2; + } // en_num[4]+=en_num[3]+1; + + if (en_escort > 0) { + en_column[5] = "Ravager"; + en_num[5] = en_escort; + en_size[5] = 1; + } // en_num[5]+=en_num[4]+1; +} + +if (enemy == 8) { + var i; + i = 0; + i = en_frigate; -en_capital=0; -en_frigate=0; -en_escort=0; -en_ships_max=0; + if (en_capital > 0) { + en_column[1] = "Custodian"; + en_num[1] = en_capital; + en_size[1] = 3; + } + + if (i > 0) { + en_column[2] = "Emissary"; + en_num[2] = 1; + i -= en_num[2]; + en_size[2] = 2; + } + if (i > 0) { + en_column[3] = "Protector"; + en_num[3] = i; + i -= en_num[3]; + en_size[3] = 2; + } // en_num[3]+=en_num[2]+1; + + if (en_escort > 0) { + en_column[4] = "Castellan"; + en_num[4] = round((en_escort / 3) * 2); + en_size[4] = 1; + } + + if (en_escort > 2) { + en_column[5] = "Warden"; + en_num[5] = en_escort - en_num[5]; + en_size[5] = 1; + } +} + +if (enemy == 9) { + var i; + i = 0; + i = en_escort; + + if (en_capital > 0) { + en_column[1] = "Leviathan"; + en_num[1] = en_capital; + en_size[1] = 3; + } + + if (i > 0) { + en_column[2] = "Stalker"; + en_num[2] = floor(i / 3) + 1; + i -= en_num[2]; + en_size[2] = 1; + } + + if (en_frigate > 0) { + en_column[3] = "Razorfiend"; + en_num[3] = en_frigate; + en_size[3] = 2; + } // en_num[2]+=en_num[1]+1; + + if (i > 0) { + en_column[4] = "Prowler"; + en_num[4] = i; + en_size[4] = 1; + } // en_num[5]+=en_num[4]+1; +} + +if (enemy == 10) { + var i; + i = 0; + i = en_frigate; + + if (en_capital > 0) { + en_column[1] = "Desecrator"; + en_num[1] = en_capital; + en_size[1] = 3; + } + + if (i > 0) { + en_column[2] = "Avenger"; + en_num[2] = floor(random(i)) + 1; + i -= en_num[2]; + en_size[2] = 2; + } + + if (i > 0) { + en_column[3] = "Carnage"; + en_num[3] = floor(random(i)) + 1; + i -= en_num[3]; + en_size[3] = 2; + } // en_num[2]+=en_num[1]+1; + + if (i > 0) { + en_column[4] = "Daemon"; + en_num[4] = i; + i -= en_num[4]; + en_size[4] = 2; + } // en_num[3]+=en_num[2]+1; + + if (en_escort > 0) { + en_column[5] = "Iconoclast"; + en_num[5] = en_escort; + en_size[5] = 1; + } // en_num[5]+=en_num[4]+1; +} + +// show_message("Dethdeala "+string(en_num[1])+" | Gorbag "+string(en_num[2])+" | Kroolboy "+string(en_num[3])+" | Frigate "+string(en_num[4])+" | Escort "+string(en_num[5])); +en_capital = 0; +en_frigate = 0; +en_escort = 0; +en_ships_max = 0; /* if (enemy="orks"){ @@ -153,7 +245,6 @@ if (enemy="orks"){ */ - /*if (en_num[2]=0) then en_num[2]=en_num[1]+1; if (en_num[3]=0) then en_num[3]=en_num[2]+1; if (en_num[4]=0) then en_num[4]=en_num[3]+1; @@ -164,7 +255,6 @@ if (en_num[3]!=0) then en_num[3]+=en_num[3]; if (en_num[4]!=0) then en_num[4]+=en_num[4]; if (en_num[5]!=0) then en_num[5]+=en_num[5];*/ - /*var i;i=0; repeat(5){i+=1; if (en_column[4]="") and (en_column[5]!="") and (en_num[5]>0){en_column[4]=en_column[5];en_num[4]=en_num[5];en_column[5]="";en_num[5]=0;} @@ -173,69 +263,172 @@ repeat(5){i+=1; if (en_column[1]="") and (en_column[2]!="") and (en_num[2]>0){en_column[1]=en_column[2];en_num[1]=en_num[2];en_column[2]="";en_num[2]=0;} }*/ +var i; +i = 0; +repeat (5) { + i += 1; + if (en_column[i] == "Avenger Class Grand Cruiser") { + en_width[i] = 196; + en_height[i] = 96; + } + if (en_column[i] == "Apocalypse Class Battleship") { + en_width[i] = 272; + en_height[i] = 128; + } + if (en_column[i] == "Nemesis Class Fleet Carrier") { + en_width[i] = 272; + en_height[i] = 128; + } + if (en_column[i] == "Sword Class Frigate") { + en_width[i] = 96; + en_height[i] = 64; + } + if (en_column[i] == "Void Stalker") { + en_width[i] = 260; + en_height[i] = 192; + } + if (en_column[i] == "Shadow Class") { + en_width[i] = 212; + en_height[i] = 160; + } + if (en_column[i] == "Hellebore") { + en_width[i] = 160; + en_height[i] = 64; + } + if (en_column[i] == "Aconite") { + en_width[i] = 128; + en_height[i] = 64; + } + if (en_column[i] == "Deathdeala") { + en_width[i] = 196; + en_height[i] = 128; + } + if (en_column[i] == "Gorbag's Revenge") { + en_width[i] = 196; + en_height[i] = 128; + } + if (en_column[i] == "Kroolboy") { + en_width[i] = 196; + en_height[i] = 128; + } + if (en_column[i] == "Slamblasta") { + en_width[i] = 196; + en_height[i] = 128; + } + if (en_column[i] == "Battlekroozer") { + en_width[i] = 160; + en_height[i] = 96; + } + if (en_column[i] == "Ravager") { + en_width[i] = 128; + en_height[i] = 64; + } -var i;i=0; -repeat(5){i+=1; - if (en_column[i]="Avenger Class Grand Cruiser"){en_width[i]=196;en_height[i]=96;} - if (en_column[i]="Apocalypse Class Battleship"){en_width[i]=272;en_height[i]=128;} - if (en_column[i]="Nemesis Class Fleet Carrier"){en_width[i]=272;en_height[i]=128;} - if (en_column[i]="Sword Class Frigate"){en_width[i]=96;en_height[i]=64;} - - if (en_column[i]="Void Stalker"){en_width[i]=260;en_height[i]=192;} - if (en_column[i]="Shadow Class"){en_width[i]=212;en_height[i]=160;} - if (en_column[i]="Hellebore"){en_width[i]=160;en_height[i]=64;} - if (en_column[i]="Aconite"){en_width[i]=128;en_height[i]=64;} - - if (en_column[i]="Deathdeala"){en_width[i]=196;en_height[i]=128;} - if (en_column[i]="Gorbag's Revenge"){en_width[i]=196;en_height[i]=128;} - if (en_column[i]="Kroolboy"){en_width[i]=196;en_height[i]=128;} - if (en_column[i]="Slamblasta"){en_width[i]=196;en_height[i]=128;} - if (en_column[i]="Battlekroozer"){en_width[i]=160;en_height[i]=96;} - if (en_column[i]="Ravager"){en_width[i]=128;en_height[i]=64;} - - if (en_column[i]="Desecrator"){en_width[i]=196;en_height[i]=128;} - if (en_column[i]="Avenger"){en_width[i]=160;en_height[i]=96;} - if (en_column[i]="Carnage"){en_width[i]=160;en_height[i]=96;} - if (en_column[i]="Daemon"){en_width[i]=160;en_height[i]=96;} - if (en_column[i]="Iconoclast"){en_width[i]=128;en_height[i]=64;} - - if (en_column[i]="Custodian"){en_width[i]=128;en_height[i]=256;} - if (en_column[i]="Emissary"){en_width[i]=160;en_height[i]=96;} - if (en_column[i]="Protector"){en_width[i]=64;en_height[i]=180;} - if (en_column[i]="Castellan"){en_width[i]=48;en_height[i]=96;} - if (en_column[i]="Warden"){en_width[i]=48;en_height[i]=80;} - - if (en_column[i]="Leviathan"){en_width[i]=200;en_height[i]=128;} - if (en_column[i]="Razorfiend"){en_width[i]=160;en_height[i]=128;} - if (en_column[i]="Stalker"){en_width[i]=96;en_height[i]=64;} - if (en_column[i]="Prowler"){en_width[i]=80;en_height[i]=64;} + if (en_column[i] == "Desecrator") { + en_width[i] = 196; + en_height[i] = 128; + } + if (en_column[i] == "Avenger") { + en_width[i] = 160; + en_height[i] = 96; + } + if (en_column[i] == "Carnage") { + en_width[i] = 160; + en_height[i] = 96; + } + if (en_column[i] == "Daemon") { + en_width[i] = 160; + en_height[i] = 96; + } + if (en_column[i] == "Iconoclast") { + en_width[i] = 128; + en_height[i] = 64; + } + + if (en_column[i] == "Custodian") { + en_width[i] = 128; + en_height[i] = 256; + } + if (en_column[i] == "Emissary") { + en_width[i] = 160; + en_height[i] = 96; + } + if (en_column[i] == "Protector") { + en_width[i] = 64; + en_height[i] = 180; + } + if (en_column[i] == "Castellan") { + en_width[i] = 48; + en_height[i] = 96; + } + if (en_column[i] == "Warden") { + en_width[i] = 48; + en_height[i] = 80; + } + + if (en_column[i] == "Leviathan") { + en_width[i] = 200; + en_height[i] = 128; + } + if (en_column[i] == "Razorfiend") { + en_width[i] = 160; + en_height[i] = 128; + } + if (en_column[i] == "Stalker") { + en_width[i] = 96; + en_height[i] = 64; + } + if (en_column[i] == "Prowler") { + en_width[i] = 80; + en_height[i] = 64; + } } /* */ -attack_mode="offensive"; +attack_mode = "offensive"; // if (ambushers=1) or (enemy=8) then attack_mode="offensive"; // if (enemy=9) then attack_mode="defensive"; -if (ambushers=1) and (ambushers=999) then global_attack=global_attack*1.1;// Need to finish this -if (bolter_drilling=1) then global_bolter=global_bolter*1.1; +if ((ambushers == 1) && (ambushers == 999)) { + global_attack = global_attack * 1.1; +} // Need to finish this +if (bolter_drilling == 1) { + global_bolter = global_bolter * 1.1; +} // if (enemy_eldar=1) and (enemy=6){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} // if (enemy_fallen=1) and (enemy=10){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} // if (enemy_orks=1) and (enemy=7){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} // if (enemy_tau=1) and (enemy=8){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} // if (enemy_tyranids=1) and (enemy=10){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} -if (siege=1) and (siege=555) then global_attack=global_attack*1.2;// Need to finish this -if (slow=1){global_attack=global_attack*0.9;global_defense=global_defense*1.2;} -if (melee=1) then global_melee=global_melee*1.15; -// -if (shitty_luck=1) then global_defense=global_defense*0.9; +if ((siege == 1) && (siege == 555)) { + global_attack = global_attack * 1.2; +} // Need to finish this +if (slow == 1) { + global_attack = global_attack * 0.9; + global_defense = global_defense * 1.2; +} +if (melee == 1) { + global_melee = global_melee * 1.15; +} +// +if (shitty_luck == 1) { + global_defense = global_defense * 0.9; +} // if (lyman=1) and (dropping=1) then ||| handle within each object -if (ossmodula=1){global_attack=global_attack*0.95;global_defense=global_defense*0.95;} -if (betchers=1) then global_melee=global_melee*0.95; -if (catalepsean=1){global_attack=global_attack*0.95;} +if (ossmodula == 1) { + global_attack = global_attack * 0.95; + global_defense = global_defense * 0.95; +} +if (betchers == 1) { + global_melee = global_melee * 0.95; +} +if (catalepsean == 1) { + global_attack = global_attack * 0.95; +} // if (occulobe=1){if (time=5) or (time=6) then global_attack=global_attack*0.7;global_defense=global_defense*0.9;} /* @@ -246,8 +439,7 @@ obj_ini.lens_color=obj_creation.lens_color; obj_ini.weapon_color=obj_creation.weapon_color; */ -alarm[2]=1; - +alarm[2] = 1; /* */ /* */ diff --git a/objects/obj_fleet/Alarm_2.gml b/objects/obj_fleet/Alarm_2.gml index c4cd3fd765..9feb22f26a 100644 --- a/objects/obj_fleet/Alarm_2.gml +++ b/objects/obj_fleet/Alarm_2.gml @@ -1,64 +1,72 @@ - -capital_max=capital; -frigate_max=frigate; -escort_max=escort; - - -var i, k, temp1, temp2, x2, hei, man, sizz; -i=0;k=0;temp1=0;temp2=0;x2=224;hei=0;man=0;sizz=0; - - - - +capital_max = capital; +frigate_max = frigate; +escort_max = escort; + +var i, k, temp1, temp2, x2, hei, man, sizz; +i = 0; +k = 0; +temp1 = 0; +temp2 = 0; +x2 = 224; +hei = 0; +man = 0; +sizz = 0; sort_ships_into_columns(self); - player_fleet_ship_spawner(); - -if (enemy=2){// This is an orderly Tau ship formation - var xx,yy,i, temp1, x2, man; - xx=0;yy=0;i=0;temp1=0;x2=1200;man=0; - - if (en_num[4]>0){ - yy=(room_height/2)-((en_height[4]*en_num[4])/2); - yy+=(en_height[4]/2); - repeat(en_num[4]){ - man=instance_create(x2,yy,obj_en_cruiser);yy+=en_height[4];man.class=en_column[4]; +if (enemy == 2) { + // This is an orderly Tau ship formation + var xx, yy, i, temp1, x2, man; + xx = 0; + yy = 0; + i = 0; + temp1 = 0; + x2 = 1200; + man = 0; + + if (en_num[4] > 0) { + yy = (room_height / 2) - ((en_height[4] * en_num[4]) / 2); + yy += en_height[4] / 2; + repeat (en_num[4]) { + man = instance_create(x2, yy, obj_en_cruiser); + yy += en_height[4]; + man.class = en_column[4]; } - x2+=en_width[4]; - } - if (en_num[3]>0){ - yy=(room_height/2)-((en_height[3]*en_num[3])/2); - yy+=(en_height[3]/2); - repeat(en_num[3]){ - man=instance_create(x2,yy,obj_en_cruiser);yy+=en_height[3];man.class=en_column[3]; + x2 += en_width[4]; + } + if (en_num[3] > 0) { + yy = (room_height / 2) - ((en_height[3] * en_num[3]) / 2); + yy += en_height[3] / 2; + repeat (en_num[3]) { + man = instance_create(x2, yy, obj_en_cruiser); + yy += en_height[3]; + man.class = en_column[3]; } - x2+=en_width[3]; - } - if (en_num[2]>0){ - yy=(room_height/2)-((en_height[2]*en_num[2])/2); - yy+=(en_height[2]/2); - repeat(en_num[2]){ - man=instance_create(x2,yy,obj_en_capital);yy+=en_height[2];man.class=en_column[2]; + x2 += en_width[3]; + } + if (en_num[2] > 0) { + yy = (room_height / 2) - ((en_height[2] * en_num[2]) / 2); + yy += en_height[2] / 2; + repeat (en_num[2]) { + man = instance_create(x2, yy, obj_en_capital); + yy += en_height[2]; + man.class = en_column[2]; } - x2+=en_width[2]; - } - if (en_num[1]>0){ - yy=256; - repeat(en_num[1]){ - man=instance_create(x2,yy,obj_en_capital);yy+=en_height[1];man.class=en_column[1]; - yy+=(en_height[1]); + x2 += en_width[2]; + } + if (en_num[1] > 0) { + yy = 256; + repeat (en_num[1]) { + man = instance_create(x2, yy, obj_en_capital); + yy += en_height[1]; + man.class = en_column[1]; + yy += en_height[1]; } } } - - - - - /* if (en_escort>0){en_column[4]="Aconite";en_num[4]=max(1,floor(en_escort/2));en_size[4]=1;} if (en_escort>1){en_column[3]="Hellebore";en_num[3]=max(1,floor(en_escort/2));en_size[3]=1;} @@ -66,150 +74,182 @@ if (en_frigate>0){en_column[2]="Shadow Class";en_num[2]=en_frigate;en_size[2]=2; if (en_capital>0){en_column[1]="Void Stalker";en_num[1]=en_capital;en_size[1]=3;} */ - - -if (enemy=6){// This is an orderly Tau ship formation - var xx,yy,i, temp1, x2, man; - xx=0;yy=0;i=0;temp1=0;x2=1200;man=0; - - if (en_num[4]>0){ - yy=128; - repeat(en_num[4]){ - man=instance_create(x2,yy,obj_en_cruiser);yy+=en_height[4];man.class=en_column[4]; +if (enemy == 6) { + // This is an orderly Tau ship formation + var xx, yy, i, temp1, x2, man; + xx = 0; + yy = 0; + i = 0; + temp1 = 0; + x2 = 1200; + man = 0; + + if (en_num[4] > 0) { + yy = 128; + repeat (en_num[4]) { + man = instance_create(x2, yy, obj_en_cruiser); + yy += en_height[4]; + man.class = en_column[4]; } } - if (en_num[3]>0){ - yy=room_height-128; - repeat(en_num[3]){ - man=instance_create(x2,yy,obj_en_cruiser);yy-=en_height[3];man.class=en_column[3]; + if (en_num[3] > 0) { + yy = room_height - 128; + repeat (en_num[3]) { + man = instance_create(x2, yy, obj_en_cruiser); + yy -= en_height[3]; + man.class = en_column[3]; } } - x2+=max(en_width[3],en_width[4]); - - if (en_num[2]>0){ - yy=(room_height/2)-((en_height[2]*en_num[2])/2); - yy+=(en_height[2]/2); - repeat(en_num[2]){ - man=instance_create(x2,yy,obj_en_capital);yy+=en_height[2];man.class=en_column[2]; + x2 += max(en_width[3], en_width[4]); + + if (en_num[2] > 0) { + yy = (room_height / 2) - ((en_height[2] * en_num[2]) / 2); + yy += en_height[2] / 2; + repeat (en_num[2]) { + man = instance_create(x2, yy, obj_en_capital); + yy += en_height[2]; + man.class = en_column[2]; } - x2+=en_width[2]; - } - if (en_num[1]>0){ - yy=256; - repeat(en_num[1]){ - man=instance_create(x2,yy,obj_en_capital);yy+=en_height[1];man.class=en_column[1]; - yy+=(en_height[1]); + x2 += en_width[2]; + } + if (en_num[1] > 0) { + yy = 256; + repeat (en_num[1]) { + man = instance_create(x2, yy, obj_en_capital); + yy += en_height[1]; + man.class = en_column[1]; + yy += en_height[1]; } } } - - - - - -if (enemy=7) or (enemy=10){// This is spew out random ships without regard for formations - var xx,yy,dist,targ,numb,man; - xx=0;yy=0;dist=0;target=0;numb=0;man=0; - - var i;i=0; - - repeat(5){ - - i+=1; - - if (en_column[i]!="") then for(s = 0; s < en_num[i]; s += 1){ - if (en_size[i]>1) then man=instance_create(random_range(1200,1400),round(random(860)+50),obj_en_capital); - if (en_size[i]=1) then man=instance_create(random_range(1200,1400),round(random(860)+50),obj_en_cruiser); - man.class=en_column[i]; +if ((enemy == 7) || (enemy == 10)) { + // This is spew out random ships without regard for formations + var xx, yy, dist, targ, numb, man; + xx = 0; + yy = 0; + dist = 0; + target = 0; + numb = 0; + man = 0; + + var i; + i = 0; + + repeat (5) { + i += 1; + + if (en_column[i] != "") { + for (s = 0; s < en_num[i]; s += 1) { + if (en_size[i] > 1) { + man = instance_create(random_range(1200, 1400), round(random(860) + 50), obj_en_capital); + } + if (en_size[i] == 1) { + man = instance_create(random_range(1200, 1400), round(random(860) + 50), obj_en_cruiser); + } + man.class = en_column[i]; + } } - - } } - - - - - - -if (enemy=8){// This is an orderly Tau ship formation - var xx,yy,i, temp1, x2, man; - xx=0;yy=0;i=0;temp1=0;x2=1200;man=0; - - yy=(room_height/2)-((en_height[5]*en_num[5])/2); - yy+=(en_height[5]/2); - repeat(en_num[5]){ - man=instance_create(x2,yy,obj_en_cruiser);yy+=en_height[5];man.class="Warden"; - } - x2+=en_width[5]; - - yy=(room_height/2)-((en_height[2]*en_num[2])/2)-((en_height[3]*en_num[3])/2); - yy+=(en_height[2]/2);yy+=(en_height[3]/2); - repeat(en_num[2]){ - man=instance_create(x2,yy,obj_en_cruiser);yy+=en_height[2];man.class="Emissary"; - } - repeat(en_num[3]){ - man=instance_create(x2,yy,obj_en_cruiser);yy+=en_height[3];man.class="Protector"; +if (enemy == 8) { + // This is an orderly Tau ship formation + var xx, yy, i, temp1, x2, man; + xx = 0; + yy = 0; + i = 0; + temp1 = 0; + x2 = 1200; + man = 0; + + yy = (room_height / 2) - ((en_height[5] * en_num[5]) / 2); + yy += en_height[5] / 2; + repeat (en_num[5]) { + man = instance_create(x2, yy, obj_en_cruiser); + yy += en_height[5]; + man.class = "Warden"; + } + x2 += en_width[5]; + + yy = (room_height / 2) - ((en_height[2] * en_num[2]) / 2) - ((en_height[3] * en_num[3]) / 2); + yy += en_height[2] / 2; + yy += en_height[3] / 2; + repeat (en_num[2]) { + man = instance_create(x2, yy, obj_en_cruiser); + yy += en_height[2]; + man.class = "Emissary"; + } + repeat (en_num[3]) { + man = instance_create(x2, yy, obj_en_cruiser); + yy += en_height[3]; + man.class = "Protector"; + } + x2 += max(en_width[2], en_width[3]); + + yy = (room_height / 2) - ((en_height[4] * en_num[4]) / 2); + yy += en_height[4] / 2; + repeat (en_num[4]) { + man = instance_create(x2, yy, obj_en_cruiser); + yy += en_height[4]; + man.class = "Castellan"; + } + x2 += en_width[4]; + + yy = (room_height / 2) - ((en_height[1] * en_num[1]) / 2); + yy += en_height[1] / 2; + repeat (en_num[1]) { + man = instance_create(x2, yy, obj_en_capital); + yy += en_height[1]; + man.class = "Custodian"; } - x2+=max(en_width[2],en_width[3]); - - yy=(room_height/2)-((en_height[4]*en_num[4])/2); - yy+=(en_height[4]/2); - repeat(en_num[4]){ - man=instance_create(x2,yy,obj_en_cruiser);yy+=en_height[4];man.class="Castellan"; - } - x2+=en_width[4]; - - yy=(room_height/2)-((en_height[1]*en_num[1])/2); - yy+=(en_height[1]/2); - repeat(en_num[1]){ - man=instance_create(x2,yy,obj_en_capital);yy+=en_height[1];man.class="Custodian"; - } - } - - - -if (enemy=9){// This is an orderly Tyranid ship formation - var xx,yy,i, temp1, x2, man; - xx=0;yy=0;i=0;temp1=0;x2=1200;man=0; - - yy=(room_height/2)-((en_height[4]*en_num[4])/2); - yy+=(en_height[4]/2); - repeat(en_num[4]){ - man=instance_create(x2,yy,obj_en_cruiser);yy+=en_height[4];man.class="Prowler"; - } - x2+=en_width[4]; - - yy=(room_height/2)-((en_height[3]*en_num[3])/2); - yy+=(en_height[3]/2); - repeat(en_num[3]){ - man=instance_create(x2,yy,obj_en_cruiser);yy+=en_height[3];man.class="Razorfiend"; - } - x2+=en_width[3]; - - yy=(room_height/2)-((en_height[2]*en_num[2])/2); - yy+=(en_height[2]/2); - repeat(en_num[2]){ - man=instance_create(x2,yy,obj_en_cruiser);yy+=en_height[2];man.class="Stalker"; - } - x2+=en_width[2]; - - yy=(room_height/2)-((en_height[1]*en_num[1])/2); - yy+=(en_height[1]/2); - repeat(en_num[1]){ - man=instance_create(x2,yy,obj_en_capital);yy+=en_height[1];man.class="Leviathan"; +if (enemy == 9) { + // This is an orderly Tyranid ship formation + var xx, yy, i, temp1, x2, man; + xx = 0; + yy = 0; + i = 0; + temp1 = 0; + x2 = 1200; + man = 0; + + yy = (room_height / 2) - ((en_height[4] * en_num[4]) / 2); + yy += en_height[4] / 2; + repeat (en_num[4]) { + man = instance_create(x2, yy, obj_en_cruiser); + yy += en_height[4]; + man.class = "Prowler"; + } + x2 += en_width[4]; + + yy = (room_height / 2) - ((en_height[3] * en_num[3]) / 2); + yy += en_height[3] / 2; + repeat (en_num[3]) { + man = instance_create(x2, yy, obj_en_cruiser); + yy += en_height[3]; + man.class = "Razorfiend"; + } + x2 += en_width[3]; + + yy = (room_height / 2) - ((en_height[2] * en_num[2]) / 2); + yy += en_height[2] / 2; + repeat (en_num[2]) { + man = instance_create(x2, yy, obj_en_cruiser); + yy += en_height[2]; + man.class = "Stalker"; + } + x2 += en_width[2]; + + yy = (room_height / 2) - ((en_height[1] * en_num[1]) / 2); + yy += en_height[1] / 2; + repeat (en_num[1]) { + man = instance_create(x2, yy, obj_en_capital); + yy += en_height[1]; + man.class = "Leviathan"; } - } - - - - /* */ action_set_alarm(2, 3); - diff --git a/objects/obj_fleet/Alarm_3.gml b/objects/obj_fleet/Alarm_3.gml index ca80204c2a..5369be8f0b 100644 --- a/objects/obj_fleet/Alarm_3.gml +++ b/objects/obj_fleet/Alarm_3.gml @@ -1,13 +1,11 @@ instance_activate_object(obj_p_ship); instance_activate_object(obj_en_ship); -instance_create(0,0,obj_fleet_controller); +instance_create(0, 0, obj_fleet_controller); - -if (instance_number(obj_en_ship)=0){ - combat_end=-1; - start=6; - obj_p_ship.alarm[3]=1; - alarm[0]=10; +if (instance_number(obj_en_ship) == 0) { + combat_end = -1; + start = 6; + obj_p_ship.alarm[3] = 1; + alarm[0] = 10; } - diff --git a/objects/obj_fleet/Alarm_4.gml b/objects/obj_fleet/Alarm_4.gml index 605cd4a9b5..020d812e45 100644 --- a/objects/obj_fleet/Alarm_4.gml +++ b/objects/obj_fleet/Alarm_4.gml @@ -1,59 +1,95 @@ - -with(obj_p_ship){instance_destroy();} -with(obj_p_th){instance_destroy();} -with(obj_en_ship){instance_destroy();} -with(obj_en_in){instance_destroy();} -with(obj_al_ship){instance_destroy();} -with(obj_al_in){instance_destroy();} -with(obj_fleet_controller){instance_destroy();} -with(obj_p_round){instance_destroy();} -with(obj_en_round){instance_destroy();} -with(obj_al_round){instance_destroy();} -with(obj_p_assra){instance_destroy();} -with(obj_en_husk){instance_destroy();} +with (obj_p_ship) { + instance_destroy(); +} +with (obj_p_th) { + instance_destroy(); +} +with (obj_en_ship) { + instance_destroy(); +} +with (obj_en_in) { + instance_destroy(); +} +with (obj_al_ship) { + instance_destroy(); +} +with (obj_al_in) { + instance_destroy(); +} +with (obj_fleet_controller) { + instance_destroy(); +} +with (obj_p_round) { + instance_destroy(); +} +with (obj_en_round) { + instance_destroy(); +} +with (obj_al_round) { + instance_destroy(); +} +with (obj_p_assra) { + instance_destroy(); +} +with (obj_en_husk) { + instance_destroy(); +} instance_activate_all(); -obj_controller.combat=0; +obj_controller.combat = 0; instance_activate_object(obj_turn_end); // instance_activate_object(obj_star_select); // show_message(obj_turn_end.current_battle); - -if (player_started=0){ - with(obj_turn_end){ - current_battle+=1; - alarm[0]=1; +if (player_started == 0) { + with (obj_turn_end) { + current_battle += 1; + alarm[0] = 1; } } -if (player_started=1){ - var taxt;taxt=""; +if (player_started == 1) { + var taxt; + taxt = ""; + + taxt = string(global.chapter_name) + " engage and destroy a"; + if ((enemy[1] == 2) || (enemy[1] == 4) || (enemy[1] == 5) || (enemy[1] == 6)) { + taxt += "n"; + } + taxt += " " + string(obj_controller.faction[enemy[1]]); + taxt += " fleet at " + string(ene_fleet.name) + "."; + scr_event_log("", taxt); - taxt=string(global.chapter_name)+" engage and destroy a"; - if (enemy[1]=2) or (enemy[1]=4) or (enemy[1]=5) or (enemy[1]=6) then taxt+="n"; - taxt+=" "+string(obj_controller.faction[enemy[1]]); - taxt+=" fleet at "+string(ene_fleet.name)+".";scr_event_log("",taxt); - - if (instance_exists(obj_star_select)) then with(obj_star_select){ - alarm[1]=1;player_fleet=0; - var i=-1;repeat(15){i+=1;en_fleet[i]=0;} + if (instance_exists(obj_star_select)) { + with (obj_star_select) { + alarm[1] = 1; + player_fleet = 0; + var i = -1; + repeat (15) { + i += 1; + en_fleet[i] = 0; + } + } } - if (instance_exists(pla_fleet)){ - pla_fleet.acted=2; - if (capital+frigate+escort=0) then with(pla_fleet){instance_destroy();} + if (instance_exists(pla_fleet)) { + pla_fleet.acted = 2; + if (capital + frigate + escort == 0) { + with (pla_fleet) { + instance_destroy(); + } + } } - if (enemy[1]!=4) and (obj_controller.faction_status[enemy[1]]!="War"){ - scr_audience(enemy[1], "declare_war", obj_controller.disposition[enemy[1]]-20, "War", 3, 2); + if ((enemy[1] != 4) && (obj_controller.faction_status[enemy[1]] != "War")) { + scr_audience(enemy[1], "declare_war", obj_controller.disposition[enemy[1]] - 20, "War", 3, 2); } } -if (view_x+view_y>0){ - obj_controller.x=view_x; - obj_controller.y=view_y; +if (view_x + view_y > 0) { + obj_controller.x = view_x; + obj_controller.y = view_y; } - - - // show_message(obj_turn_end.current_battle); -with(obj_controller){instance_activate_all();} +with (obj_controller) { + instance_activate_all(); +} instance_destroy(); diff --git a/objects/obj_fleet/Alarm_5.gml b/objects/obj_fleet/Alarm_5.gml index 6d7b74c073..afab278577 100644 --- a/objects/obj_fleet/Alarm_5.gml +++ b/objects/obj_fleet/Alarm_5.gml @@ -1,4 +1,3 @@ - -if (combat_end=170) then game_set_speed(30, gamespeed_fps); - - +if (combat_end == 170) { + game_set_speed(30, gamespeed_fps); +} diff --git a/objects/obj_fleet/Alarm_6.gml b/objects/obj_fleet/Alarm_6.gml index 1d2846a7d0..6ffaebf572 100644 --- a/objects/obj_fleet/Alarm_6.gml +++ b/objects/obj_fleet/Alarm_6.gml @@ -1,4 +1,3 @@ - /* enemy[2]=6;enemy_status[2]=1; en_capital[2]=2;en_frigate[2]=3;en_escort[2]=5; @@ -12,102 +11,135 @@ en_ships_max[3]=6; */ var total_enemies, total_allies, t, tt, y1, y2, fug, spawner; -total_enemies=0; -total_allies=1; -spawner=0; -t=0;y1=0;y2=0;tt=0;fug=0; - -repeat(6){t+=1; - if (enemy[t]!=0){ - if (enemy_status[t]<0) then total_enemies+=1; - if (enemy_status[t]>0) then total_allies+=1; - +total_enemies = 0; +total_allies = 1; +spawner = 0; +t = 0; +y1 = 0; +y2 = 0; +tt = 0; +fug = 0; + +repeat (6) { + t += 1; + if (enemy[t] != 0) { + if (enemy_status[t] < 0) { + total_enemies += 1; + } + if (enemy_status[t] > 0) { + total_allies += 1; + } + // show_message("Computer "+string(t)+":"+string(enemy[t])+", status:"+string(enemy_status[t])); } } - - -if (total_enemies>0){ - t=1;y2=room_height/total_enemies/2;tt=0; - repeat(5){fug+=1; - if (enemy_status[fug]<0){ - tt+=1;y1=(t*y2); - - spawner=instance_create(room_width+200,y1,obj_fleet_spawner); - spawner.owner=enemy[fug]; - spawner.height=(y2); - spawner.number=fug; - - t+=2; +if (total_enemies > 0) { + t = 1; + y2 = room_height / total_enemies / 2; + tt = 0; + repeat (5) { + fug += 1; + if (enemy_status[fug] < 0) { + tt += 1; + y1 = t * y2; + + spawner = instance_create(room_width + 200, y1, obj_fleet_spawner); + spawner.owner = enemy[fug]; + spawner.height = y2; + spawner.number = fug; + + t += 2; } } } -if (total_allies>0){ - y1=0;fug=0; - t=1; - y2=room_height/total_allies/2; - tt=0; - repeat(5){ - fug+=1; - if (enemy_status[fug]>0){ - tt+=1; - y1=(t*y2); - - spawner=instance_create(200,y1,obj_fleet_spawner); - - if (fug=1) then spawner.owner = eFACTION.Player; - if (fug>1) then spawner.owner=enemy[fug];// Get the ENEMY after the actual enemies - - spawner.height=(y2); - spawner.number=fug; - - t+=2; +if (total_allies > 0) { + y1 = 0; + fug = 0; + t = 1; + y2 = room_height / total_allies / 2; + tt = 0; + repeat (5) { + fug += 1; + if (enemy_status[fug] > 0) { + tt += 1; + y1 = t * y2; + + spawner = instance_create(200, y1, obj_fleet_spawner); + + if (fug == 1) { + spawner.owner = eFACTION.Player; + } + if (fug > 1) { + spawner.owner = enemy[fug]; + } // Get the ENEMY after the actual enemies + + spawner.height = y2; + spawner.number = fug; + + t += 2; } } } - // show_message("Total Enemies: "+string(total_enemies)); // show_message("Total Allies: "+string(total_allies)); - // Buffs here -// if (ambushers=1) or (enemy=8) then -attack_mode="offensive"; +// if (ambushers=1) or (enemy=8) then +attack_mode = "offensive"; // if (enemy=9) then attack_mode="defensive"; -if (ambushers=1) and (ambushers=999) then global_attack=global_attack*1.1;// Need to finish this -if (bolter_drilling=1) then global_bolter=global_bolter*1.1; +if ((ambushers == 1) && (ambushers == 999)) { + global_attack = global_attack * 1.1; +} // Need to finish this +if (bolter_drilling == 1) { + global_bolter = global_bolter * 1.1; +} // if (enemy_eldar=1) and (enemy=6){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} // if (enemy_fallen=1) and (enemy=10){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} // if (enemy_orks=1) and (enemy=7){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} // if (enemy_tau=1) and (enemy=8){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} // if (enemy_tyranids=1) and (enemy=10){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} -if (siege=1) and (siege=555) then global_attack=global_attack*1.2;// Need to finish this -if (slow=1){global_attack=global_attack*0.9;global_defense=global_defense*1.2;} -if (melee=1) then global_melee=global_melee*1.15; -// -if (shitty_luck=1) then global_defense=global_defense*0.9; +if ((siege == 1) && (siege == 555)) { + global_attack = global_attack * 1.2; +} // Need to finish this +if (slow == 1) { + global_attack = global_attack * 0.9; + global_defense = global_defense * 1.2; +} +if (melee == 1) { + global_melee = global_melee * 1.15; +} +// +if (shitty_luck == 1) { + global_defense = global_defense * 0.9; +} // if (lyman=1) and (dropping=1) then ||| handle within each object -if (ossmodula=1){global_attack=global_attack*0.95;global_defense=global_defense*0.95;} -if (betchers=1) then global_melee=global_melee*0.95; -if (catalepsean=1){global_attack=global_attack*0.95;} +if (ossmodula == 1) { + global_attack = global_attack * 0.95; + global_defense = global_defense * 0.95; +} +if (betchers == 1) { + global_melee = global_melee * 0.95; +} +if (catalepsean == 1) { + global_attack = global_attack * 0.95; +} // if (occulobe=1){if (time=5) or (time=6) then global_attack=global_attack*0.7;global_defense=global_defense*0.9;} // More prep for player -var i=0,k=0,onceh=0; +var i = 0, k = 0, onceh = 0; // instance_activate_object(obj_combat_info); -capital_max=capital; -frigate_max=frigate; -escort_max=escort; - -obj_fleet_spawner.alarm[0]=1; +capital_max = capital; +frigate_max = frigate; +escort_max = escort; +obj_fleet_spawner.alarm[0] = 1; // alarm[1]=2; /* */ diff --git a/objects/obj_fleet/Alarm_7.gml b/objects/obj_fleet/Alarm_7.gml index 2cd61ecc75..3b9c7dd74a 100644 --- a/objects/obj_fleet/Alarm_7.gml +++ b/objects/obj_fleet/Alarm_7.gml @@ -1,166 +1,235 @@ try { var _player_battle_fleet, yeehaw2, tstar; - _player_battle_fleet=0;yeehaw2=0;tstar=0; - - if (player_started=1){ - _player_battle_fleet=pla_fleet; - yeehaw2=ene_fleet; + _player_battle_fleet = 0; + yeehaw2 = 0; + tstar = 0; + + if (player_started == 1) { + _player_battle_fleet = pla_fleet; + yeehaw2 = ene_fleet; } - - if (player_started=0) and (instance_exists(obj_turn_end)){ - _player_battle_fleet=obj_turn_end.battle_pobject[obj_turn_end.current_battle]; + + if ((player_started == 0) && instance_exists(obj_turn_end)) { + _player_battle_fleet = obj_turn_end.battle_pobject[obj_turn_end.current_battle]; } - - - if (instance_number(obj_en_ship)>0){ - scr_recent("fleet_defeat",star_name,(capital_lost*6)+(frigate_lost*2)+escort_lost); + + if (instance_number(obj_en_ship) > 0) { + scr_recent("fleet_defeat", star_name, (capital_lost * 6) + (frigate_lost * 2) + escort_lost); } - if (instance_number(obj_en_ship)<=0){ - with(obj_p_ship){ - if (hp<=0) then scr_recent("ship_destroyed",obj_ini.ship[ship_id],ship_id); + if (instance_number(obj_en_ship) <= 0) { + with (obj_p_ship) { + if (hp <= 0) { + scr_recent("ship_destroyed", obj_ini.ship[ship_id], ship_id); + } + } + } + + with (_player_battle_fleet) { + scr_ini_ship_cleanup(); + + if (player_fleet_ship_count() == 0) { + instance_destroy(); } } - - with (_player_battle_fleet){ - scr_ini_ship_cleanup() - if (player_fleet_ship_count() == 0) then instance_destroy(); + var op, ii, killer, killer_tg; + op = 0; + killer = 0; + killer_tg = 0; + ii = -50; + + if ((player_started == 0) && instance_exists(obj_turn_end)) { + with (obj_star) { + if (name != obj_turn_end.battle_location[obj_turn_end.current_battle]) { + x -= 10000; + y -= 10000; + } + } + } + if (player_started == 1) { + with (obj_star) { + if (id != obj_fleet.ene_fleet) { + x -= 10000; + y -= 10000; + } + } } - - var op,ii,killer,killer_tg;op=0;killer=0;killer_tg=0;ii=-50; - - - - - - if (player_started=0) and (instance_exists(obj_turn_end)) then with(obj_star){if (name!=obj_turn_end.battle_location[obj_turn_end.current_battle]){x-=10000;y-=10000;}} - if (player_started=1) then with(obj_star){if (id!=obj_fleet.ene_fleet){x-=10000;y-=10000;}} - ii=instance_nearest(room_width,room_height,obj_star); - obj_controller.temp[1070]=ii.id; - with(obj_star){if (x<-5000) and (y<-5000){x+=10000;y+=10000;}} - - - - - - - - op=0;var ofleet;ofleet=0; - repeat(5) { - op+=1; - if (enemy[op]!=0) and (enemy[op]!=4){ofleet=0; - obj_controller.temp[1071]=enemy[op]; - + ii = instance_nearest(room_width, room_height, obj_star); + obj_controller.temp[1070] = ii.id; + with (obj_star) { + if ((x < -5000) && (y < -5000)) { + x += 10000; + y += 10000; + } + } + + op = 0; + var ofleet; + ofleet = 0; + repeat (5) { + op += 1; + if ((enemy[op] != 0) && (enemy[op] != 4)) { + ofleet = 0; + obj_controller.temp[1071] = enemy[op]; + // show_message("Hiding all but the fleet owned by "+string(obj_controller.temp[1071])); - - with(obj_en_fleet){if (owner!=obj_controller.temp[1071]) or (orbiting!=obj_controller.temp[1070]){x-=10000;y-=10000;}} - - ofleet=instance_nearest(room_width/2,room_height/2,obj_en_fleet); + + with (obj_en_fleet) { + if ((owner != obj_controller.temp[1071]) || (orbiting != obj_controller.temp[1070])) { + x -= 10000; + y -= 10000; + } + } + + ofleet = instance_nearest(room_width / 2, room_height / 2, obj_en_fleet); // show_message("Fleet: "+string(ofleet.capital_number)+"/"+string(ofleet.frigate_number)+"/"+string(ofleet.escort_number)+", lost "+string(en_capital_lost[op])+"/"+string(en_frigate_lost[op])+"/"+string(en_escort_lost[op])); - - repeat(50){ - if (!instance_exists(ofleet)){ofleet=instance_nearest(room_width/2,room_height/2,obj_en_fleet);} - if (instance_exists(ofleet)){ - if (ofleet.trade_goods="player_hold") then ofleet.trade_goods=""; + + repeat (50) { + if (!instance_exists(ofleet)) { + ofleet = instance_nearest(room_width / 2, room_height / 2, obj_en_fleet); + } + if (instance_exists(ofleet)) { + if (ofleet.trade_goods == "player_hold") { + ofleet.trade_goods = ""; + } // show_message("ofleet x:"+string(ofleet.x)+", ofleet y:"+string(ofleet.y)+", ofleet owner: "+string(ofleet.owner)+" wants "+string(enemy[op])); - if (ofleet.x>-7000) and (ofleet.y>-7000) and (ofleet.owner=enemy[op]){ - if (en_capital_lost[op]+en_frigate_lost[op]+en_escort_lost[op]>=ofleet.capital_number+ofleet.frigate_number+ofleet.escort_number){ - en_capital_lost[op]-=ofleet.capital_number;en_frigate_lost[op]-=ofleet.frigate_number;en_escort_lost[op]-=ofleet.escort_number; + if ((ofleet.x > -7000) && (ofleet.y > -7000) && (ofleet.owner == enemy[op])) { + if (en_capital_lost[op] + en_frigate_lost[op] + en_escort_lost[op] >= ofleet.capital_number + ofleet.frigate_number + ofleet.escort_number) { + en_capital_lost[op] -= ofleet.capital_number; + en_frigate_lost[op] -= ofleet.frigate_number; + en_escort_lost[op] -= ofleet.escort_number; // show_message("Fleet baleeted"); - with(ofleet){instance_destroy();} + with (ofleet) { + instance_destroy(); + } } - if (en_capital_lost[op]+en_frigate_lost[op]+en_escort_lost[op]>0) and (instance_exists(ofleet)){ + if ((en_capital_lost[op] + en_frigate_lost[op] + en_escort_lost[op] > 0) && instance_exists(ofleet)) { // show_message("Fleet: "+string(ofleet.capital_number)+"/"+string(ofleet.frigate_number)+"/"+string(ofleet.escort_number)+", lost "+string(en_capital_lost[op])+"/"+string(en_frigate_lost[op])+"/"+string(en_escort_lost[op])); - if (en_capital_lost[op]>0) and (ofleet.capital_number>0){en_capital_lost[op]-=1;ofleet.capital_number-=1;} - if (en_frigate_lost[op]>0) and (ofleet.frigate_number>0){en_frigate_lost[op]-=1;ofleet.frigate_number-=1;} - if (en_escort_lost[op]>0) and (ofleet.escort_number>0){en_escort_lost[op]-=1;ofleet.escort_number-=1;} - if (ofleet.capital_number+ofleet.frigate_number+ofleet.escort_number<=0) then with(ofleet){instance_destroy();} + if ((en_capital_lost[op] > 0) && (ofleet.capital_number > 0)) { + en_capital_lost[op] -= 1; + ofleet.capital_number -= 1; + } + if ((en_frigate_lost[op] > 0) && (ofleet.frigate_number > 0)) { + en_frigate_lost[op] -= 1; + ofleet.frigate_number -= 1; + } + if ((en_escort_lost[op] > 0) && (ofleet.escort_number > 0)) { + en_escort_lost[op] -= 1; + ofleet.escort_number -= 1; + } + if (ofleet.capital_number + ofleet.frigate_number + ofleet.escort_number <= 0) { + with (ofleet) { + instance_destroy(); + } + } } } } } - - with(obj_en_fleet){if (x<-7000) and (y<-7000){x+=10000;y+=10000;}} - + + with (obj_en_fleet) { + if ((x < -7000) && (y < -7000)) { + x += 10000; + y += 10000; + } + } + // if (instance_exists(ofleet)){show_message("Fleet: "+string(ofleet.capital_number)+"/"+string(ofleet.frigate_number)+"/"+string(ofleet.escort_number));} // if (!instance_exists(ofleet)){show_message("FlEET WAS DELETED");} } - + // show_message("End ship removing"); - - if (enemy[op]=4) and (enemy_status[op]<0){ - obj_controller.temp[1071]=enemy[op]; - with(obj_en_fleet){if (owner!=obj_controller.temp[1071]) or (orbiting!=obj_controller.temp[1070]){x-=10000;y-=10000;}} - ofleet=instance_nearest(room_width/2,room_height/2,obj_en_fleet); - killer=1; - obj_controller.temp[1071]=enemy[op]; - killer_tg=ofleet.inquisitor; - with(ofleet){instance_destroy();} - with(obj_en_fleet){{x+=10000;y+=10000;}} + + if ((enemy[op] == 4) && (enemy_status[op] < 0)) { + obj_controller.temp[1071] = enemy[op]; + with (obj_en_fleet) { + if ((owner != obj_controller.temp[1071]) || (orbiting != obj_controller.temp[1070])) { + x -= 10000; + y -= 10000; + } + } + ofleet = instance_nearest(room_width / 2, room_height / 2, obj_en_fleet); + killer = 1; + obj_controller.temp[1071] = enemy[op]; + killer_tg = ofleet.inquisitor; + with (ofleet) { + instance_destroy(); + } + with (obj_en_fleet) { + { + x += 10000; + y += 10000; + } + } } } - - - - - - obj_controller.cooldown=20; - - if (killer>0){ - scr_loyalty("Inquisitor Killer","+"); - if (obj_controller.loyalty>=85) then obj_controller.last_world_inspection-=44; - if (obj_controller.loyalty>=70) and (obj_controller.loyalty<85) then obj_controller.last_world_inspection-=32; - if (obj_controller.loyalty>=50) and (obj_controller.loyalty<70) then obj_controller.last_world_inspection-=20; - if (obj_controller.loyalty<50) then scr_loyalty("Inquisitor Killer","+"); - - var msg="",msg2="",i=0; - if (killer_tg > 0){ + + obj_controller.cooldown = 20; + + if (killer > 0) { + scr_loyalty("Inquisitor Killer", "+"); + if (obj_controller.loyalty >= 85) { + obj_controller.last_world_inspection -= 44; + } + if ((obj_controller.loyalty >= 70) && (obj_controller.loyalty < 85)) { + obj_controller.last_world_inspection -= 32; + } + if ((obj_controller.loyalty >= 50) && (obj_controller.loyalty < 70)) { + obj_controller.last_world_inspection -= 20; + } + if (obj_controller.loyalty < 50) { + scr_loyalty("Inquisitor Killer", "+"); + } + + var msg = "", msg2 = "", i = 0; + if (killer_tg > 0) { var inquis_name = obj_controller.inquisitor[killer_tg]; - msg+=$"Inquisitor {inquis_name} has been killed!"; - msg2=$"Inquisitor {inquis_name}"; + msg += $"Inquisitor {inquis_name} has been killed!"; + msg2 = $"Inquisitor {inquis_name}"; + } + if (obj_controller.inquisitor_type[killer_tg] == "Ordo Hereticus") { + scr_loyalty("Inquisitor Killer", "+"); } - if (obj_controller.inquisitor_type[killer_tg]=="Ordo Hereticus") then scr_loyalty("Inquisitor Killer","+"); - - array_delete(obj_controller.inquisitor_gender, killer_tg,1); - array_delete(obj_controller.inquisitor_type, killer_tg,1); - array_delete(obj_controller.inquisitor, killer_tg,1); - - array_push(obj_controller.inquisitor_gender, choose(0,0,0,1,1,1,1)); - array_push(obj_controller.inquisitor_type, choose("Ordo Malleus","Ordo Xenos","Ordo Hereticus","Ordo Hereticus","Ordo Hereticus","Ordo Hereticus","Ordo Hereticus","Ordo Hereticus")); + + array_delete(obj_controller.inquisitor_gender, killer_tg, 1); + array_delete(obj_controller.inquisitor_type, killer_tg, 1); + array_delete(obj_controller.inquisitor, killer_tg, 1); + + array_push(obj_controller.inquisitor_gender, choose(0, 0, 0, 1, 1, 1, 1)); + array_push(obj_controller.inquisitor_type, choose("Ordo Malleus", "Ordo Xenos", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus")); array_push(obj_controller.inquisitor, global.name_generator.generate_imperial_name(obj_controller.inquisitor_gender[i])); - + instance_activate_object(obj_turn_end); - - if (instance_exists(obj_turn_end)) then scr_alert("red","inqis",string(msg),ii.x+16,ii.y-24); - if (!instance_exists(obj_turn_end)) and (obj_controller.faction_status[eFACTION.Inquisition]!="War"){ - var pip;pip=instance_create(0,0,obj_popup); - pip.title="Inquisitor Killed"; - pip.text=msg; - pip.image="inquisition"; - pip.cooldown=20; - - if (obj_controller.known[eFACTION.Inquisition]<3){ - pip.title="EXCOMMUNICATUS TRAITORUS"; - pip.text=$"The Inquisition has noticed your uncalled murder of {msg2} and declared your chapter Excommunicatus Traitorus."; - obj_controller.alarm[8]=1; + + if (instance_exists(obj_turn_end)) { + scr_alert("red", "inqis", string(msg), ii.x + 16, ii.y - 24); + } + if ((!instance_exists(obj_turn_end)) && (obj_controller.faction_status[eFACTION.Inquisition] != "War")) { + var pip; + pip = instance_create(0, 0, obj_popup); + pip.title = "Inquisitor Killed"; + pip.text = msg; + pip.image = "inquisition"; + pip.cooldown = 20; + + if (obj_controller.known[eFACTION.Inquisition] < 3) { + pip.title = "EXCOMMUNICATUS TRAITORUS"; + pip.text = $"The Inquisition has noticed your uncalled murder of {msg2} and declared your chapter Excommunicatus Traitorus."; + obj_controller.alarm[8] = 1; } } - - + // if (obj_controller.known[eFACTION.Inquisition]<3) then with(obj_popup){instance_destroy();} - - - + // excommunicatus traitorus } - + instance_activate_all(); - - if (instance_exists(obj_p_assra)){obj_p_assra.alarm[0]=1;} - alarm[4]=2; - - - -} catch(_exception) { + + if (instance_exists(obj_p_assra)) { + obj_p_assra.alarm[0] = 1; + } + alarm[4] = 2; +} catch (_exception) { handle_exception(_exception); -} \ No newline at end of file +} diff --git a/objects/obj_fleet/Create_0.gml b/objects/obj_fleet/Create_0.gml index 68c77a33db..c9352170f7 100644 --- a/objects/obj_fleet/Create_0.gml +++ b/objects/obj_fleet/Create_0.gml @@ -1,41 +1,49 @@ - - instance_activate_object(obj_controller); log_message("Fleet Combat Started"); -beg=0;fallen=0;fallen_command=0; -obj_controller.cooldown=20; -sel_x1=0;sel_y1=0;control=0; -ships_selected=0; -battle_special=""; -csm_exp=0;star_name=""; +beg = 0; +fallen = 0; +fallen_command = 0; +obj_controller.cooldown = 20; +sel_x1 = 0; +sel_y1 = 0; +control = 0; +ships_selected = 0; +battle_special = ""; +csm_exp = 0; +star_name = ""; // woohoo=0; -left_down=0; - -view_x=obj_controller.x; -view_y=obj_controller.y; -obj_controller.x=0; -obj_controller.y=240; -obj_controller.combat=1; -is_zoomed=obj_controller.zoomed; -start=0;combat_end=170; - -if (obj_controller.zoomed=0) then with(obj_controller){scr_zoom();} +left_down = 0; + +view_x = obj_controller.x; +view_y = obj_controller.y; +obj_controller.x = 0; +obj_controller.y = 240; +obj_controller.combat = 1; +is_zoomed = obj_controller.zoomed; +start = 0; +combat_end = 170; + +if (obj_controller.zoomed == 0) { + with (obj_controller) { + scr_zoom(); + } +} -enemy=0; -enemy_status="attacking"; +enemy = 0; +enemy_status = "attacking"; -tempor1=0; -tempor2=0; +tempor1 = 0; +tempor2 = 0; -player_started=0; -player_lasers=0; -player_lasers_cd=70; -player_lasers_target=0; -pla_fleet=0; -ene_fleet=0; -victory=false; +player_started = 0; +player_lasers = 0; +player_lasers_cd = 70; +player_lasers_target = 0; +pla_fleet = 0; +ene_fleet = 0; +victory = false; instance_deactivate_all(true); instance_activate_object(obj_controller); @@ -43,146 +51,151 @@ instance_activate_object(obj_ini); instance_activate_object(obj_cursor); instance_activate_object(obj_img); -column[0]=""; -column_width[0]=0;// This is determined at the pre-battle screen -column[1]=""; -column_width[1]=0; -column[2]=""; -column_width[2]=0; -column[3]=""; -column_width[3]=0; -column[4]=""; -column_width[4]=0; -column[5]=""; -column_width[5]=0;// Furthest right - - -threat=4; -var k,j; -k=-1; -j=-1; - - -repeat(6){k+=1;j=-1; - repeat(11){j+=1; - enemy[j]=0; - enemy_status[j]=0; - +column[0] = ""; +column_width[0] = 0; // This is determined at the pre-battle screen +column[1] = ""; +column_width[1] = 0; +column[2] = ""; +column_width[2] = 0; +column[3] = ""; +column_width[3] = 0; +column[4] = ""; +column_width[4] = 0; +column[5] = ""; +column_width[5] = 0; // Furthest right + +threat = 4; +var k, j; +k = -1; +j = -1; + +repeat (6) { + k += 1; + j = -1; + repeat (11) { + j += 1; + enemy[j] = 0; + enemy_status[j] = 0; + /*en_column[j,k]=""; en_width[j,k]=0;en_height[j,k]=0; en_num[j,k]=0;en_size[j,k]=0;*/ - - en_capital[j]=0; - en_capital_max[j]=0; - en_capital_lost[j]=0; - en_frigate[j]=0; - en_frigate_max[j]=0; - en_frigate_lost[j]=0; - en_escort[j]=0; - en_escort_max[j]=0; - en_escort_lost[j]=0; - en_ships_max[j]=0; + + en_capital[j] = 0; + en_capital_max[j] = 0; + en_capital_lost[j] = 0; + en_frigate[j] = 0; + en_frigate_max[j] = 0; + en_frigate_lost[j] = 0; + en_escort[j] = 0; + en_escort_max[j] = 0; + en_escort_lost[j] = 0; + en_ships_max[j] = 0; } } // Should be 0-5 for each of the factions - - - - -capital=0;capital_max=0;capital_lost=0; -frigate=0;frigate_max=0;frigate_lost=0; -escort=0;escort_max=0;escort_lost=0; -thunderhawk=0;thunderhawk_list=0; -ships_max=0; -ships_damaged=0; - -marines_lost=0; - -en_mutation=[]; -en_mutation[0]=""; -en_mutation[1]=""; -en_mutation[2]=""; - -// +capital = 0; +capital_max = 0; +capital_lost = 0; +frigate = 0; +frigate_max = 0; +frigate_lost = 0; +escort = 0; +escort_max = 0; +escort_lost = 0; +thunderhawk = 0; +thunderhawk_list = 0; +ships_max = 0; +ships_damaged = 0; + +marines_lost = 0; + +en_mutation = []; +en_mutation[0] = ""; +en_mutation[1] = ""; +en_mutation[2] = ""; + +// ambushers = scr_has_adv("Ambushers"); bolter_drilling = scr_has_adv("Bolter Drilling"); -enemy_eldar= scr_has_adv("Enemy: Eldar"); -enemy_fallen=scr_has_adv("Enemy: Fallen"); -enemy_orks=scr_has_adv("Enemy: Orks"); +enemy_eldar = scr_has_adv("Enemy: Eldar"); +enemy_fallen = scr_has_adv("Enemy: Fallen"); +enemy_orks = scr_has_adv("Enemy: Orks"); enemy_tau = scr_has_adv("Enemy: Tau"); -enemy_tyranids= scr_has_adv("Enemy: Tyranids"); -siege=scr_has_adv("Siege Masters"); -slow=scr_has_adv("Devastator Doctrine"); -melee=scr_has_adv("Assault Doctrine"); -// -black_rage=scr_has_disadv("Black Rage"); -shitty_luck=scr_has_disadv("Shitty Luck"); -favoured_by_the_warp=scr_has_adv("Favoured By The Warp"); -lyman=obj_ini.lyman;// drop pod penalties -omophagea=obj_ini.omophagea;// feast -ossmodula=obj_ini.ossmodula;// small penalty to all -membrane=obj_ini.membrane;// less chance of survival for wounded -betchers=obj_ini.betchers;// slight melee penalty -catalepsean=obj_ini.catalepsean;// minor global attack decrease -occulobe=obj_ini.occulobe;// penalty if morning and susceptible to flash grenades -mucranoid=obj_ini.mucranoid;// chance to short-circuit -// -global_melee=1; -global_bolter=1; -global_attack=1; -global_defense=1; +enemy_tyranids = scr_has_adv("Enemy: Tyranids"); +siege = scr_has_adv("Siege Masters"); +slow = scr_has_adv("Devastator Doctrine"); +melee = scr_has_adv("Assault Doctrine"); +// +black_rage = scr_has_disadv("Black Rage"); +shitty_luck = scr_has_disadv("Shitty Luck"); +favoured_by_the_warp = scr_has_adv("Favoured By The Warp"); +lyman = obj_ini.lyman; // drop pod penalties +omophagea = obj_ini.omophagea; // feast +ossmodula = obj_ini.ossmodula; // small penalty to all +membrane = obj_ini.membrane; // less chance of survival for wounded +betchers = obj_ini.betchers; // slight melee penalty +catalepsean = obj_ini.catalepsean; // minor global attack decrease +occulobe = obj_ini.occulobe; // penalty if morning and susceptible to flash grenades +mucranoid = obj_ini.mucranoid; // chance to short-circuit +// +global_melee = 1; +global_bolter = 1; +global_attack = 1; +global_defense = 1; // STC Bonuses -if (obj_controller.stc_bonus[5]=1) then global_defense+=0.1; -if (obj_controller.stc_bonus[5]=2) then global_attack=1.05; -if (obj_controller.stc_bonus[6]=1) then global_defense+=0.1; +if (obj_controller.stc_bonus[5] == 1) { + global_defense += 0.1; +} +if (obj_controller.stc_bonus[5] == 2) { + global_attack = 1.05; +} +if (obj_controller.stc_bonus[6] == 1) { + global_defense += 0.1; +} // Kings of Space Bonus -if (scr_has_adv("Kings of Space")){ - control=1; - global_defense+=0.1; - global_attack+=0.1; +if (scr_has_adv("Kings of Space")) { + control = 1; + global_defense += 0.1; + global_attack += 0.1; } - - -// -master=0; -time=0; - +// +master = 0; +time = 0; init_player_fleet_arrays(); ship_id = []; - // screwing around below here -alarm[6]=2; -// +alarm[6] = 2; +// // waiting at this point- show loading screen // in this time the obj_controller passes over which units will be fighting, similar to the below code -column[0]=""; -column_width[0]=0; -column_num[0]=0;// This is determined at the pre-battle screen -column[1]=""; -column_width[1]=0; -column_num[1]=0; -column[2]=""; -column_width[2]=0; -column_num[3]=0; -column[3]="capital"; -column_width[3]=270; -column_num[3]=0; -column[4]="frigate"; -column_width[4]=140; -column_num[4]=0; -column[5]="escort"; -column_width[5]=76; -column_num[5]=0;// Furthest right - - -color_index=0; +column[0] = ""; +column_width[0] = 0; +column_num[0] = 0; // This is determined at the pre-battle screen +column[1] = ""; +column_width[1] = 0; +column_num[1] = 0; +column[2] = ""; +column_width[2] = 0; +column_num[3] = 0; +column[3] = "capital"; +column_width[3] = 270; +column_num[3] = 0; +column[4] = "frigate"; +column_width[4] = 140; +column_num[4] = 0; +column[5] = "escort"; +column_width[5] = 76; +column_num[5] = 0; // Furthest right + +color_index = 0; /* */ /* */ diff --git a/objects/obj_fleet/Draw_64.gml b/objects/obj_fleet/Draw_64.gml index bca3eebfd7..896c232476 100644 --- a/objects/obj_fleet/Draw_64.gml +++ b/objects/obj_fleet/Draw_64.gml @@ -1,4 +1,4 @@ -var _ui_green = CM_GREEN_COLOR +var _ui_green = CM_GREEN_COLOR; var _text_color = #080000; var _surface_w = surface_get_width(application_surface); var _surface_h = surface_get_height(application_surface); @@ -15,7 +15,6 @@ var _bbox_y2; var _bbox_x_from_center; var _bbox_y_from_center; - if (left_down) { draw_set_alpha(0.5); draw_set_color(_ui_green); @@ -25,7 +24,7 @@ if (left_down) { draw_set_font(fnt_menu); // begin box -if (start==0) { +if (start == 0) { var _begin_x = _surface_w / 2; var _begin_y = 56; var _begin_w_half = 128; @@ -35,7 +34,7 @@ if (start==0) { draw_set_valign(fa_middle); _text_draw_width = string_width(_begin_text); _text_draw_height = string_height(_begin_text); - _bbox_x_from_center = ( _text_draw_width / 2) + _padding_x; + _bbox_x_from_center = (_text_draw_width / 2) + _padding_x; _bbox_y_from_center = (_text_draw_height / 2) + _padding_y; _bbox_x1 = _begin_x - _bbox_x_from_center; _bbox_y1 = _begin_y - _bbox_y_from_center; @@ -73,7 +72,7 @@ if (start < 7) { _stat_numbers += $"{_newline}{string(frigate)}"; } if (escort) { - _newline = (capital || frigate ? "\n" : ""); + _newline = capital || frigate ? "\n" : ""; _stat_headers += $"{_newline}Escorts:"; _stat_numbers += $"{_newline}{string(escort)}"; } @@ -83,7 +82,7 @@ if (start < 7) { draw_set_valign(fa_top); // add the widths for the box size plus a bit between - _text_draw_width = (string_width(_stat_headers) + string_width(_stat_numbers) + 8); + _text_draw_width = string_width(_stat_headers) + string_width(_stat_numbers) + 8; _text_draw_height = string_height(_stat_numbers); _bbox_x1 = 1; @@ -107,10 +106,10 @@ if (start < 7) { } // end of combat fade -if (combat_end <= 120){ +if (combat_end <= 120) { draw_set_color(0); draw_set_alpha((120 - combat_end) / 100); - draw_rectangle(0 ,0, room_width, room_height, 0); + draw_rectangle(0, 0, room_width, room_height, 0); } // end of combat results @@ -118,32 +117,28 @@ if (start == 7) { // ## todo: calculate all of this once at the end of the battle ## var _margin_categories = max(bool(capital_max) + bool(frigate_max) + bool(escort_max), 1); - var _margin_percent = ( - (max(capital, 0) / max(1, capital_max)) + - (max(frigate, 0) / max(1, frigate_max)) + - (max(escort, 0) / max(1, escort_max)) - ); + var _margin_percent = (max(capital, 0) / max(1, capital_max)) + (max(frigate, 0) / max(1, frigate_max)) + (max(escort, 0) / max(1, escort_max)); _margin_percent /= max(_margin_categories, 1); var _result_box_header; - if (_margin_percent>=0.95){ + if (_margin_percent >= 0.95) { _result_box_header = "Major Victory"; - } else if (_margin_percent>=0.75) { + } else if (_margin_percent >= 0.75) { _result_box_header = "Victory"; - } else if (_margin_percent>0.01) { + } else if (_margin_percent > 0.01) { _result_box_header = "Minor Victory"; - } else if (_margin_percent<=0.01){ + } else if (_margin_percent <= 0.01) { _result_box_header = "Defeat"; } var _result_box_footer = "[ Enter ] to Continue"; var _result_box_text = ""; - var _all_lost = capital_lost+frigate_lost+escort_lost; - var _wiped_out = _all_lost>=(capital_max+frigate_max+escort_max); + var _all_lost = capital_lost + frigate_lost + escort_lost; + var _wiped_out = _all_lost >= (capital_max + frigate_max + escort_max); if (capital_max) { _result_box_text += $"\nBattleships Lost: {string(capital_lost)} ({string((capital_lost / max(0, capital_max)) * 100)}%)"; } if (frigate_max) { - _result_box_text += $"\nCruisers Lost: {string(frigate_lost)} ({string((frigate_lost / max(0, frigate_max)) * 100)}%)" + _result_box_text += $"\nCruisers Lost: {string(frigate_lost)} ({string((frigate_lost / max(0, frigate_max)) * 100)}%)"; } if (escort_max) { _result_box_text += $"\nEscorts Lost: {string(escort_lost)} ({string((escort_lost / max(0, escort_max)) * 100)}%)"; @@ -168,10 +163,10 @@ if (start == 7) { var _result_image_w = 409; var _result_image_h = 247; - var _result_center_x = (_surface_w / 2); + var _result_center_x = _surface_w / 2; var _result_center_y = (_surface_h / 2) + (_result_image_h / 2) + _padding_y; - _bbox_x_from_center = ( _result_text_width / 2) + _padding_x; + _bbox_x_from_center = (_result_text_width / 2) + _padding_x; _bbox_y_from_center = (_result_text_height / 2) + _padding_y; _bbox_x1 = _result_center_x - _bbox_x_from_center; _bbox_y1 = _result_center_y - _bbox_y_from_center; diff --git a/objects/obj_fleet/KeyPress_13.gml b/objects/obj_fleet/KeyPress_13.gml index 52e27d6828..2e095abcc3 100644 --- a/objects/obj_fleet/KeyPress_13.gml +++ b/objects/obj_fleet/KeyPress_13.gml @@ -1,39 +1,33 @@ var __b__; __b__ = action_if_variable(obj_controller.cooldown, 0, 2); -if !__b__ -{ -__b__ = action_if_variable(start, 7, 0); -if !__b__ -{ -{ -start = 5; -// show_message(string(ships_max)); +if (!__b__) { + __b__ = action_if_variable(start, 7, 0); + if (!__b__) { + { + start = 5; + // show_message(string(ships_max)); -/*en_capital_max=en_capital; + /*en_capital_max=en_capital; en_frigate_max=en_frigate; en_escort_max=en_escort;*/ -beg=1; + beg = 1; -/* */ -} -} + /* */ + } + } } __b__ = action_if_variable(obj_controller.cooldown, 0, 2); -if !__b__ -{ -__b__ = action_if_variable(start, 7, 0); -if __b__ -{ - -// End battle crap here +if (!__b__) { + __b__ = action_if_variable(start, 7, 0); + if (__b__) { + // End battle crap here -instance_activate_all(); -game_set_speed(30, gamespeed_fps); -alarm[7]=1; + instance_activate_all(); + game_set_speed(30, gamespeed_fps); + alarm[7] = 1; - -/* */ -} + /* */ + } } /* */ diff --git a/objects/obj_fleet/KeyPress_32.gml b/objects/obj_fleet/KeyPress_32.gml index 5507da6098..20958c9684 100644 --- a/objects/obj_fleet/KeyPress_32.gml +++ b/objects/obj_fleet/KeyPress_32.gml @@ -1,4 +1,6 @@ -if (obj_controller.cooldown<=0){ - obj_controller.cooldown=8; - with(obj_controller){scr_zoom();} +if (obj_controller.cooldown <= 0) { + obj_controller.cooldown = 8; + with (obj_controller) { + scr_zoom(); + } } diff --git a/objects/obj_fleet/KeyPress_67.gml b/objects/obj_fleet/KeyPress_67.gml index 47f5d24a90..632facf1c3 100644 --- a/objects/obj_fleet/KeyPress_67.gml +++ b/objects/obj_fleet/KeyPress_67.gml @@ -1,4 +1,3 @@ - /*obj_p_capital.hp=0; obj_en_ship.hp=0; obj_en_ship.shields=0; diff --git a/objects/obj_fleet/Mouse_53.gml b/objects/obj_fleet/Mouse_53.gml index 1e74f5a699..8ea2b05f12 100644 --- a/objects/obj_fleet/Mouse_53.gml +++ b/objects/obj_fleet/Mouse_53.gml @@ -1,13 +1,16 @@ +if ((sel_x1 + sel_y1 == 0) && (control == 1)) { + if (instance_exists(obj_p_ship)) { + left_down = 50; + sel_x1 = mouse_x; + sel_y1 = mouse_y; + ships_selected = 0; -if (sel_x1+sel_y1=0) and (control=1){ - if (instance_exists(obj_p_ship)){ - left_down=50;sel_x1=mouse_x;sel_y1=mouse_y;ships_selected=0; - - with(obj_p_ship){ - if (keyboard_check(vk_shift)=false) then selected=0; - sel_x1=mouse_x;sel_y1=mouse_y; + with (obj_p_ship) { + if (keyboard_check(vk_shift) == false) { + selected = 0; + } + sel_x1 = mouse_x; + sel_y1 = mouse_y; } } } - - diff --git a/objects/obj_fleet/Mouse_56.gml b/objects/obj_fleet/Mouse_56.gml index 56954481b2..a295ca460e 100644 --- a/objects/obj_fleet/Mouse_56.gml +++ b/objects/obj_fleet/Mouse_56.gml @@ -1,46 +1,52 @@ +var pressy; +pressy = 0; +sel_x1 = 0; +sel_y1 = 0; + +if (instance_exists(obj_p_ship) && (control == 1)) { + left_down = 0; + with (obj_p_ship) { + var casey = 2; + sel_x2 = mouse_x; + sel_y2 = mouse_y; + + if (point_distance(sel_x1, sel_y1, sel_x2, sel_y2) < 30) { + casey = 1; + } - -var pressy;pressy=0; -sel_x1=0;sel_y1=0; - - -if (instance_exists(obj_p_ship)) and (control=1){ - left_down=0; - with(obj_p_ship){ - var casey=2; - sel_x2=mouse_x; - sel_y2=mouse_y; - - if (point_distance(sel_x1,sel_y1,sel_x2,sel_y2)<30) then casey=1; - - if (casey=1){ - selected=0; - if (point_distance(mouse_x,mouse_y,x,y)<=30){ - selected=1; - obj_fleet.ships_selected+=1; + if (casey == 1) { + selected = 0; + if (point_distance(mouse_x, mouse_y, x, y) <= 30) { + selected = 1; + obj_fleet.ships_selected += 1; } } - - if (casey=2){ - if point_in_rectangle(x,y,sel_x1,sel_y1,sel_x2,sel_y2){ - selected=1; - obj_fleet.ships_selected+=1; - } - else{ - if (!keyboard_check(vk_shift)) then selected=0; + + if (casey == 2) { + if (point_in_rectangle(x, y, sel_x1, sel_y1, sel_x2, sel_y2)) { + selected = 1; + obj_fleet.ships_selected += 1; + } else { + if (!keyboard_check(vk_shift)) { + selected = 0; + } } } - - sel_x1=0;sel_y1=0;sel_x2=0;sel_y2=0; + + sel_x1 = 0; + sel_y1 = 0; + sel_x2 = 0; + sel_y2 = 0; } } -if (start=5) and (obj_controller.zoomed=0){ - if (mouse_x>=__view_get( e__VW.XView, 0 )+12) and (mouse_y>=__view_get( e__VW.YView, 0 )+436) and (mouse_x<__view_get( e__VW.XView, 0 )+48) and (mouse_y<__view_get( e__VW.YView, 0 )+480) and (gamespeed_fps<90) then game_set_speed(gamespeed_fps+30, gamespeed_fps); +if ((start == 5) && (obj_controller.zoomed == 0)) { + if ((mouse_x >= __view_get(e__VW.XView, 0) + 12) && (mouse_y >= __view_get(e__VW.YView, 0) + 436) && (mouse_x < __view_get(e__VW.XView, 0) + 48) && (mouse_y < __view_get(e__VW.YView, 0) + 480) && (gamespeed_fps < 90)) { + game_set_speed(gamespeed_fps + 30, gamespeed_fps); + } } -if (start=5) and (obj_controller.zoomed=1){ - if (mouse_x>24) and (mouse_y>872) and (mouse_x<90) and (mouse_y<960) and (gamespeed_fps<90) then game_set_speed(gamespeed_fps+30, gamespeed_fps); +if ((start == 5) && (obj_controller.zoomed == 1)) { + if ((mouse_x > 24) && (mouse_y > 872) && (mouse_x < 90) && (mouse_y < 960) && (gamespeed_fps < 90)) { + game_set_speed(gamespeed_fps + 30, gamespeed_fps); + } } - - - diff --git a/objects/obj_fleet/Step_0.gml b/objects/obj_fleet/Step_0.gml index 475e3f1b9f..b809ff2182 100644 --- a/objects/obj_fleet/Step_0.gml +++ b/objects/obj_fleet/Step_0.gml @@ -1,52 +1,61 @@ - // if (woohoo<60) then woohoo+=1; - - -if (beg!=0)/* and (instance_exists(obj_fleet_controller))*/{ - if (combat_end>-1) and (instance_number(obj_en_ship)=0){ - combat_end-=1; - victory=true; +if (beg != 0) /* and (instance_exists(obj_fleet_controller))*/ { + if ((combat_end > -1) && (instance_number(obj_en_ship) == 0)) { + combat_end -= 1; + victory = true; } - if (combat_end>-1) and ((capital+frigate+escort)<=0) then combat_end-=1; - if (combat_end>-1){ - if (instance_exists(obj_p_ship)){ - var wooo=instance_nearest(room_width/2,room_height/2,obj_p_ship); - if (point_distance(wooo.x,wooo.y,room_width/2,room_height/2)>4000){ - //^have this be the same as roomSettings Height and Width or fleets will auto end! + if ((combat_end > -1) && ((capital + frigate + escort) <= 0)) { + combat_end -= 1; + } + if (combat_end > -1) { + if (instance_exists(obj_p_ship)) { + var wooo = instance_nearest(room_width / 2, room_height / 2, obj_p_ship); + if (point_distance(wooo.x, wooo.y, room_width / 2, room_height / 2) > 4000) { + //^have this be the same as roomSettings Height and Width or fleets will auto end! - combat_end-=1; - log_message("Fleet Combat Ended- Loss - Enemy:"+string(enemy[1])); + combat_end -= 1; + log_message("Fleet Combat Ended- Loss - Enemy:" + string(enemy[1])); } } } - - if (combat_end<=-1) and (start=5) and (instance_exists(obj_p_ship)){ - start=6; - obj_p_ship.alarm[3]=1; - alarm[0]=10; - log_message("Fleet Combat Ended- Victory - Enemy:"+string(enemy[1])); + + if ((combat_end <= -1) && (start == 5) && instance_exists(obj_p_ship)) { + start = 6; + obj_p_ship.alarm[3] = 1; + alarm[0] = 10; + log_message("Fleet Combat Ended- Victory - Enemy:" + string(enemy[1])); + } + + if ((combat_end > -1) && (instance_number(obj_en_ship) == 0)) { + combat_end -= 1; + } + if ((combat_end > -1) && (instance_number(obj_p_ship) == 0)) { + combat_end -= 1; } - - if (combat_end>-1) and (instance_number(obj_en_ship)=0) then combat_end-=1; - if (combat_end>-1) and (instance_number(obj_p_ship)=0) then combat_end-=1; } +if (start == 5) { + if ((player_lasers > 0) && instance_exists(obj_en_ship)) { + if ((player_lasers_target == 0) || (!instance_exists(player_lasers_target))) { + player_lasers_target = instance_nearest(-50, room_height / 2, obj_en_ship); + } -if (start=5){ - if (player_lasers>0) and (instance_exists(obj_en_ship)){ - if (player_lasers_target=0) or (!instance_exists(player_lasers_target)) then player_lasers_target=instance_nearest(-50,room_height/2,obj_en_ship); - - player_lasers_cd=max(player_lasers_cd-1,0); - if (player_lasers_cd<=0){ - player_lasers_cd=round(360/(player_lasers)); - repeat(min(2,player_lasers)){var las; - las=instance_create(x-150,random(room_height/2)+(room_height/4),obj_p_round); - las.direction=point_direction(las.x,las.y,player_lasers_target.x,player_lasers_target.y)+round(random_range(-4,4)); - las.image_xscale=1.5;las.image_yscale=1.5;las.speed=30;las.dam=30; - las.sprite_index=spr_ground_las;las.image_index=0;las.image_speed=0; + player_lasers_cd = max(player_lasers_cd - 1, 0); + if (player_lasers_cd <= 0) { + player_lasers_cd = round(360 / player_lasers); + repeat (min(2, player_lasers)) { + var las; + las = instance_create(x - 150, random(room_height / 2) + (room_height / 4), obj_p_round); + las.direction = point_direction(las.x, las.y, player_lasers_target.x, player_lasers_target.y) + round(random_range(-4, 4)); + las.image_xscale = 1.5; + las.image_yscale = 1.5; + las.speed = 30; + las.dam = 30; + las.sprite_index = spr_ground_las; + las.image_index = 0; + las.image_speed = 0; } - } } } From f8633e8cf2ff8b188249c7218fb77549b7bc1751 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 14:13:01 -0500 Subject: [PATCH 20/45] ChapterMaster.yyp wants to auto change this line everytime i open the project and I don't see anything wrong with it? --- ChapterMaster.yyp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index a42a578b15..e0d95bc698 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -2,7 +2,7 @@ "$GMProject":"v1", "%Name":"ChapterMaster", "AudioGroups":[ - {"$GMAudioGroup":"","%Name":"audiogroup_default","name":"audiogroup_default","resourceType":"GMAudioGroup","resourceVersion":"2.0","targets":-1,}, + {"$GMAudioGroup":"v1","%Name":"audiogroup_default","exportDir":"","name":"audiogroup_default","resourceType":"GMAudioGroup","resourceVersion":"2.0","targets":-1,}, ], "configs":{ "children":[], @@ -581,7 +581,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.14.1.210", + "IDEVersion":"2024.1400.2.926", }, "name":"ChapterMaster", "resources":[ From f1d88952d2d02e78d014034b616a6eb97a683f34 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 14:15:28 -0500 Subject: [PATCH 21/45] linted scr_draw_unit_stat_data.gml --- ChapterMaster.yyp | 2 +- .../scr_draw_unit_stat_data.gml | 554 ++++++++---------- 2 files changed, 254 insertions(+), 302 deletions(-) diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index e0d95bc698..b26c7076e2 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -581,7 +581,7 @@ "isEcma":false, "LibraryEmitters":[], "MetaData":{ - "IDEVersion":"2024.1400.2.926", + "IDEVersion":"2024.1400.2.941", }, "name":"ChapterMaster", "resources":[ diff --git a/scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml b/scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml index 780b9f9c9f..185813d8ea 100644 --- a/scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml +++ b/scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml @@ -1,324 +1,276 @@ // Script assets have changed for v2.3.0 see // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information -function scr_draw_unit_stat_data(manage=false, data_block = { - x1: 1008, - y1: 520, - w: 569, - h: 303, -}, squeezed = false){ - var _cur_font = draw_get_font(); - draw_set_font(fnt_40k_14); - if (event_number==ev_gui){ - xx=0; - yy=0; - } else { - var xx=__view_get( e__VW.XView, 0 )+0; - var yy=__view_get( e__VW.YView, 0 )+0; - } - var stat_tool_tips = []; - var trait_tool_tips = []; - var unit_name = name(); - if (psionic < 0) { - var _psy_levels = ARR_negative_psy_levels; - var _psionic_assignment = _psy_levels[psionic * -1] - } else { - var _psy_levels = ARR_psy_levels - var _psionic_assignment = _psy_levels[psionic] - } - data_block.x1 += xx; - data_block.y1 += yy; - data_block.x2 = data_block.x1 + data_block.w; - data_block.y2 = data_block.y1 + data_block.h; - data_block.x_mid = (data_block.x1 + data_block.x2) / 2; - data_block.y_mid = (data_block.y1 + data_block.y2) / 2; +function scr_draw_unit_stat_data( + manage = false, + data_block = { + x1: 1008, + y1: 520, + w: 569, + h: 303, + }, + squeezed = false +) { + var _cur_font = draw_get_font(); + draw_set_font(fnt_40k_14); + if (event_number == ev_gui) { + xx = 0; + yy = 0; + } else { + var xx = __view_get(e__VW.XView, 0) + 0; + var yy = __view_get(e__VW.YView, 0) + 0; + } + var stat_tool_tips = []; + var trait_tool_tips = []; + var unit_name = name(); + if (psionic < 0) { + var _psy_levels = ARR_negative_psy_levels; + var _psionic_assignment = _psy_levels[psionic * -1]; + } else { + var _psy_levels = ARR_psy_levels; + var _psionic_assignment = _psy_levels[psionic]; + } + data_block.x1 += xx; + data_block.y1 += yy; + data_block.x2 = data_block.x1 + data_block.w; + data_block.y2 = data_block.y1 + data_block.h; + data_block.x_mid = (data_block.x1 + data_block.x2) / 2; + data_block.y_mid = (data_block.y1 + data_block.y2) / 2; - var attribute_box = { - x1: data_block.x1 + (squeezed ? 42 : 84), - y1: data_block.y1 + 8, - w: 32, - h: 48, - enter : function(){ - return scr_hit(x1,y1,x2,y2); - }, - draw : function(outline){ - draw_rectangle(x1,y1,x2,y2,outline); - } - }; - attribute_box.x2 = attribute_box.x1 + attribute_box.w; - attribute_box.y2 = attribute_box.y1 + attribute_box.h; - attribute_box.x_mid = (attribute_box.x1 + attribute_box.x2) / 2; - attribute_box.y_mid = (attribute_box.y1 + attribute_box.y2) / 2; + var attribute_box = { + x1: data_block.x1 + (squeezed ? 42 : 84), + y1: data_block.y1 + 8, + w: 32, + h: 48, + enter: function() { + return scr_hit(x1, y1, x2, y2); + }, + draw: function(outline) { + draw_rectangle(x1, y1, x2, y2, outline); + }, + }; + attribute_box.x2 = attribute_box.x1 + attribute_box.w; + attribute_box.y2 = attribute_box.y1 + attribute_box.h; + attribute_box.x_mid = (attribute_box.x1 + attribute_box.x2) / 2; + attribute_box.y_mid = (attribute_box.y1 + attribute_box.y2) / 2; - stat_display_list = [ - [ - "Measure of how quick and nimble unit is as well as their base ability to manipulate and do tasks with their hands.##Influences Ranged Attack", - "dexterity"], + stat_display_list = [["Measure of how quick and nimble unit is as well as their base ability to manipulate and do tasks with their hands.##Influences Ranged Attack", "dexterity"], ["How strong a unit. Strong units can wield heavier equipment without penalties and are more deadly in close combat.##Influences Melee Attack#Influences Melee Burden Cap#Influences Ranged Burden Cap", "strength"], ["Unit's general toughness and resistance to damage.##Influences Health#Influences Damage Resistance", "constitution"], ["Measure of learnt knowledge and specialist skill aptitude.##Influences esoteric knowledge and use of force weapons", "intelligence"], ["Unit's perception and street smarts including certain types of battlefield knowledge.##Influences tactical decisions and garrison effects", "wisdom"], ["Unit's faith in their given religion or general aptitude towards faith.##Influences resistance to corruption", "piety"], ["General skill with close combat weaponry.##Influences Melee Attack#Influences Melee Burden Cap", "weapon_skill"], ["General skill with ballistic and ranged weaponry.##Influences Ranged Attack#Influences Ranged Burden Cap", "ballistic_skill"], ["...Luck...", "luck"], ["Skill and understanding of technology and various technical thingies and ability to interact with the machine spirit.##Influences Forge point output", "technology"], ["General likeability and ability to interact with people.##Influences disposition increases and decreases#Influences ability to spread corruption", "charisma"]]; + // draw_set_color(c_gray); + // draw_rectangle(stat_block.x1,stat_block.y1, stat_block.x1 + (36*array_length(stat_display_list)), stat_block.y1+48+8, 0) + // draw_set_color(c_black); + // draw_rectangle(stat_block.x1,stat_block.y1, stat_block.x1 + (4*array_length(stat_display_list)), stat_block.y1+48+4, 1) + var viewing_stat, icon_colour; + for (var i = 0; i < array_length(stat_display_list); i++) { + var stat_data = stat_display_list[i]; + var stat_key = stat_data[1]; + var stat_abbreviation = global.stat_shorts[$ stat_key]; + var _stat_name = global.stat_display_strings[$ stat_key]; + var _icon = global.stat_icons[$ stat_key]; + var _stat_description = stat_data[0]; + var _stat_col = global.stat_display_colour[$ stat_key]; - [ - "How strong a unit. Strong units can wield heavier equipment without penalties and are more deadly in close combat.##Influences Melee Attack#Influences Melee Burden Cap#Influences Ranged Burden Cap", - "strength"], + if (attribute_box.enter()) { + icon_colour = c_white; + draw_set_color(_stat_col); + attribute_box.draw(false); + } else { + icon_colour = c_gray; + } + //draw_rectangle(stat_square.x1-1,stat_square.y1-1,stat_square.x1+33,stat_square.y1+49, 1); + draw_set_color(c_gray); + attribute_box.draw(true); + draw_sprite_ext(_icon, 0, attribute_box.x1, attribute_box.y1, 0.5, 0.5, 0, icon_colour, 1); + draw_set_color(#50a076); + draw_set_halign(fa_center); + draw_text((attribute_box.x1 + attribute_box.x2) / 2, attribute_box.y1 + 32, $"{self[$ stat_key]}"); + draw_set_halign(fa_left); + if (manage) { + if (point_and_click([attribute_box.x1, attribute_box.y1, attribute_box.x2, attribute_box.y1 + 45])) { + filter_and_sort_company("stat", stat_key); + obj_controller.unit_bio = false; + } + } + var stat_percentage = 0; - [ - "Unit's general toughness and resistance to damage.##Influences Health#Influences Damage Resistance", - "constitution"], + if (is_struct(obj_controller.temp[122])) { + if (struct_exists(obj_controller.temp[122], stat_key)) { + stat_percentage = obj_controller.temp[122][$ stat_key]; + } + } + var _final_string = $"{_stat_description} #Click to order by highest {_stat_name}#{stat_percentage}% chance of growth"; + array_push(stat_tool_tips, [attribute_box.x1, attribute_box.y1, attribute_box.x2, attribute_box.y2, _final_string, $"{_stat_name} ({stat_abbreviation})"]); + attribute_box.x1 += 36; + attribute_box.x2 += 36; + } - [ - "Measure of learnt knowledge and specialist skill aptitude.##Influences esoteric knowledge and use of force weapons", - "intelligence"], + // var data_block.x_mid = stats_block.x1+((attribute_box.x1 - stats_block.x1)/2); + // var data_block.y_mid = attribute_box.y2+4; - [ - "Unit's perception and street smarts including certain types of battlefield knowledge.##Influences tactical decisions and garrison effects", - "wisdom" - ], + // draw_set_color(c_gray); + // draw_rectangle(data_block.x_mid-70,data_block.y_mid, data_block.x_mid+67, data_block.y_mid+70, 0); + // draw_set_color(c_black); + // draw_rectangle(data_block.x_mid-66,data_block.y_mid+1, data_block.x_mid-1, data_block.y_mid+65, 1); + // draw_rectangle(data_block.x_mid-66,data_block.y_mid,data_block.x_mid-1,data_block.y_mid+64, 0); - [ - "Unit's faith in their given religion or general aptitude towards faith.##Influences resistance to corruption", - "piety"], + // var psy_box = { + // x1: attribute_box.x2-36, + // y1: attribute_box.y1, + // w: attribute_box.w, + // h: attribute_box.h, + // } + // psy_box.x2 = psy_box.x1 + psy_box.w; + // psy_box.y2 = psy_box.y1 + psy_box.h; + // psy_box.x_mid = (psy_box.x1 + psy_box.x2) / 2; + // psy_box.y_mid = (psy_box.y1 + psy_box.y2) / 2; + // draw_set_color(c_gray); + // draw_rectangle(psy_box.x1,psy_box.y1,psy_box.x2,psy_box.y2, 1); + // draw_set_color(c_white); + // draw_sprite_stretched(spr_warp_level_icon, 2, psy_box.x1, psy_box.y1, psy_box.w, psy_box.h); + // draw_set_halign(fa_center); + // draw_set_valign(fa_middle); + // draw_text(psy_box.x_mid, psy_box.y_mid+3, $"{psionic}") + // var assignment_description = "The Imperium measures and records the psionic activity and power level of psychic individuals through a rating system called The Assignment. Comprised of a twenty-four point scale, The Assignment simplifies the comparison of psykers to aid Imperial authorities in recognizing possible threats."; + // array_push(stat_tool_tips, [psy_box.x1, psy_box.y1, psy_box.x2, psy_box.y2, assignment_description, "The Assignment"]); - [ - "General skill with close combat weaponry.##Influences Melee Attack#Influences Melee Burden Cap", - "weapon_skill"], + // var forge_box = { + // x1: attribute_box.x2, + // y1: attribute_box.y1, + // w: attribute_box.w, + // h: attribute_box.h, + // } + // forge_box.x2 = forge_box.x1 + forge_box.w; + // forge_box.y2 = forge_box.y1 + forge_box.h; + // forge_box.x_mid = (forge_box.x1 + forge_box.x2) / 2; + // forge_box.y_mid = (forge_box.y1 + forge_box.y2) / 2; + // //draw_rectangle(data_block.x_mid+1,data_block.y_mid+2,data_block.x_mid+1,data_block.y_mid+34, 0); + // var is_forge = IsSpecialist(SPECIALISTS_TECHS); + // if (is_forge){ + // draw_set_color(c_gray); + // draw_rectangle(forge_box.x1,forge_box.y1,forge_box.x2,forge_box.y2, 1); + // draw_set_color(c_white); + // draw_sprite_stretched(spr_forge_points_icon, 1, forge_box.x1-6, forge_box.y1-4, forge_box.w+12, forge_box.h+8); + // draw_set_halign(fa_center); + // draw_set_valign(fa_middle); + // draw_text(forge_box.x_mid, forge_box.y_mid, $"{forge_point_generation()[0]}"); + // var forge_description = ""; + // array_push(stat_tool_tips, [forge_box.x1,forge_box.y1,forge_box.x2,forge_box.y2, $"{forge_point_generation()}", "Craftsmanship"]); + // } - [ - "General skill with ballistic and ranged weaponry.##Influences Ranged Attack#Influences Ranged Burden Cap", - "ballistic_skill" - ], + //var warp_box_size = tooltip_draw(stat_square.x1,stat_square.y1+56,$"Warp Level:{psionic}"); + //draw_set_color(c_red); + //if (IsSpecialist(SPECIALISTS_TECHS)){ + // tooltip_draw(stat_square.x1,stat_square.y1+45+warp_box_size[1],$"Forge Points:{forge_point_generation()}"); + //} + // draw_line(stat_block.x1, yy+519, stat_block.x1, yy+957); + // draw_line(stat_square.x1, yy+519, stat_square.x1, yy+957); - [ - "...Luck...", - "luck" - ], + draw_set_halign(fa_left); + draw_set_valign(fa_top); + draw_set_color(#50a076); - [ + if (!obj_controller.view_squad && obj_controller.unit_bio) { + var unit_data_string = unit_profile_text(); + tooltip_draw(unit_data_string, 925, [xx + 23, yy + 141],,,,, true); + } - "Skill and understanding of technology and various technical thingies and ability to interact with the machine spirit.##Influences Forge point output", - "technology" - ], + var data_lines = []; + var data_entry = {}; + data_entry.text = $"Loyalty: {loyalty}\n"; + data_entry.tooltip = "Loyalty represents the unwavering devotion to one's Chapter, their Primarch, and the Emperor himself. It is a measure of their ability to resist the temptations of Chaos, the influence of xenos artifacts, and the machinations of the Warp."; + array_push(data_lines, data_entry); - [ - "General likeability and ability to interact with people.##Influences disposition increases and decreases#Influences ability to spread corruption", - "charisma" - ], - ] - // draw_set_color(c_gray); - // draw_rectangle(stat_block.x1,stat_block.y1, stat_block.x1 + (36*array_length(stat_display_list)), stat_block.y1+48+8, 0) - // draw_set_color(c_black); - // draw_rectangle(stat_block.x1,stat_block.y1, stat_block.x1 + (4*array_length(stat_display_list)), stat_block.y1+48+4, 1) - var viewing_stat,icon_colour; - for (var i=0; i 0) { + repeat (max(floor(_stat_val / 2), 1)) { + descriptive_string += "+"; + } + } else { + repeat (max(floor((_stat_val * -1) / 2), 1)) { + descriptive_string += "-"; + } + } + _trait_growth_effect += $"{_stat_name} : {descriptive_string}\n"; + } + } + array_push(trait_tool_tips, [x1, y1, x2, y2, $"{trait_description}\n{trait_effect}\n{_trait_growth_effect}" + trait_effect]); + } + } else { + draw_set_halign(fa_right); + draw_text(data_block.x2 - 16, attribute_box.y2 + 16, "No Traits"); + draw_set_halign(fa_left); + } - // var forge_box = { - // x1: attribute_box.x2, - // y1: attribute_box.y1, - // w: attribute_box.w, - // h: attribute_box.h, - // } - // forge_box.x2 = forge_box.x1 + forge_box.w; - // forge_box.y2 = forge_box.y1 + forge_box.h; - // forge_box.x_mid = (forge_box.x1 + forge_box.x2) / 2; - // forge_box.y_mid = (forge_box.y1 + forge_box.y2) / 2; - // //draw_rectangle(data_block.x_mid+1,data_block.y_mid+2,data_block.x_mid+1,data_block.y_mid+34, 0); - // var is_forge = IsSpecialist(SPECIALISTS_TECHS); - // if (is_forge){ - // draw_set_color(c_gray); - // draw_rectangle(forge_box.x1,forge_box.y1,forge_box.x2,forge_box.y2, 1); - // draw_set_color(c_white); - // draw_sprite_stretched(spr_forge_points_icon, 1, forge_box.x1-6, forge_box.y1-4, forge_box.w+12, forge_box.h+8); - // draw_set_halign(fa_center); - // draw_set_valign(fa_middle); - // draw_text(forge_box.x_mid, forge_box.y_mid, $"{forge_point_generation()[0]}"); - // var forge_description = ""; - // array_push(stat_tool_tips, [forge_box.x1,forge_box.y1,forge_box.x2,forge_box.y2, $"{forge_point_generation()}", "Craftsmanship"]); - // } + for (var i = 0; i < array_length(stat_tool_tips); i++) { + if (scr_hit(stat_tool_tips[i])) { + tooltip_draw(stat_tool_tips[i][4], 300, [stat_tool_tips[i][0], stat_tool_tips[i][3]],,, stat_tool_tips[i][5]); + } + } + for (var i = 0; i < array_length(trait_tool_tips); i++) { + if (point_in_rectangle(mouse_x, mouse_y, trait_tool_tips[i][2], trait_tool_tips[i][1], trait_tool_tips[i][0], trait_tool_tips[i][3])) { + tooltip_draw(trait_tool_tips[i][4], 300); + } + } - //var warp_box_size = tooltip_draw(stat_square.x1,stat_square.y1+56,$"Warp Level:{psionic}"); - //draw_set_color(c_red); - //if (IsSpecialist(SPECIALISTS_TECHS)){ - // tooltip_draw(stat_square.x1,stat_square.y1+45+warp_box_size[1],$"Forge Points:{forge_point_generation()}"); - //} - // draw_line(stat_block.x1, yy+519, stat_block.x1, yy+957); - // draw_line(stat_square.x1, yy+519, stat_square.x1, yy+957); - - draw_set_halign(fa_left); - draw_set_valign(fa_top); - draw_set_color(#50a076); - - if (!obj_controller.view_squad && obj_controller.unit_bio){ - var unit_data_string = unit_profile_text(); - tooltip_draw(unit_data_string, 925, [xx+23,yy+141],,,,,true); - } - - var data_lines = []; - var data_entry = {}; - data_entry.text = $"Loyalty: {loyalty}\n"; - data_entry.tooltip = "Loyalty represents the unwavering devotion to one's Chapter, their Primarch, and the Emperor himself. It is a measure of their ability to resist the temptations of Chaos, the influence of xenos artifacts, and the machinations of the Warp."; - array_push(data_lines, data_entry); - - data_entry = {}; - data_entry.text = $"Corruption: {corruption}\n"; - data_entry.tooltip = "Corruption reflects exposure to the malevolent forces of the Warp. High Corruption may indicate that the person is teetering on the brink of damnation, while a low score suggests relative purity."; - array_push(data_lines, data_entry); - - data_entry = {}; - data_entry.text = $"Assignment: {_psionic_assignment} ({psionic})\n"; - data_entry.tooltip = "The Imperium measures and records the psionic activity and power level of psychic individuals through a rating system called The Assignment. Comprised of a twenty-four point scale, The Assignment simplifies the comparison of psykers to aid Imperial authorities in recognizing possible threats."; - array_push(data_lines, data_entry); - - var forge_gen = forge_point_generation(); - - data_entry = {}; - data_entry.tooltip=""; - var gen_reasons = forge_gen[1]; - data_entry.text = $"Forge Production: {forge_gen[0]}\n"; - if (struct_exists(gen_reasons, "trained")){ - data_entry.tooltip+=$"Trained On Mars (TEC/10): {gen_reasons.trained}\n"; - if (struct_exists(gen_reasons, "at_forge")){ - data_entry.tooltip+=$"{gen_reasons.at_forge}(at Forge)\n"; - } - } - if (struct_exists(gen_reasons, "master")){ - data_entry.tooltip+=$"Forge Master: +{gen_reasons.master}\n"; - } - if (struct_exists(gen_reasons, "crafter")){ - data_entry.tooltip+=$"Crafter: +{gen_reasons.crafter}\n"; - } - if (struct_exists(gen_reasons, "maintenance")){ - data_entry.tooltip+=$"Maintenance: {gen_reasons.maintenance}"; - } - array_push(data_lines, data_entry); - - - for (var i = 0; i < array_length(data_lines); i++) { - draw_text(data_block.x1+16, attribute_box.y2+16+(i*24), data_lines[i].text); // Adjust the y-coordinate for the new line - array_push(stat_tool_tips, [data_block.x1+16, attribute_box.y2+16+(i*24), data_block.x1+16+string_width(data_lines[i].text), attribute_box.y2+16+(i*24)+string_height(data_lines[i].text), data_lines[i].tooltip, ""]); - } - - var x1 = squeezed ? data_block.x1 + ((data_block.x2- data_block.x1)/2) +32: data_block.x2-16; - if (array_length(traits) != 0) { - for (var i=0; i0){ - repeat(max(floor(_stat_val/2),1)){ - descriptive_string += "+" - } - } else { - repeat(max(floor((_stat_val*-1)/2),1)){ - descriptive_string += "-" - } - } - _trait_growth_effect += $"{_stat_name} : {descriptive_string}\n"; - } - } - array_push(trait_tool_tips, [x1, y1, x2, y2, $"{trait_description}\n{trait_effect}\n{_trait_growth_effect}" + trait_effect]); - } - } else { - draw_set_halign(fa_right); - draw_text(data_block.x2-16, attribute_box.y2+16, "No Traits"); - draw_set_halign(fa_left); - } - - for (var i=0;i Date: Sat, 27 Dec 2025 14:23:05 -0500 Subject: [PATCH 22/45] refactored GENDER enum to eGENDER according to COD_STYLE.md --- scripts/macros/macros.gml | 4 ++-- scripts/scr_string_functions/scr_string_functions.gml | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index 965db1bad0..71dd256791 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -42,14 +42,14 @@ enum eFACTION { Necrons = 13 } -enum GENDER { +enum eGENDER { Female, Male, Neutral } function set_gender(){ - return choose(GENDER.Female, GENDER.Male); + return choose(eGENDER.Female, eGENDER.Male); } enum MENU { diff --git a/scripts/scr_string_functions/scr_string_functions.gml b/scripts/scr_string_functions/scr_string_functions.gml index be4a53485c..154c304d95 100644 --- a/scripts/scr_string_functions/scr_string_functions.gml +++ b/scripts/scr_string_functions/scr_string_functions.gml @@ -22,10 +22,10 @@ function string_upper_first(_string) { function string_gender_third_person(gender){ var _string = "they"; switch(gender){ - case GENDER.Female: + case eGENDER.Female: _string = "she"; break; - case GENDER.Male: + case eGENDER.Male: _string = "he"; break; } @@ -37,13 +37,13 @@ function string_gender_third_person(gender){ function string_gender_pronouns(gender){ var _string = "their"; switch(gender){ - case GENDER.Female: + case eGENDER.Female: _string ="her" break; - case GENDER.Male: + case eGENDER.Male: _string ="his" break; - case GENDER.Neutral: + case eGENDER.Neutral: _string = "their"; break; } From 7babd507eb4928b63e00a0df7b25b21164f95cb0 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 14:38:58 -0500 Subject: [PATCH 23/45] Refactored MENU enum to eMENU according to CODE_STYLE.md --- objects/obj_controller/Create_0.gml | 264 +++--------------- objects/obj_controller/Draw_0.gml | 2 +- objects/obj_controller/Draw_64.gml | 12 +- objects/obj_controller/Mouse_50.gml | 10 +- objects/obj_controller/Step_0.gml | 2 +- objects/obj_event_log/Draw_0.gml | 2 +- objects/obj_img/Step_0.gml | 2 +- objects/obj_star/Mouse_50.gml | 2 +- objects/obj_turn_end/Alarm_1.gml | 2 +- scripts/is_specialist/is_specialist.gml | 2 +- scripts/macros/macros.gml | 10 +- .../scr_controller_helpers.gml | 64 ++--- .../scr_diplomacy_helpers.gml | 2 +- scripts/scr_draw_rainbow/scr_draw_rainbow.gml | 4 +- .../scr_planetary_feature.gml | 4 +- scripts/scr_ui_advisors/scr_ui_advisors.gml | 10 +- scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml | 2 +- scripts/scr_ui_manage/scr_ui_manage.gml | 4 +- 18 files changed, 107 insertions(+), 293 deletions(-) diff --git a/objects/obj_controller/Create_0.gml b/objects/obj_controller/Create_0.gml index 7347a07918..cf6565edba 100644 --- a/objects/obj_controller/Create_0.gml +++ b/objects/obj_controller/Create_0.gml @@ -97,10 +97,7 @@ chapter_made = 0; map_scale = 1; scale_mod = 1; unit_manage_constants = {}; -unit_manage_constants.current_data = [ - -1, - -1 -]; +unit_manage_constants.current_data = [-1, -1]; management_buttons = false; diplomacy_pathway = ""; @@ -111,12 +108,7 @@ ready = false; chaos_gods = {}; function build_chaos_gods() { - var _god_names = [ - "Khorne", - "Slaanesh", - "Nurgle", - "Tzeentch" - ]; + var _god_names = ["Khorne", "Slaanesh", "Nurgle", "Tzeentch"]; for (var _i = 0; _i < 4; _i++) { chaos_gods[$ _god_names[_i]] = {}; chaos_gods[$ _god_names[_i]].favour = 0; @@ -393,10 +385,7 @@ unit_focus = false; filter_mode = false; manage_tags = []; pauldron_trim = 0; -last_unit = [ - 0, - 0 -]; +last_unit = [0, 0]; ui_coloring = ""; ui_melee_penalty = 0; ui_ranged_penalty = 0; @@ -535,126 +524,41 @@ player_forge_data = { selection_data = false; selections = []; production_research = { - flame: [ - 0, - {} - ], - bolt: [ - 1, - {} - ], - plasma: [ - 0, - {} - ], - psi: [ - 0, - {} - ], - melta: [ - 0, - {} - ], - grav: [ - 0, - {} - ], - chasis: [ - 0, - {} - ], - chain: [ - 0, - {} - ], - power_fields: [ - 1, - {} - ], - las: [ - 0, - {} - ], + flame: [0, {}], + bolt: [1, {}], + plasma: [0, {}], + psi: [0, {}], + melta: [0, {}], + grav: [0, {}], + chasis: [0, {}], + chain: [0, {}], + power_fields: [1, {}], + las: [0, {}], armour: [ 0, { - stealth: [ - 0, - {} - ], - armour: [ - 0, - {} - ], + stealth: [0, {}], + armour: [0, {}], } ], }; production_research_pathways = { - flame: [ - ["Promethium Tank Brazing"], - {} - ], - bolt: [ - [ - "Hardened Barrel Boring", - "Projectile Propellant Purification" - ], - {} - ], - plasma: [ - ["Plasma Coil Magnetization"], - {} - ], - psi: [ - ["Psionic Resonance Valves"], - {} - ], - melta: [ - ["Atomic Chamber Construction"], - {} - ], - grav: [ - ["Gravitic Reaction Principle"], - {} - ], - chasis: [ - [], - {} - ], - chain: [ - ["Adamantine Links"], - {} - ], - power_fields: [ - [ - "Power Field Cooling", - "Mono-molecular Edge Sheathing" - ], - {} - ], - las: [ - ["Light Condensement Chamber"], - {} - ], + flame: [["Promethium Tank Brazing"], {}], + bolt: [["Hardened Barrel Boring", "Projectile Propellant Purification"], {}], + plasma: [["Plasma Coil Magnetization"], {}], + psi: [["Psionic Resonance Valves"], {}], + melta: [["Atomic Chamber Construction"], {}], + grav: [["Gravitic Reaction Principle"], {}], + chasis: [[], {}], + chain: [["Adamantine Links"], {}], + power_fields: [["Power Field Cooling", "Mono-molecular Edge Sheathing"], {}], + las: [["Light Condensement Chamber"], {}], armour: [ - [ - "Ceramite Casting Chambers", - "Enhanced Nerve Interfacing" - ], + ["Ceramite Casting Chambers", "Enhanced Nerve Interfacing"], { - stealth: [ - ["Advanced Servo Motors"], - {} - ], - armour: [ - [ - "Advanced Ceramite Bonding", - "Lightened Ceramite Compound", - "Ceremite Void Hardening" - ], - {} - ], + stealth: [["Advanced Servo Motors"], {}], + armour: [["Advanced Ceramite Bonding", "Lightened Ceramite Compound", "Ceremite Void Hardening"], {}], } ], }; @@ -851,31 +755,7 @@ random_event_next = EVENT.none; useful_info = ""; // ** Sets the reason for loss of loyalty ** -var loyalReasons = [ - "Heretic Contact", - "Heretical Homeworld", - "Traitorous Marines", - "Use of Sorcery", - "Mutant Gene-Seed", - "Non-Codex Arming", - "Non-Codex Size", - "Lack of Apothecary", - "Upset Machine Spirits", - "Undevout", - "Irreverence for His Servants", - "Unvigilant", - "Conduct Unbecoming", - "Refusing to Crusade", - "Eldar Contact", - "Ork Contact", - "Tau Contact", - "Xeno Trade", - "Xeno Associate", - "Inquisitor Killer", - "Crossing the Inquisition", - "Avoiding Inspections", - "Lost Standard" -]; +var loyalReasons = ["Heretic Contact", "Heretical Homeworld", "Traitorous Marines", "Use of Sorcery", "Mutant Gene-Seed", "Non-Codex Arming", "Non-Codex Size", "Lack of Apothecary", "Upset Machine Spirits", "Undevout", "Irreverence for His Servants", "Unvigilant", "Conduct Unbecoming", "Refusing to Crusade", "Eldar Contact", "Ork Contact", "Tau Contact", "Xeno Trade", "Xeno Associate", "Inquisitor Killer", "Crossing the Inquisition", "Avoiding Inspections", "Lost Standard"]; for (var i = 0; i < array_length(loyalReasons); i++) { loyal[i + 1] = loyalReasons[i]; @@ -969,12 +849,7 @@ bat_landspeeder_column = 4; bat_scout_column = 1; // ** Sets up disposition per faction ** -imperial_factions = [ - eFACTION.Imperium, - eFACTION.Mechanicus, - eFACTION.Inquisition, - eFACTION.Ecclesiarchy -]; +imperial_factions = [eFACTION.Imperium, eFACTION.Mechanicus, eFACTION.Inquisition, eFACTION.Ecclesiarchy]; faction[0] = ""; disposition[0] = 0; faction[eFACTION.Player] = "Player"; @@ -1279,22 +1154,7 @@ serialize = function() { forge_queue: specialist_point_handler.forge_queue, chapter_master_data: chapter_master, }; - var excluded_from_save = [ - "temp", - "serialize", - "deserialize", - "build_chaos_gods", - "company_data", - "menu_buttons", - "location_viewer", - "production_research_pathways", - "specialist_point_handler", - "spec_train_data", - "tooltips", - "last_unit", - "unit_manage_constants", - "unit_manage_image" - ]; + var excluded_from_save = ["temp", "serialize", "deserialize", "build_chaos_gods", "company_data", "menu_buttons", "location_viewer", "production_research_pathways", "specialist_point_handler", "spec_train_data", "tooltips", "last_unit", "unit_manage_constants", "unit_manage_image"]; var excluded_from_save_start = ["restart_"]; copy_serializable_fields(object_controller, save_data, excluded_from_save, excluded_from_save_start); @@ -1360,72 +1220,26 @@ spec_train_data = [ { name: "Techmarine", min_exp: 30, - coord_offset: [ - 0, - 0 - ], - req: [ - [ - "technology", - 34, - "exmore" - ] - ], + coord_offset: [0, 0], + req: [["technology", 34, "exmore"]], }, { name: "Librarian", min_exp: 0, - coord_offset: [ - 0, - -7 - ], - req: [ - [ - "psionic", - 1, - "exmore" - ] - ], + coord_offset: [0, -7], + req: [["psionic", 1, "exmore"]], }, { name: "Chaplain", min_exp: 60, - coord_offset: [ - 7, - -7 - ], - req: [ - [ - "piety", - 34, - "exmore" - ], - [ - "charisma", - 29, - "exmore" - ] - ], + coord_offset: [7, -7], + req: [["piety", 34, "exmore"], ["charisma", 29, "exmore"]], }, { name: "Apothecary", min_exp: 60, - coord_offset: [ - 7, - 0 - ], - req: [ - [ - "technology", - 29, - "exmore" - ], - [ - "intelligence", - 44, - "exmore" - ] - ], + coord_offset: [7, 0], + req: [["technology", 29, "exmore"], ["intelligence", 44, "exmore"]], } ]; // Redefines training based on chapter diff --git a/objects/obj_controller/Draw_0.gml b/objects/obj_controller/Draw_0.gml index 02cf79792e..1845317e74 100644 --- a/objects/obj_controller/Draw_0.gml +++ b/objects/obj_controller/Draw_0.gml @@ -12,7 +12,7 @@ try { handle_exception(_exception); main_map_defaults(); } -if (menu == MENU.Diplomacy) { +if (menu == eMENU.Diplomacy) { try { /*if (audience > 0 && instance_exists(obj_turn_end)){ menu = 20; diff --git a/objects/obj_controller/Draw_64.gml b/objects/obj_controller/Draw_64.gml index 429ebd5819..860f46ef23 100644 --- a/objects/obj_controller/Draw_64.gml +++ b/objects/obj_controller/Draw_64.gml @@ -34,7 +34,7 @@ draw_set_valign(fa_top); draw_set_halign(fa_left); var xx = 0; var yy = 0; -if (menu == MENU.Diplomacy) { +if (menu == eMENU.Diplomacy) { add_draw_return_values(); if (diplomacy > 0) { draw_diplomacy_diplo_text(); @@ -61,7 +61,7 @@ if (menu == MENU.Diplomacy) { // Main UI if (!zoomed && !zui) { add_draw_return_values(); - if (menu == MENU.Default) { + if (menu == eMENU.Default) { location_viewer.draw(); helpful_places_button .update({ @@ -265,7 +265,7 @@ function draw_line(x1, y1, y_slide, variable) { } try { - if (menu == MENU.Manage) { + if (menu == eMENU.Manage) { if (managing != 0) { draw_sprite_and_unit_equip_data(); } @@ -275,14 +275,14 @@ try { if (managing > 0) { company_specific_management(); } - } else if (menu == MENU.Armamentarium) { + } else if (menu == eMENU.Armamentarium) { scr_draw_armentarium_gui(); - } else if (menu == MENU.Librarium) { + } else if (menu == eMENU.Librarium) { scr_librarium_gui(); } } catch (_exception) { handle_exception(_exception); - menu = MENU.Default; + menu = eMENU.Default; } pop_draw_return_values(); diff --git a/objects/obj_controller/Mouse_50.gml b/objects/obj_controller/Mouse_50.gml index 874218a7e2..0ca51e5bec 100644 --- a/objects/obj_controller/Mouse_50.gml +++ b/objects/obj_controller/Mouse_50.gml @@ -172,7 +172,7 @@ if ((menu == 15) && (cooldown <= 0)) { } */ // ** Diplomacy ** -if ((menu == MENU.Diplomacy) && (diplomacy > 0) || ((diplomacy < -5) && (diplomacy > -6)) && (cooldown <= 0) && (diplomacy < 10)) { +if ((menu == eMENU.Diplomacy) && (diplomacy > 0) || ((diplomacy < -5) && (diplomacy > -6)) && (cooldown <= 0) && (diplomacy < 10)) { if ((trading == 0) && valid_diplomacy_options()) { if ((force_goodbye == 0) && (cooldown <= 0)) {} if ((force_goodbye != 0) && (cooldown <= 0)) { @@ -200,7 +200,7 @@ if ((menu == MENU.Diplomacy) && (diplomacy > 0) || ((diplomacy < -5) && (diploma } } // Diplomacy -if ((zoomed == 0) && (cooldown <= 0) && (menu == MENU.Diplomacy) && (diplomacy == 0)) { +if ((zoomed == 0) && (cooldown <= 0) && (menu == eMENU.Diplomacy) && (diplomacy == 0)) { xx += 55; yy -= 20; var onceh = 0; @@ -236,12 +236,12 @@ scr_menu_clear_up(function() { yy = yy + 0; if ((mouse_x >= xx + 22) && (mouse_y >= yy + 84) && (mouse_x < xx + 98) && (mouse_y < yy + 126)) { - menu = MENU.Manage; + menu = eMENU.Manage; cooldown = 8000; } } // Selecting individual marines - if ((menu == MENU.Manage) && (managing > 0) || (managing < 0) && (!view_squad || !company_report)) { + if ((menu == eMENU.Manage) && (managing > 0) || (managing < 0) && (!view_squad || !company_report)) { var unit; var eventing = false, bb = ""; xx = __view_get(e__VW.XView, 0) + 0; @@ -270,7 +270,7 @@ scr_menu_clear_up(function() { if ((menu == 50) && (managing > 0) && (cooldown <= 0)) { if ((mouse_x >= xx + 217) && (mouse_y >= yy + 28) && (mouse_x < xx + 250) && (mouse_y < yy + 59)) { cooldown = 8; - menu = MENU.Manage; + menu = eMENU.Manage; click = 1; } } diff --git a/objects/obj_controller/Step_0.gml b/objects/obj_controller/Step_0.gml index 22c4b5b739..68199fbac2 100644 --- a/objects/obj_controller/Step_0.gml +++ b/objects/obj_controller/Step_0.gml @@ -490,7 +490,7 @@ try { income = income_base + income_home + income_forge + income_agri + income_training + income_fleet + income_trade + income_tribute; - if ((menu == MENU.Diplomacy) && ((diplomacy > 0) || ((diplomacy < -5) && (diplomacy > -6)))) { + if ((menu == eMENU.Diplomacy) && ((diplomacy > 0) || ((diplomacy < -5) && (diplomacy > -6)))) { if (string_length(diplo_txt) < string_length(diplo_text)) { diplo_char += 2; diplo_txt = string_copy(diplo_text, 0, diplo_char); diff --git a/objects/obj_event_log/Draw_0.gml b/objects/obj_event_log/Draw_0.gml index 6b22dfde5b..648165e557 100644 --- a/objects/obj_event_log/Draw_0.gml +++ b/objects/obj_event_log/Draw_0.gml @@ -3,7 +3,7 @@ __b__ = action_if_variable(help, 0, 0); if (__b__) { var bad = 1; if (instance_exists(obj_controller)) { - if (obj_controller.menu == MENU.EventLog) { + if (obj_controller.menu == eMENU.EventLog) { bad = 0; } } diff --git a/objects/obj_img/Step_0.gml b/objects/obj_img/Step_0.gml index 089596a41e..513edc1c2d 100644 --- a/objects/obj_img/Step_0.gml +++ b/objects/obj_img/Step_0.gml @@ -7,7 +7,7 @@ if (!instance_exists(obj_fleet)) and (!instance_exists(obj_ncombat)){ if (instance_exists(obj_controller)){ - if (obj_controller.diplomacy=0) and (obj_controller.menu==MENU.Diplomacy) and (diplomacy_icon_good=false){ + if (obj_controller.diplomacy=0) and (obj_controller.menu==eMENU.Diplomacy) and (diplomacy_icon_good=false){ scr_image("diplomacy_icon",-50,0,0,0,0); scr_image("symbol",-50,0,0,0,0); } diff --git a/objects/obj_star/Mouse_50.gml b/objects/obj_star/Mouse_50.gml index 6b72c6513d..0688d6ed71 100644 --- a/objects/obj_star/Mouse_50.gml +++ b/objects/obj_star/Mouse_50.gml @@ -1,5 +1,5 @@ // Checks which systems you can see the planets -if (obj_controller.menu != MENU.Default){ +if (obj_controller.menu != eMENU.Default){ exit; } if (instances_exist_any([obj_drop_select,obj_saveload,obj_bomb_select])){ diff --git a/objects/obj_turn_end/Alarm_1.gml b/objects/obj_turn_end/Alarm_1.gml index e8d9b3a34e..967517fd09 100644 --- a/objects/obj_turn_end/Alarm_1.gml +++ b/objects/obj_turn_end/Alarm_1.gml @@ -15,7 +15,7 @@ if (_is_audience){ show_debug_message(current_audience); - if (obj_controller.menu != MENU.Diplomacy){ + if (obj_controller.menu != eMENU.Diplomacy){ scr_toggle_diplomacy(); } obj_controller.audience=current_audience.faction; diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index d6718e8274..b1ef3ecd06 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -377,7 +377,7 @@ function group_selection(group, selection_data={}) { obj_controller.selection_data = selection_data; set_zoom_to_default(); with(obj_controller) { - if (menu != MENU.Manage){ + if (menu != eMENU.Manage){ scr_toggle_manage(); } else { basic_manage_settings(); diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index 71dd256791..ccaafbd621 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -2,10 +2,10 @@ #macro DEFAULT_TOOLTIP_VIEW_OFFSET 32 #macro DEFAULT_LINE_GAP -1 #macro LB_92 "############################################################################################" -#macro DATE_TIME_1 $"{current_day}-{current_month}-{current_year}-{format_time(current_hour)}{format_time(current_minute)}{format_time(format_time(current_second))}" -#macro DATE_TIME_2 $"{current_day}-{current_month}-{current_year}|{format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" -#macro DATE_TIME_3 $"{current_day}-{current_month}-{current_year} {format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" -#macro TIME_1 $"{format_time(current_hour)}:{format_time(current_minute)}:{format_time(current_second)}" +#macro DATE_TIME_1 current_day"-"current_month"-"current_year"-"format_time(current_hour)""format_time(current_minute)""format_time(format_time(current_second))"" +#macro DATE_TIME_2 current_day"-"current_month"-"current_year"|"format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" +#macro DATE_TIME_3 current_day"-"current_month"-"current_year" "format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" +#macro TIME_1 format_time(current_hour)":"format_time(current_minute)":"format_time(current_second)"" #macro CM_GREEN_COLOR #34bc75 #macro CM_RED_COLOR #bf4040 #macro MANAGE_MAN_SEE 34 @@ -52,7 +52,7 @@ function set_gender(){ return choose(eGENDER.Female, eGENDER.Male); } -enum MENU { +enum eMENU { Default = 0, Manage = 1, Apothecarion = 11, diff --git a/scripts/scr_controller_helpers/scr_controller_helpers.gml b/scripts/scr_controller_helpers/scr_controller_helpers.gml index d949869095..c4c245dbf5 100644 --- a/scripts/scr_controller_helpers/scr_controller_helpers.gml +++ b/scripts/scr_controller_helpers/scr_controller_helpers.gml @@ -97,7 +97,7 @@ function scr_change_menu(wanted_menu, specific_area_function = void()) { function main_map_defaults() { with (obj_controller) { - menu = MENU.Default; + menu = eMENU.Default; hide_banner = 0; location_viewer.update_garrison_log(); managing = 0; @@ -114,7 +114,7 @@ function main_map_defaults() { } function scr_in_game_help() { - scr_change_menu(MENU.GameHelp, function() { + scr_change_menu(eMENU.GameHelp, function() { with (obj_controller) { if ((zoomed == 0) && (!instance_exists(obj_ingame_menu)) && (!instance_exists(obj_popup))) { set_zoom_to_default(); @@ -144,7 +144,7 @@ function scr_in_game_menu() { function basic_manage_settings() { with (obj_controller) { - menu = MENU.Manage; + menu = eMENU.Manage; popup = 0; selected = 0; diplomacy = 0; @@ -181,9 +181,9 @@ function init_manage_buttons() { } function scr_toggle_manage() { - scr_change_menu(MENU.Manage, function() { + scr_change_menu(eMENU.Manage, function() { with (obj_controller) { - if (menu != MENU.Manage) { + if (menu != eMENU.Manage) { hide_banner = 1; basic_manage_settings(); scr_management(1); @@ -193,15 +193,15 @@ function scr_toggle_manage() { } function scr_toggle_setting() { - scr_change_menu(MENU.Settings, function() { + scr_change_menu(eMENU.Settings, function() { with (obj_controller) { - if (menu != MENU.Settings) { - menu = MENU.Settings; + if (menu != eMENU.Settings) { + menu = eMENU.Settings; popup = 0; selected = 0; hide_banner = 1; } else if (settings) { - menu = MENU.Settings; + menu = eMENU.Settings; cooldown = 8000; click = 1; settings = 0; @@ -211,15 +211,15 @@ function scr_toggle_setting() { } function scr_toggle_apothecarion() { - scr_change_menu(MENU.Apothecarion, function() { + scr_change_menu(eMENU.Apothecarion, function() { with (obj_controller) { menu_adept = 0; hide_banner = 1; if (scr_role_count("Master of the Apothecarion", "0") == 0) { menu_adept = 1; } - if (menu != MENU.Apothecarion) { - menu = MENU.Apothecarion; + if (menu != eMENU.Apothecarion) { + menu = eMENU.Apothecarion; temp[36] = scr_role_count(obj_ini.role[100][15], ""); } @@ -228,15 +228,15 @@ function scr_toggle_apothecarion() { } function scr_toggle_reclu() { - scr_change_menu(MENU.Reclusiam, function() { + scr_change_menu(eMENU.Reclusiam, function() { with (obj_controller) { menu_adept = 0; hide_banner = 1; if (scr_role_count("Master of Sanctity", "0") == 0) { menu_adept = 1; } - if (menu != MENU.Reclusiam) { - menu = MENU.Reclusiam; + if (menu != eMENU.Reclusiam) { + menu = eMENU.Reclusiam; temp[36] = string(scr_role_count(obj_ini.role[100][14], "field")); temp[37] = string(scr_role_count(obj_ini.role[100][14], "home")); @@ -260,15 +260,15 @@ function scr_toggle_reclu() { } function scr_toggle_lib() { - scr_change_menu(MENU.Librarium, function() { + scr_change_menu(eMENU.Librarium, function() { with (obj_controller) { menu_adept = 0; hide_banner = 1; if (scr_role_count("Chief " + string(obj_ini.role[100][17]), "0") == 0) { menu_adept = 1; } - if (menu != MENU.Librarium) { - menu = MENU.Librarium; + if (menu != eMENU.Librarium) { + menu = eMENU.Librarium; if ((artifacts > 0) && (menu_artifact == 0)) { menu_artifact = 1; @@ -294,9 +294,9 @@ function scr_toggle_lib() { } function scr_toggle_armamentarium() { - scr_change_menu(MENU.Armamentarium, function() { + scr_change_menu(eMENU.Armamentarium, function() { with (obj_controller) { - if (menu != MENU.Armamentarium) { + if (menu != eMENU.Armamentarium) { if (scr_role_count("Forge Master", "0") == 0) { menu_adept = 1; } @@ -308,7 +308,7 @@ function scr_toggle_armamentarium() { } function scr_toggle_recruiting() { - scr_change_menu(MENU.Recruiting, function() { + scr_change_menu(eMENU.Recruiting, function() { with (obj_controller) { var geh = 0, good = 0; for (geh = 1; geh <= 50; geh++) { @@ -320,7 +320,7 @@ function scr_toggle_recruiting() { } } - if (menu != MENU.Recruiting) { + if (menu != eMENU.Recruiting) { set_up_recruitment_view(); hide_banner = 1; } @@ -329,7 +329,7 @@ function scr_toggle_recruiting() { } function scr_toggle_fleet_area() { - scr_change_menu(MENU.Fleet, function() { + scr_change_menu(eMENU.Fleet, function() { with (obj_controller) { menu_adept = 0; var geh = 0, good = 0; @@ -340,10 +340,10 @@ function scr_toggle_fleet_area() { } } } - if (menu != MENU.Fleet) { + if (menu != eMENU.Fleet) { hide_banner = 1; //TODO rewrite all this shit when fleets finally become OOP - menu = MENU.Fleet; + menu = eMENU.Fleet; cooldown = 8000; click = 1; @@ -406,11 +406,11 @@ function scr_toggle_fleet_area() { } function scr_toggle_diplomacy() { - scr_change_menu(MENU.Diplomacy, function() { + scr_change_menu(eMENU.Diplomacy, function() { with (obj_controller) { - if (menu != MENU.Diplomacy) { + if (menu != eMENU.Diplomacy) { set_up_diplomacy_buttons(); - menu = MENU.Diplomacy; + menu = eMENU.Diplomacy; audience = 0; diplomacy = 0; hide_banner = 1; @@ -422,10 +422,10 @@ function scr_toggle_diplomacy() { } function scr_toggle_event_log() { - scr_change_menu(MENU.EventLog, function() { + scr_change_menu(eMENU.EventLog, function() { with (obj_controller) { - if (menu != MENU.EventLog) { - menu = MENU.EventLog; + if (menu != eMENU.EventLog) { + menu = eMENU.EventLog; hide_banner = 1; instance_activate_object(obj_event_log); @@ -441,7 +441,7 @@ function scr_end_turn() { } scr_change_menu(-1, function() { with (obj_controller) { - if ((menu == MENU.Default) && (cooldown <= 0)) { + if ((menu == eMENU.Default) && (cooldown <= 0)) { if (location_viewer.hide_sequence == 0) { location_viewer.hide_sequence++; } diff --git a/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml b/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml index 9590468bd0..9861112bb7 100644 --- a/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml +++ b/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml @@ -117,7 +117,7 @@ function basic_diplomacy_screen(){ } yy=__view_get( e__VW.YView, 0 ); } - if (menu==MENU.Diplomacy) and (diplomacy==10.1){ + if (menu==eMENU.Diplomacy) and (diplomacy==10.1){ scr_emmisary_diplomacy_routes(); } /*if (force_goodbye=1){ diff --git a/scripts/scr_draw_rainbow/scr_draw_rainbow.gml b/scripts/scr_draw_rainbow/scr_draw_rainbow.gml index d884a8d05e..94f5041c6c 100644 --- a/scripts/scr_draw_rainbow/scr_draw_rainbow.gml +++ b/scripts/scr_draw_rainbow/scr_draw_rainbow.gml @@ -7,13 +7,13 @@ function scr_draw_rainbow(x1, y1, x2, y2, colour_ratio) { var wid,rat;wid=x2-x1;rat=colour_ratio; - if (menu!=MENU.Diplomacy) or (diplomacy!=0){ + if (menu!=eMENU.Diplomacy) or (diplomacy!=0){ if (colour_ratio<=0.15) then draw_set_color(c_red); if (colour_ratio>=0.15) and (colour_ratio<=0.4) then draw_set_color(c_orange); if (colour_ratio>=0.4) and (colour_ratio<=0.7) then draw_set_color(c_yellow); if (colour_ratio>=0.7) then draw_set_color(c_green); } - if (menu=MENU.Diplomacy) and (diplomacy=0){ + if (menu=eMENU.Diplomacy) and (diplomacy=0){ if (colour_ratio<=0.5) then draw_set_color(c_red); if (colour_ratio>=0.5) and (colour_ratio<=0.65) then draw_set_color(c_orange); if (colour_ratio>=0.65) and (colour_ratio<=0.85) then draw_set_color(c_yellow); diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index a793501f93..d10bb18cc6 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -406,7 +406,7 @@ function ground_mission_leave_it_function(){ /// @mixin PlanetData function discover_artifact_popup(feature){ - obj_controller.menu = MENU.Default; + obj_controller.menu = eMENU.Default; /*if ((planet_type == "Dead" || current_owner == eFACTION.Player)) { alarm[4] = 1; exit; @@ -578,7 +578,7 @@ function check_for_stc_grab_mission(){ /// @mixin PlanetData function discover_stc_fragment_popup(techies, mechanicus_reps){ var _owner = current_owner; - obj_controller.menu = MENU.Default; + obj_controller.menu = eMENU.Default; var pop = instance_create(0, 0, obj_popup); pop.image = "stc"; pop.title = "STC Fragment Located"; diff --git a/scripts/scr_ui_advisors/scr_ui_advisors.gml b/scripts/scr_ui_advisors/scr_ui_advisors.gml index d7a9233515..3073d82067 100644 --- a/scripts/scr_ui_advisors/scr_ui_advisors.gml +++ b/scripts/scr_ui_advisors/scr_ui_advisors.gml @@ -13,18 +13,18 @@ function scr_ui_advisors() { // This script draws all of the ADVISOR screens // ** Fleet ** - if (menu = MENU.Fleet) { + if (menu = eMENU.Fleet) { scr_fleet_advisor(); } // ** Apothecarium ** - else if (menu = MENU.Apothecarion) { + else if (menu = eMENU.Apothecarion) { scr_apothecarium(); } // ** Reclusium ** - if ((floor(menu) == MENU.Reclusiam)) { + if ((floor(menu) == eMENU.Reclusiam)) { draw_sprite(spr_rock_bg, 0, xx, yy); draw_set_alpha(0.75); @@ -89,7 +89,7 @@ function scr_ui_advisors() { draw_set_font(fnt_40k_30b); draw_set_halign(fa_center); - if (menu == MENU.Reclusiam){ + if (menu == eMENU.Reclusiam){ draw_text_transformed(xx + 1262, yy + 70, "Penitorium", 0.6, 0.6, 0); } if (menu = 12.1) then draw_text_transformed(xx + 1262, yy + 70, "Scheduling Event", 0.6, 0.6, 0); @@ -691,7 +691,7 @@ function scr_ui_advisors() { } - if (menu == MENU.Manage) and (managing == 0) { + if (menu == eMENU.Manage) and (managing == 0) { draw_set_alpha(1); draw_sprite(spr_rock_bg, 0, xx, yy); draw_set_font(fnt_40k_30b); diff --git a/scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml b/scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml index d5102e212a..ac541036f5 100644 --- a/scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml +++ b/scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml @@ -447,7 +447,7 @@ function faction_disposition_rating_string(diplomacy){ } function scr_ui_diplomacy() { - if (menu != MENU.Diplomacy){ + if (menu != eMENU.Diplomacy){ return; } diff --git a/scripts/scr_ui_manage/scr_ui_manage.gml b/scripts/scr_ui_manage/scr_ui_manage.gml index a935f8e312..5a31929ee1 100644 --- a/scripts/scr_ui_manage/scr_ui_manage.gml +++ b/scripts/scr_ui_manage/scr_ui_manage.gml @@ -79,7 +79,7 @@ function load_marines_into_ship(system, ship, units, reload = false) { man_size = 0; man_current = 0; if (reload == false) { - menu = MENU.Manage; + menu = eMENU.Manage; } selecting_ship = -1; if (managing == -1 && obj_controller.selection_data.purpose != "Ship Management") { @@ -1252,7 +1252,7 @@ function scr_ui_manage() { if (point_and_click([xx + 25, yy + 70, xx + 70, yy + 140])) { man_size = 0; man_current = 0; - menu = MENU.Manage;; + menu = eMENU.Manage;; } var top, temp1 = "", temp2 = "", temp3 = "", temp4 = "", temp5 = ""; From 4a172ad791d49bd8952cc12a022c3fd9fa13594c Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 14:41:10 -0500 Subject: [PATCH 24/45] enum GOD_MISSION seems to be unused for now but has now been refactored to be eGOD_MISSION according to CODE_STYLE.md --- scripts/macros/macros.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index ccaafbd621..48bd874945 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -72,7 +72,7 @@ enum eLUCK { neutral = 0, good = 1 } -enum GOD_MISSION { +enum eGOD_MISSION { artifact } enum INQUISITION_MISSION { From 11fc43f55cef2dcb06f68e4db8ddb0087cc88ede Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 14:43:08 -0500 Subject: [PATCH 25/45] Refactored INQUISITION_MISSION to eINQUISITION_MISSION according to CODE_STYLE.md --- scripts/macros/macros.gml | 2 +- scripts/scr_cheatcode/scr_cheatcode.gml | 14 ++++---- .../scr_inquisition_mission.gml | 34 +++++++++---------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index 48bd874945..e712c31cfa 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -75,7 +75,7 @@ enum eLUCK { enum eGOD_MISSION { artifact } -enum INQUISITION_MISSION { +enum eINQUISITION_MISSION { purge, inquisitor, spyrer, diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index ac2319de16..c9fea8e073 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -160,25 +160,25 @@ function scr_cheatcode(argument0) { scr_inquisition_mission(EVENT.inquisition_planet); break; case "spyrer": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.spyrer); + scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.spyrer); break; case "artifact": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.artifact); + scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.artifact); break; case "inquisitor": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.inquisitor); + scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.inquisitor); break; case "purge": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.purge); + scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.purge); break; case "tomb_world": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.tomb_world); + scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.tomb_world); break; case "tyranid_organism": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.tyranid_organism); + scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.tyranid_organism); break; case "demon": - scr_inquisition_mission(EVENT.inquisition_mission, INQUISITION_MISSION.demon_world); + scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.demon_world); break; default: scr_inquisition_mission(EVENT.inquisition_mission); diff --git a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml index b333eba560..6f78f3893a 100644 --- a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml +++ b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml @@ -17,7 +17,7 @@ /// @param {Enum.EVENT} event -/// @param {Enum.INQUISITION_MISSION} forced_mission optional +/// @param {Enum.eINQUISITION_MISSION} forced_mission optional function scr_inquisition_mission(event, forced_mission = -1){ log_message($"RE: Inquisition Mission, event {event}, forced_mission {forced_mission}"); @@ -34,10 +34,10 @@ function scr_inquisition_mission(event, forced_mission = -1){ var inquisition_missions = [ - INQUISITION_MISSION.purge, - INQUISITION_MISSION.inquisitor, - INQUISITION_MISSION.spyrer, - INQUISITION_MISSION.artifact + eINQUISITION_MISSION.purge, + eINQUISITION_MISSION.inquisitor, + eINQUISITION_MISSION.spyrer, + eINQUISITION_MISSION.artifact ]; var found_sleeping_necrons = false; @@ -69,19 +69,19 @@ function scr_inquisition_mission(event, forced_mission = -1){ } if (found_sleeping_necrons){ - array_push(inquisition_missions, INQUISITION_MISSION.tomb_world); + array_push(inquisition_missions, eINQUISITION_MISSION.tomb_world); log_message($"Was able to find a _star with dormant necron tomb for inquisition mission"); } else { log_message($"Couldn't find any planets with a dormant necron tomb for inquisition mission") } if (found_tyranid_org){ log_message($"Was able to find a _star with lvl 4 tyranids for inquisition mission"); - array_push(inquisition_missions, INQUISITION_MISSION.tyranid_organism); + array_push(inquisition_missions, eINQUISITION_MISSION.tyranid_organism); } else { log_message($"Couldn't find any planets with lvl 4 tyranids for inquisition mission") } if (found_demon_world){ - array_push(inquisition_missions, INQUISITION_MISSION.demon_world); + array_push(inquisition_missions, eINQUISITION_MISSION.demon_world); log_message($"Was able to find a _star with demons on it for inquisition mission"); } else { log_message($"Couldn't find any planets with demons for inquisition mission") @@ -96,7 +96,7 @@ function scr_inquisition_mission(event, forced_mission = -1){ // for(var i = 1; i <= planets; i++) // { // if (p_tau[i]>4) { - // array_push(inquisition_missions, INQUISITION_MISSION.ethereal); + // array_push(inquisition_missions, eINQUISITION_MISSION.ethereal); // found_tau = true // break; // } @@ -109,14 +109,14 @@ function scr_inquisition_mission(event, forced_mission = -1){ chosen_mission = forced_mission; } switch (chosen_mission){ - case INQUISITION_MISSION.purge: mission_inquistion_purge(); break; - case INQUISITION_MISSION.inquisitor: mission_inquistion_hunt_inquisitor(); break; - case INQUISITION_MISSION.spyrer: mission_inquistion_spyrer(); break; - case INQUISITION_MISSION.artifact: mission_inquisition_artifact(); break; - case INQUISITION_MISSION.tomb_world: mission_inquisition_tomb_world(necron_tomb_worlds); break; - case INQUISITION_MISSION.tyranid_organism: mission_inquisition_tyranid_organism(tyranid_org_worlds); break; - case INQUISITION_MISSION.ethereal: mission_inquisition_ethereal(); break; - case INQUISITION_MISSION.demon_world: mission_inquisition_demon_world(demon_worlds); break; + case eINQUISITION_MISSION.purge: mission_inquistion_purge(); break; + case eINQUISITION_MISSION.inquisitor: mission_inquistion_hunt_inquisitor(); break; + case eINQUISITION_MISSION.spyrer: mission_inquistion_spyrer(); break; + case eINQUISITION_MISSION.artifact: mission_inquisition_artifact(); break; + case eINQUISITION_MISSION.tomb_world: mission_inquisition_tomb_world(necron_tomb_worlds); break; + case eINQUISITION_MISSION.tyranid_organism: mission_inquisition_tyranid_organism(tyranid_org_worlds); break; + case eINQUISITION_MISSION.ethereal: mission_inquisition_ethereal(); break; + case eINQUISITION_MISSION.demon_world: mission_inquisition_demon_world(demon_worlds); break; } From c397ac00be988eb0864a3ac5687bb4a87296a16e Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 14:47:39 -0500 Subject: [PATCH 26/45] Refactored EVENT enum to eEVENT according to CODE_STYLE.md --- objects/obj_controller/Create_0.gml | 2 +- scripts/macros/macros.gml | 2 +- scripts/scr_cheatcode/scr_cheatcode.gml | 20 +-- scripts/scr_dialogue/scr_dialogue.gml | 44 +++---- .../scr_inquisition_mission.gml | 4 +- scripts/scr_random_event/scr_random_event.gml | 122 +++++++++--------- scripts/scr_trade/scr_trade.gml | 2 +- 7 files changed, 98 insertions(+), 98 deletions(-) diff --git a/objects/obj_controller/Create_0.gml b/objects/obj_controller/Create_0.gml index cf6565edba..ee4bb74b7a 100644 --- a/objects/obj_controller/Create_0.gml +++ b/objects/obj_controller/Create_0.gml @@ -751,7 +751,7 @@ diplo_option = []; diplo_alpha = 0; // ** Sets combat to not true ** combat = 0; -random_event_next = EVENT.none; +random_event_next = eEVENT.none; useful_info = ""; // ** Sets the reason for loss of loyalty ** diff --git a/scripts/macros/macros.gml b/scripts/macros/macros.gml index e712c31cfa..a63efbd582 100644 --- a/scripts/macros/macros.gml +++ b/scripts/macros/macros.gml @@ -86,7 +86,7 @@ enum eINQUISITION_MISSION { demon_world } -enum EVENT { +enum eEVENT { //good space_hulk, promotion, diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index c9fea8e073..6600806892 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -154,34 +154,34 @@ function scr_cheatcode(argument0) { show_debug_message($"{mission},"); switch (mission){ case "1": //default - scr_inquisition_mission(EVENT.inquisition_mission); + scr_inquisition_mission(eEVENT.inquisition_mission); break; case "planet": - scr_inquisition_mission(EVENT.inquisition_planet); + scr_inquisition_mission(eEVENT.inquisition_planet); break; case "spyrer": - scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.spyrer); + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.spyrer); break; case "artifact": - scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.artifact); + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.artifact); break; case "inquisitor": - scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.inquisitor); + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.inquisitor); break; case "purge": - scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.purge); + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.purge); break; case "tomb_world": - scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.tomb_world); + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.tomb_world); break; case "tyranid_organism": - scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.tyranid_organism); + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.tyranid_organism); break; case "demon": - scr_inquisition_mission(EVENT.inquisition_mission, eINQUISITION_MISSION.demon_world); + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.demon_world); break; default: - scr_inquisition_mission(EVENT.inquisition_mission); + scr_inquisition_mission(eEVENT.inquisition_mission); break; } show_debug_message("inquisitor mission initiated"); diff --git a/scripts/scr_dialogue/scr_dialogue.gml b/scripts/scr_dialogue/scr_dialogue.gml index 170c773fa1..08e8c6eab8 100644 --- a/scripts/scr_dialogue/scr_dialogue.gml +++ b/scripts/scr_dialogue/scr_dialogue.gml @@ -2099,7 +2099,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { for(var i=30; i<30; i++){ if (rando==5) and (string_count("CM|",obj_controller.useful_info)>0) then rando-=1; - if (rando==4) and (random_event_next != EVENT.none) then rando-=1; + if (rando==4) and (random_event_next != eEVENT.none) then rando-=1; if (rando==3) and ((turn3)) then rando-=1; if (rando==2) and ((known[eFACTION.Ork]<0) or (known[eFACTION.Ork]>=3) or (string_count("WL7|",obj_controller.useful_info)=1)) then rando-=1; if (rando==1) and (string_count("WG|",obj_controller.useful_info)>1) then rando=5; @@ -2124,27 +2124,27 @@ function scr_dialogue(diplo_keyphrase, data = {}) { // * Next random event * if (rando==4){ scr_random_event(false); - if (random_event_next == EVENT.strange_behavior) and (obj_controller.disposition[6]<15) then diplo_text="One of your Mon'keigh soldiers will no longer act as you expect him to. Be wary, when one Mon'keigh is influenced the rest of the herd will be."; - else if (random_event_next == EVENT.strange_behavior) and (obj_controller.disposition[6]>=15) then diplo_text="One of your soldiers will no longer act as you expect him to. Be wary, when one is influenced the rest of the herd will be."; - else if (random_event_next == EVENT.space_hulk) then diplo_text="It comes from the warp, a relic from the past. It is steeped in the energies of the ethereal tides. Beware."; - else if (random_event_next == EVENT.promotion) then diplo_text="One of your soldiers will cover himself in glory. As his “Chapter Master”, a title I find inherently foolish, you may wish to reward him."; - else if (random_event_next == EVENT.strange_building) then diplo_text="The Red robed ones, their “Machine God”, calls to them. Soon, one shall lose their tenuos grip on the here and now and follow the pictures in his head."; - else if (random_event_next == EVENT.sororitas) then diplo_text="Your priestesses of war, who worship He Who Fell, will gather their forces soon, to stay."; - else if (random_event_next == EVENT.inquisition_mission) then diplo_text="They will come very soon, the bearers of hellfire and hate. They will scour the sector for so-called ''Heresy''."; - else if (random_event_next == EVENT.inquisition_planet) then diplo_text="Your questions askers seek to learn more of a planet. Warp meddlers and free thinkers would be well-served with caution. Beware, Chapter Master."; - else if (random_event_next == EVENT.rogue_trader) then diplo_text="Free thinkers, traders in the vast expanse. They are coming, perhaps you aught to set out your wares?"; - else if (random_event_next == EVENT.fleet_delay) then diplo_text="Mon'keigh, your fleets may be delayed by my kin. Eldar Pirates, your kind would call them."; - else if (random_event_next == EVENT.harlequins) then diplo_text="Rillietann. They have come. They are on some world, hidden, or soon will be."; - else if (random_event_next == EVENT.succession_war) then diplo_text="Your underlings fight for power, Mon'keigh. Someone will die who believes he is important. His children and ''friends'' will vie for the rite to call himself or herself governor. Or king. Or whatever self aggrandising title your people name yourselves."; - else if (random_event_next == EVENT.random_fun) then diplo_text="Something will happen soon. The runes do not show me exactly what will happen, only that it concerns you. Watch the horizon, Mon'keigh."; - else if (random_event_next == EVENT.warp_storms) then diplo_text="The tides of the Immaterium are unsettled. Of course, it's hard to calculate where the Immaterium will affect the Materium, but I predict it will come soon."; - else if (random_event_next == EVENT.enemy_forces) then diplo_text="From beyond your circle of firelight, they are coming. Rest not Mon'keigh, for they will come soon and are bent on destruction."; - else if (random_event_next == EVENT.crusade) then diplo_text="Soon, your masters will call you to heel like a dog to attack the foes of man. One of your ''Crusades'' of hate, ignorance and bigotry will be called."; - else if (random_event_next == EVENT.enemy) then diplo_text="You will make an enemy among your fellow man. Soon they shall whisper into their lord's ear, telling that you are a threat, a beetle to be crushed beneath their boot. You would do well to speak carefully, for some time."; - else if (random_event_next == EVENT.mutation) then diplo_text="Your 'battle brothers' are twisting like snakes beneath your feet. Watch yourself, Chapter Master."; - else if (random_event_next == EVENT.ship_lost) then diplo_text="The Immaterium will swallow one of your ships. Do not look for it to return."; - else if (random_event_next == EVENT.chaos_invasion) then diplo_text="Your twisted brethren, who fell to the lure of the Immaterium, will soon arrive with their wrath and demons. Beware."; - else if (random_event_next == EVENT.necron_awaken) then diplo_text="Our old enemies, the men of metal, are close. You call them “Necrons”, and you will need to fight them soon. Or flee, it matters not to me."; + if (random_event_next == eEVENT.strange_behavior) and (obj_controller.disposition[6]<15) then diplo_text="One of your Mon'keigh soldiers will no longer act as you expect him to. Be wary, when one Mon'keigh is influenced the rest of the herd will be."; + else if (random_event_next == eEVENT.strange_behavior) and (obj_controller.disposition[6]>=15) then diplo_text="One of your soldiers will no longer act as you expect him to. Be wary, when one is influenced the rest of the herd will be."; + else if (random_event_next == eEVENT.space_hulk) then diplo_text="It comes from the warp, a relic from the past. It is steeped in the energies of the ethereal tides. Beware."; + else if (random_event_next == eEVENT.promotion) then diplo_text="One of your soldiers will cover himself in glory. As his “Chapter Master”, a title I find inherently foolish, you may wish to reward him."; + else if (random_event_next == eEVENT.strange_building) then diplo_text="The Red robed ones, their “Machine God”, calls to them. Soon, one shall lose their tenuos grip on the here and now and follow the pictures in his head."; + else if (random_event_next == eEVENT.sororitas) then diplo_text="Your priestesses of war, who worship He Who Fell, will gather their forces soon, to stay."; + else if (random_event_next == eEVENT.inquisition_mission) then diplo_text="They will come very soon, the bearers of hellfire and hate. They will scour the sector for so-called ''Heresy''."; + else if (random_event_next == eEVENT.inquisition_planet) then diplo_text="Your questions askers seek to learn more of a planet. Warp meddlers and free thinkers would be well-served with caution. Beware, Chapter Master."; + else if (random_event_next == eEVENT.rogue_trader) then diplo_text="Free thinkers, traders in the vast expanse. They are coming, perhaps you aught to set out your wares?"; + else if (random_event_next == eEVENT.fleet_delay) then diplo_text="Mon'keigh, your fleets may be delayed by my kin. Eldar Pirates, your kind would call them."; + else if (random_event_next == eEVENT.harlequins) then diplo_text="Rillietann. They have come. They are on some world, hidden, or soon will be."; + else if (random_event_next == eEVENT.succession_war) then diplo_text="Your underlings fight for power, Mon'keigh. Someone will die who believes he is important. His children and ''friends'' will vie for the rite to call himself or herself governor. Or king. Or whatever self aggrandising title your people name yourselves."; + else if (random_event_next == eEVENT.random_fun) then diplo_text="Something will happen soon. The runes do not show me exactly what will happen, only that it concerns you. Watch the horizon, Mon'keigh."; + else if (random_event_next == eEVENT.warp_storms) then diplo_text="The tides of the Immaterium are unsettled. Of course, it's hard to calculate where the Immaterium will affect the Materium, but I predict it will come soon."; + else if (random_event_next == eEVENT.enemy_forces) then diplo_text="From beyond your circle of firelight, they are coming. Rest not Mon'keigh, for they will come soon and are bent on destruction."; + else if (random_event_next == eEVENT.crusade) then diplo_text="Soon, your masters will call you to heel like a dog to attack the foes of man. One of your ''Crusades'' of hate, ignorance and bigotry will be called."; + else if (random_event_next == eEVENT.enemy) then diplo_text="You will make an enemy among your fellow man. Soon they shall whisper into their lord's ear, telling that you are a threat, a beetle to be crushed beneath their boot. You would do well to speak carefully, for some time."; + else if (random_event_next == eEVENT.mutation) then diplo_text="Your 'battle brothers' are twisting like snakes beneath your feet. Watch yourself, Chapter Master."; + else if (random_event_next == eEVENT.ship_lost) then diplo_text="The Immaterium will swallow one of your ships. Do not look for it to return."; + else if (random_event_next == eEVENT.chaos_invasion) then diplo_text="Your twisted brethren, who fell to the lure of the Immaterium, will soon arrive with their wrath and demons. Beware."; + else if (random_event_next == eEVENT.necron_awaken) then diplo_text="Our old enemies, the men of metal, are close. You call them “Necrons”, and you will need to fight them soon. Or flee, it matters not to me."; else { diplo_text="[Missing Dialogue: "+string(random_event_next)+" forcast.]"; // this will print a number rather that a string which is less than ideal, but we can just add new flavour text whem we get the bug reports } diff --git a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml index 6f78f3893a..11d259ad5c 100644 --- a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml +++ b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml @@ -28,9 +28,9 @@ function scr_inquisition_mission(event, forced_mission = -1){ if (global.cheat_debug){ show_debug_message("find mission"); } - if (event == EVENT.inquisition_planet){ + if (event == eEVENT.inquisition_planet){ mission_investigate_planet(); - } else if (event == EVENT.inquisition_mission){ + } else if (event == eEVENT.inquisition_mission){ var inquisition_missions = [ diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index 142ed1594b..556a24500a 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -28,8 +28,8 @@ function scr_random_event(execute_now) { force_inquisition_mission = true; } - if (force_inquisition_mission && random_event_next == EVENT.none) { - chosen_event = EVENT.inquisition_mission; + if (force_inquisition_mission && random_event_next == eEVENT.none) { + chosen_event = eEVENT.inquisition_mission; } else { if (execute_now) { var random_event_roll = irandom(100); @@ -44,7 +44,7 @@ function scr_random_event(execute_now) { } // Minimum interval between } - if (random_event_next != EVENT.none) { + if (random_event_next != eEVENT.none) { chosen_event = random_event_next; } else { var player_luck; @@ -63,34 +63,34 @@ function scr_random_event(execute_now) { var events; if (player_luck == eLUCK.good) { events = [ - EVENT.space_hulk, - EVENT.promotion, - EVENT.strange_building, - EVENT.sororitas, - EVENT.rogue_trader, - EVENT.inquisition_mission, - EVENT.inquisition_planet, - EVENT.mechanicus_mission + eEVENT.space_hulk, + eEVENT.promotion, + eEVENT.strange_building, + eEVENT.sororitas, + eEVENT.rogue_trader, + eEVENT.inquisition_mission, + eEVENT.inquisition_planet, + eEVENT.mechanicus_mission ]; } else if (player_luck == eLUCK.neutral) { events = [ - EVENT.strange_behavior, - EVENT.fleet_delay, - EVENT.harlequins, - EVENT.succession_war, - EVENT.random_fun + eEVENT.strange_behavior, + eEVENT.fleet_delay, + eEVENT.harlequins, + eEVENT.succession_war, + eEVENT.random_fun ]; } else if (player_luck == eLUCK.bad) { events = [ - EVENT.warp_storms, - EVENT.enemy_forces, - EVENT.crusade, // Reportly breaks often because of lack of imperial fleets and eats player ships // TODO LOW CRUSADE_EVENT // fix - EVENT.enemy, // Save-scumming event, Should probably base this on something else than tech-scavs - EVENT.mutation, - EVENT.ship_lost, // Another save-scumming event, mainly due to rarity of player ships - //EVENT.chaos_invasion, // Spawns Chaos fleets way too close to player owned worlds with no warning and usually lots of big ships, save-scum galore and encourages fleet-based chapters // TODO LOW INVASION_EVENT // Make them spawn way farther with more warning, make them have a different goal or remove this event entirely - EVENT.necron_awaken, // Inquisitor check for this is inverted - EVENT.fallen // Event mission cannot be completed and never expires // TODO LOW FALLEN_EVENT // fix + eEVENT.warp_storms, + eEVENT.enemy_forces, + eEVENT.crusade, // Reportly breaks often because of lack of imperial fleets and eats player ships // TODO LOW CRUSADE_EVENT // fix + eEVENT.enemy, // Save-scumming event, Should probably base this on something else than tech-scavs + eEVENT.mutation, + eEVENT.ship_lost, // Another save-scumming event, mainly due to rarity of player ships + //eEVENT.chaos_invasion, // Spawns Chaos fleets way too close to player owned worlds with no warning and usually lots of big ships, save-scum galore and encourages fleet-based chapters // TODO LOW INVASION_EVENT // Make them spawn way farther with more warning, make them have a different goal or remove this event entirely + eEVENT.necron_awaken, // Inquisitor check for this is inverted + eEVENT.fallen // Event mission cannot be completed and never expires // TODO LOW FALLEN_EVENT // fix ]; } @@ -104,26 +104,26 @@ function scr_random_event(execute_now) { //DEBUG-INI (EVENTS DEBUG CODE - 1) //Comment/delete this when not debugging events //List of possible events above - /*curr_event = EVENT.necron_awaken + /*curr_event = eEVENT.necron_awaken events_count = 1 events_total = events_count; events_share = array_create(events_count, 1);*/ //DEBUG-FIN (EVENTS DEBUG CODE - 1) switch (curr_event) { - case EVENT.inquisition_planet: + case eEVENT.inquisition_planet: if (known[eFACTION.Inquisition] == 0 || obj_controller.faction_status[eFACTION.Inquisition] == "War") { events_share[i] -= 1; events_total -= 1; } break; - case EVENT.inquisition_mission: + case eEVENT.inquisition_mission: if (known[eFACTION.Inquisition] == 0 || obj_controller.disposition[4] < 0 || obj_controller.faction_status[eFACTION.Inquisition] == "War") { events_share[i] -= 1; events_total -= 1; } break; - case EVENT.mechanicus_mission: + case eEVENT.mechanicus_mission: if (known[eFACTION.Mechanicus] == 0 || obj_controller.disposition[3] < 50 || obj_controller.faction_status[eFACTION.Mechanicus] == "War") { events_share[i] -= 1; events_total -= 1; @@ -132,31 +132,31 @@ function scr_random_event(execute_now) { events_total += 2; } break; - case EVENT.enemy: + case eEVENT.enemy: if (scr_has_adv("Scavangers")) { events_share[i] += 2; events_total += 2; } break; - case EVENT.mutation: + case eEVENT.mutation: if (gene_seed < 5) { events_share[i] -= 1; events_total -= 1; } break; - case EVENT.necron_awaken: + case eEVENT.necron_awaken: if (known[eFACTION.Inquisition] == 0) { events_share[i] -= 1; events_total -= 1; } break; - case EVENT.crusade: + case eEVENT.crusade: if (obj_controller.faction_status[eFACTION.Imperium] == "War") { events_share[i] -= 1; events_total -= 1; } break; - case EVENT.fleet_delay: + case eEVENT.fleet_delay: var has_moving_fleet = false; with (obj_p_fleet) { if (action == "move") { @@ -169,7 +169,7 @@ function scr_random_event(execute_now) { events_total -= 1; } break; - case EVENT.ship_lost: + case eEVENT.ship_lost: var has_moving_fleet = false; with (obj_p_fleet) { if (action == "move") { @@ -182,7 +182,7 @@ function scr_random_event(execute_now) { events_total -= 1; } break; - case EVENT.fallen: + case eEVENT.fallen: if (!scr_has_disadv("Never Forgive")) { events_share[i] -= 1; events_total -= 1; @@ -201,7 +201,7 @@ function scr_random_event(execute_now) { //DEBUG-INI (EVENTS DEBUG CODE - 2) //Comment/delete this when not debugging events //If event on the switch above, (EVENTS DEBUG CODE - 1) var should be set to event too. - /*chosen_event = EVENT.necron_awaken*/ + /*chosen_event = eEVENT.necron_awaken*/ //DEBUG-FIN (EVENTS DEBUG CODE - 2) } } @@ -211,11 +211,11 @@ function scr_random_event(execute_now) { exit; } - if (chosen_event == EVENT.strange_behavior) { + if (chosen_event == eEVENT.strange_behavior) { //TODO this event currenlty dose'nt do anything but now we have marine structs there is lots of potential here init_marine_acting_strange(); _evented = true; - } else if (chosen_event == EVENT.space_hulk) { + } else if (chosen_event == eEVENT.space_hulk) { log_message("RE: Space Hulk"); var own = choose(1, 1, 2); @@ -263,7 +263,7 @@ function scr_random_event(execute_now) { handle_exception(_exception); } } - } else if (chosen_event == EVENT.promotion) { + } else if (chosen_event == eEVENT.promotion) { log_message("RE: Promotion"); var marine_and_company = scr_random_marine( [ @@ -300,9 +300,9 @@ function scr_random_event(execute_now) { scr_popup("Promotions!", text, "distinguished", ""); scr_event_log("green", text); _evented = true; - } else if (chosen_event == EVENT.strange_building) { + } else if (chosen_event == eEVENT.strange_building) { _evented = strange_build_event(); - } else if (chosen_event == EVENT.sororitas) { + } else if (chosen_event == eEVENT.sororitas) { log_message("RE: Sororitas Company"); var own; own = choose(1, 2); @@ -341,12 +341,12 @@ function scr_random_event(execute_now) { } } } - } else if (chosen_event == EVENT.mechanicus_mission) { + } else if (chosen_event == eEVENT.mechanicus_mission) { evented = spawn_mechanicus_mission(); - } else if (chosen_event == EVENT.inquisition_planet || chosen_event == EVENT.inquisition_mission) { + } else if (chosen_event == eEVENT.inquisition_planet || chosen_event == eEVENT.inquisition_mission) { scr_inquisition_mission(chosen_event); _evented = true; - } else if (chosen_event == EVENT.rogue_trader) { + } else if (chosen_event == eEVENT.rogue_trader) { log_message("RE: Rogue Trader"); var eligible_stars = []; with (obj_star) { @@ -394,7 +394,7 @@ function scr_random_event(execute_now) { star_alert.image_alpha = 1; star_alert.image_speed = 1; _evented = true; - } else if (chosen_event == EVENT.fleet_delay) { + } else if (chosen_event == eEVENT.fleet_delay) { log_message("RE: Fleet Delay"); var eligible_fleets = []; with (obj_p_fleet) { @@ -435,7 +435,7 @@ function scr_random_event(execute_now) { star_alert.col = "red"; } } - } else if (chosen_event == EVENT.harlequins) { + } else if (chosen_event == eEVENT.harlequins) { log_message("RE: Harlequins"); var owner = choose(1, 2, 2, 2, 3); var star = scr_random_find(owner, true, "", ""); @@ -457,7 +457,7 @@ function scr_random_event(execute_now) { star_alert.image_speed = 1; star_alert.col = "green"; } - } else if (chosen_event == EVENT.succession_war) { + } else if (chosen_event == eEVENT.succession_war) { log_message("RE: Succession War"); var eligible_stars = []; with (obj_star) { @@ -495,7 +495,7 @@ function scr_random_event(execute_now) { star_alert.col = "red"; scr_event_log("red", "War of Succession on " + string(text)); _evented = true; - } else if (chosen_event == EVENT.random_fun) { + } else if (chosen_event == eEVENT.random_fun) { // Flavor text/events log_message("RE: Random"); var text; @@ -555,7 +555,7 @@ function scr_random_event(execute_now) { scr_alert("color", "lol", text, 0, 0); scr_event_log("red", text); _evented = true; - } else if (chosen_event == EVENT.warp_storms) { + } else if (chosen_event == eEVENT.warp_storms) { log_message("RE: Warp Storm"); var own, time, him; @@ -588,7 +588,7 @@ function scr_random_event(execute_now) { scr_alert(_col, "Warp", $"Warp Storms rage across the {star_id.name} system.", star_id.x, star_id.y); scr_event_log(_col, $"Warp Storms rage across the {star_id.name} system."); } - } else if (chosen_event == EVENT.enemy_forces) { + } else if (chosen_event == eEVENT.enemy_forces) { log_message("RE: Enemy Forces"); var own; if (scr_has_disadv("Shitty Luck")) { @@ -662,12 +662,12 @@ function scr_random_event(execute_now) { scr_event_log("red", $"{text} forces suddenly appear at {star_id.name} {planet}!"); _evented = true; } - } else if (chosen_event == EVENT.crusade) { + } else if (chosen_event == eEVENT.crusade) { //i think all events should be hanlded like this then we have far more options on when to call them and how they work _evented = launch_crusade(); - } else if (chosen_event == EVENT.enemy) { + } else if (chosen_event == eEVENT.enemy) { _evented = make_faction_enemy_event(); - } else if (chosen_event == EVENT.mutation) { + } else if (chosen_event == eEVENT.mutation) { //TODO make reprocussions to ignoring this log_message("RE: Gene-Seed Mutation"); var text = "The Chapter's gene-seed has mutated! Apothecaries are scrambling to control the damage and prevent further contamination. What is thy will?"; @@ -708,9 +708,9 @@ function scr_random_event(execute_now) { scr_popup("Gene-Seed Mutated!", text, "gene_bad", _pop_data); _evented = true; scr_event_log("red", "The Chapter Gene-Seed has mutated."); - } else if (chosen_event == EVENT.ship_lost) { + } else if (chosen_event == eEVENT.ship_lost) { loose_ship_to_warp_event(); - } else if (chosen_event == EVENT.chaos_invasion) { + } else if (chosen_event == eEVENT.chaos_invasion) { log_message("RE: Chaos Invasion"); add_event({ @@ -733,20 +733,20 @@ function scr_random_event(execute_now) { } else if ((psyker_intolerant || !has_chief_psyker) && cm_is_psyker) { scr_popup("The Maw of the Warp Yawns Wide", "The barrier between the realm of man and the Immaterium feels thin and tested to you. Dark forces are afoot.", "Warp", ""); } - } else if (chosen_event == EVENT.necron_awaken) { + } else if (chosen_event == eEVENT.necron_awaken) { _evented = awaken_tomb_event(); - } else if (chosen_event == EVENT.fallen) { + } else if (chosen_event == eEVENT.fallen) { event_fallen(); _evented = true; } if (_evented) { - if (force_inquisition_mission && chosen_event == EVENT.inquisition_mission) { + if (force_inquisition_mission && chosen_event == eEVENT.inquisition_mission) { last_mission = turn; } else { last_event = turn; - if (random_event_next != EVENT.none) { - random_event_next = EVENT.none; + if (random_event_next != eEVENT.none) { + random_event_next = eEVENT.none; } } } diff --git a/scripts/scr_trade/scr_trade.gml b/scripts/scr_trade/scr_trade.gml index 09975ba533..e04a7025f8 100644 --- a/scripts/scr_trade/scr_trade.gml +++ b/scripts/scr_trade/scr_trade.gml @@ -561,7 +561,7 @@ function TradeAttempt(diplomacy) constructor{ } var _info_val = 0; with (obj_controller){ - if (random_event_next != EVENT.none) and ((string_count("WL10|",useful_info)>0) or (turn0) or (known[eFACTION.Ork]<1)) and (string_count("WG|",useful_info)>1) and (string_count("CM|",useful_info)>0){ + if (random_event_next != eEVENT.none) and ((string_count("WL10|",useful_info)>0) or (turn0) or (known[eFACTION.Ork]<1)) and (string_count("WG|",useful_info)>1) and (string_count("CM|",useful_info)>0){ _info_val=1000; } } From f0cc8aebc0f0a11815c5be41623ff0729ff747fa Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 15:01:16 -0500 Subject: [PATCH 27/45] Linted all files touched by the macro enum refractor. This probably cleared out a slew of minor logic bugs just sitting in the code. --- objects/obj_event_log/Create_0.gml | 34 +- objects/obj_event_log/Draw_0.gml | 29 +- objects/obj_event_log/Mouse_60.gml | 16 +- objects/obj_event_log/Mouse_61.gml | 23 +- objects/obj_event_log/Step_0.gml | 7 +- objects/obj_img/Create_0.gml | 135 +- objects/obj_img/Draw_0.gml | 5 +- objects/obj_img/Other_4.gml | 15 +- objects/obj_img/Other_5.gml | 21 +- objects/obj_img/Step_0.gml | 202 +- objects/obj_star/Alarm_0.gml | 220 +- objects/obj_star/Alarm_1.gml | 449 +- objects/obj_star/Alarm_2.gml | 36 +- objects/obj_star/Alarm_3.gml | 78 +- objects/obj_star/Create_0.gml | 145 +- objects/obj_star/Draw_0.gml | 78 +- objects/obj_star/Mouse_50.gml | 34 +- objects/obj_star/Step_0.gml | 97 +- objects/obj_star/Step_2.gml | 11 +- objects/obj_turn_end/Alarm_0.gml | 352 +- objects/obj_turn_end/Alarm_1.gml | 162 +- objects/obj_turn_end/Alarm_2.gml | 36 +- objects/obj_turn_end/Alarm_3.gml | 3 +- objects/obj_turn_end/Alarm_4.gml | 199 +- objects/obj_turn_end/Create_0.gml | 165 +- objects/obj_turn_end/Destroy_0.gml | 6 +- objects/obj_turn_end/Draw_0.gml | 416 +- objects/obj_turn_end/Draw_64.gml | 28 +- objects/obj_turn_end/Mouse_56.gml | 395 +- objects/obj_turn_end/Step_0.gml | 44 +- scripts/is_specialist/is_specialist.gml | 546 +- scripts/scr_cheatcode/scr_cheatcode.gml | 1462 ++-- scripts/scr_dialogue/scr_dialogue.gml | 6776 ++++++++++------- .../scr_diplomacy_helpers.gml | 423 +- scripts/scr_draw_rainbow/scr_draw_rainbow.gml | 67 +- .../scr_inquisition_mission.gml | 677 +- .../scr_planetary_feature.gml | 1977 ++--- scripts/scr_random_event/scr_random_event.gml | 29 +- .../scr_string_functions.gml | 243 +- scripts/scr_trade/scr_trade.gml | 1338 ++-- scripts/scr_ui_advisors/scr_ui_advisors.gml | 566 +- scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml | 1132 ++- scripts/scr_ui_manage/scr_ui_manage.gml | 892 +-- 43 files changed, 10828 insertions(+), 8741 deletions(-) diff --git a/objects/obj_event_log/Create_0.gml b/objects/obj_event_log/Create_0.gml index bfb02f69b5..6f51017e91 100644 --- a/objects/obj_event_log/Create_0.gml +++ b/objects/obj_event_log/Create_0.gml @@ -6,7 +6,7 @@ event = []; // Get upon load? t = 0; event = []; -// +// help = 0; help_topics = 0; topic = ""; @@ -19,21 +19,23 @@ related[1] = ""; related[2] = ""; related[3] = ""; var e = -1; -repeat(101) { - e += 1; - topics[e] = ""; +repeat (101) { + e += 1; + topics[e] = ""; } if (file_exists("main\\help.ini")) { - ini_open("main\\help.ini"); - var ch; - ch = 0; - repeat(100) { - ch += 1; - if (ini_section_exists(string(ch))) { - help_topics += 1; - topics[help_topics] = ini_read_string(string(ch), "topic", "Error"); - } - } - ini_close(); + ini_open("main\\help.ini"); + var ch; + ch = 0; + repeat (100) { + ch += 1; + if (ini_section_exists(string(ch))) { + help_topics += 1; + topics[help_topics] = ini_read_string(string(ch), "topic", "Error"); + } + } + ini_close(); +} +if ((help_topics == 0) && (help != 0)) { + instance_destroy(); } -if (help_topics = 0) and(help != 0) then instance_destroy(); \ No newline at end of file diff --git a/objects/obj_event_log/Draw_0.gml b/objects/obj_event_log/Draw_0.gml index 648165e557..2397192e5d 100644 --- a/objects/obj_event_log/Draw_0.gml +++ b/objects/obj_event_log/Draw_0.gml @@ -7,7 +7,7 @@ if (__b__) { bad = 0; } } - if (bad = 0) { + if (bad == 0) { var ent; var xx = __view_get(e__VW.XView, 0) + 0; var yy = __view_get(e__VW.YView, 0) + 0; @@ -22,9 +22,7 @@ if (__b__) { draw_set_halign(fa_center); draw_text(xx + 800, yy + 74, string(global.chapter_name) + " Event Log"); draw_set_halign(fa_left); - var t = 0, - p = -1, - cur_event; + var t = 0, p = -1, cur_event; var ent = array_length(event); draw_set_color(CM_GREEN_COLOR); if (ent == 0) { @@ -33,14 +31,15 @@ if (__b__) { p = -1; draw_set_font(fnt_40k_14); draw_set_alpha(0.8); - for (var t=top - 1; t1) then top-=1; - if (top>1) then top-=1; -// } - - - +// scroll_cool=1; +if (top > 1) { + top -= 1; +} +if (top > 1) { + top -= 1; +} +// } diff --git a/objects/obj_event_log/Mouse_61.gml b/objects/obj_event_log/Mouse_61.gml index 1605c7fd41..fb48e44b58 100644 --- a/objects/obj_event_log/Mouse_61.gml +++ b/objects/obj_event_log/Mouse_61.gml @@ -1,12 +1,15 @@ - // if (scroll_cool<=0){ - // scroll_cool=1; - - var t,p;ent=0;p=top-1; - t=0; - ent=array_length(event); - if (ent-24>top) then top+=1; - if (ent-24>top) then top+=1; -// } - +// scroll_cool=1; +var t, p; +ent = 0; +p = top - 1; +t = 0; +ent = array_length(event); +if (ent - 24 > top) { + top += 1; +} +if (ent - 24 > top) { + top += 1; +} +// } diff --git a/objects/obj_event_log/Step_0.gml b/objects/obj_event_log/Step_0.gml index 50402b663c..33486b7b93 100644 --- a/objects/obj_event_log/Step_0.gml +++ b/objects/obj_event_log/Step_0.gml @@ -1,4 +1,3 @@ - -if (scroll_cool>=0) then scroll_cool-=1; - - +if (scroll_cool >= 0) { + scroll_cool -= 1; +} diff --git a/objects/obj_img/Create_0.gml b/objects/obj_img/Create_0.gml index f54fbb9b62..9bab5a0d67 100644 --- a/objects/obj_img/Create_0.gml +++ b/objects/obj_img/Create_0.gml @@ -1,6 +1,5 @@ - -// should end up a struct of arrays, -// e.g. +// should end up a struct of arrays, +// e.g. /* img_cache: { "creation/chapters": [somesprite1, somesprite2, ...]; @@ -10,65 +9,85 @@ show_debug_message("obj_img spawned"); image_cache = {}; +var i; +i = -1; +repeat (301) { + i += 1; + creation[i] = 0; + creation_exists[i] = -1; + main[i] = 0; + main_exists[i] = -1; + existing[i] = 0; + existing_exists[i] = -1; + others[i] = 0; + others_exists[i] = -1; + advisor[i] = 0; + advisor_exists[i] = -1; + diplomacy_splash[i] = 0; + diplomacy_splash_exists[i] = -1; + diplomacy_daemon[i] = 0; + diplomacy_daemon_exists[i] = -1; + diplomacy_icon[i] = -1; + diplomacy_icon_exists[i] = -1; + menu[i] = 0; + menu_exists[i] = -1; + loading[i] = 0; + loading_exists[i] = -1; + postbattle[i] = 0; + postbattle_exists[i] = -1; + postspace[i] = 0; + postspace_exists[i] = -1; + formation[i] = 0; + formation_exists[i] = -1; + popup[i] = 0; + popup_exists[i] = -1; + commander[i] = 0; + commander_exists[i] = -1; + planet_good[i] = 0; + planet_exists[i] = -1; + attacked[i] = 0; + attacked_exists[i] = -1; + force[i] = 0; + force_exists[i] = -1; + purge[i] = 0; + purge_exists[i] = 0; + event[i] = 0; + event_exists[i] = 0; + title_splash[i] = 0; + title_splash_exists[i] = 0; -var i;i=-1; -repeat(301){i+=1; - creation[i]=0;creation_exists[i]=-1; - main[i]=0;main_exists[i]=-1; - existing[i]=0;existing_exists[i]=-1; - others[i]=0;others_exists[i]=-1; - advisor[i]=0;advisor_exists[i]=-1; - diplomacy_splash[i]=0;diplomacy_splash_exists[i]=-1; - diplomacy_daemon[i]=0;diplomacy_daemon_exists[i]=-1; - diplomacy_icon[i]=-1;diplomacy_icon_exists[i]=-1; - menu[i]=0;menu_exists[i]=-1; - loading[i]=0;loading_exists[i]=-1; - postbattle[i]=0;postbattle_exists[i]=-1; - postspace[i]=0;postspace_exists[i]=-1; - formation[i]=0;formation_exists[i]=-1; - popup[i]=0;popup_exists[i]=-1; - commander[i]=0;commander_exists[i]=-1; - planet_good[i]=0;planet_exists[i]=-1; - attacked[i]=0;attacked_exists[i]=-1; - force[i]=0;force_exists[i]=-1; - purge[i]=0;purge_exists[i]=0; - event[i]=0;event_exists[i]=0; - title_splash[i]=0;title_splash_exists[i]=0; - - symbol[i]=0;symbol_exists[i]=0; - defeat[i]=0;defeat_exists[i]=0; - slate[i]=0;slate_exists[i]=0; - + symbol[i] = 0; + symbol_exists[i] = 0; + defeat[i] = 0; + defeat_exists[i] = 0; + slate[i] = 0; + slate_exists[i] = 0; } -creation_good=false; -splash_good=false; -advisor_good=false; -diplomacy_splash_good=false; -diplomacy_daemon_good=false; -diplomacy_icon_good=false; -menu_good=false; -loading_good=false; -postbattle_good=false; -postspace_good=false; -formation_good=false; -popup_good=false; -commander_good=false; -planet_good=false; -attacked_good=false; -force_good=false; -purge_good=false; -event_good=false; -title_splash_good=false; +creation_good = false; +splash_good = false; +advisor_good = false; +diplomacy_splash_good = false; +diplomacy_daemon_good = false; +diplomacy_icon_good = false; +menu_good = false; +loading_good = false; +postbattle_good = false; +postspace_good = false; +formation_good = false; +popup_good = false; +commander_good = false; +planet_good = false; +attacked_good = false; +force_good = false; +purge_good = false; +event_good = false; +title_splash_good = false; -symbol_good=false; -defeat_good=false; -slate_good=false; +symbol_good = false; +defeat_good = false; +slate_good = false; // End Image Replacer // Start Text Replacer -scr_image("force",-50,0,0,0,0) - - - - +scr_image("force", -50, 0, 0, 0, 0); diff --git a/objects/obj_img/Draw_0.gml b/objects/obj_img/Draw_0.gml index 06ba930ca7..caaa2ace76 100644 --- a/objects/obj_img/Draw_0.gml +++ b/objects/obj_img/Draw_0.gml @@ -1,6 +1,3 @@ // Prints a blue circle in the upper left corner. Some leftover debug stuff? //draw_set_alpha(1);draw_set_halign(fa_left);draw_set_color(c_blue); -//draw_circle(__view_get( e__VW.XView, 0 )+20,__view_get( e__VW.YView, 0 )+20,32,0); - - - +//draw_circle(__view_get( e__VW.XView, 0 )+20,__view_get( e__VW.YView, 0 )+20,32,0); diff --git a/objects/obj_img/Other_4.gml b/objects/obj_img/Other_4.gml index ea43244db1..8bca8c93f8 100644 --- a/objects/obj_img/Other_4.gml +++ b/objects/obj_img/Other_4.gml @@ -1,11 +1,8 @@ - -if (room_get_name(room)="Creation"){ - if (creation_good=false) and (splash_good=false){ - scr_image("creation",-50,0,0,0,0); - scr_image("main_splash",-50,0,0,0,0); - scr_image("existing_splash",-50,0,0,0,0); - scr_image("other_splash",-50,0,0,0,0); +if (room_get_name(room) == "Creation") { + if ((creation_good == false) && (splash_good == false)) { + scr_image("creation", -50, 0, 0, 0, 0); + scr_image("main_splash", -50, 0, 0, 0, 0); + scr_image("existing_splash", -50, 0, 0, 0, 0); + scr_image("other_splash", -50, 0, 0, 0, 0); } } - - diff --git a/objects/obj_img/Other_5.gml b/objects/obj_img/Other_5.gml index c170dd769e..ca9d5eb06b 100644 --- a/objects/obj_img/Other_5.gml +++ b/objects/obj_img/Other_5.gml @@ -1,17 +1,12 @@ - -if (room_get_name(room)="Creation"){ - if (creation_good=false) and (splash_good=false){ - scr_image("creation",-666,0,0,0,0); - scr_image("main_splash",-666,0,0,0,0); - scr_image("existing_splash",-666,0,0,0,0); - scr_image("other_splash",-666,0,0,0,0); +if (room_get_name(room) == "Creation") { + if ((creation_good == false) && (splash_good == false)) { + scr_image("creation", -666, 0, 0, 0, 0); + scr_image("main_splash", -666, 0, 0, 0, 0); + scr_image("existing_splash", -666, 0, 0, 0, 0); + scr_image("other_splash", -666, 0, 0, 0, 0); } } - -if (room_get_name(room)="Game"){ - scr_image("all",-666,0,0,0,0); +if (room_get_name(room) == "Game") { + scr_image("all", -666, 0, 0, 0, 0); } - - - diff --git a/objects/obj_img/Step_0.gml b/objects/obj_img/Step_0.gml index 513edc1c2d..7dd450ea15 100644 --- a/objects/obj_img/Step_0.gml +++ b/objects/obj_img/Step_0.gml @@ -1,78 +1,146 @@ - - //if ((instance_exists(obj_turn_end)) or (instance_exists(obj_fleet)) or (instance_exists(obj_star_select))) and (force_good=false) then scr_image("force",-50,0,0,0,0); //if (!instance_exists(obj_turn_end)) and (!instance_exists(obj_fleet) and (!instance_exists(obj_star_select))) and (force_good=true) then scr_image("force",-666,0,0,0,0); +if ((!instance_exists(obj_fleet)) && (!instance_exists(obj_ncombat))) { + if (instance_exists(obj_controller)) { + if ((obj_controller.diplomacy == 0) && (obj_controller.menu == eMENU.Diplomacy) && (diplomacy_icon_good == false)) { + scr_image("diplomacy_icon", -50, 0, 0, 0, 0); + scr_image("symbol", -50, 0, 0, 0, 0); + } + if ((obj_controller.menu != 20) && (diplomacy_icon_good == true)) { + scr_image("diplomacy_icon", -666, 0, 0, 0, 0); + scr_image("symbol", -666, 0, 0, 0, 0); + } + + if ((obj_controller.diplomacy > 0) && (diplomacy_splash_good == false)) { + scr_image("diplomacy_splash", -50, 0, 0, 0, 0); + } + if ((obj_controller.diplomacy == 0) && (diplomacy_splash_good == true)) { + scr_image("diplomacy_splash", -666, 0, 0, 0, 0); + } -if (!instance_exists(obj_fleet)) and (!instance_exists(obj_ncombat)){ - - if (instance_exists(obj_controller)){ - if (obj_controller.diplomacy=0) and (obj_controller.menu==eMENU.Diplomacy) and (diplomacy_icon_good=false){ - scr_image("diplomacy_icon",-50,0,0,0,0); - scr_image("symbol",-50,0,0,0,0); + var adv_goo; + adv_goo = 0; + if ((obj_controller.diplomacy < -5) && (obj_controller.diplomacy > -6)) { + adv_goo += 1; } - if (obj_controller.menu!=20) and (diplomacy_icon_good=true){ - scr_image("diplomacy_icon",-666,0,0,0,0); - scr_image("symbol",-666,0,0,0,0); + if ((obj_controller.menu >= 11) && (obj_controller.menu <= 16)) { + adv_goo += 1; } - - if (obj_controller.diplomacy>0) and (diplomacy_splash_good=false) then scr_image("diplomacy_splash",-50,0,0,0,0); - if (obj_controller.diplomacy=0) and (diplomacy_splash_good=true) then scr_image("diplomacy_splash",-666,0,0,0,0); - - var adv_goo;adv_goo=0; - if (obj_controller.diplomacy<-5) and (obj_controller.diplomacy>-6){adv_goo+=1;} - if (obj_controller.menu>=11) and (obj_controller.menu<=16){adv_goo+=1;} - if (obj_controller.menu>=500) and (obj_controller.menu<=510){adv_goo+=1;} - if (adv_goo>0) and (advisor_good=false) then scr_image("advisor",-50,0,0,0,0); - if (adv_goo=0) and (advisor_good=true) then scr_image("advisor",-666,0,0,0,0); - + if ((obj_controller.menu >= 500) && (obj_controller.menu <= 510)) { + adv_goo += 1; + } + if ((adv_goo > 0) && (advisor_good == false)) { + scr_image("advisor", -50, 0, 0, 0, 0); + } + if ((adv_goo == 0) && (advisor_good == true)) { + scr_image("advisor", -666, 0, 0, 0, 0); + } + //if (obj_controller.diplomacy>10) and (obj_controller.diplomacy<11) and (diplomacy_daemon_good=false) then scr_image("diplomacy_daemon",-50,0,0,0,0); - //if (obj_controller.diplomacy<=10) or (obj_controller.diplomacy>=11) and (diplomacy_daemon_good=true) then scr_image("diplomacy_daemon",-666,0,0,0,0); - - if (obj_controller.menu=24) and (obj_controller.formating>0) and (formation_good=false) then scr_image("formation",-50,0,0,0,0); - if (obj_controller.menu!=24) or (obj_controller.formating<=0) and (formation_good=true) then scr_image("formation",-666,0,0,0,0); - } - - var crea_goo;crea_goo=0; - if (instance_exists(obj_controller)){if (!instance_exists(obj_fleet)) and (!instance_exists(obj_ncombat)) then crea_goo+=1;} - if (instance_exists(obj_creation)) then crea_goo+=1; - if (room_get_name(room)="Defeat") then crea_goo+=1; - if (crea_goo>0) and (creation_good=false) then scr_image("creation",-50,0,0,0,0); - if (crea_goo<=0) and (creation_good=true) then scr_image("creation",-666,0,0,0,0); - - if (instance_exists(obj_ingame_menu)) and (menu_good=false) then scr_image("menu",-50,0,0,0,0); - if (!instance_exists(obj_ingame_menu)) and (menu_good=true) then scr_image("menu",-666,0,0,0,0); - - if (instance_exists(obj_fleet)) and (postspace_good=false) then scr_image("postspace",-50,0,0,0,0); - if (!instance_exists(obj_fleet)) and (postspace_good=true) then scr_image("postspace",-666,0,0,0,0); - - if (instance_exists(obj_popup)) and (popup_good=false) then scr_image("popup",-50,0,0,0,0); - if (!instance_exists(obj_popup)) and (popup_good=true) then scr_image("popup",-666,0,0,0,0); - - if (instance_exists(obj_creation)) and (commander_good=false) then scr_image("commander",-50,0,0,0,0); - if (!instance_exists(obj_creation)) and (commander_good=true) then scr_image("commander",-666,0,0,0,0); - if (instance_exists(obj_creation)) and (slate_good=false) then scr_image("slate",-50,0,0,0,0); - if (!instance_exists(obj_creation)) and (slate_good=true) then scr_image("slate",-666,0,0,0,0); - - if ((instance_exists(obj_creation)) or (instance_exists(obj_star_select))) and (planet_good=false) then scr_image("planet",-50,0,0,0,0); - if (!instance_exists(obj_creation)) and (!instance_exists(obj_star_select)) and (planet_good=true) then scr_image("planet",-666,0,0,0,0); - - if (instance_exists(obj_turn_end)) and (attacked_good=false) then scr_image("attacked",-50,0,0,0,0); - if (!instance_exists(obj_turn_end)) and (attacked_good=true) then scr_image("attacked",-666,0,0,0,0); - - if (instance_exists(obj_drop_select)) and (purge_good=false) then scr_image("purge",-50,0,0,0,0); - if (!instance_exists(obj_drop_select)) and (purge_good=true) then scr_image("purge",-666,0,0,0,0); - - if (instance_exists(obj_event)) and (event_good=false) then scr_image("event",-50,0,0,0,0); - if (!instance_exists(obj_event)) and (event_good=true) then scr_image("event",-666,0,0,0,0); - - if (room_get_name(room)="Main_Menu") and (title_splash_good=false) then scr_image("title_splash",-50,0,0,0,0); - if (room_get_name(room)!="Main_Menu") and (title_splash_good=true) then scr_image("title_splash",-666,0,0,0,0); - - if (room_get_name(room)="Defeat") and (defeat_good=false) then scr_image("defeat",-50,0,0,0,0); - if (room_get_name(room)!="Defeat") and (defeat_good=true) then scr_image("defeat",-666,0,0,0,0); + //if (obj_controller.diplomacy<=10) or (obj_controller.diplomacy>=11) and (diplomacy_daemon_good=true) then scr_image("diplomacy_daemon",-666,0,0,0,0); -} + if ((obj_controller.menu == 24) && (obj_controller.formating > 0) && (formation_good == false)) { + scr_image("formation", -50, 0, 0, 0, 0); + } + if ((obj_controller.menu != 24) || (obj_controller.formating <= 0) && (formation_good == true)) { + scr_image("formation", -666, 0, 0, 0, 0); + } + } + + var crea_goo; + crea_goo = 0; + if (instance_exists(obj_controller)) { + if ((!instance_exists(obj_fleet)) && (!instance_exists(obj_ncombat))) { + crea_goo += 1; + } + } + if (instance_exists(obj_creation)) { + crea_goo += 1; + } + if (room_get_name(room) == "Defeat") { + crea_goo += 1; + } + if ((crea_goo > 0) && (creation_good == false)) { + scr_image("creation", -50, 0, 0, 0, 0); + } + if ((crea_goo <= 0) && (creation_good == true)) { + scr_image("creation", -666, 0, 0, 0, 0); + } + + if (instance_exists(obj_ingame_menu) && (menu_good == false)) { + scr_image("menu", -50, 0, 0, 0, 0); + } + if ((!instance_exists(obj_ingame_menu)) && (menu_good == true)) { + scr_image("menu", -666, 0, 0, 0, 0); + } + + if (instance_exists(obj_fleet) && (postspace_good == false)) { + scr_image("postspace", -50, 0, 0, 0, 0); + } + if ((!instance_exists(obj_fleet)) && (postspace_good == true)) { + scr_image("postspace", -666, 0, 0, 0, 0); + } + + if (instance_exists(obj_popup) && (popup_good == false)) { + scr_image("popup", -50, 0, 0, 0, 0); + } + if ((!instance_exists(obj_popup)) && (popup_good == true)) { + scr_image("popup", -666, 0, 0, 0, 0); + } + + if (instance_exists(obj_creation) && (commander_good == false)) { + scr_image("commander", -50, 0, 0, 0, 0); + } + if ((!instance_exists(obj_creation)) && (commander_good == true)) { + scr_image("commander", -666, 0, 0, 0, 0); + } + if (instance_exists(obj_creation) && (slate_good == false)) { + scr_image("slate", -50, 0, 0, 0, 0); + } + if ((!instance_exists(obj_creation)) && (slate_good == true)) { + scr_image("slate", -666, 0, 0, 0, 0); + } + + if ((instance_exists(obj_creation) || instance_exists(obj_star_select)) && (planet_good == false)) { + scr_image("planet", -50, 0, 0, 0, 0); + } + if ((!instance_exists(obj_creation)) && (!instance_exists(obj_star_select)) && (planet_good == true)) { + scr_image("planet", -666, 0, 0, 0, 0); + } + if (instance_exists(obj_turn_end) && (attacked_good == false)) { + scr_image("attacked", -50, 0, 0, 0, 0); + } + if ((!instance_exists(obj_turn_end)) && (attacked_good == true)) { + scr_image("attacked", -666, 0, 0, 0, 0); + } + if (instance_exists(obj_drop_select) && (purge_good == false)) { + scr_image("purge", -50, 0, 0, 0, 0); + } + if ((!instance_exists(obj_drop_select)) && (purge_good == true)) { + scr_image("purge", -666, 0, 0, 0, 0); + } + + if (instance_exists(obj_event) && (event_good == false)) { + scr_image("event", -50, 0, 0, 0, 0); + } + if ((!instance_exists(obj_event)) && (event_good == true)) { + scr_image("event", -666, 0, 0, 0, 0); + } + if ((room_get_name(room) == "Main_Menu") && (title_splash_good == false)) { + scr_image("title_splash", -50, 0, 0, 0, 0); + } + if ((room_get_name(room) != "Main_Menu") && (title_splash_good == true)) { + scr_image("title_splash", -666, 0, 0, 0, 0); + } + + if ((room_get_name(room) == "Defeat") && (defeat_good == false)) { + scr_image("defeat", -50, 0, 0, 0, 0); + } + if ((room_get_name(room) != "Defeat") && (defeat_good == true)) { + scr_image("defeat", -666, 0, 0, 0, 0); + } +} diff --git a/objects/obj_star/Alarm_0.gml b/objects/obj_star/Alarm_0.gml index 09b69d56cc..36e71c0a3e 100644 --- a/objects/obj_star/Alarm_0.gml +++ b/objects/obj_star/Alarm_0.gml @@ -1,72 +1,80 @@ // This will create a system, with all the planet setup. It also does naming of stars, eldar craft worlds and space hulks -if (obj_controller.craftworld==0) and (space_hulk==0){ - var test,oldx,oldy; - oldx=x; - oldy=y; - x-=5000; - y-=5000; - test=instance_nearest(oldx+choose(random(200),1*-random(200)),oldy+choose(random(200),1*-random(200)),obj_star); - x2=test.x; - y2=test.y; - x=oldx; - y=oldy; +if ((obj_controller.craftworld == 0) && (space_hulk == 0)) { + var test, oldx, oldy; + oldx = x; + oldy = y; + x -= 5000; + y -= 5000; + test = instance_nearest(oldx + choose(random(200), 1 * -random(200)), oldy + choose(random(200), 1 * -random(200)), obj_star); + x2 = test.x; + y2 = test.y; + x = oldx; + y = oldy; } // Generate star name -for(var i=0; i<80; i++){ - if ((name=="random") or (name=="")) and (craftworld==0) and (space_hulk==0) { - var new_star_name = global.name_generator.generate_star_name(); - name = new_star_name; - obj_controller.star_names+=new_star_name; // TODO make sure it's always unique. Although star_names should just be removed, frankly. - }; - if (name=="") and (craftworld) then global.name_generator.generate_eldar_name(3); +for (var i = 0; i < 80; i++) { + if (((name == "random") || (name == "")) && (craftworld == 0) && (space_hulk == 0)) { + var new_star_name = global.name_generator.generate_star_name(); + name = new_star_name; + obj_controller.star_names += new_star_name; // TODO make sure it's always unique. Although star_names should just be removed, frankly. + } + if ((name == "") && craftworld) { + global.name_generator.generate_eldar_name(3); + } } // Sets up an eldar craftworld -if (obj_controller.craftworld) and (space_hulk==0){ - star="craftworld"; - sprite_index=spr_craftworld; - image_index=0; - image_speed=0; - planets=1; - p_type[1]="Craftworld"; - heresy=-999; - p_owner[1]=6; - p_first[1]=6; +if (obj_controller.craftworld && (space_hulk == 0)) { + star = "craftworld"; + sprite_index = spr_craftworld; + image_index = 0; + image_speed = 0; + planets = 1; + p_type[1] = "Craftworld"; + heresy = -999; + p_owner[1] = 6; + p_first[1] = 6; owner = eFACTION.Eldar; - p_population[1]=floor(random_range(150000,300000)); - p_fortified[1]=6; - p_eldar[1]=6; - old_x=x; - old_y=y; + p_population[1] = floor(random_range(150000, 300000)); + p_fortified[1] = 6; + p_eldar[1] = 6; + old_x = x; + old_y = y; exit; } // Sets up the space hulk -if (space_hulk==1){ - star="space_hulk"; - sprite_index=spr_star_hulk; - image_index=0; - image_speed=0; - planets=1; - p_type[1]="Space Hulk"; - heresy=-999; - p_owner[1]=2; - p_population[1]=0; - p_fortified[1]=5; - - var faction=choose(7,9,9,9,9,9,10); - if (faction == eFACTION.Ork) then p_orks[1]=choose(3,4,5); - if (faction == eFACTION.Tyranids) then p_tyranids[1]=choose(3,4,5); - if (faction == eFACTION.Chaos) then p_traitors[1]=choose(2,3,4); - - p_first[1]=faction; - - old_x=x; - old_y=y; - p_owner[1]=faction; - vision=1; +if (space_hulk == 1) { + star = "space_hulk"; + sprite_index = spr_star_hulk; + image_index = 0; + image_speed = 0; + planets = 1; + p_type[1] = "Space Hulk"; + heresy = -999; + p_owner[1] = 2; + p_population[1] = 0; + p_fortified[1] = 5; + + var faction = choose(7, 9, 9, 9, 9, 9, 10); + if (faction == eFACTION.Ork) { + p_orks[1] = choose(3, 4, 5); + } + if (faction == eFACTION.Tyranids) { + p_tyranids[1] = choose(3, 4, 5); + } + if (faction == eFACTION.Chaos) { + p_traitors[1] = choose(2, 3, 4); + } + + p_first[1] = faction; + + old_x = x; + old_y = y; + p_owner[1] = faction; + vision = 1; exit; } // Sets up the star type -var rui=choose(0,0,0,0,1,1,2,2,3,4,5); +var rui = choose(0, 0, 0, 0, 1, 1, 2, 2, 3, 4, 5); switch (rui) { case 0: star = "orange1"; @@ -93,8 +101,8 @@ switch (rui) { image_index = 5; break; } -image_speed=0; -image_alpha=1; +image_speed = 0; +image_alpha = 1; // Sets up number of planets per star switch (star) { case "orange1": @@ -188,11 +196,11 @@ switch (name) { break; } -var a=99,b=99,c=99,d=99,e="",f=0,g="",h=0; +var a = 99, b = 99, c = 99, d = 99, e = "", f = 0, g = "", h = 0; // Sets up points value for each planet on the system // TODO in here the map generation should be called for each planet -for(var i=0; i<10; i++){ - e=p_type[1]; +for (var i = 0; i < 10; i++) { + e = p_type[1]; switch (e) { case "Lava": a = 1; @@ -225,7 +233,7 @@ for(var i=0; i<10; i++){ a = 1; break; } - e=p_type[2]; + e = p_type[2]; switch (e) { case "Lava": b = 1; @@ -258,7 +266,7 @@ for(var i=0; i<10; i++){ b = 2.5; break; } - e=p_type[3]; + e = p_type[3]; switch (e) { case "Lava": c = 1; @@ -291,7 +299,7 @@ for(var i=0; i<10; i++){ c = 3.5; break; } - e=p_type[4]; + e = p_type[4]; switch (e) { case "Lava": d = 1; @@ -325,50 +333,58 @@ for(var i=0; i<10; i++){ break; } // Arranges planets based on which type got assigned to what order - if (d=10000000){ - var military=p_population[i]/470; - p_guardsmen[i]=floor(military*0.25); - p_pdf[i]=floor(military*0.75); + if (p_population[i] >= 10000000) { + var military = p_population[i] / 470; + p_guardsmen[i] = floor(military * 0.25); + p_pdf[i] = floor(military * 0.75); } - if (p_population[i]>=5000000) and (p_population[i]<10000000){ - var military=p_population[i]/200; - p_guardsmen[i]=floor(military*0.25); - p_pdf[i]=floor(military*0.75); + if ((p_population[i] >= 5000000) && (p_population[i] < 10000000)) { + var military = p_population[i] / 200; + p_guardsmen[i] = floor(military * 0.25); + p_pdf[i] = floor(military * 0.75); } - if (p_population[i]>=100000) and (p_population[i]<5000000){ - var military=p_population[i]/50; - p_guardsmen[i]=floor(military*0.25); - p_pdf[i]=floor(military*0.75); + if ((p_population[i] >= 100000) && (p_population[i] < 5000000)) { + var military = p_population[i] / 50; + p_guardsmen[i] = floor(military * 0.25); + p_pdf[i] = floor(military * 0.75); } - if (p_population[i]<100000) and (p_population[i]>5) and (p_large[i]==0){ - p_pdf[i]=floor(p_population[i]/25); + if ((p_population[i] < 100000) && (p_population[i] > 5) && (p_large[i] == 0)) { + p_pdf[i] = floor(p_population[i] / 25); } - if (p_population[i]<2000) and (p_population[i]>5) and (p_large[i]==0){ - p_pdf[i]=floor(p_population[i]/10); + if ((p_population[i] < 2000) && (p_population[i] > 5) && (p_large[i] == 0)) { + p_pdf[i] = floor(p_population[i] / 10); } - if (p_large[i]==1){ - p_guardsmen[i]=floor(p_population[i]*1250000); - p_pdf[i]=p_guardsmen[i]*3; + if (p_large[i] == 1) { + p_guardsmen[i] = floor(p_population[i] * 1250000); + p_pdf[i] = p_guardsmen[i] * 3; } - - if (p_population[i]<1000000) and (p_large[i]==0)then p_pop[i]=string(p_population[i]); - if (p_population[i]>999999) and (p_large[i]==0)and (p_population[i]<1000000000) then p_pop[i]=string(p_population[i]/1000000)+"M"; - if (p_large[i]==1) then p_pop[i]=string(p_population[i])+"B"; - - if (craftworld==1){ - p_guardsmen[i]=0; - p_pdf[i]=0; - p_eldar[i]=6; + + if ((p_population[i] < 1000000) && (p_large[i] == 0)) { + p_pop[i] = string(p_population[i]); + } + if ((p_population[i] > 999999) && (p_large[i] == 0) && (p_population[i] < 1000000000)) { + p_pop[i] = string(p_population[i] / 1000000) + "M"; + } + if (p_large[i] == 1) { + p_pop[i] = string(p_population[i]) + "B"; + } + + if (craftworld == 1) { + p_guardsmen[i] = 0; + p_pdf[i] = 0; + p_eldar[i] = 6; owner = eFACTION.Eldar; - p_owner[1]=6; - warp_lanes=[]; - x2=0; + p_owner[1] = 6; + warp_lanes = []; + x2 = 0; } // p_guardsmen[i]=0; } -for(var i=1; i<=4; i++){p_guardsmen[i]=0;} +for (var i = 1; i <= 4; i++) { + p_guardsmen[i] = 0; +} -var fleet, system_fleet=0,capital=0,frigate=0,escort=0; +var fleet, system_fleet = 0, capital = 0, frigate = 0, escort = 0; // Create Imperium Fleet -if (owner == eFACTION.Imperium || owner == eFACTION.Ork || owner == eFACTION.Mechanicus){ - for(var g=1; g<=4; g++){ +if (owner == eFACTION.Imperium || owner == eFACTION.Ork || owner == eFACTION.Mechanicus) { + for (var g = 1; g <= 4; g++) { switch (p_type[g]) { case "Hive": system_fleet += 4; @@ -143,153 +151,185 @@ if (owner == eFACTION.Imperium || owner == eFACTION.Ork || owner == eFACTION.Mec break; } } - - frigate=round(system_fleet/2); - escort=round(system_fleet); - - if (capital<0) then capital=0; - if (frigate<0) then frigate=0; - if (escort<0) then escort=0; - - if (system_fleet>0){ // DISABLED FOR TESTING FLEET COMBAT - fleet=instance_create(x,y,obj_en_fleet); + + frigate = round(system_fleet / 2); + escort = round(system_fleet); + + if (capital < 0) { + capital = 0; + } + if (frigate < 0) { + frigate = 0; + } + if (escort < 0) { + escort = 0; + } + + if (system_fleet > 0) { + // DISABLED FOR TESTING FLEET COMBAT + fleet = instance_create(x, y, obj_en_fleet); fleet.owner = eFACTION.Imperium; - - fleet.capital_number=capital; - fleet.frigate_number=frigate; - fleet.escort_number=escort; - + + fleet.capital_number = capital; + fleet.frigate_number = frigate; + fleet.escort_number = escort; + // present_fleet[2]+=1; - + // Create ships here - fleet.image_speed=0; - var ii=0; - ii+=capital-1; - ii+=round((frigate/2)); - ii+=round((escort/4)); - if (ii<=1) and (capital+frigate+escort>0) then ii=1; - fleet.image_index=ii; + fleet.image_speed = 0; + var ii = 0; + ii += capital - 1; + ii += round((frigate / 2)); + ii += round((escort / 4)); + if ((ii <= 1) && (capital + frigate + escort > 0)) { + ii = 1; + } + fleet.image_index = ii; } } // Creates Ork forces -if (owner == eFACTION.Ork){ - if (p_population[1]>0) then p_orks[1]=1; - if (p_population[2]>0) then p_orks[2]=1; - if (p_population[3]>0) then p_orks[3]=1; - if (p_population[4]>0) then p_orks[4]=1; - - if (p_orks[1]>0){p_orks[1]=choose(1,2,3,3,4,5); - if (p_type[1]="Forge") or (p_type[1]="Hive") then p_orks[1]=choose(4,5);} - if (p_orks[2]>0){p_orks[2]=choose(1,2,3,3,4,5); - if (p_type[2]="Forge") or (p_type[2]="Hive") then p_orks[2]=choose(4,5);} - if (p_orks[3]>0){p_orks[3]=choose(1,2,3,3,4,5); - if (p_type[3]="Forge") or (p_type[3]="Hive") then p_orks[3]=choose(4,5);} - if (p_orks[4]>0){p_orks[4]=choose(1,2,3,3,4,5); - if (p_type[4]="Forge") or (p_type[4]="Hive") then p_orks[4]=choose(4,5);} +if (owner == eFACTION.Ork) { + if (p_population[1] > 0) { + p_orks[1] = 1; + } + if (p_population[2] > 0) { + p_orks[2] = 1; + } + if (p_population[3] > 0) { + p_orks[3] = 1; + } + if (p_population[4] > 0) { + p_orks[4] = 1; + } + + if (p_orks[1] > 0) { + p_orks[1] = choose(1, 2, 3, 3, 4, 5); + if ((p_type[1] == "Forge") || (p_type[1] == "Hive")) { + p_orks[1] = choose(4, 5); + } + } + if (p_orks[2] > 0) { + p_orks[2] = choose(1, 2, 3, 3, 4, 5); + if ((p_type[2] == "Forge") || (p_type[2] == "Hive")) { + p_orks[2] = choose(4, 5); + } + } + if (p_orks[3] > 0) { + p_orks[3] = choose(1, 2, 3, 3, 4, 5); + if ((p_type[3] == "Forge") || (p_type[3] == "Hive")) { + p_orks[3] = choose(4, 5); + } + } + if (p_orks[4] > 0) { + p_orks[4] = choose(1, 2, 3, 3, 4, 5); + if ((p_type[4] == "Forge") || (p_type[4] == "Hive")) { + p_orks[4] = choose(4, 5); + } + } } -system_fleet=1; -capital=0; -frigate=0; -escort=0; +system_fleet = 1; +capital = 0; +frigate = 0; +escort = 0; // Create Tau Fleet -if (owner == eFACTION.Tau){ +if (owner == eFACTION.Tau) { for (var i = 1; i <= planets; i++) { if (p_type[i] == "Desert") { system_fleet += 5; } } - - if (system_fleet>=4){ - capital=choose(1,2,2,2,3,4); - frigate=floor(random_range(5,10)); - escort=floor(random_range(8,14)); - } - if (system_fleet>=1) and (system_fleet<3){ - capital=choose(1,2,2); - frigate=floor(random_range(4,8)); - escort=floor(random_range(5,12)); - } - if (system_fleet>0){ - fleet=instance_create(x,y,obj_en_fleet); + + if (system_fleet >= 4) { + capital = choose(1, 2, 2, 2, 3, 4); + frigate = floor(random_range(5, 10)); + escort = floor(random_range(8, 14)); + } + if ((system_fleet >= 1) && (system_fleet < 3)) { + capital = choose(1, 2, 2); + frigate = floor(random_range(4, 8)); + escort = floor(random_range(5, 12)); + } + if (system_fleet > 0) { + fleet = instance_create(x, y, obj_en_fleet); fleet.owner = eFACTION.Tau; // Create ships here - fleet.sprite_index=spr_fleet_tau; - fleet.image_speed=0; - - fleet.capital_number=capital; - fleet.frigate_number=frigate; - fleet.escort_number=escort; - - fleet.image_index=floor((capital)+(frigate/2)+(escort/4)); + fleet.sprite_index = spr_fleet_tau; + fleet.image_speed = 0; + + fleet.capital_number = capital; + fleet.frigate_number = frigate; + fleet.escort_number = escort; + + fleet.image_index = floor(capital + (frigate / 2) + (escort / 4)); } - - for (var i = 1; i <=planets; i++) { + + for (var i = 1; i <= planets; i++) { if (p_type[i] != "Dead") { - p_tau[i] = choose(1,2,3,4); + p_tau[i] = choose(1, 2, 3, 4); } } - for (var i = 1; i <=planets; i++) { + for (var i = 1; i <= planets; i++) { if (p_type[i] == "Desert" && p_tau[i] < 4) { p_tau[i] = 4; } } - for (var i = 1; i <=planets; i++) { + for (var i = 1; i <= planets; i++) { if (p_tau[i] > 0) { p_owner[i] = 8; p_first[i] = 8; - + switch (p_type[i]) { case "Forge": case "Hive": - p_tau[i] = choose(2,3); + p_tau[i] = choose(2, 3); break; case "Ice": - p_tau[i] = choose(1,2); + p_tau[i] = choose(1, 2); break; case "Temperate": case "Desert": case "Feudal": - p_tau[i] = choose(3,3,4,4,5); + p_tau[i] = choose(3, 3, 4, 4, 5); break; } } } - for (var i=1;i<=planets;i++){ - p_owner[i]=eFACTION.Tau; - p_first[i]=eFACTION.Tau; - p_influence[i][eFACTION.Tau]=65+irandom(15); + for (var i = 1; i <= planets; i++) { + p_owner[i] = eFACTION.Tau; + p_first[i] = eFACTION.Tau; + p_influence[i][eFACTION.Tau] = 65 + irandom(15); } } // Create Nids -if (owner == eFACTION.Tyranids){ +if (owner == eFACTION.Tyranids) { for (var i = 1; i <= planets; i++) { if (p_population[i] > 0) { p_tyranids[i] = 1; - + switch (p_type[i]) { case "Forge": case "Hive": - p_tyranids[i] = choose(4,5,5); + p_tyranids[i] = choose(4, 5, 5); break; } //array_push(p_feature[i], new NewPlanetFeature(P_features.Gene_Stealer_Cult)); - } p_owner[i] = eFACTION.Imperium; } } -if (owner>20){ +if (owner > 20) { for (var i = 1; i <= planets; i++) { if (p_population[i] > 0) { var new_cult = new NewPlanetFeature(P_features.Gene_Stealer_Cult); array_push(p_feature[i], new_cult); - new_cult.cult_age = irandom(300) - p_influence[i][eFACTION.Tyranids] = new_cult.cult_age/10 + irandom(30); - p_tyranids[i] = min(3, floor(p_influence[i][eFACTION.Tyranids]/15)) - if (p_tyranids[i]!=0){ - new_cult.hiding =false; + new_cult.cult_age = irandom(300); + p_influence[i][eFACTION.Tyranids] = new_cult.cult_age / 10 + irandom(30); + p_tyranids[i] = min(3, floor(p_influence[i][eFACTION.Tyranids] / 15)); + if (p_tyranids[i] != 0) { + new_cult.hiding = false; } } p_owner[i] = 2; @@ -297,22 +337,22 @@ if (owner>20){ owner = eFACTION.Tyranids; } -for(var i=1; i<=planets; i++){ - if (p_owner[i]=8) and (p_guardsmen[i]>0){ - p_pdf[i]+=p_guardsmen[i]; - p_guardsmen[i]=0; +for (var i = 1; i <= planets; i++) { + if ((p_owner[i] == 8) && (p_guardsmen[i] > 0)) { + p_pdf[i] += p_guardsmen[i]; + p_guardsmen[i] = 0; } - if (p_type[i]="Shrine") and (p_owner[i]!=1) and (p_first[i]!=1){ - p_owner[i]=5; - p_first[i]=5; - p_sisters[i]=4; - adjust_influence(eFACTION.Ecclesiarchy, (p_sisters[i]*10)-irandom(5), i); + if ((p_type[i] == "Shrine") && (p_owner[i] != 1) && (p_first[i] != 1)) { + p_owner[i] = 5; + p_first[i] = 5; + p_sisters[i] = 4; + adjust_influence(eFACTION.Ecclesiarchy, (p_sisters[i] * 10) - irandom(5), i); } // if (p_owner[i]=3) or (p_owner[i]=5){p_feature[i]="Artifact|";}Testing ; 137 } -if (name=="Kim Jong") and (owner == eFACTION.Chaos){ - for (var i = 1; i <=planets; i++) { +if ((name == "Kim Jong") && (owner == eFACTION.Chaos)) { + for (var i = 1; i <= planets; i++) { if (p_type[i] != "Dead") { p_heresy[i] = 100; p_traitors[i] = 2; @@ -320,30 +360,32 @@ if (name=="Kim Jong") and (owner == eFACTION.Chaos){ } } -obj_controller.alarm[3]=1; +obj_controller.alarm[3] = 1; + +var i = choose(0, 1); +if ((i == 1) && (planets > 0)) { + var nostart = false, aa = 0; + i = floor(random(planets)) + 1; -var i=choose(0,1); -if (i==1) and (planets>0){ - var nostart=false,aa=0; - i=floor(random(planets))+1; - if (instance_exists(obj_p_fleet)) { aa = instance_nearest(x, y, obj_p_fleet); if (point_distance(x, y, aa.x, aa.y) > 50) { nostart = true; } } - if (!instance_exists(obj_p_fleet)) then nostart=true; - - if (array_length(p_feature[i])==0) and (p_owner[i]!=1) and (nostart){ - var ranb=0; - // if (ranb=1) and (p_owner[i]!=1) and (p_owner[i]!=2) and (p_owner[i]!=3) then ranb=floor(random(4))+2; - // - var goo=0; - if (goo==0){ - for(var j=0; j<10; j++){ - if (goo==0)and (irandom(9)<2){ - ranb=floor(random(6))+1; + if (!instance_exists(obj_p_fleet)) { + nostart = true; + } + + if ((array_length(p_feature[i]) == 0) && (p_owner[i] != 1) && nostart) { + var ranb = 0; + // if (ranb=1) and (p_owner[i]!=1) and (p_owner[i]!=2) and (p_owner[i]!=3) then ranb=floor(random(4))+2; + // + var goo = 0; + if (goo == 0) { + for (var j = 0; j < 10; j++) { + if ((goo == 0) && (irandom(9) < 2)) { + ranb = floor(random(6)) + 1; switch (name) { case "Vulvis Major": @@ -356,78 +398,82 @@ if (i==1) and (planets>0){ ranb = 5; break; } - - if (goo==0){ - switch (ranb){ + + if (goo == 0) { + switch (ranb) { case 1: - array_push(p_feature[i], new NewPlanetFeature(P_features.Sororitas_Cathedral)) - if (p_heresy[i]>10) then p_heresy[i]-=10; - p_sisters[i]=choose(2,2,3); - adjust_influence(eFACTION.Ecclesiarchy, (p_sisters[i]*10)-irandom(3), i) - goo=1; + array_push(p_feature[i], new NewPlanetFeature(P_features.Sororitas_Cathedral)); + if (p_heresy[i] > 10) { + p_heresy[i] -= 10; + } + p_sisters[i] = choose(2, 2, 3); + adjust_influence(eFACTION.Ecclesiarchy, (p_sisters[i] * 10) - irandom(3), i); + goo = 1; break; case 2: - if (p_type[i]!="Hive") and (p_type[i]!="Lava") and (goo==0){ - array_push(p_feature[i], new NewPlanetFeature(P_features.Necron_Tomb)) - goo=1; + if ((p_type[i] != "Hive") && (p_type[i] != "Lava") && (goo == 0)) { + array_push(p_feature[i], new NewPlanetFeature(P_features.Necron_Tomb)); + goo = 1; } break; case 3: - array_push(p_feature[i], new NewPlanetFeature( P_features.Artifact)) - goo=1; + array_push(p_feature[i], new NewPlanetFeature(P_features.Artifact)); + goo = 1; break; case 4: - array_push(p_feature[i], new NewPlanetFeature( P_features.STC_Fragment)) - goo=1; + array_push(p_feature[i], new NewPlanetFeature(P_features.STC_Fragment)); + goo = 1; break; case 5: - if (p_type[i]!="Ice") and (p_type[i]!="Dead") and (p_type[i]!="Feudal"){ - goo=1; - array_push(p_feature[i], new NewPlanetFeature( P_features.Ancient_Ruins)) + if ((p_type[i] != "Ice") && (p_type[i] != "Dead") && (p_type[i] != "Feudal")) { + goo = 1; + array_push(p_feature[i], new NewPlanetFeature(P_features.Ancient_Ruins)); } break; //alternative spawn for necron tomb probably needs merging with other method case 6: - if ((p_type[i]=="Ice") or (p_type[i]=="Dead")){ - array_push(p_feature[i], new NewPlanetFeature( P_features.Necron_Tomb)) - goo=1; + if ((p_type[i] == "Ice") || (p_type[i] == "Dead")) { + array_push(p_feature[i], new NewPlanetFeature(P_features.Necron_Tomb)); + goo = 1; } break; case 7: - if ((p_type[i]=="Dead") or (p_type[i]=="Desert")){ - var randum=floor(random(100))+1; - if (randum<=25){ - array_push(p_feature[i], new NewPlanetFeature( P_features.Cave_Network)) - goo=1; + if ((p_type[i] == "Dead") || (p_type[i] == "Desert")) { + var randum = floor(random(100)) + 1; + if (randum <= 25) { + array_push(p_feature[i], new NewPlanetFeature(P_features.Cave_Network)); + goo = 1; + } } - } - break; + break; } } - } - } - } + } + } + } } } -var hyu=0; -for(var i=1; i<=4; i++){ - if (p_tyranids[i]>=5){ - p_guardsmen[i]=0; - p_pdf[i]=0; - p_population[i]=0; - hyu+=1; - p_owner[i]=9; +var hyu = 0; +for (var i = 1; i <= 4; i++) { + if (p_tyranids[i] >= 5) { + p_guardsmen[i] = 0; + p_pdf[i] = 0; + p_population[i] = 0; + hyu += 1; + p_owner[i] = 9; } - if (p_first[i]<=5) and (dispo[i]>-5000){ - dispo[i]=-20; + if ((p_first[i] <= 5) && (dispo[i] > -5000)) { + dispo[i] = -20; } } -if (hyu==0) and (owner == eFACTION.Tyranids) then owner = eFACTION.Imperium; +if ((hyu == 0) && (owner == eFACTION.Tyranids)) { + owner = eFACTION.Imperium; +} scr_star_ownership(false); -if (obj_controller.is_test_map=true){ +if (obj_controller.is_test_map == true) { /*if (p_owner[1]=3) then p_feature[1]="STC Fragment|"; if (p_owner[2]=3) then p_feature[2]="STC Fragment|"; if (p_owner[3]=3) then p_feature[3]="STC Fragment|"; @@ -448,19 +494,19 @@ if (obj_controller.is_test_map=true){ // if (obj_controller.is_test_map=true) and (p_owner[2]=1){ -if (p_owner[2]=1){ +if (p_owner[2] == 1) { /* p_guardsmen[2]=10000000; p_pdf[2]=0; obj_controller.faction_status[eFACTION.Imperium]="War"; */ - + // p_type[1]="Dead"; // p_feature[2]=""; - + // p_orks[2]=3; // p_feature[2]="Starship!0!|"; - + /*repeat(4){ var fleet;fleet=instance_create(x+(floor(random_range(100,200))*choose(1,-1)),y+(floor(random_range(100,200))*choose(1,-1)),obj_en_fleet); fleet.owner = eFACTION.Chaos;fleet.sprite_index=spr_fleet_chaos;fleet.orbiting=0; @@ -476,9 +522,10 @@ if (p_owner[2]=1){ if (ii<=1) and (capital+frigate+escort>0) then ii=1; fleet.image_index=ii; }*/ - } -if (obj_controller.is_test_map!=true) and (p_owner[2]!=1){ - for(var i=1; i<=4; i++){p_guardsmen[i]=0;} +if ((obj_controller.is_test_map != true) && (p_owner[2] != 1)) { + for (var i = 1; i <= 4; i++) { + p_guardsmen[i] = 0; + } } diff --git a/objects/obj_star/Alarm_2.gml b/objects/obj_star/Alarm_2.gml index 72e0de1e8e..4ff28807a9 100644 --- a/objects/obj_star/Alarm_2.gml +++ b/objects/obj_star/Alarm_2.gml @@ -1,23 +1,31 @@ // Assigns the income to the player system based on its neighbours -if (instance_exists(obj_temp1)){ - var tempy=0,tempy_d=9999,biggy=0; +if (instance_exists(obj_temp1)) { + var tempy = 0, tempy_d = 9999, biggy = 0; + + tempy = instance_nearest(x, y, obj_temp1); + tempy_d = point_distance(x, y, tempy.x, tempy.y); - tempy=instance_nearest(x,y,obj_temp1); - tempy_d=point_distance(x,y,tempy.x,tempy.y); - // Nearby star system - if (tempy_d>10) and (tempy_d<=180){ - for(var i=1; i<=planets; i++){ - if (p_type[i]=="Forge") and (p_owner[i]==3) then obj_controller.income_forge+=6; - if (p_type[i]=="Agri") and (p_owner[i]==2) then obj_controller.income_agri+=3; + if ((tempy_d > 10) && (tempy_d <= 180)) { + for (var i = 1; i <= planets; i++) { + if ((p_type[i] == "Forge") && (p_owner[i] == 3)) { + obj_controller.income_forge += 6; + } + if ((p_type[i] == "Agri") && (p_owner[i] == 2)) { + obj_controller.income_agri += 3; + } } } - biggy=instance_nearest(obj_temp1.x,obj_temp1.y,obj_star); + biggy = instance_nearest(obj_temp1.x, obj_temp1.y, obj_star); var connected = determine_warp_join(biggy, self.id); - if (biggy.owner==eFACTION.Player) and (tempy_d>180) and (connected){ - for(var i=1; i<=planets; i++){ - if (p_type[i]=="Forge") and (p_owner[i]==3) then obj_controller.income_forge+=6; - if (p_type[i]=="Agri") and (p_owner[i]==2) then obj_controller.income_agri+=3; + if ((biggy.owner == eFACTION.Player) && (tempy_d > 180) && connected) { + for (var i = 1; i <= planets; i++) { + if ((p_type[i] == "Forge") && (p_owner[i] == 3)) { + obj_controller.income_forge += 6; + } + if ((p_type[i] == "Agri") && (p_owner[i] == 2)) { + obj_controller.income_agri += 3; + } } } } diff --git a/objects/obj_star/Alarm_3.gml b/objects/obj_star/Alarm_3.gml index b9ba935667..a8451f5cf7 100644 --- a/objects/obj_star/Alarm_3.gml +++ b/objects/obj_star/Alarm_3.gml @@ -1,67 +1,67 @@ // Checks if player selects a system/star and then assigns the matching values to obj_controller -if (obj_controller.zoomed==1){ - obj_controller.x=self.x; - obj_controller.y=self.y; +if (obj_controller.zoomed == 1) { + obj_controller.x = self.x; + obj_controller.y = self.y; } -obj_controller.popup=3;// 3: star system -obj_controller.sel_system_x=x; -obj_controller.sel_system_y=y; +obj_controller.popup = 3; // 3: star system +obj_controller.sel_system_x = x; +obj_controller.sel_system_y = y; -selected=1; +selected = 1; -var xx=x,yy=y; +var xx = x, yy = y; -obj_controller.selected=self.id; -obj_controller.sel_owner=self.owner; -obj_controller.cooldown=8; -obj_controller.selecting_planet=0; +obj_controller.selected = self.id; +obj_controller.sel_owner = self.owner; +obj_controller.cooldown = 8; +obj_controller.selecting_planet = 0; -if (obj_controller.zoomed==1){ - obj_controller.zoomed=0; - __view_set( e__VW.Visible, 0, true ); - __view_set( e__VW.Visible, 1, false ); - obj_cursor.image_xscale=1; - obj_cursor.image_yscale=1; +if (obj_controller.zoomed == 1) { + obj_controller.zoomed = 0; + __view_set(e__VW.Visible, 0, true); + __view_set(e__VW.Visible, 1, false); + obj_cursor.image_xscale = 1; + obj_cursor.image_yscale = 1; } // Pass variables to obj_controller.temp[t]=""; here -with(obj_star_select){ +with (obj_star_select) { instance_destroy(); } -instance_create(x,y,obj_star_select); -obj_star_select.owner=self.owner; -obj_star_select.target=self.id; +instance_create(x, y, obj_star_select); +obj_star_select.owner = self.owner; +obj_star_select.target = self.id; -try{ - if (obj_controller.selection_data != false){ +try { + if (obj_controller.selection_data != false) { loading = false; var _data = obj_controller.selection_data; - if (!struct_exists(_data, "system")){ + if (!struct_exists(_data, "system")) { _data.system = id; } - if (_data.system != "none"){ - if (struct_exists(_data, "feature")){ - if (_data.feature != " none"){ - if (is_struct(_data.feature)){ - if (struct_exists(_data.feature, "f_type")){ - if (_data.feature.f_type != "none"){ - obj_star_select.feature = new FeatureSelected(_data.feature,_data.system, _data.planet); + if (_data.system != "none") { + if (struct_exists(_data, "feature")) { + if (_data.feature != " none") { + if (is_struct(_data.feature)) { + if (struct_exists(_data.feature, "f_type")) { + if (_data.feature.f_type != "none") { + obj_star_select.feature = new FeatureSelected(_data.feature, _data.system, _data.planet); } } } } } - if (struct_exists(_data, "planet")){ + if (struct_exists(_data, "planet")) { obj_controller.selecting_planet = _data.planet; - if (obj_controller.selecting_planet >0 && obj_controller.selecting_planet<5){ - obj_star_select.garrison = new GarrisonForce(p_operatives[obj_controller.selecting_planet]); - } + if (obj_controller.selecting_planet > 0 && obj_controller.selecting_planet < 5) { + obj_star_select.garrison = new GarrisonForce(p_operatives[obj_controller.selecting_planet]); + } } - obj_controller.selection_data=false; + obj_controller.selection_data = false; } } obj_controller.selection_data = false; -} catch(_exception){ +} catch (_exception) { handle_exception(_exception); obj_controller.selection_data = false; -} \ No newline at end of file +} diff --git a/objects/obj_star/Create_0.gml b/objects/obj_star/Create_0.gml index a3200bd6ad..1c8dd6e972 100644 --- a/objects/obj_star/Create_0.gml +++ b/objects/obj_star/Create_0.gml @@ -1,29 +1,32 @@ // Creates all variables, sets up default variables for different planets and if there is a fleet orbiting a system/planet -craftworld=0;// orbit_angle=0;orbit_radius=0; -space_hulk=0; -old_x=0; -old_y=0; +craftworld = 0; // orbit_angle=0;orbit_radius=0; +space_hulk = 0; +old_x = 0; +old_y = 0; -if (((x>=(room_width-150)) and (y<=450)) or (y<100)) and (global.load==-1){// was 300 +if ((((x >= (room_width - 150)) && (y <= 450)) || (y < 100)) && (global.load == -1)) { + // was 300 instance_destroy(); } scale = 1; -var run=0; -name=""; -star=""; -planets=0; +var run = 0; +name = ""; +star = ""; +planets = 0; owner = eFACTION.Imperium; -image_speed=0; -image_alpha=0; -x2=0; -y2=0; -warp_lanes=[]; -if (global.load==-1) then alarm[0]=1; -storm=0; -storm_image=0; -trader=0; -visited=0; +image_speed = 0; +image_alpha = 0; +x2 = 0; +y2 = 0; +warp_lanes = []; +if (global.load == -1) { + alarm[0] = 1; +} +storm = 0; +storm_image = 0; +trader = 0; +visited = 0; stored_owner = -1; star_surface = 0; @@ -73,130 +76,126 @@ p_timer = array_create_advanced(_planet_array_size, array_create(8, -1)); system_player_ground_forces = 0; garrison = false; -for(run=8; run<=30; run++){ - present_fleet[run]=0; +for (run = 8; run <= 30; run++) { + present_fleet[run] = 0; } -vision=1; +vision = 1; // present_fleets=0; // tau_fleets=0; -ai_a=-1; -ai_b=-1; -ai_c=-1; -ai_d=-1; -ai_e=-1; +ai_a = -1; +ai_b = -1; +ai_c = -1; +ai_d = -1; +ai_e = -1; global.star_name_colors = [ - c_gray, - c_white, //player - c_gray, //imperium - c_red, // toaster fuckers - CM_GREEN_COLOR, //nothing for inquisition - c_white, //ecclesiarchy - #FF8000, //Hi, I'm Elfo - #009500, // waagh - #FECB01, // the greater good - #AD5272,// bug boys - c_dkgray, // chaos - CM_GREEN_COLOR, //nothing for heretics either - #AD5272, //why 12 is skipped in general, we will never know - #80FF00 // Sleepy robots -] - - -#region save/load serialization - -/// Called from save function to take all object variables and convert them to a json savable format and return it -serialize = function(){ + c_gray, + c_white, //player + c_gray, //imperium + c_red, // toaster fuckers + CM_GREEN_COLOR, //nothing for inquisition + c_white, //ecclesiarchy + #FF8000, //Hi, I'm Elfo + #009500, // waagh + #FECB01, // the greater good + #AD5272, // bug boys + c_dkgray, // chaos + CM_GREEN_COLOR, //nothing for heretics either + #AD5272, //why 12 is skipped in general, we will never know + #80FF00 // Sleepy robots +]; + +#region save/load serialization + +/// Called from save function to take all object variables and convert them to a json savable format and return it +serialize = function() { var object_star = self; var planet_data = []; - for(var p = 1; p <= object_star.planets; p++){ + for (var p = 1; p <= object_star.planets; p++) { planet_data[p] = { dispo: object_star.dispo[p], planet: object_star.planet[p], }; var var_names = variable_struct_get_names(object_star); - for(var n = 0; n < array_length(var_names); n++){ + for (var n = 0; n < array_length(var_names); n++) { var var_name = var_names[n]; - if(string_starts_with(var_name, "p_")){ - var val = object_star[$var_name][p]; + if (string_starts_with(var_name, "p_")) { + var val = object_star[$ var_name][p]; variable_struct_set(planet_data[p], var_name, val); } } } - var save_data = { obj: object_get_name(object_index), x, y, present_fleet: object_star.present_fleet, planet_data: planet_data, - } - if(struct_exists(object_star, "system_garrison")){ + }; + if (struct_exists(object_star, "system_garrison")) { save_data.system_garrison = object_star.system_garrison; } - if(struct_exists(object_star, "system_sabatours")){ + if (struct_exists(object_star, "system_sabatours")) { save_data.system_sabatours = object_star.system_sabatours; } - var excluded_from_save = ["temp", "serialize", "deserialize", "arraysum"]; var excluded_from_save_start = ["p_"]; copy_serializable_fields(object_star, save_data, excluded_from_save, excluded_from_save_start); return save_data; -} +}; -function deserialize(save_data){ +function deserialize(save_data) { var exclusions = ["id", "present_fleet", "planet_data"]; // skip automatic setting of certain vars, handle explicitly later // Automatic var setting var all_names = struct_get_names(save_data); var _len = array_length(all_names); - for(var i = 0; i < _len; i++){ + for (var i = 0; i < _len; i++) { var var_name = all_names[i]; - if(array_contains(exclusions, var_name)){ + if (array_contains(exclusions, var_name)) { continue; } - var loaded_value = struct_get(save_data, var_name); - variable_struct_set(self, var_name, loaded_value); + var loaded_value = struct_get(save_data, var_name); + variable_struct_set(self, var_name, loaded_value); } // Set explicit vars here - if(struct_exists(save_data, "present_fleet")){ + if (struct_exists(save_data, "present_fleet")) { variable_struct_set(self, "present_fleet", save_data.present_fleet); } - if(struct_exists(save_data, "planet_data")){ + if (struct_exists(save_data, "planet_data")) { var planet_arr = save_data.planet_data; var _len = array_length(planet_arr); - for(var p = 1; p < _len; p++){ + for (var p = 1; p < _len; p++) { var planet = planet_arr[p]; var var_names = struct_get_names(planet); - for(var v = 0; v < array_length(var_names); v++){ + for (var v = 0; v < array_length(var_names); v++) { var var_name = var_names[v]; - var val = planet[$var_name]; + var val = planet[$ var_name]; // var_name = "p_type" // planet = {"p_type":"hive"}; // val = planet[$var_name] = "hive" - self[$var_name][p] = val; + self[$ var_name][p] = val; // variable_struct_set(self, var_name, planet[$var_name]); } } } - if(struct_exists(save_data, "system_sabatours")){ + if (struct_exists(save_data, "system_sabatours")) { variable_struct_set(self, "system_sabatours", save_data.system_sabatours); } - if(struct_exists(save_data, "system_garrison")){ + if (struct_exists(save_data, "system_garrison")) { variable_struct_set(self, "system_garrison", save_data.system_garrison); } - } -#endregion \ No newline at end of file +#endregion diff --git a/objects/obj_star/Draw_0.gml b/objects/obj_star/Draw_0.gml index cf103abbff..f68f9a943d 100644 --- a/objects/obj_star/Draw_0.gml +++ b/objects/obj_star/Draw_0.gml @@ -1,24 +1,34 @@ // Draws the system name and color codes it based on ownership -if (p_type[1]="Craftworld") and (obj_controller.known[eFACTION.Eldar]=0){ +if ((p_type[1] == "Craftworld") && (obj_controller.known[eFACTION.Eldar] == 0)) { draw_set_alpha(0); draw_set_color(255); - draw_circle(old_x,old_y,5,0); + draw_circle(old_x, old_y, 5, 0); draw_set_alpha(1); exit; } -var show=name; +var show = name; -if (global.cheat_debug=true) then show=string(name)+"#"+string(p_problem[1,1])+":"+string(p_timer[1,1])+"#"+string(p_problem[1,2])+":"+string(p_timer[1,2])+"#"+string(p_problem[1,3])+":"+string(p_timer[1,3]); -scale = min(camera_get_view_width(view_camera[0])/global.default_view_width, 2.4); +if (global.cheat_debug == true) { + show = string(name) + "#" + string(p_problem[1][1]) + ":" + string(p_timer[1][1]) + "#" + string(p_problem[1][2]) + ":" + string(p_timer[1][2]) + "#" + string(p_problem[1][3]) + ":" + string(p_timer[1][3]); +} +scale = min(camera_get_view_width(view_camera[0]) / global.default_view_width, 2.4); draw_set_color(c_white); draw_set_alpha(0.25); -if (!craftworld) and (vision==1) then draw_sprite_ext(sprite_index,image_index,x,y,1*scale,1*scale,0,c_white,1) -if (craftworld) then draw_sprite_ext(spr_craftworld,0,x,y,1*scale,1*scale,point_direction(x,y,room_width/2,room_height/2)+90,c_white,1); -if (space_hulk) then draw_sprite_ext(spr_star_hulk,0,x,y,1*scale,1*scale,0,c_white,1); +if ((!craftworld) && (vision == 1)) { + draw_sprite_ext(sprite_index, image_index, x, y, 1 * scale, 1 * scale, 0, c_white, 1); +} +if (craftworld) { + draw_sprite_ext(spr_craftworld, 0, x, y, 1 * scale, 1 * scale, point_direction(x, y, room_width / 2, room_height / 2) + 90, c_white, 1); +} +if (space_hulk) { + draw_sprite_ext(spr_star_hulk, 0, x, y, 1 * scale, 1 * scale, 0, c_white, 1); +} -if (storm>0) then draw_sprite_ext(spr_warp_storm,storm_image,x,y,0.75*scale,0.75*scale,0,c_white,1); +if (storm > 0) { + draw_sprite_ext(spr_warp_storm, storm_image, x, y, 0.75 * scale, 0.75 * scale, 0, c_white, 1); +} //ad hoc way of determining whether stuff is in view or not...needs work @@ -26,70 +36,66 @@ draw_set_halign(fa_center); draw_set_font(fnt_cul_14); draw_set_alpha(1); - if (global.load == -1 && (obj_controller.zoomed || in_camera_view(star_box_shape()))) { - - if (garrison){ - draw_sprite(spr_new_resource,3,x-30,y+15); - if (scr_hit(x-40,y+10,x-10,y+35)){ + if (garrison) { + draw_sprite(spr_new_resource, 3, x - 30, y + 15); + if (scr_hit(x - 40, y + 10, x - 10, y + 35)) { tooltip_draw("Marine Garrison in system"); } } - if (point_in_rectangle(mouse_x, mouse_y,x-128,y, x+128, y+80) && obj_controller.zoomed){ + if (point_in_rectangle(mouse_x, mouse_y, x - 128, y, x + 128, y + 80) && obj_controller.zoomed) { scale *= 1.5; } var _reset = false; - if (stored_owner != owner){ + if (stored_owner != owner) { _reset = true; } - if (ds_map_exists(global.star_sprites, name)){ + if (ds_map_exists(global.star_sprites, name)) { var _old_sprite = ds_map_find_value(global.star_sprites, name); - if (sprite_exists(_old_sprite)){ - if (_reset){ + if (sprite_exists(_old_sprite)) { + if (_reset) { sprite_delete(_old_sprite); } } else { _reset = true; } - if (_reset){ + if (_reset) { ds_map_delete(global.star_sprites, name); } } else { _reset = true; } - if (_reset){ + if (_reset) { star_tag_surface = surface_create(256, 128); - var xx=64; - var yy=0; + var xx = 64; + var yy = 0; surface_set_target(star_tag_surface); var panel_width = string_width(name) + 60; - if (owner != eFACTION.Player ){ + if (owner != eFACTION.Player) { var _faction_index = owner; var faction_colour = global.star_name_colors[_faction_index]; - draw_sprite_general(spr_p_name_bg, 0, 0, 0, string_width(name) + 60, 32, xx-(panel_width/2), yy+30, 1, 1, 0, faction_colour, faction_colour, faction_colour, faction_colour, 1); - draw_sprite_ext(spr_faction_icons,_faction_index,xx+(panel_width/2)-30,yy+25, 0.60, 0.60, 0, c_white, 1); + draw_sprite_general(spr_p_name_bg, 0, 0, 0, string_width(name) + 60, 32, xx - (panel_width / 2), yy + 30, 1, 1, 0, faction_colour, faction_colour, faction_colour, faction_colour, 1); + draw_sprite_ext(spr_faction_icons, _faction_index, xx + (panel_width / 2) - 30, yy + 25, 0.60, 0.60, 0, c_white, 1); } else { scr_shader_initialize(); var main_color = make_colour_from_array(obj_controller.body_colour_replace); var right_pauldron = make_colour_from_array(obj_controller.pauldron_colour_replace); - draw_sprite_general(spr_p_name_bg, 0, 0, 0, string_width(name) + 60, 32, xx-(panel_width/2), yy+30, 1, 1, 0, main_color, main_color, right_pauldron, right_pauldron, 1); + draw_sprite_general(spr_p_name_bg, 0, 0, 0, string_width(name) + 60, 32, xx - (panel_width / 2), yy + 30, 1, 1, 0, main_color, main_color, right_pauldron, right_pauldron, 1); var faction_sprite = global.chapter_icon.sprite; - draw_sprite_ext(faction_sprite,0,xx+(panel_width/2)-30,yy+30, 0.2, 0.2, 0, c_white, 1); + draw_sprite_ext(faction_sprite, 0, xx + (panel_width / 2) - 30, yy + 30, 0.2, 0.2, 0, c_white, 1); //context.set_vertical_gradient(main_color, right_pauldron); //draw_text_ext_transformed_color(gx + xoffset,gy + yoffset,text,sep,owner.width,xscale,yscale,angle ,col1, col2, col3, col4, alpha); } draw_set_color(c_white); - draw_text(xx, yy+33, name) + draw_text(xx, yy + 33, name); surface_reset_target(); stored_owner = owner; var _new_sprite = sprite_create_from_surface(star_tag_surface, 0, 0, surface_get_width(star_tag_surface), surface_get_height(star_tag_surface), false, false, 0, 0); ds_map_set(global.star_sprites, name, _new_sprite); - surface_clear_and_free(star_tag_surface) - } - var _sprite = ds_map_find_value(global.star_sprites, name) - draw_sprite_ext(_sprite, 0, x-(64*scale), y, scale, scale, 1, c_white, 1); + surface_clear_and_free(star_tag_surface); + } + var _sprite = ds_map_find_value(global.star_sprites, name); + draw_sprite_ext(_sprite, 0, x - (64 * scale), y, scale, scale, 1, c_white, 1); } -draw_set_valign(fa_top) - - +draw_set_valign(fa_top); diff --git a/objects/obj_star/Mouse_50.gml b/objects/obj_star/Mouse_50.gml index 0688d6ed71..4ad82c8009 100644 --- a/objects/obj_star/Mouse_50.gml +++ b/objects/obj_star/Mouse_50.gml @@ -1,27 +1,35 @@ // Checks which systems you can see the planets -if (obj_controller.menu != eMENU.Default){ +if (obj_controller.menu != eMENU.Default) { exit; } -if (instances_exist_any([obj_drop_select,obj_saveload,obj_bomb_select])){ +if (instances_exist_any([obj_drop_select, obj_saveload, obj_bomb_select])) { exit; } if (!global.ui_click_lock) { - var m_dist=point_distance(x,y,mouse_x,mouse_y); - var allow_click_distance = 20*scale; + var m_dist = point_distance(x, y, mouse_x, mouse_y); + var allow_click_distance = 20 * scale; - if (obj_controller.location_viewer.is_entered) then exit; + if (obj_controller.location_viewer.is_entered) { + exit; + } // if ((obj_controller.zoomed==0) and (mouse_y <__view_get( e__VW.YView, 0 )+62)) or (obj_controller.menu!=0) then exit; // if ((obj_controller.zoomed==0) and (mouse_y>__view_get( e__VW.YView, 0 )+830)) or (obj_controller.menu!=0) then exit; - if (p_type[1]=="Craftworld") and (obj_controller.known[eFACTION.Eldar]==0) then exit; - if (vision==0) then exit; - if (!scr_void_click()) then exit; + if ((p_type[1] == "Craftworld") && (obj_controller.known[eFACTION.Eldar] == 0)) { + exit; + } + if (vision == 0) { + exit; + } + if (!scr_void_click()) { + exit; + } - if ((obj_controller.zoomed==0) and (m_dist=0){ - sprite_index=spr_star; - if (star=="orange1") then image_index=0; - if (star=="orange2") then image_index=1; - if (star=="red") then image_index=2; - if (star=="white1") then image_index=3; - if (star=="white2") then image_index=4; - if (star=="blue") then image_index=5; - if (vision==1) then image_alpha=1; - if (vision==0) then image_alpha=0; +if (global.load >= 0) { + sprite_index = spr_star; + if (star == "orange1") { + image_index = 0; + } + if (star == "orange2") { + image_index = 1; + } + if (star == "red") { + image_index = 2; + } + if (star == "white1") { + image_index = 3; + } + if (star == "white2") { + image_index = 4; + } + if (star == "blue") { + image_index = 5; + } + if (vision == 1) { + image_alpha = 1; + } + if (vision == 0) { + image_alpha = 0; + } exit; } // Sets up transparency of system image -if (name!=""){ - if (planets==0) and (image_alpha!=0.33){ - image_alpha=0.33; - } else if (planets!=0) and (image_alpha==0.33){ - image_alpha=1; +if (name != "") { + if ((planets == 0) && (image_alpha != 0.33)) { + image_alpha = 0.33; + } else if ((planets != 0) && (image_alpha == 0.33)) { + image_alpha = 1; } - } // Sets up warp storm image -if (storm>0){ +if (storm > 0) { storm_image++; } else { - storm_image=0; + storm_image = 0; } // Checks if they are dead planets, then sets up image -if (is_dead_star()) then image_alpha=0.33; +if (is_dead_star()) { + image_alpha = 0.33; +} // Sets up enemy ai beheaviour -if (ai_a>=0){ +if (ai_a >= 0) { ai_a--; - if (ai_a==0){ - try{ + if (ai_a == 0) { + try { scr_enemy_ai_a(); - } catch(_exception){ + } catch (_exception) { handle_exception(_exception); } } } -if (ai_b>=0){ +if (ai_b >= 0) { ai_b--; - if (ai_b==0){ - try{ + if (ai_b == 0) { + try { scr_enemy_ai_b(); - } catch(_exception){ + } catch (_exception) { handle_exception(_exception); } } } -if (ai_c>=0){ +if (ai_c >= 0) { ai_c--; - if (ai_c==0){ - try{ + if (ai_c == 0) { + try { scr_enemy_ai_c(); - } catch(_exception){ + } catch (_exception) { handle_exception(_exception); } } } -if (ai_d>=0){ +if (ai_d >= 0) { ai_d--; - if (ai_d==0){ - try{ + if (ai_d == 0) { + try { scr_enemy_ai_d(); - } catch(_exception){ + } catch (_exception) { handle_exception(_exception); } } } -if (ai_e>=0){ +if (ai_e >= 0) { ai_e--; - if (ai_e==0){ - try{ + if (ai_e == 0) { + try { scr_enemy_ai_e(); - } catch(_exception){ + } catch (_exception) { handle_exception(_exception); } } -} \ No newline at end of file +} diff --git a/objects/obj_star/Step_2.gml b/objects/obj_star/Step_2.gml index c889af8d55..fa81d83fff 100644 --- a/objects/obj_star/Step_2.gml +++ b/objects/obj_star/Step_2.gml @@ -1,11 +1,2 @@ /// @description Insert description here -// You can write your code in this editor - - - - - - - - - +// You can write your code in this editor diff --git a/objects/obj_turn_end/Alarm_0.gml b/objects/obj_turn_end/Alarm_0.gml index bbf79e371e..03bf5e7f51 100644 --- a/objects/obj_turn_end/Alarm_0.gml +++ b/objects/obj_turn_end/Alarm_0.gml @@ -1,176 +1,210 @@ - // show_message("biiiiiIIIng"); -try_and_report_loop("battle alarm 0 loop", function(){ -instance_activate_object(obj_star); -combating=0; - -var i; - - -i=50; -repeat(50){ - i-=1; - - if (battles<=i) and (i>=2){ - if (battle[i]!=0) and (battle[i-1]!=0) and (battle_world[i]=-50) and (battle_world[i-1]>0){ - var tem1, tem2, tem3, tem4, tem5, tem6, tem7; - tem1=battle[i-1]; - tem2=battle_location[i-1]; - tem3=battle_world[i-1]; - tem4=battle_opponent[i-1]; - tem5=battle_object[i-1]; - tem6=battle_pobject[i-1]; - tem7=battle_special[i-1]; - - battle[i-1]=battle[i]; - battle_location[i-1]=battle_location[i]; - battle_world[i-1]=battle_world[i]; - battle_opponent[i-1]=battle_opponent[i]; - // battle_object[i-1]=battle_object[i]; - battle_pobject[i-1]=battle_pobject[i]; - battle_special[i-1]=battle_special[i]; - - battle[i]=tem1; - battle_location[i]=tem2; - battle_world[i]=tem3; - battle_opponent[i]=tem4; - battle_object[i]=tem5; - battle_pobject[i]=tem6; - battle_special[i]=tem7; +try_and_report_loop("battle alarm 0 loop", function() { + instance_activate_object(obj_star); + combating = 0; + + var i; + + i = 50; + repeat (50) { + i -= 1; + + if ((battles <= i) && (i >= 2)) { + if ((battle[i] != 0) && (battle[i - 1] != 0) && (battle_world[i] == -50) && (battle_world[i - 1] > 0)) { + var tem1, tem2, tem3, tem4, tem5, tem6, tem7; + tem1 = battle[i - 1]; + tem2 = battle_location[i - 1]; + tem3 = battle_world[i - 1]; + tem4 = battle_opponent[i - 1]; + tem5 = battle_object[i - 1]; + tem6 = battle_pobject[i - 1]; + tem7 = battle_special[i - 1]; + + battle[i - 1] = battle[i]; + battle_location[i - 1] = battle_location[i]; + battle_world[i - 1] = battle_world[i]; + battle_opponent[i - 1] = battle_opponent[i]; + // battle_object[i-1]=battle_object[i]; + battle_pobject[i - 1] = battle_pobject[i]; + battle_special[i - 1] = battle_special[i]; + + battle[i] = tem1; + battle_location[i] = tem2; + battle_world[i] = tem3; + battle_opponent[i] = tem4; + battle_object[i] = tem5; + battle_pobject[i] = tem6; + battle_special[i] = tem7; + } } } -} - - - -// Probably want something right here to organize the battle just in case -// Space battles first -// Ground battles after - - - - -if (battles>0) and (current_battle<=battles){ - var ii, xx, yy, good; - ii=0; - good=0; - - var battle_star = star_by_name(battle_location[current_battle]); - - if (battle_star!="none"){// trying to find the star - obj_controller.x=battle_star.x; - obj_controller.y=battle_star.y; - show=current_battle; - - if (battle_world[current_battle]=-50){ - strin[1]=string(round(battle_pobject[current_battle].capital_number)); - strin[2]=string(round(battle_pobject[current_battle].frigate_number)); - strin[3]=string(round(battle_pobject[current_battle].escort_number)); - // pull health values here - strin[4]=string(round(battle_pobject[current_battle].capital_health)); - strin[5]=string(round(battle_pobject[current_battle].frigate_health)); - strin[6]=string(round(battle_pobject[current_battle].escort_health)); - - // pull enemy ships here - - var e=1; - repeat(10){ - e+=1; - if (e=11) then e=13; - if (battle_star.present_fleet[e]>0){ - obj_controller.temp[1070]=battle_star.id; - obj_controller.temp[1071]=e; - obj_controller.temp[1072]=0; - obj_controller.temp[1073]=0; - obj_controller.temp[1074]=0; - - with(obj_en_fleet){ - if (orbiting=obj_controller.temp[1070]) and (owner=obj_controller.temp[1071]){ - obj_controller.temp[1072]+=round(capital_number); - obj_controller.temp[1073]+=round(frigate_number); - obj_controller.temp[1074]+=round(escort_number); + + // Probably want something right here to organize the battle just in case + // Space battles first + // Ground battles after + + if ((battles > 0) && (current_battle <= battles)) { + var ii, xx, yy, good; + ii = 0; + good = 0; + + var battle_star = star_by_name(battle_location[current_battle]); + + if (battle_star != "none") { + // trying to find the star + obj_controller.x = battle_star.x; + obj_controller.y = battle_star.y; + show = current_battle; + + if (battle_world[current_battle] == -50) { + strin[1] = string(round(battle_pobject[current_battle].capital_number)); + strin[2] = string(round(battle_pobject[current_battle].frigate_number)); + strin[3] = string(round(battle_pobject[current_battle].escort_number)); + // pull health values here + strin[4] = string(round(battle_pobject[current_battle].capital_health)); + strin[5] = string(round(battle_pobject[current_battle].frigate_health)); + strin[6] = string(round(battle_pobject[current_battle].escort_health)); + + // pull enemy ships here + + var e = 1; + repeat (10) { + e += 1; + if (e == 11) { + e = 13; + } + if (battle_star.present_fleet[e] > 0) { + obj_controller.temp[1070] = battle_star.id; + obj_controller.temp[1071] = e; + obj_controller.temp[1072] = 0; + obj_controller.temp[1073] = 0; + obj_controller.temp[1074] = 0; + + with (obj_en_fleet) { + if ((orbiting == obj_controller.temp[1070]) && (owner == obj_controller.temp[1071])) { + obj_controller.temp[1072] += round(capital_number); + obj_controller.temp[1073] += round(frigate_number); + obj_controller.temp[1074] += round(escort_number); + } + } + + var l1, l2; + l1 = 0; + l2 = 0; + if (obj_controller.faction_status[e] != "War") { + repeat (10) { + l1 += 1; + if ((allied_fleet[l1] == 0) && (l2 == 0)) { + l2 = l1; + } + } + allied_fleet[l2] = e; + acap[l2] = obj_controller.temp[1072]; + afri[l2] = obj_controller.temp[1073]; + aesc[l2] = obj_controller.temp[1074]; + } + if ((obj_controller.faction_status[e] == "War") || (e == 9) || (e == 13)) { + repeat (10) { + l1 += 1; + if ((enemy_fleet[l1] == 0) && (l2 == 0)) { + l2 = l1; + } + } + enemy_fleet[l2] = e; + ecap[l2] = obj_controller.temp[1072]; + efri[l2] = obj_controller.temp[1073]; + eesc[l2] = obj_controller.temp[1074]; } } - - var l1,l2;l1=0;l2=0; - if (obj_controller.faction_status[e]!="War"){ - repeat(10){l1+=1;if (allied_fleet[l1]=0) and (l2=0) then l2=l1;} - allied_fleet[l2]=e; - acap[l2]=obj_controller.temp[1072]; - afri[l2]=obj_controller.temp[1073]; - aesc[l2]=obj_controller.temp[1074]; + } + } + + if (battle_world[current_battle] >= 1) { + scr_count_forces(string(battle_location[current_battle]), battle_world[current_battle], true); + + strin[1] = info_mahreens; + strin[2] = info_vehicles; + + if (info_mahreens + info_vehicles == 0) { + if (battles > current_battle) { + alarm[4] = 1; } - if (obj_controller.faction_status[e]="War") or (e=9) or (e=13){ - repeat(10){l1+=1;if (enemy_fleet[l1]=0) and (l2=0) then l2=l1;} - enemy_fleet[l2]=e; - ecap[l2]=obj_controller.temp[1072]; - efri[l2]=obj_controller.temp[1073]; - eesc[l2]=obj_controller.temp[1074]; + if (battles == current_battle) { + alarm[1] = 1; } } + + strin[3] = ""; + + var tempy = 0; + tempy = battle_object[current_battle].p_owner[battle_world[current_battle]]; + + if ((tempy == 1) || (tempy == 2) || (tempy == 3)) { + var array_string = ["", "Minimally", "Lightly", "Moderately", "Highly", "Extremely", "Maximally"]; + var battle_fortification = battle_object[current_battle].p_fortified[battle_world[current_battle]]; + strin[3] = array_string[clamp(battle_fortification, 1, 6)]; + } + + tempy = 0; + if (battle_opponent[current_battle] == 7) { + tempy = battle_object[current_battle].p_orks[battle_world[current_battle]]; + } + if (battle_opponent[current_battle] == 8) { + tempy = battle_object[current_battle].p_tau[battle_world[current_battle]]; + } + if (battle_opponent[current_battle] == 9) { + tempy = battle_object[current_battle].p_tyranids[battle_world[current_battle]]; + } + if (battle_opponent[current_battle] == 10) { + tempy = battle_object[current_battle].p_traitors[battle_world[current_battle]]; + } + if (battle_opponent[current_battle] == 13) { + tempy = battle_object[current_battle].p_necrons[battle_world[current_battle]]; + } + + if (tempy == 1) { + strin[4] = "Minimal Forces"; + } + if (tempy == 2) { + strin[4] = "Sparse Forces"; + } + if (tempy == 3) { + strin[4] = "Moderate Forces"; + } + if (tempy == 4) { + strin[4] = "Numerous Forces"; + } + if (tempy == 5) { + strin[4] = "Very Numerous"; + } + if (tempy == 6) { + strin[4] = "Overwhelming"; + } + + // if (battle_opponent[current_battle]=2) then obj_controller.alarm[7]=1; + obj_controller.cooldown = 9999; } - - } - - if (battle_world[current_battle]>=1){ - scr_count_forces(string(battle_location[current_battle]),battle_world[current_battle],true); - - strin[1]=info_mahreens; - strin[2]=info_vehicles; - - if (info_mahreens+info_vehicles=0){ - if (battles>current_battle) then alarm[4]=1; - if (battles=current_battle) then alarm[1]=1; - } - - strin[3]=""; - - var tempy=0; - tempy=battle_object[current_battle].p_owner[battle_world[current_battle]]; - - if (tempy=1) or (tempy=2) or (tempy=3){ - var array_string = ["","Minimally","Lightly","Moderately","Highly","Extremely","Maximally"]; - var battle_fortification = battle_object[current_battle].p_fortified[battle_world[current_battle]]; - strin[3] = array_string[clamp(battle_fortification, 1, 6)]; + + if (obj_controller.zoomed == 1) { + with (obj_controller) { + scr_zoom(); + } } - - tempy=0; - if (battle_opponent[current_battle]=7) then tempy=battle_object[current_battle].p_orks[battle_world[current_battle]]; - if (battle_opponent[current_battle]=8) then tempy=battle_object[current_battle].p_tau[battle_world[current_battle]]; - if (battle_opponent[current_battle]=9) then tempy=battle_object[current_battle].p_tyranids[battle_world[current_battle]]; - if (battle_opponent[current_battle]=10) then tempy=battle_object[current_battle].p_traitors[battle_world[current_battle]]; - if (battle_opponent[current_battle]=13) then tempy=battle_object[current_battle].p_necrons[battle_world[current_battle]]; - - if (tempy=1) then strin[4]="Minimal Forces"; - if (tempy=2) then strin[4]="Sparse Forces"; - if (tempy=3) then strin[4]="Moderate Forces"; - if (tempy=4) then strin[4]="Numerous Forces"; - if (tempy=5) then strin[4]="Very Numerous"; - if (tempy=6) then strin[4]="Overwhelming"; - - // if (battle_opponent[current_battle]=2) then obj_controller.alarm[7]=1; - obj_controller.cooldown=9999; } - - if (obj_controller.zoomed=1) then with(obj_controller){scr_zoom();} + instance_activate_object(obj_star); } - instance_activate_object(obj_star); - -} - -instance_activate_object(obj_star); - - + instance_activate_object(obj_star); -if (battle[1]=0) or (current_battle>battles){// This is temporary for the sake of testing - if (battle[1]=0){ - obj_controller.x=first_x; - obj_controller.y=first_y; + if ((battle[1] == 0) || (current_battle > battles)) { + // This is temporary for the sake of testing + if (battle[1] == 0) { + obj_controller.x = first_x; + obj_controller.y = first_y; + } + alarm[1] = 1; } - alarm[1]=1; -} -/* */ -/* */ + /* */ + /* */ }); diff --git a/objects/obj_turn_end/Alarm_1.gml b/objects/obj_turn_end/Alarm_1.gml index 967517fd09..ae22c65830 100644 --- a/objects/obj_turn_end/Alarm_1.gml +++ b/objects/obj_turn_end/Alarm_1.gml @@ -1,157 +1,141 @@ - var _is_audience = false; -if (array_length(audience_stack) > 0){ +if (array_length(audience_stack) > 0) { var current_audience = audience_stack[0]; _is_audience = true; } - -if (_is_audience){ - with(obj_controller){ - if (zoomed=1){ +if (_is_audience) { + with (obj_controller) { + if (zoomed == 1) { scr_zoom(); } } show_debug_message(current_audience); - if (obj_controller.menu != eMENU.Diplomacy){ + if (obj_controller.menu != eMENU.Diplomacy) { scr_toggle_diplomacy(); } - obj_controller.audience=current_audience.faction; - obj_controller.diplomacy=current_audience.faction; + obj_controller.audience = current_audience.faction; + obj_controller.diplomacy = current_audience.faction; obj_controller.audience_data = current_audience.audience_data; - - if (obj_controller.diplomacy=10) and (obj_controller.faction_gender[10]=2){ - scr_music("blood",60); - } - - if (string_count("intro",current_audience.topic)>0){ - obj_controller.known[obj_controller.diplomacy]=2; - obj_controller.faction_justmet=1; - if (obj_controller.diplomacy=6){ - scr_dialogue("intro1"); + if ((obj_controller.diplomacy == 10) && (obj_controller.faction_gender[10] == 2)) { + scr_music("blood", 60); + } + if (string_count("intro", current_audience.topic) > 0) { + obj_controller.known[obj_controller.diplomacy] = 2; + obj_controller.faction_justmet = 1; + if (obj_controller.diplomacy == 6) { + scr_dialogue("intro1"); } - if (obj_controller.diplomacy!=6){ + if (obj_controller.diplomacy != 6) { //show_debug_message("new_intro"); scr_dialogue("intro"); - } - }else { + } else { scr_dialogue(current_audience.topic); - } array_delete(audience_stack, 0, 1); exit; } - - - - - - - - // if (current_audience<=audiences) then alarm[1]=5; +if (!_is_audience) { + current_popup += 1; -if (!_is_audience){ - current_popup+=1; - - - if (popup[current_popup]!=0){ + if (popup[current_popup] != 0) { var pip; - pip=instance_create(0,0,obj_popup); - pip.title=popup_type[current_popup]; - pip.text=popup_text[current_popup]; - pip.image=popup_image[current_popup]; - if (is_struct(popup_special[current_popup])){ + pip = instance_create(0, 0, obj_popup); + pip.title = popup_type[current_popup]; + pip.text = popup_text[current_popup]; + pip.image = popup_image[current_popup]; + if (is_struct(popup_special[current_popup])) { pip.pop_data = popup_special[current_popup]; - if (struct_exists(pip.pop_data , "options")){ + if (struct_exists(pip.pop_data, "options")) { pip.add_option(pip.pop_data.options); } } else { - if (popup_special[current_popup]!="") and ((pip.image="inquisition")) and (popup_special[current_popup]!="1") and (popup_special[current_popup]!="2") and (pip.image!="tech_build") and (popup_special[current_popup]!="contraband") and (string_count("mech_",popup_special[current_popup])=0) and (string_count("meeting",popup_special[current_popup])=0){ - explode_script(popup_special[current_popup],"|"); - pip.mission=string(explode[0]); - pip.loc=string(explode[1]); - pip.planet=real(explode[2]); - pip.estimate=real(explode[3]); + if ((popup_special[current_popup] != "") && (pip.image == "inquisition") && (popup_special[current_popup] != "1") && (popup_special[current_popup] != "2") && (pip.image != "tech_build") && (popup_special[current_popup] != "contraband") && (string_count("mech_", popup_special[current_popup]) == 0) && (string_count("meeting", popup_special[current_popup]) == 0)) { + explode_script(popup_special[current_popup], "|"); + pip.mission = string(explode[0]); + pip.loc = string(explode[1]); + pip.planet = real(explode[2]); + pip.estimate = real(explode[3]); } - if (string_count("target_marine",popup_special[current_popup])>0){ + if (string_count("target_marine", popup_special[current_popup]) > 0) { var aa; - explode_script(popup_special[current_popup],"|"); - aa=string(explode[0]); - pip.ma_name=string(explode[1]); - pip.ma_co=real(explode[2]); - pip.ma_id=real(explode[3]); + explode_script(popup_special[current_popup], "|"); + aa = string(explode[0]); + pip.ma_name = string(explode[1]); + pip.ma_co = real(explode[2]); + pip.ma_id = real(explode[3]); } - if (string_count("mech_",popup_special[current_popup])>0){ - explode_script(popup_special[current_popup],"|"); - pip.mission=string(explode[0]); - pip.loc=string(explode[1]); + if (string_count("mech_", popup_special[current_popup]) > 0) { + explode_script(popup_special[current_popup], "|"); + pip.mission = string(explode[0]); + pip.loc = string(explode[1]); // "mech_raider!0!|"+string(you2.name)); "mech_bionics!0!|"+string(you2.name)); } - if (string_count("meeting_",popup_special[current_popup])>0){ - pip.mission=popup_special[current_popup]; + if (string_count("meeting_", popup_special[current_popup]) > 0) { + pip.mission = popup_special[current_popup]; + } + if (popup_special[current_popup] == "contraband") { + pip.loc = "contraband"; + } + if (popup_special[current_popup] == "1") { + pip.planet = 1; + } + if (popup_special[current_popup] == "2") { + pip.planet = 2; } - if (popup_special[current_popup]="contraband") then pip.loc="contraband"; - if (popup_special[current_popup]="1") then pip.planet=1; - if (popup_special[current_popup]="2") then pip.planet=2; } - pip.number=1; - - + pip.number = 1; } - if (current_popup>popups) or (popup[1]=0){ - if (popups_end=0) then popups_end=1; + if ((current_popup > popups) || (popup[1] == 0)) { + if (popups_end == 0) { + popups_end = 1; + } // obj_controller.x=first_x; // obj_controller.y=first_y; // instance_destroy(); } - - - // obj_controller.x=first_x; // obj_controller.y=first_y; // instance_destroy(); } - // if (current_popup>popups) or (popup[1]=0) then popups_end=1; -if (popups_end=1){ - - +if (popups_end == 1) { /*if (popups=0){ obj_controller.x=first_x; obj_controller.y=first_y; instance_destroy(); }*/ + obj_controller.x = first_x; + obj_controller.y = first_y; + + alarm[2] = 10; + obj_controller.menu = 0; + combating = 0; - obj_controller.x=first_x; - obj_controller.y=first_y; - - alarm[2]=10; - obj_controller.menu=0; - combating=0; - - with(obj_controller){ - year_fraction+=84; - if (year_fraction>999){ - year+=1;year_fraction=0; + with (obj_controller) { + year_fraction += 84; + if (year_fraction > 999) { + year += 1; + year_fraction = 0; } - if (year>=1000){ - millenium+=1;year-=1000; + if (year >= 1000) { + millenium += 1; + year -= 1000; } // menu=0; } - } /* */ diff --git a/objects/obj_turn_end/Alarm_2.gml b/objects/obj_turn_end/Alarm_2.gml index 4fb43bdb8b..f99f0c71f8 100644 --- a/objects/obj_turn_end/Alarm_2.gml +++ b/objects/obj_turn_end/Alarm_2.gml @@ -1,30 +1,30 @@ - -if (fast=0){ +if (fast == 0) { instance_activate_object(obj_star_event); - if (instance_exists(obj_star_event)){ - obj_star_event.image_alpha=1; - obj_star_event.image_speed=1; + if (instance_exists(obj_star_event)) { + obj_star_event.image_alpha = 1; + obj_star_event.image_speed = 1; } - + instance_activate_object(obj_star_select); instance_activate_object(obj_drop_select); instance_activate_object(obj_bomb_select); - - if (instance_exists(obj_star_select)) then obj_star_select.alarm[1]=2; -} - + if (instance_exists(obj_star_select)) { + obj_star_select.alarm[1] = 2; + } +} -fast+=1; -if (fast=alerts){ - alarm[2]=9999; - alarm[3]=max(230,(alerts*60)); - alarm[3]=min(alarm[3],360); +if (fast >= alerts) { + alarm[2] = 9999; + alarm[3] = max(230, (alerts * 60)); + alarm[3] = min(alarm[3], 360); } -if (alerts=0){ +if (alerts == 0) { instance_destroy(); } - diff --git a/objects/obj_turn_end/Alarm_3.gml b/objects/obj_turn_end/Alarm_3.gml index 422b1cc860..f89fac8286 100644 --- a/objects/obj_turn_end/Alarm_3.gml +++ b/objects/obj_turn_end/Alarm_3.gml @@ -1,2 +1 @@ -fadeout=1; - +fadeout = 1; diff --git a/objects/obj_turn_end/Alarm_4.gml b/objects/obj_turn_end/Alarm_4.gml index 939fd4a72e..2a3509de5e 100644 --- a/objects/obj_turn_end/Alarm_4.gml +++ b/objects/obj_turn_end/Alarm_4.gml @@ -1,100 +1,137 @@ - -var battle_o;battle_o=0; -current_battle+=1; -combating=0; +var battle_o; +battle_o = 0; +current_battle += 1; +combating = 0; instance_activate_object(obj_star); -if (battles>0) and (current_battle<=battles){ - - var ii=0,good=0; +if ((battles > 0) && (current_battle <= battles)) { + var ii = 0, good = 0; var battle_star = star_by_name(battle_location[current_battle]); - obj_controller.temp[1060]=battle_location[current_battle]; - - if (battle_star!="none"){ - obj_controller.x=battle_star.x; - obj_controller.y=battle_star.y; - show=current_battle; - - if (battle_world[current_battle]=-50){ - strin[1]=string(battle_pobject[current_battle].capital_number); - strin[2]=string(battle_pobject[current_battle].frigate_number); - strin[3]=string(battle_pobject[current_battle].escort_number); + obj_controller.temp[1060] = battle_location[current_battle]; + + if (battle_star != "none") { + obj_controller.x = battle_star.x; + obj_controller.y = battle_star.y; + show = current_battle; + + if (battle_world[current_battle] == -50) { + strin[1] = string(battle_pobject[current_battle].capital_number); + strin[2] = string(battle_pobject[current_battle].frigate_number); + strin[3] = string(battle_pobject[current_battle].escort_number); // pull health values here - strin[4]=string(battle_pobject[current_battle].capital_health); - strin[5]=string(battle_pobject[current_battle].frigate_health); - strin[6]=string(battle_pobject[current_battle].escort_health); - + strin[4] = string(battle_pobject[current_battle].capital_health); + strin[5] = string(battle_pobject[current_battle].frigate_health); + strin[6] = string(battle_pobject[current_battle].escort_health); + // Here - strin[7]=string(battle_object[current_battle].capital_number); - strin[8]=string(battle_object[current_battle].frigate_number); - strin[9]=string(battle_object[current_battle].escort_number); + strin[7] = string(battle_object[current_battle].capital_number); + strin[8] = string(battle_object[current_battle].frigate_number); + strin[9] = string(battle_object[current_battle].escort_number); // pull health values here - strin[10]="100"; - strin[11]="100"; - strin[12]="100"; + strin[10] = "100"; + strin[11] = "100"; + strin[12] = "100"; } - - - - if (battle_world[current_battle]>=1){ - - scr_count_forces(string(battle_location[current_battle]),battle_world[current_battle],true); - - strin[1]=info_mahreens; - strin[2]=info_vehicles; - - if (info_mahreens+info_vehicles=0){ - if (battles>current_battle) then alarm[4]=1; - if (battles=current_battle) then alarm[1]=1; + + if (battle_world[current_battle] >= 1) { + scr_count_forces(string(battle_location[current_battle]), battle_world[current_battle], true); + + strin[1] = info_mahreens; + strin[2] = info_vehicles; + + if (info_mahreens + info_vehicles == 0) { + if (battles > current_battle) { + alarm[4] = 1; + } + if (battles == current_battle) { + alarm[1] = 1; + } + } + + strin[3] = ""; + + var tempy; + tempy = 0; + tempy = battle_object[current_battle].p_owner[battle_world[current_battle]]; + + if ((tempy == 1) || (tempy == 2) || (tempy == 3)) { + if (battle_object[current_battle].p_fortified[battle_world[current_battle]] == 1) { + strin[3] = "Minimally"; + } + if (battle_object[current_battle].p_fortified[battle_world[current_battle]] == 2) { + strin[3] = "Lightly"; + } + if (battle_object[current_battle].p_fortified[battle_world[current_battle]] == 3) { + strin[3] = "Moderately"; + } + if (battle_object[current_battle].p_fortified[battle_world[current_battle]] == 4) { + strin[3] = "Highly"; + } + if (battle_object[current_battle].p_fortified[battle_world[current_battle]] == 5) { + strin[3] = "Extremely"; + } + if (battle_object[current_battle].p_fortified[battle_world[current_battle]] == 6) { + strin[3] = "Maximally"; + } + } + + tempy = 0; + if (battle_opponent[current_battle] == 7) { + tempy = battle_object[current_battle].p_orks[battle_world[current_battle]]; } - - strin[3]=""; - - var tempy;tempy=0; - tempy=battle_object[current_battle].p_owner[battle_world[current_battle]]; - - if (tempy=1) or (tempy=2) or (tempy=3){ - if (battle_object[current_battle].p_fortified[battle_world[current_battle]]=1) then strin[3]="Minimally"; - if (battle_object[current_battle].p_fortified[battle_world[current_battle]]=2) then strin[3]="Lightly"; - if (battle_object[current_battle].p_fortified[battle_world[current_battle]]=3) then strin[3]="Moderately"; - if (battle_object[current_battle].p_fortified[battle_world[current_battle]]=4) then strin[3]="Highly"; - if (battle_object[current_battle].p_fortified[battle_world[current_battle]]=5) then strin[3]="Extremely"; - if (battle_object[current_battle].p_fortified[battle_world[current_battle]]=6) then strin[3]="Maximally"; + if (battle_opponent[current_battle] == 8) { + tempy = battle_object[current_battle].p_tau[battle_world[current_battle]]; } - - tempy=0; - if (battle_opponent[current_battle]=7) then tempy=battle_object[current_battle].p_orks[battle_world[current_battle]]; - if (battle_opponent[current_battle]=8) then tempy=battle_object[current_battle].p_tau[battle_world[current_battle]]; - if (battle_opponent[current_battle]=9) then tempy=battle_object[current_battle].p_tyranids[battle_world[current_battle]]; - if (battle_opponent[current_battle]=10) then tempy=battle_object[current_battle].p_traitors[battle_world[current_battle]]; - if (battle_opponent[current_battle]=30){tempy=1;strin[4]="Master Spyrer";} - - if (battle_opponent[current_battle]<=20){ - if (tempy=1) then strin[4]="Minimal Forces"; - if (tempy=2) then strin[4]="Sparse Forces"; - if (tempy=3) then strin[4]="Moderate Forces"; - if (tempy=4) then strin[4]="Numerous Forces"; - if (tempy=5) then strin[4]="Very Numerous"; - if (tempy=6) then strin[4]="Overwhelming"; + if (battle_opponent[current_battle] == 9) { + tempy = battle_object[current_battle].p_tyranids[battle_world[current_battle]]; + } + if (battle_opponent[current_battle] == 10) { + tempy = battle_object[current_battle].p_traitors[battle_world[current_battle]]; + } + if (battle_opponent[current_battle] == 30) { + tempy = 1; + strin[4] = "Master Spyrer"; + } + + if (battle_opponent[current_battle] <= 20) { + if (tempy == 1) { + strin[4] = "Minimal Forces"; + } + if (tempy == 2) { + strin[4] = "Sparse Forces"; + } + if (tempy == 3) { + strin[4] = "Moderate Forces"; + } + if (tempy == 4) { + strin[4] = "Numerous Forces"; + } + if (tempy == 5) { + strin[4] = "Very Numerous"; + } + if (tempy == 6) { + strin[4] = "Overwhelming"; + } + } + } + + if (obj_controller.zoomed == 1) { + with (obj_controller) { + scr_zoom(); } } - - if (obj_controller.zoomed=1) then with(obj_controller){scr_zoom();} } instance_activate_object(obj_star); - } instance_activate_object(obj_star); - - - - - -if (battle[1]=0) or (current_battle>battles){// This is temporary for the sake of testing - if (battle[1]=0){obj_controller.x=first_x;obj_controller.y=first_y;} - alarm[1]=1; +if ((battle[1] == 0) || (current_battle > battles)) { + // This is temporary for the sake of testing + if (battle[1] == 0) { + obj_controller.x = first_x; + obj_controller.y = first_y; + } + alarm[1] = 1; } - diff --git a/objects/obj_turn_end/Create_0.gml b/objects/obj_turn_end/Create_0.gml index 77a0406cb6..535322512e 100644 --- a/objects/obj_turn_end/Create_0.gml +++ b/objects/obj_turn_end/Create_0.gml @@ -1,99 +1,110 @@ - instance_deactivate_object(obj_star_select); instance_deactivate_object(obj_drop_select); instance_deactivate_object(obj_bomb_select); -var i;i=-1; -keywords=""; -last_open=1; - -battles=0; -audiences=0; -popups=0; -alerts=0; -fadeout=0; -popups_end=0; - -current_battle=1; -current_popup=0; - -fast=0;// This is increased, once the alert[i]=1 and >=fast then it begins to fade in and get letters -info_mahreens=0; -info_vehicles=0; - -first_x=obj_controller.x;// Return to this position once all the battles are done -first_y=obj_controller.y; -combating=0; -cooldown=10; - -obj_controller.menu=999;// show nothing, click nothing - -i=-1;repeat(11){i+=1;enemy_fleet[i]=0;allied_fleet[i]=0;ecap[i]=0;efri[i]=0;eesc[i]=0;acap[i]=0;afri[i]=0;aesc[i]=0;} - -i=-1; -repeat(91){ - i+=1; - - popup[i]=0; - popup_type[i]=""; - popup_text[i]=""; - popup_image[i]=""; - popup_special[i]=""; - - alert[i]=0; - alert_type[i]=""; - alert_text[i]=""; - - alert_char[i]=0; - alert_alpha[i]=0; - alert_txt[i]=""; - alert_color[i]=""; - - battle[i]=0;// Set to 0 for none, 1 for battle to do, and 2 for resolved - battle_location[i]=""; - battle_world[i]=0;// Be like -50 for space battle - battle_opponent[i]=0;// faction ID - battle_object[i]=0;// faction object for the fleets - battle_pobject[i]=0;// player object for the fleets - battle_special[i]=""; - - - if (i<16) then strin[i]=""; +var i; +i = -1; +keywords = ""; +last_open = 1; + +battles = 0; +audiences = 0; +popups = 0; +alerts = 0; +fadeout = 0; +popups_end = 0; + +current_battle = 1; +current_popup = 0; + +fast = 0; // This is increased, once the alert[i]=1 and >=fast then it begins to fade in and get letters +info_mahreens = 0; +info_vehicles = 0; + +first_x = obj_controller.x; // Return to this position once all the battles are done +first_y = obj_controller.y; +combating = 0; +cooldown = 10; + +obj_controller.menu = 999; // show nothing, click nothing + +i = -1; +repeat (11) { + i += 1; + enemy_fleet[i] = 0; + allied_fleet[i] = 0; + ecap[i] = 0; + efri[i] = 0; + eesc[i] = 0; + acap[i] = 0; + afri[i] = 0; + aesc[i] = 0; +} + +i = -1; +repeat (91) { + i += 1; + + popup[i] = 0; + popup_type[i] = ""; + popup_text[i] = ""; + popup_image[i] = ""; + popup_special[i] = ""; + + alert[i] = 0; + alert_type[i] = ""; + alert_text[i] = ""; + + alert_char[i] = 0; + alert_alpha[i] = 0; + alert_txt[i] = ""; + alert_color[i] = ""; + + battle[i] = 0; // Set to 0 for none, 1 for battle to do, and 2 for resolved + battle_location[i] = ""; + battle_world[i] = 0; // Be like -50 for space battle + battle_opponent[i] = 0; // faction ID + battle_object[i] = 0; // faction object for the fleets + battle_pobject[i] = 0; // player object for the fleets + battle_special[i] = ""; + + if (i < 16) { + strin[i] = ""; + } } audiences = 0; audience = 0; audience_stack = []; -alert_alpha[1]=0.2; -alert_char[1]=1; -i=-1 +alert_alpha[1] = 0.2; +alert_char[1] = 1; +i = -1; -handle_discovered_governor_assasinations() +handle_discovered_governor_assasinations(); - -if (audiences>0){// This is a one-off change all messages to declare war - var i=0; +if (audiences > 0) { + // This is a one-off change all messages to declare war + var i = 0; var war; - repeat(15){ - i+=1; - war[i]=0; + repeat (15) { + i += 1; + war[i] = 0; } - for (var i=0;i0) then exit; -if (obj_controller.audience>0) then exit; +if (combating > 0) { + exit; +} +if (obj_controller.audience > 0) { + exit; +} -if (show=0) and (obj_controller.zoomed=0) and (current_popup=0) then draw_sprite(spr_loading,image_index,__view_get( e__VW.XView, 0 )+23,__view_get( e__VW.YView, 0 )+73); -if (show=0) and (obj_controller.zoomed=1) and (current_popup=0) then draw_sprite_ext(spr_loading,image_index,40,40,2,2,0,c_white,1); +if ((show == 0) && (obj_controller.zoomed == 0) && (current_popup == 0)) { + draw_sprite(spr_loading, image_index, __view_get(e__VW.XView, 0) + 23, __view_get(e__VW.YView, 0) + 73); +} +if ((show == 0) && (obj_controller.zoomed == 1) && (current_popup == 0)) { + draw_sprite_ext(spr_loading, image_index, 40, 40, 2, 2, 0, c_white, 1); +} +if ((show > 0) && (current_battle <= battles)) { + var xxx, yyy, i; + xxx = __view_get(e__VW.XView, 0) + 535; + yyy = __view_get(e__VW.YView, 0) + 200; + i = current_battle; -if (show>0) and (current_battle<=battles){ - var xxx,yyy,i; - xxx=__view_get( e__VW.XView, 0 )+535; - yyy=__view_get( e__VW.YView, 0 )+200; - i=current_battle; - - draw_sprite(spr_purge_panel,0,xxx,yyy); + draw_sprite(spr_purge_panel, 0, xxx, yyy); // if (battle_world[i]=-50) then draw_sprite(spr_attacked,1,xxx+12,yyy+54); // if (battle_world[i]>0) then draw_sprite(spr_attacked,0,xxx+12,yyy+54); - if (battle_world[i]=-50) then scr_image("attacked",1,xxx+12,yyy+54,254,174); - if (battle_world[i]>0) then scr_image("attacked",0,xxx+12,yyy+54,254,174); - - draw_set_font(fnt_40k_14);draw_set_halign(fa_left);draw_set_color(c_gray); - draw_text(xxx+8,yyy+13,string_hash_to_newline(string(i)+"/"+string(battles))); - + if (battle_world[i] == -50) { + scr_image("attacked", 1, xxx + 12, yyy + 54, 254, 174); + } + if (battle_world[i] > 0) { + scr_image("attacked", 0, xxx + 12, yyy + 54, 254, 174); + } + + draw_set_font(fnt_40k_14); + draw_set_halign(fa_left); + draw_set_color(c_gray); + draw_text(xxx + 8, yyy + 13, string_hash_to_newline(string(i) + "/" + string(battles))); + draw_set_halign(fa_center); draw_set_font(fnt_40k_30b); - - if (battle_world[i]>0) then draw_text_transformed(xxx+265,yyy+11,string_hash_to_newline("Forces Attacked! ("+string(battle_location[i])+" "+scr_roman(battle_world[i])+")"),0.7,0.7,0); - if (battle_world[i]=-50) then draw_text_transformed(xxx+265,yyy+11,string_hash_to_newline("Fleet Attacked! ("+string(battle_location[i])+" System)"),0.7,0.7,0); - - scr_image("ui/force",1,xxx+378-32,yyy+86-32,64,64); + + if (battle_world[i] > 0) { + draw_text_transformed(xxx + 265, yyy + 11, string_hash_to_newline("Forces Attacked! (" + string(battle_location[i]) + " " + scr_roman(battle_world[i]) + ")"), 0.7, 0.7, 0); + } + if (battle_world[i] == -50) { + draw_text_transformed(xxx + 265, yyy + 11, string_hash_to_newline("Fleet Attacked! (" + string(battle_location[i]) + " System)"), 0.7, 0.7, 0); + } + + scr_image("ui/force", 1, xxx + 378 - 32, yyy + 86 - 32, 64, 64); // draw_sprite(spr_force_icon,1,xxx+378,yyy+86); - - draw_set_font(fnt_40k_14);draw_set_halign(fa_left); - - - - if (battle_world[i]<0){ + + draw_set_font(fnt_40k_14); + draw_set_halign(fa_left); + + if (battle_world[i] < 0) { draw_set_font(fnt_40k_14b); draw_set_halign(fa_left); - - draw_text(xxx+12,yyy+237,string_hash_to_newline("Enemy Fleets:")); - draw_text(xxx+332,yyy+237,string_hash_to_newline("Allied Fleets:")); - - if (string(strin[1])="1") then draw_text(xxx+310,yyy+118,string_hash_to_newline(string(strin[1])+" Battleship ("+string(strin[4])+"% HP)")); - if (string(strin[2])="1") then draw_text(xxx+310,yyy+138,string_hash_to_newline(string(strin[2])+" Frigate ("+string(strin[5])+"% HP)")); - if (string(strin[3])="1") then draw_text(xxx+310,yyy+158,string_hash_to_newline(string(strin[3])+" Escort ("+string(strin[6])+"% HP)")); - if (string(strin[1])!="1") then draw_text(xxx+310,yyy+118,string_hash_to_newline(string(strin[1])+" Battleships ("+string(strin[4])+"% HP)")); - if (string(strin[2])!="1") then draw_text(xxx+310,yyy+138,string_hash_to_newline(string(strin[2])+" Frigates ("+string(strin[5])+"% HP)")); - if (string(strin[3])!="1") then draw_text(xxx+310,yyy+158,string_hash_to_newline(string(strin[3])+" Escorts ("+string(strin[6])+"% HP)")); - - + + draw_text(xxx + 12, yyy + 237, string_hash_to_newline("Enemy Fleets:")); + draw_text(xxx + 332, yyy + 237, string_hash_to_newline("Allied Fleets:")); + + if (string(strin[1]) == "1") { + draw_text(xxx + 310, yyy + 118, string_hash_to_newline(string(strin[1]) + " Battleship (" + string(strin[4]) + "% HP)")); + } + if (string(strin[2]) == "1") { + draw_text(xxx + 310, yyy + 138, string_hash_to_newline(string(strin[2]) + " Frigate (" + string(strin[5]) + "% HP)")); + } + if (string(strin[3]) == "1") { + draw_text(xxx + 310, yyy + 158, string_hash_to_newline(string(strin[3]) + " Escort (" + string(strin[6]) + "% HP)")); + } + if (string(strin[1]) != "1") { + draw_text(xxx + 310, yyy + 118, string_hash_to_newline(string(strin[1]) + " Battleships (" + string(strin[4]) + "% HP)")); + } + if (string(strin[2]) != "1") { + draw_text(xxx + 310, yyy + 138, string_hash_to_newline(string(strin[2]) + " Frigates (" + string(strin[5]) + "% HP)")); + } + if (string(strin[3]) != "1") { + draw_text(xxx + 310, yyy + 158, string_hash_to_newline(string(strin[3]) + " Escorts (" + string(strin[6]) + "% HP)")); + } + draw_set_halign(fa_center); - - if (enemy_fleet[1]!=0){ + + if (enemy_fleet[1] != 0) { // draw_sprite(spr_force_icon,enemy_fleet[1],xxx+44,yyy+269); - scr_image("ui/force",enemy_fleet[1],xxx+44-32,yyy+269-32,64,64); - var shw;shw=""; - if (ecap[1]=1) then shw+=string(ecap[1])+" Battleship#"; - if (ecap[1]!=1) then shw+=string(ecap[1])+" Battleships#"; - if (efri[1]=1) then shw+=string(efri[1])+" Frigate#"; - if (efri[1]!=1) then shw+=string(efri[1])+" Frigates#"; - if (eesc[1]=1) then shw+=string(eesc[1])+" Escort#"; - if (eesc[1]!=1) then shw+=string(eesc[1])+" Escorts#"; - - draw_text_transformed(xxx+44,yyy+286,string_hash_to_newline(string(shw)),0.7,1,0); - draw_set_halign(fa_center);draw_set_font(fnt_40k_14b); + scr_image("ui/force", enemy_fleet[1], xxx + 44 - 32, yyy + 269 - 32, 64, 64); + var shw; + shw = ""; + if (ecap[1] == 1) { + shw += string(ecap[1]) + " Battleship#"; + } + if (ecap[1] != 1) { + shw += string(ecap[1]) + " Battleships#"; + } + if (efri[1] == 1) { + shw += string(efri[1]) + " Frigate#"; + } + if (efri[1] != 1) { + shw += string(efri[1]) + " Frigates#"; + } + if (eesc[1] == 1) { + shw += string(eesc[1]) + " Escort#"; + } + if (eesc[1] != 1) { + shw += string(eesc[1]) + " Escorts#"; + } + + draw_text_transformed(xxx + 44, yyy + 286, string_hash_to_newline(string(shw)), 0.7, 1, 0); + draw_set_halign(fa_center); + draw_set_font(fnt_40k_14b); } - if (enemy_fleet[2]!=0){ + if (enemy_fleet[2] != 0) { // draw_sprite(spr_force_icon,enemy_fleet[2],xxx+154,yyy+269); - scr_image("ui/force",enemy_fleet[2],xxx+154-32,yyy+269-32,64,64); - var shw;shw=""; - if (ecap[2]=1) then shw+=string(ecap[2])+" Battleship#"; - if (ecap[2]!=1) then shw+=string(ecap[2])+" Battleships#"; - if (efri[2]=1) then shw+=string(efri[2])+" Frigate#"; - if (efri[2]!=1) then shw+=string(efri[2])+" Frigates#"; - if (eesc[2]=1) then shw+=string(eesc[2])+" Escort#"; - if (eesc[2]!=1) then shw+=string(eesc[2])+" Escorts#"; - - draw_text_transformed(xxx+154,yyy+286,string_hash_to_newline(string(shw)),0.7,1,0); - draw_set_halign(fa_center);draw_set_font(fnt_40k_14b); + scr_image("ui/force", enemy_fleet[2], xxx + 154 - 32, yyy + 269 - 32, 64, 64); + var shw; + shw = ""; + if (ecap[2] == 1) { + shw += string(ecap[2]) + " Battleship#"; + } + if (ecap[2] != 1) { + shw += string(ecap[2]) + " Battleships#"; + } + if (efri[2] == 1) { + shw += string(efri[2]) + " Frigate#"; + } + if (efri[2] != 1) { + shw += string(efri[2]) + " Frigates#"; + } + if (eesc[2] == 1) { + shw += string(eesc[2]) + " Escort#"; + } + if (eesc[2] != 1) { + shw += string(eesc[2]) + " Escorts#"; + } + + draw_text_transformed(xxx + 154, yyy + 286, string_hash_to_newline(string(shw)), 0.7, 1, 0); + draw_set_halign(fa_center); + draw_set_font(fnt_40k_14b); } - if (enemy_fleet[3]!=0){ + if (enemy_fleet[3] != 0) { // draw_sprite(spr_force_icon,enemy_fleet[3],xxx+264,yyy+269); - scr_image("ui/force",enemy_fleet[3],xxx+264-32,yyy+269-32,64,64); - var shw;shw=""; - if (ecap[3]=1) then shw+=string(ecap[3])+" Battleship#"; - if (ecap[3]!=1) then shw+=string(ecap[3])+" Battleships#"; - if (efri[3]=1) then shw+=string(efri[3])+" Frigate#"; - if (efri[3]!=1) then shw+=string(efri[3])+" Frigates#"; - if (eesc[3]=1) then shw+=string(eesc[3])+" Escort#"; - if (eesc[3]!=1) then shw+=string(eesc[3])+" Escorts#"; - - draw_text_transformed(xxx+264,yyy+286,string_hash_to_newline(string(shw)),0.7,1,0); - draw_set_halign(fa_center);draw_set_font(fnt_40k_14b); + scr_image("ui/force", enemy_fleet[3], xxx + 264 - 32, yyy + 269 - 32, 64, 64); + var shw; + shw = ""; + if (ecap[3] == 1) { + shw += string(ecap[3]) + " Battleship#"; + } + if (ecap[3] != 1) { + shw += string(ecap[3]) + " Battleships#"; + } + if (efri[3] == 1) { + shw += string(efri[3]) + " Frigate#"; + } + if (efri[3] != 1) { + shw += string(efri[3]) + " Frigates#"; + } + if (eesc[3] == 1) { + shw += string(eesc[3]) + " Escort#"; + } + if (eesc[3] != 1) { + shw += string(eesc[3]) + " Escorts#"; + } + + draw_text_transformed(xxx + 264, yyy + 286, string_hash_to_newline(string(shw)), 0.7, 1, 0); + draw_set_halign(fa_center); + draw_set_font(fnt_40k_14b); } - - if (allied_fleet[1]!=0){ + + if (allied_fleet[1] != 0) { // draw_sprite(spr_force_icon,allied_fleet[1],xxx+374,yyy+269); - scr_image("ui/force",allied_fleet[1],xxx+374-32,yyy+269-32,64,64); - var shw;shw=""; - if (acap[1]=1) then shw+=string(acap[1])+" Battleship#"; - if (acap[1]!=1) then shw+=string(acap[1])+" Battleships#"; - if (afri[1]=1) then shw+=string(afri[1])+" Frigate#"; - if (afri[1]!=1) then shw+=string(afri[1])+" Frigates#"; - if (aesc[1]=1) then shw+=string(aesc[1])+" Escort#"; - if (aesc[1]!=1) then shw+=string(aesc[1])+" Escorts#"; - - draw_text_transformed(xxx+374,yyy+286,string_hash_to_newline(string(shw)),0.7,1,0); - draw_set_halign(fa_center);draw_set_font(fnt_40k_14b); + scr_image("ui/force", allied_fleet[1], xxx + 374 - 32, yyy + 269 - 32, 64, 64); + var shw; + shw = ""; + if (acap[1] == 1) { + shw += string(acap[1]) + " Battleship#"; + } + if (acap[1] != 1) { + shw += string(acap[1]) + " Battleships#"; + } + if (afri[1] == 1) { + shw += string(afri[1]) + " Frigate#"; + } + if (afri[1] != 1) { + shw += string(afri[1]) + " Frigates#"; + } + if (aesc[1] == 1) { + shw += string(aesc[1]) + " Escort#"; + } + if (aesc[1] != 1) { + shw += string(aesc[1]) + " Escorts#"; + } + + draw_text_transformed(xxx + 374, yyy + 286, string_hash_to_newline(string(shw)), 0.7, 1, 0); + draw_set_halign(fa_center); + draw_set_font(fnt_40k_14b); } - if (allied_fleet[2]!=0){ + if (allied_fleet[2] != 0) { // draw_sprite(spr_force_icon,allied_fleet[1],xxx+484,yyy+269); - scr_image("ui/force",allied_fleet[1],xxx+484-32,yyy+269-32,64,64); - var shw;shw=""; - if (acap[2]=1) then shw+=string(acap[2])+" Battleship#"; - if (acap[2]!=1) then shw+=string(acap[2])+" Battleships#"; - if (afri[2]=1) then shw+=string(afri[2])+" Frigate#"; - if (afri[2]!=1) then shw+=string(afri[2])+" Frigates#"; - if (aesc[2]=1) then shw+=string(aesc[2])+" Escort#"; - if (aesc[2]!=1) then shw+=string(aesc[2])+" Escorts#"; - - draw_text_transformed(xxx+484,yyy+286,string_hash_to_newline(string(shw)),0.7,1,0); - draw_set_halign(fa_center);draw_set_font(fnt_40k_14b); + scr_image("ui/force", allied_fleet[1], xxx + 484 - 32, yyy + 269 - 32, 64, 64); + var shw; + shw = ""; + if (acap[2] == 1) { + shw += string(acap[2]) + " Battleship#"; + } + if (acap[2] != 1) { + shw += string(acap[2]) + " Battleships#"; + } + if (afri[2] == 1) { + shw += string(afri[2]) + " Frigate#"; + } + if (afri[2] != 1) { + shw += string(afri[2]) + " Frigates#"; + } + if (aesc[2] == 1) { + shw += string(aesc[2]) + " Escort#"; + } + if (aesc[2] != 1) { + shw += string(aesc[2]) + " Escorts#"; + } + + draw_text_transformed(xxx + 484, yyy + 286, string_hash_to_newline(string(shw)), 0.7, 1, 0); + draw_set_halign(fa_center); + draw_set_font(fnt_40k_14b); } - - - - - - draw_set_color(c_gray);draw_rectangle(xxx+132,yyy+354,xxx+259,yyy+389,0); - draw_set_color(0);draw_text_transformed(xxx+195,yyy+362,string_hash_to_newline("Retreat"),1.1,1.1,0); - if (scr_hit(xxx+132,yyy+354,xxx+259,yyy+389)=true){ - draw_set_alpha(0.2);draw_rectangle(xxx+132,yyy+354,xxx+259,yyy+389,0);draw_set_alpha(1); + + draw_set_color(c_gray); + draw_rectangle(xxx + 132, yyy + 354, xxx + 259, yyy + 389, 0); + draw_set_color(0); + draw_text_transformed(xxx + 195, yyy + 362, string_hash_to_newline("Retreat"), 1.1, 1.1, 0); + if (scr_hit(xxx + 132, yyy + 354, xxx + 259, yyy + 389) == true) { + draw_set_alpha(0.2); + draw_rectangle(xxx + 132, yyy + 354, xxx + 259, yyy + 389, 0); + draw_set_alpha(1); } - - draw_set_color(c_gray);draw_rectangle(xxx+272,yyy+354,xxx+399,yyy+389,0); - draw_set_color(0);draw_text_transformed(xxx+335,yyy+362,string_hash_to_newline("Fight"),1.1,1.1,0); - if (scr_hit(xxx+272,yyy+354,xxx+399,yyy+389)=true){ - draw_set_alpha(0.2);draw_rectangle(xxx+272,yyy+354,xxx+399,yyy+389,0);draw_set_alpha(1); + + draw_set_color(c_gray); + draw_rectangle(xxx + 272, yyy + 354, xxx + 399, yyy + 389, 0); + draw_set_color(0); + draw_text_transformed(xxx + 335, yyy + 362, string_hash_to_newline("Fight"), 1.1, 1.1, 0); + if (scr_hit(xxx + 272, yyy + 354, xxx + 399, yyy + 389) == true) { + draw_set_alpha(0.2); + draw_rectangle(xxx + 272, yyy + 354, xxx + 399, yyy + 389, 0); + draw_set_alpha(1); } - } - - - if (battle_world[i]>=1){ - if (battle_opponent[i]<=20){ - draw_text(xxx+310,yyy+118,string_hash_to_newline(string(strin[1])+" Marines")); - draw_text(xxx+310,yyy+138,string_hash_to_newline(string(strin[2])+" Vehicles")); - if (strin[3]!="") then draw_text(xxx+310,yyy+158,string_hash_to_newline(string(strin[3])+" Fortified"));// Not / Barely / Lightly / Moderately / Highly / Maximally + + if (battle_world[i] >= 1) { + if (battle_opponent[i] <= 20) { + draw_text(xxx + 310, yyy + 118, string_hash_to_newline(string(strin[1]) + " Marines")); + draw_text(xxx + 310, yyy + 138, string_hash_to_newline(string(strin[2]) + " Vehicles")); + if (strin[3] != "") { + draw_text(xxx + 310, yyy + 158, string_hash_to_newline(string(strin[3]) + " Fortified")); + } // Not / Barely / Lightly / Moderately / Highly / Maximally } - + draw_set_font(fnt_40k_14b); draw_set_halign(fa_left); - - draw_text(xxx+12,yyy+237,string_hash_to_newline("Enemy Factions:")); - draw_text(xxx+332,yyy+237,string_hash_to_newline("Allies:")); - - - + + draw_text(xxx + 12, yyy + 237, string_hash_to_newline("Enemy Factions:")); + draw_text(xxx + 332, yyy + 237, string_hash_to_newline("Allies:")); + draw_set_halign(fa_center); // draw_sprite(spr_force_icon,battle_opponent[i],xxx+44,yyy+289); - scr_image("ui/force",battle_opponent[i],xxx+44-32,yyy+289-32,64,64); - draw_text_transformed(xxx+44,yyy+316,string_hash_to_newline(string(strin[4])),0.75,1,0); - draw_set_halign(fa_center);draw_set_font(fnt_40k_14b); - - - draw_set_color(c_gray);draw_rectangle(xxx+132,yyy+354,xxx+259,yyy+389,0); - draw_set_color(0);draw_text_transformed(xxx+195,yyy+362,string_hash_to_newline("Offensive"),1.1,1.1,0); - if (scr_hit(xxx+132,yyy+354,xxx+259,yyy+389)=true){ - draw_set_alpha(0.2);draw_rectangle(xxx+132,yyy+354,xxx+259,yyy+389,0);draw_set_alpha(1); + scr_image("ui/force", battle_opponent[i], xxx + 44 - 32, yyy + 289 - 32, 64, 64); + draw_text_transformed(xxx + 44, yyy + 316, string_hash_to_newline(string(strin[4])), 0.75, 1, 0); + draw_set_halign(fa_center); + draw_set_font(fnt_40k_14b); + + draw_set_color(c_gray); + draw_rectangle(xxx + 132, yyy + 354, xxx + 259, yyy + 389, 0); + draw_set_color(0); + draw_text_transformed(xxx + 195, yyy + 362, string_hash_to_newline("Offensive"), 1.1, 1.1, 0); + if (scr_hit(xxx + 132, yyy + 354, xxx + 259, yyy + 389) == true) { + draw_set_alpha(0.2); + draw_rectangle(xxx + 132, yyy + 354, xxx + 259, yyy + 389, 0); + draw_set_alpha(1); } - - draw_set_color(c_gray);draw_rectangle(xxx+272,yyy+354,xxx+399,yyy+389,0); - draw_set_color(0);draw_text_transformed(xxx+335,yyy+362,string_hash_to_newline("Defensive"),1.1,1.1,0); - if (scr_hit(xxx+272,yyy+354,xxx+399,yyy+389)=true){ - draw_set_alpha(0.2);draw_rectangle(xxx+272,yyy+354,xxx+399,yyy+389,0);draw_set_alpha(1); + + draw_set_color(c_gray); + draw_rectangle(xxx + 272, yyy + 354, xxx + 399, yyy + 389, 0); + draw_set_color(0); + draw_text_transformed(xxx + 335, yyy + 362, string_hash_to_newline("Defensive"), 1.1, 1.1, 0); + if (scr_hit(xxx + 272, yyy + 354, xxx + 399, yyy + 389) == true) { + draw_set_alpha(0.2); + draw_rectangle(xxx + 272, yyy + 354, xxx + 399, yyy + 389, 0); + draw_set_alpha(1); } - - - - - } } - - - - - - /* if (show>0) and (current_battle<=battles){ @@ -288,7 +383,6 @@ if (show>0) and (current_battle<=battles){ }*/ - /* */ /* */ diff --git a/objects/obj_turn_end/Draw_64.gml b/objects/obj_turn_end/Draw_64.gml index 15c5c40f25..1dbe9b418b 100644 --- a/objects/obj_turn_end/Draw_64.gml +++ b/objects/obj_turn_end/Draw_64.gml @@ -1,36 +1,30 @@ /// @description Insert description here // You can write your code in this editor - - -var i=0; - +var i = 0; draw_set_font(fnt_40k_14b); draw_set_halign(fa_left); draw_set_color(CM_GREEN_COLOR); -if (alerts>0) and (popups_end=1){ - - repeat(alerts){ - i+=1; +if ((alerts > 0) && (popups_end == 1)) { + repeat (alerts) { + i += 1; set_alert_draw_colour(alert_color[i]); - draw_set_alpha(min(1,alert_alpha[i])); - - if (obj_controller.zoomed=0){ - draw_text(32,+46+(i*20),string_hash_to_newline(string(alert_txt[i]))); + draw_set_alpha(min(1, alert_alpha[i])); + + if (obj_controller.zoomed == 0) { + draw_text(32, +46 + (i * 20), string_hash_to_newline(string(alert_txt[i]))); // draw_text(view_xview[0]+16.5,view_yview[0]+40.5+(i*12),string(alert_txt[i])); } /*if (obj_controller.zoomed=1){ draw_text_transformed(80,80+(i*24),string(alert_txt[i]),2,2,0); draw_text_transformed(81,81+(i*24),string(alert_txt[i]),2,2,0); }*/ - - if (obj_controller.zoomed=1){ - draw_text_transformed(32,92+(i*40),string_hash_to_newline(string(alert_txt[i])),2,2,0); + + if (obj_controller.zoomed == 1) { + draw_text_transformed(32, 92 + (i * 40), string_hash_to_newline(string(alert_txt[i])), 2, 2, 0); // draw_text_transformed(122,122+(i*36),string(alert_txt[i]),3,3,0); } } } - - diff --git a/objects/obj_turn_end/Mouse_56.gml b/objects/obj_turn_end/Mouse_56.gml index a2822f4842..881f98d87b 100644 --- a/objects/obj_turn_end/Mouse_56.gml +++ b/objects/obj_turn_end/Mouse_56.gml @@ -2,206 +2,207 @@ var __b__; //so this only runs if there aren't these types of instances __b__ = action_if_number(obj_saveload, 0, 0); -if __b__ -{ -__b__ = action_if_number(obj_popup, 0, 0); - if __b__ - { - __b__ = action_if_number(obj_ncombat, 0, 0); - if __b__ - { - __b__ = action_if_number(obj_fleet, 0, 0); - if __b__ - { - - if (obj_controller.complex_event=true) or (instance_exists(obj_temp_meeting)) then exit; - - - - var xxx,yyy; - xxx=__view_get( e__VW.XView, 0 )+535; - yyy=__view_get( e__VW.YView, 0 )+200; - - if (cooldown<=0) and (battle_world[current_battle]=-50) and (combating=0){ - if (mouse_x>=xxx+132) and (mouse_y>=yyy+354) and (mouse_x=xxx+272) and (mouse_y>=yyy+354) and (mouse_x0) and (combating=0){ - - var tip;tip=""; - - if (mouse_x>=xxx+132) and (mouse_y>=yyy+354) and (mouse_x=xxx+272) and (mouse_y>=yyy+354) and (mouse_x= xxx + 132) && (mouse_y >= yyy + 354) && (mouse_x < xxx + 259) && (mouse_y < yyy + 389)) { + // Run like hell, space + with (obj_fleet_select) { + instance_destroy(); + } + var that, that2; + that = instance_nearest(battle_pobject[current_battle].x, battle_pobject[current_battle].y, obj_p_fleet); + that.alarm[3] = 1; + that2 = instance_create(0, 0, obj_popup); + that2.type = 99; + obj_controller.force_scroll = 1; + } + + if ((mouse_x >= xxx + 272) && (mouse_y >= yyy + 354) && (mouse_x < xxx + 399) && (mouse_y < yyy + 389)) { + // Fight fight fight, space + obj_controller.cooldown = 8000; + instance_activate_all(); + + // Start battle here + + combating = 1; + + instance_create(0, 0, obj_fleet); + // + obj_fleet.enemy[1] = enemy_fleet[1]; + obj_fleet.enemy_status[1] = -1; + + obj_fleet.en_capital[1] = ecap[1]; + obj_fleet.en_frigate[1] = efri[1]; + obj_fleet.en_escort[1] = eesc[1]; + + // Plug in all of the enemies first + // And then plug in the allies after then with their status set to positive + + var g = 1; + ee = 1; + repeat (5) { + g += 1; + if (enemy_fleet[g] != 0) { + ee += 1; + obj_fleet.enemy[ee] = enemy_fleet[g]; + obj_fleet.enemy_status[ee] = -1; + + obj_fleet.en_capital[ee] = ecap[g]; + obj_fleet.en_frigate[ee] = efri[g]; + obj_fleet.en_escort[ee] = eesc[g]; + } + } + var g = 0; + repeat (6) { + g += 1; + if (allied_fleet[g] != 0) { + ee += 1; + obj_fleet.enemy[ee] = allied_fleet[g]; + obj_fleet.enemy_status[ee] = 1; + + obj_fleet.en_capital[ee] = acap[g]; + obj_fleet.en_frigate[ee] = afri[g]; + obj_fleet.en_escort[ee] = aesc[g]; + } + } + + if (battle_special[current_battle] == "csm") { + obj_fleet.csm_exp = 1; + } + if (battle_special[current_battle] == "BLOOD") { + obj_fleet.csm_exp = 2; + } + + instance_activate_all(); + var stahr = instance_nearest(battle_pobject[current_battle].x, battle_pobject[current_battle].y, obj_star); + obj_fleet.star_name = stahr.name; + + for (var p_num = 1; p_num < stahr.planets; p_num++) { + //TODO fix this because this sounds rad + //if(planet_feature_bool(stahr.p_feature[p_num], P_features.Monastery)==1)thenobj_fleet.player_lasers=stahr.p_lasers[p_num]; + } + add_fleet_ships_to_combat(battle_pobject[current_battle], obj_fleet); + + instance_deactivate_all(true); + instance_activate_object(obj_controller); + instance_activate_object(obj_ini); + instance_activate_object(obj_fleet); + instance_activate_object(obj_cursor); + // instance_deactivate_object(battle_pobject[current_battle]); + } + } + + if ((cooldown <= 0) && (battle_world[current_battle] > 0) && (combating == 0)) { + var tip; + tip = ""; + + if ((mouse_x >= xxx + 132) && (mouse_y >= yyy + 354) && (mouse_x < xxx + 259) && (mouse_y < yyy + 389)) { + tip = "offensive"; + } + + if ((mouse_x >= xxx + 272) && (mouse_y >= yyy + 354) && (mouse_x < xxx + 399) && (mouse_y < yyy + 389)) { + tip = "defensive"; + } + + if (tip != "") { + var _loc = battle_location[current_battle]; + var _planet = battle_world[current_battle]; // Fight fight fight, ground + obj_controller.cooldown = 8; + + // Start battle here + + combating = 1; + + instance_deactivate_all(true); + instance_activate_object(obj_controller); + instance_activate_object(obj_ini); + instance_activate_object(battle_object[current_battle]); + + var _battle_obj = battle_object[current_battle]; + + instance_create(0, 0, obj_ncombat); + obj_ncombat.enemy = battle_opponent[current_battle]; + obj_ncombat.battle_object = _battle_obj; + obj_ncombat.battle_loc = _loc; + obj_ncombat.battle_id = _planet; + + var _enemy = obj_ncombat.enemy; + + var _planet_data = new PlanetData(_planet, _battle_obj); + if (tip == "offensive") { + obj_ncombat.formation_set = 1; + } else if (tip == "defensive") { + obj_ncombat.formation_set = 2; + } + + var _allow_fortifications = false; + var _fort_factions = [eFACTION.Player, eFACTION.Tyranids, eFACTION.Ork]; + _allow_fortifications = array_contains(_fort_factions, _planet_data.current_owner); + + if (!_allow_fortifications) { + var owner_fac_status; + _allow_fortifications = _planet_data.owner_status() != "War"; + } + + if (_allow_fortifications) { + obj_ncombat.fortified = _planet_data.fortification_level; + } + + if (obj_ncombat.enemy == 13) { + obj_ncombat.fortified = 0; + } + + obj_ncombat.battle_special = battle_special[current_battle]; + obj_ncombat.battle_climate = _planet_data.planet_type; + + // show_message(string(battle_object[current_battle].p_feature[battle_world[current_battle]])); + /*if (scr_planetary_feature.plant_feature_bool(battle_object[current_battle].p_feature[battle_world[current_battle]], P_features.Monastery)==1){ // show_message(string(battle_object[current_battle].p_defenses[battle_world[current_battle]])); // show_message(string(battle_object[current_battle].p_silo[battle_world[current_battle]])); obj_ncombat.player_defenses+=battle_object[current_battle].p_defenses[battle_world[current_battle]]; obj_ncombat.player_silos+=battle_object[current_battle].p_silo[battle_world[current_battle]]; }*/ - - if (_enemy == eFACTION.Imperium){ - obj_ncombat.threat=min(1000000,_planet_data.guardsmen); - } else if (obj_ncombat.enemy<14 && _enemy>5){ - obj_ncombat.threat = _planet_data.planet_forces[_enemy]; - } - else if (_enemy=30){ - obj_ncombat.threat=1; - } - - // - _roster = new Roster(); - with (_roster){ - roster_location = _loc; - roster_planet = _planet; - determine_full_roster(); - only_locals(); - update_roster(); - if (array_length(selected_units)){ - setup_battle_formations(); - add_to_battle(); - } - } - delete _roster - instance_deactivate_object(battle_object[current_battle]); - } - } - } - } - } + + if (_enemy == eFACTION.Imperium) { + obj_ncombat.threat = min(1000000, _planet_data.guardsmen); + } else if (obj_ncombat.enemy < 14 && _enemy > 5) { + obj_ncombat.threat = _planet_data.planet_forces[_enemy]; + } else if (_enemy == 30) { + obj_ncombat.threat = 1; + } + + // + _roster = new Roster(); + with (_roster) { + roster_location = _loc; + roster_planet = _planet; + determine_full_roster(); + only_locals(); + update_roster(); + if (array_length(selected_units)) { + setup_battle_formations(); + add_to_battle(); + } + } + delete _roster; + instance_deactivate_object(battle_object[current_battle]); + } + } + } + } + } } diff --git a/objects/obj_turn_end/Step_0.gml b/objects/obj_turn_end/Step_0.gml index 201e530948..c187d532ff 100644 --- a/objects/obj_turn_end/Step_0.gml +++ b/objects/obj_turn_end/Step_0.gml @@ -1,31 +1,35 @@ - var i; -i=0; +i = 0; -if (cooldown>=0) then cooldown-=1; +if (cooldown >= 0) { + cooldown -= 1; +} -if (alerts>0) and (popups_end=1) and (fadeout=0){ - repeat(alerts){ - i+=1; +if ((alerts > 0) && (popups_end == 1) && (fadeout == 0)) { + repeat (alerts) { + i += 1; - if (fast>=i) and (string_length(alert_txt[i])= i) && (string_length(alert_txt[i]) < string_length(alert_text[i]))) { + alert_char[i] += 1; + alert_txt[i] = string_copy(alert_text[i], 0, alert_char[i]); + } + if ((fast >= i) && (alert_alpha[i] < 1)) { + alert_alpha[i] += 0.03; } - if (fast>=i) and (alert_alpha[i]<1) then alert_alpha[i]+=0.03; } } - -if (fadeout=1){ - i=0; - repeat(alerts){ - i+=1;alert_alpha[i]-=0.05; - if (i=1) and (alert_alpha[1]<=0) then instance_destroy(); +if (fadeout == 1) { + i = 0; + repeat (alerts) { + i += 1; + alert_alpha[i] -= 0.05; + if ((i == 1) && (alert_alpha[1] <= 0)) { + instance_destroy(); + } } } - - -if (alarm[2]=2000) then instance_destroy(); - +if (alarm[2] == 2000) { + instance_destroy(); +} diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index b1ef3ecd06..74c0a30020 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -1,3 +1,7 @@ +❌ Formatting made the code invalid! +Syntax error at line 109, column 27: +unexpected '[$' + #macro SPECIALISTS_APOTHECARIES "apothecaries" #macro SPECIALISTS_CHAPLAINS "chaplains" #macro SPECIALISTS_LIBRARIANS "librarians" @@ -15,9 +19,9 @@ /// @description Retrieves the active roles from the game, either from the obj_creation or obj_ini object. /// @returns {array} -function active_roles(){ - var _roles = instance_exists(obj_creation) ? obj_creation.role[100] : obj_ini.role[100]; - return _roles; +function active_roles() { + var _roles = instance_exists(obj_creation) ? obj_creation.role[100] : obj_ini.role[100]; + return _roles; } /// @description Returns a list of roles based on the specified group, with optional inclusion of trainees and heads. @@ -28,172 +32,106 @@ function active_roles(){ function role_groups(group, include_trainee = false, include_heads = true) { var _role_list = []; var _roles = active_roles(); - var _chap_name = instance_exists(obj_creation) ? obj_creation.chapter_name : global.chapter_name; + var _chap_name = instance_exists(obj_creation) ? obj_creation.chapter_name : global.chapter_name; switch (group) { case SPECIALISTS_STANDARD: - _role_list = [ - _roles[eROLE.Captain], - _roles[eROLE.Dreadnought], - $"Venerable {_roles[eROLE.Dreadnought]}", - _roles[eROLE.Champion], - _roles[eROLE.Chaplain], - _roles[eROLE.Apothecary], - _roles[eROLE.Techmarine], - _roles[eROLE.Librarian], - "Codiciery", - "Lexicanum", - _roles[eROLE.HonourGuard] - ]; + _role_list = [_roles[eROLE.Captain], _roles[eROLE.Dreadnought], $"Venerable {_roles[eROLE.Dreadnought]}", _roles[eROLE.Champion], _roles[eROLE.Chaplain], _roles[eROLE.Apothecary], _roles[eROLE.Techmarine], _roles[eROLE.Librarian], "Codiciery", "Lexicanum", _roles[eROLE.HonourGuard]]; if (include_trainee) { - _role_list = array_concat(_role_list, role_groups(SPECIALISTS_TRAINEES)); + _role_list = array_concat(_role_list, role_groups(SPECIALISTS_TRAINEES)); } - if (include_heads) { - _role_list = array_concat(_role_list, role_groups(SPECIALISTS_HEADS)); + if (include_heads) { + _role_list = array_concat(_role_list, role_groups(SPECIALISTS_HEADS)); } break; case SPECIALISTS_LIBRARIANS: - _role_list = [ - _roles[eROLE.Librarian], - "Codiciery", - "Lexicanum" - ]; - if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Librarian]} Aspirant"); + _role_list = [_roles[eROLE.Librarian], "Codiciery", "Lexicanum"]; + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Librarian]} Aspirant"); + } + if (include_heads) { + array_push(_role_list, $"Chief {_roles[eROLE.Librarian]}"); + } + break; + case SPECIALISTS_TECHS: + _role_list = [_roles[eROLE.Techmarine], "Techpriest"]; + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Techmarine]} Aspirant"); + } + if (include_heads) { + array_push(_role_list, "Forge Master"); + } + break; + case SPECIALISTS_TECHMARINES: + _role_list = [_roles[eROLE.Techmarine]]; + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Techmarine]} Aspirant"); } - if (include_heads) { - array_push(_role_list, $"Chief {_roles[eROLE.Librarian]}"); + if (include_heads) { + array_push(_role_list, "Forge Master"); + } + break; + case SPECIALISTS_CHAPLAINS: + _role_list = [_roles[eROLE.Chaplain]]; + if (_chap_name == "Iron Hands") { + array_push(_role_list, _roles[eROLE.Techmarine]); + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Techmarine]} Aspirant"); + } + if (include_heads) { + array_push(_role_list, "Forge Master"); + } + } + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Chaplain]} Aspirant"); + } + if (include_heads) { + array_push(_role_list, "Master of Sanctity"); + } + break; + case SPECIALISTS_APOTHECARIES: + _role_list = [_roles[eROLE.Apothecary]]; + if (_chap_name == "Space Wolves") { + array_push(_role_list, _roles[eROLE.Chaplain]); + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Chaplain]} Aspirant"); + } + if (include_heads) { + array_push(_role_list, "Master of Sanctity"); + } + } + if (include_trainee) { + array_push(_role_list, $"{_roles[eROLE.Apothecary]} Aspirant"); + } + if (include_heads) { + array_push(_role_list, "Master of the Apothecarion"); } break; - case SPECIALISTS_TECHS: - _role_list = [ - _roles[eROLE.Techmarine], - "Techpriest" - ]; - if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Techmarine]} Aspirant"); - } - if (include_heads) { - array_push(_role_list, "Forge Master"); - } - break; - case SPECIALISTS_TECHMARINES: - _role_list = [ - _roles[eROLE.Techmarine], - ] - if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Techmarine]} Aspirant"); - } - if (include_heads) { - array_push(_role_list, "Forge Master"); - } - break; - case SPECIALISTS_CHAPLAINS: - _role_list = [_roles[eROLE.Chaplain]]; - if (_chap_name == "Iron Hands") { - array_push(_role_list, _roles[eROLE.Techmarine]); - if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Techmarine]} Aspirant"); - } - if (include_heads) { - array_push(_role_list, "Forge Master"); - } - } - if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Chaplain]} Aspirant"); - } - if (include_heads) { - array_push(_role_list, "Master of Sanctity"); - } - break; - case SPECIALISTS_APOTHECARIES: - _role_list = [_roles[eROLE.Apothecary]]; - if (_chap_name == "Space Wolves") { - array_push(_role_list, _roles[eROLE.Chaplain]); - if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Chaplain]} Aspirant"); - } - if (include_heads) { - array_push(_role_list, "Master of Sanctity"); - } - } - if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Apothecary]} Aspirant"); - } - if (include_heads) { - array_push(_role_list, "Master of the Apothecarion"); - } - break; case SPECIALISTS_TRAINEES: - _role_list = [ - $"{_roles[eROLE.Librarian]} Aspirant", - $"{_roles[eROLE.Apothecary]} Aspirant", - $"{_roles[eROLE.Chaplain]} Aspirant", - $"{_roles[eROLE.Techmarine]} Aspirant" - ]; + _role_list = [$"{_roles[eROLE.Librarian]} Aspirant", $"{_roles[eROLE.Apothecary]} Aspirant", $"{_roles[eROLE.Chaplain]} Aspirant", $"{_roles[eROLE.Techmarine]} Aspirant"]; break; case SPECIALISTS_HEADS: - _role_list = [ - "Master of Sanctity", - $"Chief {_roles[eROLE.Librarian]}", - "Forge Master", - obj_ini.role[100][eROLE.ChapterMaster], - "Master of the Apothecarion" - ]; + _role_list = ["Master of Sanctity", $"Chief {_roles[eROLE.Librarian]}", "Forge Master", obj_ini.role[100][eROLE.ChapterMaster], "Master of the Apothecarion"]; break; case SPECIALISTS_VETERANS: - _role_list = [ - _roles[eROLE.Veteran], - _roles[eROLE.Terminator], - _roles[eROLE.VeteranSergeant], - _roles[eROLE.HonourGuard] - ]; + _role_list = [_roles[eROLE.Veteran], _roles[eROLE.Terminator], _roles[eROLE.VeteranSergeant], _roles[eROLE.HonourGuard]]; break; case SPECIALISTS_RANK_AND_FILE: - _role_list = [ - _roles[eROLE.Tactical], - _roles[eROLE.Devastator], - _roles[eROLE.Assault], - _roles[eROLE.Scout] - ]; + _role_list = [_roles[eROLE.Tactical], _roles[eROLE.Devastator], _roles[eROLE.Assault], _roles[eROLE.Scout]]; break; case SPECIALISTS_SQUAD_LEADERS: - _role_list = [ - _roles[eROLE.Sergeant], - _roles[eROLE.VeteranSergeant] - ]; + _role_list = [_roles[eROLE.Sergeant], _roles[eROLE.VeteranSergeant]]; break; case SPECIALISTS_COMMAND: - _role_list = [ - _roles[eROLE.Captain], - _roles[eROLE.Apothecary], - _roles[eROLE.Chaplain], - _roles[eROLE.Techmarine], - _roles[eROLE.Librarian], - "Codiciery", - "Lexicanum", - _roles[eROLE.Ancient], - _roles[eROLE.Champion] - ]; + _role_list = [_roles[eROLE.Captain], _roles[eROLE.Apothecary], _roles[eROLE.Chaplain], _roles[eROLE.Techmarine], _roles[eROLE.Librarian], "Codiciery", "Lexicanum", _roles[eROLE.Ancient], _roles[eROLE.Champion]]; break; case SPECIALISTS_DREADNOUGHTS: - _role_list = [ - _roles[eROLE.Dreadnought], - $"Venerable {_roles[eROLE.Dreadnought]}" - ]; + _role_list = [_roles[eROLE.Dreadnought], $"Venerable {_roles[eROLE.Dreadnought]}"]; break; case SPECIALISTS_CAPTAIN_CANDIDATES: - _role_list = [ - _roles[eROLE.Sergeant], - _roles[eROLE.VeteranSergeant], - _roles[eROLE.Champion], - _roles[eROLE.Captain], - _roles[eROLE.Terminator], - _roles[eROLE.Veteran], - _roles[eROLE.Ancient] - ]; + _role_list = [_roles[eROLE.Sergeant], _roles[eROLE.VeteranSergeant], _roles[eROLE.Champion], _roles[eROLE.Captain], _roles[eROLE.Terminator], _roles[eROLE.Veteran], _roles[eROLE.Ancient]]; break; } @@ -215,150 +153,170 @@ function is_specialist(unit_role, type = SPECIALISTS_STANDARD, include_trainee = //TODO write this out with proper formatting when i can be assed //Used to quikcly collect groups of marines with given parameters // group takes a string relating to options in the role_groups function, to ignore filtering by group use "all" - // can also pass an array to filter for mutiple groups +// can also pass an array to filter for mutiple groups // location takes wther a string with a system name or an array with 3 parameters [,,] // if opposite is true then then the roles defined in the group argument are ignored and all others collected // search conditions - // companies, takes either an int or an arrat to define which companies to search in - // any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines - // job allows you to find marines forfuling certain tasks like garrison or forge etc +// companies, takes either an int or an arrat to define which companies to search in +// any stat allowed by the stat_valuator basically allows you to look for marines whith certain stat lines +// job allows you to find marines forfuling certain tasks like garrison or forge etc -function collect_role_group(group=SPECIALISTS_STANDARD, location="", opposite=false, search_conditions = {companies:"all"}){ - var _units = [], unit, count=0, _add=false, _is_special_group; - var _max_count = 0; - var _total_count = 0; - if (struct_exists(search_conditions, "max")){ - _max_count = search_conditions.max; - } - if (!struct_exists(search_conditions, "companies")){ - search_conditions.companies = "all"; - } - for (var com=0;com<=10;com++){ - if (_max_count>0){ - if (array_length(_units)>=_max_count){ - break; - } - } - var _wanted_companies = search_conditions.companies; - if (_wanted_companies!="all"){ - if (is_array(_wanted_companies)){ - if (!array_contains(_wanted_companies, com)) then continue; - } else { - if (_wanted_companies != com) then continue; - } - } - for (var i=0;i0){ - if (array_length(_units)>=_max_count){ - break; - } - } - if array_length(_units) - _add=false; - unit=fetch_unit([com,i]); - if (unit.name()=="") then continue; - if (group!="all"){ - if (is_array(group)){ - if (array_length(group) == 3) { - _is_special_group = unit.IsSpecialist(group[0], group[1], group[2]); - } else { - _is_special_group = unit.IsSpecialist(group[0], group[1]); - } - } else { - _is_special_group = unit.IsSpecialist(group); - } - } else { - _is_special_group = true; - } - if ((_is_special_group && !opposite) || (!_is_special_group && opposite)){ - if (location==""){ - _add=true; - } else if (!is_array(location)){ - _add=unit.is_at_location(location); - } else { - _add=unit.is_at_location(location[0], location[1], location[2]); - } - } - if (_add){ - if (struct_exists(search_conditions, "stat")){ - _add = stat_valuator(search_conditions.stat, unit); - } - if (struct_exists(search_conditions,"job")){ - _add = (unit.assignment() == search_conditions.job); - } - } - if (_add) then array_push(_units, obj_ini.TTRPG[com][i]); - } - } - return _units; +function collect_role_group( + group = SPECIALISTS_STANDARD, + location = "", + opposite = false, + search_conditions = { + companies: "all", + } +) { + var _units = [], unit, count = 0, _add = false, _is_special_group; + var _max_count = 0; + var _total_count = 0; + if (struct_exists(search_conditions, "max")) { + _max_count = search_conditions.max; + } + if (!struct_exists(search_conditions, "companies")) { + search_conditions.companies = "all"; + } + for (var com = 0; com <= 10; com++) { + if (_max_count > 0) { + if (array_length(_units) >= _max_count) { + break; + } + } + var _wanted_companies = search_conditions.companies; + if (_wanted_companies != "all") { + if (is_array(_wanted_companies)) { + if (!array_contains(_wanted_companies, com)) { + continue; + } + } else { + if (_wanted_companies != com) { + continue; + } + } + } + for (var i = 0; i < array_length(obj_ini.TTRPG[com]); i++) { + if (_max_count > 0) { + if (array_length(_units) >= _max_count) { + break; + } + } + if (array_length(_units)) { + _add = false; + } + unit = fetch_unit([com, i]); + if (unit.name() == "") { + continue; + } + if (group != "all") { + if (is_array(group)) { + if (array_length(group) == 3) { + _is_special_group = unit.IsSpecialist(group[0], group[1], group[2]); + } else { + _is_special_group = unit.IsSpecialist(group[0], group[1]); + } + } else { + _is_special_group = unit.IsSpecialist(group); + } + } else { + _is_special_group = true; + } + if ((_is_special_group && !opposite) || (!_is_special_group && opposite)) { + if (location == "") { + _add = true; + } else if (!is_array(location)) { + _add = unit.is_at_location(location); + } else { + _add = unit.is_at_location(location[0], location[1], location[2]); + } + } + if (_add) { + if (struct_exists(search_conditions, "stat")) { + _add = stat_valuator(search_conditions.stat, unit); + } + if (struct_exists(search_conditions, "job")) { + _add = unit.assignment() == search_conditions.job; + } + } + if (_add) { + array_push(_units, obj_ini.TTRPG[com][i]); + } + } + } + return _units; } -function stat_valuator(search_params, unit){ - match = true; - for (var stat = 0;stat _stat_val[1]){ - match = false; - break; - } - break; + case "inless": + case "less": + if (unit[$ _stat_val[0]] > _stat_val[1]) { + match = false; + break; + } + break; - case "exless": - if (unit[$ _stat_val[0]] >= _stat_val[1]){ - match = false; - break; - } - break; - } - } - return match; + case "exless": + if (unit[$ _stat_val[0]] >= _stat_val[1]) { + match = false; + break; + } + break; + } + } + return match; } -function collect_by_religeon(religion, sub_cult="", location=""){ - var _units = [], unit, count=0, _add=false; - for (var com=0;com<=10;com++){ - for (var i=1;i 1) { - cheat_arguments = input_string[1]; - // Handle quotes and spaces for arguments - if (string_count("\"", cheat_arguments) > 0) { - // Split by quotes and trim spaces - var temp_args = string_split(cheat_arguments, "\"", 1, 2); - for (var i = 0; i < array_length(temp_args); i++) { - temp_args[i] = string_trim(temp_args[i]); - } - name = temp_args[0]; - if (array_length(temp_args) > 1) { - cheat_arguments = string_split(temp_args[1], " ", 1); - } else { - cheat_arguments = []; - } - } else { - cheat_arguments = string_split(cheat_arguments, " ", 1); - } - } else { - cheat_arguments = []; - } - - // Default values for cheat_arguments - while(array_length(cheat_arguments) < 3) { - array_push(cheat_arguments, "1"); - } - - if (cheat_code!= "") { - switch (cheat_code) { - case "finishforge": - with (obj_controller) { - forge_points = 1000000; - forge_queue_logic(); - } - break; - case "newapoth": - obj_controller.apothecary_training_points = 50; - break; - case "newpsyk": - obj_controller.psyker_points = 70; - break; - case "newtech": - obj_controller.tech_points = 400; - break; - case "newchap": - obj_controller.chaplain_points = 50; - break; - case "additem": - var quantity = (array_length(cheat_arguments) > 0) ? real(cheat_arguments[0]) : 1; - var quality = (array_length(cheat_arguments) > 1) ? string_lower(cheat_arguments[1]) : "normal"; - scr_add_item(name, quantity, quality); - break; - case "artifact": - if (cheat_arguments[0] == "1") { - scr_add_artifact("random", "", 6, obj_ini.ship[0], 501); - } else { - repeat(real(cheat_arguments[1])){ - scr_add_artifact(cheat_arguments[0], "", 6, obj_ini.ship[0], 501); - } - } - break; - case "sisterhospitaler": - repeat(real(cheat_arguments[0])){ - scr_add_man("Sister Hospitaler", 0, "", "", 0, true, "default"); - } - break; - case "sisterofbattle": - repeat(real(cheat_arguments[0])){ - scr_add_man("Sister of Battle", 0, "", "", 0, true, "default"); - } - break; - case "skitarii": - repeat(real(cheat_arguments[0])){ - scr_add_man("Skitarii", 0, "", "", 0, true, "default"); - } - break; - case "techpriest": - repeat(real(cheat_arguments[0])){ - scr_add_man("Techpriest", 0, "", "", 0, true, "default"); - } - break; - case "crusader": - repeat(real(cheat_arguments[0])){ - scr_add_man("Crusader", 0, "", "", 0, true, "default"); - } - break; - case "flashgit": - repeat(real(cheat_arguments[0])){ - scr_add_man("Flash Git", 0, "", "", 0, true, "default"); - } - break; - case "chaosfleetspawn": - spawn_chaos_warlord(); - break; - case "waaagh": - - init_ork_waagh(true); - break; - case "neworkfleet": - var p_fleet = get_largest_player_fleet(); - with (instance_nearest(p_fleet.x, p_fleet.y, obj_star)) { - new_ork_fleet(x, y); - } - break; - case "inquisarti": - scr_quest(0, "artifact_loan", 4, 10); - var last_artifact = scr_add_artifact("good", "inquisition", 0, obj_ini.ship[0], 501); - break; - case "govmission": - var problem = ""; - if (array_length(cheat_arguments)){ - if (cheat_arguments[0] != "1"){ - problem = cheat_arguments[0] - } - } - with (obj_star) { - for (var i = 1; i <= planets; i++) { - var existing_problem = false; //has_any_problem_planet(i); - if (!existing_problem) { - if (p_owner[i] == eFACTION.Imperium) { - show_debug_message("mission"); - scr_new_governor_mission(i, problem); - } - } - } - } - break; - - case "mechmission": - show_debug_message("mech_mission"); - - if (array_length(cheat_arguments)){ - spawn_mechanicus_mission(cheat_arguments[0]); - } else { - spawn_mechanicus_mission(); - } - break; - - case "inquismission": - var mission = cheat_arguments[0]; - show_debug_message($"{mission},"); - switch (mission){ - case "1": //default - scr_inquisition_mission(eEVENT.inquisition_mission); - break; - case "planet": - scr_inquisition_mission(eEVENT.inquisition_planet); - break; - case "spyrer": - scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.spyrer); - break; - case "artifact": - scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.artifact); - break; - case "inquisitor": - scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.inquisitor); - break; - case "purge": - scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.purge); - break; - case "tomb_world": - scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.tomb_world); - break; - case "tyranid_organism": - scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.tyranid_organism); - break; - case "demon": - scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.demon_world); - break; - default: - scr_inquisition_mission(eEVENT.inquisition_mission); - break; - } - show_debug_message("inquisitor mission initiated"); - obj_controller.location_viewer.update_mission_log(); - break; - case "artifactpopulate": - with (obj_star) { - for (var i = 1; i <= planets; i++) { - array_push(p_feature[i], new NewPlanetFeature(P_features.Artifact)); - } - } - break; - case "ruinspopulate": - with (obj_star) { - for (var i = 1; i <= planets; i++) { - array_push(p_feature[i], new NewPlanetFeature(P_features.Ancient_Ruins)); - } - } - break; - case "stcpopulate": - with (obj_star) { - for (var i = 1; i <= planets; i++) { - array_push(p_feature[i], new NewPlanetFeature(P_features.STC_Fragment)); - } - } - break; - case "event": - if (cheat_arguments[0] == "crusade") { - show_debug_message("crusading"); - with (obj_controller) { - launch_crusade(); - } - } else if (cheat_arguments[0] == "tomb") { - show_debug_message("necron_tomb_awaken"); - with (obj_controller) { - awaken_tomb_event(); - } - } else if (cheat_arguments[0] == "techuprising") { - tech_uprising_event(); - } else if (cheat_arguments[0] == "inspection") { - new_inquisitor_inspection(); - } else if (cheat_arguments[0] == "slaughtersong") { - create_starship_event(); - } else if (cheat_arguments[0] == "fallen"){ - event_fallen(); - }else if (cheat_arguments[0] == "surfremove"){ - var _star_id = scr_random_find(0,true,"",""); - add_event({ - duration : 2, - e_id : "governor_assassination", - variant : 2, - system : _star_id.name, - planet : irandom_range(1, _star_id.planets), - }); - } else if (cheat_arguments[0] == "strangebuild"){ - show_debug_message("strange build"); - strange_build_event(); - }else if (cheat_arguments[0] == "factionenemy"){ - make_faction_enemy_event(); - }else if (cheat_arguments[0] == "stopall"){ - obj_controller.last_event = 1000000; - show_debug_message($"last event : {obj_controller.last_event}") - }else if (cheat_arguments[0] == "startevents"){ - obj_controller.last_event = 0; - show_debug_message($"last event : {obj_controller.last_event}") - }else { - with (obj_controller) { - scr_random_event(false); - } - } - break; - case "infreq": - if (global.cheat_req == 0) { - global.cheat_req = 1; - cheatyface = 1; - obj_controller.tempRequisition = obj_controller.requisition; - obj_controller.requisition = 51234; - } else { - global.cheat_req = 0; - cheatyface = 1; - obj_controller.requisition = obj_controller.tempRequisition; - } - break; - case "infseed": - if (global.cheat_gene == 0) { - global.cheat_gene = 1; - cheatyface = 1; - obj_controller.tempGene_seed = obj_controller.gene_seed; - obj_controller.gene_seed = 9999; - } else { - global.cheat_gene = 0; - cheatyface = 1; - obj_controller.gene_seed = obj_controller.tempGene_seed; - } - break; - case "debug": - if (global.cheat_debug == 0) { - global.cheat_debug = 1; - cheatyface = 1; - } else { - global.cheat_debug = 0; - cheatyface = 1; - } - break; - case "test": - cheatyface = 1; - diplomacy = 10.5; - scr_dialogue("test"); - break; - case "req": - if (global.cheat_req == 0) { - cheatyface = 1; - obj_controller.requisition = real(cheat_arguments[0]); - } - break; - case "seed": - if (global.cheat_gene == 0) { - cheatyface = 1; - obj_controller.gene_seed = real(cheat_arguments[0]); - } - break; - case "depimp": - obj_controller.disposition[2] = real(cheat_arguments[0]); - break; - case "depmec": - obj_controller.disposition[3] = real(cheat_arguments[0]); - break; - case "depinq": - obj_controller.disposition[4] = real(cheat_arguments[0]); - break; - case "depecc": - obj_controller.disposition[5] = real(cheat_arguments[0]); - break; - case "depeld": - obj_controller.disposition[6] = real(cheat_arguments[0]); - break; - case "depork": - obj_controller.disposition[7] = real(cheat_arguments[0]); - break; - case "deptau": - obj_controller.disposition[8] = real(cheat_arguments[0]); - break; - case "deptyr": - obj_controller.disposition[9] = real(cheat_arguments[0]); - break; - case "depcha": - obj_controller.disposition[10] = real(cheat_arguments[0]); - break; - case "depall": - global.cheat_disp = 1; - cheatyface = 1; - for (var i = 2; i <= 10; i++) { - obj_controller.disposition[i] = real(cheat_arguments[0]); - } - break; - case "stc": - repeat(cheat_arguments[0]){ - scr_add_stc_fragment(); - } - break; - case "recruit": - var _start_pos = 0 - var length = (array_length(obj_controller.recruit_name) - 1) - var i = 0; - while (i < length) { - if (obj_controller.recruit_name[i] == "") { - _start_pos = i - break - } else { - i++ - continue - } - } - for (i = _start_pos; i < (real(cheat_arguments[0]) + _start_pos); i++) { - array_insert(obj_controller.recruit_corruption, i, 0); - array_insert(obj_controller.recruit_distance, i, 0); - array_insert(obj_controller.recruit_training, i, 1); - array_insert(obj_controller.recruit_exp, i, 20); - array_insert(obj_controller.recruit_data, i, {}); - array_insert(obj_controller.recruit_name, i, global.name_generator.generate_space_marine_name()); - scr_alert("green", "recruitment", (string(obj_controller.recruit_name[i]) + "has started training."), 0, 0) - } - break; - case "shiplostevent": - loose_ship_to_warp_event(); - break; - case "recoverlostship": - return_lost_ship(); - break; - case "gloriana": - var _fleet = get_nearest_player_fleet(0,0); - add_ship_to_fleet(new_player_ship("Gloriana"),_fleet); - break; - case "zoom": - set_zoom_to_default(); - break; - case "orkinvasion": - out_of_system_warboss(); - break; - case "forgemastermeet": - var _forge_master = scr_role_count("Forge Master", "", "units"); - if (array_length(_forge_master)>0){ - show_debug_message("meet forge master"); - obj_controller.menu_lock = false; - instance_destroy(obj_popup_dialogue); - scr_toggle_diplomacy(); - obj_controller.diplomacy = -1; - obj_controller.character_diplomacy = _forge_master[0]; - diplo_txt="Greetings chapter master"; - } else { - show_debug_message("no forge master"); - } - break; - } - } - } catch(_exception) { - show_debug_message(_exception.longMessage); - } -} + try { + if (argument0 == "") { + return; + } + var input_string; + var cheat_code; + var cheat_arguments; + var name; + + input_string = string_split(argument0, " ", 0, 1); + cheat_code = string_lower(input_string[0]); + + if (array_length(input_string) > 1) { + cheat_arguments = input_string[1]; + // Handle quotes and spaces for arguments + if (string_count("\"", cheat_arguments) > 0) { + // Split by quotes and trim spaces + var temp_args = string_split(cheat_arguments, "\"", 1, 2); + for (var i = 0; i < array_length(temp_args); i++) { + temp_args[i] = string_trim(temp_args[i]); + } + name = temp_args[0]; + if (array_length(temp_args) > 1) { + cheat_arguments = string_split(temp_args[1], " ", 1); + } else { + cheat_arguments = []; + } + } else { + cheat_arguments = string_split(cheat_arguments, " ", 1); + } + } else { + cheat_arguments = []; + } + // Default values for cheat_arguments + while (array_length(cheat_arguments) < 3) { + array_push(cheat_arguments, "1"); + } + + if (cheat_code != "") { + switch (cheat_code) { + case "finishforge": + with (obj_controller) { + forge_points = 1000000; + forge_queue_logic(); + } + break; + case "newapoth": + obj_controller.apothecary_training_points = 50; + break; + case "newpsyk": + obj_controller.psyker_points = 70; + break; + case "newtech": + obj_controller.tech_points = 400; + break; + case "newchap": + obj_controller.chaplain_points = 50; + break; + case "additem": + var quantity = (array_length(cheat_arguments) > 0) ? real(cheat_arguments[0]) : 1; + var quality = (array_length(cheat_arguments) > 1) ? string_lower(cheat_arguments[1]) : "normal"; + scr_add_item(name, quantity, quality); + break; + case "artifact": + if (cheat_arguments[0] == "1") { + scr_add_artifact("random", "", 6, obj_ini.ship[0], 501); + } else { + repeat (real(cheat_arguments[1])) { + scr_add_artifact(cheat_arguments[0], "", 6, obj_ini.ship[0], 501); + } + } + break; + case "sisterhospitaler": + repeat (real(cheat_arguments[0])) { + scr_add_man("Sister Hospitaler", 0, "", "", 0, true, "default"); + } + break; + case "sisterofbattle": + repeat (real(cheat_arguments[0])) { + scr_add_man("Sister of Battle", 0, "", "", 0, true, "default"); + } + break; + case "skitarii": + repeat (real(cheat_arguments[0])) { + scr_add_man("Skitarii", 0, "", "", 0, true, "default"); + } + break; + case "techpriest": + repeat (real(cheat_arguments[0])) { + scr_add_man("Techpriest", 0, "", "", 0, true, "default"); + } + break; + case "crusader": + repeat (real(cheat_arguments[0])) { + scr_add_man("Crusader", 0, "", "", 0, true, "default"); + } + break; + case "flashgit": + repeat (real(cheat_arguments[0])) { + scr_add_man("Flash Git", 0, "", "", 0, true, "default"); + } + break; + case "chaosfleetspawn": + spawn_chaos_warlord(); + break; + case "waaagh": + init_ork_waagh(true); + break; + case "neworkfleet": + var p_fleet = get_largest_player_fleet(); + with (instance_nearest(p_fleet.x, p_fleet.y, obj_star)) { + new_ork_fleet(x, y); + } + break; + case "inquisarti": + scr_quest(0, "artifact_loan", 4, 10); + var last_artifact = scr_add_artifact("good", "inquisition", 0, obj_ini.ship[0], 501); + break; + case "govmission": + var problem = ""; + if (array_length(cheat_arguments)) { + if (cheat_arguments[0] != "1") { + problem = cheat_arguments[0]; + } + } + with (obj_star) { + for (var i = 1; i <= planets; i++) { + var existing_problem = false; //has_any_problem_planet(i); + if (!existing_problem) { + if (p_owner[i] == eFACTION.Imperium) { + show_debug_message("mission"); + scr_new_governor_mission(i, problem); + } + } + } + } + break; + + case "mechmission": + show_debug_message("mech_mission"); + + if (array_length(cheat_arguments)) { + spawn_mechanicus_mission(cheat_arguments[0]); + } else { + spawn_mechanicus_mission(); + } + break; + + case "inquismission": + var mission = cheat_arguments[0]; + show_debug_message($"{mission},"); + switch (mission) { + case "1": //default + scr_inquisition_mission(eEVENT.inquisition_mission); + break; + case "planet": + scr_inquisition_mission(eEVENT.inquisition_planet); + break; + case "spyrer": + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.spyrer); + break; + case "artifact": + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.artifact); + break; + case "inquisitor": + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.inquisitor); + break; + case "purge": + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.purge); + break; + case "tomb_world": + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.tomb_world); + break; + case "tyranid_organism": + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.tyranid_organism); + break; + case "demon": + scr_inquisition_mission(eEVENT.inquisition_mission, eINQUISITION_MISSION.demon_world); + break; + default: + scr_inquisition_mission(eEVENT.inquisition_mission); + break; + } + show_debug_message("inquisitor mission initiated"); + obj_controller.location_viewer.update_mission_log(); + break; + case "artifactpopulate": + with (obj_star) { + for (var i = 1; i <= planets; i++) { + array_push(p_feature[i], new NewPlanetFeature(P_features.Artifact)); + } + } + break; + case "ruinspopulate": + with (obj_star) { + for (var i = 1; i <= planets; i++) { + array_push(p_feature[i], new NewPlanetFeature(P_features.Ancient_Ruins)); + } + } + break; + case "stcpopulate": + with (obj_star) { + for (var i = 1; i <= planets; i++) { + array_push(p_feature[i], new NewPlanetFeature(P_features.STC_Fragment)); + } + } + break; + case "event": + if (cheat_arguments[0] == "crusade") { + show_debug_message("crusading"); + with (obj_controller) { + launch_crusade(); + } + } else if (cheat_arguments[0] == "tomb") { + show_debug_message("necron_tomb_awaken"); + with (obj_controller) { + awaken_tomb_event(); + } + } else if (cheat_arguments[0] == "techuprising") { + tech_uprising_event(); + } else if (cheat_arguments[0] == "inspection") { + new_inquisitor_inspection(); + } else if (cheat_arguments[0] == "slaughtersong") { + create_starship_event(); + } else if (cheat_arguments[0] == "fallen") { + event_fallen(); + } else if (cheat_arguments[0] == "surfremove") { + var _star_id = scr_random_find(0, true, "", ""); + add_event({ + duration: 2, + e_id: "governor_assassination", + variant: 2, + system: _star_id.name, + planet: irandom_range(1, _star_id.planets), + }); + } else if (cheat_arguments[0] == "strangebuild") { + show_debug_message("strange build"); + strange_build_event(); + } else if (cheat_arguments[0] == "factionenemy") { + make_faction_enemy_event(); + } else if (cheat_arguments[0] == "stopall") { + obj_controller.last_event = 1000000; + show_debug_message($"last event : {obj_controller.last_event}"); + } else if (cheat_arguments[0] == "startevents") { + obj_controller.last_event = 0; + show_debug_message($"last event : {obj_controller.last_event}"); + } else { + with (obj_controller) { + scr_random_event(false); + } + } + break; + case "infreq": + if (global.cheat_req == 0) { + global.cheat_req = 1; + cheatyface = 1; + obj_controller.tempRequisition = obj_controller.requisition; + obj_controller.requisition = 51234; + } else { + global.cheat_req = 0; + cheatyface = 1; + obj_controller.requisition = obj_controller.tempRequisition; + } + break; + case "infseed": + if (global.cheat_gene == 0) { + global.cheat_gene = 1; + cheatyface = 1; + obj_controller.tempGene_seed = obj_controller.gene_seed; + obj_controller.gene_seed = 9999; + } else { + global.cheat_gene = 0; + cheatyface = 1; + obj_controller.gene_seed = obj_controller.tempGene_seed; + } + break; + case "debug": + if (global.cheat_debug == 0) { + global.cheat_debug = 1; + cheatyface = 1; + } else { + global.cheat_debug = 0; + cheatyface = 1; + } + break; + case "test": + cheatyface = 1; + diplomacy = 10.5; + scr_dialogue("test"); + break; + case "req": + if (global.cheat_req == 0) { + cheatyface = 1; + obj_controller.requisition = real(cheat_arguments[0]); + } + break; + case "seed": + if (global.cheat_gene == 0) { + cheatyface = 1; + obj_controller.gene_seed = real(cheat_arguments[0]); + } + break; + case "depimp": + obj_controller.disposition[2] = real(cheat_arguments[0]); + break; + case "depmec": + obj_controller.disposition[3] = real(cheat_arguments[0]); + break; + case "depinq": + obj_controller.disposition[4] = real(cheat_arguments[0]); + break; + case "depecc": + obj_controller.disposition[5] = real(cheat_arguments[0]); + break; + case "depeld": + obj_controller.disposition[6] = real(cheat_arguments[0]); + break; + case "depork": + obj_controller.disposition[7] = real(cheat_arguments[0]); + break; + case "deptau": + obj_controller.disposition[8] = real(cheat_arguments[0]); + break; + case "deptyr": + obj_controller.disposition[9] = real(cheat_arguments[0]); + break; + case "depcha": + obj_controller.disposition[10] = real(cheat_arguments[0]); + break; + case "depall": + global.cheat_disp = 1; + cheatyface = 1; + for (var i = 2; i <= 10; i++) { + obj_controller.disposition[i] = real(cheat_arguments[0]); + } + break; + case "stc": + repeat (cheat_arguments[0]) { + scr_add_stc_fragment(); + } + break; + case "recruit": + var _start_pos = 0; + var length = array_length(obj_controller.recruit_name) - 1; + var i = 0; + while (i < length) { + if (obj_controller.recruit_name[i] == "") { + _start_pos = i; + break; + } else { + i++; + continue; + } + } + for (i = _start_pos; i < (real(cheat_arguments[0]) + _start_pos); i++) { + array_insert(obj_controller.recruit_corruption, i, 0); + array_insert(obj_controller.recruit_distance, i, 0); + array_insert(obj_controller.recruit_training, i, 1); + array_insert(obj_controller.recruit_exp, i, 20); + array_insert(obj_controller.recruit_data, i, {}); + array_insert(obj_controller.recruit_name, i, global.name_generator.generate_space_marine_name()); + scr_alert("green", "recruitment", (string(obj_controller.recruit_name[i]) + "has started training."), 0, 0); + } + break; + case "shiplostevent": + loose_ship_to_warp_event(); + break; + case "recoverlostship": + return_lost_ship(); + break; + case "gloriana": + var _fleet = get_nearest_player_fleet(0, 0); + add_ship_to_fleet(new_player_ship("Gloriana"), _fleet); + break; + case "zoom": + set_zoom_to_default(); + break; + case "orkinvasion": + out_of_system_warboss(); + break; + case "forgemastermeet": + var _forge_master = scr_role_count("Forge Master", "", "units"); + if (array_length(_forge_master) > 0) { + show_debug_message("meet forge master"); + obj_controller.menu_lock = false; + instance_destroy(obj_popup_dialogue); + scr_toggle_diplomacy(); + obj_controller.diplomacy = -1; + obj_controller.character_diplomacy = _forge_master[0]; + diplo_txt = "Greetings chapter master"; + } else { + show_debug_message("no forge master"); + } + break; + } + } + } catch (_exception) { + show_debug_message(_exception.longMessage); + } +} /// @mixin obj_Star_Select -function draw_planet_debug_options(){ - try{ - add_draw_return_values(); - draw_set_halign(fa_left); - draw_set_color(c_white); - draw_set_alpha(1); - if (debug) { - debug_slate.inside_method = function(){ - debug_options.draw() - if (debug_options.current_selection == 0){ - draw_planet_debug_forces(); - } else if (debug_options.current_selection == 1){ - draw_planet_debug_problems(); - } else if (debug_options.current_selection == 2){ - draw_planet_debug_features(); - } - } - debug_slate.draw() - } - if (debug_button.draw()){ - debug = !debug; - //scroll_problems = new ScrollableContainer() +function draw_planet_debug_options() { + try { + add_draw_return_values(); + draw_set_halign(fa_left); + draw_set_color(c_white); + draw_set_alpha(1); + if (debug) { + debug_slate.inside_method = function() { + debug_options.draw(); + if (debug_options.current_selection == 0) { + draw_planet_debug_forces(); + } else if (debug_options.current_selection == 1) { + draw_planet_debug_problems(); + } else if (debug_options.current_selection == 2) { + draw_planet_debug_features(); + } + }; + debug_slate.draw(); + } + if (debug_button.draw()) { + debug = !debug; + //scroll_problems = new ScrollableContainer() + } + pop_draw_return_values(); + } catch (_exception) { + handle_exception(_exception); } - pop_draw_return_values(); - }catch(_exception){ - handle_exception(_exception); - } } -function draw_planet_debug_features(){ - static _addable_features = [ - { - e_num : P_features.Gene_Stealer_Cult, - name : "GeneStealer Cult" - }, - { - e_num : P_features.Ancient_Ruins, - name : "Ancient Ruins" - }, - { - e_num : P_features.Artifact, - name : "Artefact" - }, - { - e_num : P_features.STC_Fragment, - name : "STC Fragment" - }, - { - e_num : P_features.Sororitas_Cathedral, - name : "Sororitas Cathedral" - }, - { - e_num : P_features.OrkWarboss, - name : "Ork Warboss" - }, - { - e_num : P_features.OrkStronghold, - name : "Ork stronghold" - }, - { - e_num : P_features.Monastery, - name : "Fortress Monastery" - }, - { - e_num : P_features.Starship, - name : "Ancient Starship" - }, - - ] - - var base_y = 220; - base_y += 2; - - - for (var i=0;i1) and (diplomacy==4) then sorc=true; - } - if (diplo_keyphrase=="declare_war") and (string_count("|SC|",obj_controller.useful_info)>1) and (diplomacy==4) then sorc=true; - - if (diplo_keyphrase=="intro") or (diplo_keyphrase=="intro1") or ((diplomacy==10) and (diplo_keyphrase=="intro2")){ - event_log=$"Chapter Master {obj_ini.master_name} meets the {obj_controller.faction[diplomacy]} {obj_controller.faction_title[diplomacy]}, {obj_controller.faction_leader[diplomacy]}."; - scr_event_log("",event_log); - } - - var dip_score=diplomacy; - // repeat(3){ - // i+=1; - rela="neutral"; - if (diplomacy>0){ - rela=relationship_hostility_matrix(diplomacy); - // */ - } - // if (i<=5) and (fleet_type=3) and (rela="hostile") then rela="neutral"; - // } - - // ** Chaos Meetings ** - if (diplo_keyphrase=="cs_meeting1"){ - diplomacy=10; - diplo_text=$"So you have brought yourself before me {obj_ini.master_name}. This pleases me. You are not the first among the Astartes to come to me. Do not look so shocked. Many have gazed upon the decay and decrepitude of the Imperium with open eyes, and heard the empty slogans of the Corpse Emperor with fresh ears and come to the realization I had so many long millennia ago. There is only one truth in the universe, one path worthy of an Astartes to walk. The path of true power. The path of true insight into the nature of reality and what lies beyond. The path of Chaos. Only when free of the pointless bondage of the Imperium can we ascend to our rightful place in the universe."; - add_diplomacy_option({option_text:"[Continue]", goto : "cs_meeting2"}); - disposition[10]+=10; - } - // First branch of choices - if (diplo_keyphrase=="cs_meeting2") or (diplo_keyphrase=="cs_meeting20"){ - diplomacy=10; - // check for MoS here - var mos=false,ii=0; - repeat(obj_temp_meeting.dudes){ - ii+=1; - if (mos=false){ - if (obj_ini.role[obj_temp_meeting.co[ii],obj_temp_meeting.ide[ii]]="Master of Sanctity"){ - mos=true; - } - } - } - - if (diplo_keyphrase=="cs_meeting2") then disposition[10]+=10; - - // Meeting2 - diplo_text="But still I am puzzled by you /noble/ Astartes. You come before me and put yourself at my mercy. I could extinguish your life in an instant, crush you beneath my boot heel faster than the lowliest insect. These are not the actions of a Space Marine. Long have you fought for Him. So tell me then Astartes, why do you come to me now?"; - - // Meeting20 - if (diplo_keyphrase=="cs_meeting20"){ - diplo_text="[[A low rumbling growl issues from "+string(obj_controller.faction_leader[eFACTION.Chaos])+"’s power armour before he speaks.]]\nI ask you for the last time Astartes. Why did you seek me out?"; - } - - if (mos==true) and (diplo_keyphrase!="cs_meeting20"){ - add_diplomacy_option({option_text:"[Continue]", goto : "cs_meeting_m1"}); - } - - if (mos==false) or (diplo_keyphrase=="cs_meeting20"){ - add_diplomacy_option( - { - option_text:"The Imperium has bound us and kept us from our true potential. We seek strength.", - goto : "cs_meeting30", - } - ); - - // if over 30 Not convinced due to high inquisition dispositioin - var _goto = obj_controller.disposition[4]>30 ? "cs_meeting45" : "cs_meeting40"; - add_diplomacy_option({option_text:"The Imperium and Inquisition's ignorance and hypocrisy will be the death of my Chapter.", goto: _goto}); - - var testy=true; - if (obj_controller.faction_status[eFACTION.Imperium]="War" || obj_controller.marines<=600) then testy=false; - if (testy=false) then _goto="cs_meeting50";// Scurrying like a rat, accepts - if (testy=true) then _goto="cs_meeting55";// Not convinced - - add_diplomacy_option({option_text:"Our enemies are many and our strength is diminished. We need allies to join with us while we rebuild our forces.", goto : _goto}); - - add_diplomacy_option({option_text:"I sought you out to slay you with my own hands.", goto: "cs_meeting60"}); - - } - } - if (diplo_keyphrase=="cs_meeting21"){ - event_log=string(obj_ini.master_name)+$" kills the {global.chapter_name} Master of Sanctity for "+string(obj_controller.faction_leader[eFACTION.Chaos])+"."; - scr_event_log("purple",event_log); - // scr_alert("purple","lol",string(tix),0,0); - - diplo_text=$"As the echoes fade, it becomes clear that the Master of Sanctity of {global.chapter_name} has fallen."; - add_diplomacy_option({option_text:"[Continue]", goto : "cs_meeting135"}); - } - // MoS cuts in - if (diplo_keyphrase=="cs_meeting_m1"){ - diplomacy=-5.2; - diplo_text=$"[[{obj_ini.name[0,3]} hisses your name over a private vox channel.]]\n"; - diplo_text+="My lord! What are we doing here, treating with this monster of the Traitor Legions? The very existence of the Archenemy is a threat to everything the Chapter stands for, and we endanger our immortal souls just being here. You know this! I demand to know your intentions! And I warn you, I will not hesitate to do what I must, for the good of the Chapter and the Imperium."; - - var _goto = "cs_meeting_m2"; - add_diplomacy_option({option_text:"Times change and the Chapter must change with them or be ground into the dust of history. (Chaos)", goto: _goto}); - add_diplomacy_option({option_text:"We will not serve the Imperium’s crooked ends any longer. Our Chapter will control its own destiny. (Renegade)", goto: _goto}); - add_diplomacy_option({option_text:"I haven’t turned traitor and my faith is strong. The Beast has foolishly opened its lair to us. Be ready for my signal.", goto: _goto}); - - - // Option4 here if all the right conditions are met - var born=false; - for(var ii=1; i<=200; i++){ - if (obj_ini.role[0,ii]==obj_ini.role[100][eROLE.ChapterMaster]) and (string_count("$",obj_ini.spe[0,ii])>0){ - born=true; - } - } - - if (obj_ini.TTRPG[0][3].corruption>=50) and (born=true){ - add_diplomacy_option({option_text:"Right now I need my Master of Sanctity at my side, trusting that his Chapter Master is doing what is best, what is necessary for the Chapter, during this dangerous moment. All will be made clear in time, I promise you brother. This is the right path.", goto:"cs_meeting_m3"}); - } - } - if (diplo_keyphrase=="cs_meeting_m2"){ - event_log=$"The {global.chapter_name} Master of Sanctity takes a stand against you."; - scr_event_log("purple",event_log);// scr_alert("purple","lol",string(tix),0,0); - diplo_text="You have besmirched the honor of our chapter this day, and I will not forget it /my lord Chapter Master/.\n[["+string(obj_ini.name[0,3])+" strides forward and his shout erupts from his external vox speakers with a boom that shatters the silence in the room.]]\nWe will not stand idly by and bandy words with heretic scum! To me my brothers! Slay these traitors in the name of our Emperor!"; - add_diplomacy_option({option_text:"[Continue]", goto: "cs_meeting9"}); - } - if (diplo_keyphrase=="cs_meeting_m3"){ - diplo_text="[["+string(obj_ini.name[0,3])+" is silent for a moment, before giving you an imperceptible nod.]]\nI stand with you, Lord "+string(obj_ini.master_name)+". Let us face this together."; - add_diplomacy_option({option_text:"[Continue]", goto :"cs_meeting20" }); - obj_controller.useful_info+="CRMOS|"; - } - if (diplo_keyphrase=="cs_meeting_m5"){ - diplomacy=-5.2; - instance_activate_all(); - diplo_text="By the sacred oath I have sworn, I bear witness to your darkest secrets. Know this: I am compelled to report your heresy to the Inquisition. Redemption or retribution, their verdict shall decide. May the Emperor's mercy guide your path."; - - add_diplomacy_option({option_text:"Very well. I did what must be done for my brothers, and now accept the price. [Game Over]", goto :"cs_meeting_m6" }); - add_diplomacy_option({option_text: $"Never! [Battle Loyalist {global.chapter_name}]", goto :"cs_meeting_battle7" }); - } - if (diplo_keyphrase=="cs_meeting_m6"){ - global.defeat=3; - obj_controller.alarm[7]=5; - } - if (diplo_keyphrase=="cs_meeting9"){ - diplomacy=10; - - diplo_text=$"[[{obj_controller.faction_leader[eFACTION.Chaos]} turns to you, his voice even and calm]]\n\nHere is the first step you must take, to prove you’ve truly left the Imperium behind. Kill him. Kill your loyal brothers.\n[[His Chaos Terminators raise their weapons as one and point them at you. Somewhere behind them a daemon cackles.]]\nChoose now or be obliterated."; - - var _master_of_sanct = fetch_unit([0,3]); - - var _string = $"Stand with me my brothers! Fight for the future of your Chapter, and slay {_master_of_sanct.name()}! [Battle loyalist {global.chapter_name}" - add_diplomacy_option({option_text:_string, goto : "cs_meeting_battle1", goto:"cs_meeting_battle1"});; - - var _string = $"{global.chapter_name}, I order you to hold your fire! {_master_of_sanct.name()}, if you doubt my leadership then let it be decided by single combat! [Duel your Master of Sanctity]" - add_diplomacy_option({option_text: _string, goto : "cs_meeting_battle2"}); - - var _string = $"I deny you {obj_controller.faction_leader[eFACTION.Chaos]}. And now I shall destroy you. For the Emperor! [Attack Chaos forces]"; - add_diplomacy_option({option_text:_string, goto :"cs_meeting_battle5" }); - } - - // First explanation for chaos - if (diplo_keyphrase=="cs_meeting30"){ - diplo_text="Then you have awakened to the truth the Imperium so hypocritically denies, that there is only one real power in the universe, and it goes to those with the will to seize it."; - add_diplomacy_option({option_text:"[Continue]", goto : "cs_meeting135"}); - disposition[10]+=30; - } - // Fucking inquisition - if (diplo_keyphrase=="cs_meeting40"){ - diplo_text="Yes...you do not fit the precious mold the Codex Astartes carves out for you, do you? And the Imperium destroys that which it cannot understand."; - add_diplomacy_option({option_text:"[Continue]",goto : "cs_meeting135"}); - disposition[10]+=30; - } - // Nah dawg - if (diplo_keyphrase=="cs_meeting45"){ - diplo_text=$"Do you take me as a fool, {obj_ini.master_name}? Even in the Eye there are whispers of your running to and fro at the Inquisition’s beck and call, like a dog playing fetch. You’re a well-trained, and maybe even a clever, dog. I’ve killed so many clever dogs in my time. How do I know this isn’t just a hopelessly doomed plot to try and kill me, hatched by your Inquisition masters still holding your leash?"; - - add_diplomacy_option({ - option_text:"There are advantages to staying on the Inquisition’s good side, and I’m not one to ignore an advantage.", - goto : choose("cs_meeting46","cs_meeting47"), - }); - add_diplomacy_option({option_text:"Appeasing the Inquisition is no hard choice when your options are obey, or eventually be branded a heretic and be destroyed.",goto : choose("cs_meeting46","cs_meeting47"),}); - add_diplomacy_option({option_text:"Given enough time, everyone becomes a heretic in the eyes of the Inquisition. I will not wait for them to make their move against us.",goto : choose("cs_meeting46","cs_meeting47"),}); - - var _string = "You have one thing right, {obj_controller.faction_leader[eFACTION.Chaos]}. I am here to kill you. Open fire brothers, NOW! [Battle Chaos forces]"; - add_diplomacy_option({option_text:_string, goto:"cs_meeting_battle5", goto:"cs_meeting_battle5"}); - } - // Sorry brah, you're not their homie - if (diplo_keyphrase=="cs_meeting46"){ - diplo_text="I am not convinced. A shame. I was hoping you might actually be of use- but now it is apparent that your use will only be as a bloody, broken offering to the Dark Gods."; - add_diplomacy_option({option_text:"[Battle Chaos AND any loyalist forces]"}); - add_diplomacy_option({option_text:"cs_meeting_battle6"}); - } - // you might be their homie, fine - if (diplo_keyphrase=="cs_meeting47"){ - diplo_text="You may yet be of use to me. Very well, we will assist you. It will be no trouble at all to exterminate you, should you displease me at a future time."; - add_diplomacy_option({option_text:"[Continue]", goto:"cs_meeting135"}); - disposition[10]+=30; - } - // mah numbers - if (diplo_keyphrase=="cs_meeting50"){ - diplo_text="Yes we have seen you struggle alone, scurrying from shadow to shadow like a hunted rat. I won’t lie to you though, I’ve seen the potential in you and your….brothers. Alright, we will assist you. It will be no trouble at all to exterminate you, should you displease me."; - add_diplomacy_option({option_text:"[Continue]", goto : "cs_meeting135"}); - disposition[10]+=30; - } - // such numbers, wow - if (diplo_keyphrase=="cs_meeting55"){ - diplo_text="I could overrun this sector with half the warriors you have now. Is your “Chapter” so pathetic you need to throw scores more men into the meatgrinder to succeed? You have not convinced me. I'd have enjoyed making use of your Chapter, but this was clearly not meant to be. Make your peace."; - add_diplomacy_option({option_text:"[Battle Chaos AND any loyalist forces]"}); - add_diplomacy_option({option_text:"cs_meeting_battle6"}); - } - // Actually here to kill you - if (diplo_keyphrase=="cs_meeting60"){ - var chaos_leader = obj_controller.faction_leader[eFACTION.Chaos]; - disposition[10]+=10; - diplo_text=$"[[{chaos_leader} is silent for a moment, then a slow chuckle rises from deep within his ancient power armour. The chuckle erupts into hideous laughter that chills your blood with its otherworldly tenor.]]\nI thank you, I have not truly laughed in three hundred years. I shall take your skull as a memento of this day and your fine jest. But before I do, indulge my curiosity. Let us say you did kill me, /then/ what would you do? Claim the price on my head? Go crawling back on your belly to your Imperial masters like a whipped cur, dragging your kill behind you? Become master of this sector yourself now that you’ve bested your greatest foe? Or perhaps you’d offer up my soul to the Dark Gods, ignorantly fumbling about in the darkness for their favor? Tell me."; - - add_diplomacy_option({option_text:"The reward for one such as you will be great, and I /will/ claim it.", goto : "cs_meeting61"}); - - add_diplomacy_option({option_text:"The atrocities you’ve visited on this sector are reason enough.",goto : "cs_meeting63"}); - add_diplomacy_option({option_text:$"You think me ignorant of the ways of Chaos, {chaos_leader}, but I know one truth. There is power in blood. Your blood. My power. They will hear me.",goto : "cs_meeting65"}); - add_diplomacy_option({option_text:$"I’m just tired of listening to you talk, {chaos_leader}.",goto : "cs_meeting67"}); - } - // Reward - if (diplo_keyphrase=="cs_meeting61"){ - diplo_text="It is this blind overconfidence that makes killing a Space Marine so satisfying."; - add_diplomacy_option({option_text:"[Battle Chaos forces]", goto : "cs_meeting_battle5"}); - } - // Atrocities - if (diplo_keyphrase=="cs_meeting63"){ - diplo_text="Oh, but I have one more atrocity to commit you simply shouldn’t miss..."; - add_diplomacy_option({option_text:"[Battle Chaos forces]", goto : "cs_meeting_battle5"}); - } - // BLOOD BLOOD BLOOD - if (diplo_keyphrase=="cs_meeting65"){ - diplo_text="You know, I think I would actually enjoy watching you attempt it. But I’ll spare you having your soul torn to shreds by daemons, and just give you an agonizing death instead."; - add_diplomacy_option({option_text:"[Battle Chaos AND any loyalist forces]", goto : "cs_meeting_battle6"}); - } - // stahp talking - if (diplo_keyphrase=="cs_meeting67"){ - disposition[10]+=10; - diplo_text="And I thought we were becoming such fast friends, you and I. Very well, don’t bore me."; - add_diplomacy_option({option_text:"[Battle Chaos forces]", goto : "cs_meeting_battle5"}); - } - - // Finish the conversation - // 135 - // 136 - // 137 - - if (diplo_keyphrase=="cs_meeting135"){ - disposition[10]=max(disposition[10]+10,10); - diplo_text=$"[[{obj_controller.faction_leader[eFACTION.Chaos]}’s power armour grinds as he leans forward, his posture predatory.]]\nThen we have an accord. We will assist you as you take your first steps on the path toward Chaos. And my payment for all this?\n[[He chuckles.]]\nEnlisting an entire chapter in the service of the Dark Gods is all the reward I require."; - diplo_text+="\nBut you cannot simply paint the eight-pointed star on your wargear and begin slaughtering in the name of the Dark Gods. No, some within your chapter will resist the choice you’ve made, either out of loyalty to the Corpse Emperor or out of fear of Chaos. Just think, it will be like your own little heresy. The ''"+string(obj_ini.master_name)+" Heresy!''"; - add_diplomacy_option({option_text:"[Continue]", goto : "cs_meeting136"}); - } - if (diplo_keyphrase=="cs_meeting136"){ - event_log=string(obj_controller.faction_leader[eFACTION.Chaos])+" gives you an Artifact, meant to help corrupt your marines to the path of Chaos."; - scr_event_log("purple",event_log);// scr_alert("purple","lol",string(tix),0,0); - diplo_text="[The tones of his humorless laughter are filled with the bitterness of ancient, poisoned memories. He continues.]\nYou must emerge victorious from this... \\Civil War\\, and not decimate your ranks in the process, if you are to be of any use to the Gods or to me. "; - diplo_text+=$"And to that end, I give you this.\n[[{obj_controller.faction_leader[eFACTION.Chaos]} gestures to one of his Terminators, who presents you with an Artifact. In your mind, something sinister seems to cling to the lines of its form.]]\nThe more of your warriors that come to accept Chaos, the fewer holdouts there will be to overcome when the time comes. This object will speed their introduction to its ways. You must also encourage your warriors to...broaden their horizons wherever possible, so they come to their own understanding of the Primordial Truth. But you must tread carefully at the same time, lest you alert the Inquisition. They must not have even a hint of what’s taking place in your Chapter, or they will obliterate you."; - add_diplomacy_option({option_text:"[Continue]", goto : "cs_meeting137"}); - } - - if (diplo_keyphrase=="cs_meeting137"){ - diplo_text=$"When enough of your warriors have embraced Chaos, assemble them together in one place and then speak with me, and I will show you the beginning of the Eightfold Path. Now, begone.\n[[As you leave he calls out to you one more time.]]\nAnd {obj_ini.master_name}, I expect action within a few years. My patience, unlike Chaos, is not infinite."; - complex_event=true; - current_eventing=""; - force_goodbye=1; - faction_status[eFACTION.Chaos]="Antagonism"; - - with(obj_star){ - remove_star_problem("meeting"); - remove_star_problem("meeting_trap"); - } - - var born=false; - for(var ii=1; ii<200; ii++){ - if (obj_ini.role[0,ii]==obj_ini.role[100][eROLE.ChapterMaster]){ - fetch_unit([0,ii]).corruption+=floor(random_range(30,50)); - } - } - obj_controller.chaos_rating+=1; - - // Casket, Chalice, Tome - if (obj_ini.fleet_type=ePlayerBase.home_world){ - scr_add_artifact("chaos_gift","",0,obj_ini.home_name,2); - } - if (obj_ini.fleet_type != ePlayerBase.home_world){ - scr_add_artifact("chaos_gift","",0,obj_ini.ship[0],501); - } - } - if (string_count("cs_meeting_battle",diplo_keyphrase)>0){ - var current_eventing=diplo_keyphrase;combating=1; - cooldown=30; - diplomacy=0; - menu=0; - instance_activate_all(); - - with(obj_ground_mission){instance_destroy();} - var _found = false; - var _star, _planet; - with(obj_star){ - if (has_problem_star("meeting")>0 && has_problem_star("meeting")>0){ - _found = true; - _star = id; - _planet = has_problem_star("meeting") > 0 ? has_problem_star("meeting"): has_problem_star("meeting_trap"); - break; - } - } - if (!_found){ - var _master = fetch_unit([0,0]); - if (_master.planet_location > 0){ - var _master_star = star_by_name(_master.location_string); - if (_master_star != "none"){ - _found = true; - _planet = _master.planet_location; - _star = _master_star; - } - } - } - // show_message(string(instance_number(obj_ground_mission))); - - if (_found){ - instance_create(0,0,obj_ncombat); - with (obj_ncombat){ - battle_special=current_eventing; - battle_object = _star; - battle_loc = _star.name; - battle_id = _planet; - } - obj_ncombat.dropping=0; - obj_ncombat.attacking=1; - obj_ncombat.local_forces=0; - - if (diplo_keyphrase=="cs_meeting_battle1"){ - obj_ncombat.enemy=1; - obj_ncombat.threat=2; - } - if (diplo_keyphrase=="cs_meeting_battle2"){ - obj_ncombat.enemy=1; - obj_ncombat.threat=1; - } - if (diplo_keyphrase=="cs_meeting_battle5"){ - obj_ncombat.enemy=10; - obj_ncombat.threat=3; - } - if (diplo_keyphrase=="cs_meeting_battle6"){ - obj_ncombat.enemy=10; - obj_ncombat.threat=3; - } - if (diplo_keyphrase=="cs_meeting_battle7"){ - obj_ncombat.enemy=1; - obj_ncombat.threat=2; - } - - if (obj_ncombat.enemy=10) and (obj_controller.faction_defeated[10]=0){ - obj_ncombat.leader=1; - - with(obj_star){ - remove_star_problem("meeting"); - remove_star_problem("meeting_trap"); - } - } - - for(var v=1; v=1){ - rando=choose(1,2,3,4); - if (rando==1) then diplo_text="Yes, "+string(obj_ini.master_name)+"?"; - if (rando==2) then diplo_text="You require something, "+string(obj_ini.master_name)+"?"; - if (rando==3) then diplo_text="What is it?"; - if (rando==4) then diplo_text="What do you want?"; - - if (obj_controller.chaos_rating>=1){ - add_diplomacy_option({option_text:"My Chapter is prepared to join Chaos. [Begin]", goto : "civilwar_begin"}); - add_diplomacy_option({option_text:"I require more time to corrupt my brethren.", goto : "civilwar_soon"}); - } - } - if (disposition[10]>-80) and (chaos_rating==0){ - rando=choose(1,2,2,3,3,3,4,4,4,4,5,5,5); - if (rando==1) then diplo_text="Ahhhh. You require something, "+string(obj_ini.master_name)+"?"; - if (rando==2) then diplo_text="You risk much with this audience. I hope I can make it worth your while."; - if (rando==3) then diplo_text="Now this is an unlikely meeting. What can I do for you, "+string(obj_ini.master_name)+"?"; - if (rando==4) then diplo_text="Have you finally seen the light, at long last?"; - if (rando==5) then diplo_text="There are few reasons a Chapter Master might wish an audience, and they are all worthwhile. What can I and my forces do for you?"; - } - if (disposition[10]<=-80){ - force_goodbye=1; - rando=choose(1,2,2,3,3); - turns_ignored[10]+=choose(3,4,5); - if (rando==1) then diplo_text="There are no more words to be said."; - if (rando==2) then diplo_text="The forces of Chaos call for your destruction."; - if (rando==3) then diplo_text="Your soul will be mine."; - } - if (rela!="hostile"){// Only happens with leader=1 - // More normal "yes?" greetings - rando=choose(1,2); - if(rando==1) then diplo_text="May the Chaos gods bless us in our meeting!"; - if(rando==2) then diplo_text="Do you need help to kill some heretics?"; - } - } - if (faction_gender[10]==1) and (string_count("CHTRP|",obj_controller.useful_info)>0){ - obj_controller.useful_info=string_replace(obj_controller.useful_info,"CHTRP|","CHTRP2|"); - diplo_text+="I almost refused to believe that my little trap hadn't done you in, but here you are. I may have misjudged you, "+string(obj_ini.master_name)+". Of course I still intend to kill you, regardless, but I can give credit where credit is due."; - force_goodbye=1; - } - if (faction_gender[10]==2){ - force_goodbye=1; - turns_ignored[10]+=choose(3,4,5); - rando=choose(1,2,3); - if (diplo_keyphrase=="propose_alliance") then rando=choose(1,2,2,3); - if (rando==1) then diplo_text="I AM GOING TO RIP YOUR HEARTS OUT AND CONSUME THEM IN FRONT OF YOU!"; - if (rando==2) then diplo_text="BEGGING WILL DO YOU NO GOOD, IMPERIAL LAPDOG!"; - if (rando==3) then diplo_text="DEATH COMES FOR ALL!"; - } - } - if (diplo_keyphrase=="trade_close"){ - rando=choose(1,2,3); - if (rela=="hostile"){ - if (rando==1) then diplo_text+="When the time comes for your extinction, I will carve a list of the many times you irked me into your skin. This incident will go on your "+choose("forehead","chest","throat","cheek","heart")+"."; - if (rando==2){ - diplo_text+="Begone then, the stench of your vaunted sanctity offends me."; - force_goodbye=1; - } - if (rando==3){ - diplo_text+="It must be said that while you fail at almost all aspects of commanding a Chapter, you are extremely skilled in causing me slight irritations. Congratulations."; - force_goodbye=1; - } - } - if (rela!="hostile"){ - if (rando==1) then diplo_text+="Next time you see fit to contact me, I expect you to have considered your words more carefully. Before you are required to speak them, if possible."; - if (rando==2) then diplo_text+="You are boorish to converse with but I suppose it cannot be helped; you were trained to kill, not to talk or, indeed, to think."; - if (rando==3) then diplo_text+="Traditionally, one makes sure one is sure of ones course of action before acting, not afterwards. Something for you to consider, no doubt."; - } - } - if (diplo_keyphrase=="demand_refused"){ - if (faction_gender[10]==1) and (rela=="hostile"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text="I spit upon your demands, loyalist dog. Beg your corpse Emperor for something instead."; - if (rando==2) then diplo_text="A child, blind to the ways of the world, may demand things from an adult but all he gets is a bloody nose. Insolent whelp."; - if (rando==3) then diplo_text="Your demands are much like your misguided faith in the ‘Emperor'; nothing but dust before the implacable winds of Chaos."; - } - } - if (string_count("agree",diplo_keyphrase)==1){ - if (trading_artifact==0) then diplo_text=string(trade_msg)+"\n"; - if (trading_artifact!=0) then diplo_text="[[Trade Accepted.]]\n"; - if (liscensing>0){ - diplo_text="[[Trade Accepted. License(s) Transmitted.]]\n"; - force_goodbye=1; - // something else here; schedule the license and do not go to the next audience - } - rando=choose(1,2,3); - if (rela!="hostile"){ - if (rando==1) then diplo_text+="Very well, let it be so. I will give the relevant commands to my underlings and arrangements will be made."; - if (rando==2) then diplo_text+="This is an acceptable trade, beneficial to both of us. I agree to it."; - if (rando==3) then diplo_text+="For now, I will accept this trade. Do not assume I will always do so, however."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="Sometimes a lord deigns to exchange with the meanest pauper. It does not make them equals."; - if (rando==2) then diplo_text+="I will trade with you, little loyalist, if only to be closer to laugh at you when you fall to the inexorable machinations of the Gods."; - if (rando==3) then diplo_text+="If only to demonstrate how meaningless your efforts are in the grand scheme of the Galaxy, I'll accept this trade."; - } - } - if (diplo_keyphrase=="disagree"){ - } - if (diplo_keyphrase=="attacked"){ - // TODO - } - if (diplo_keyphrase=="declare_war"){ - force_goodbye=1; - turns_ignored[diplomacy]+=4; - rando=choose(1,2,3); - if (rela=="hostile"){ - if (rando==1) then diplo_text+="The war already exists, you petulant fool. It has raged for 10,000 years and will outlive us both."; - if (rando==2) then diplo_text+="And before you ‘declared war'? Did you believe that I had no intention of destroying you at that time? You delusional dog."; - if (rando==3) then diplo_text+="Do not worry, thrall of the corpse Emperor, I shall grant you both death and freedom from your bonds of ‘loyalty'."; - } - if (rela!="hostile"){ - if (rando==1) then diplo_text+="It is puzzling to me that you believe this changes anything but I see this means a lot to you so I accept your ‘declaration'."; - if (rando==2) then diplo_text+="Little fool, you do not to understand the nature of the Galaxy. If we have time before I obliterate you, I will educate you."; - if (rando==3) then diplo_text+="Were we not already engaged in a war 10,000 years old, your declaration might mean something."; - } - } - if (diplo_keyphrase=="accept_peace"){ - scr_chaos_alliance_test(); - } - - if (diplo_keyphrase=="ignored"){ - // TODO - } - if (diplo_keyphrase=="denounced"){ - if (faction_gender[10]==1){ - disposition[10]-=1; - - var _diag_opts = [ - "You are nothing.", - "Pathetic.", - "I grow weary of your ineptitude.", - "Judgement comes for all.", - "Your kind will be destroyed, in time.", - $"[{faction_leader[eFACTION.Inquisition]} lets out an amused, extremely confident chuckle.]", - "Your soul will be mine.", - "Do not trifle with me, worm.", - "I have travelled the stars for millennia. Worlds have burned at my command, countless souls damned. The ground trembles with every step. Now I sit here and listen to you. Where did it all go so wrong?" - ] - diplo_text = array_random_element(_diag_opts); - - - - if (irandom(9)==9){ - force_goodbye=1; - } - if (disposition[10]<=-80){ - diplo_text="Your end will soon be at hand; you need not rush toward it so eagerly."; - force_goodbye=1; - } - } - } - if (diplo_keyphrase=="praised") and (faction_gender[10]=1){ - if (faction_justmet==0) and (disposition[10]<-75) then disposition[diplomacy]+=choose(0,0,1); - if (faction_justmet==1){ - disposition[diplomacy]+=2; - faction_justmet=0; - } - rando=choose(1,2,3); - if (rela=="hostile"){ - if (rando==1) then diplo_text+="Save your words for one who is easily swayed by such pleasantries, you blundering oaf."; - if (rando==2) then diplo_text+="Your words would be better served placating members of your Imperium's Inquisition who will, I am sure, be interested in our correspondences."; - if (rando==3) then diplo_text+="Prattle on, fool, your words contain less meaning than the solar wind that blows across cold stars."; - } - if (rela!="hostile"){ - if (rando==1) then diplo_text+="Whether by accident or design, you speak truth. But do not believe it changes anything about how I see you or how I will treat you."; - if (rando==2) then diplo_text+="Were I someone who responded to the slightest praise with preferential treatment, I would not have got were I am today."; - if (rando==3) then diplo_text+="Words will not sway me in the slightest. Only actions display worthiness."; - } - } - if (diplo_keyphrase=="offer"){ - rando=choose(1,2,3); - if (rela=="hostile"){ - if (rando==1) then diplo_text+="As much as I am loathe to besmirch my ears by listening to your words, needs must when cruel fate drives us into a corner. I have an offer for you."; - if (rando==2) then diplo_text+="Do not presume that I come to you out of admiration or seeking friendship. I merely wish to trade you enough rope to hang yourself with."; - if (rando==3) then diplo_text+="Soon, you will be either dead or close enough that it makes no difference. At this moment, however, I wish to offer you a trade."; - } - if (rela!="hostile"){ - if (rando==1) then diplo_text+="Prove that you are more than just another ten day traitor, trade with me and further both our agendas."; - if (rando==2) then diplo_text+="If we truly both follow the many stepped path towards the glory of chaos, you will agree to trade with me."; - if (rando==3) then diplo_text+="Trade, if not allegiance, between the children of chaos is essential to the furthering of our shared agenda."; - } - } - if (diplo_keyphrase=="open_trade") then diplo_text="Make your proposal."; - if (diplo_keyphrase=="artifact_thanks"){ - rando=choose(1,2,3); - if (rela=="hostile"){ - if (rando==1) then diplo_text+="I would have torn it from your cold, dead hands in any case but this does save us some time."; - if (rando==2) then diplo_text+="A meaningless gesture, Chapter Master, but it brings us a little closer to your inevitable demise so it is appreciated."; - if (rando==3) then diplo_text+="You have no more idea of what you're doing than a headless Grox, do you? I will consider making you end swift, when the time comes."; - } - if (rela!="hostile"){ - if (rando==1) then diplo_text+="I shall examine this gift for any traps or flaws before rendering you any thanks."; - if (rando==2) then diplo_text+="It will go into my vault to be stored with the many others of its type I have collected. Nevertheless, I thank you for the gesture."; - if (rando==3) then diplo_text+="If you expect gushing thanks or rapturous praise, you will go on waiting. I am not sure how much of a favour you have done me."; - } - } - if (diplo_keyphrase=="stc_thanks"){ - rando=choose(1,2,3); - if (rela=="hostile"){ - if (rando==1) then diplo_text+="There would have been no place you could have hidden it from me when I came to claim it, you insignificant worm."; - if (rando==2) then diplo_text+="A petty, insignificant, pointless gesture of deference but a gesture of deference nonetheless and I will remember it when my hand is around your throat."; - if (rando==3) then diplo_text+="I cannot fathom the path of thought that brought you to this action but it doesn't truly matter; it will be rendered meaningless with your death."; - } - if (rela!="hostile"){ - if (rando==1) then diplo_text+="Interesting, a gift as rare as this implies that you expect something in return. I shall consider what you want and, more importantly, what I am prepared to give."; - if (rando==2) then diplo_text+="A gift more valuable than most but still something I have come across before. I shall have it stored in my personal vaults."; - if (rando==3) then diplo_text+="I shall keep this gift close, both as a reminder of your generosity and to remind me to watch you carefully, Chapter Master."; - } - } - if (diplo_keyphrase=="trading_demand"){ - if (rela=="hostile"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text+="Speak, worm, lest I wipe you from existence before you manage even to beg for mercy."; - if (rando==2) then diplo_text+="I can only hope you intend to beg for mercy and throw yourself upon my dubious mercy. It will be quicker for all concerned."; - if (rando==3) then diplo_text+="Words are wind, much like you will be if I don't like what I hear."; - } - if (rela!="hostile"){ - rando=choose(1,2,2,3,3,3); - if (rando==1) then diplo_text+="Choose the words you use as carefully as your battle gear, least the former mean you need to use the latter."; - if (rando==2) then diplo_text+="I am not a being of unlimited leisure time, Chapter Master, so you will need to be swift with your words."; - if (rando==3) then diplo_text+="Speak but do not be offended if I seem not to be paying attention; I'm probably not."; - } - add_diplomacy_option({option_text:"Demand Requisition"}); - add_diplomacy_option({option_text:"Demand Military Assistance"}); - add_diplomacy_option({ - option_text:"Cancel", - goto:"disagree" - }); - } - if (diplo_keyphrase=="propose_alliance") and (obj_controller.faction_gender[10]==1){ - var _found = false; - var _star, _planet; - with(obj_star){ - for(var i=1; i<=4;){ - for(var r=1; r<=4; r++){ - if (p_problem[i,r]=="meeting") or (p_problem[i,r]=="meeting_trap"){ - _found = true; - _star = id; - _planet = r; - break - } - } - } - } - if (_found){ - rando=choose(1,2); - var _name = planet_numeral_name(_planet, _star); - if (rando==1) then diplo_text=$"I await your arrival on {_name}, in case it has slipped your mind."; - if (rando==2) then diplo_text=$"We agreed to meet upon {_name}. Do not squander this opportunity."; - } else { - scr_chaos_alliance_test(); - } - } - } - // ** Imperium ** - if (diplomacy==2){ - if (diplo_keyphrase=="intro"){ - rando=choose(1,2); - if (rando==1) then tempd=$"[[To see Sector Commander {faction_leader[eFACTION.Imperium]} is to see what happens to heroes when their glory days have passed and the rot of ages sets in. Now a huge mass of fat and flab, he was once a mighty and respected general and the commander of a score of successful campaigns. As his reward for a glorious career, he was given commander of the sector and, as has happened to so many others, the bureaucracy crushed his warrior spirit and turned him into the man he is.]]"; - if (rando==2) then tempd=$"[[Loyal to allies and venomous to enemies, few figures command such opposing reputations as {faction_leader[eFACTION.Imperium]}. Enemies of the Imperium speak in hushed tones of his incredible cruelty and harsh actions against them, whereas the citizens and organizations that lay claim to the protection of the Emperor loudly toast his generosity and stalwart courage. A friend to keep and an enemy to lose.]]"; - tempd+="\n#"; - rando=choose(1,2); - if (rando==1) then tempd+="Space Marines in my sector are expected to conduct themselves as befits one of the Adeptus Astartes. Do not disappoint me."; - if (rando==2) then tempd+="It is good that the vessels of the Emperor's wrath have arrived in this sector- to bring his justice to the xenos and the heretic."; - diplo_text=tempd; - } - if (diplo_keyphrase=="hello"){ - if (rela=="friendly") then diplo_text=$"What can I do for the hero of {obj_ini.sector_name}?"; - if (rela=="neutral") then diplo_text=$"State your business, Chapter Master."; - if (rela=="hostile") then diplo_text=$"What do you want, Chapter Master? I have little time for glorified interplanetary brigands such as yourself."; - } - if (diplo_keyphrase=="trade_close"){ - if (rela=="friendly") then diplo_text="Were I a less forgiving man, I might find that rude! But there is little I would not forgive you, my friend!"; - if (rela=="neutral") then diplo_text="It is hardly courteous to change ones mind when a deal is about to be reached. Still, I suppose you /must/ have your reasons."; - if (rela=="hostile") then diplo_text="How very like you to back out of things. I seem to recall your vows to guard this sector from Xenos, heretics and mutants. Strange, but some still seem to be around."; - } - if (diplo_keyphrase=="demand_refused"){ - rando=choose(1,2); - if (rela=="friendly"){ - if (rando==1) then diplo_text="I only wish I could assist you in this way, Chapter Master, but I am afraid I cannot."; - if (rando==2) then diplo_text="I am truly sorry, Lord, but I have to chance of fulfilling your request."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="At this time, I'm afraid it is not possible for me to comply."; - if (rando==2) then diplo_text="Perhaps at a later date or if you had asked earlier, but now is simply too difficult."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="Do not think that you can demand everything because you are an Astartes. I decline."; - if (rando==2) then diplo_text="Get thee gone, I am in no mood for your presumptions."; - } - } - if (string_count("agree",diplo_keyphrase)==1){ - if (trading_artifact==0) then diplo_text=string(trade_msg)+"\n"; - if (trading_artifact!=0) then diplo_text="[[Trade Accepted.]]\n"; - if (liscensing>0){ - diplo_text="[[Trade Accepted. License(s) Transmitted.]]\n"; - force_goodbye=1; - // TODO something else here; schedule the lisence and do not go to the next audience - } - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="Mightily agreeable, Chapter Master. I will await the fruition of our arrangement."; - if (rando==2) then diplo_text+="A sound suggestion, let it be so!"; - if (rando==3) then diplo_text+="The Emperor was truly merciful when he sent you to us, Chapter Master. I agree!"; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="An acceptable proposition. You will have to talk it over with my scribes."; - if (rando==2) then diplo_text+="The Sector would benefit from such a deal."; - if (rando==3) then diplo_text+="Indeed, let it be so, Chapter Master."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="It is my only option, but I will curse you forever for forcing me into this."; - if (rando==2) then diplo_text+="If you cross me, the wrath of the Emperor will come down on your head."; - if (rando==3) then diplo_text+="I never thought I would work with as deplorable a character as yourself, but I accept."; - } - } - if (diplo_keyphrase=="disagree"){ - if (trading_artifact==0) then diplo_text="[[Trade Refused]]\n"; - if (trading_artifact==1) then diplo_text=""; - annoyed[diplomacy]+=2; - if (annoyed[diplomacy]>=10){ - force_goodbye=1; - if (rela=="friendly") then diplo_text+="I cannot accept this deal and the day grows late; I will not take any more of your time."; - if (rela=="neutral") then diplo_text+="I apologize, Chapter Master, but I have more pressing concerns. The Emperor protects."; - if (rela=="hostile") then diplo_text+="Don't you have better things to do, astartes?"; - turns_ignored[diplomacy]=max(turns_ignored[diplomacy],1); - diplo_last=string(diplo_keyphrase); - diplo_char=0; - diplo_alpha=0; - exit; - } - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="I apologize, but my resources must be directed in a different direction."; - if (rando==2) then diplo_text+="It pains me to deny you but I fear I must."; - if (rando==3) then diplo_text+="Unfortunately, I and my forces have a prior engagement."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="I do not believe this will help either of us."; - if (rando==2) then diplo_text+="Tempting... but no, I must decline."; - if (rando==3) then diplo_text+="Perhaps circumstances will change but for now I must decline."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="Are you mad? Even if you are not, I suggest you plead insanity when the Inquisition comes for you. It might make your death quicker."; - if (rando==2) then diplo_text+="Do not think me your fool whom you can ask to do whatever you wish."; - if (rando==3) then diplo_text+="Unlike you, I do only the bidding of the Emperor. I do not agree."; - } - } - if (diplo_keyphrase=="attacked"){ - diplo_text="By striking at me, you strike at the entire Imperium! You will live to regret this."; - } - if (diplo_keyphrase=="declare_war"){ - force_goodbye=1; - turns_ignored[diplomacy]+=4; - known[diplomacy]=max(2,known[diplomacy]); - diplo_text="You have gone too far this time! Lest suspicion fall on me for simply sharing a sector with you, I have no choice but to destroy you."; - - with(obj_star){ - for(var p=1; p<=4; p++){ - if (planets>=p){ - if (p_owner[p]==eFACTION.Player) and (dispo[p]<100) and (planet_feature_bool(p_feature[p], P_features.Monastery)==0){ - if (p_first[p]!=eFACTION.Player) then p_owner[p]=p_first[p]; - else p_owner[p]=eFACTION.Imperium; - scr_alert("red","blarg","Control of "+string(name)+" "+scr_roman(p)+" lost!",x,y); - scr_event_log("red","Control of "+string(name)+" "+scr_roman(p)+" lost!"); - } - } - } - } - } - if (diplo_keyphrase=="accept_peace"){ - diplo_text="Perhaps I was hasty in my judgment of you. I will accept peace. For the moment..."; - } - if (diplo_keyphrase=="ignored"){ - diplo_text="It is customary to offer reports of your progress to your sector's commander. And your sector commander is me and yet I see a disturbing lack of reports."; - } - if (diplo_keyphrase=="denounced"){ - if (faction_justmet==1){ - disposition[diplomacy]-=5; - faction_justmet=0; - } - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text="Perhaps you could be a little less harsh in your criticisms, friend?"; - if (rando==2) then diplo_text="I shall have to reexamine myself, if such a loyal soldier says such things of me."; - if (rando==3) then diplo_text="Might I suggest you learn the practice of thinking before speaking?"; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="Words are wind, Astartes."; - if (rando==2) then diplo_text="If I took on board the criticisms of everyone in the sector, I'd never get a damn thing done."; - if (rando==3) then diplo_text="I care not for your insults, only for the work you do for the Emperor."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="Your words are as full of poison as your heart."; - if (rando==2) then diplo_text="If you think that your words would go unnoticed, you were wrong."; - if (rando==3) then diplo_text="The true soldiers of the Imperium would not speak so of their rightful commanders."; - } - } - if (diplo_keyphrase=="praised"){ - if (faction_justmet==1){ - disposition[diplomacy]+=2; - faction_justmet=0; - } - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text="You are too kind, friend, for it is you that the people see as their champion."; - if (rando==2) then diplo_text="If all Astartes were half as bold as you are courteous, there would be not a single foe left in the galaxy."; - if (rando==3) then diplo_text="Few Space Marines are as kind as they are valorous."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="Back up your sweet words with bold actions and perhaps you shall find a friend in me."; - if (rando==2) then diplo_text="I thank you for the compliment but it does not alter our relation in the slightest."; - if (rando==3) then diplo_text="A heretic rarely speaks with such a kind tongue, but this is an unknowable galaxy and stranger things have happened."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="You won't sway me to your cause with poisoned honey."; - if (rando==2) then diplo_text="A wicked man speaks wicked lies, but even a stopped chrono is right twice a day."; - if (rando==3) then diplo_text="You approval means less to me than your enmity."; - } - } - if (diplo_keyphrase=="offer"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text="Would a trade such as this be to your satisfaction?"; - if (rando==2) then diplo_text="I believe this trade would be beneficial to us both."; - if (rando==3) then diplo_text="What benefits us both benefits the Imperium. Who better for you to trade with than myself?"; - } - if (diplo_keyphrase=="open_trade"){ - diplo_text="Make your proposal, Chapter Master."; - } - else if (diplo_keyphrase=="artifact_thanks"){ - diplo_text="Thank you indeed, Chapter Master. A relic of such magnificence... I thank you more than I can say."; - } - else if (diplo_keyphrase=="artifact_daemon"){ - diplo_text="Thank you indeed, Chapter Master. A relic of such magnificence... I thank you. This item is precious to me."; - } - if (diplo_keyphrase=="stc_thanks"){ - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="Such relics are a rare and glorious sight, Chapter Master. I thank you for this boon and trust that you know my gratitude will be expressed in a manner pleasing to you."; - if (rando==2) then diplo_text+="You honour me beyond words with this gift. I thank you, as do all under my command and all who will benefit from it."; - if (rando==3) then diplo_text+="A mighty gift from a mighty ally, Chapter Master. It will be remembered as one of the many great deeds you have done for this sector."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="Do not think me ungrateful but I am a little suspicious as to what has caused this sudden largesse. Perhaps this gift is not as pure as it seems?"; - if (rando==2) then diplo_text+="Quite a gift, Chapter Master. I expect that you will want repaying, even if you have not openly stated thus. We shall see..."; - if (rando==3) then diplo_text+="Were it so simple that I could just take the gift and give you thanks. In these times, there is always a price and always a reckoning."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="Do you think simple gifts will make us firm friends? I think not, you villainous cur! Away with you, though I will keep this gift, if only to deprive you of it."; - if (rando==2) then diplo_text+="When a traitor in all but name gives you a gift, one only survives by first checking it for traps and then killing the traitor. And I intend to survive."; - if (rando==3) then diplo_text+="Your gifts mean nothing to me, even less than your words do. I will not be swayed by either and will keep my own counsel."; - } - } - if (diplo_keyphrase=="artifact_angry"){ - // TODO - diplo_text="How dare you offer us such an artifact!"; - } - if (diplo_keyphrase=="bombard_angry"){ - diplo_text="For the love of the Emperor, what the hell are you doing? That was an Imperial world you layed waste to!"; - } - if (diplo_keyphrase=="trading_demand"){ - if (rela=="friendly") then diplo_text=string(obj_ini.master_name)+"?"; - if (rela=="neutral") then diplo_text="What is the meaning of this?"; - if (rela=="hostile") then diplo_text="Consider your next words carefully."; - add_diplomacy_option({option_text:"Demand Requisition"}); - add_diplomacy_option({option_text:"Demand Military Assistance"}); - add_diplomacy_option({ - option_text:"Cancel", - goto:"disagree" - }); - } - if (diplo_keyphrase == "assassination_angryish"){ - - var _event = audience_data; - rando=choose(1,2,3); - var _assasin_place = planet_numeral_name(_event.planet, _event.system); - if (rando==1) then diplo_text=$"Several sources indicate that you have killed the Planetary Governor of {_assasin_place} and went on to meddle with the succession. Such subterfuge will not be tolerated, Chapter Master."; - if (rando==2) then diplo_text=$"I have received word that you have killed the Planetary Governor of {_assasin_place} and placed a fool in power. Your attempts to control this sector, and seemingly emulate the Ultramarines, have not gone unnoticed. Do not think this will go unpunished."; - if (rando==3) then diplo_text=$"What do you think you are doing, Chapter Master? Killing a Planetary Governor? Replacing them with one of your tools? Inquisitor Lord {faction_leader[eFACTION.Inquisition]} will hear of this madness."; - array_delete(obj_controller.event, _event_index, 1); - - } - } - // ** Mechanicus ** - if (diplomacy=3){ - if (diplo_keyphrase=="intro"){ - rando=choose(1,2); - if (rando==1) then diplo_text="[["+string(faction_leader[eFACTION.Mechanicus])+" is a name often spoken of on the factory floor of "+string(obj_ini.sector_name)+"'s forgeworlds, though it cursed as often as it's praised. Sometimes referred to as “The Iron Whip”, "+string(faction_leader[eFACTION.Mechanicus])+" is famed for the high level of efficiency he extracts from those working under him, if not particularly for the quality of their works.]]"; - if (rando==2) then diplo_text="[[The flesh is weak. "+string(faction_leader[eFACTION.Mechanicus])+" believes in this part of the iron creed above all others, forcing all those under him to mirror his dedication. All meaty parts of his body have been removed, leaving only the most vital parts of his brain. His retinue display their rank by showing how little of their body remains.]]"; - diplo_text+="\n#"; - if (disposition[3]>30) and (disposition[3]<60) then tempd="Greetings. I wish to see you bring the light of civilization to this sector, Chapter Master."; - if (disposition[3]<=30) or (scr_has_disadv("Tech-Heresy")) then tempd="You are impure, illogical and irritating. Keep your army of techno barbarians away from my territory."; - if (disposition[3]>=60) or (scr_has_adv("Tech-Brothers")) then tempd="Hail, Chapter Master. Were it not a logical fallacy, I would wish you luck in your coming endeavors."; - diplo_text+=tempd; - } - if (diplo_keyphrase=="hello"){ - if (rela=="friendly") then diplo_text="What can I and my forces do for you, Chapter Master?"; - if (rela=="neutral") then diplo_text="I will allow you a small portion of my time for an audience, Astartes."; - if (rela=="hostile") then diplo_text="Time is a precious resource and I do not wish to spend much of mine on you."; - } - if (diplo_keyphrase=="trade_close"){ - if (rela=="friendly") then diplo_text="I trust you have recalculated how your resources can be best utilised and deemed this trade inefficient."; - if (rela=="neutral") then diplo_text="I suggest you leaner to calculate a little further into the future, Space Marine. It will be inefficient for you to continue operating in your current fashion."; - if (rela=="hostile") then diplo_text="It would be illogical to engage in a trade with one as unreliable as you in any case."; - } - if (diplo_keyphrase=="demand_refused"){ - rando=choose(1,2); - if (rela=="friendly"){ - if (rando==1) then diplo_text="Were it a logical and efficient use of resources, we would gladly comply but it is not."; - if (rando==2) then diplo_text="We express regret that we cannot currently assist you, Chapter Master."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="Your request has been considered and found to be lacking in merit."; - if (rando==2) then diplo_text="While you make an acceptable case, we decline to enter into this agreement."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="To enter into any agreement with you would be a awful error of judgement."; - if (rando==2) then diplo_text="It would be more efficient to discharge a plasma rifle into my own chest cavity. [Simulated Mirth]"; - } - } - if (diplo_keyphrase=="agree"){ - if (trading_artifact==0) then diplo_text=string(trade_msg)+"\n"; - if (trading_artifact!=0) then diplo_text="[[Trade Accepted.]]\n"; - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="Let it be so, and may the Machine God bless this venture."; - if (rando==2) then diplo_text+="You made a wise decision in bringing this proposal to me."; - if (rando==3) then diplo_text+="Let this agreement strengthen the bounds of our brotherhood."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="Let it be so; it is immaterial in my calculations."; - if (rando==2) then diplo_text+="I agree, though it will change little in the grand scheme of the galaxy."; - if (rando==3) then diplo_text+="Logic dictates that I agree. We have an accord."; - } - if (rela=="hostile"){ - if (rando=1) then diplo_text+="It is logical to agree with you, but I dislike it."; - if (rando=2) then diplo_text+="At least for you, it is lucky that I have little choice."; - if (rando=3) then diplo_text+="Probability suggests this endeavor will fail, but I agree."; - } - } - if (diplo_keyphrase=="disagree"){ - if (trading_artifact==0) then diplo_text="[[Trade Refused]]\n"; - if (trading_artifact==1) then diplo_text=""; - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="I cannot allow favoritism to affect my calculations. I decline."; - if (rando==2) then diplo_text+="Our friendship means fractionally less to me than this bargain. I decline."; - if (rando==3) then diplo_text="I have calculated the likely benefits weighed against the risks, and find this venture unsatisfactory."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="I have calculated the likely benefits weighed against the risks, and find this venture unsatisfactory."; - if (rando==2) then diplo_text+="My answer is no, for it is the only logical route."; - if (rando==3) then diplo_text+="I do not think so, though you may find others who are more willing."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="A ludicrous proposal, illogical and dangerous. Take it somewhere else."; - if (rando==2) then diplo_text+="Do you suppose me to be mad? Do you judge me by your own standard? No."; - if (rando==3) then diplo_text+="It would be illogical and heretical. Extrapolate your answer from that."; - } - } - if (diplo_keyphrase=="attacked"){ - if (rela!="friendly") then diplo_text="Your heretic blasphemy shall not go unpunished. The Adeptus Mechanicus will destroy without exception all that is your chapter."; - if (rela=="friendly") then diplo_text="You have forsaken the Omnissiah's generosity; now you shall face judgment."; - } - if (diplo_keyphrase=="declare_war"){ - force_goodbye=1; - turns_ignored[diplomacy]+=4; - known[diplomacy]=max(2,known[diplomacy]); - diplo_text="++ CORPUS FINIS+MACHINA MAGNUS+SANCTUS METALLUM+POTESTAS OMNISSIAH+OMNISSIAH VULT+DEATH TO THE ENEMIES OF THE MACHINE GOD ++"; - } - if (diplo_keyphrase=="accept_peace"){ - diplo_text="We have calculated the price of your destruction and found it excessive."; - } - if (diplo_keyphrase=="ignored"){ - diplo_text="What cause do you have, to listen to reason and logic once more?"; - } - if (diplo_keyphrase=="denounced"){ - if (faction_justmet==1){ - disposition[diplomacy]-=5; - faction_justmet=0; - } - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text="Look to your weapons, your armour, and your ships, Chapter Master, and reconsider the logic of your statement."; - if (rando==2) then diplo_text="It is illogical and unwise to turn aside the Adeptus Mechanicus' auspices."; - if (rando==3) then diplo_text="To speak against us is to speak against the Machine God."; - } - if (rela!="friendly"){ - if (rando==1) then diplo_text="The smallest mind strives to comprehend its limits."; - if (rando==2) then diplo_text="Your words are illogical and meaningless."; - if (rando==3) then diplo_text="Do not waste my time with incongruous statements."; - } - } - if (diplo_keyphrase=="praised"){ - if (rela=="friendly"){ - rando=choose(1,2); - if (rando==1) then diplo_text="Do not be fictitious, Chapter Master. What is it you covet?"; - if (rando==2) then diplo_text="I am unable to be swayed by ingratiating words; the truth of your statement is clear to all."; - } - if (rela!="friendly"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text="I have better things to do than listen to your praise."; - if (rando==2) then diplo_text="Words such as these have no place in my calculations."; - if (rando==3) then diplo_text="Do not waste my time."; - } - } - if (diplo_keyphrase=="offer"){ - rando=choose(1,2,3,4); - if (rando==1) then diplo_text="The Adeptus Mechanicus offers you this."; - if (rando==2) then diplo_text="A logical transaction. What is your answer, Chapter Master?"; - if (rando==3) then diplo_text="You lack resources; the Adeptus Mechanicus has much at its disposal."; - if (rando==4) then diplo_text="Calculations reveal that we shall mutually benefit from this transaction."; - } - if (diplo_keyphrase=="open_trade") then diplo_text="..."; - if (diplo_keyphrase=="artifact"){ - if (rela!="hostile"){ - add_diplomacy_option({ - option_text:"Propose a trade for the Artifact." - }); - add_diplomacy_option({ - option_text:"Leave it be; Exit.", - is_exit : true, - }); - diplo_text="The Adeptus Mechanicus is aware of the Artifact. Do not concern yourself with that which is rightly within our territory."; - } - if (rela=="hostile"){ - force_goodbye=1; - diplo_text="This Artifact rightly belongs to the Adeptus Mechanicus. Keep your techno barbarians out of our territory and we shall not be forced to act."; - } - } - if (diplo_keyphrase=="artifact_thanks"){ - diplo_text="We thank you for your help in retrieving this artifact, though we would doubtless have located it eventually."; - } - if (diplo_keyphrase=="artifact_angry"){ - diplo_text="The Mechanicus does not forgive theft and the Mechanicus does not forgive. We will avenge this. We will return and make you pay."; - } - if (diplo_keyphrase="stc_thanks"){ - rando=choose(1,2,3,4,5,6); - if (rela=="friendly"){ - if (rando==1) then diplo_text="I had every confidence that engaging in a mutually beneficial relationship with you would prove a wise move. I had, in non-logical parlance, a 'hunch'."; - if (rando==2) then diplo_text="It was the most beneficial action that you could take to inform the Mechanicus of this fragment. I calculated you would take it if ever the opportunity was presented to you."; - if (rando==3) then diplo_text="Your cooperation in this matter will not go unappreciated, nor will the servants of the Omnissiah forget your name."; - if (rando==4) then diplo_text+="Honoured ally, you have performed your function with incredible efficiency."; - if (rando==5) then diplo_text+="+++ Divinitatae Imperator, Dies Optimus Semper +++"; - if (rando==6) then diplo_text+="A most auspicious gift, Chapter Master, which will not be forgotten."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="We are pleased with your contribution, Astartes. An explorator has been dispatched to receive what is ours- you would do well to ensure the STC sanctity remains intact."; - if (rando==2) then diplo_text="It is pleasing that you made the logical choice in this matter. Our evaluation of you will be adjusted accordingly."; - if (rando==3) then diplo_text="You have acted in the interests of the Imperium, giving to us what we can utilize for humanity, now trust our judgment to do the same for you."; - if (rando==4) then diplo_text+="This gift is valuable. Your status in relation to the Mechanicus will be reappraised and reassigned."; - if (rando==5) then diplo_text+="The origin, purpose, authenticity and quality of this gift will be evaluated before you receive any thanks."; - if (rando==6) then diplo_text+="Gratitude is an illogical emotion, do not expect any. Instead, accept that Mechanicus will continue to act as is dictated by logic and the Omnissiah."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="Your actions simply prove that you are afraid that the hands of the Machine God are coming for you. Deus Vult."; - if (rando==2) then diplo_text="We thank you for the fragment but it has not caused us to forgive or to forget. In the eyes of the Omnissiah, you have been seen to be unworthy."; - if (rando==3) then diplo_text="While you have acted like a loyal servant in this case, it does not erase the records of your trespasses."; - if (rando==4) then diplo_text+="Query; where did you attain such a technological marvel? Hypothesis; from the lords of chaos. Conclusion; You are an enemy."; - if (rando==5) then diplo_text+="The servants of the Omnissiah cannot be bought with trinkets, no matter how valuable, Chapter Master."; - if (rando==6) then diplo_text+="Your clumsy attempt to curry favour with us has been seen through and will be recorded as yet another flaw in your character."; - } - } - if (diplo_keyphrase=="bombard_angry"){ - diplo_text="When you strike at us, you strike the guns from the hands of the soldiers of the God Emperor. This is unacceptable and you have not heard the last of this."; - } - if (diplo_keyphrase=="trading_demand"){ - if (rela=="friendly") then diplo_text="Speak, Chapter Master."; - if (rela=="neutral") then diplo_text="I am awaiting your query."; - if (rela=="hostile"){ - var randoo=0; - randoo=floor(random(100))+1; - if (randoo==1) then diplo_text="Calculations reveal that depending on your query we may have to beat your ass."; - if (randoo!=1) then diplo_text="Certain queries may have to be answered by action."; - } - add_diplomacy_option({option_text:"Demand Requisition"}); - add_diplomacy_option({ - option_text:"Cancel", - goto:"disagree" - }); - } - } - // ** Inquisition ** - if (diplomacy==4){ - if (diplo_keyphrase=="intro"){ - rando=choose(1,1,2); - if (rando==1) then tempd="[[An ancient and well respected Inquistor Lord, "+string(faction_leader[eFACTION.Inquisition])+" has purged heresy and exterminated mutants for well over four centuries. His steely gaze and iron will have broken as many heretics as have the tools of persuasion wielded by his retinue. Were he to die, the Ordo "+choose("Malleus","Xenos","Hereticus")+" would dearly miss his services.]]"; - if (rando==2) then tempd="[[A thousand heretics have cursed the name of "+string(faction_leader[eFACTION.Inquisition])+" with their last breath but he is still not satisfied. Remorse is as alien to him as pity and he will stop at nothing to destroy the enemies of purity.]]"; - tempd+="\n#"; - if (rela=="friendly") then tempd+="Ave Imperator, Chapter Master. You show great promise and I look forward to seeing you bring the light of the Emperor to "+string(obj_ini.sector_name)+"."; - if (rela=="neutral") then tempd+="Greetings, space marine. Serve the Emperor in body and soul and you shall have nothing to fear from the Inquisition."; - if (rela=="hostile") then tempd+="I hear worrying rumors about your conduct, astartes. I have no doubt we will meet again soon."; - diplo_text=tempd; - } - if (diplo_keyphrase=="hello"){ - if (rela=="friendly") then diplo_text+="Hail, hero of "+string(obj_ini.sector_name)+". How may I assist you this day?"; - if (rela=="neutral") then diplo_text+="Praise be to the Emperor. What is your business here?"; - if (rela=="hostile") then diplo_text+="State your business, for many heretics pray the Emperor's mercy."; - } - if (diplo_keyphrase=="trade_close"){ - if (rela=="friendly") then diplo_text="There are few people I would allow to back out of a deal in such a way, Chapter Master. Think of this as a symbol of my friendship."; - if (rela=="neutral") then diplo_text="I have work to do Space Marine, much of it implements of torture and stubborn heretics, please make sure you are ready to commit to a deal when you interrupt my labours next time."; - if (rela=="hostile") then diplo_text="Do not delude yourself in thinking I was truly going to trade with you. Much of my interest was a ruse."; - } - if (diplo_keyphrase=="demand_refused"){ - rando=choose(1,2); - if (rela=="friendly"){ - if (rando==1) then diplo_text="Only a true friend would be given such a courteous message as this; the Inquisition does not agree and does not take kindly to such requests."; - if (rando==2) then diplo_text="I don't believe I will accept this request, Chapter Master, but do not let it dishearten you."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="Do not attempt to sway the mind of an Inquisitor, Chapter Master, it cannot be done."; - if (rando==2) then diplo_text="While your request is not without merit, I think not."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="Idleness and greed are the signs of a heretic, Chapter Master."; - if (rando==2) then diplo_text="Do not presume, Chapter Master, for you too will be judged by the Inquisition."; - } - } - if (string_count("agree",diplo_keyphrase)>0){ - if (trading_artifact==0) then diplo_text=string(trade_msg)+"\n"; - if (trading_artifact!=0) or (liscensing>0) then diplo_text="[[Trade Accepted.]]\n"; - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="An interesting proposal. I look forward to the fruition of this deal."; - if (rando==2) then diplo_text+="Agreed, may the Emperor bless us both."; - if (rando==3) then diplo_text+="Exactly what I wished for; this will benefit us both."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="Then we are in agreement."; - if (rando==2) then diplo_text+="Let it be so then and may it benefit us both."; - if (rando==3) then diplo_text+="This arrangement will be mutually beneficial."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="It goes against my instincts, but you have a deal."; - if (rando==2) then diplo_text+="I believe we shall both come to regret this, but I agree."; - if (rando==3) then diplo_text+="Try and play me for a fool and you will be destroyed, but I agree."; - } - } - if (diplo_keyphrase=="disagree"){ - if (trading_artifact==0) then diplo_text="[[Trade Refused]]\n"; - if (trading_artifact==1) then diplo_text=""; - annoyed[diplomacy]+=2; - if (rela=="friendly") and (annoyed[diplomacy]>=8){ - diplo_text+="I cannot help you at this time and advise that you cease pressing the matter."; - force_goodbye=1; - turns_ignored[diplomacy]=max(turns_ignored[diplomacy],1); - diplo_last=string(diplo_keyphrase); - diplo_char=0;diplo_alpha=0; - exit; - } - if (rela=="neutral") and (annoyed[diplomacy]>=6){ - diplo_text+="You are testing my patience, astartes."; - force_goodbye=1; - disposition[diplomacy]-=2; - turns_ignored[diplomacy]=max(turns_ignored[diplomacy],1); - diplo_last=string(diplo_keyphrase); - diplo_char=0; - diplo_alpha=0;exit; - } - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="I apologize but my resources must be directed in a different direction."; - if (rando==2) then diplo_text+="It pains me to deny you but I fear I must."; - if (rando==3) then diplo_text+="Unfortunately, I and my forces have a prior engagement."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="I do not believe this will help either of us."; - if (rando==2) then diplo_text+="Tempting... but no, I must decline."; - if (rando==3) then diplo_text+="Perhaps circumstances will change but for now I must decline."; - } - if (rela=="hostile"){ - disposition[diplomacy]-=2; - force_goodbye=1; - turns_ignored[diplomacy]=max(turns_ignored[diplomacy],3); - if (rando==1) then diplo_text+="Not even when the gates of the immaterium have closed, heretic!"; - if (rando==2) then diplo_text+="Heresy leaks from your every word. I would rather burn than agree."; - if (rando==3) then diplo_text+="You have either mistaken me for a fool or wish to offend me. Look to your sins, heretic."; - } - } - if (diplo_keyphrase=="attacked"){ - diplo_text="You shall pay dearly for this, as shall your entire chapter. So swears "+string(faction_leader[eFACTION.Inquisition])+"!"; - } - if (diplo_keyphrase=="declare_war") and (sorc=false){force_goodbye=1;turns_ignored[diplomacy]+=4; - diplo_text="You have stepped far beyond the acceptable conduct for an Astartes. Look to your sins and prepare to face the Emperor's judgment."; - } - if (diplo_keyphrase=="accept_peace"){ - diplo_text="For now, your judgement shall be postponed. Thank the Emperor for your respite, or perhaps whatever dark gods you now worship would be more appropriate."; - } - if (diplo_keyphrase=="ignored"){ - diplo_text="Idleness breeds heresy, marine, and I hear that you have been greatly idle of late."; - } - if (diplo_keyphrase=="denounced"){ - if (faction_justmet==1){ - disposition[diplomacy]-=15; - faction_justmet=0; - } - rando=choose(1,2,3); - if (rela=="friendly"){ - disposition[diplomacy]-=choose(0,1); - if (rando==1) then diplo_text="Words are wind and mean nothing between two servants of the Emperor's eternal glory."; - if (rando==2) then diplo_text="Your deeds speak far louder than the words that issue from your mouth, and they speak of heroism and loyalty."; - if (rando==3) then diplo_text="An ego is nothing more than a tool for the darkness to use against a servant of the Emperor. Say what you will of me."; - } - if (rela=="neutral"){ - disposition[diplomacy]-=2; - force_goodbye=1; - if (rando==1) then diplo_text="I cannot agree with what you have said, but perhaps you have your reasons. I hope they are good ones."; - if (rando==2) then diplo_text="I will remember what you said today and you will be held accountable."; - if (rando==3) then diplo_text="In the future, I ask that you consider what you are saying before you say it."; - } - if (rela=="hostile"){ - disposition[diplomacy]-=4; - force_goodbye=1; - if (rando==1) then diplo_text="You dare besmirch the honour of the Inquisition!? You have crossed a line this day!"; - if (rando==2) then diplo_text="The mouths of heretics are ever full of lies and filth."; - if (rando==3) then diplo_text="When you stand before the Emperor in death, He will remind you of what you said today."; - } - } - if (diplo_keyphrase=="praised"){ - if (faction_justmet==1){ - disposition[diplomacy]+=2; - faction_justmet=0; - } - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text="You flatter me, but it would be churlish to deny the truth in your words."; - if (rando==2) then diplo_text="You speak only the truth, noble Astartes, as is befitting of one of the Emperor's sons."; - if (rando==3) then diplo_text="Thanks are owed for your kind words and I cannot deny they are accurate."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="I will remember those words, but they will not stay my blade if your actions call for it to fall."; - if (rando==2) then diplo_text="If only I could believe your actions were as pure as your words."; - if (rando==3) then diplo_text="I thank you for the compliment but it will not turn my course."; - } - if (rela=="hostile"){ - disposition[diplomacy]-=1; - force_goodbye=1; - if (rando==1) then diplo_text="If you think kissing my boots will make me overlook your crimes you are sorely mistaken."; - if (rando==2) then diplo_text="For a true servant of mankind's Emperor, compliments mean nothing. Only vindication in serving him brings us satisfaction."; - if (rando==3) then diplo_text="Take your liar's, heretic tongue elsewhere, lest I cut it out and roast it on an open fire."; - } - } - if (diplo_keyphrase=="offer"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text="I believe we would both benefit greatly from an exchange."; - if (rando==2) then diplo_text="A trade of goods and services would be most useful at this time."; - if (rando==3) then diplo_text="Do you wish to trade with me for some of the resources in my possession?"; - } - if (diplo_keyphrase=="open_trade") then diplo_text="Make me an offer and I shall consider it, both for its value and its potential heresy."; - if (diplo_keyphrase=="artifact"){ - add_diplomacy_option({option_text:"Propose a trade for the Artifact."}); - add_diplomacy_option({option_text:"Leave it be; Exit."}); - diplo_text="The Inquisition is, of course, aware of the artifact in question. What, precisely, are you offering for it?"; - } - if (diplo_keyphrase=="artifact_thanks"){ - diplo_text="You have earned the gratitude of the Inquisition, my friend, and you shall be rewarded. This artifact will serve as a reminder of my debt to you."; - } - if (diplo_keyphrase=="stc_thanks"){ - rando=choose(1,2,3); - if (rela="friendly"){ - if (rando==1) then diplo_text+="A treasured relic of the Imperium’s glorious past? You do us great honour, Chapter Master."; - if (rando==2) then diplo_text+="As wise as you are fearsome, you choose to place this sacred relic in the care of the Inquisition. We thank you."; - if (rando==3) then diplo_text+="Your decision shows you to be a skilful leader, Chapter Master, for only the Inquisition can be trusted with such a hallowed relic."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="It is just that you choose to entrusts such a precious relic to the Inquisition, mankind’s most stalwart defenders in this dark age."; - if (rando==2) then diplo_text+="Such artifacts may provide a return to the Golden age of Mankind and the Inquisition are the best candidates to guide us there. Wise decision, Space Marine."; - if (rando==3) then diplo_text+="While you smite the Heretic and the Xenos, the Inquisition will will bring light to the sector with this artifact."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="You think that the Inquisition forgive slights simply because you hand us gifts? You are wrong, we take it to remove it from your heretical grasp."; - if (rando==2) then diplo_text+="And where did you acquire such an artefact? From your daemonical accomplices? This device bares careful consideration."; - if (rando==3) then diplo_text+="A relic owned by a being such as you cannot be taken at face value, much like the honeyed words of a serpent. We are watching you, Astartes."; - } - } - if (diplo_keyphrase=="artifact_daemon"){ - if (rela=="friendly") then diplo_text="There are few Astartes who have the wisdom and the humility to recognise when their own abilities are not suited to the task in hand. You are one Marine in a thousand, my friend. The Inquisition shall not forget your humble service to the Emperor."; - if (rela=="neutral") then diplo_text="The Inquisition will guard this artifact well, I swear it. Only when it has been assured that the foul daemon contained within has no chance of escape will it be used against the Emperor's enemies. Well done, Astartes, you have done the right thing."; - if (rela=="hostile") then diplo_text="Only the truest, most noble and most incorruptible servants of the Emperor can be trusted with such an artifact. None but the Inquisition have the immutable will to wield such things. Despite the mistakes you have made in the past, it is good that you have recognised our superiority. Perhaps there is hope for you still, but I doubt it."; - } - if (diplo_keyphrase=="artifact_returned"){ - scr_quest(3,"artifact_return",4,0); - diplo_text="It is well that you have returned the artifact, late though it may be."; - if (rela=="friendly") then diplo_text+=" Do not let this happen again."; - if (rela!="friendly") then diplo_text+=" Our faith was still poorly placed- if you fail another task there will be dire consequences for your chapter. Is this understood?"; - } - if (diplo_keyphrase=="artifact_angry"){ - diplo_text="No man, no woman, no marine, no heretic and no piece of xenos scum steals from the Inquisition and escapes unmarked. There will be a reckoning."; - } - if (diplo_keyphrase=="gene_trade"){ - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text="Chapter Master, even a hero of the Imperium like yourself must abide by the rules of the great Codex Astartes. Please desist in the trading of Gene-seed immediately."; - if (rando==2) then diplo_text="As loathe as I am to reprimand you, I must demand that you cease trading away the genetic material of your chapter."; - if (rando==3) then diplo_text="Normally, I would leave the running of your chapter in your very capable hands. But the trading of your Gene-seed must stop and I will not be moved on this."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="Even Astartes are held to the rule of Law. And those laws decree that Gene-seed is to remain within the Chapter of its origin."; - if (rando==2) then diplo_text="No matter what was offered, a true Astartes does not barter away what is both their birthright and their future. The trading of your Gene-seed must stop."; - if (rando==3) then diplo_text="The Imperium allows Chapter Masters free hands in most of their dealings, but on the trading of Gene-seed we must shackle you, firmly and completely."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="You look like a heretic, sound like a heretic and act like a heretic, for only a heretic would place such little store on their own Gene-seed. Prove I am mistaken or there will be dire consequences."; - if (rando==2) then diplo_text="By Holy Terra, I need but one more reason to wipe the stain of your existence from the universe and if you do not cease trading in Genetic material, I will have it."; - if (rando==3) then diplo_text="When you choose to act outside the rule of Law and trade in forbidden substances, the Inquisition will either bring you back to the Law or bring the Law to you."; - } - gene_sold=0; - // diplo_text="[Missing Dialogue: gene_angry]"; - } - if (diplo_keyphrase=="gene_xeno"){ - rando=choose(1,2,3);// diplo_text="[Missing Dialogue: gene_xeno]"; - if (rando==1) then diplo_text="You risk the sanctitude of the Emperor's holy sons, the Adeptus Astartes, and for what? Some paltry material reward? You will reap the seeds you have sown, traitor."; - if (rando==2) then diplo_text="No matter your past deeds, you are now an enemy of the Imperium. Only an enemy would give away our most valued secret, the base of the Astartes themselves."; - if (rando==3) then diplo_text="You have handed away the root of the Imperium's most powerful warriors to foul xenos. Did you truly believe a crime of this magnitude would escape the eye of the Imperium?"; - faction_status[diplomacy]="War"; - var lol=""; - lol=string(obj_controller.faction_title[diplomacy])+" "+string(obj_controller.faction_leader[diplomacy])+$" declares war on the {global.chapter_name}."; - scr_event_log("red",lol); - force_goodbye=1; - gene_xeno=0; - } - if (diplo_keyphrase=="trading_demand"){ - if (rela=="friendly") then diplo_text="Remember whom you speak to, Chapter Master."; - if (rela=="neutral") then diplo_text=$"I, Inquisitor Lord {faction_leader[eFACTION.Inquisition]}, on behalf of the Inquisition, am awaiting your words."; - if (rela=="hostile") then diplo_text="Speak your next words very carefully, Astartes, for they may be your last."; - add_diplomacy_option({ - option_text:"Demand Requisition" - }); - - - add_diplomacy_option({ - option_text:"Skip Inspection", - choice_func : inquis_demand_inspection_pass, - }); - - if (inspection_passes>0){ - add_diplomacy_option({ - option_text:"Skip Inspection (Use pass)", - choice_func : inquis_use_inspection_pass - }); - } - add_diplomacy_option({ - option_text:"Cancel", - goto:"disagree" - }); - } - if (diplo_keyphrase=="penitent_end"){ - rando=choose(1,2); - if (rando==1) then diplo_text="It seems that congratulations are in order. While some might think the Inquisition blind to the possibility that it, that is to say we, could ever do wrong, it is not so. I know that we are as fallible as any man, save the Emperor, and can make mistakes when judging character. I took you for a traitor to humanity's cause. I see that I was wrong now and let it not be said I will not give credit where it is due; well done, Chapter Master. May the enemies of mankind speak your name in fear and humanity in adoration."; - if (rando==2) then diplo_text="Few return from a penitent crusade, Chapter Master, and I find that those who do are invariably changed by the experience. Tell me, do you feel your vision expanded? Your faults exposed and then erased by his glorious light? I do not doubt that you do. To battle the Emperor's enemies without any thought of pause or relief is the highest form of honour, the highest form of service. You are to be congratulated on your diligence and dedication, not to mention your skill at arms."; - } - if (diplo_keyphrase == "assassination_angry"){ - // aa|planet_name|planet number| - - - var _event = audience_data; - var _system = _event.system; - var _planet = _event.planet; - var _star_name = planet_numeral_name(_planet, star_by_name(_system)) - diplo_text=$"My patience is wearing thin, Chapter Master. I have many more problems more urgent and, yet, you continue to force me away from the work assigned to me by He on Terra. Your serf on {_star_name} will be executed along with all the other puppets I ferret out. You are close to treason, Chapter Master. Choose your next words with exceptional care for they may be your last."; - - add_diplomacy_option({ - option_text:"It will not happen again", - key : "serf_removal_submit", - choice_func : function(){ - scr_dialogue("you_better"); - force_goodbye=1; - hunt_player_serfs(audience_data.planet, audience_data.system); - alter_dispositions([ - [eFACTION.Imperium, -15], - [eFACTION.Inquisition, -30], - [eFACTION.Ecclesiarchy, -10], - ]); - exit; - } - }); - add_diplomacy_option({ - option_text:"Very well", - key : "serf_removal_accept", - choice_func : function(){ - force_goodbye=1; - - hunt_player_serfs(audience_data.planet, audience_data.system); - - alter_dispositions([ - [eFACTION.Imperium, -15], - [eFACTION.Inquisition, -30], - [eFACTION.Ecclesiarchy, -10], - ]); - exit; - } - }); - - if (obj_controller.disposition[eFACTION.Inquisition] >= 70){ - add_diplomacy_option({ - option_text:"Perhaps We can come to an arrangement", - tooltip : "This action will trigger a Charisma test", - choice_func : function(){ - - } - }); - } - add_diplomacy_option({ - option_text:$"You will not. {_star_name} is MINE!", - key : "serf_removal_defy", - force_goodbye : 1, - choice_func : function(){ - alter_dispositions([ - [eFACTION.Imperium, -30], - [eFACTION.Inquisition, -60], - [eFACTION.Ecclesiarchy, -30], - ]); - }, - goto : "die_heretic", - }); - } - if (diplo_keyphrase=="you_better"){ - rando=choose(1,2); - if (rando==1) then diplo_text="I do not know if you are guided by choice or incompetence, Chapter Master, however you are not the only player in this most dangerous game you insist upon pursuing. There is no more room for failure."; - if (rando==2) then diplo_text="Ensure this is your last mistake, Chapter Master. You and your ivory tower you think stand so tall above man is not indestructible."; - } - if (diplo_keyphrase=="die_heretic"){ - rando=choose(1,1,2); - if (rando==1) then diplo_text="Very well, Chapter Master. I will bury you and your Chapter so thoroughly even I will forget your existence."; - if (rando==2){ - if (obj_ini.fleet_type==ePlayerBase.home_world) then diplo_text="I understand. I am authorizing the deployment of cyclonic torpedoes. Make peace with your homeworld, Chapter Master."; - if (obj_ini.fleet_type != ePlayerBase.home_world) then diplo_text="I am mobilizing the Segmentum battlefleet. You may run, heretic, but it will do you no good."; - } - var ev=0; - add_event({ - e_id : "game_over_man", - duration : 1, - }) - } - rando=choose(1,2,3); - if (diplo_keyphrase=="chaos_audience1"){ - force_goodbye=1; - if (rando==1) then diplo_text="I have been notified of your corrospondences with "+string(faction_leader[eFACTION.Chaos])+". There is no reason for you to talk to such a villain, your only interactions should be both short lived and extremely violent."; - if (rando==2) then diplo_text="Whatever your reasons for seeking an audience with traitors, they can not be sufficient and I trust you will not repeat your mistake."; - if (rando==3) then diplo_text="The words of those who have turned from His light are not worth risking the sanctity of your soul to listen to."; - } - if (diplo_keyphrase=="chaos_audience2"){ - force_goodbye=1; - if (rando==1) then diplo_text="If you give aid to or converse with a heretic or a traitor, you're either a heretic or a traitor. Either way, consider yourself under close scrutiny, Chapter Master."; - if (rando==2) then diplo_text="The only people who have any desire to hear the poison that spews from the lips of heretics are other heretics. You have been warned."; - if (rando==3) then diplo_text="I can only conclude that you have no conception of how despicable your actions are because you have lost all feeling for how heretical it is to converse with a heretic."; - } - if (diplo_keyphrase=="sorcery1"){ - force_goodbye=1; - if (rando==1) then diplo_text="It pains me to see an Astartes debase his chapter by using the tools of a heretic, especially when you have access to sanctioned psyker powers. Ensure that it does not happen again."; - if (rando==2) then diplo_text="The use of magik and sorcery in place of those powers deemed acceptable by the Imperium is simply not acceptable, Chapter Master. You have been warned."; - if (rando==3) then diplo_text="Please desist from wielding the same weapons as heretics, traitors and chaos filth, lest you become one of them."; - } - if (diplo_keyphrase=="sorcery2") or (sorc==true){ - rando=choose(1,1,2,2,2,3,3,3); - force_goodbye=1; - turns_ignored[diplomacy]+=4; - if (rando==1) then diplo_text="Did you not think that the Inquisition might notice the use of sorcerous and heretical powers? You are either foolish beyond belief or wish for your own destruction."; - if (rando==2) then diplo_text="To wield such heretical powers in the face of an Inquisitorial inspection speaks of a traitorous streak so deep it can only be purged with fire."; - if (rando==3) then diplo_text="You wield the weapons of a traitor, probably gifted to you by a daemonic ally, and you will be dealt with as a traitor; you will be purged."; - } - if (diplo_keyphrase=="loyalty_zero"){ - disposition[2]-=20; - disposition[3]-=15; - disposition[4]-=20; - disposition[5]-=20; - diplo_text="Your arrogant, blatant disregard for proper Imperial conduct can no longer go unanswered, Astartes. Time and time again you have ignored the Imperium's call to arms, refusing to strike out at the enemies of man when it was most needed, and callously ignored the Inquisition's wants. It has become clear that you are not in line with the High Lords of Terra and His will. This heresy must be cut from your Chapter like the festering blight it is. You may either atone for your Chapter's crimes, in penitence, or see it ground to dust around you."; - // Speak your next words carefully, Chapter Master, for they may damn all the souls of your men to oblivion. - - add_diplomacy_option({option_text:"You are right in that we must account for our sins. Let our Penitence begin.", goto : "loyalty_penitence"}); - add_diplomacy_option({option_text:"I answer only to the Emperor himself, not to the likes of you.",goto:"die_heretic"}); - add_diplomacy_option({option_text:"Threaten my Chapter at your own peril.", goto:"die_heretic"}); - } - if (diplo_keyphrase=="loyalty_penitence"){ - diplo_text="Brothers, hear my words! It is time to embark on a sacred journey of redemption, a penitence crusade to cleanse our souls. Our past wrongdoings have led us astray form the Emperor, but through unwavering determination and righteous deeds, we shall forge a path to absolution. With every battle fought, every sacrifice made, we shall restore honor to our name and rekindle the flame of righteousness within. "; - - var tx=$"The {global.chapter_name} become Penitent."; - scr_alert("green","halp",string(tx),0,0); - scr_event_log("",string(tx)); - - var str=round((marines+command)/130); - obj_ini.penitent=1; - obj_ini.penitent_current=0; - obj_ini.penitent_max=(str*1000)+300; - obj_ini.penitent_end=str*48; - obj_controller.penitent=1; - obj_controller.penitent_current=0; - obj_controller.penitent_max=obj_ini.penitent_max; - obj_controller.penitent_end=obj_ini.penitent_end; - - loyalty=50; - loyalty_hidden=50; - force_goodbye=1; - } - } - // ** Ecclesiarchy ** - if (diplomacy==5){ - var _diag_data = { - faction_leader:faction_leader[eFACTION.Ecclesiarchy], - sector:obj_ini.sector_name, - relationship : rela, - annoyed:annoyed[diplomacy], - turns_ignored :turns_ignored[diplomacy], - chapter_name :global.chapter_name, - master_name : obj_ini.master_name, - faction_status:obj_controller.faction_status[eFACTION.Ecclesiarchy] - } - var _diag_set = global.dialogue.sisters; - diplo_text = create_dialogue_string(global.dialogue.sisters, diplo_keyphrase,_diag_data); - - if(struct_exists(data,"prepend")){ - diplo_text=$"{data.prepend} {diplo_text}" - } - - if (diplo_keyphrase=="disagree"){ - if (trading_artifact==0) then diplo_text="[[Trade Refused]]\n"; - if (trading_artifact==1) then diplo_text=""; - annoyed[diplomacy]+=2; - if (rela=="neutral") and (_diag_data.annoyed>=8){ - force_goodbye=1; - turns_ignored[diplomacy]=max(turns_ignored[diplomacy],1); - diplo_last=string(diplo_keyphrase); - diplo_char=0; - diplo_alpha=0; - exit; - } - - if (rela=="hostile"){ - force_goodbye=choose(0,1); - if (_diag_data.annoyed>=4){ - turns_ignored[diplomacy]=max(turns_ignored[diplomacy],1); - diplo_last=string(diplo_keyphrase); - diplo_char=0; - diplo_alpha=0; - } - } - } - if (diplo_keyphrase=="declare_war"){ - force_goodbye=1; - turns_ignored[diplomacy]+=4; - known[diplomacy]=max(2,known[diplomacy]); - } - if (diplo_keyphrase=="denounced"){ - if (faction_justmet==1){ - disposition[diplomacy]-=5; - faction_justmet=0; - } - scr_loyalty("Irreverance for His Servants","+"); - } - if (diplo_keyphrase=="praised"){ - if (faction_justmet==1){ - alter_disposition(diplomacy,3); - faction_justmet=0; - } - - } - - if (diplo_keyphrase=="artifact"){ - add_diplomacy_option({ - option_text:create_dialogue_string(_diag_set, "propose_arti_trade",_diag_data), - }); - add_diplomacy_option({ - option_text:create_dialogue_string(_diag_set, "leave_it",_diag_data), - }); - - } - - if (diplo_keyphrase=="artifact_daemon"){ - if (rela=="friendly"){ - obj_controller.disposition[5]-=2; - } - else if (rela=="neutral"){ - obj_controller.disposition[5]-=6; - } - else if (rela=="hostile"){ - obj_controller.disposition[5]-=10; - } - if (_diag_data.faction_status=="Allied"){ - obj_controller.faction_status[eFACTION.Ecclesiarchy]="Antagonism"; - } - } - - if (diplo_keyphrase=="trading_demand"){ - add_diplomacy_option({ - option_text:"Demand Requisition" - }); - add_diplomacy_option({ - option_text:"Cancel", - goto:"disagree" - }); - } - } - // ** Eldar ** - if (diplomacy=6){ - if (string_count("intro",diplo_keyphrase)>0){ - if (faction_gender[6]==1) then diplo_text="[["+string(faction_leader[diplomacy])+" is a farseer, or witch, of the eldar. He is dressed in a typical fashion of his position, clad in flowing black cloth and bone-like armour. Almost seeming to relish in conflict, this xeno is known in local records for "+choose("sudden raid on trade vessels","assassinating a pair of planetary govererners")+". It is unlikely "+string(faction_leader[diplomacy])+" will be receptive to diplomacy- further audiences are ill-advised.]]"; - if (faction_gender[6]==2){ - rando=choose(1,2,3); - diplo_text="[["+string(faction_leader[diplomacy])+" is a witch; an old farseer of eldar kind. While obviously a female, the grating voice and inhuman proportions are an unholy mockery of the human form. She seems to avoid contact with the Imperium, as is befitting a xeno. Little is known about "+string(faction_leader[diplomacy])+", other than "; - if (rando==1) then diplo_text+="random1."; - if (rando==2) then diplo_text+="random2."; - if (rando==3){ - diplo_text+="rumors of her involvement at the massacre of "; - diplo_text+=global.name_generator.generate_star_name(); - diplo_text+=" "+choose("I.","II.","III.","IV."); - } - diplo_text+=" Do not expect futher contact.]]"; - } - diplo_text+="\n#"; - // * Normal craftworld reveal * - if (string_count("1",diplo_keyphrase)>0){ - if (scr_has_adv("Enemy: Eldar")){ - diplo_text+="This is our home, Mon'keigh. Leave it in peace or feel the full wrath of Kaela Mensha Khaine."; - } else { - if (scr_has_disadv("Tolerant")){ - diplo_text+="Your future is clouded, human. Will you be a tool, or a thorn in our side?"; - } else { - diplo_text+="Another repulsive Mon'keigh. Leave the Eldar alone, primitive. You have no idea what you face."; - } - } - } - // * Running into eldar ships * - if (string_count("2",diplo_keyphrase)>0){ - if (scr_has_disadv("Tolerant")) and (!scr_has_adv("Enemy: Eldar")){ - diplo_text+="This meeting is long since due. I pray that you pull back your forces, "+string(obj_ini.master_name)+". None of this concerns you."; - } else { - diplo_text+="You do not understand that which you trifle with. Leave or be eradicated."; - } - } - // * Request audience * - if (diplo_keyphrase=="intro"){ - if (scr_has_adv("Enemy: Eldar")){ - diplo_text+="Another repulsive Mon'keigh. Leave the Eldar alone, primitive, you have no idea what you face."; - } else { - if (scr_has_disadv("Tolerant")) { - diplo_text+="We have been expecting you, "+string(obj_ini.master_name)+"."; - } else { - diplo_text+="The skeins have foretold of our meeting, Space Marine."; - } - } - } - diplo_text+=tempd; - } - if (diplo_keyphrase=="hello"){ - if (rela=="friendly") then diplo_text=choose("For what reason does "+string(obj_ini.master_name)+" seek an audience?","You require something, "+string(obj_ini.master_name)+"?","I have a moment or two to spare. Speak."); - if (rela=="neutral") then diplo_text=choose("I hope you have good reason for this audience.","What is it, space marine?","Do not waste my time."); - if (rela=="hostile"){ - rando=floor(random(100))+1; - if (rando>0) and (rando<=32) then diplo_text="What is it, mon-keigh?"; - if (rando>32) and (rando<=64) then diplo_text="Do not waste my time."; - if (rando>64) and (rando<=95) then diplo_text="What is the quickest way I may be rid of you?"; - if (rando>95) and (rando<=99) then diplo_text="The runes did not foretell listening to your blabbering Mon-keigh mouth."; - if (rando==100) then diplo_text="I have little patience for your antics. You... you... DOUBLE MON-KEIGH."; - } - } - if (diplo_keyphrase=="trade_close"){ - if (rela=="friendly") then diplo_text="While you are intelligent for a Mon'keigh, I sometimes forget the limitations of your race. You find it difficult to plan ahead with any efficiency, so I do not take this as a slight."; - if (rela=="neutral") then diplo_text="Oh, did you see a pretty light? Why don't you go and chase it? I shall return to my own affairs, which are far beyond your understanding."; - if (rela=="hostile") then diplo_text="Typical Mon'keigh, confused in its intentions to the point of injuring itself. Contact me again when you've climbed a few rungs higher on the evolutionary ladder."; - } - if (diplo_keyphrase=="demand_refused"){ - rando=choose(1,2); - if (rela=="friendly"){ - if (rando==1) then diplo_text="While I would like to help you, there are more important things afoot in the galaxy than your problem."; - if (rando==2) then diplo_text="Mon'keigh, I would like to help you but I cannot currently."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="I have heard words like these a thousand times from Mon'keigh. And I can only give you one answer; No."; - if (rando==2) then diplo_text=" If you could only understand the complexity of my schemes... then perhaps you would understand why I cannot currently help you. Alas, my plans are far beyond your feeble mind."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="Children such as yourself should not be as presumptuous with their elders and betters."; - if (rando==2) then diplo_text="Seek not the reasons for my denial of what you seek, know only that you have neither the skill to find them nor the wisdom to interpret them."; - } - } - if (diplo_keyphrase=="agree"){ - if (trading_artifact==0) then diplo_text=string(trade_msg)+"\n"; - if (trading_artifact!=0) then diplo_text="[[Trade Accepted.]]\n"; - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="We are agreed."; - if (rando==2) then diplo_text+="Very well."; - if (rando==3) then diplo_text+="Your logic is clear."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="Hmm. I will say yes...this time."; - if (rando==2) then diplo_text+="Fine, we'll do it your way."; - if (rando==3) then diplo_text+="An unlikely alliance, at best. Still, it shall happen."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="It appears I have no other choice but to do as you say Mon'keigh."; - if (rando==2) then diplo_text+="A repulsive way to put it, Mon'keigh...but yes."; - if (rando==3) then diplo_text+="I agree, though not for the reasons you present."; - } - } - if (diplo_keyphrase=="disagree"){ - if (trading_artifact==0) then diplo_text="[[Trade Refused]]\n"; - if (trading_artifact==1) then diplo_text=""; - annoyed[diplomacy]+=2; - if (rela=="friendly") and (annoyed[diplomacy]>=6){ - diplo_text+="You test my boundries, "+string(obj_ini.master_name)+", and I find tiresome."; - force_goodbye=1; - turns_ignored[diplomacy]=max(turns_ignored[diplomacy],2); - diplo_last=string(diplo_keyphrase); - diplo_char=0; - diplo_alpha=0; - exit; - } - if (rela!="friendly") and (annoyed[diplomacy]>=4){ - diplo_text+=choose("I will suffer your presence no longer.","Expect consequences for this offense");force_goodbye=1; - turns_ignored[diplomacy]=max(turns_ignored[diplomacy],4); - diplo_last=string(diplo_keyphrase); - diplo_char=0; - diplo_alpha=0; - exit; - } - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="You test my patience, "+string(obj_ini.master_name)+"."; - if (rando==2) then diplo_text+="I see no good coming of this."; - if (rando==3) then diplo_text+="I must decline."; - // 25% chance to close window - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="This is of no concern to us."; - if (rando==2) then diplo_text+="I cannot allow such a deal."; - if (rando==3) then diplo_text+="Simply unacceptable."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="Remember your place, mon-keigh."; - if (rando==2) then diplo_text+="Do not insult me with such an offer."; - if (rando==3) then diplo_text+="Expect consequences for this offense."; - force_goodbye=choose(0,0,0,1); - } - } - if (diplo_keyphrase=="attacked"){ - if (rela!="friendly") then diplo_text="Normal 'we were attacked' line goes here."; - if (rela=="friendly") then diplo_text="I would say 'you should know better', "+string(obj_ini.master_name)+", but children are incapable of acting with wisdom, as is their nature.\nThis act of war obliges us to respond in kind. I expect to see you upon the fields of battle."; - } - if (diplo_keyphrase=="declare_war"){ - force_goodbye=1; - turns_ignored[diplomacy]+=4; - diplo_text="The Bloody-Handed God calls for your destruction. We shall only rest when your filth is cleansed from this sector."; - } - if (diplo_keyphrase=="accept_peace"){ - diplo_text="A civilization does not survive for as long as ours has without knowing when to put down its weapons. One must also know when to use them again, however."; - } - /*if (diplo_keyphrase="ignored"){ + // diplo_last=""; + + with (obj_controller) { + // diplo_keyphrase = keyphrase + + clear_diplo_choices(); + if (diplomacy == -1) { + if (is_struct(character_diplomacy)) { + if (_unit.role == "Forge Master") { + if (diplo_keyphrase == "intro") { + diplo_text = "Chapter Master. What may "; + iplomacy_option({ + option_text: "The Imperium and Inquisition's ignorance and hypocrisy will be the death of my Chapter.", + goto: _goto, + }); + } + } + } + } + var event_log = ""; + var rando = 0, tempd = "", sorc = false; + var rela, trade_msg; + + rela = "neutral"; + trade_msg = "[[Trade Accepted. Shipment initialized.]]"; + + diplo_txt = ""; + diplo_text = ""; + + // show_message(string(diplo_keyphrase)); + + if ((diplo_keyphrase == "declare_war") && (faction_status[diplomacy] != "War")) { + faction_status[diplomacy] = "War"; + event_log = string(obj_controller.faction_title[diplomacy]) + " " + string(obj_controller.faction_leader[diplomacy]) + $" declares war on the {global.chapter_name}."; + scr_event_log("red", event_log); + + if ((string_count("|SC|", obj_controller.useful_info) > 1) && (diplomacy == 4)) { + sorc = true; + } + } + if ((diplo_keyphrase == "declare_war") && (string_count("|SC|", obj_controller.useful_info) > 1) && (diplomacy == 4)) { + sorc = true; + } + + if ((diplo_keyphrase == "intro") || (diplo_keyphrase == "intro1") || ((diplomacy == 10) && (diplo_keyphrase == "intro2"))) { + event_log = $"Chapter Master {obj_ini.master_name} meets the {obj_controller.faction[diplomacy]} {obj_controller.faction_title[diplomacy]}, {obj_controller.faction_leader[diplomacy]}."; + scr_event_log("", event_log); + } + + var dip_score = diplomacy; + // repeat(3){ + // i+=1; + rela = "neutral"; + if (diplomacy > 0) { + rela = relationship_hostility_matrix(diplomacy); + // */ + } + // if (i<=5) and (fleet_type=3) and (rela="hostile") then rela="neutral"; + // } + + // ** Chaos Meetings ** + if (diplo_keyphrase == "cs_meeting1") { + diplomacy = 10; + diplo_text = $"So you have brought yourself before me {obj_ini.master_name}. This pleases me. You are not the first among the Astartes to come to me. Do not look so shocked. Many have gazed upon the decay and decrepitude of the Imperium with open eyes, and heard the empty slogans of the Corpse Emperor with fresh ears and come to the realization I had so many long millennia ago. There is only one truth in the universe, one path worthy of an Astartes to walk. The path of true power. The path of true insight into the nature of reality and what lies beyond. The path of Chaos. Only when free of the pointless bondage of the Imperium can we ascend to our rightful place in the universe."; + add_diplomacy_option({ + option_text: "[Continue]", + goto: "cs_meeting2", + }); + disposition[10] += 10; + } + // First branch of choices + if ((diplo_keyphrase == "cs_meeting2") || (diplo_keyphrase == "cs_meeting20")) { + diplomacy = 10; + // check for MoS here + var mos = false, ii = 0; + repeat (obj_temp_meeting.dudes) { + ii += 1; + if (mos == false) { + if (obj_ini.role[obj_temp_meeting.co[ii]][obj_temp_meeting.ide[ii]] == "Master of Sanctity") { + mos = true; + } + } + } + + if (diplo_keyphrase == "cs_meeting2") { + disposition[10] += 10; + } + + // Meeting2 + diplo_text = "But still I am puzzled by you /noble/ Astartes. You come before me and put yourself at my mercy. I could extinguish your life in an instant, crush you beneath my boot heel faster than the lowliest insect. These are not the actions of a Space Marine. Long have you fought for Him. So tell me then Astartes, why do you come to me now?"; + + // Meeting20 + if (diplo_keyphrase == "cs_meeting20") { + diplo_text = "[[A low rumbling growl issues from " + string(obj_controller.faction_leader[eFACTION.Chaos]) + "’s power armour before he speaks.]]\nI ask you for the last time Astartes. Why did you seek me out?"; + } + + if ((mos == true) && (diplo_keyphrase != "cs_meeting20")) { + add_diplomacy_option({ + option_text: "[Continue]", + goto: "cs_meeting_m1", + }); + } + + if ((mos == false) || (diplo_keyphrase == "cs_meeting20")) { + add_diplomacy_option({ + option_text: "The Imperium has bound us and kept us from our true potential. We seek strength.", + goto: "cs_meeting30", + }); + + // if over 30 Not convinced due to high inquisition dispositioin + var _goto = obj_controller.disposition[4] > 30 ? "cs_meeting45" : "cs_meeting40"; + add_diplomacy_option({ + option_text: "The Imperium and Inquisition's ignorance and hypocrisy will be the death of my Chapter.", + goto: _goto, + }); + + var testy = true; + if (obj_controller.faction_status[eFACTION.Imperium] == "War" || obj_controller.marines <= 600) { + testy = false; + } + if (testy == false) { + _goto = "cs_meeting50"; + } // Scurrying like a rat, accepts + if (testy == true) { + _goto = "cs_meeting55"; + } // Not convinced + + add_diplomacy_option({ + option_text: "Our enemies are many and our strength is diminished. We need allies to join with us while we rebuild our forces.", + goto: _goto, + }); + + add_diplomacy_option({ + option_text: "I sought you out to slay you with my own hands.", + goto: "cs_meeting60", + }); + } + } + if (diplo_keyphrase == "cs_meeting21") { + event_log = string(obj_ini.master_name) + $" kills the {global.chapter_name} Master of Sanctity for " + string(obj_controller.faction_leader[eFACTION.Chaos]) + "."; + scr_event_log("purple", event_log); + // scr_alert("purple","lol",string(tix),0,0); + + diplo_text = $"As the echoes fade, it becomes clear that the Master of Sanctity of {global.chapter_name} has fallen."; + add_diplomacy_option({ + option_text: "[Continue]", + goto: "cs_meeting135", + }); + } + // MoS cuts in + if (diplo_keyphrase == "cs_meeting_m1") { + diplomacy = -5.2; + diplo_text = $"[[{obj_ini.name[0][3]} hisses your name over a private vox channel.]]\n"; + diplo_text += "My lord! What are we doing here, treating with this monster of the Traitor Legions? The very existence of the Archenemy is a threat to everything the Chapter stands for, and we endanger our immortal souls just being here. You know this! I demand to know your intentions! And I warn you, I will not hesitate to do what I must, for the good of the Chapter and the Imperium."; + + var _goto = "cs_meeting_m2"; + add_diplomacy_option({ + option_text: "Times change and the Chapter must change with them or be ground into the dust of history. (Chaos)", + goto: _goto, + }); + add_diplomacy_option({ + option_text: "We will not serve the Imperium’s crooked ends any longer. Our Chapter will control its own destiny. (Renegade)", + goto: _goto, + }); + add_diplomacy_option({ + option_text: "I haven’t turned traitor and my faith is strong. The Beast has foolishly opened its lair to us. Be ready for my signal.", + goto: _goto, + }); + + // Option4 here if all the right conditions are met + var born = false; + for (var ii = 1; i <= 200; i++) { + if ((obj_ini.role[0][ii] == obj_ini.role[100][eROLE.ChapterMaster]) && (string_count("$", obj_ini.spe[0][ii]) > 0)) { + born = true; + } + } + + if ((obj_ini.TTRPG[0][3].corruption >= 50) && (born == true)) { + add_diplomacy_option({ + option_text: "Right now I need my Master of Sanctity at my side, trusting that his Chapter Master is doing what is best, what is necessary for the Chapter, during this dangerous moment. All will be made clear in time, I promise you brother. This is the right path.", + goto: "cs_meeting_m3", + }); + } + } + if (diplo_keyphrase == "cs_meeting_m2") { + event_log = $"The {global.chapter_name} Master of Sanctity takes a stand against you."; + scr_event_log("purple", event_log); // scr_alert("purple","lol",string(tix),0,0); + diplo_text = "You have besmirched the honor of our chapter this day, and I will not forget it /my lord Chapter Master/.\n[[" + string(obj_ini.name[0][3]) + " strides forward and his shout erupts from his external vox speakers with a boom that shatters the silence in the room.]]\nWe will not stand idly by and bandy words with heretic scum! To me my brothers! Slay these traitors in the name of our Emperor!"; + add_diplomacy_option({ + option_text: "[Continue]", + goto: "cs_meeting9", + }); + } + if (diplo_keyphrase == "cs_meeting_m3") { + diplo_text = "[[" + string(obj_ini.name[0][3]) + " is silent for a moment, before giving you an imperceptible nod.]]\nI stand with you, Lord " + string(obj_ini.master_name) + ". Let us face this together."; + add_diplomacy_option({ + option_text: "[Continue]", + goto: "cs_meeting20", + }); + obj_controller.useful_info += "CRMOS|"; + } + if (diplo_keyphrase == "cs_meeting_m5") { + diplomacy = -5.2; + instance_activate_all(); + diplo_text = "By the sacred oath I have sworn, I bear witness to your darkest secrets. Know this: I am compelled to report your heresy to the Inquisition. Redemption or retribution, their verdict shall decide. May the Emperor's mercy guide your path."; + + add_diplomacy_option({ + option_text: "Very well. I did what must be done for my brothers, and now accept the price. [Game Over]", + goto: "cs_meeting_m6", + }); + add_diplomacy_option({ + option_text: $"Never! [Battle Loyalist {global.chapter_name}]", + goto: "cs_meeting_battle7", + }); + } + if (diplo_keyphrase == "cs_meeting_m6") { + global.defeat = 3; + obj_controller.alarm[7] = 5; + } + if (diplo_keyphrase == "cs_meeting9") { + diplomacy = 10; + + diplo_text = $"[[{obj_controller.faction_leader[eFACTION.Chaos]} turns to you, his voice even and calm]]\n\nHere is the first step you must take, to prove you’ve truly left the Imperium behind. Kill him. Kill your loyal brothers.\n[[His Chaos Terminators raise their weapons as one and point them at you. Somewhere behind them a daemon cackles.]]\nChoose now or be obliterated."; + + var _master_of_sanct = fetch_unit([0, 3]); + + var _string = $"Stand with me my brothers! Fight for the future of your Chapter, and slay {_master_of_sanct.name()}! [Battle loyalist {global.chapter_name}"; + add_diplomacy_option({ + option_text: _string, + goto: "cs_meeting_battle1", + goto: "cs_meeting_battle1", + }); + + var _string = $"{global.chapter_name}, I order you to hold your fire! {_master_of_sanct.name()}, if you doubt my leadership then let it be decided by single combat! [Duel your Master of Sanctity]"; + add_diplomacy_option({ + option_text: _string, + goto: "cs_meeting_battle2", + }); + + var _string = $"I deny you {obj_controller.faction_leader[eFACTION.Chaos]}. And now I shall destroy you. For the Emperor! [Attack Chaos forces]"; + add_diplomacy_option({ + option_text: _string, + goto: "cs_meeting_battle5", + }); + } + + // First explanation for chaos + if (diplo_keyphrase == "cs_meeting30") { + diplo_text = "Then you have awakened to the truth the Imperium so hypocritically denies, that there is only one real power in the universe, and it goes to those with the will to seize it."; + add_diplomacy_option({ + option_text: "[Continue]", + goto: "cs_meeting135", + }); + disposition[10] += 30; + } + // Fucking inquisition + if (diplo_keyphrase == "cs_meeting40") { + diplo_text = "Yes...you do not fit the precious mold the Codex Astartes carves out for you, do you? And the Imperium destroys that which it cannot understand."; + add_diplomacy_option({ + option_text: "[Continue]", + goto: "cs_meeting135", + }); + disposition[10] += 30; + } + // Nah dawg + if (diplo_keyphrase == "cs_meeting45") { + diplo_text = $"Do you take me as a fool, {obj_ini.master_name}? Even in the Eye there are whispers of your running to and fro at the Inquisition’s beck and call, like a dog playing fetch. You’re a well-trained, and maybe even a clever, dog. I’ve killed so many clever dogs in my time. How do I know this isn’t just a hopelessly doomed plot to try and kill me, hatched by your Inquisition masters still holding your leash?"; + + add_diplomacy_option({ + option_text: "There are advantages to staying on the Inquisition’s good side, and I’m not one to ignore an advantage.", + goto: choose("cs_meeting46", "cs_meeting47"), + }); + add_diplomacy_option({ + option_text: "Appeasing the Inquisition is no hard choice when your options are obey, or eventually be branded a heretic and be destroyed.", + goto: choose("cs_meeting46", "cs_meeting47"), + }); + add_diplomacy_option({ + option_text: "Given enough time, everyone becomes a heretic in the eyes of the Inquisition. I will not wait for them to make their move against us.", + goto: choose("cs_meeting46", "cs_meeting47"), + }); + + var _string = "You have one thing right, {obj_controller.faction_leader[eFACTION.Chaos]}. I am here to kill you. Open fire brothers, NOW! [Battle Chaos forces]"; + add_diplomacy_option({ + option_text: _string, + goto: "cs_meeting_battle5", + goto: "cs_meeting_battle5", + }); + } + // Sorry brah, you're not their homie + if (diplo_keyphrase == "cs_meeting46") { + diplo_text = "I am not convinced. A shame. I was hoping you might actually be of use- but now it is apparent that your use will only be as a bloody, broken offering to the Dark Gods."; + add_diplomacy_option({ + option_text: "[Battle Chaos AND any loyalist forces]", + }); + add_diplomacy_option({ + option_text: "cs_meeting_battle6", + }); + } + // you might be their homie, fine + if (diplo_keyphrase == "cs_meeting47") { + diplo_text = "You may yet be of use to me. Very well, we will assist you. It will be no trouble at all to exterminate you, should you displease me at a future time."; + add_diplomacy_option({ + option_text: "[Continue]", + goto: "cs_meeting135", + }); + disposition[10] += 30; + } + // mah numbers + if (diplo_keyphrase == "cs_meeting50") { + diplo_text = "Yes we have seen you struggle alone, scurrying from shadow to shadow like a hunted rat. I won’t lie to you though, I’ve seen the potential in you and your….brothers. Alright, we will assist you. It will be no trouble at all to exterminate you, should you displease me."; + add_diplomacy_option({ + option_text: "[Continue]", + goto: "cs_meeting135", + }); + disposition[10] += 30; + } + // such numbers, wow + if (diplo_keyphrase == "cs_meeting55") { + diplo_text = "I could overrun this sector with half the warriors you have now. Is your “Chapter” so pathetic you need to throw scores more men into the meatgrinder to succeed? You have not convinced me. I'd have enjoyed making use of your Chapter, but this was clearly not meant to be. Make your peace."; + add_diplomacy_option({ + option_text: "[Battle Chaos AND any loyalist forces]", + }); + add_diplomacy_option({ + option_text: "cs_meeting_battle6", + }); + } + // Actually here to kill you + if (diplo_keyphrase == "cs_meeting60") { + var chaos_leader = obj_controller.faction_leader[eFACTION.Chaos]; + disposition[10] += 10; + diplo_text = $"[[{chaos_leader} is silent for a moment, then a slow chuckle rises from deep within his ancient power armour. The chuckle erupts into hideous laughter that chills your blood with its otherworldly tenor.]]\nI thank you, I have not truly laughed in three hundred years. I shall take your skull as a memento of this day and your fine jest. But before I do, indulge my curiosity. Let us say you did kill me, /then/ what would you do? Claim the price on my head? Go crawling back on your belly to your Imperial masters like a whipped cur, dragging your kill behind you? Become master of this sector yourself now that you’ve bested your greatest foe? Or perhaps you’d offer up my soul to the Dark Gods, ignorantly fumbling about in the darkness for their favor? Tell me."; + + add_diplomacy_option({ + option_text: "The reward for one such as you will be great, and I /will/ claim it.", + goto: "cs_meeting61", + }); + + add_diplomacy_option({ + option_text: "The atrocities you’ve visited on this sector are reason enough.", + goto: "cs_meeting63", + }); + add_diplomacy_option({ + option_text: $"You think me ignorant of the ways of Chaos, {chaos_leader}, but I know one truth. There is power in blood. Your blood. My power. They will hear me.", + goto: "cs_meeting65", + }); + add_diplomacy_option({ + option_text: $"I’m just tired of listening to you talk, {chaos_leader}.", + goto: "cs_meeting67", + }); + } + // Reward + if (diplo_keyphrase == "cs_meeting61") { + diplo_text = "It is this blind overconfidence that makes killing a Space Marine so satisfying."; + add_diplomacy_option({ + option_text: "[Battle Chaos forces]", + goto: "cs_meeting_battle5", + }); + } + // Atrocities + if (diplo_keyphrase == "cs_meeting63") { + diplo_text = "Oh, but I have one more atrocity to commit you simply shouldn’t miss..."; + add_diplomacy_option({ + option_text: "[Battle Chaos forces]", + goto: "cs_meeting_battle5", + }); + } + // BLOOD BLOOD BLOOD + if (diplo_keyphrase == "cs_meeting65") { + diplo_text = "You know, I think I would actually enjoy watching you attempt it. But I’ll spare you having your soul torn to shreds by daemons, and just give you an agonizing death instead."; + add_diplomacy_option({ + option_text: "[Battle Chaos AND any loyalist forces]", + goto: "cs_meeting_battle6", + }); + } + // stahp talking + if (diplo_keyphrase == "cs_meeting67") { + disposition[10] += 10; + diplo_text = "And I thought we were becoming such fast friends, you and I. Very well, don’t bore me."; + add_diplomacy_option({ + option_text: "[Battle Chaos forces]", + goto: "cs_meeting_battle5", + }); + } + + // Finish the conversation + // 135 + // 136 + // 137 + + if (diplo_keyphrase == "cs_meeting135") { + disposition[10] = max(disposition[10] + 10, 10); + diplo_text = $"[[{obj_controller.faction_leader[eFACTION.Chaos]}’s power armour grinds as he leans forward, his posture predatory.]]\nThen we have an accord. We will assist you as you take your first steps on the path toward Chaos. And my payment for all this?\n[[He chuckles.]]\nEnlisting an entire chapter in the service of the Dark Gods is all the reward I require."; + diplo_text += "\nBut you cannot simply paint the eight-pointed star on your wargear and begin slaughtering in the name of the Dark Gods. No, some within your chapter will resist the choice you’ve made, either out of loyalty to the Corpse Emperor or out of fear of Chaos. Just think, it will be like your own little heresy. The ''" + string(obj_ini.master_name) + " Heresy!''"; + add_diplomacy_option({ + option_text: "[Continue]", + goto: "cs_meeting136", + }); + } + if (diplo_keyphrase == "cs_meeting136") { + event_log = string(obj_controller.faction_leader[eFACTION.Chaos]) + " gives you an Artifact, meant to help corrupt your marines to the path of Chaos."; + scr_event_log("purple", event_log); // scr_alert("purple","lol",string(tix),0,0); + diplo_text = "[The tones of his humorless laughter are filled with the bitterness of ancient, poisoned memories. He continues.]\nYou must emerge victorious from this... \\Civil War\\, and not decimate your ranks in the process, if you are to be of any use to the Gods or to me. "; + diplo_text += $"And to that end, I give you this.\n[[{obj_controller.faction_leader[eFACTION.Chaos]} gestures to one of his Terminators, who presents you with an Artifact. In your mind, something sinister seems to cling to the lines of its form.]]\nThe more of your warriors that come to accept Chaos, the fewer holdouts there will be to overcome when the time comes. This object will speed their introduction to its ways. You must also encourage your warriors to...broaden their horizons wherever possible, so they come to their own understanding of the Primordial Truth. But you must tread carefully at the same time, lest you alert the Inquisition. They must not have even a hint of what’s taking place in your Chapter, or they will obliterate you."; + add_diplomacy_option({ + option_text: "[Continue]", + goto: "cs_meeting137", + }); + } + + if (diplo_keyphrase == "cs_meeting137") { + diplo_text = $"When enough of your warriors have embraced Chaos, assemble them together in one place and then speak with me, and I will show you the beginning of the Eightfold Path. Now, begone.\n[[As you leave he calls out to you one more time.]]\nAnd {obj_ini.master_name}, I expect action within a few years. My patience, unlike Chaos, is not infinite."; + complex_event = true; + current_eventing = ""; + force_goodbye = 1; + faction_status[eFACTION.Chaos] = "Antagonism"; + + with (obj_star) { + remove_star_problem("meeting"); + remove_star_problem("meeting_trap"); + } + + var born = false; + for (var ii = 1; ii < 200; ii++) { + if (obj_ini.role[0][ii] == obj_ini.role[100][eROLE.ChapterMaster]) { + fetch_unit([0, ii]).corruption += floor(random_range(30, 50)); + } + } + obj_controller.chaos_rating += 1; + + // Casket, Chalice, Tome + if (obj_ini.fleet_type == ePlayerBase.home_world) { + scr_add_artifact("chaos_gift", "", 0, obj_ini.home_name, 2); + } + if (obj_ini.fleet_type != ePlayerBase.home_world) { + scr_add_artifact("chaos_gift", "", 0, obj_ini.ship[0], 501); + } + } + if (string_count("cs_meeting_battle", diplo_keyphrase) > 0) { + var current_eventing = diplo_keyphrase; + combating = 1; + cooldown = 30; + diplomacy = 0; + menu = 0; + instance_activate_all(); + + with (obj_ground_mission) { + instance_destroy(); + } + var _found = false; + var _star, _planet; + with (obj_star) { + if (has_problem_star("meeting") > 0 && has_problem_star("meeting") > 0) { + _found = true; + _star = id; + _planet = has_problem_star("meeting") > 0 ? has_problem_star("meeting") : has_problem_star("meeting_trap"); + break; + } + } + if (!_found) { + var _master = fetch_unit([0, 0]); + if (_master.planet_location > 0) { + var _master_star = star_by_name(_master.location_string); + if (_master_star != "none") { + _found = true; + _planet = _master.planet_location; + _star = _master_star; + } + } + } + // show_message(string(instance_number(obj_ground_mission))); + + if (_found) { + instance_create(0, 0, obj_ncombat); + with (obj_ncombat) { + battle_special = current_eventing; + battle_object = _star; + battle_loc = _star.name; + battle_id = _planet; + } + obj_ncombat.dropping = 0; + obj_ncombat.attacking = 1; + obj_ncombat.local_forces = 0; + + if (diplo_keyphrase == "cs_meeting_battle1") { + obj_ncombat.enemy = 1; + obj_ncombat.threat = 2; + } + if (diplo_keyphrase == "cs_meeting_battle2") { + obj_ncombat.enemy = 1; + obj_ncombat.threat = 1; + } + if (diplo_keyphrase == "cs_meeting_battle5") { + obj_ncombat.enemy = 10; + obj_ncombat.threat = 3; + } + if (diplo_keyphrase == "cs_meeting_battle6") { + obj_ncombat.enemy = 10; + obj_ncombat.threat = 3; + } + if (diplo_keyphrase == "cs_meeting_battle7") { + obj_ncombat.enemy = 1; + obj_ncombat.threat = 2; + } + + if ((obj_ncombat.enemy == 10) && (obj_controller.faction_defeated[10] == 0)) { + obj_ncombat.leader = 1; + + with (obj_star) { + remove_star_problem("meeting"); + remove_star_problem("meeting_trap"); + } + } + + for (var v = 1; v < obj_temp_meeting.dudes; v++) { + if (obj_temp_meeting.present[v] == 1) { + obj_ncombat.fighting[obj_temp_meeting.co[v]][obj_temp_meeting.ide[v]] = 1; + } + } + scr_civil_roster(obj_ncombat.battle_loc, obj_ncombat.battle_id, true); + + instance_deactivate_all(true); + instance_activate_object(obj_controller); + instance_activate_object(obj_ini); + instance_activate_object(obj_temp_meeting); + instance_activate_object(obj_ncombat); + instance_activate_object(obj_centerline); + instance_activate_object(obj_pnunit); + instance_activate_object(obj_enunit); + + exit; + } + } + // ** Chaos Gods ** + if (diplomacy == 10.1) { + diplo_option = ["", "", "", "", ""]; + switch (diplo_keyphrase) { + case "intro": + diplo_text = "[[The Emmissary to Chaos is writhing snake like creature, a vile creature even by the standards of it's foul bretheren it has no specific master instead preffering to work undividely. It's savage toungue flicks from between it's teeth with glazed aged ayes staring into your soul]]"; + diplo_text += "\n#"; + diplo_text += "Greetings Chapter Master, The gods have been watching you oh so very closely, they see you struggles, they hear your pain, they breathe your despair. The warp is the key too all things all you need do is ask and they will provide......For a cost of course even in the warp nothing comes without cost"; + add_diplomacy_option({ + option_text: "I seek a favour from the Gods", + }); + add_diplomacy_option({ + option_text: "Begone Filth i serve the true god FOR THE EMPROR", + }); + add_diplomacy_option({ + option_text: "The gods may have respect when they earn it i'll be back cretin", + }); + break; + case "gift": + diplo_text = "Of course Chapter master (giggle) and what may they do for you"; + add_diplomacy_option({ + option_text: "I need strength and power to crush my enemies", + }); + add_diplomacy_option({ + option_text: "I seek to protect thoes under my command from this hellish existance", + }); + add_diplomacy_option({ + option_text: "I seek wisdom and knowlage to better guide me", + }); + add_diplomacy_option({ + option_text: "I seek wealth and a better life for my men", + }); + break; + case "Khorne_path": + diplo_text = "AAAAH the path of the warrior perhaps it was a little hopefull of me to expect anymore, from the right angle i suppose you could almost pass form one of those stunted little red bretheren of mine. The lord of skulls is always eager to help in an endevour that might spill even a moreseful more, but pray what will you offer to the lord of skulls for such favour; he loathes those who emply sorcery but then, but he's known to value the martial mans skull most, i suppose it dosen't matter too much from where the blood flows so long as it flows."; + add_diplomacy_option({ + option_text: "Sacrifice Librarian", + }); + add_diplomacy_option({ + option_text: "Sacrifice Champion", + }); + add_diplomacy_option({ + option_text: "Sacrifice squad", + }); + add_diplomacy_option({ + option_text: "FLEE", + }); + break; + case "daemon_scorn": + diplo_text = "return when you find yourself more enligtened Chapter Master my Lords hunger for you"; + break; + case "Nurgle_path": + diplo_text = "No one understands decay, rot and eventual death like the loving father of the warp. Only he can end your suffering and and that of your men. To be embraced is all the benevolent Father asks do you accept thse tuerms Chapter Master"; + add_diplomacy_option({ + option_text: "I accept, we surrender our will to the father", + }); + add_diplomacy_option({ + option_text: "Never you foul daemon all i hear are foul tricks", + }); + break; + case "Slaanesh_path": + diplo_text = "Riches. Joy. Pleasure.ha you remind me of that fool Midas. Who's Midas? Oh never you mind. She who thirsts has a fondness for little play things. Seek out a relic of importnace to her and you'll find yourself rewarded."; + add_diplomacy_option({ + option_text: "Where is this relic?", + }); + add_diplomacy_option({ + option_text: "As i thought the gods would rather have me chase my own tail than give me what i want", + }); + break; + case "Tzeentch_path": + diplo_text = "Yes I supose for a creature of your occupation your fate must be a pressing concern. it's dreary really wandering which rancid little backwater you'll die on fighting a pointless cause for a corpse on a throne, or maybe you only ask because you harbour greater ambitions? The changer of ways knows all things if you'll play a part in his games for him. ohh he does love his games yes he does."; + add_diplomacy_option({ + option_text: "What little game?", + }); + add_diplomacy_option({ + option_text: "A game? not only heretics but fools then begone Daemon", + }); + break; + case "sacrifice_lib": + diplo_text = "one less spell caster how pleasing for the lord. Enjoy your gift."; + break; + case "sacrifice_champ": + diplo_text = "How much of a champion can a dead man really be. Enjoy your gift."; + break; + case "sacrifice_squad": + diplo_text = "Sooo many good souls how sweet on my tounge. Enjoy your gift"; + break; + case "Slaanesh_arti": + diplo_text = "Fetch this for her and you shall have their favour"; + break; + case "Nurgle_gift": + diplo_text = "The father is a loving figure. Farewell may your men rot gently."; + break; + case "Tzeentch_plan": + diplo_text = "All these schemes i can hardly be bothered to keep track. Do this and you shall have fates favour."; + break; + } + if (diplo_keyphrase == "gift") { + diplo_text = "Of course Chapter master (giggle) and what may they do for you"; + add_diplomacy_option({ + option_text: "I need strength and power to crush my enemies", + }); + add_diplomacy_option({ + option_text: "I seek to protect thoes under my command from this hellish existance", + }); + add_diplomacy_option({ + option_text: "I seek wisdom and knowlage to better guide me", + }); + add_diplomacy_option({ + option_text: "I seek wealth and a better life for my men", + }); + } + } + if (diplo_keyphrase == "Demand Method") { + add_diplomacy_option({ + option_text: "Threaten", + tooltip: "The plausibility will of your threat", + }); + add_diplomacy_option({ + option_text: "Bribe", + }); + add_diplomacy_option({ + option_text: "Plausible Excuse", + }); + } + // ** Chaos ** + if (diplomacy == 10) { + if (diplo_keyphrase == "civilwar_begin") { + diplo_text = "The Imperium, blinded by its own hypocrisy, drowns in corruption and stagnation.If it is civil war they desire, then civil war they shall have."; + force_goodbye = 1; + } + if (diplo_keyphrase == "civilwar_soon") { + diplo_text = "The winds of change whisper a familiar tune. Soon, the veil of deceit shall be lifted, and the true face of the Imperium shall be revealed to all."; + force_goodbye = 1; + } + + if ((diplo_keyphrase == "intro") || (diplo_keyphrase == "intro2")) { + if (faction_gender[10] == 1) { + tempd = "[[An ancient and veteran Chaos Lord, " + string(faction_leader[eFACTION.Chaos]) + " has been a massive threat to " + string(obj_ini.sector_name) + " and the surround region since time remembered. He has fought against loyal Astartes and the forces of man for many millennia, if not since the Horus Heresy, and is personally responsible for several rebellions. Were " + string(faction_leader[eFACTION.Chaos]) + " to be silenced, his poisonous lies and false promises would no longer taint the sector.]]"; + } + if (faction_gender[10] == 2) { + tempd = "[An ancient World Eaters Chaos Lord, " + string(faction_leader[eFACTION.Chaos]) + " is a powerful warrior, blessed by Khorne. He has personally vanquished dozens of Astartes Champions and countless more Imperial Servants. It is by his warband's hands that a massive, bloody path of destruction has been carved through the stars. His forces are just now arriving within " + string(obj_ini.sector_name) + "- a direct confrontation is ill-advised.]]"; + } + tempd += "\n#"; + + // Need to have situational awareness for here- alternate introductions + + if ((faction_gender[10] == 1) && (diplo_keyphrase == "intro")) { + rando = choose(1, 1, 2); + force_goodbye = 1; + if (rando == 1) { + tempd += "It is a fine day, is it not? Yet again the Imperium displays its tyrannical, bureaucratic nature by declaring your chapter traitor. To unmake your forces, alone, is beyond my reach. It is fortunate I may simply sit back and watch as it is ground to dust by your former allies. When we meet again, " + string(obj_ini.master_name) + "- if we meet again- I will enjoy killing you."; + } + if (rando == 2) { + tempd += "We have not met before, " + string(obj_ini.master_name) + ", but until now this would have been troublesome. I am " + string(faction_leader[eFACTION.Chaos]) + "- no doubt you know of me, or have at least seen my hand at play. I am here, now, to laugh at you. Though it's been long since I could feel joy, or amusement, my hearts are warmed at seeing the Imperium destroying their own. If we meet again I would very much like to kill you."; + } + } + if ((faction_gender[10] == 1) && (diplo_keyphrase == "intro2")) { + rando = choose(1, 1, 2, 3, 3, 4, 4); + force_goodbye = 1; + if (rando == 1) { + tempd += "Your defeat was a foregone conclusion, Astartes. Your Chapters are like children compared to the Legions of old and we have only grown stronger after millennia of slaughter. Though you are not worthy of it I will honor you with death and make of it an offering to the Dark Gods."; + } + if (rando == 2) { + tempd += "Do not mourn your fallen, mewling wretch of the Imperium. Their deaths were not in vain. Each was a sacrifice to the Gods of the Warp and you pleased them greatly this day. For there is no paradise at the side of the False Emperor awaiting them, no glorious final battle. There is only the Warp. Even now their souls writhe in torment as they are chewed by the teeth of madness, and they will do so for all eternity. This same fate, and more, awaits you."; + } + if (rando == 3) { + tempd += "Your men were no true challenge, Chapter Master, merely wheat before the scythe of my forces. Next time you foolishly send your troops blundering into combat, at least make sure they are troops that offer some diversion. More entertainment was had from the desecration of their corpses than in the stealing of their life, though perhaps this will be true of your entire warband. In time, no doubt I will see."; + } + if (rando == 4) { + tempd += "You should be grateful that I gave your men a chance to die for their Emperor, to throw their lives away for your corpse god, to squander their might and prestigious gifts on fighting for the glory of a long dead cause. Their deaths, while meaningless to the the rest of the galaxy, must surely have brought them the satisfaction of a vindicated fanatic. Soon, I will give you this gift as well, purely from the generosity of my hearts."; + } + } + if (faction_gender[10] == 2) { + rando = choose(1, 1, 2, 2, 2); + if (rando == 1) { + tempd += "I COME NOW, " + string_upper(obj_ini.master_name) + ", FOR YOU. NONE OF YOUR MEN, NONE OF YOUR ALLIES, AND NOTHING YOU CAN DO WILL PREVENT ME FROM KILLING YOU. FLEE, AND I WILL RUN YOU DOWN LIKE THE ANIMAL YOU ARE. YOUR DAYS ARE NUMBERED."; + } + if (rando == 2) { + tempd += "BY KHORNE'S NAME " + string_upper(obj_ini.sector_name) + " SHALL BURN. CRAWL INTO A HOLE, OR STAND AND FIGHT, IT MATTERS NOT. YOU ARE FATED TO DIE BY MY HAND, ALONG WITH THE REST OF YOUR PATHETIC CHAPTER."; + } + } + diplo_text = tempd; + } + if ((diplo_keyphrase == "hello") || ((diplo_keyphrase == "propose_alliance") && (faction_gender[10] == 2))) { + scr_loyalty("Heretic Contact", "+"); + + if ((faction_gender[10] == 1) && (string_count("CHTRP|", obj_controller.useful_info) == 0)) { + if (chaos_rating >= 1) { + rando = choose(1, 2, 3, 4); + if (rando == 1) { + diplo_text = "Yes, " + string(obj_ini.master_name) + "?"; + } + if (rando == 2) { + diplo_text = "You require something, " + string(obj_ini.master_name) + "?"; + } + if (rando == 3) { + diplo_text = "What is it?"; + } + if (rando == 4) { + diplo_text = "What do you want?"; + } + + if (obj_controller.chaos_rating >= 1) { + add_diplomacy_option({ + option_text: "My Chapter is prepared to join Chaos. [Begin]", + goto: "civilwar_begin", + }); + add_diplomacy_option({ + option_text: "I require more time to corrupt my brethren.", + goto: "civilwar_soon", + }); + } + } + if ((disposition[10] > -80) && (chaos_rating == 0)) { + rando = choose(1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5); + if (rando == 1) { + diplo_text = "Ahhhh. You require something, " + string(obj_ini.master_name) + "?"; + } + if (rando == 2) { + diplo_text = "You risk much with this audience. I hope I can make it worth your while."; + } + if (rando == 3) { + diplo_text = "Now this is an unlikely meeting. What can I do for you, " + string(obj_ini.master_name) + "?"; + } + if (rando == 4) { + diplo_text = "Have you finally seen the light, at long last?"; + } + if (rando == 5) { + diplo_text = "There are few reasons a Chapter Master might wish an audience, and they are all worthwhile. What can I and my forces do for you?"; + } + } + if (disposition[10] <= -80) { + force_goodbye = 1; + rando = choose(1, 2, 2, 3, 3); + turns_ignored[10] += choose(3, 4, 5); + if (rando == 1) { + diplo_text = "There are no more words to be said."; + } + if (rando == 2) { + diplo_text = "The forces of Chaos call for your destruction."; + } + if (rando == 3) { + diplo_text = "Your soul will be mine."; + } + } + if (rela != "hostile") { + // Only happens with leader=1 + // More normal "yes?" greetings + rando = choose(1, 2); + if (rando == 1) { + diplo_text = "May the Chaos gods bless us in our meeting!"; + } + if (rando == 2) { + diplo_text = "Do you need help to kill some heretics?"; + } + } + } + if ((faction_gender[10] == 1) && (string_count("CHTRP|", obj_controller.useful_info) > 0)) { + obj_controller.useful_info = string_replace(obj_controller.useful_info, "CHTRP|", "CHTRP2|"); + diplo_text += "I almost refused to believe that my little trap hadn't done you in, but here you are. I may have misjudged you, " + string(obj_ini.master_name) + ". Of course I still intend to kill you, regardless, but I can give credit where credit is due."; + force_goodbye = 1; + } + if (faction_gender[10] == 2) { + force_goodbye = 1; + turns_ignored[10] += choose(3, 4, 5); + rando = choose(1, 2, 3); + if (diplo_keyphrase == "propose_alliance") { + rando = choose(1, 2, 2, 3); + } + if (rando == 1) { + diplo_text = "I AM GOING TO RIP YOUR HEARTS OUT AND CONSUME THEM IN FRONT OF YOU!"; + } + if (rando == 2) { + diplo_text = "BEGGING WILL DO YOU NO GOOD, IMPERIAL LAPDOG!"; + } + if (rando == 3) { + diplo_text = "DEATH COMES FOR ALL!"; + } + } + } + if (diplo_keyphrase == "trade_close") { + rando = choose(1, 2, 3); + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "When the time comes for your extinction, I will carve a list of the many times you irked me into your skin. This incident will go on your " + choose("forehead", "chest", "throat", "cheek", "heart") + "."; + } + if (rando == 2) { + diplo_text += "Begone then, the stench of your vaunted sanctity offends me."; + force_goodbye = 1; + } + if (rando == 3) { + diplo_text += "It must be said that while you fail at almost all aspects of commanding a Chapter, you are extremely skilled in causing me slight irritations. Congratulations."; + force_goodbye = 1; + } + } + if (rela != "hostile") { + if (rando == 1) { + diplo_text += "Next time you see fit to contact me, I expect you to have considered your words more carefully. Before you are required to speak them, if possible."; + } + if (rando == 2) { + diplo_text += "You are boorish to converse with but I suppose it cannot be helped; you were trained to kill, not to talk or, indeed, to think."; + } + if (rando == 3) { + diplo_text += "Traditionally, one makes sure one is sure of ones course of action before acting, not afterwards. Something for you to consider, no doubt."; + } + } + } + if (diplo_keyphrase == "demand_refused") { + if ((faction_gender[10] == 1) && (rela == "hostile")) { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text = "I spit upon your demands, loyalist dog. Beg your corpse Emperor for something instead."; + } + if (rando == 2) { + diplo_text = "A child, blind to the ways of the world, may demand things from an adult but all he gets is a bloody nose. Insolent whelp."; + } + if (rando == 3) { + diplo_text = "Your demands are much like your misguided faith in the ‘Emperor'; nothing but dust before the implacable winds of Chaos."; + } + } + } + if (string_count("agree", diplo_keyphrase) == 1) { + if (trading_artifact == 0) { + diplo_text = string(trade_msg) + "\n"; + } + if (trading_artifact != 0) { + diplo_text = "[[Trade Accepted.]]\n"; + } + if (liscensing > 0) { + diplo_text = "[[Trade Accepted. License(s) Transmitted.]]\n"; + force_goodbye = 1; + // something else here; schedule the license and do not go to the next audience + } + rando = choose(1, 2, 3); + if (rela != "hostile") { + if (rando == 1) { + diplo_text += "Very well, let it be so. I will give the relevant commands to my underlings and arrangements will be made."; + } + if (rando == 2) { + diplo_text += "This is an acceptable trade, beneficial to both of us. I agree to it."; + } + if (rando == 3) { + diplo_text += "For now, I will accept this trade. Do not assume I will always do so, however."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "Sometimes a lord deigns to exchange with the meanest pauper. It does not make them equals."; + } + if (rando == 2) { + diplo_text += "I will trade with you, little loyalist, if only to be closer to laugh at you when you fall to the inexorable machinations of the Gods."; + } + if (rando == 3) { + diplo_text += "If only to demonstrate how meaningless your efforts are in the grand scheme of the Galaxy, I'll accept this trade."; + } + } + } + if (diplo_keyphrase == "disagree") {} + if (diplo_keyphrase == "attacked") { + // TODO + } + if (diplo_keyphrase == "declare_war") { + force_goodbye = 1; + turns_ignored[diplomacy] += 4; + rando = choose(1, 2, 3); + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "The war already exists, you petulant fool. It has raged for 10,000 years and will outlive us both."; + } + if (rando == 2) { + diplo_text += "And before you ‘declared war'? Did you believe that I had no intention of destroying you at that time? You delusional dog."; + } + if (rando == 3) { + diplo_text += "Do not worry, thrall of the corpse Emperor, I shall grant you both death and freedom from your bonds of ‘loyalty'."; + } + } + if (rela != "hostile") { + if (rando == 1) { + diplo_text += "It is puzzling to me that you believe this changes anything but I see this means a lot to you so I accept your ‘declaration'."; + } + if (rando == 2) { + diplo_text += "Little fool, you do not to understand the nature of the Galaxy. If we have time before I obliterate you, I will educate you."; + } + if (rando == 3) { + diplo_text += "Were we not already engaged in a war 10,000 years old, your declaration might mean something."; + } + } + } + if (diplo_keyphrase == "accept_peace") { + scr_chaos_alliance_test(); + } + + if (diplo_keyphrase == "ignored") { + // TODO + } + if (diplo_keyphrase == "denounced") { + if (faction_gender[10] == 1) { + disposition[10] -= 1; + + var _diag_opts = ["You are nothing.", "Pathetic.", "I grow weary of your ineptitude.", "Judgement comes for all.", "Your kind will be destroyed, in time.", $"[{faction_leader[eFACTION.Inquisition]} lets out an amused, extremely confident chuckle.]", "Your soul will be mine.", "Do not trifle with me, worm.", "I have travelled the stars for millennia. Worlds have burned at my command, countless souls damned. The ground trembles with every step. Now I sit here and listen to you. Where did it all go so wrong?"]; + diplo_text = array_random_element(_diag_opts); + + if (irandom(9) == 9) { + force_goodbye = 1; + } + if (disposition[10] <= -80) { + diplo_text = "Your end will soon be at hand; you need not rush toward it so eagerly."; + force_goodbye = 1; + } + } + } + if ((diplo_keyphrase == "praised") && (faction_gender[10] == 1)) { + if ((faction_justmet == 0) && (disposition[10] < -75)) { + disposition[diplomacy] += choose(0, 0, 1); + } + if (faction_justmet == 1) { + disposition[diplomacy] += 2; + faction_justmet = 0; + } + rando = choose(1, 2, 3); + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "Save your words for one who is easily swayed by such pleasantries, you blundering oaf."; + } + if (rando == 2) { + diplo_text += "Your words would be better served placating members of your Imperium's Inquisition who will, I am sure, be interested in our correspondences."; + } + if (rando == 3) { + diplo_text += "Prattle on, fool, your words contain less meaning than the solar wind that blows across cold stars."; + } + } + if (rela != "hostile") { + if (rando == 1) { + diplo_text += "Whether by accident or design, you speak truth. But do not believe it changes anything about how I see you or how I will treat you."; + } + if (rando == 2) { + diplo_text += "Were I someone who responded to the slightest praise with preferential treatment, I would not have got were I am today."; + } + if (rando == 3) { + diplo_text += "Words will not sway me in the slightest. Only actions display worthiness."; + } + } + } + if (diplo_keyphrase == "offer") { + rando = choose(1, 2, 3); + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "As much as I am loathe to besmirch my ears by listening to your words, needs must when cruel fate drives us into a corner. I have an offer for you."; + } + if (rando == 2) { + diplo_text += "Do not presume that I come to you out of admiration or seeking friendship. I merely wish to trade you enough rope to hang yourself with."; + } + if (rando == 3) { + diplo_text += "Soon, you will be either dead or close enough that it makes no difference. At this moment, however, I wish to offer you a trade."; + } + } + if (rela != "hostile") { + if (rando == 1) { + diplo_text += "Prove that you are more than just another ten day traitor, trade with me and further both our agendas."; + } + if (rando == 2) { + diplo_text += "If we truly both follow the many stepped path towards the glory of chaos, you will agree to trade with me."; + } + if (rando == 3) { + diplo_text += "Trade, if not allegiance, between the children of chaos is essential to the furthering of our shared agenda."; + } + } + } + if (diplo_keyphrase == "open_trade") { + diplo_text = "Make your proposal."; + } + if (diplo_keyphrase == "artifact_thanks") { + rando = choose(1, 2, 3); + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "I would have torn it from your cold, dead hands in any case but this does save us some time."; + } + if (rando == 2) { + diplo_text += "A meaningless gesture, Chapter Master, but it brings us a little closer to your inevitable demise so it is appreciated."; + } + if (rando == 3) { + diplo_text += "You have no more idea of what you're doing than a headless Grox, do you? I will consider making you end swift, when the time comes."; + } + } + if (rela != "hostile") { + if (rando == 1) { + diplo_text += "I shall examine this gift for any traps or flaws before rendering you any thanks."; + } + if (rando == 2) { + diplo_text += "It will go into my vault to be stored with the many others of its type I have collected. Nevertheless, I thank you for the gesture."; + } + if (rando == 3) { + diplo_text += "If you expect gushing thanks or rapturous praise, you will go on waiting. I am not sure how much of a favour you have done me."; + } + } + } + if (diplo_keyphrase == "stc_thanks") { + rando = choose(1, 2, 3); + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "There would have been no place you could have hidden it from me when I came to claim it, you insignificant worm."; + } + if (rando == 2) { + diplo_text += "A petty, insignificant, pointless gesture of deference but a gesture of deference nonetheless and I will remember it when my hand is around your throat."; + } + if (rando == 3) { + diplo_text += "I cannot fathom the path of thought that brought you to this action but it doesn't truly matter; it will be rendered meaningless with your death."; + } + } + if (rela != "hostile") { + if (rando == 1) { + diplo_text += "Interesting, a gift as rare as this implies that you expect something in return. I shall consider what you want and, more importantly, what I am prepared to give."; + } + if (rando == 2) { + diplo_text += "A gift more valuable than most but still something I have come across before. I shall have it stored in my personal vaults."; + } + if (rando == 3) { + diplo_text += "I shall keep this gift close, both as a reminder of your generosity and to remind me to watch you carefully, Chapter Master."; + } + } + } + if (diplo_keyphrase == "trading_demand") { + if (rela == "hostile") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text += "Speak, worm, lest I wipe you from existence before you manage even to beg for mercy."; + } + if (rando == 2) { + diplo_text += "I can only hope you intend to beg for mercy and throw yourself upon my dubious mercy. It will be quicker for all concerned."; + } + if (rando == 3) { + diplo_text += "Words are wind, much like you will be if I don't like what I hear."; + } + } + if (rela != "hostile") { + rando = choose(1, 2, 2, 3, 3, 3); + if (rando == 1) { + diplo_text += "Choose the words you use as carefully as your battle gear, least the former mean you need to use the latter."; + } + if (rando == 2) { + diplo_text += "I am not a being of unlimited leisure time, Chapter Master, so you will need to be swift with your words."; + } + if (rando == 3) { + diplo_text += "Speak but do not be offended if I seem not to be paying attention; I'm probably not."; + } + } + add_diplomacy_option({ + option_text: "Demand Requisition", + }); + add_diplomacy_option({ + option_text: "Demand Military Assistance", + }); + add_diplomacy_option({ + option_text: "Cancel", + goto: "disagree", + }); + } + if ((diplo_keyphrase == "propose_alliance") && (obj_controller.faction_gender[10] == 1)) { + var _found = false; + var _star, _planet; + with (obj_star) { + for (var i = 1; i <= 4;) { + for (var r = 1; r <= 4; r++) { + if ((p_problem[i][r] == "meeting") || (p_problem[i][r] == "meeting_trap")) { + _found = true; + _star = id; + _planet = r; + break; + } + } + } + } + if (_found) { + rando = choose(1, 2); + var _name = planet_numeral_name(_planet, _star); + if (rando == 1) { + diplo_text = $"I await your arrival on {_name}, in case it has slipped your mind."; + } + if (rando == 2) { + diplo_text = $"We agreed to meet upon {_name}. Do not squander this opportunity."; + } + } else { + scr_chaos_alliance_test(); + } + } + } + // ** Imperium ** + if (diplomacy == 2) { + if (diplo_keyphrase == "intro") { + rando = choose(1, 2); + if (rando == 1) { + tempd = $"[[To see Sector Commander {faction_leader[eFACTION.Imperium]} is to see what happens to heroes when their glory days have passed and the rot of ages sets in. Now a huge mass of fat and flab, he was once a mighty and respected general and the commander of a score of successful campaigns. As his reward for a glorious career, he was given commander of the sector and, as has happened to so many others, the bureaucracy crushed his warrior spirit and turned him into the man he is.]]"; + } + if (rando == 2) { + tempd = $"[[Loyal to allies and venomous to enemies, few figures command such opposing reputations as {faction_leader[eFACTION.Imperium]}. Enemies of the Imperium speak in hushed tones of his incredible cruelty and harsh actions against them, whereas the citizens and organizations that lay claim to the protection of the Emperor loudly toast his generosity and stalwart courage. A friend to keep and an enemy to lose.]]"; + } + tempd += "\n#"; + rando = choose(1, 2); + if (rando == 1) { + tempd += "Space Marines in my sector are expected to conduct themselves as befits one of the Adeptus Astartes. Do not disappoint me."; + } + if (rando == 2) { + tempd += "It is good that the vessels of the Emperor's wrath have arrived in this sector- to bring his justice to the xenos and the heretic."; + } + diplo_text = tempd; + } + if (diplo_keyphrase == "hello") { + if (rela == "friendly") { + diplo_text = $"What can I do for the hero of {obj_ini.sector_name}?"; + } + if (rela == "neutral") { + diplo_text = $"State your business, Chapter Master."; + } + if (rela == "hostile") { + diplo_text = $"What do you want, Chapter Master? I have little time for glorified interplanetary brigands such as yourself."; + } + } + if (diplo_keyphrase == "trade_close") { + if (rela == "friendly") { + diplo_text = "Were I a less forgiving man, I might find that rude! But there is little I would not forgive you, my friend!"; + } + if (rela == "neutral") { + diplo_text = "It is hardly courteous to change ones mind when a deal is about to be reached. Still, I suppose you /must/ have your reasons."; + } + if (rela == "hostile") { + diplo_text = "How very like you to back out of things. I seem to recall your vows to guard this sector from Xenos, heretics and mutants. Strange, but some still seem to be around."; + } + } + if (diplo_keyphrase == "demand_refused") { + rando = choose(1, 2); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "I only wish I could assist you in this way, Chapter Master, but I am afraid I cannot."; + } + if (rando == 2) { + diplo_text = "I am truly sorry, Lord, but I have to chance of fulfilling your request."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "At this time, I'm afraid it is not possible for me to comply."; + } + if (rando == 2) { + diplo_text = "Perhaps at a later date or if you had asked earlier, but now is simply too difficult."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "Do not think that you can demand everything because you are an Astartes. I decline."; + } + if (rando == 2) { + diplo_text = "Get thee gone, I am in no mood for your presumptions."; + } + } + } + if (string_count("agree", diplo_keyphrase) == 1) { + if (trading_artifact == 0) { + diplo_text = string(trade_msg) + "\n"; + } + if (trading_artifact != 0) { + diplo_text = "[[Trade Accepted.]]\n"; + } + if (liscensing > 0) { + diplo_text = "[[Trade Accepted. License(s) Transmitted.]]\n"; + force_goodbye = 1; + // TODO something else here; schedule the lisence and do not go to the next audience + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "Mightily agreeable, Chapter Master. I will await the fruition of our arrangement."; + } + if (rando == 2) { + diplo_text += "A sound suggestion, let it be so!"; + } + if (rando == 3) { + diplo_text += "The Emperor was truly merciful when he sent you to us, Chapter Master. I agree!"; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "An acceptable proposition. You will have to talk it over with my scribes."; + } + if (rando == 2) { + diplo_text += "The Sector would benefit from such a deal."; + } + if (rando == 3) { + diplo_text += "Indeed, let it be so, Chapter Master."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "It is my only option, but I will curse you forever for forcing me into this."; + } + if (rando == 2) { + diplo_text += "If you cross me, the wrath of the Emperor will come down on your head."; + } + if (rando == 3) { + diplo_text += "I never thought I would work with as deplorable a character as yourself, but I accept."; + } + } + } + if (diplo_keyphrase == "disagree") { + if (trading_artifact == 0) { + diplo_text = "[[Trade Refused]]\n"; + } + if (trading_artifact == 1) { + diplo_text = ""; + } + annoyed[diplomacy] += 2; + if (annoyed[diplomacy] >= 10) { + force_goodbye = 1; + if (rela == "friendly") { + diplo_text += "I cannot accept this deal and the day grows late; I will not take any more of your time."; + } + if (rela == "neutral") { + diplo_text += "I apologize, Chapter Master, but I have more pressing concerns. The Emperor protects."; + } + if (rela == "hostile") { + diplo_text += "Don't you have better things to do, astartes?"; + } + turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 1); + diplo_last = string(diplo_keyphrase); + diplo_char = 0; + diplo_alpha = 0; + exit; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "I apologize, but my resources must be directed in a different direction."; + } + if (rando == 2) { + diplo_text += "It pains me to deny you but I fear I must."; + } + if (rando == 3) { + diplo_text += "Unfortunately, I and my forces have a prior engagement."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "I do not believe this will help either of us."; + } + if (rando == 2) { + diplo_text += "Tempting... but no, I must decline."; + } + if (rando == 3) { + diplo_text += "Perhaps circumstances will change but for now I must decline."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "Are you mad? Even if you are not, I suggest you plead insanity when the Inquisition comes for you. It might make your death quicker."; + } + if (rando == 2) { + diplo_text += "Do not think me your fool whom you can ask to do whatever you wish."; + } + if (rando == 3) { + diplo_text += "Unlike you, I do only the bidding of the Emperor. I do not agree."; + } + } + } + if (diplo_keyphrase == "attacked") { + diplo_text = "By striking at me, you strike at the entire Imperium! You will live to regret this."; + } + if (diplo_keyphrase == "declare_war") { + force_goodbye = 1; + turns_ignored[diplomacy] += 4; + known[diplomacy] = max(2, known[diplomacy]); + diplo_text = "You have gone too far this time! Lest suspicion fall on me for simply sharing a sector with you, I have no choice but to destroy you."; + + with (obj_star) { + for (var p = 1; p <= 4; p++) { + if (planets >= p) { + if ((p_owner[p] == eFACTION.Player) && (dispo[p] < 100) && (planet_feature_bool(p_feature[p], P_features.Monastery) == 0)) { + if (p_first[p] != eFACTION.Player) { + p_owner[p] = p_first[p]; + } else { + p_owner[p] = eFACTION.Imperium; + } + scr_alert("red", "blarg", "Control of " + string(name) + " " + scr_roman(p) + " lost!", x, y); + scr_event_log("red", "Control of " + string(name) + " " + scr_roman(p) + " lost!"); + } + } + } + } + } + if (diplo_keyphrase == "accept_peace") { + diplo_text = "Perhaps I was hasty in my judgment of you. I will accept peace. For the moment..."; + } + if (diplo_keyphrase == "ignored") { + diplo_text = "It is customary to offer reports of your progress to your sector's commander. And your sector commander is me and yet I see a disturbing lack of reports."; + } + if (diplo_keyphrase == "denounced") { + if (faction_justmet == 1) { + disposition[diplomacy] -= 5; + faction_justmet = 0; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "Perhaps you could be a little less harsh in your criticisms, friend?"; + } + if (rando == 2) { + diplo_text = "I shall have to reexamine myself, if such a loyal soldier says such things of me."; + } + if (rando == 3) { + diplo_text = "Might I suggest you learn the practice of thinking before speaking?"; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "Words are wind, Astartes."; + } + if (rando == 2) { + diplo_text = "If I took on board the criticisms of everyone in the sector, I'd never get a damn thing done."; + } + if (rando == 3) { + diplo_text = "I care not for your insults, only for the work you do for the Emperor."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "Your words are as full of poison as your heart."; + } + if (rando == 2) { + diplo_text = "If you think that your words would go unnoticed, you were wrong."; + } + if (rando == 3) { + diplo_text = "The true soldiers of the Imperium would not speak so of their rightful commanders."; + } + } + } + if (diplo_keyphrase == "praised") { + if (faction_justmet == 1) { + disposition[diplomacy] += 2; + faction_justmet = 0; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "You are too kind, friend, for it is you that the people see as their champion."; + } + if (rando == 2) { + diplo_text = "If all Astartes were half as bold as you are courteous, there would be not a single foe left in the galaxy."; + } + if (rando == 3) { + diplo_text = "Few Space Marines are as kind as they are valorous."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "Back up your sweet words with bold actions and perhaps you shall find a friend in me."; + } + if (rando == 2) { + diplo_text = "I thank you for the compliment but it does not alter our relation in the slightest."; + } + if (rando == 3) { + diplo_text = "A heretic rarely speaks with such a kind tongue, but this is an unknowable galaxy and stranger things have happened."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "You won't sway me to your cause with poisoned honey."; + } + if (rando == 2) { + diplo_text = "A wicked man speaks wicked lies, but even a stopped chrono is right twice a day."; + } + if (rando == 3) { + diplo_text = "You approval means less to me than your enmity."; + } + } + } + if (diplo_keyphrase == "offer") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text = "Would a trade such as this be to your satisfaction?"; + } + if (rando == 2) { + diplo_text = "I believe this trade would be beneficial to us both."; + } + if (rando == 3) { + diplo_text = "What benefits us both benefits the Imperium. Who better for you to trade with than myself?"; + } + } + if (diplo_keyphrase == "open_trade") { + diplo_text = "Make your proposal, Chapter Master."; + } else if (diplo_keyphrase == "artifact_thanks") { + diplo_text = "Thank you indeed, Chapter Master. A relic of such magnificence... I thank you more than I can say."; + } else if (diplo_keyphrase == "artifact_daemon") { + diplo_text = "Thank you indeed, Chapter Master. A relic of such magnificence... I thank you. This item is precious to me."; + } + if (diplo_keyphrase == "stc_thanks") { + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "Such relics are a rare and glorious sight, Chapter Master. I thank you for this boon and trust that you know my gratitude will be expressed in a manner pleasing to you."; + } + if (rando == 2) { + diplo_text += "You honour me beyond words with this gift. I thank you, as do all under my command and all who will benefit from it."; + } + if (rando == 3) { + diplo_text += "A mighty gift from a mighty ally, Chapter Master. It will be remembered as one of the many great deeds you have done for this sector."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "Do not think me ungrateful but I am a little suspicious as to what has caused this sudden largesse. Perhaps this gift is not as pure as it seems?"; + } + if (rando == 2) { + diplo_text += "Quite a gift, Chapter Master. I expect that you will want repaying, even if you have not openly stated thus. We shall see..."; + } + if (rando == 3) { + diplo_text += "Were it so simple that I could just take the gift and give you thanks. In these times, there is always a price and always a reckoning."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "Do you think simple gifts will make us firm friends? I think not, you villainous cur! Away with you, though I will keep this gift, if only to deprive you of it."; + } + if (rando == 2) { + diplo_text += "When a traitor in all but name gives you a gift, one only survives by first checking it for traps and then killing the traitor. And I intend to survive."; + } + if (rando == 3) { + diplo_text += "Your gifts mean nothing to me, even less than your words do. I will not be swayed by either and will keep my own counsel."; + } + } + } + if (diplo_keyphrase == "artifact_angry") { + // TODO + diplo_text = "How dare you offer us such an artifact!"; + } + if (diplo_keyphrase == "bombard_angry") { + diplo_text = "For the love of the Emperor, what the hell are you doing? That was an Imperial world you layed waste to!"; + } + if (diplo_keyphrase == "trading_demand") { + if (rela == "friendly") { + diplo_text = string(obj_ini.master_name) + "?"; + } + if (rela == "neutral") { + diplo_text = "What is the meaning of this?"; + } + if (rela == "hostile") { + diplo_text = "Consider your next words carefully."; + } + add_diplomacy_option({ + option_text: "Demand Requisition", + }); + add_diplomacy_option({ + option_text: "Demand Military Assistance", + }); + add_diplomacy_option({ + option_text: "Cancel", + goto: "disagree", + }); + } + if (diplo_keyphrase == "assassination_angryish") { + var _event = audience_data; + rando = choose(1, 2, 3); + var _assasin_place = planet_numeral_name(_event.planet, _event.system); + if (rando == 1) { + diplo_text = $"Several sources indicate that you have killed the Planetary Governor of {_assasin_place} and went on to meddle with the succession. Such subterfuge will not be tolerated, Chapter Master."; + } + if (rando == 2) { + diplo_text = $"I have received word that you have killed the Planetary Governor of {_assasin_place} and placed a fool in power. Your attempts to control this sector, and seemingly emulate the Ultramarines, have not gone unnoticed. Do not think this will go unpunished."; + } + if (rando == 3) { + diplo_text = $"What do you think you are doing, Chapter Master? Killing a Planetary Governor? Replacing them with one of your tools? Inquisitor Lord {faction_leader[eFACTION.Inquisition]} will hear of this madness."; + } + array_delete(obj_controller.event, _event_index, 1); + } + } + // ** Mechanicus ** + if (diplomacy == 3) { + if (diplo_keyphrase == "intro") { + rando = choose(1, 2); + if (rando == 1) { + diplo_text = "[[" + string(faction_leader[eFACTION.Mechanicus]) + " is a name often spoken of on the factory floor of " + string(obj_ini.sector_name) + "'s forgeworlds, though it cursed as often as it's praised. Sometimes referred to as “The Iron Whip”, " + string(faction_leader[eFACTION.Mechanicus]) + " is famed for the high level of efficiency he extracts from those working under him, if not particularly for the quality of their works.]]"; + } + if (rando == 2) { + diplo_text = "[[The flesh is weak. " + string(faction_leader[eFACTION.Mechanicus]) + " believes in this part of the iron creed above all others, forcing all those under him to mirror his dedication. All meaty parts of his body have been removed, leaving only the most vital parts of his brain. His retinue display their rank by showing how little of their body remains.]]"; + } + diplo_text += "\n#"; + if ((disposition[3] > 30) && (disposition[3] < 60)) { + tempd = "Greetings. I wish to see you bring the light of civilization to this sector, Chapter Master."; + } + if ((disposition[3] <= 30) || scr_has_disadv("Tech-Heresy")) { + tempd = "You are impure, illogical and irritating. Keep your army of techno barbarians away from my territory."; + } + if ((disposition[3] >= 60) || scr_has_adv("Tech-Brothers")) { + tempd = "Hail, Chapter Master. Were it not a logical fallacy, I would wish you luck in your coming endeavors."; + } + diplo_text += tempd; + } + if (diplo_keyphrase == "hello") { + if (rela == "friendly") { + diplo_text = "What can I and my forces do for you, Chapter Master?"; + } + if (rela == "neutral") { + diplo_text = "I will allow you a small portion of my time for an audience, Astartes."; + } + if (rela == "hostile") { + diplo_text = "Time is a precious resource and I do not wish to spend much of mine on you."; + } + } + if (diplo_keyphrase == "trade_close") { + if (rela == "friendly") { + diplo_text = "I trust you have recalculated how your resources can be best utilised and deemed this trade inefficient."; + } + if (rela == "neutral") { + diplo_text = "I suggest you leaner to calculate a little further into the future, Space Marine. It will be inefficient for you to continue operating in your current fashion."; + } + if (rela == "hostile") { + diplo_text = "It would be illogical to engage in a trade with one as unreliable as you in any case."; + } + } + if (diplo_keyphrase == "demand_refused") { + rando = choose(1, 2); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "Were it a logical and efficient use of resources, we would gladly comply but it is not."; + } + if (rando == 2) { + diplo_text = "We express regret that we cannot currently assist you, Chapter Master."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "Your request has been considered and found to be lacking in merit."; + } + if (rando == 2) { + diplo_text = "While you make an acceptable case, we decline to enter into this agreement."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "To enter into any agreement with you would be a awful error of judgement."; + } + if (rando == 2) { + diplo_text = "It would be more efficient to discharge a plasma rifle into my own chest cavity. [Simulated Mirth]"; + } + } + } + if (diplo_keyphrase == "agree") { + if (trading_artifact == 0) { + diplo_text = string(trade_msg) + "\n"; + } + if (trading_artifact != 0) { + diplo_text = "[[Trade Accepted.]]\n"; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "Let it be so, and may the Machine God bless this venture."; + } + if (rando == 2) { + diplo_text += "You made a wise decision in bringing this proposal to me."; + } + if (rando == 3) { + diplo_text += "Let this agreement strengthen the bounds of our brotherhood."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "Let it be so; it is immaterial in my calculations."; + } + if (rando == 2) { + diplo_text += "I agree, though it will change little in the grand scheme of the galaxy."; + } + if (rando == 3) { + diplo_text += "Logic dictates that I agree. We have an accord."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "It is logical to agree with you, but I dislike it."; + } + if (rando == 2) { + diplo_text += "At least for you, it is lucky that I have little choice."; + } + if (rando == 3) { + diplo_text += "Probability suggests this endeavor will fail, but I agree."; + } + } + } + if (diplo_keyphrase == "disagree") { + if (trading_artifact == 0) { + diplo_text = "[[Trade Refused]]\n"; + } + if (trading_artifact == 1) { + diplo_text = ""; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "I cannot allow favoritism to affect my calculations. I decline."; + } + if (rando == 2) { + diplo_text += "Our friendship means fractionally less to me than this bargain. I decline."; + } + if (rando == 3) { + diplo_text = "I have calculated the likely benefits weighed against the risks, and find this venture unsatisfactory."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "I have calculated the likely benefits weighed against the risks, and find this venture unsatisfactory."; + } + if (rando == 2) { + diplo_text += "My answer is no, for it is the only logical route."; + } + if (rando == 3) { + diplo_text += "I do not think so, though you may find others who are more willing."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "A ludicrous proposal, illogical and dangerous. Take it somewhere else."; + } + if (rando == 2) { + diplo_text += "Do you suppose me to be mad? Do you judge me by your own standard? No."; + } + if (rando == 3) { + diplo_text += "It would be illogical and heretical. Extrapolate your answer from that."; + } + } + } + if (diplo_keyphrase == "attacked") { + if (rela != "friendly") { + diplo_text = "Your heretic blasphemy shall not go unpunished. The Adeptus Mechanicus will destroy without exception all that is your chapter."; + } + if (rela == "friendly") { + diplo_text = "You have forsaken the Omnissiah's generosity; now you shall face judgment."; + } + } + if (diplo_keyphrase == "declare_war") { + force_goodbye = 1; + turns_ignored[diplomacy] += 4; + known[diplomacy] = max(2, known[diplomacy]); + diplo_text = "++ CORPUS FINIS+MACHINA MAGNUS+SANCTUS METALLUM+POTESTAS OMNISSIAH+OMNISSIAH VULT+DEATH TO THE ENEMIES OF THE MACHINE GOD ++"; + } + if (diplo_keyphrase == "accept_peace") { + diplo_text = "We have calculated the price of your destruction and found it excessive."; + } + if (diplo_keyphrase == "ignored") { + diplo_text = "What cause do you have, to listen to reason and logic once more?"; + } + if (diplo_keyphrase == "denounced") { + if (faction_justmet == 1) { + disposition[diplomacy] -= 5; + faction_justmet = 0; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "Look to your weapons, your armour, and your ships, Chapter Master, and reconsider the logic of your statement."; + } + if (rando == 2) { + diplo_text = "It is illogical and unwise to turn aside the Adeptus Mechanicus' auspices."; + } + if (rando == 3) { + diplo_text = "To speak against us is to speak against the Machine God."; + } + } + if (rela != "friendly") { + if (rando == 1) { + diplo_text = "The smallest mind strives to comprehend its limits."; + } + if (rando == 2) { + diplo_text = "Your words are illogical and meaningless."; + } + if (rando == 3) { + diplo_text = "Do not waste my time with incongruous statements."; + } + } + } + if (diplo_keyphrase == "praised") { + if (rela == "friendly") { + rando = choose(1, 2); + if (rando == 1) { + diplo_text = "Do not be fictitious, Chapter Master. What is it you covet?"; + } + if (rando == 2) { + diplo_text = "I am unable to be swayed by ingratiating words; the truth of your statement is clear to all."; + } + } + if (rela != "friendly") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text = "I have better things to do than listen to your praise."; + } + if (rando == 2) { + diplo_text = "Words such as these have no place in my calculations."; + } + if (rando == 3) { + diplo_text = "Do not waste my time."; + } + } + } + if (diplo_keyphrase == "offer") { + rando = choose(1, 2, 3, 4); + if (rando == 1) { + diplo_text = "The Adeptus Mechanicus offers you this."; + } + if (rando == 2) { + diplo_text = "A logical transaction. What is your answer, Chapter Master?"; + } + if (rando == 3) { + diplo_text = "You lack resources; the Adeptus Mechanicus has much at its disposal."; + } + if (rando == 4) { + diplo_text = "Calculations reveal that we shall mutually benefit from this transaction."; + } + } + if (diplo_keyphrase == "open_trade") { + diplo_text = "..."; + } + if (diplo_keyphrase == "artifact") { + if (rela != "hostile") { + add_diplomacy_option({ + option_text: "Propose a trade for the Artifact.", + }); + add_diplomacy_option({ + option_text: "Leave it be; Exit.", + is_exit: true, + }); + diplo_text = "The Adeptus Mechanicus is aware of the Artifact. Do not concern yourself with that which is rightly within our territory."; + } + if (rela == "hostile") { + force_goodbye = 1; + diplo_text = "This Artifact rightly belongs to the Adeptus Mechanicus. Keep your techno barbarians out of our territory and we shall not be forced to act."; + } + } + if (diplo_keyphrase == "artifact_thanks") { + diplo_text = "We thank you for your help in retrieving this artifact, though we would doubtless have located it eventually."; + } + if (diplo_keyphrase == "artifact_angry") { + diplo_text = "The Mechanicus does not forgive theft and the Mechanicus does not forgive. We will avenge this. We will return and make you pay."; + } + if (diplo_keyphrase == "stc_thanks") { + rando = choose(1, 2, 3, 4, 5, 6); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "I had every confidence that engaging in a mutually beneficial relationship with you would prove a wise move. I had, in non-logical parlance, a 'hunch'."; + } + if (rando == 2) { + diplo_text = "It was the most beneficial action that you could take to inform the Mechanicus of this fragment. I calculated you would take it if ever the opportunity was presented to you."; + } + if (rando == 3) { + diplo_text = "Your cooperation in this matter will not go unappreciated, nor will the servants of the Omnissiah forget your name."; + } + if (rando == 4) { + diplo_text += "Honoured ally, you have performed your function with incredible efficiency."; + } + if (rando == 5) { + diplo_text += "+++ Divinitatae Imperator, Dies Optimus Semper +++"; + } + if (rando == 6) { + diplo_text += "A most auspicious gift, Chapter Master, which will not be forgotten."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "We are pleased with your contribution, Astartes. An explorator has been dispatched to receive what is ours- you would do well to ensure the STC sanctity remains intact."; + } + if (rando == 2) { + diplo_text = "It is pleasing that you made the logical choice in this matter. Our evaluation of you will be adjusted accordingly."; + } + if (rando == 3) { + diplo_text = "You have acted in the interests of the Imperium, giving to us what we can utilize for humanity, now trust our judgment to do the same for you."; + } + if (rando == 4) { + diplo_text += "This gift is valuable. Your status in relation to the Mechanicus will be reappraised and reassigned."; + } + if (rando == 5) { + diplo_text += "The origin, purpose, authenticity and quality of this gift will be evaluated before you receive any thanks."; + } + if (rando == 6) { + diplo_text += "Gratitude is an illogical emotion, do not expect any. Instead, accept that Mechanicus will continue to act as is dictated by logic and the Omnissiah."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "Your actions simply prove that you are afraid that the hands of the Machine God are coming for you. Deus Vult."; + } + if (rando == 2) { + diplo_text = "We thank you for the fragment but it has not caused us to forgive or to forget. In the eyes of the Omnissiah, you have been seen to be unworthy."; + } + if (rando == 3) { + diplo_text = "While you have acted like a loyal servant in this case, it does not erase the records of your trespasses."; + } + if (rando == 4) { + diplo_text += "Query; where did you attain such a technological marvel? Hypothesis; from the lords of chaos. Conclusion; You are an enemy."; + } + if (rando == 5) { + diplo_text += "The servants of the Omnissiah cannot be bought with trinkets, no matter how valuable, Chapter Master."; + } + if (rando == 6) { + diplo_text += "Your clumsy attempt to curry favour with us has been seen through and will be recorded as yet another flaw in your character."; + } + } + } + if (diplo_keyphrase == "bombard_angry") { + diplo_text = "When you strike at us, you strike the guns from the hands of the soldiers of the God Emperor. This is unacceptable and you have not heard the last of this."; + } + if (diplo_keyphrase == "trading_demand") { + if (rela == "friendly") { + diplo_text = "Speak, Chapter Master."; + } + if (rela == "neutral") { + diplo_text = "I am awaiting your query."; + } + if (rela == "hostile") { + var randoo = 0; + randoo = floor(random(100)) + 1; + if (randoo == 1) { + diplo_text = "Calculations reveal that depending on your query we may have to beat your ass."; + } + if (randoo != 1) { + diplo_text = "Certain queries may have to be answered by action."; + } + } + add_diplomacy_option({ + option_text: "Demand Requisition", + }); + add_diplomacy_option({ + option_text: "Cancel", + goto: "disagree", + }); + } + } + // ** Inquisition ** + if (diplomacy == 4) { + if (diplo_keyphrase == "intro") { + rando = choose(1, 1, 2); + if (rando == 1) { + tempd = "[[An ancient and well respected Inquistor Lord, " + string(faction_leader[eFACTION.Inquisition]) + " has purged heresy and exterminated mutants for well over four centuries. His steely gaze and iron will have broken as many heretics as have the tools of persuasion wielded by his retinue. Were he to die, the Ordo " + choose("Malleus", "Xenos", "Hereticus") + " would dearly miss his services.]]"; + } + if (rando == 2) { + tempd = "[[A thousand heretics have cursed the name of " + string(faction_leader[eFACTION.Inquisition]) + " with their last breath but he is still not satisfied. Remorse is as alien to him as pity and he will stop at nothing to destroy the enemies of purity.]]"; + } + tempd += "\n#"; + if (rela == "friendly") { + tempd += "Ave Imperator, Chapter Master. You show great promise and I look forward to seeing you bring the light of the Emperor to " + string(obj_ini.sector_name) + "."; + } + if (rela == "neutral") { + tempd += "Greetings, space marine. Serve the Emperor in body and soul and you shall have nothing to fear from the Inquisition."; + } + if (rela == "hostile") { + tempd += "I hear worrying rumors about your conduct, astartes. I have no doubt we will meet again soon."; + } + diplo_text = tempd; + } + if (diplo_keyphrase == "hello") { + if (rela == "friendly") { + diplo_text += "Hail, hero of " + string(obj_ini.sector_name) + ". How may I assist you this day?"; + } + if (rela == "neutral") { + diplo_text += "Praise be to the Emperor. What is your business here?"; + } + if (rela == "hostile") { + diplo_text += "State your business, for many heretics pray the Emperor's mercy."; + } + } + if (diplo_keyphrase == "trade_close") { + if (rela == "friendly") { + diplo_text = "There are few people I would allow to back out of a deal in such a way, Chapter Master. Think of this as a symbol of my friendship."; + } + if (rela == "neutral") { + diplo_text = "I have work to do Space Marine, much of it implements of torture and stubborn heretics, please make sure you are ready to commit to a deal when you interrupt my labours next time."; + } + if (rela == "hostile") { + diplo_text = "Do not delude yourself in thinking I was truly going to trade with you. Much of my interest was a ruse."; + } + } + if (diplo_keyphrase == "demand_refused") { + rando = choose(1, 2); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "Only a true friend would be given such a courteous message as this; the Inquisition does not agree and does not take kindly to such requests."; + } + if (rando == 2) { + diplo_text = "I don't believe I will accept this request, Chapter Master, but do not let it dishearten you."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "Do not attempt to sway the mind of an Inquisitor, Chapter Master, it cannot be done."; + } + if (rando == 2) { + diplo_text = "While your request is not without merit, I think not."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "Idleness and greed are the signs of a heretic, Chapter Master."; + } + if (rando == 2) { + diplo_text = "Do not presume, Chapter Master, for you too will be judged by the Inquisition."; + } + } + } + if (string_count("agree", diplo_keyphrase) > 0) { + if (trading_artifact == 0) { + diplo_text = string(trade_msg) + "\n"; + } + if ((trading_artifact != 0) || (liscensing > 0)) { + diplo_text = "[[Trade Accepted.]]\n"; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "An interesting proposal. I look forward to the fruition of this deal."; + } + if (rando == 2) { + diplo_text += "Agreed, may the Emperor bless us both."; + } + if (rando == 3) { + diplo_text += "Exactly what I wished for; this will benefit us both."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "Then we are in agreement."; + } + if (rando == 2) { + diplo_text += "Let it be so then and may it benefit us both."; + } + if (rando == 3) { + diplo_text += "This arrangement will be mutually beneficial."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "It goes against my instincts, but you have a deal."; + } + if (rando == 2) { + diplo_text += "I believe we shall both come to regret this, but I agree."; + } + if (rando == 3) { + diplo_text += "Try and play me for a fool and you will be destroyed, but I agree."; + } + } + } + if (diplo_keyphrase == "disagree") { + if (trading_artifact == 0) { + diplo_text = "[[Trade Refused]]\n"; + } + if (trading_artifact == 1) { + diplo_text = ""; + } + annoyed[diplomacy] += 2; + if ((rela == "friendly") && (annoyed[diplomacy] >= 8)) { + diplo_text += "I cannot help you at this time and advise that you cease pressing the matter."; + force_goodbye = 1; + turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 1); + diplo_last = string(diplo_keyphrase); + diplo_char = 0; + diplo_alpha = 0; + exit; + } + if ((rela == "neutral") && (annoyed[diplomacy] >= 6)) { + diplo_text += "You are testing my patience, astartes."; + force_goodbye = 1; + disposition[diplomacy] -= 2; + turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 1); + diplo_last = string(diplo_keyphrase); + diplo_char = 0; + diplo_alpha = 0; + exit; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "I apologize but my resources must be directed in a different direction."; + } + if (rando == 2) { + diplo_text += "It pains me to deny you but I fear I must."; + } + if (rando == 3) { + diplo_text += "Unfortunately, I and my forces have a prior engagement."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "I do not believe this will help either of us."; + } + if (rando == 2) { + diplo_text += "Tempting... but no, I must decline."; + } + if (rando == 3) { + diplo_text += "Perhaps circumstances will change but for now I must decline."; + } + } + if (rela == "hostile") { + disposition[diplomacy] -= 2; + force_goodbye = 1; + turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 3); + if (rando == 1) { + diplo_text += "Not even when the gates of the immaterium have closed, heretic!"; + } + if (rando == 2) { + diplo_text += "Heresy leaks from your every word. I would rather burn than agree."; + } + if (rando == 3) { + diplo_text += "You have either mistaken me for a fool or wish to offend me. Look to your sins, heretic."; + } + } + } + if (diplo_keyphrase == "attacked") { + diplo_text = "You shall pay dearly for this, as shall your entire chapter. So swears " + string(faction_leader[eFACTION.Inquisition]) + "!"; + } + if ((diplo_keyphrase == "declare_war") && (sorc == false)) { + force_goodbye = 1; + turns_ignored[diplomacy] += 4; + diplo_text = "You have stepped far beyond the acceptable conduct for an Astartes. Look to your sins and prepare to face the Emperor's judgment."; + } + if (diplo_keyphrase == "accept_peace") { + diplo_text = "For now, your judgement shall be postponed. Thank the Emperor for your respite, or perhaps whatever dark gods you now worship would be more appropriate."; + } + if (diplo_keyphrase == "ignored") { + diplo_text = "Idleness breeds heresy, marine, and I hear that you have been greatly idle of late."; + } + if (diplo_keyphrase == "denounced") { + if (faction_justmet == 1) { + disposition[diplomacy] -= 15; + faction_justmet = 0; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + disposition[diplomacy] -= choose(0, 1); + if (rando == 1) { + diplo_text = "Words are wind and mean nothing between two servants of the Emperor's eternal glory."; + } + if (rando == 2) { + diplo_text = "Your deeds speak far louder than the words that issue from your mouth, and they speak of heroism and loyalty."; + } + if (rando == 3) { + diplo_text = "An ego is nothing more than a tool for the darkness to use against a servant of the Emperor. Say what you will of me."; + } + } + if (rela == "neutral") { + disposition[diplomacy] -= 2; + force_goodbye = 1; + if (rando == 1) { + diplo_text = "I cannot agree with what you have said, but perhaps you have your reasons. I hope they are good ones."; + } + if (rando == 2) { + diplo_text = "I will remember what you said today and you will be held accountable."; + } + if (rando == 3) { + diplo_text = "In the future, I ask that you consider what you are saying before you say it."; + } + } + if (rela == "hostile") { + disposition[diplomacy] -= 4; + force_goodbye = 1; + if (rando == 1) { + diplo_text = "You dare besmirch the honour of the Inquisition!? You have crossed a line this day!"; + } + if (rando == 2) { + diplo_text = "The mouths of heretics are ever full of lies and filth."; + } + if (rando == 3) { + diplo_text = "When you stand before the Emperor in death, He will remind you of what you said today."; + } + } + } + if (diplo_keyphrase == "praised") { + if (faction_justmet == 1) { + disposition[diplomacy] += 2; + faction_justmet = 0; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "You flatter me, but it would be churlish to deny the truth in your words."; + } + if (rando == 2) { + diplo_text = "You speak only the truth, noble Astartes, as is befitting of one of the Emperor's sons."; + } + if (rando == 3) { + diplo_text = "Thanks are owed for your kind words and I cannot deny they are accurate."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "I will remember those words, but they will not stay my blade if your actions call for it to fall."; + } + if (rando == 2) { + diplo_text = "If only I could believe your actions were as pure as your words."; + } + if (rando == 3) { + diplo_text = "I thank you for the compliment but it will not turn my course."; + } + } + if (rela == "hostile") { + disposition[diplomacy] -= 1; + force_goodbye = 1; + if (rando == 1) { + diplo_text = "If you think kissing my boots will make me overlook your crimes you are sorely mistaken."; + } + if (rando == 2) { + diplo_text = "For a true servant of mankind's Emperor, compliments mean nothing. Only vindication in serving him brings us satisfaction."; + } + if (rando == 3) { + diplo_text = "Take your liar's, heretic tongue elsewhere, lest I cut it out and roast it on an open fire."; + } + } + } + if (diplo_keyphrase == "offer") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text = "I believe we would both benefit greatly from an exchange."; + } + if (rando == 2) { + diplo_text = "A trade of goods and services would be most useful at this time."; + } + if (rando == 3) { + diplo_text = "Do you wish to trade with me for some of the resources in my possession?"; + } + } + if (diplo_keyphrase == "open_trade") { + diplo_text = "Make me an offer and I shall consider it, both for its value and its potential heresy."; + } + if (diplo_keyphrase == "artifact") { + add_diplomacy_option({ + option_text: "Propose a trade for the Artifact.", + }); + add_diplomacy_option({ + option_text: "Leave it be; Exit.", + }); + diplo_text = "The Inquisition is, of course, aware of the artifact in question. What, precisely, are you offering for it?"; + } + if (diplo_keyphrase == "artifact_thanks") { + diplo_text = "You have earned the gratitude of the Inquisition, my friend, and you shall be rewarded. This artifact will serve as a reminder of my debt to you."; + } + if (diplo_keyphrase == "stc_thanks") { + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "A treasured relic of the Imperium’s glorious past? You do us great honour, Chapter Master."; + } + if (rando == 2) { + diplo_text += "As wise as you are fearsome, you choose to place this sacred relic in the care of the Inquisition. We thank you."; + } + if (rando == 3) { + diplo_text += "Your decision shows you to be a skilful leader, Chapter Master, for only the Inquisition can be trusted with such a hallowed relic."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "It is just that you choose to entrusts such a precious relic to the Inquisition, mankind’s most stalwart defenders in this dark age."; + } + if (rando == 2) { + diplo_text += "Such artifacts may provide a return to the Golden age of Mankind and the Inquisition are the best candidates to guide us there. Wise decision, Space Marine."; + } + if (rando == 3) { + diplo_text += "While you smite the Heretic and the Xenos, the Inquisition will will bring light to the sector with this artifact."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "You think that the Inquisition forgive slights simply because you hand us gifts? You are wrong, we take it to remove it from your heretical grasp."; + } + if (rando == 2) { + diplo_text += "And where did you acquire such an artefact? From your daemonical accomplices? This device bares careful consideration."; + } + if (rando == 3) { + diplo_text += "A relic owned by a being such as you cannot be taken at face value, much like the honeyed words of a serpent. We are watching you, Astartes."; + } + } + } + if (diplo_keyphrase == "artifact_daemon") { + if (rela == "friendly") { + diplo_text = "There are few Astartes who have the wisdom and the humility to recognise when their own abilities are not suited to the task in hand. You are one Marine in a thousand, my friend. The Inquisition shall not forget your humble service to the Emperor."; + } + if (rela == "neutral") { + diplo_text = "The Inquisition will guard this artifact well, I swear it. Only when it has been assured that the foul daemon contained within has no chance of escape will it be used against the Emperor's enemies. Well done, Astartes, you have done the right thing."; + } + if (rela == "hostile") { + diplo_text = "Only the truest, most noble and most incorruptible servants of the Emperor can be trusted with such an artifact. None but the Inquisition have the immutable will to wield such things. Despite the mistakes you have made in the past, it is good that you have recognised our superiority. Perhaps there is hope for you still, but I doubt it."; + } + } + if (diplo_keyphrase == "artifact_returned") { + scr_quest(3, "artifact_return", 4, 0); + diplo_text = "It is well that you have returned the artifact, late though it may be."; + if (rela == "friendly") { + diplo_text += " Do not let this happen again."; + } + if (rela != "friendly") { + diplo_text += " Our faith was still poorly placed- if you fail another task there will be dire consequences for your chapter. Is this understood?"; + } + } + if (diplo_keyphrase == "artifact_angry") { + diplo_text = "No man, no woman, no marine, no heretic and no piece of xenos scum steals from the Inquisition and escapes unmarked. There will be a reckoning."; + } + if (diplo_keyphrase == "gene_trade") { + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "Chapter Master, even a hero of the Imperium like yourself must abide by the rules of the great Codex Astartes. Please desist in the trading of Gene-seed immediately."; + } + if (rando == 2) { + diplo_text = "As loathe as I am to reprimand you, I must demand that you cease trading away the genetic material of your chapter."; + } + if (rando == 3) { + diplo_text = "Normally, I would leave the running of your chapter in your very capable hands. But the trading of your Gene-seed must stop and I will not be moved on this."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "Even Astartes are held to the rule of Law. And those laws decree that Gene-seed is to remain within the Chapter of its origin."; + } + if (rando == 2) { + diplo_text = "No matter what was offered, a true Astartes does not barter away what is both their birthright and their future. The trading of your Gene-seed must stop."; + } + if (rando == 3) { + diplo_text = "The Imperium allows Chapter Masters free hands in most of their dealings, but on the trading of Gene-seed we must shackle you, firmly and completely."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "You look like a heretic, sound like a heretic and act like a heretic, for only a heretic would place such little store on their own Gene-seed. Prove I am mistaken or there will be dire consequences."; + } + if (rando == 2) { + diplo_text = "By Holy Terra, I need but one more reason to wipe the stain of your existence from the universe and if you do not cease trading in Genetic material, I will have it."; + } + if (rando == 3) { + diplo_text = "When you choose to act outside the rule of Law and trade in forbidden substances, the Inquisition will either bring you back to the Law or bring the Law to you."; + } + } + gene_sold = 0; + // diplo_text="[Missing Dialogue: gene_angry]"; + } + if (diplo_keyphrase == "gene_xeno") { + rando = choose(1, 2, 3); // diplo_text="[Missing Dialogue: gene_xeno]"; + if (rando == 1) { + diplo_text = "You risk the sanctitude of the Emperor's holy sons, the Adeptus Astartes, and for what? Some paltry material reward? You will reap the seeds you have sown, traitor."; + } + if (rando == 2) { + diplo_text = "No matter your past deeds, you are now an enemy of the Imperium. Only an enemy would give away our most valued secret, the base of the Astartes themselves."; + } + if (rando == 3) { + diplo_text = "You have handed away the root of the Imperium's most powerful warriors to foul xenos. Did you truly believe a crime of this magnitude would escape the eye of the Imperium?"; + } + faction_status[diplomacy] = "War"; + var lol = ""; + lol = string(obj_controller.faction_title[diplomacy]) + " " + string(obj_controller.faction_leader[diplomacy]) + $" declares war on the {global.chapter_name}."; + scr_event_log("red", lol); + force_goodbye = 1; + gene_xeno = 0; + } + if (diplo_keyphrase == "trading_demand") { + if (rela == "friendly") { + diplo_text = "Remember whom you speak to, Chapter Master."; + } + if (rela == "neutral") { + diplo_text = $"I, Inquisitor Lord {faction_leader[eFACTION.Inquisition]}, on behalf of the Inquisition, am awaiting your words."; + } + if (rela == "hostile") { + diplo_text = "Speak your next words very carefully, Astartes, for they may be your last."; + } + add_diplomacy_option({ + option_text: "Demand Requisition", + }); + + add_diplomacy_option({ + option_text: "Skip Inspection", + choice_func: inquis_demand_inspection_pass, + }); + + if (inspection_passes > 0) { + add_diplomacy_option({ + option_text: "Skip Inspection (Use pass)", + choice_func: inquis_use_inspection_pass, + }); + } + add_diplomacy_option({ + option_text: "Cancel", + goto: "disagree", + }); + } + if (diplo_keyphrase == "penitent_end") { + rando = choose(1, 2); + if (rando == 1) { + diplo_text = "It seems that congratulations are in order. While some might think the Inquisition blind to the possibility that it, that is to say we, could ever do wrong, it is not so. I know that we are as fallible as any man, save the Emperor, and can make mistakes when judging character. I took you for a traitor to humanity's cause. I see that I was wrong now and let it not be said I will not give credit where it is due; well done, Chapter Master. May the enemies of mankind speak your name in fear and humanity in adoration."; + } + if (rando == 2) { + diplo_text = "Few return from a penitent crusade, Chapter Master, and I find that those who do are invariably changed by the experience. Tell me, do you feel your vision expanded? Your faults exposed and then erased by his glorious light? I do not doubt that you do. To battle the Emperor's enemies without any thought of pause or relief is the highest form of honour, the highest form of service. You are to be congratulated on your diligence and dedication, not to mention your skill at arms."; + } + } + if (diplo_keyphrase == "assassination_angry") { + // aa|planet_name|planet number| + + var _event = audience_data; + var _system = _event.system; + var _planet = _event.planet; + var _star_name = planet_numeral_name(_planet, star_by_name(_system)); + diplo_text = $"My patience is wearing thin, Chapter Master. I have many more problems more urgent and, yet, you continue to force me away from the work assigned to me by He on Terra. Your serf on {_star_name} will be executed along with all the other puppets I ferret out. You are close to treason, Chapter Master. Choose your next words with exceptional care for they may be your last."; + + add_diplomacy_option({ + option_text: "It will not happen again", + key: "serf_removal_submit", + choice_func: function() { + scr_dialogue("you_better"); + force_goodbye = 1; + hunt_player_serfs(audience_data.planet, audience_data.system); + alter_dispositions([[eFACTION.Imperium, -15], [eFACTION.Inquisition, -30], [eFACTION.Ecclesiarchy, -10]]); + exit; + }, + }); + add_diplomacy_option({ + option_text: "Very well", + key: "serf_removal_accept", + choice_func: function() { + force_goodbye = 1; + + hunt_player_serfs(audience_data.planet, audience_data.system); + + alter_dispositions([[eFACTION.Imperium, -15], [eFACTION.Inquisition, -30], [eFACTION.Ecclesiarchy, -10]]); + exit; + }, + }); + + if (obj_controller.disposition[eFACTION.Inquisition] >= 70) { + add_diplomacy_option({ + option_text: "Perhaps We can come to an arrangement", + tooltip: "This action will trigger a Charisma test", + choice_func: function() {}, + }); + } + add_diplomacy_option({ + option_text: $"You will not. {_star_name} is MINE!", + key: "serf_removal_defy", + force_goodbye: 1, + choice_func: function() { + alter_dispositions([[eFACTION.Imperium, -30], [eFACTION.Inquisition, -60], [eFACTION.Ecclesiarchy, -30]]); + }, + goto: "die_heretic", + }); + } + if (diplo_keyphrase == "you_better") { + rando = choose(1, 2); + if (rando == 1) { + diplo_text = "I do not know if you are guided by choice or incompetence, Chapter Master, however you are not the only player in this most dangerous game you insist upon pursuing. There is no more room for failure."; + } + if (rando == 2) { + diplo_text = "Ensure this is your last mistake, Chapter Master. You and your ivory tower you think stand so tall above man is not indestructible."; + } + } + if (diplo_keyphrase == "die_heretic") { + rando = choose(1, 1, 2); + if (rando == 1) { + diplo_text = "Very well, Chapter Master. I will bury you and your Chapter so thoroughly even I will forget your existence."; + } + if (rando == 2) { + if (obj_ini.fleet_type == ePlayerBase.home_world) { + diplo_text = "I understand. I am authorizing the deployment of cyclonic torpedoes. Make peace with your homeworld, Chapter Master."; + } + if (obj_ini.fleet_type != ePlayerBase.home_world) { + diplo_text = "I am mobilizing the Segmentum battlefleet. You may run, heretic, but it will do you no good."; + } + } + var ev = 0; + add_event({ + e_id: "game_over_man", + duration: 1, + }); + } + rando = choose(1, 2, 3); + if (diplo_keyphrase == "chaos_audience1") { + force_goodbye = 1; + if (rando == 1) { + diplo_text = "I have been notified of your corrospondences with " + string(faction_leader[eFACTION.Chaos]) + ". There is no reason for you to talk to such a villain, your only interactions should be both short lived and extremely violent."; + } + if (rando == 2) { + diplo_text = "Whatever your reasons for seeking an audience with traitors, they can not be sufficient and I trust you will not repeat your mistake."; + } + if (rando == 3) { + diplo_text = "The words of those who have turned from His light are not worth risking the sanctity of your soul to listen to."; + } + } + if (diplo_keyphrase == "chaos_audience2") { + force_goodbye = 1; + if (rando == 1) { + diplo_text = "If you give aid to or converse with a heretic or a traitor, you're either a heretic or a traitor. Either way, consider yourself under close scrutiny, Chapter Master."; + } + if (rando == 2) { + diplo_text = "The only people who have any desire to hear the poison that spews from the lips of heretics are other heretics. You have been warned."; + } + if (rando == 3) { + diplo_text = "I can only conclude that you have no conception of how despicable your actions are because you have lost all feeling for how heretical it is to converse with a heretic."; + } + } + if (diplo_keyphrase == "sorcery1") { + force_goodbye = 1; + if (rando == 1) { + diplo_text = "It pains me to see an Astartes debase his chapter by using the tools of a heretic, especially when you have access to sanctioned psyker powers. Ensure that it does not happen again."; + } + if (rando == 2) { + diplo_text = "The use of magik and sorcery in place of those powers deemed acceptable by the Imperium is simply not acceptable, Chapter Master. You have been warned."; + } + if (rando == 3) { + diplo_text = "Please desist from wielding the same weapons as heretics, traitors and chaos filth, lest you become one of them."; + } + } + if ((diplo_keyphrase == "sorcery2") || (sorc == true)) { + rando = choose(1, 1, 2, 2, 2, 3, 3, 3); + force_goodbye = 1; + turns_ignored[diplomacy] += 4; + if (rando == 1) { + diplo_text = "Did you not think that the Inquisition might notice the use of sorcerous and heretical powers? You are either foolish beyond belief or wish for your own destruction."; + } + if (rando == 2) { + diplo_text = "To wield such heretical powers in the face of an Inquisitorial inspection speaks of a traitorous streak so deep it can only be purged with fire."; + } + if (rando == 3) { + diplo_text = "You wield the weapons of a traitor, probably gifted to you by a daemonic ally, and you will be dealt with as a traitor; you will be purged."; + } + } + if (diplo_keyphrase == "loyalty_zero") { + disposition[2] -= 20; + disposition[3] -= 15; + disposition[4] -= 20; + disposition[5] -= 20; + diplo_text = "Your arrogant, blatant disregard for proper Imperial conduct can no longer go unanswered, Astartes. Time and time again you have ignored the Imperium's call to arms, refusing to strike out at the enemies of man when it was most needed, and callously ignored the Inquisition's wants. It has become clear that you are not in line with the High Lords of Terra and His will. This heresy must be cut from your Chapter like the festering blight it is. You may either atone for your Chapter's crimes, in penitence, or see it ground to dust around you."; + // Speak your next words carefully, Chapter Master, for they may damn all the souls of your men to oblivion. + + add_diplomacy_option({ + option_text: "You are right in that we must account for our sins. Let our Penitence begin.", + goto: "loyalty_penitence", + }); + add_diplomacy_option({ + option_text: "I answer only to the Emperor himself, not to the likes of you.", + goto: "die_heretic", + }); + add_diplomacy_option({ + option_text: "Threaten my Chapter at your own peril.", + goto: "die_heretic", + }); + } + if (diplo_keyphrase == "loyalty_penitence") { + diplo_text = "Brothers, hear my words! It is time to embark on a sacred journey of redemption, a penitence crusade to cleanse our souls. Our past wrongdoings have led us astray form the Emperor, but through unwavering determination and righteous deeds, we shall forge a path to absolution. With every battle fought, every sacrifice made, we shall restore honor to our name and rekindle the flame of righteousness within. "; + + var tx = $"The {global.chapter_name} become Penitent."; + scr_alert("green", "halp", string(tx), 0, 0); + scr_event_log("", string(tx)); + + var str = round((marines + command) / 130); + obj_ini.penitent = 1; + obj_ini.penitent_current = 0; + obj_ini.penitent_max = (str * 1000) + 300; + obj_ini.penitent_end = str * 48; + obj_controller.penitent = 1; + obj_controller.penitent_current = 0; + obj_controller.penitent_max = obj_ini.penitent_max; + obj_controller.penitent_end = obj_ini.penitent_end; + + loyalty = 50; + loyalty_hidden = 50; + force_goodbye = 1; + } + } + // ** Ecclesiarchy ** + if (diplomacy == 5) { + var _diag_data = { + faction_leader: faction_leader[eFACTION.Ecclesiarchy], + sector: obj_ini.sector_name, + relationship: rela, + annoyed: annoyed[diplomacy], + turns_ignored: turns_ignored[diplomacy], + chapter_name: global.chapter_name, + master_name: obj_ini.master_name, + faction_status: obj_controller.faction_status[eFACTION.Ecclesiarchy], + }; + var _diag_set = global.dialogue.sisters; + diplo_text = create_dialogue_string(global.dialogue.sisters, diplo_keyphrase, _diag_data); + + if (struct_exists(data, "prepend")) { + diplo_text = $"{data.prepend} {diplo_text}"; + } + + if (diplo_keyphrase == "disagree") { + if (trading_artifact == 0) { + diplo_text = "[[Trade Refused]]\n"; + } + if (trading_artifact == 1) { + diplo_text = ""; + } + annoyed[diplomacy] += 2; + if ((rela == "neutral") && (_diag_data.annoyed >= 8)) { + force_goodbye = 1; + turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 1); + diplo_last = string(diplo_keyphrase); + diplo_char = 0; + diplo_alpha = 0; + exit; + } + + if (rela == "hostile") { + force_goodbye = choose(0, 1); + if (_diag_data.annoyed >= 4) { + turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 1); + diplo_last = string(diplo_keyphrase); + diplo_char = 0; + diplo_alpha = 0; + } + } + } + if (diplo_keyphrase == "declare_war") { + force_goodbye = 1; + turns_ignored[diplomacy] += 4; + known[diplomacy] = max(2, known[diplomacy]); + } + if (diplo_keyphrase == "denounced") { + if (faction_justmet == 1) { + disposition[diplomacy] -= 5; + faction_justmet = 0; + } + scr_loyalty("Irreverance for His Servants", "+"); + } + if (diplo_keyphrase == "praised") { + if (faction_justmet == 1) { + alter_disposition(diplomacy, 3); + faction_justmet = 0; + } + } + + if (diplo_keyphrase == "artifact") { + add_diplomacy_option({ + option_text: create_dialogue_string(_diag_set, "propose_arti_trade", _diag_data), + }); + add_diplomacy_option({ + option_text: create_dialogue_string(_diag_set, "leave_it", _diag_data), + }); + } + + if (diplo_keyphrase == "artifact_daemon") { + if (rela == "friendly") { + obj_controller.disposition[5] -= 2; + } else if (rela == "neutral") { + obj_controller.disposition[5] -= 6; + } else if (rela == "hostile") { + obj_controller.disposition[5] -= 10; + } + if (_diag_data.faction_status == "Allied") { + obj_controller.faction_status[eFACTION.Ecclesiarchy] = "Antagonism"; + } + } + + if (diplo_keyphrase == "trading_demand") { + add_diplomacy_option({ + option_text: "Demand Requisition", + }); + add_diplomacy_option({ + option_text: "Cancel", + goto: "disagree", + }); + } + } + // ** Eldar ** + if (diplomacy == 6) { + if (string_count("intro", diplo_keyphrase) > 0) { + if (faction_gender[6] == 1) { + diplo_text = "[[" + string(faction_leader[diplomacy]) + " is a farseer, or witch, of the eldar. He is dressed in a typical fashion of his position, clad in flowing black cloth and bone-like armour. Almost seeming to relish in conflict, this xeno is known in local records for " + choose("sudden raid on trade vessels", "assassinating a pair of planetary govererners") + ". It is unlikely " + string(faction_leader[diplomacy]) + " will be receptive to diplomacy- further audiences are ill-advised.]]"; + } + if (faction_gender[6] == 2) { + rando = choose(1, 2, 3); + diplo_text = "[[" + string(faction_leader[diplomacy]) + " is a witch; an old farseer of eldar kind. While obviously a female, the grating voice and inhuman proportions are an unholy mockery of the human form. She seems to avoid contact with the Imperium, as is befitting a xeno. Little is known about " + string(faction_leader[diplomacy]) + ", other than "; + if (rando == 1) { + diplo_text += "random1."; + } + if (rando == 2) { + diplo_text += "random2."; + } + if (rando == 3) { + diplo_text += "rumors of her involvement at the massacre of "; + diplo_text += global.name_generator.generate_star_name(); + diplo_text += " " + choose("I.", "II.", "III.", "IV."); + } + diplo_text += " Do not expect futher contact.]]"; + } + diplo_text += "\n#"; + // * Normal craftworld reveal * + if (string_count("1", diplo_keyphrase) > 0) { + if (scr_has_adv("Enemy: Eldar")) { + diplo_text += "This is our home, Mon'keigh. Leave it in peace or feel the full wrath of Kaela Mensha Khaine."; + } else { + if (scr_has_disadv("Tolerant")) { + diplo_text += "Your future is clouded, human. Will you be a tool, or a thorn in our side?"; + } else { + diplo_text += "Another repulsive Mon'keigh. Leave the Eldar alone, primitive. You have no idea what you face."; + } + } + } + // * Running into eldar ships * + if (string_count("2", diplo_keyphrase) > 0) { + if (scr_has_disadv("Tolerant") && (!scr_has_adv("Enemy: Eldar"))) { + diplo_text += "This meeting is long since due. I pray that you pull back your forces, " + string(obj_ini.master_name) + ". None of this concerns you."; + } else { + diplo_text += "You do not understand that which you trifle with. Leave or be eradicated."; + } + } + // * Request audience * + if (diplo_keyphrase == "intro") { + if (scr_has_adv("Enemy: Eldar")) { + diplo_text += "Another repulsive Mon'keigh. Leave the Eldar alone, primitive, you have no idea what you face."; + } else { + if (scr_has_disadv("Tolerant")) { + diplo_text += "We have been expecting you, " + string(obj_ini.master_name) + "."; + } else { + diplo_text += "The skeins have foretold of our meeting, Space Marine."; + } + } + } + diplo_text += tempd; + } + if (diplo_keyphrase == "hello") { + if (rela == "friendly") { + diplo_text = choose("For what reason does " + string(obj_ini.master_name) + " seek an audience?", "You require something, " + string(obj_ini.master_name) + "?", "I have a moment or two to spare. Speak."); + } + if (rela == "neutral") { + diplo_text = choose("I hope you have good reason for this audience.", "What is it, space marine?", "Do not waste my time."); + } + if (rela == "hostile") { + rando = floor(random(100)) + 1; + if ((rando > 0) && (rando <= 32)) { + diplo_text = "What is it, mon-keigh?"; + } + if ((rando > 32) && (rando <= 64)) { + diplo_text = "Do not waste my time."; + } + if ((rando > 64) && (rando <= 95)) { + diplo_text = "What is the quickest way I may be rid of you?"; + } + if ((rando > 95) && (rando <= 99)) { + diplo_text = "The runes did not foretell listening to your blabbering Mon-keigh mouth."; + } + if (rando == 100) { + diplo_text = "I have little patience for your antics. You... you... DOUBLE MON-KEIGH."; + } + } + } + if (diplo_keyphrase == "trade_close") { + if (rela == "friendly") { + diplo_text = "While you are intelligent for a Mon'keigh, I sometimes forget the limitations of your race. You find it difficult to plan ahead with any efficiency, so I do not take this as a slight."; + } + if (rela == "neutral") { + diplo_text = "Oh, did you see a pretty light? Why don't you go and chase it? I shall return to my own affairs, which are far beyond your understanding."; + } + if (rela == "hostile") { + diplo_text = "Typical Mon'keigh, confused in its intentions to the point of injuring itself. Contact me again when you've climbed a few rungs higher on the evolutionary ladder."; + } + } + if (diplo_keyphrase == "demand_refused") { + rando = choose(1, 2); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "While I would like to help you, there are more important things afoot in the galaxy than your problem."; + } + if (rando == 2) { + diplo_text = "Mon'keigh, I would like to help you but I cannot currently."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "I have heard words like these a thousand times from Mon'keigh. And I can only give you one answer; No."; + } + if (rando == 2) { + diplo_text = " If you could only understand the complexity of my schemes... then perhaps you would understand why I cannot currently help you. Alas, my plans are far beyond your feeble mind."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "Children such as yourself should not be as presumptuous with their elders and betters."; + } + if (rando == 2) { + diplo_text = "Seek not the reasons for my denial of what you seek, know only that you have neither the skill to find them nor the wisdom to interpret them."; + } + } + } + if (diplo_keyphrase == "agree") { + if (trading_artifact == 0) { + diplo_text = string(trade_msg) + "\n"; + } + if (trading_artifact != 0) { + diplo_text = "[[Trade Accepted.]]\n"; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "We are agreed."; + } + if (rando == 2) { + diplo_text += "Very well."; + } + if (rando == 3) { + diplo_text += "Your logic is clear."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "Hmm. I will say yes...this time."; + } + if (rando == 2) { + diplo_text += "Fine, we'll do it your way."; + } + if (rando == 3) { + diplo_text += "An unlikely alliance, at best. Still, it shall happen."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "It appears I have no other choice but to do as you say Mon'keigh."; + } + if (rando == 2) { + diplo_text += "A repulsive way to put it, Mon'keigh...but yes."; + } + if (rando == 3) { + diplo_text += "I agree, though not for the reasons you present."; + } + } + } + if (diplo_keyphrase == "disagree") { + if (trading_artifact == 0) { + diplo_text = "[[Trade Refused]]\n"; + } + if (trading_artifact == 1) { + diplo_text = ""; + } + annoyed[diplomacy] += 2; + if ((rela == "friendly") && (annoyed[diplomacy] >= 6)) { + diplo_text += "You test my boundries, " + string(obj_ini.master_name) + ", and I find tiresome."; + force_goodbye = 1; + turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 2); + diplo_last = string(diplo_keyphrase); + diplo_char = 0; + diplo_alpha = 0; + exit; + } + if ((rela != "friendly") && (annoyed[diplomacy] >= 4)) { + diplo_text += choose("I will suffer your presence no longer.", "Expect consequences for this offense"); + force_goodbye = 1; + turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 4); + diplo_last = string(diplo_keyphrase); + diplo_char = 0; + diplo_alpha = 0; + exit; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "You test my patience, " + string(obj_ini.master_name) + "."; + } + if (rando == 2) { + diplo_text += "I see no good coming of this."; + } + if (rando == 3) { + diplo_text += "I must decline."; + } + // 25% chance to close window + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "This is of no concern to us."; + } + if (rando == 2) { + diplo_text += "I cannot allow such a deal."; + } + if (rando == 3) { + diplo_text += "Simply unacceptable."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "Remember your place, mon-keigh."; + } + if (rando == 2) { + diplo_text += "Do not insult me with such an offer."; + } + if (rando == 3) { + diplo_text += "Expect consequences for this offense."; + } + force_goodbye = choose(0, 0, 0, 1); + } + } + if (diplo_keyphrase == "attacked") { + if (rela != "friendly") { + diplo_text = "Normal 'we were attacked' line goes here."; + } + if (rela == "friendly") { + diplo_text = "I would say 'you should know better', " + string(obj_ini.master_name) + ", but children are incapable of acting with wisdom, as is their nature.\nThis act of war obliges us to respond in kind. I expect to see you upon the fields of battle."; + } + } + if (diplo_keyphrase == "declare_war") { + force_goodbye = 1; + turns_ignored[diplomacy] += 4; + diplo_text = "The Bloody-Handed God calls for your destruction. We shall only rest when your filth is cleansed from this sector."; + } + if (diplo_keyphrase == "accept_peace") { + diplo_text = "A civilization does not survive for as long as ours has without knowing when to put down its weapons. One must also know when to use them again, however."; + } + /*if (diplo_keyphrase="ignored"){ diplo_text=""; }*/ - if (diplo_keyphrase=="denounced"){ - if (faction_justmet==1){ - disposition[diplomacy]-=10; - faction_justmet=0; - } - if (rela=="friendly"){ - rando=choose(1,2,3); - force_goodbye=choose(0,0,0,1); - if (rando==1) then diplo_text="You know not what you speak of."; - if (rando==2) then diplo_text="There are many mysteries, not all easy to understand."; - if (rando==3) then diplo_text="Our ways are not your ways, "+string(obj_ini.master_name)+"."; - } - if (rela!="friendly"){ - rando=choose(1,2,3,4,5); - force_goodbye=1; - if (rando==1) then diplo_text="You are like a child."; - if (rando==2) then diplo_text="Your words harm no one but yourself."; - if (rando==3) then diplo_text="This audience serves no purpose."; - if (rando==4) then diplo_text="These words spill forth from your mon-keigh mouth like worms."; - if (rando==5) then diplo_text="I expect more of a sapient being."; - } - } - if (diplo_keyphrase=="praised"){ - if (faction_justmet==1){ - disposition[diplomacy]+=1; - faction_justmet=0; - } - if (rela=="friendly"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text="You are amusingly perceptive for your species."; - if (rando==2) then diplo_text="A rare, but accurate judgement, "+string(obj_ini.master_name)+"."; - if (rando==3) then diplo_text="If only you could grasp how little you have understood... I thank you for the compliment none-the-less."; - } - if (rela!="friendly"){ - rando=choose(1,2,3,4,5); - if (rando==1) then diplo_text="Your words are hollow."; - if (rando==2) then diplo_text="Compliments from a Mon-keigh are as meaningless as the guttural growls of the Orks."; - if (rando==3) then diplo_text="Do not presume to understand us well enough to appreciate the full breadth and complexity of our actions."; - if (rando==4) then diplo_text="You are as a man upon laying eyes upon the ocean for the first time; amazed at what he has seen but woefully ignorant of how much he is still unaware of."; - if (rando==5) then diplo_text="Save your words for your “battle brothers”, to whom they will undoubtedly mean much more."; - } - } - if (diplo_keyphrase=="offer"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text="We offer you this."; - if (rando==2) then diplo_text="This trade will benefit all."; - if (rando==3) then diplo_text="What say you of this deal?"; - } - if (diplo_keyphrase=="open_trade") then diplo_text="Speak."; - if (diplo_keyphrase=="artifact"){ - diplo_text=$"Representatives of the Imperium, as the Chapter Master of {global.chapter_name}, I inform you of a potential artifact within our possession, one that we are willing to trade."; - } - if (diplo_keyphrase=="artifact_thanks"){ - diplo_text="We... thank you, for the gift of this imperial curio. I am sure it will prove useful for something. What, I am not sure."; - } - if (diplo_keyphrase=="artifact_angry"){ - diplo_text="Mon'keigh, there will be a reckoning for the arrogance you have displayed here! You cannot take what you please from our lands and worlds, without paying for it in blood or in a more peaceful currency."; - } - if (diplo_keyphrase=="stc_thanks"){ - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="How quaint, a relic of the “golden age” of your “civilisation”. Nevertheless, you meant it to be a kind gesture and I thank you."; - if (rando==2) then diplo_text+="A kind gesture, even if it is a little... pointless. I am grateful that you have seen past the foolish prejudices of your species."; - if (rando==3) then diplo_text+="I remember when these devices were commonplace. Even then, your species was blind to the wisdom of my people. I thank you for the trinket though."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="With your limited mental capacity, I suppose you can’t imagine a more advanced piece of technology, which is amusing. I thank you for the jest."; - if (rando==2) then diplo_text+="I suspect you imagined this dusty piece of technology would help us in some way? Amusing. However, we accept the gift anyway."; - if (rando==3) then diplo_text+="Your species generally scrabbles for traces of the time before, when you were far greater than you are now. It is good you are letting go and accepting your present lot."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="A child, handing an adult a misshapen failure of a sculpture made of spit, rocks and hope. Still, perhaps we shall find space for it, somewhere."; - if (rando==2) then diplo_text+="It is a wonder your species ever mastered space travel, if this was the pinnacle of your “technology”. I don’t know what you expect me to do with it."; - if (rando==3) then diplo_text+="How brutish, how dirty. I shall fear to put it down, in case it contaminates part of my Craftworld. Perhaps the void would be a better place for it?"; - } - } - if (diplo_keyphrase=="trading_demand"){ - if (rela=="friendly") then diplo_text="You have proven yourself an able ally, "+string(obj_ini.master_name)=". Consider your next words thoroughly and deliberately."; - if (rela=="neutral") then diplo_text="Speak up, Mon'keigh."; - if (rela=="hostile"){ - rando=choose(1,1,2,2,3); - if (rando==1) then diplo_text="Make your demands, Mon'keigh, so that I might refute them."; - if (rando==2) then diplo_text="You may not always have what you wish for, Mon'keigh."; - if (rando==3) then diplo_text="Were I a lesser being, such as yourself, spitting in your face might prove tempting."; - } - add_diplomacy_option({option_text:"Demand Requisition"}); - add_diplomacy_option({option_text:"Demand Useful Information"}); - add_diplomacy_option({ - option_text:"Cancel", - goto:"disagree" - }); - } - if (diplo_keyphrase=="mission1"){ - diplo_text="The good that might come from simple acts of benevolence are oft underestimated. A token goodwill gesture can go far, "; - if (rela=="hostile") then diplo_text+="Mon'keigh"; - if (rela!="hostile") then diplo_text+="human"; - - diplo_text+=". Even something as small as water, raw material, and sustenance can have a profound efect."; - add_diplomacy_option({ - option_text:"Give 500 Requisition", - goto : "elder_mission1_thanks", - choice_func : function(){ - scr_loyalty("Xeno Trade","+"); - scr_quest(2,"fund_elder",6,0); - requisition-=500; - } - }); - add_diplomacy_option({ - option_text:"Maybe", - goto : "quest_maybe", - }); - add_diplomacy_option({ - option_text:"Refuse", - goto : "mission1_refused", - choice_func : function(){ - scr_quest(3,"fund_elder",6,0); - questing=0; - } - }); - questing=1; - } - if (diplo_keyphrase=="elder_mission1_thanks"){ - scr_recent("eldar_mission","completed",1); - rando=choose(1,1,1,2,2,3,3,3); - if (rando==1) then diplo_text="You intend to hand over these resources? Without a promise of compensation? You are a strange human, Chapter Master. Few would do this, and it will not be forgotten."; - if (rando==2) then diplo_text="As little as I expected you to be this generous, I cannot claim complete surprise. While I am a little surprised you were as quick to comply, I expected you to see the light in due course."; - if (rando==3) then diplo_text="It is not that I am surprised but I confess a little confusion at your forthright generosity. Perhaps you expect something in return? Regardless, I thank you."; - } - if (diplo_keyphrase=="mission1_refused"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text="Just as I expected, you are exactly like every other member of your race. I have met a great many Mon'keigh in my life, and you are no different from the rest."; - if (rando==2) then diplo_text="As a brainless fool shouting at the tide to stop, you do your best to fight the inevitable. I shall endure this, however. You too, shall die."; - if (rando==3) then diplo_text="Expected. You have done nothing than fulfill my projected outcome. If you think yourself clever for refusing or especially loyal to your leader, do not. You are no more fervent or intelligent than any other Mon'keigh soldier."; - } - if (diplo_keyphrase=="mission1_failed"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text="One would think, with a life span as short as yours, you would have a better memory. It's not as though you live long enough to have enough time to properly forget anything. This insult will not be forgotten, Mon'keigh."; - if (rando==2) then diplo_text="You are as predictable as a the rest of your kind. You say things and make promises, which slip from your tiny mind mere moments afterwards. I pity you more than I scorn you."; - if (rando==3) then diplo_text="While your mind might be too small to record things for more than a few years, I remember the birth of your “Imperium”. I also remember your words, Mon'keigh. You have, predictably, disappointed me."; - force_goodbye=1; - } - if (diplo_keyphrase=="quest_maybe"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text="Ah, the ever cautious Mon'keigh, too scared by the shadow of his precious Emperor to try something new, to adventure a little. Hardly surprising."; - if (rando==2) then diplo_text="While this is not the gesture I was referring to, I suppose the fact you are yet to scream and shout about ‘Xenos Scum' must be taken as a minor miracle."; - if (rando==3) then diplo_text="Not hard to see why your species is so universally viewed as foolish. Still, perhaps you will manage to be a little more enlightened than the rest."; - questing=0; - clear_diplo_choices(); - } - if (diplo_keyphrase=="useful_information"){ - var found=0; - rando=choose(1,1,2,3,4,4,5); - force_goodbye=-1; - - for(var i=30; i<30; i++){ - if (rando==5) and (string_count("CM|",obj_controller.useful_info)>0) then rando-=1; - if (rando==4) and (random_event_next != eEVENT.none) then rando-=1; - if (rando==3) and ((turn3)) then rando-=1; - if (rando==2) and ((known[eFACTION.Ork]<0) or (known[eFACTION.Ork]>=3) or (string_count("WL7|",obj_controller.useful_info)=1)) then rando-=1; - if (rando==1) and (string_count("WG|",obj_controller.useful_info)>1) then rando=5; - } - // * Most corrupt mahreen * - if (rando==5){ - obj_controller.useful_info+="CM|"; - - var him_c=0,him_i=0,him_num=0,him_cor=0,split=""; - - split=scr_max_marine("chaos"); - - explode_script(split,"|"); - him_c=real(explode[0]); - him_i=real(explode[1]); - him_num=string(explode[2]); - him_cor=real(explode[3]); - - if (him_cor==0) then diplo_text="I have looked into the strands of fate, with your chapter, and found that the future is not suspect for any of your men. None of them have their minds poisoned by the taint of chaos."; - if (him_cor>0) then diplo_text="I have looked into the strands of fate, with your chapter. Your 'battle brother' "+string(him_num)+" has a clouded, dark future- it is advised you watch him carefully."; - } - // * Next random event * - if (rando==4){ - scr_random_event(false); - if (random_event_next == eEVENT.strange_behavior) and (obj_controller.disposition[6]<15) then diplo_text="One of your Mon'keigh soldiers will no longer act as you expect him to. Be wary, when one Mon'keigh is influenced the rest of the herd will be."; - else if (random_event_next == eEVENT.strange_behavior) and (obj_controller.disposition[6]>=15) then diplo_text="One of your soldiers will no longer act as you expect him to. Be wary, when one is influenced the rest of the herd will be."; - else if (random_event_next == eEVENT.space_hulk) then diplo_text="It comes from the warp, a relic from the past. It is steeped in the energies of the ethereal tides. Beware."; - else if (random_event_next == eEVENT.promotion) then diplo_text="One of your soldiers will cover himself in glory. As his “Chapter Master”, a title I find inherently foolish, you may wish to reward him."; - else if (random_event_next == eEVENT.strange_building) then diplo_text="The Red robed ones, their “Machine God”, calls to them. Soon, one shall lose their tenuos grip on the here and now and follow the pictures in his head."; - else if (random_event_next == eEVENT.sororitas) then diplo_text="Your priestesses of war, who worship He Who Fell, will gather their forces soon, to stay."; - else if (random_event_next == eEVENT.inquisition_mission) then diplo_text="They will come very soon, the bearers of hellfire and hate. They will scour the sector for so-called ''Heresy''."; - else if (random_event_next == eEVENT.inquisition_planet) then diplo_text="Your questions askers seek to learn more of a planet. Warp meddlers and free thinkers would be well-served with caution. Beware, Chapter Master."; - else if (random_event_next == eEVENT.rogue_trader) then diplo_text="Free thinkers, traders in the vast expanse. They are coming, perhaps you aught to set out your wares?"; - else if (random_event_next == eEVENT.fleet_delay) then diplo_text="Mon'keigh, your fleets may be delayed by my kin. Eldar Pirates, your kind would call them."; - else if (random_event_next == eEVENT.harlequins) then diplo_text="Rillietann. They have come. They are on some world, hidden, or soon will be."; - else if (random_event_next == eEVENT.succession_war) then diplo_text="Your underlings fight for power, Mon'keigh. Someone will die who believes he is important. His children and ''friends'' will vie for the rite to call himself or herself governor. Or king. Or whatever self aggrandising title your people name yourselves."; - else if (random_event_next == eEVENT.random_fun) then diplo_text="Something will happen soon. The runes do not show me exactly what will happen, only that it concerns you. Watch the horizon, Mon'keigh."; - else if (random_event_next == eEVENT.warp_storms) then diplo_text="The tides of the Immaterium are unsettled. Of course, it's hard to calculate where the Immaterium will affect the Materium, but I predict it will come soon."; - else if (random_event_next == eEVENT.enemy_forces) then diplo_text="From beyond your circle of firelight, they are coming. Rest not Mon'keigh, for they will come soon and are bent on destruction."; - else if (random_event_next == eEVENT.crusade) then diplo_text="Soon, your masters will call you to heel like a dog to attack the foes of man. One of your ''Crusades'' of hate, ignorance and bigotry will be called."; - else if (random_event_next == eEVENT.enemy) then diplo_text="You will make an enemy among your fellow man. Soon they shall whisper into their lord's ear, telling that you are a threat, a beetle to be crushed beneath their boot. You would do well to speak carefully, for some time."; - else if (random_event_next == eEVENT.mutation) then diplo_text="Your 'battle brothers' are twisting like snakes beneath your feet. Watch yourself, Chapter Master."; - else if (random_event_next == eEVENT.ship_lost) then diplo_text="The Immaterium will swallow one of your ships. Do not look for it to return."; - else if (random_event_next == eEVENT.chaos_invasion) then diplo_text="Your twisted brethren, who fell to the lure of the Immaterium, will soon arrive with their wrath and demons. Beware."; - else if (random_event_next == eEVENT.necron_awaken) then diplo_text="Our old enemies, the men of metal, are close. You call them “Necrons”, and you will need to fight them soon. Or flee, it matters not to me."; - else { - diplo_text="[Missing Dialogue: "+string(random_event_next)+" forcast.]"; // this will print a number rather that a string which is less than ideal, but we can just add new flavour text whem we get the bug reports - } - } - // * Chaos warlord location * - if (rando==3){ - obj_controller.useful_info+="WL10|"; - if (obj_controller.faction_gender[10]==1){ - for(var i=0; i<5; i++){ - if (found==0){ - instance_activate_object(obj_star); - with(obj_temp5){instance_destroy();} - with(obj_star){ - for(var i=1; i<=4; i++){ - if (planet_feature_bool(p_feature[1], P_features.Warlord10)==1) then instance_create(x,y,obj_temp5); - } - } - if (instance_exists(obj_temp5)){ - var you,nuum,plan=0; - you=instance_nearest(obj_temp5.x,obj_temp5.y,obj_star); - nuum=you.name; - for(var i=1; i<=you.planets; i++){ - if (planet_feature_bool(you.p_feature[1], P_features.Warlord10)==1) then plan=i; - } - found=1; - diplo_text=$"The fallen warlord of your kind is located somewhere within the {nuum} system. More I cannot say. It would be prudent to deal with this soon- that abomination may not remain there long."; - } - }} - } - if (obj_controller.faction_gender[10]==2){ - diplo_text="The Lord of Rage turns his foul gaze upon this sector. With it death and destruction will soon come. You had best be ready when it does."; - } - } - // * Ork Warboss Location * - if (rando==2){ - obj_controller.useful_info+="WL7|"; - for(var i=0; i<5; i++){ - if (found==0){ - instance_activate_object(obj_star); - with(obj_temp5){instance_destroy();} - with(obj_star){ - for(var i=1; i<=4; i++){ - if (planet_feature_bool(p_feature[1], P_features.OrkWarboss)==1) then instance_create(x,y,obj_temp5); - } - } - if (instance_exists(obj_temp5)){ - var you,nuum,plan=0; - you=instance_nearest(obj_temp5.x,obj_temp5.y,obj_star); - nuum=you.name; - for(var i=1; i<=you.planets; i++){ - if (planet_feature_bool(you.p_feature[1], P_features.OrkWarboss)==1) then plan=i; - } - if (you.p_orks[plan]<6) then you.p_orks[plan]=6; - diplo_text="The greenskin horde is led by a massive Ork, one who calls himself "+string(faction_leader[eFACTION.Ork])+". If this warboss were to perish the rest might be dealt with in a more languorous fashion. He is located on "+string(nuum); - if (plan==1) then diplo_text+=" I."; - if (plan==2) then diplo_text+=" II."; - if (plan==3) then diplo_text+=" III."; - if (plan==4) then diplo_text+=" IV."; - found=1; - } - } - } - } - // * Webway Gate Location * - // if (rando=1) and (string_count("WG|",obj_controller.useful_info)=2) then rando+=choose(1,2,3,3); - if (rando==1){ - obj_controller.useful_info+="WG|"; - if (string_count("WG|",obj_controller.useful_info)==1){ - for(var i=0; i<5; i++){ - if (found==0){ - instance_activate_object(obj_star); - with(obj_temp6){instance_destroy();} - with(obj_temp5){instance_destroy();} - if (obj_ini.fleet_type==ePlayerBase.home_world) then with(obj_star){if (owner==1) then instance_create(x,y,obj_temp6);} - if (obj_ini.fleet_type != ePlayerBase.home_world) then with(obj_p_fleet){if (capital_number>0) then instance_create(x,y,obj_temp6);} - - with(obj_star){ - if (owner != eFACTION.Imperium) then instance_deactivate_object(id); - if (owner == eFACTION.Imperium) and (point_distance(x,y,obj_temp6.x,obj_temp6.y)>250) then instance_deactivate_object(id); - if (owner == eFACTION.Imperium) and (planets<1) then instance_deactivate_object(id); - } - var that,good=0; - that=instance_nearest(random(room_width),random(room_height),obj_star); - for(var i=0; i<5; i++){ - if (good==0) then with(that){ - var j=0,onceh=0; - for(var k=0; k<10; k++){ - j=floor(random(planets))+1; - if (array_length(p_feature[j])==0) and (onceh==0) then onceh=j; - } - if (onceh!=0){ - array_push(p_feature[onceh], new NewPlanetFeature(P_features.Webway)); - obj_controller.temp[90] = planet_numeral_name(onceh); - } - } - } - if (good==1){ - diplo_text="A series of labyrinthian corridors and veins connect the galaxy. The planet you know as "+string(obj_controller.temp[90])+" contains a dormant entrance to this realm."; - found=1; - } - } - } - } - if (string_count("WG|",obj_controller.useful_info)==2){ - for(var i=0; i<5; i++){ - if (found==0){ - instance_activate_object(obj_star); - with(obj_temp6){instance_destroy();} - with(obj_temp5){instance_destroy();} - if (obj_ini.fleet_type==ePlayerBase.home_world) then with(obj_star){if (owner==1) then instance_create(x,y,obj_temp6);} - if (obj_ini.fleet_type != ePlayerBase.home_world) then with(obj_p_fleet){if (capital_number>0) then instance_create(x,y,obj_temp6);} - with(obj_star){ - if (owner != eFACTION.Imperium) then instance_deactivate_object(id); - if (owner == eFACTION.Imperium) and (point_distance(x,y,obj_temp6.x,obj_temp6.y)<800) then instance_deactivate_object(id); - if (owner == eFACTION.Imperium) and (planets<1) then instance_deactivate_object(id); - } - var that,good=0; - that=instance_nearest(random(room_width),random(room_height),obj_star); - for(var j=0; j<5; j++){ - if (good==0){ - with(that){ - var onceh=0; - for(var k=0; k<10; k++){ - var i=floor(random(planets))+1; - if (array_length(p_feature[i])==0) and (onceh==0) then onceh=i; - } - if (onceh!=0){ - array_push(p_feature[onceh], new NewPlanetFeature(P_features.Webway)); - obj_controller.temp[90] = planet_numeral_name(onceh); - } - } - } - } - if (good==1){ - diplo_text="The second dormant webway gate lays upon "+string(obj_controller.temp[90])+"."; - found=1; - } - } - } - } - with(obj_temp6){instance_destroy();} - with(obj_temp5){instance_destroy();} - instance_activate_object(obj_star); - } - } - } - // ** ORKZZZ ** - if (diplomacy==7){ - if (disposition[diplomacy]>=20) then rela="friendly"; - if (disposition[diplomacy]<20) and (disposition[diplomacy]>=-20) then rela="neutral"; - if (disposition[diplomacy]<-20) then rela="hostile"; - // * Request audience * - if (diplo_keyphrase=="intro"){ - rando=choose(1,2); - if (rando==1) then diplo_text="[["+string(faction_leader[diplomacy])+" is the scourge of the sector, a colossal green brute infamous for the destruction of a dozen worlds. He rules his vicious horde of xenos savages the only way greenskins know how; with brute force. Trophies from the champions of a score of races bedeck his armour, including many from "+string(choose("other Astartes","the Tyranids","the Tau Empire"))+".]]"; - if (rando==2) then diplo_text="[["+string(faction_leader[diplomacy])+" is a veteran of countless engagements, leading his tribe into battle with an almost manic giddiness. His name is synonymous with extended campaigns of looting and senseless violence, even more so than the other members of his barbaric race. He and the rest of his tribe hail from the "+string(choose("Goffs","Blood Axes","Bad Moons","Death Skulls","Death Skulls"))+" clan.]]"; - diplo_text+="\n#"; - if (scr_has_adv("Enemy: Orks")){ - diplo_text+="Oi Beaky! I ain't heard your name round here before! If ya eva get bored of havin' your ‘ead attached to your shouldas, good old "+string(faction_leader[diplomacy])+" can sort dat out for ya!"; - } else { - if (scr_has_disadv("Tolerant")){ - diplo_text+="You seem good for a scrap, ya beaky faced ponce! Bring your lads down my way some time and we'll have one!"; - } else { - diplo_text+="All you space marines seem da same ta me. I reckon we'll be seein' each other soon enough..."; - } - } - diplo_text+=tempd; - } - if (diplo_keyphrase=="new_warboss"){ - rando=choose(1,1,1,2); - diplo_text="[["+string(faction_leader[diplomacy])+" is the scourge of many sectors, a colossal green brute infamous for the destruction of dozens of worlds. His name is synonymous with extended campaigns of looting and senseless violence, even more so than the other members of his barbaric race. He and the rest of his tribe hail from the "+string(choose("Goffs","Blood Axes","Bad Moons","Death Skulls","Death Skulls"))+" clan. He is recently arrived to the sector, bringing with him a massive invasion fleet.]]"; - diplo_text+="\n#"; - if (rando==1) then diplo_text+="I've got good news, humie! "+string(faction_leader[diplomacy])+" is da warboss now! An' ya know wot dat means? It means yer krumped! Krumped good an' well, just as soon as me Mekboys get dis piece o junk movin'. Thaz right! Get ready fer a foight, humies; me an' da boyz'll be antsy when we gets there, and it'd be downroight inhorspitotalibile not to give us a good one!" - if (rando==2) then diplo_text+="Tasty humie worldz. All dat loot. All dat MEAT. By Gork an Mork, we's gonna smash it all up wiv an ax, burn it to da ground and have a proppa meal! "+string(faction_leader[diplomacy])+" is da warboss now, and I's commin for you humie! Git ready for da WWWAAAGGGGGGGGGGHHHHHHH!" - } - if (diplo_keyphrase=="hello"){ - if (rela=="friendly"){ - rando=choose(1,2); - if (rando==1) then diplo_text+="Hey, if it isn't me favorite ‘umie! What can I do for ya? Want some help with some skumgrods, a quick trade or just come to chat with old "+string(faction_leader[eFACTION.Ork])+"?"; - if (rando==2) then diplo_text+="Pull up a chair, Chapta masta! Want some fungus ale? It's good stuff! There's even a squig fight on in da pits today! Oh, but you're always buisness, ain't ya?"; - } - if (rela=="neutral"){ - rando=choose(1,2); - if (rando==1) then diplo_text+="Alright ‘umie, whatcha want? I got betta things ta do today but ‘umies are always good for a laugh so I'll give ya a little while."; - if (rando==2) then diplo_text+="Go on den ‘umie, say you piece. But if ya call me xenos or mention the Emprah even once, this is gunna end badly."; - } - if (rela=="hostile"){ - rando=choose(1,2); - if (rando==1) then diplo_text+="What da zog do ya want, ‘umie? I ain't in da mood for any of your squig dung, so make it quick before I start shootin'."; - if (rando==2) then diplo_text+="Ya got eight words to tell me what you want, ‘cause dat's how many finers I got left. After dat, I'll show ya what I learned losing the other three."; - } - } - if (diplo_keyphrase="trade_close"){ - if (rela=="friendly") then diplo_text="Oi', don't rush off! Why don't ya drink a fungus ale wit me and the nobz? We could discuss business while watching a squigfight! No? Suit ya self."; - if (rela=="neutral") then diplo_text="Well dat was a waste of time. See ya ‘around Space Marine."; - if (rela=="hostile") then diplo_text="Next time you says you got a deal for me, you beta zoggin' well ‘ave one!"; - } - if (diplo_keyphrase=="demand_refused"){ - rando=choose(1,2); - if (rela=="friendly"){ - if (rando==1) then diplo_text="Nah, I ain't seein it mate. Maybe next time, 'eh?"; - if (rando==2) then diplo_text="Dun't sound like fun, Spash Mareen. I fink I'll take the boys for a scrap someplace else."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="Get lost 'umie, I got me own fings ta do."; - if (rando==2) then diplo_text="I'll fink about it but I ain't sure it sounds like fun."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="Da only fing I'll 'elp ya with is the removal of you head!"; - if (rando==2) then diplo_text="Next time ya want somefing, try askin' someone who dun't fink you're a piece of mouldy grot dung."; - } - } - if (string_count("agree",diplo_keyphrase)>0){ - if (trading_artifact==0) then diplo_text=string(trade_msg)+"\n"; - if (trading_artifact!=0) or (liscensing>0) then diplo_text="[[Trade Accepted.]]\n"; - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="Ha, this is gunna be a whole lot of fun! I'm in!"; - if (rando==2) then diplo_text+="You ain't green but ya fink like an ork all right! It's a deal!"; - if (rando==3) then diplo_text+="‘ERE WE GO, ‘ERE WE GO, ‘ERE WE GO!"; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="Yeah, all right, why not?"; - if (rando==2) then diplo_text+="You're lucky I'm such a nice boss, no other ork'd agree to this."; - if (rando==3) then diplo_text+="Well, I don't see no reasons why I shouldn't agree."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="I dun't like it but I ain't got no choice."; - if (rando==2) then diplo_text+="If you cross me, I'll pick me teef with your ribs!"; - if (rando==3) then diplo_text+="You're a lousy ‘umie skumgrod but you got a deal."; - } - } - if (diplo_keyphrase=="disagree"){ - if (trading_artifact==0) then diplo_text="[[Trade Refused]]\n"; - if (trading_artifact==1) then diplo_text=""; - annoyed[diplomacy]+=2; - if (annoyed[diplomacy]>=6){ - diplo_text+="You'ze wasting my time."; - force_goodbye=1; - turns_ignored[diplomacy]=max(turns_ignored[diplomacy],4); - diplo_last=string(diplo_keyphrase); - diplo_char=0; - diplo_alpha=0; - exit; - } - if (rela=="friendly"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text+="Not dis time but don't let it get ya down."; - if (rando==2) then diplo_text+="Ha, sounds like a good time but dere's too many squigs on me plate right now."; - if (rando==3) then diplo_text+="Pull the uvver one mate, it's got bells on it!"; - // 25% chance to close window - } - if (rela=="neutral"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text+="Nah, I don't like the sound of dat."; - if (rando==2) then diplo_text+="Maybe some uvver time, there's a fight on at the squig pits."; - if (rando==3) then diplo_text+="Find some uvver ork, this one ain't got da time."; - } - if (rela=="hostile"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text+="Not a chance, ya fleshy pink git!"; - if (rando==2) then diplo_text+="I got a better idea; get zogged!"; - if (rando==3) then diplo_text+="If dat's a serious offer, you're out of your tiny ‘uman mind."; - force_goodbye=choose(0,0,0,1); - } - } - if (diplo_keyphrase=="attacked"){ - diplo_text="So it's krumping time is it, you stupid beaky!? I'm gunna find you and smash your zogging face in with me bare hands! Nobody starts a fight round ‘ere ‘cept me!"; - } - if (diplo_keyphrase=="declare_war"){ - force_goodbye=1; - turns_ignored[diplomacy]+=4; - diplo_text="Me boyz ain't fought anyone for... at least half a zoggin' hour! It's skrapping time and may da best ork win!"; - } - if (diplo_keyphrase=="denounced"){ - if (faction_justmet==1){ - disposition[diplomacy]-=5; - faction_justmet=0; - } - if (rela=="friendly"){ - rando=choose(1,2,3);// force_goodbye=1; - if (rando==1) then diplo_text="Ha, I know ya dun't mean that!"; - if (rando==2) then diplo_text="Say dat again and I'll slap ya ‘round the head, ya daft git! Just kiddin'!"; - if (rando==3) then diplo_text="If ya think dat, ya must have squig dropping between yur ears."; - } - if (rela=="neutral"){ - rando=choose(1,2,3);// force_goodbye=1; - if (rando==1) then diplo_text="Words is all ya got, is it?"; - if (rando==2) then diplo_text="Dat was a paffetic excuse for an insult, dung-for-brains."; - if (rando==3) then diplo_text="We'll just see if dem words are true, won't we?"; - } - if (rela=="hostile"){ - rando=choose(1,2,3); - force_goodbye=choose(0,0,1); - if (rando==1) then diplo_text="Say dat to me face and see what happens, ya gork damned beaky!"; - if (rando==2) then diplo_text="I'm gunna take dem words and ram ‘em down your throat!"; - if (rando==3) then diplo_text="Let's see ya say that without a head!"; - } - } - if (diplo_keyphrase=="praised"){ - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text="You're a mate, ta say such nice fings about little ole' me."; - if (rando==2) then diplo_text="Dat's da truth, plain and simple. Well said!."; - if (rando==3) then diplo_text="Job's a good ‘un!"; - } - if (rela=="neutral"){ - force_goodbye=choose(0,0,0,1); - if (rando==1) then diplo_text="You know how ta polish a name, but do ya know how to wield a blade?"; - if (rando==2) then diplo_text="That dun't push me one way or the uvver."; - if (rando==3) then diplo_text="Words don't last, ‘umie, it's deeds that get remembered."; - } - if (rela=="hostile"){ - force_goodbye=choose(0,1); - if (faction_justmet==1) then force_goodbye=1; - if (rando==1) then diplo_text="Get your nose outta me arse ‘umie! I dun't want your pretty words, just your head!"; - if (rando==2) then diplo_text="Quick ta turn tail and kiss arse, ain't ya? It wun't help."; - if (rando==3) then diplo_text=string(faction_leader[diplomacy])+" dun't like be called names by ‘umies, not even good ones."; - } - if (faction_justmet==1){ - disposition[diplomacy]+=5; - faction_justmet=0; - } - } - if (diplo_keyphrase=="offer"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text="You wanna swap dis ‘ere fine bolter for dat fing?"; - if (rando==2) then diplo_text="Oi, you want some of dis? Special offer for a limited time only!"; - if (rando==3) then diplo_text="Take it or leave it, dat's me final offer."; - } - if (diplo_keyphrase=="stc_thanks"){ - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="It’s a... shinybit! Fanks fer da shinybit Beaky!"; - if (rando==2) then diplo_text+="Wot, so it’s like a box o’ ideas fer ‘Umie teknology? Fanks!"; - if (rando==3) then diplo_text+="Cor, looks real nice! I’ll stick it on me Choppa!"; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="It’s a... not really useful fer anyfin’, is it?"; - if (rando==2) then diplo_text+="Ya know ‘umie, I dun’t like bitz that dun’t do nuffin’. Just sayin’ fer next time."; - if (rando==3) then diplo_text+="So wat, ya want a fank you note or summin’?"; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="If ya dun’t zog off, I’m gunna ram dis down yer throat!"; - if (rando==2) then diplo_text+="Fanks, now get lost ‘afore I smashes ya!"; - if (rando==3) then diplo_text+="Maybe one o’ da grots will like it, ‘cos I dun’t."; - } - } - if (diplo_keyphrase=="artifact_thanks"){ - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text="Thanks mate, dis'll make a good toof pick!"; - if (rando==2) then diplo_text="Cor, shiny fing, ain't it!? Dun't worry, I'll find a place fer it."; - if (rando==3) then diplo_text="Yer a good mate, givin' me such nice dakka!"; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="Not bad, not bad. I'll see if I can find sum grot ta use it."; - if (rando==2) then diplo_text="Aright, just dun't spect me ta give ya one back for Gorkmas!"; - if (rando==3) then diplo_text="Well, so long as ya aren't askin' for sum teef in return fer it."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="Ha, you givin' me a somefin ta shove down your throat, beaky!?"; - if (rando==2) then diplo_text="It wus mine anyway, seein' as I'll take all yer stuff eventually."; - if (rando==3) then diplo_text="Wot a piece o' rubbish. ‘Ope you got better dakka an' dis somewhere."; - } - } - if (diplo_keyphrase=="open_trade") then diplo_text="Wut?"; - if (diplo_keyphrase=="trading_demand"){ - diplo_text="Yeah? Wut?"; - add_diplomacy_option({option_text:"Demand Requisition"}); - add_diplomacy_option({option_text:"Demand Military Assistance"}); - add_diplomacy_option({ - option_text:"Cancel", - goto:"disagree" - }); - } - } - // ** Tau ** - if (diplomacy==8){ - if (diplo_keyphrase=="intro"){ - rando=choose(1,2); - if (rando==1) then tempd="[[Tall and slender, its skin is blue and clammy-looking. Disgusting. Its face contains two large, expressionless eyes, a slit-like mouth, and a bizarre I-shaped gash between its eyes that must function as a nose. So this is "+string(faction_title[8])+" "+string(faction_leader[eFACTION.Tau])+". This particular xenos is said to "+choose("have quite the silver tongue","have negotiated the surrender of many Imperial worlds","have a great deal of military backing.")+".]]"; - if (rando==2) then tempd="[[Tall and slender, its skin is a light blue and looks almost reptilian. A Y-shaped slit nestles between its eyes, and a mouth like a slit sits below that. This must be "+string(faction_title[8])+" "+string(faction_leader[eFACTION.Tau])+". The Ordo Xenos tells us that this particular xeno "+choose("can sense weakness in a rock","knows more than it will let on","uses its words like a scalpel")+".]]"; - tempd+="\n#"; - rando=choose(1,2); - if (rando==1) then tempd+="Greetings, Chapter Master. As you know, we have claimed for ourselves planets along the borders of your Imperium. I wish to clarify that we of the Tau do not seek a war. Rather, we hope to cooperate with you so that we may both work towards a Greater Good."; - if (rando==2) then tempd+="Salutations, "+string(obj_ini.master_name)+". I represent the interests of the Tau Empire. We wish to exist in peace beside you for now, and hope that one day you will see the wisdom of the Greater Good. We will be more than happy to accept you into the fold, for the way of the Tau is one of benevolence and acceptance."; - diplo_text=tempd; - } - if (diplo_keyphrase=="hello"){ - if (rela=="friendly") then diplo_text=string(obj_ini.master_name)+"! How may we help one another today?"; - if (rela=="neutral") then diplo_text="We welcome you, Chapter Master. What do you wish of the Tau?"; - if (rela=="hostile") then diplo_text="Chapter Master. Have you finally decided to submit yourself to The Greater Good?"; - } - if (diplo_keyphrase=="trade_close"){ - if (rela=="friendly") then diplo_text="I will await your word with anxious anticipation, honoured ally, for I am sure something of great importance draws you away."; - if (rela=="neutral") then diplo_text="Please reconsider your actions. I believe we would both benefit from a trade, Gue'la"; - if (rela=="hostile") then diplo_text="I am saddened by your lack of respect, and can only attribute it to inferior cultural surroundings."; - } - if (diplo_keyphrase=="demand_refused"){ - rando=choose(1,2); - if (rela=="friendly"){ - if (rando==1) then diplo_text="While I truly sympathise with your plight, I'm afraid I cannot acquiesce at this time."; - if (rando==2) then diplo_text="I am sorry, friend, but I simply cannot comply at this time."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="It is not possible for such a thing to be done, whatever your reasons."; - if (rando==2) then diplo_text="As eloquent as your arguments have been, I cannot give this my approval."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="It will not happen, and you must deal with that."; - if (rando==2) then diplo_text="No, and that is our final word upon the matter."; - } - } - if (diplo_keyphrase=="agree"){ - if (trading_artifact==0) then diplo_text=string(trade_msg)+"\n"; - if (trading_artifact!=0) then diplo_text="[[Trade Accepted.]]\n"; - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="Yes! We wholeheartedly agree to this deal. The Tau Empire thanks you for your continuing support."; - if (rando==2) then diplo_text+="Of course. We are always happy to be able to meet the needs of our friends and allies- such is the philosophy of the Greater Good."; - if (rando==3) then diplo_text+="Your terms are most amicable. May the light of wisdom shine on you ever, Chapter Master. Greater Good prevails."; - } - if (rela=="neutral"){ - if (rando=1) then diplo_text+="Hmm. Agreed. I hope that this will pave the way to better relations overall."; - if (rando=2) then diplo_text+="We accept. The Greater Good teaches us cooperation, and this is just one of the many ways it applies."; - if (rando=3) then diplo_text+="As you say, we are in need of such things... I think this arrangement will profit us both. Perhaps we shall work together more in the future."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="You drive a hard bargain... but it is for The Greater Good."; - if (rando==2) then diplo_text+="An unfair bargain does no good for any... but you force our hand."; - if (rando==3) then diplo_text+="Under other circumstances we would refuse... but the word of the Aun's is heard by all."; - } - } - if (diplo_keyphrase=="disagree"){ - if (trading_artifact==0) then diplo_text="[[Trade Refused]]\n"; - if (trading_artifact==1) then diplo_text=""; - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text+="I am sorry but I will have to say no for now."; - if (rando==2) then diplo_text+="You must forgive us, but we are unable to agree to your terms. We simply cannot fulfil the obligations you suggest."; - if (rando==3) then diplo_text+="Your terms are agreeable, and past deeds have proven your trustworthiness... but I fear the consequences of this trade."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text+="This arrangement does not benefit us at this time. Perhaps if you were to offer again later..."; - if (rando==2) then diplo_text+="Unfortunately we cannot accept these terms. I apologize."; - if (rando==3) then diplo_text+="We will have to consider it. For now, you would do well to seek another partner."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text+="The Aun's decree is final. Your terms do not benefit The Greater Good."; - if (rando==2) then diplo_text+="Absolutely not. We of the Tau Empire have pride of our own to maintain."; - if (rando==3) then diplo_text+="Your terms are practically insulting. The Greater Good is not so impotent that we cannot simply go to someone else."; - } - } - if (diplo_keyphrase=="attacked"){ - diplo_text="You will regret this day, space marine. The Tau grow stronger by the hour; a dozen races have joined our cause. The Greater Good is no mere philosophy but a way of life we will fight for."; - } - if (diplo_keyphrase=="declare_war"){ - force_goodbye=1; - turns_ignored[diplomacy]+=4; - diplo_text="We have attempted diplomacy, Chapter Master. Time and again, Tau ambassadors have contacted your Imperium with peaceful intentions... and time and again they have been betrayed. No more. It is war, Space Marine. Surrender, or face the fury of those who dream of a Greater Good!"; - } - if (diplo_keyphrase=="accept_peace"){ - diplo_text="We, the Tau, agree to a complete cessation of hostilities. Perhaps you may yet join us and achieve a Greater Good."; - } - if (diplo_keyphrase=="ignored"){ - diplo_text="You request for an audience is granted, but I would hope that you attempt to keep up more regular contact in future."; - } - if (diplo_keyphrase=="denounced"){ - if (faction_justmet==1){ - disposition[diplomacy]-=2; - faction_justmet=0; - } - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text="Was this communication sent in error? Do we not all serve a Greater Good?"; - if (rando==2) then diplo_text="We apologise if we have caused any offence. We are not above admitting our mistakes."; - if (rando==3) then diplo_text="This is most unlike you, Chapter Master. Are you unwell?"; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="Such sentiments are regrettable. We hope one day you realize your mistakes and submit to The Greater Good."; - if (rando==2){diplo_text="Foolish notions are below our recognition. Contact us when you have a message of substance.";force_goodbye=1;} - if (rando==3) then diplo_text="Coming to insults so soon? Embrace The Greater Good, Gue'la, and we will show you the true way."; - } - if (rela=="hostile"){ - force_goodbye=choose(0,0,1); - if (rando==1) then diplo_text="Your tiresome slander is noted and dismissed. We do not hold it against you."; - if (rando==2) then diplo_text="Gue'la are obviously less sophisticated than the Tau. We know not to sling feces at others."; - if (rando==3) then diplo_text="Our greatest poets would respond to your laughable taunts, but none of your race could understand them."; - } - } - if (diplo_keyphrase=="praised"){ - if (faction_justmet==1){ - disposition[diplomacy]+=4; - faction_justmet=0; - } - rando=choose(1,2,3); - if (rela=="friendly"){ - if (rando==1) then diplo_text="Let us feast and celebrate, Chapter Master! Friends like you are rare in these times."; - if (rando==2) then diplo_text="The Greater Good thanks you!"; - if (rando==3) then diplo_text="The Aun's send their humble thanks, Chapter Master. You should feel honoured."; - } - if (rela=="neutral"){ - if (rando==1) then diplo_text="Your entreaty is noted and will be considered in future."; - if (rando==2) then diplo_text="A simple gesture, Chapter Master... but we thank you."; - if (rando==3) then diplo_text="Hmm... perhaps you are not beyond redemption. May the Greater Good be with you, Chapter Master."; - } - if (rela=="hostile"){ - if (rando==1) then diplo_text="Words are cheap, Chapter Master. Actions are worth far more."; - if (rando==2) then diplo_text="Grovelling before The Greater Good? Do you have no pride?"; - if (rando==3) then diplo_text="Forgiveness is earned, not given. Show us your worth, Chapter Master."; - } - } - if (diplo_keyphrase=="offer"){ - rando=choose(1,2,3); - if (rando==1) then diplo_text="Our emissaries bring gifts, Chapter Master. Perhaps you would consider a mutually beneficial arrangement?"; - if (rando==2) then diplo_text="The Aun's ask much of you, Chapter Master... but we are more than willing to repay you in full."; - if (rando==3) then diplo_text="Let us forget our differences, for we may all reap the rewards of The Greater Good."; - } - if (diplo_keyphrase=="open_trade"){ - rando=choose(1,2); - if (rando==1) then diplo_text="Make your proposal and the Tau shall answer."; - if (rando==2) then diplo_text="Ah, you have something that might possibly allow us both to benefit of The Greater Good?"; - } - if (diplo_keyphrase=="artifact_thanks") then diplo_text="Your generosity will not be forgotten, friend of the Tau. What you have done shall advance The Greater Good."; - if (diplo_keyphrase=="stc_thanks"){ - diplo_text="We extend our sincere gratitude to you, noble ally of the Tau, for your generosity. The STC fragment you have bestowed upon us shall not only serve our cause but also contribute significantly to The Greater Good. "; - } - if (diplo_keyphrase=="bombard_angry"){ - diplo_text="What are you doing!? The bombardment of our planet is inexcusable and shall be met with an immediate and forceful response!"; - } - } - - // ** Trading Error Handling ** - if (diplo_keyphrase=="trade_error_1") and (obj_ini.fleet_type==ePlayerBase.home_world) then diplo_text="[Error 1: No valid planet to trade with.]"; - if (diplo_keyphrase=="trade_error_1") and (obj_ini.fleet_type != ePlayerBase.home_world) then diplo_text="[Error 1: No valid fleet to trade with.]"; - if (diplo_keyphrase=="trade_error_2") then diplo_text="[Error 2: "+string(obj_controller.faction[diplomacy])+" has no valid origin for a fleet.]"; - - // ** Sets ignored turns when kicked out of diplomacy screen ** - if (force_goodbye==1){ - turns_ignored[diplomacy]=max(turns_ignored[diplomacy],1); - } - - // ** Resets global vars ** - diplo_last=string(diplo_keyphrase); - diplo_char=0; - diplo_alpha=0; - } - + if (diplo_keyphrase == "denounced") { + if (faction_justmet == 1) { + disposition[diplomacy] -= 10; + faction_justmet = 0; + } + if (rela == "friendly") { + rando = choose(1, 2, 3); + force_goodbye = choose(0, 0, 0, 1); + if (rando == 1) { + diplo_text = "You know not what you speak of."; + } + if (rando == 2) { + diplo_text = "There are many mysteries, not all easy to understand."; + } + if (rando == 3) { + diplo_text = "Our ways are not your ways, " + string(obj_ini.master_name) + "."; + } + } + if (rela != "friendly") { + rando = choose(1, 2, 3, 4, 5); + force_goodbye = 1; + if (rando == 1) { + diplo_text = "You are like a child."; + } + if (rando == 2) { + diplo_text = "Your words harm no one but yourself."; + } + if (rando == 3) { + diplo_text = "This audience serves no purpose."; + } + if (rando == 4) { + diplo_text = "These words spill forth from your mon-keigh mouth like worms."; + } + if (rando == 5) { + diplo_text = "I expect more of a sapient being."; + } + } + } + if (diplo_keyphrase == "praised") { + if (faction_justmet == 1) { + disposition[diplomacy] += 1; + faction_justmet = 0; + } + if (rela == "friendly") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text = "You are amusingly perceptive for your species."; + } + if (rando == 2) { + diplo_text = "A rare, but accurate judgement, " + string(obj_ini.master_name) + "."; + } + if (rando == 3) { + diplo_text = "If only you could grasp how little you have understood... I thank you for the compliment none-the-less."; + } + } + if (rela != "friendly") { + rando = choose(1, 2, 3, 4, 5); + if (rando == 1) { + diplo_text = "Your words are hollow."; + } + if (rando == 2) { + diplo_text = "Compliments from a Mon-keigh are as meaningless as the guttural growls of the Orks."; + } + if (rando == 3) { + diplo_text = "Do not presume to understand us well enough to appreciate the full breadth and complexity of our actions."; + } + if (rando == 4) { + diplo_text = "You are as a man upon laying eyes upon the ocean for the first time; amazed at what he has seen but woefully ignorant of how much he is still unaware of."; + } + if (rando == 5) { + diplo_text = "Save your words for your “battle brothers”, to whom they will undoubtedly mean much more."; + } + } + } + if (diplo_keyphrase == "offer") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text = "We offer you this."; + } + if (rando == 2) { + diplo_text = "This trade will benefit all."; + } + if (rando == 3) { + diplo_text = "What say you of this deal?"; + } + } + if (diplo_keyphrase == "open_trade") { + diplo_text = "Speak."; + } + if (diplo_keyphrase == "artifact") { + diplo_text = $"Representatives of the Imperium, as the Chapter Master of {global.chapter_name}, I inform you of a potential artifact within our possession, one that we are willing to trade."; + } + if (diplo_keyphrase == "artifact_thanks") { + diplo_text = "We... thank you, for the gift of this imperial curio. I am sure it will prove useful for something. What, I am not sure."; + } + if (diplo_keyphrase == "artifact_angry") { + diplo_text = "Mon'keigh, there will be a reckoning for the arrogance you have displayed here! You cannot take what you please from our lands and worlds, without paying for it in blood or in a more peaceful currency."; + } + if (diplo_keyphrase == "stc_thanks") { + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "How quaint, a relic of the “golden age” of your “civilisation”. Nevertheless, you meant it to be a kind gesture and I thank you."; + } + if (rando == 2) { + diplo_text += "A kind gesture, even if it is a little... pointless. I am grateful that you have seen past the foolish prejudices of your species."; + } + if (rando == 3) { + diplo_text += "I remember when these devices were commonplace. Even then, your species was blind to the wisdom of my people. I thank you for the trinket though."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "With your limited mental capacity, I suppose you can’t imagine a more advanced piece of technology, which is amusing. I thank you for the jest."; + } + if (rando == 2) { + diplo_text += "I suspect you imagined this dusty piece of technology would help us in some way? Amusing. However, we accept the gift anyway."; + } + if (rando == 3) { + diplo_text += "Your species generally scrabbles for traces of the time before, when you were far greater than you are now. It is good you are letting go and accepting your present lot."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "A child, handing an adult a misshapen failure of a sculpture made of spit, rocks and hope. Still, perhaps we shall find space for it, somewhere."; + } + if (rando == 2) { + diplo_text += "It is a wonder your species ever mastered space travel, if this was the pinnacle of your “technology”. I don’t know what you expect me to do with it."; + } + if (rando == 3) { + diplo_text += "How brutish, how dirty. I shall fear to put it down, in case it contaminates part of my Craftworld. Perhaps the void would be a better place for it?"; + } + } + } + if (diplo_keyphrase == "trading_demand") { + if (rela == "friendly") { + diplo_text = "You have proven yourself an able ally, " + string(obj_ini.master_name) == ". Consider your next words thoroughly and deliberately."; + } + if (rela == "neutral") { + diplo_text = "Speak up, Mon'keigh."; + } + if (rela == "hostile") { + rando = choose(1, 1, 2, 2, 3); + if (rando == 1) { + diplo_text = "Make your demands, Mon'keigh, so that I might refute them."; + } + if (rando == 2) { + diplo_text = "You may not always have what you wish for, Mon'keigh."; + } + if (rando == 3) { + diplo_text = "Were I a lesser being, such as yourself, spitting in your face might prove tempting."; + } + } + add_diplomacy_option({ + option_text: "Demand Requisition", + }); + add_diplomacy_option({ + option_text: "Demand Useful Information", + }); + add_diplomacy_option({ + option_text: "Cancel", + goto: "disagree", + }); + } + if (diplo_keyphrase == "mission1") { + diplo_text = "The good that might come from simple acts of benevolence are oft underestimated. A token goodwill gesture can go far, "; + if (rela == "hostile") { + diplo_text += "Mon'keigh"; + } + if (rela != "hostile") { + diplo_text += "human"; + } + + diplo_text += ". Even something as small as water, raw material, and sustenance can have a profound efect."; + add_diplomacy_option({ + option_text: "Give 500 Requisition", + goto: "elder_mission1_thanks", + choice_func: function() { + scr_loyalty("Xeno Trade", "+"); + scr_quest(2, "fund_elder", 6, 0); + requisition -= 500; + }, + }); + add_diplomacy_option({ + option_text: "Maybe", + goto: "quest_maybe", + }); + add_diplomacy_option({ + option_text: "Refuse", + goto: "mission1_refused", + choice_func: function() { + scr_quest(3, "fund_elder", 6, 0); + questing = 0; + }, + }); + questing = 1; + } + if (diplo_keyphrase == "elder_mission1_thanks") { + scr_recent("eldar_mission", "completed", 1); + rando = choose(1, 1, 1, 2, 2, 3, 3, 3); + if (rando == 1) { + diplo_text = "You intend to hand over these resources? Without a promise of compensation? You are a strange human, Chapter Master. Few would do this, and it will not be forgotten."; + } + if (rando == 2) { + diplo_text = "As little as I expected you to be this generous, I cannot claim complete surprise. While I am a little surprised you were as quick to comply, I expected you to see the light in due course."; + } + if (rando == 3) { + diplo_text = "It is not that I am surprised but I confess a little confusion at your forthright generosity. Perhaps you expect something in return? Regardless, I thank you."; + } + } + if (diplo_keyphrase == "mission1_refused") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text = "Just as I expected, you are exactly like every other member of your race. I have met a great many Mon'keigh in my life, and you are no different from the rest."; + } + if (rando == 2) { + diplo_text = "As a brainless fool shouting at the tide to stop, you do your best to fight the inevitable. I shall endure this, however. You too, shall die."; + } + if (rando == 3) { + diplo_text = "Expected. You have done nothing than fulfill my projected outcome. If you think yourself clever for refusing or especially loyal to your leader, do not. You are no more fervent or intelligent than any other Mon'keigh soldier."; + } + } + if (diplo_keyphrase == "mission1_failed") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text = "One would think, with a life span as short as yours, you would have a better memory. It's not as though you live long enough to have enough time to properly forget anything. This insult will not be forgotten, Mon'keigh."; + } + if (rando == 2) { + diplo_text = "You are as predictable as a the rest of your kind. You say things and make promises, which slip from your tiny mind mere moments afterwards. I pity you more than I scorn you."; + } + if (rando == 3) { + diplo_text = "While your mind might be too small to record things for more than a few years, I remember the birth of your “Imperium”. I also remember your words, Mon'keigh. You have, predictably, disappointed me."; + } + force_goodbye = 1; + } + if (diplo_keyphrase == "quest_maybe") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text = "Ah, the ever cautious Mon'keigh, too scared by the shadow of his precious Emperor to try something new, to adventure a little. Hardly surprising."; + } + if (rando == 2) { + diplo_text = "While this is not the gesture I was referring to, I suppose the fact you are yet to scream and shout about ‘Xenos Scum' must be taken as a minor miracle."; + } + if (rando == 3) { + diplo_text = "Not hard to see why your species is so universally viewed as foolish. Still, perhaps you will manage to be a little more enlightened than the rest."; + } + questing = 0; + clear_diplo_choices(); + } + if (diplo_keyphrase == "useful_information") { + var found = 0; + rando = choose(1, 1, 2, 3, 4, 4, 5); + force_goodbye = -1; + + for (var i = 30; i < 30; i++) { + if ((rando == 5) && (string_count("CM|", obj_controller.useful_info) > 0)) { + rando -= 1; + } + if ((rando == 4) && (random_event_next != eEVENT.none)) { + rando -= 1; + } + if ((rando == 3) && ((turn < chaos_turn) || (known[eFACTION.Chaos] > 3))) { + rando -= 1; + } + if ((rando == 2) && ((known[eFACTION.Ork] < 0) || (known[eFACTION.Ork] >= 3) || (string_count("WL7|", obj_controller.useful_info) == 1))) { + rando -= 1; + } + if ((rando == 1) && (string_count("WG|", obj_controller.useful_info) > 1)) { + rando = 5; + } + } + // * Most corrupt mahreen * + if (rando == 5) { + obj_controller.useful_info += "CM|"; + + var him_c = 0, him_i = 0, him_num = 0, him_cor = 0, split = ""; + + split = scr_max_marine("chaos"); + + explode_script(split, "|"); + him_c = real(explode[0]); + him_i = real(explode[1]); + him_num = string(explode[2]); + him_cor = real(explode[3]); + + if (him_cor == 0) { + diplo_text = "I have looked into the strands of fate, with your chapter, and found that the future is not suspect for any of your men. None of them have their minds poisoned by the taint of chaos."; + } + if (him_cor > 0) { + diplo_text = "I have looked into the strands of fate, with your chapter. Your 'battle brother' " + string(him_num) + " has a clouded, dark future- it is advised you watch him carefully."; + } + } + // * Next random event * + if (rando == 4) { + scr_random_event(false); + if ((random_event_next == eEVENT.strange_behavior) && (obj_controller.disposition[6] < 15)) { + diplo_text = "One of your Mon'keigh soldiers will no longer act as you expect him to. Be wary, when one Mon'keigh is influenced the rest of the herd will be."; + } else if ((random_event_next == eEVENT.strange_behavior) && (obj_controller.disposition[6] >= 15)) { + diplo_text = "One of your soldiers will no longer act as you expect him to. Be wary, when one is influenced the rest of the herd will be."; + } else if (random_event_next == eEVENT.space_hulk) { + diplo_text = "It comes from the warp, a relic from the past. It is steeped in the energies of the ethereal tides. Beware."; + } else if (random_event_next == eEVENT.promotion) { + diplo_text = "One of your soldiers will cover himself in glory. As his “Chapter Master”, a title I find inherently foolish, you may wish to reward him."; + } else if (random_event_next == eEVENT.strange_building) { + diplo_text = "The Red robed ones, their “Machine God”, calls to them. Soon, one shall lose their tenuos grip on the here and now and follow the pictures in his head."; + } else if (random_event_next == eEVENT.sororitas) { + diplo_text = "Your priestesses of war, who worship He Who Fell, will gather their forces soon, to stay."; + } else if (random_event_next == eEVENT.inquisition_mission) { + diplo_text = "They will come very soon, the bearers of hellfire and hate. They will scour the sector for so-called ''Heresy''."; + } else if (random_event_next == eEVENT.inquisition_planet) { + diplo_text = "Your questions askers seek to learn more of a planet. Warp meddlers and free thinkers would be well-served with caution. Beware, Chapter Master."; + } else if (random_event_next == eEVENT.rogue_trader) { + diplo_text = "Free thinkers, traders in the vast expanse. They are coming, perhaps you aught to set out your wares?"; + } else if (random_event_next == eEVENT.fleet_delay) { + diplo_text = "Mon'keigh, your fleets may be delayed by my kin. Eldar Pirates, your kind would call them."; + } else if (random_event_next == eEVENT.harlequins) { + diplo_text = "Rillietann. They have come. They are on some world, hidden, or soon will be."; + } else if (random_event_next == eEVENT.succession_war) { + diplo_text = "Your underlings fight for power, Mon'keigh. Someone will die who believes he is important. His children and ''friends'' will vie for the rite to call himself or herself governor. Or king. Or whatever self aggrandising title your people name yourselves."; + } else if (random_event_next == eEVENT.random_fun) { + diplo_text = "Something will happen soon. The runes do not show me exactly what will happen, only that it concerns you. Watch the horizon, Mon'keigh."; + } else if (random_event_next == eEVENT.warp_storms) { + diplo_text = "The tides of the Immaterium are unsettled. Of course, it's hard to calculate where the Immaterium will affect the Materium, but I predict it will come soon."; + } else if (random_event_next == eEVENT.enemy_forces) { + diplo_text = "From beyond your circle of firelight, they are coming. Rest not Mon'keigh, for they will come soon and are bent on destruction."; + } else if (random_event_next == eEVENT.crusade) { + diplo_text = "Soon, your masters will call you to heel like a dog to attack the foes of man. One of your ''Crusades'' of hate, ignorance and bigotry will be called."; + } else if (random_event_next == eEVENT.enemy) { + diplo_text = "You will make an enemy among your fellow man. Soon they shall whisper into their lord's ear, telling that you are a threat, a beetle to be crushed beneath their boot. You would do well to speak carefully, for some time."; + } else if (random_event_next == eEVENT.mutation) { + diplo_text = "Your 'battle brothers' are twisting like snakes beneath your feet. Watch yourself, Chapter Master."; + } else if (random_event_next == eEVENT.ship_lost) { + diplo_text = "The Immaterium will swallow one of your ships. Do not look for it to return."; + } else if (random_event_next == eEVENT.chaos_invasion) { + diplo_text = "Your twisted brethren, who fell to the lure of the Immaterium, will soon arrive with their wrath and demons. Beware."; + } else if (random_event_next == eEVENT.necron_awaken) { + diplo_text = "Our old enemies, the men of metal, are close. You call them “Necrons”, and you will need to fight them soon. Or flee, it matters not to me."; + } else { + diplo_text = "[Missing Dialogue: " + string(random_event_next) + " forcast.]"; // this will print a number rather that a string which is less than ideal, but we can just add new flavour text whem we get the bug reports + } + } + // * Chaos warlord location * + if (rando == 3) { + obj_controller.useful_info += "WL10|"; + if (obj_controller.faction_gender[10] == 1) { + for (var i = 0; i < 5; i++) { + if (found == 0) { + instance_activate_object(obj_star); + with (obj_temp5) { + instance_destroy(); + } + with (obj_star) { + for (var i = 1; i <= 4; i++) { + if (planet_feature_bool(p_feature[1], P_features.Warlord10) == 1) { + instance_create(x, y, obj_temp5); + } + } + } + if (instance_exists(obj_temp5)) { + var you, nuum, plan = 0; + you = instance_nearest(obj_temp5.x, obj_temp5.y, obj_star); + nuum = you.name; + for (var i = 1; i <= you.planets; i++) { + if (planet_feature_bool(you.p_feature[1], P_features.Warlord10) == 1) { + plan = i; + } + } + found = 1; + diplo_text = $"The fallen warlord of your kind is located somewhere within the {nuum} system. More I cannot say. It would be prudent to deal with this soon- that abomination may not remain there long."; + } + } + } + } + if (obj_controller.faction_gender[10] == 2) { + diplo_text = "The Lord of Rage turns his foul gaze upon this sector. With it death and destruction will soon come. You had best be ready when it does."; + } + } + // * Ork Warboss Location * + if (rando == 2) { + obj_controller.useful_info += "WL7|"; + for (var i = 0; i < 5; i++) { + if (found == 0) { + instance_activate_object(obj_star); + with (obj_temp5) { + instance_destroy(); + } + with (obj_star) { + for (var i = 1; i <= 4; i++) { + if (planet_feature_bool(p_feature[1], P_features.OrkWarboss) == 1) { + instance_create(x, y, obj_temp5); + } + } + } + if (instance_exists(obj_temp5)) { + var you, nuum, plan = 0; + you = instance_nearest(obj_temp5.x, obj_temp5.y, obj_star); + nuum = you.name; + for (var i = 1; i <= you.planets; i++) { + if (planet_feature_bool(you.p_feature[1], P_features.OrkWarboss) == 1) { + plan = i; + } + } + if (you.p_orks[plan] < 6) { + you.p_orks[plan] = 6; + } + diplo_text = "The greenskin horde is led by a massive Ork, one who calls himself " + string(faction_leader[eFACTION.Ork]) + ". If this warboss were to perish the rest might be dealt with in a more languorous fashion. He is located on " + string(nuum); + if (plan == 1) { + diplo_text += " I."; + } + if (plan == 2) { + diplo_text += " II."; + } + if (plan == 3) { + diplo_text += " III."; + } + if (plan == 4) { + diplo_text += " IV."; + } + found = 1; + } + } + } + } + // * Webway Gate Location * + // if (rando=1) and (string_count("WG|",obj_controller.useful_info)=2) then rando+=choose(1,2,3,3); + if (rando == 1) { + obj_controller.useful_info += "WG|"; + if (string_count("WG|", obj_controller.useful_info) == 1) { + for (var i = 0; i < 5; i++) { + if (found == 0) { + instance_activate_object(obj_star); + with (obj_temp6) { + instance_destroy(); + } + with (obj_temp5) { + instance_destroy(); + } + if (obj_ini.fleet_type == ePlayerBase.home_world) { + with (obj_star) { + if (owner == 1) { + instance_create(x, y, obj_temp6); + } + } + } + if (obj_ini.fleet_type != ePlayerBase.home_world) { + with (obj_p_fleet) { + if (capital_number > 0) { + instance_create(x, y, obj_temp6); + } + } + } + + with (obj_star) { + if (owner != eFACTION.Imperium) { + instance_deactivate_object(id); + } + if ((owner == eFACTION.Imperium) && (point_distance(x, y, obj_temp6.x, obj_temp6.y) > 250)) { + instance_deactivate_object(id); + } + if ((owner == eFACTION.Imperium) && (planets < 1)) { + instance_deactivate_object(id); + } + } + var that, good = 0; + that = instance_nearest(random(room_width), random(room_height), obj_star); + for (var i = 0; i < 5; i++) { + if (good == 0) { + with (that) { + var j = 0, onceh = 0; + for (var k = 0; k < 10; k++) { + j = floor(random(planets)) + 1; + if ((array_length(p_feature[j]) == 0) && (onceh == 0)) { + onceh = j; + } + } + if (onceh != 0) { + array_push(p_feature[onceh], new NewPlanetFeature(P_features.Webway)); + obj_controller.temp[90] = planet_numeral_name(onceh); + } + } + } + } + if (good == 1) { + diplo_text = "A series of labyrinthian corridors and veins connect the galaxy. The planet you know as " + string(obj_controller.temp[90]) + " contains a dormant entrance to this realm."; + found = 1; + } + } + } + } + if (string_count("WG|", obj_controller.useful_info) == 2) { + for (var i = 0; i < 5; i++) { + if (found == 0) { + instance_activate_object(obj_star); + with (obj_temp6) { + instance_destroy(); + } + with (obj_temp5) { + instance_destroy(); + } + if (obj_ini.fleet_type == ePlayerBase.home_world) { + with (obj_star) { + if (owner == 1) { + instance_create(x, y, obj_temp6); + } + } + } + if (obj_ini.fleet_type != ePlayerBase.home_world) { + with (obj_p_fleet) { + if (capital_number > 0) { + instance_create(x, y, obj_temp6); + } + } + } + with (obj_star) { + if (owner != eFACTION.Imperium) { + instance_deactivate_object(id); + } + if ((owner == eFACTION.Imperium) && (point_distance(x, y, obj_temp6.x, obj_temp6.y) < 800)) { + instance_deactivate_object(id); + } + if ((owner == eFACTION.Imperium) && (planets < 1)) { + instance_deactivate_object(id); + } + } + var that, good = 0; + that = instance_nearest(random(room_width), random(room_height), obj_star); + for (var j = 0; j < 5; j++) { + if (good == 0) { + with (that) { + var onceh = 0; + for (var k = 0; k < 10; k++) { + var i = floor(random(planets)) + 1; + if ((array_length(p_feature[i]) == 0) && (onceh == 0)) { + onceh = i; + } + } + if (onceh != 0) { + array_push(p_feature[onceh], new NewPlanetFeature(P_features.Webway)); + obj_controller.temp[90] = planet_numeral_name(onceh); + } + } + } + } + if (good == 1) { + diplo_text = "The second dormant webway gate lays upon " + string(obj_controller.temp[90]) + "."; + found = 1; + } + } + } + } + with (obj_temp6) { + instance_destroy(); + } + with (obj_temp5) { + instance_destroy(); + } + instance_activate_object(obj_star); + } + } + } + // ** ORKZZZ ** + if (diplomacy == 7) { + if (disposition[diplomacy] >= 20) { + rela = "friendly"; + } + if ((disposition[diplomacy] < 20) && (disposition[diplomacy] >= -20)) { + rela = "neutral"; + } + if (disposition[diplomacy] < -20) { + rela = "hostile"; + } + // * Request audience * + if (diplo_keyphrase == "intro") { + rando = choose(1, 2); + if (rando == 1) { + diplo_text = "[[" + string(faction_leader[diplomacy]) + " is the scourge of the sector, a colossal green brute infamous for the destruction of a dozen worlds. He rules his vicious horde of xenos savages the only way greenskins know how; with brute force. Trophies from the champions of a score of races bedeck his armour, including many from " + string(choose("other Astartes", "the Tyranids", "the Tau Empire")) + ".]]"; + } + if (rando == 2) { + diplo_text = "[[" + string(faction_leader[diplomacy]) + " is a veteran of countless engagements, leading his tribe into battle with an almost manic giddiness. His name is synonymous with extended campaigns of looting and senseless violence, even more so than the other members of his barbaric race. He and the rest of his tribe hail from the " + string(choose("Goffs", "Blood Axes", "Bad Moons", "Death Skulls", "Death Skulls")) + " clan.]]"; + } + diplo_text += "\n#"; + if (scr_has_adv("Enemy: Orks")) { + diplo_text += "Oi Beaky! I ain't heard your name round here before! If ya eva get bored of havin' your ‘ead attached to your shouldas, good old " + string(faction_leader[diplomacy]) + " can sort dat out for ya!"; + } else { + if (scr_has_disadv("Tolerant")) { + diplo_text += "You seem good for a scrap, ya beaky faced ponce! Bring your lads down my way some time and we'll have one!"; + } else { + diplo_text += "All you space marines seem da same ta me. I reckon we'll be seein' each other soon enough..."; + } + } + diplo_text += tempd; + } + if (diplo_keyphrase == "new_warboss") { + rando = choose(1, 1, 1, 2); + diplo_text = "[[" + string(faction_leader[diplomacy]) + " is the scourge of many sectors, a colossal green brute infamous for the destruction of dozens of worlds. His name is synonymous with extended campaigns of looting and senseless violence, even more so than the other members of his barbaric race. He and the rest of his tribe hail from the " + string(choose("Goffs", "Blood Axes", "Bad Moons", "Death Skulls", "Death Skulls")) + " clan. He is recently arrived to the sector, bringing with him a massive invasion fleet.]]"; + diplo_text += "\n#"; + if (rando == 1) { + diplo_text += "I've got good news, humie! " + string(faction_leader[diplomacy]) + " is da warboss now! An' ya know wot dat means? It means yer krumped! Krumped good an' well, just as soon as me Mekboys get dis piece o junk movin'. Thaz right! Get ready fer a foight, humies; me an' da boyz'll be antsy when we gets there, and it'd be downroight inhorspitotalibile not to give us a good one!"; + } + if (rando == 2) { + diplo_text += "Tasty humie worldz. All dat loot. All dat MEAT. By Gork an Mork, we's gonna smash it all up wiv an ax, burn it to da ground and have a proppa meal! " + string(faction_leader[diplomacy]) + " is da warboss now, and I's commin for you humie! Git ready for da WWWAAAGGGGGGGGGGHHHHHHH!"; + } + } + if (diplo_keyphrase == "hello") { + if (rela == "friendly") { + rando = choose(1, 2); + if (rando == 1) { + diplo_text += "Hey, if it isn't me favorite ‘umie! What can I do for ya? Want some help with some skumgrods, a quick trade or just come to chat with old " + string(faction_leader[eFACTION.Ork]) + "?"; + } + if (rando == 2) { + diplo_text += "Pull up a chair, Chapta masta! Want some fungus ale? It's good stuff! There's even a squig fight on in da pits today! Oh, but you're always buisness, ain't ya?"; + } + } + if (rela == "neutral") { + rando = choose(1, 2); + if (rando == 1) { + diplo_text += "Alright ‘umie, whatcha want? I got betta things ta do today but ‘umies are always good for a laugh so I'll give ya a little while."; + } + if (rando == 2) { + diplo_text += "Go on den ‘umie, say you piece. But if ya call me xenos or mention the Emprah even once, this is gunna end badly."; + } + } + if (rela == "hostile") { + rando = choose(1, 2); + if (rando == 1) { + diplo_text += "What da zog do ya want, ‘umie? I ain't in da mood for any of your squig dung, so make it quick before I start shootin'."; + } + if (rando == 2) { + diplo_text += "Ya got eight words to tell me what you want, ‘cause dat's how many finers I got left. After dat, I'll show ya what I learned losing the other three."; + } + } + } + if (diplo_keyphrase == "trade_close") { + if (rela == "friendly") { + diplo_text = "Oi', don't rush off! Why don't ya drink a fungus ale wit me and the nobz? We could discuss business while watching a squigfight! No? Suit ya self."; + } + if (rela == "neutral") { + diplo_text = "Well dat was a waste of time. See ya ‘around Space Marine."; + } + if (rela == "hostile") { + diplo_text = "Next time you says you got a deal for me, you beta zoggin' well ‘ave one!"; + } + } + if (diplo_keyphrase == "demand_refused") { + rando = choose(1, 2); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "Nah, I ain't seein it mate. Maybe next time, 'eh?"; + } + if (rando == 2) { + diplo_text = "Dun't sound like fun, Spash Mareen. I fink I'll take the boys for a scrap someplace else."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "Get lost 'umie, I got me own fings ta do."; + } + if (rando == 2) { + diplo_text = "I'll fink about it but I ain't sure it sounds like fun."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "Da only fing I'll 'elp ya with is the removal of you head!"; + } + if (rando == 2) { + diplo_text = "Next time ya want somefing, try askin' someone who dun't fink you're a piece of mouldy grot dung."; + } + } + } + if (string_count("agree", diplo_keyphrase) > 0) { + if (trading_artifact == 0) { + diplo_text = string(trade_msg) + "\n"; + } + if ((trading_artifact != 0) || (liscensing > 0)) { + diplo_text = "[[Trade Accepted.]]\n"; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "Ha, this is gunna be a whole lot of fun! I'm in!"; + } + if (rando == 2) { + diplo_text += "You ain't green but ya fink like an ork all right! It's a deal!"; + } + if (rando == 3) { + diplo_text += "‘ERE WE GO, ‘ERE WE GO, ‘ERE WE GO!"; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "Yeah, all right, why not?"; + } + if (rando == 2) { + diplo_text += "You're lucky I'm such a nice boss, no other ork'd agree to this."; + } + if (rando == 3) { + diplo_text += "Well, I don't see no reasons why I shouldn't agree."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "I dun't like it but I ain't got no choice."; + } + if (rando == 2) { + diplo_text += "If you cross me, I'll pick me teef with your ribs!"; + } + if (rando == 3) { + diplo_text += "You're a lousy ‘umie skumgrod but you got a deal."; + } + } + } + if (diplo_keyphrase == "disagree") { + if (trading_artifact == 0) { + diplo_text = "[[Trade Refused]]\n"; + } + if (trading_artifact == 1) { + diplo_text = ""; + } + annoyed[diplomacy] += 2; + if (annoyed[diplomacy] >= 6) { + diplo_text += "You'ze wasting my time."; + force_goodbye = 1; + turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 4); + diplo_last = string(diplo_keyphrase); + diplo_char = 0; + diplo_alpha = 0; + exit; + } + if (rela == "friendly") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text += "Not dis time but don't let it get ya down."; + } + if (rando == 2) { + diplo_text += "Ha, sounds like a good time but dere's too many squigs on me plate right now."; + } + if (rando == 3) { + diplo_text += "Pull the uvver one mate, it's got bells on it!"; + } + // 25% chance to close window + } + if (rela == "neutral") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text += "Nah, I don't like the sound of dat."; + } + if (rando == 2) { + diplo_text += "Maybe some uvver time, there's a fight on at the squig pits."; + } + if (rando == 3) { + diplo_text += "Find some uvver ork, this one ain't got da time."; + } + } + if (rela == "hostile") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text += "Not a chance, ya fleshy pink git!"; + } + if (rando == 2) { + diplo_text += "I got a better idea; get zogged!"; + } + if (rando == 3) { + diplo_text += "If dat's a serious offer, you're out of your tiny ‘uman mind."; + } + force_goodbye = choose(0, 0, 0, 1); + } + } + if (diplo_keyphrase == "attacked") { + diplo_text = "So it's krumping time is it, you stupid beaky!? I'm gunna find you and smash your zogging face in with me bare hands! Nobody starts a fight round ‘ere ‘cept me!"; + } + if (diplo_keyphrase == "declare_war") { + force_goodbye = 1; + turns_ignored[diplomacy] += 4; + diplo_text = "Me boyz ain't fought anyone for... at least half a zoggin' hour! It's skrapping time and may da best ork win!"; + } + if (diplo_keyphrase == "denounced") { + if (faction_justmet == 1) { + disposition[diplomacy] -= 5; + faction_justmet = 0; + } + if (rela == "friendly") { + rando = choose(1, 2, 3); // force_goodbye=1; + if (rando == 1) { + diplo_text = "Ha, I know ya dun't mean that!"; + } + if (rando == 2) { + diplo_text = "Say dat again and I'll slap ya ‘round the head, ya daft git! Just kiddin'!"; + } + if (rando == 3) { + diplo_text = "If ya think dat, ya must have squig dropping between yur ears."; + } + } + if (rela == "neutral") { + rando = choose(1, 2, 3); // force_goodbye=1; + if (rando == 1) { + diplo_text = "Words is all ya got, is it?"; + } + if (rando == 2) { + diplo_text = "Dat was a paffetic excuse for an insult, dung-for-brains."; + } + if (rando == 3) { + diplo_text = "We'll just see if dem words are true, won't we?"; + } + } + if (rela == "hostile") { + rando = choose(1, 2, 3); + force_goodbye = choose(0, 0, 1); + if (rando == 1) { + diplo_text = "Say dat to me face and see what happens, ya gork damned beaky!"; + } + if (rando == 2) { + diplo_text = "I'm gunna take dem words and ram ‘em down your throat!"; + } + if (rando == 3) { + diplo_text = "Let's see ya say that without a head!"; + } + } + } + if (diplo_keyphrase == "praised") { + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "You're a mate, ta say such nice fings about little ole' me."; + } + if (rando == 2) { + diplo_text = "Dat's da truth, plain and simple. Well said!."; + } + if (rando == 3) { + diplo_text = "Job's a good ‘un!"; + } + } + if (rela == "neutral") { + force_goodbye = choose(0, 0, 0, 1); + if (rando == 1) { + diplo_text = "You know how ta polish a name, but do ya know how to wield a blade?"; + } + if (rando == 2) { + diplo_text = "That dun't push me one way or the uvver."; + } + if (rando == 3) { + diplo_text = "Words don't last, ‘umie, it's deeds that get remembered."; + } + } + if (rela == "hostile") { + force_goodbye = choose(0, 1); + if (faction_justmet == 1) { + force_goodbye = 1; + } + if (rando == 1) { + diplo_text = "Get your nose outta me arse ‘umie! I dun't want your pretty words, just your head!"; + } + if (rando == 2) { + diplo_text = "Quick ta turn tail and kiss arse, ain't ya? It wun't help."; + } + if (rando == 3) { + diplo_text = string(faction_leader[diplomacy]) + " dun't like be called names by ‘umies, not even good ones."; + } + } + if (faction_justmet == 1) { + disposition[diplomacy] += 5; + faction_justmet = 0; + } + } + if (diplo_keyphrase == "offer") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text = "You wanna swap dis ‘ere fine bolter for dat fing?"; + } + if (rando == 2) { + diplo_text = "Oi, you want some of dis? Special offer for a limited time only!"; + } + if (rando == 3) { + diplo_text = "Take it or leave it, dat's me final offer."; + } + } + if (diplo_keyphrase == "stc_thanks") { + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "It’s a... shinybit! Fanks fer da shinybit Beaky!"; + } + if (rando == 2) { + diplo_text += "Wot, so it’s like a box o’ ideas fer ‘Umie teknology? Fanks!"; + } + if (rando == 3) { + diplo_text += "Cor, looks real nice! I’ll stick it on me Choppa!"; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "It’s a... not really useful fer anyfin’, is it?"; + } + if (rando == 2) { + diplo_text += "Ya know ‘umie, I dun’t like bitz that dun’t do nuffin’. Just sayin’ fer next time."; + } + if (rando == 3) { + diplo_text += "So wat, ya want a fank you note or summin’?"; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "If ya dun’t zog off, I’m gunna ram dis down yer throat!"; + } + if (rando == 2) { + diplo_text += "Fanks, now get lost ‘afore I smashes ya!"; + } + if (rando == 3) { + diplo_text += "Maybe one o’ da grots will like it, ‘cos I dun’t."; + } + } + } + if (diplo_keyphrase == "artifact_thanks") { + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "Thanks mate, dis'll make a good toof pick!"; + } + if (rando == 2) { + diplo_text = "Cor, shiny fing, ain't it!? Dun't worry, I'll find a place fer it."; + } + if (rando == 3) { + diplo_text = "Yer a good mate, givin' me such nice dakka!"; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "Not bad, not bad. I'll see if I can find sum grot ta use it."; + } + if (rando == 2) { + diplo_text = "Aright, just dun't spect me ta give ya one back for Gorkmas!"; + } + if (rando == 3) { + diplo_text = "Well, so long as ya aren't askin' for sum teef in return fer it."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "Ha, you givin' me a somefin ta shove down your throat, beaky!?"; + } + if (rando == 2) { + diplo_text = "It wus mine anyway, seein' as I'll take all yer stuff eventually."; + } + if (rando == 3) { + diplo_text = "Wot a piece o' rubbish. ‘Ope you got better dakka an' dis somewhere."; + } + } + } + if (diplo_keyphrase == "open_trade") { + diplo_text = "Wut?"; + } + if (diplo_keyphrase == "trading_demand") { + diplo_text = "Yeah? Wut?"; + add_diplomacy_option({ + option_text: "Demand Requisition", + }); + add_diplomacy_option({ + option_text: "Demand Military Assistance", + }); + add_diplomacy_option({ + option_text: "Cancel", + goto: "disagree", + }); + } + } + // ** Tau ** + if (diplomacy == 8) { + if (diplo_keyphrase == "intro") { + rando = choose(1, 2); + if (rando == 1) { + tempd = "[[Tall and slender, its skin is blue and clammy-looking. Disgusting. Its face contains two large, expressionless eyes, a slit-like mouth, and a bizarre I-shaped gash between its eyes that must function as a nose. So this is " + string(faction_title[8]) + " " + string(faction_leader[eFACTION.Tau]) + ". This particular xenos is said to " + choose("have quite the silver tongue", "have negotiated the surrender of many Imperial worlds", "have a great deal of military backing.") + ".]]"; + } + if (rando == 2) { + tempd = "[[Tall and slender, its skin is a light blue and looks almost reptilian. A Y-shaped slit nestles between its eyes, and a mouth like a slit sits below that. This must be " + string(faction_title[8]) + " " + string(faction_leader[eFACTION.Tau]) + ". The Ordo Xenos tells us that this particular xeno " + choose("can sense weakness in a rock", "knows more than it will let on", "uses its words like a scalpel") + ".]]"; + } + tempd += "\n#"; + rando = choose(1, 2); + if (rando == 1) { + tempd += "Greetings, Chapter Master. As you know, we have claimed for ourselves planets along the borders of your Imperium. I wish to clarify that we of the Tau do not seek a war. Rather, we hope to cooperate with you so that we may both work towards a Greater Good."; + } + if (rando == 2) { + tempd += "Salutations, " + string(obj_ini.master_name) + ". I represent the interests of the Tau Empire. We wish to exist in peace beside you for now, and hope that one day you will see the wisdom of the Greater Good. We will be more than happy to accept you into the fold, for the way of the Tau is one of benevolence and acceptance."; + } + diplo_text = tempd; + } + if (diplo_keyphrase == "hello") { + if (rela == "friendly") { + diplo_text = string(obj_ini.master_name) + "! How may we help one another today?"; + } + if (rela == "neutral") { + diplo_text = "We welcome you, Chapter Master. What do you wish of the Tau?"; + } + if (rela == "hostile") { + diplo_text = "Chapter Master. Have you finally decided to submit yourself to The Greater Good?"; + } + } + if (diplo_keyphrase == "trade_close") { + if (rela == "friendly") { + diplo_text = "I will await your word with anxious anticipation, honoured ally, for I am sure something of great importance draws you away."; + } + if (rela == "neutral") { + diplo_text = "Please reconsider your actions. I believe we would both benefit from a trade, Gue'la"; + } + if (rela == "hostile") { + diplo_text = "I am saddened by your lack of respect, and can only attribute it to inferior cultural surroundings."; + } + } + if (diplo_keyphrase == "demand_refused") { + rando = choose(1, 2); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "While I truly sympathise with your plight, I'm afraid I cannot acquiesce at this time."; + } + if (rando == 2) { + diplo_text = "I am sorry, friend, but I simply cannot comply at this time."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "It is not possible for such a thing to be done, whatever your reasons."; + } + if (rando == 2) { + diplo_text = "As eloquent as your arguments have been, I cannot give this my approval."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "It will not happen, and you must deal with that."; + } + if (rando == 2) { + diplo_text = "No, and that is our final word upon the matter."; + } + } + } + if (diplo_keyphrase == "agree") { + if (trading_artifact == 0) { + diplo_text = string(trade_msg) + "\n"; + } + if (trading_artifact != 0) { + diplo_text = "[[Trade Accepted.]]\n"; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "Yes! We wholeheartedly agree to this deal. The Tau Empire thanks you for your continuing support."; + } + if (rando == 2) { + diplo_text += "Of course. We are always happy to be able to meet the needs of our friends and allies- such is the philosophy of the Greater Good."; + } + if (rando == 3) { + diplo_text += "Your terms are most amicable. May the light of wisdom shine on you ever, Chapter Master. Greater Good prevails."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "Hmm. Agreed. I hope that this will pave the way to better relations overall."; + } + if (rando == 2) { + diplo_text += "We accept. The Greater Good teaches us cooperation, and this is just one of the many ways it applies."; + } + if (rando == 3) { + diplo_text += "As you say, we are in need of such things... I think this arrangement will profit us both. Perhaps we shall work together more in the future."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "You drive a hard bargain... but it is for The Greater Good."; + } + if (rando == 2) { + diplo_text += "An unfair bargain does no good for any... but you force our hand."; + } + if (rando == 3) { + diplo_text += "Under other circumstances we would refuse... but the word of the Aun's is heard by all."; + } + } + } + if (diplo_keyphrase == "disagree") { + if (trading_artifact == 0) { + diplo_text = "[[Trade Refused]]\n"; + } + if (trading_artifact == 1) { + diplo_text = ""; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text += "I am sorry but I will have to say no for now."; + } + if (rando == 2) { + diplo_text += "You must forgive us, but we are unable to agree to your terms. We simply cannot fulfil the obligations you suggest."; + } + if (rando == 3) { + diplo_text += "Your terms are agreeable, and past deeds have proven your trustworthiness... but I fear the consequences of this trade."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text += "This arrangement does not benefit us at this time. Perhaps if you were to offer again later..."; + } + if (rando == 2) { + diplo_text += "Unfortunately we cannot accept these terms. I apologize."; + } + if (rando == 3) { + diplo_text += "We will have to consider it. For now, you would do well to seek another partner."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text += "The Aun's decree is final. Your terms do not benefit The Greater Good."; + } + if (rando == 2) { + diplo_text += "Absolutely not. We of the Tau Empire have pride of our own to maintain."; + } + if (rando == 3) { + diplo_text += "Your terms are practically insulting. The Greater Good is not so impotent that we cannot simply go to someone else."; + } + } + } + if (diplo_keyphrase == "attacked") { + diplo_text = "You will regret this day, space marine. The Tau grow stronger by the hour; a dozen races have joined our cause. The Greater Good is no mere philosophy but a way of life we will fight for."; + } + if (diplo_keyphrase == "declare_war") { + force_goodbye = 1; + turns_ignored[diplomacy] += 4; + diplo_text = "We have attempted diplomacy, Chapter Master. Time and again, Tau ambassadors have contacted your Imperium with peaceful intentions... and time and again they have been betrayed. No more. It is war, Space Marine. Surrender, or face the fury of those who dream of a Greater Good!"; + } + if (diplo_keyphrase == "accept_peace") { + diplo_text = "We, the Tau, agree to a complete cessation of hostilities. Perhaps you may yet join us and achieve a Greater Good."; + } + if (diplo_keyphrase == "ignored") { + diplo_text = "You request for an audience is granted, but I would hope that you attempt to keep up more regular contact in future."; + } + if (diplo_keyphrase == "denounced") { + if (faction_justmet == 1) { + disposition[diplomacy] -= 2; + faction_justmet = 0; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "Was this communication sent in error? Do we not all serve a Greater Good?"; + } + if (rando == 2) { + diplo_text = "We apologise if we have caused any offence. We are not above admitting our mistakes."; + } + if (rando == 3) { + diplo_text = "This is most unlike you, Chapter Master. Are you unwell?"; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "Such sentiments are regrettable. We hope one day you realize your mistakes and submit to The Greater Good."; + } + if (rando == 2) { + diplo_text = "Foolish notions are below our recognition. Contact us when you have a message of substance."; + force_goodbye = 1; + } + if (rando == 3) { + diplo_text = "Coming to insults so soon? Embrace The Greater Good, Gue'la, and we will show you the true way."; + } + } + if (rela == "hostile") { + force_goodbye = choose(0, 0, 1); + if (rando == 1) { + diplo_text = "Your tiresome slander is noted and dismissed. We do not hold it against you."; + } + if (rando == 2) { + diplo_text = "Gue'la are obviously less sophisticated than the Tau. We know not to sling feces at others."; + } + if (rando == 3) { + diplo_text = "Our greatest poets would respond to your laughable taunts, but none of your race could understand them."; + } + } + } + if (diplo_keyphrase == "praised") { + if (faction_justmet == 1) { + disposition[diplomacy] += 4; + faction_justmet = 0; + } + rando = choose(1, 2, 3); + if (rela == "friendly") { + if (rando == 1) { + diplo_text = "Let us feast and celebrate, Chapter Master! Friends like you are rare in these times."; + } + if (rando == 2) { + diplo_text = "The Greater Good thanks you!"; + } + if (rando == 3) { + diplo_text = "The Aun's send their humble thanks, Chapter Master. You should feel honoured."; + } + } + if (rela == "neutral") { + if (rando == 1) { + diplo_text = "Your entreaty is noted and will be considered in future."; + } + if (rando == 2) { + diplo_text = "A simple gesture, Chapter Master... but we thank you."; + } + if (rando == 3) { + diplo_text = "Hmm... perhaps you are not beyond redemption. May the Greater Good be with you, Chapter Master."; + } + } + if (rela == "hostile") { + if (rando == 1) { + diplo_text = "Words are cheap, Chapter Master. Actions are worth far more."; + } + if (rando == 2) { + diplo_text = "Grovelling before The Greater Good? Do you have no pride?"; + } + if (rando == 3) { + diplo_text = "Forgiveness is earned, not given. Show us your worth, Chapter Master."; + } + } + } + if (diplo_keyphrase == "offer") { + rando = choose(1, 2, 3); + if (rando == 1) { + diplo_text = "Our emissaries bring gifts, Chapter Master. Perhaps you would consider a mutually beneficial arrangement?"; + } + if (rando == 2) { + diplo_text = "The Aun's ask much of you, Chapter Master... but we are more than willing to repay you in full."; + } + if (rando == 3) { + diplo_text = "Let us forget our differences, for we may all reap the rewards of The Greater Good."; + } + } + if (diplo_keyphrase == "open_trade") { + rando = choose(1, 2); + if (rando == 1) { + diplo_text = "Make your proposal and the Tau shall answer."; + } + if (rando == 2) { + diplo_text = "Ah, you have something that might possibly allow us both to benefit of The Greater Good?"; + } + } + if (diplo_keyphrase == "artifact_thanks") { + diplo_text = "Your generosity will not be forgotten, friend of the Tau. What you have done shall advance The Greater Good."; + } + if (diplo_keyphrase == "stc_thanks") { + diplo_text = "We extend our sincere gratitude to you, noble ally of the Tau, for your generosity. The STC fragment you have bestowed upon us shall not only serve our cause but also contribute significantly to The Greater Good. "; + } + if (diplo_keyphrase == "bombard_angry") { + diplo_text = "What are you doing!? The bombardment of our planet is inexcusable and shall be met with an immediate and forceful response!"; + } + } + + // ** Trading Error Handling ** + if ((diplo_keyphrase == "trade_error_1") && (obj_ini.fleet_type == ePlayerBase.home_world)) { + diplo_text = "[Error 1: No valid planet to trade with.]"; + } + if ((diplo_keyphrase == "trade_error_1") && (obj_ini.fleet_type != ePlayerBase.home_world)) { + diplo_text = "[Error 1: No valid fleet to trade with.]"; + } + if (diplo_keyphrase == "trade_error_2") { + diplo_text = "[Error 2: " + string(obj_controller.faction[diplomacy]) + " has no valid origin for a fleet.]"; + } + + // ** Sets ignored turns when kicked out of diplomacy screen ** + if (force_goodbye == 1) { + turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 1); + } + + // ** Resets global vars ** + diplo_last = string(diplo_keyphrase); + diplo_char = 0; + diplo_alpha = 0; + } } diff --git a/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml b/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml index 9861112bb7..8bd20811d8 100644 --- a/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml +++ b/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml @@ -1,31 +1,49 @@ // Script assets have changed for v2.3.0 see // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information -function relationship_hostility_matrix(faction){ - var _rela="neutral"; +function relationship_hostility_matrix(faction) { + var _rela = "neutral"; var _disp = disposition[faction]; - with (obj_controller){ + with (obj_controller) { // if (diplomacy!=8){ - if (_disp>=60) then _rela="friendly"; - if (_disp<60) and (_disp>=20) then _rela="neutral"; - if (_disp<20) then _rela="hostile"; + if (_disp >= 60) { + _rela = "friendly"; + } + if ((_disp < 60) && (_disp >= 20)) { + _rela = "neutral"; + } + if (_disp < 20) { + _rela = "hostile"; + } // } - if (diplomacy==6){ - if (_disp>=60) then _rela="friendly"; - if (_disp<60) and (_disp>=0) then _rela="neutral"; - if (_disp<0) then _rela="hostile"; + if (diplomacy == 6) { + if (_disp >= 60) { + _rela = "friendly"; + } + if ((_disp < 60) && (_disp >= 0)) { + _rela = "neutral"; + } + if (_disp < 0) { + _rela = "hostile"; + } + } + + if (diplomacy == 8) { + if (_disp >= 40) { + _rela = "friendly"; + } + if ((_disp < 40) && (_disp >= -15)) { + _rela = "neutral"; + } + if (_disp < -15) { + _rela = "hostile"; + } } - - if (diplomacy==8){ - if (_disp>=40) then _rela="friendly"; - if (_disp<40) and (_disp>=-15) then _rela="neutral"; - if (_disp<-15) then _rela="hostile"; - } } return _rela; } -function alter_disposition(faction, alter_value){ - switch (faction){ +function alter_disposition(faction, alter_value) { + switch (faction) { case eFACTION.Eldar: case eFACTION.Tau: case eFACTION.Ork: @@ -35,43 +53,44 @@ function alter_disposition(faction, alter_value){ break; case eFACTION.Ecclesiarchy: if (scr_has_adv("Reverent Guardians")) { - alter_value+=2; + alter_value += 2; } - } - obj_controller.disposition[faction] = clamp(obj_controller.disposition[faction]+alter_value, -100, 100); + } + obj_controller.disposition[faction] = clamp(obj_controller.disposition[faction] + alter_value, -100, 100); } -function alter_dispositions(alterations){ - for (var i=0;i=0;i--){ + if (array_length(obj_controller.diplo_option)) { + for (var i = array_length(obj_controller.diplo_option) - 1; i >= 0; i--) { var _opt = obj_controller.diplo_option[i]; - if (struct_exists(_opt, "option_text") && _opt.option_text != ""){ + if (struct_exists(_opt, "option_text") && _opt.option_text != "") { valid = true; } else { array_delete(obj_controller.diplo_option, i, 1); } } - }else{ + } else { return false; } return valid; } -function add_diplomacy_option(option={}){ - if (!struct_exists(option, "goto")){ +function add_diplomacy_option(option = {}) { + if (!struct_exists(option, "goto")) { option.goto = ""; } - if (!struct_exists(option, "key")){ + if (!struct_exists(option, "key")) { option.key = option.option_text; } var _button = new UnitButtonObject(option); @@ -80,46 +99,49 @@ function add_diplomacy_option(option={}){ array_push(obj_controller.diplo_option, _button); } -function basic_diplomacy_screen(){ - var yy=__view_get( e__VW.YView, 0 ); - var xx=__view_get( e__VW.XView, 0 ); - if (trading=0 && valid_diplomacy_options()){ - if (!force_goodbye){ +function basic_diplomacy_screen() { + var yy = __view_get(e__VW.YView, 0); + var xx = __view_get(e__VW.XView, 0); + if (trading == 0 && valid_diplomacy_options()) { + if (!force_goodbye) { draw_set_halign(fa_center); - + var opts = array_length(diplo_option); - if (opts==4) then yy-=30; - if (opts==2) then yy+=30; - if (opts==1) then yy+=60; + if (opts == 4) { + yy -= 30; + } + if (opts == 2) { + yy += 30; + } + if (opts == 1) { + yy += 60; + } - var left,top,right,base,opt; - option_selections = []; + var left, top, right, base, opt; + option_selections = []; var diplo_pressed = -1; - for (var slot=0; slot-1){ + if (diplo_pressed > -1) { evaluate_chosen_diplomacy_option(diplo_pressed); } - yy=__view_get( e__VW.YView, 0 ); + yy = __view_get(e__VW.YView, 0); + } + if ((menu == eMENU.Diplomacy) && (diplomacy == 10.1)) { + scr_emmisary_diplomacy_routes(); } - if (menu==eMENU.Diplomacy) and (diplomacy==10.1){ - scr_emmisary_diplomacy_routes(); - } /*if (force_goodbye=1){ draw_rectangle(xx+818,yy+796,xx+897,yy+815,0); draw_set_color(0); @@ -128,241 +150,236 @@ function basic_diplomacy_screen(){ if (mouse_x>=xx+818) and (mouse_y>=yy+796) and (mouse_x<=xx+897) and (mouse_y<=yy+815) then draw_rectangle(xx+818,yy+796,xx+897,yy+815,0); draw_set_alpha(1); }*/ - } } -function draw_character_diplomacy(){ +function draw_character_diplomacy() { var _diplo_unit = character_diplomacy; - if (_diplo_unit.allegiance == global.chapter_name){ - - + if (_diplo_unit.allegiance == global.chapter_name) { /*if (advi="flee") { _diplomacy_faction_name="Master of the Fleet "+string(obj_ini.lord_admiral_name); }*/ var _splash = ""; var _specific_splash = 0; _diplomacy_faction_name = _diplo_unit.name_role(); - _diplo_unit.IsSpecialist(SPECIALISTS_HEADS){ - + _diplo_unit.IsSpecialist(SPECIALISTS_HEADS); + { var _customs = obj_ini.custom_advisors; if (_diplo_unit.IsSpecialist(SPECIALISTS_APOTHECARIES)) { - _specific_splash = struct_exists(_customs,"apothecary") ? _customs.apothecary : 2; - } - else if (_diplo_unit.IsSpecialist(SPECIALISTS_CHAPLAINS)) { - _specific_splash = struct_exists(_customs,"chaplain") ? _customs.chaplain : 3; - } - else if (_diplo_unit.IsSpecialist(SPECIALISTS_LIBRARIANS)) { - _specific_splash = struct_exists(_customs,"librarian") ? _customs.librarian : 4; - } - else if (_diplo_unit.IsSpecialist(SPECIALISTS_TECHS)) { - _specific_splash = struct_exists(_customs,"forge_master") ? _customs.forge : 5; + _specific_splash = struct_exists(_customs, "apothecary") ? _customs.apothecary : 2; + } else if (_diplo_unit.IsSpecialist(SPECIALISTS_CHAPLAINS)) { + _specific_splash = struct_exists(_customs, "chaplain") ? _customs.chaplain : 3; + } else if (_diplo_unit.IsSpecialist(SPECIALISTS_LIBRARIANS)) { + _specific_splash = struct_exists(_customs, "librarian") ? _customs.librarian : 4; + } else if (_diplo_unit.IsSpecialist(SPECIALISTS_TECHS)) { + _specific_splash = struct_exists(_customs, "forge_master") ? _customs.forge : 5; } scr_image("advisor/splash", _specific_splash, 16, 43, 310, 828); } - /* else if (advi="") { + /* else if (advi="") { _diplomacy_faction_name="First Sergeant "+string(recruiter_name); }*/ - } - var _main_slate = diplo_buttons.main_slate; + var _main_slate = diplo_buttons.main_slate; var _meet = diplo_buttons.meet_slate; var _cm_slate = diplo_buttons.cm_slate; - with (_meet){ + with (_meet) { XX = 0; YY = 520; width = 520; } - _meet.inside_method = function(){ + _meet.inside_method = function() { var _diplo_unit = obj_controller.character_diplomacy; - if (!struct_exists(obj_controller, "diplo_image")){ + if (!struct_exists(obj_controller, "diplo_image")) { obj_controller.diplo_image = _diplo_unit.draw_unit_image(); } - obj_controller.diplo_image.draw(210, 520-271,true, 1,1,0,CM_GREEN_COLOR, 1); - _diplo_unit.stat_display(false,{ - x1: 10, - y1: 520, - w: 569, - h: 303, - }, true); - draw_sprite(spr_holo_pad, 0, 210, 520); - } + obj_controller.diplo_image.draw(210, 520 - 271, true, 1, 1, 0, CM_GREEN_COLOR, 1); + _diplo_unit + .stat_display( + false, + { + x1: 10, + y1: 520, + w: 569, + h: 303, + }, + true + ); + draw_sprite(spr_holo_pad, 0, 210, 520); + }; _meet.draw_with_dimensions(); - _main_slate.XX = _meet.XX+_meet.width; + _main_slate.XX = _meet.XX + _meet.width; _main_slate.YY = 175; _main_slate.draw_with_dimensions(); draw_diplomacy_diplo_text(); draw_set_halign(fa_center); - draw_text_transformed(622,104,$"{_diplo_unit.name_role()}",0.6,0.6,0); + draw_text_transformed(622, 104, $"{_diplo_unit.name_role()}", 0.6, 0.6, 0); draw_set_halign(fa_left); - with (_cm_slate){ - XX = _main_slate.XX+_main_slate.width; + with (_cm_slate) { + XX = _main_slate.XX + _main_slate.width; YY = 520; } - _cm_slate.inside_method = function(){ - var _master = fetch_unit([0,0]); + _cm_slate.inside_method = function() { + var _master = fetch_unit([0, 0]); - if (!struct_exists(obj_controller, "master_image")){ + if (!struct_exists(obj_controller, "master_image")) { obj_controller.master_image = _master.draw_unit_image(); } - obj_controller.master_image.draw(1108+200, 520-271,true, 1,1,0,CM_GREEN_COLOR, 1); - _master.stat_display(false,{ - x1: 1108, - y1: 520, - w: 569, - h: 303, - } , true); - draw_sprite(spr_holo_pad, 0, 1108+200, 520); - } + obj_controller.master_image.draw(1108 + 200, 520 - 271, true, 1, 1, 0, CM_GREEN_COLOR, 1); + _master + .stat_display( + false, + { + x1: 1108, + y1: 520, + w: 569, + h: 303, + }, + true + ); + draw_sprite(spr_holo_pad, 0, 1108 + 200, 520); + }; _cm_slate.draw_with_dimensions(); - - basic_diplomacy_screen(); } -function evaluate_chosen_diplomacy_option(diplo_pressed){ +function evaluate_chosen_diplomacy_option(diplo_pressed) { var _opt = diplo_option[diplo_pressed]; var _pressed_option = _opt.key; - if (struct_exists(_opt, "choice_func")){ - if (is_callable(_opt.choice_func)){ + if (struct_exists(_opt, "choice_func")) { + if (is_callable(_opt.choice_func)) { script_execute(_opt.choice_func); } } - if (_opt.goto != ""){ + if (_opt.goto != "") { scr_dialogue(_opt.goto); } - if ((struct_exists(_opt,"is_exit") && _opt.is_exit)){ + if (struct_exists(_opt, "is_exit") && _opt.is_exit) { exit_diplomacy_dialogue(); } } -function scr_diplomacy_hit(selection, new_path, complex_path="none"){ - if (array_length(option_selections)>selection){ - if (point_and_click(option_selections[selection])){ - if (!is_method(complex_path)){ - diplomacy_pathway = new_path; - scr_dialogue(diplomacy_pathway); - } else { - complex_path(); - } - } +function scr_diplomacy_hit(selection, new_path, complex_path = "none") { + if (array_length(option_selections) > selection) { + if (point_and_click(option_selections[selection])) { + if (!is_method(complex_path)) { + diplomacy_pathway = new_path; + scr_dialogue(diplomacy_pathway); + } else { + complex_path(); + } + } } else { return false; } } + // ** Diplomacy Chaos talks ** -function scr_emmisary_diplomacy_routes(){ - if ((cooldown > 0)) then exit; - if (diplomacy_pathway == "intro") { +function scr_emmisary_diplomacy_routes() { + if (cooldown > 0) { + exit; + } + if (diplomacy_pathway == "intro") { //TODO replace with methods more in line with rest of code base but this helps find bugs for now - scr_diplomacy_hit(0,"gift"); - scr_diplomacy_hit(1,"daemon_scorn"); - scr_diplomacy_hit(2,"daemon_scorn"); - } - else if (diplomacy_pathway == "gift") { - scr_diplomacy_hit(0,"Khorne_path"); - scr_diplomacy_hit(1,"Nurgle_path"); - scr_diplomacy_hit(2,"Tzeentch_path"); - scr_diplomacy_hit(3,"Slaanesh_path"); - } - else if (diplomacy_pathway == "Khorne_path") { - scr_diplomacy_hit(0, ,function(){ - //TODO central get cm choice_func - var chapter_master = obj_ini.TTRPG[0,0]; - cooldown=8000; - diplomacy_pathway = "sacrifice_lib"; + scr_diplomacy_hit(0, "gift"); + scr_diplomacy_hit(1, "daemon_scorn"); + scr_diplomacy_hit(2, "daemon_scorn"); + } else if (diplomacy_pathway == "gift") { + scr_diplomacy_hit(0, "Khorne_path"); + scr_diplomacy_hit(1, "Nurgle_path"); + scr_diplomacy_hit(2, "Tzeentch_path"); + scr_diplomacy_hit(3, "Slaanesh_path"); + } else if (diplomacy_pathway == "Khorne_path") { + scr_diplomacy_hit(0,, function() { + //TODO central get cm choice_func + var chapter_master = obj_ini.TTRPG[0][0]; + cooldown = 8000; + diplomacy_pathway = "sacrifice_lib"; //grab a random librarian - var lib = scr_random_marine(SPECIALISTS_LIBRARIANS,0); - if (lib!="none"){ + var lib = scr_random_marine(SPECIALISTS_LIBRARIANS, 0); + if (lib != "none") { var chapter_master = obj_ini.TTRPG[0][1]; - var dead_lib = obj_ini.TTRPG[lib[0],lib[1]]; - pop_up = instance_create(0,0,obj_popup); + var dead_lib = obj_ini.TTRPG[lib[0]][lib[1]]; + pop_up = instance_create(0, 0, obj_popup); pop_up.title = "Skull for the Skull Throne"; - pop_up.text = $"You summon {dead_lib.name_role()} to your personal chambers. Darting from the shadows you deftly strike his head from his shoulders. With the flesh removed from his skull you place the skull upon a hastily erected shrine." - pop_up.type=98; + pop_up.text = $"You summon {dead_lib.name_role()} to your personal chambers. Darting from the shadows you deftly strike his head from his shoulders. With the flesh removed from his skull you place the skull upon a hastily erected shrine."; + pop_up.type = 98; pop_up.image = "chaos"; - kill_and_recover(lib[0],lib[1]); + kill_and_recover(lib[0], lib[1]); chapter_master.add_trait("blood_for_blood"); chapter_master.edit_corruption(20); } else { diplomacy_pathway = "daemon_scorn"; } - scr_dialogue(diplomacy_pathway); - force_goodbye = 1; - }); - scr_diplomacy_hit(1, ,function(){ - - cooldown=8000; - diplomacy_pathway = "sacrifice_champ"; - var champ = scr_random_marine(obj_ini.role[100,7],0); - if (champ!="none"){ + scr_dialogue(diplomacy_pathway); + force_goodbye = 1; + }); + scr_diplomacy_hit(1,, function() { + cooldown = 8000; + diplomacy_pathway = "sacrifice_champ"; + var champ = scr_random_marine(obj_ini.role[100][7], 0); + if (champ != "none") { var chapter_master = obj_ini.TTRPG[0][1]; - chapter_master.add_trait("blood_for_blood"); - chapter_master.edit_corruption(20); + chapter_master.add_trait("blood_for_blood"); + chapter_master.edit_corruption(20); var dead_champ = obj_ini.TTRPG[champ[0]][champ[1]]; //TODO make this into a real dual with consequences - pop_up = instance_create(0,0,obj_popup); + pop_up = instance_create(0, 0, obj_popup); pop_up.title = "Skull for the Skull Throne"; - pop_up.text = $"You summon {dead_champ.name_role()} to your personal chambers. Darting from the shadows towards {dead_champ.name()} who is a cunning warrior and reacts with precision to your attack, however eventually you prevail and strike him down. With the flesh removed from his skull you place it upon a hastily erected shrine." - pop_up.type=98; - pop_up.image = "chaos"; - // obj_duel = instance_create(0,0,obj_duel); - // obj_duel.title = "Ambush Champion"; - // pop.type="duel"; - kill_and_recover(champ[0],champ[1]); + pop_up.text = $"You summon {dead_champ.name_role()} to your personal chambers. Darting from the shadows towards {dead_champ.name()} who is a cunning warrior and reacts with precision to your attack, however eventually you prevail and strike him down. With the flesh removed from his skull you place it upon a hastily erected shrine."; + pop_up.type = 98; + pop_up.image = "chaos"; + // obj_duel = instance_create(0,0,obj_duel); + // obj_duel.title = "Ambush Champion"; + // pop.type="duel"; + kill_and_recover(champ[0], champ[1]); } else { diplomacy_pathway = "daemon_scorn"; - } - scr_dialogue(diplomacy_pathway); - force_goodbye = 1; - - }); - scr_diplomacy_hit(2, ,function(){ - cooldown=8000; - diplomacy_pathway = "sacrifice_squad"; - var kill_squad, squad_found=false; - for(var i=0;i4){ + if (kill_squad.type == "tactical_squad" && array_length(kill_squad.members) > 4) { var chapter_master = obj_ini.TTRPG[0][1]; - chapter_master.add_trait("blood_for_blood"); + chapter_master.add_trait("blood_for_blood"); chapter_master.edit_corruption(20); kill_squad.kill_members(); - with(obj_ini){ + with (obj_ini) { scr_company_order(kill_squad.base_company); } - squad_found=true + squad_found = true; break; } } - if (!squad_found){ + if (!squad_found) { diplomacy_pathway = "daemon_scorn"; } - scr_dialogue(diplomacy_pathway); - force_goodbye = 1; - }); - scr_diplomacy_hit(3, "daemon_scorn"); - } - else if (diplomacy_pathway == "Slaanesh_path") { - scr_diplomacy_hit(0, "Slaanesh_arti"); - scr_diplomacy_hit(1, "daemon_scorn"); - } - else if (diplomacy_pathway == "Nurgle_path") { - scr_diplomacy_hit(0, "nurgle_gift"); - scr_diplomacy_hit(1, "daemon_scorn"); - - } - - else if (diplomacy_pathway = "Tzeentch_path") { - scr_diplomacy_hit(0, "Tzeentch_plan"); - scr_diplomacy_hit(1, "daemon_scorn"); - } -} \ No newline at end of file + scr_dialogue(diplomacy_pathway); + force_goodbye = 1; + }); + scr_diplomacy_hit(3, "daemon_scorn"); + } else if (diplomacy_pathway == "Slaanesh_path") { + scr_diplomacy_hit(0, "Slaanesh_arti"); + scr_diplomacy_hit(1, "daemon_scorn"); + } else if (diplomacy_pathway == "Nurgle_path") { + scr_diplomacy_hit(0, "nurgle_gift"); + scr_diplomacy_hit(1, "daemon_scorn"); + } else if (diplomacy_pathway == "Tzeentch_path") { + scr_diplomacy_hit(0, "Tzeentch_plan"); + scr_diplomacy_hit(1, "daemon_scorn"); + } +} diff --git a/scripts/scr_draw_rainbow/scr_draw_rainbow.gml b/scripts/scr_draw_rainbow/scr_draw_rainbow.gml index 94f5041c6c..6329fb6fae 100644 --- a/scripts/scr_draw_rainbow/scr_draw_rainbow.gml +++ b/scripts/scr_draw_rainbow/scr_draw_rainbow.gml @@ -1,28 +1,47 @@ function scr_draw_rainbow(x1, y1, x2, y2, colour_ratio) { + // Draws a variable length and color rectangle based on a ratio of two variables + with (obj_controller) { + var wid, rat; + wid = x2 - x1; + rat = colour_ratio; - // Draws a variable length and color rectangle based on a ratio of two variables - - with (obj_controller){ - var wid,rat;wid=x2-x1;rat=colour_ratio; - - - if (menu!=eMENU.Diplomacy) or (diplomacy!=0){ - if (colour_ratio<=0.15) then draw_set_color(c_red); - if (colour_ratio>=0.15) and (colour_ratio<=0.4) then draw_set_color(c_orange); - if (colour_ratio>=0.4) and (colour_ratio<=0.7) then draw_set_color(c_yellow); - if (colour_ratio>=0.7) then draw_set_color(c_green); - } - if (menu=eMENU.Diplomacy) and (diplomacy=0){ - if (colour_ratio<=0.5) then draw_set_color(c_red); - if (colour_ratio>=0.5) and (colour_ratio<=0.65) then draw_set_color(c_orange); - if (colour_ratio>=0.65) and (colour_ratio<=0.85) then draw_set_color(c_yellow); - if (colour_ratio>=0.85) then draw_set_color(c_green); - } - if (rat>1) then rat=1;if (rat<-1) then rat=-1; - draw_rectangle(x1,y1,x1+(wid*rat),y2,0); - draw_set_color(c_gray); - draw_rectangle(x1,y1,x2,y2,1); - - } + if ((menu != eMENU.Diplomacy) || (diplomacy != 0)) { + if (colour_ratio <= 0.15) { + draw_set_color(c_red); + } + if ((colour_ratio >= 0.15) && (colour_ratio <= 0.4)) { + draw_set_color(c_orange); + } + if ((colour_ratio >= 0.4) && (colour_ratio <= 0.7)) { + draw_set_color(c_yellow); + } + if (colour_ratio >= 0.7) { + draw_set_color(c_green); + } + } + if ((menu == eMENU.Diplomacy) && (diplomacy == 0)) { + if (colour_ratio <= 0.5) { + draw_set_color(c_red); + } + if ((colour_ratio >= 0.5) && (colour_ratio <= 0.65)) { + draw_set_color(c_orange); + } + if ((colour_ratio >= 0.65) && (colour_ratio <= 0.85)) { + draw_set_color(c_yellow); + } + if (colour_ratio >= 0.85) { + draw_set_color(c_green); + } + } + if (rat > 1) { + rat = 1; + } + if (rat < -1) { + rat = -1; + } + draw_rectangle(x1, y1, x1 + (wid * rat), y2, 0); + draw_set_color(c_gray); + draw_rectangle(x1, y1, x2, y2, 1); + } } diff --git a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml index 11d259ad5c..8f01098f61 100644 --- a/scripts/scr_inquisition_mission/scr_inquisition_mission.gml +++ b/scripts/scr_inquisition_mission/scr_inquisition_mission.gml @@ -15,184 +15,186 @@ star_has_planet_with_forces -> given the id of a _star, and a faction, returns whether or not there are forces present there and in sufficient number */ - -/// @param {Enum.EVENT} event +/// @param {Enum.EVENT} event /// @param {Enum.eINQUISITION_MISSION} forced_mission optional -function scr_inquisition_mission(event, forced_mission = -1){ - +function scr_inquisition_mission(event, forced_mission = -1) { log_message($"RE: Inquisition Mission, event {event}, forced_mission {forced_mission}"); - if ((obj_controller.known[eFACTION.Inquisition] == 0 || obj_controller.faction_status[eFACTION.Inquisition] == "War") && !global.cheat_debug){ + if ((obj_controller.known[eFACTION.Inquisition] == 0 || obj_controller.faction_status[eFACTION.Inquisition] == "War") && !global.cheat_debug) { log_message("Player is either hasn't met or is at war with Inquisition, not proceeding with inquisition mission"); return; } - if (global.cheat_debug){ + if (global.cheat_debug) { show_debug_message("find mission"); } - if (event == eEVENT.inquisition_planet){ + if (event == eEVENT.inquisition_planet) { mission_investigate_planet(); - } else if (event == eEVENT.inquisition_mission){ - - var inquisition_missions = - [ - eINQUISITION_MISSION.purge, - eINQUISITION_MISSION.inquisitor, - eINQUISITION_MISSION.spyrer, - eINQUISITION_MISSION.artifact - ]; - - var found_sleeping_necrons = false; + } else if (event == eEVENT.inquisition_mission) { + var inquisition_missions = [eINQUISITION_MISSION.purge, eINQUISITION_MISSION.inquisitor, eINQUISITION_MISSION.spyrer, eINQUISITION_MISSION.artifact]; + + var found_sleeping_necrons = false; var found_tyranid_org = false; var found_demon_world = false; - + var necron_tomb_worlds = []; var tyranid_org_worlds = []; var demon_worlds = []; var all_stars = scr_get_stars(); - for(var s = 0, _len = array_length(all_stars); s <_len; s++){ + for (var s = 0, _len = array_length(all_stars); s < _len; s++) { var _star = all_stars[s]; - if (scr_star_has_planet_with_feature(_star, P_features.Necron_Tomb) && !awake_necron_star(_star.id)){ + if (scr_star_has_planet_with_feature(_star, P_features.Necron_Tomb) && !awake_necron_star(_star.id)) { array_push(necron_tomb_worlds, _star); found_sleeping_necrons = true; } - if (star_has_planet_with_forces(_star, "Demons", 1)){ + if (star_has_planet_with_forces(_star, "Demons", 1)) { // array_push(demon_worlds, _star); // turning this off til i have a way to finish the mission found_demon_world = true; } - if (star_has_planet_with_forces(_star, eFACTION.Tyranids, 4)){ - array_push(tyranid_org_worlds, _star) + if (star_has_planet_with_forces(_star, eFACTION.Tyranids, 4)) { + array_push(tyranid_org_worlds, _star); found_tyranid_org = true; } } - if (found_sleeping_necrons){ + if (found_sleeping_necrons) { array_push(inquisition_missions, eINQUISITION_MISSION.tomb_world); log_message($"Was able to find a _star with dormant necron tomb for inquisition mission"); } else { - log_message($"Couldn't find any planets with a dormant necron tomb for inquisition mission") + log_message($"Couldn't find any planets with a dormant necron tomb for inquisition mission"); } - if (found_tyranid_org){ + if (found_tyranid_org) { log_message($"Was able to find a _star with lvl 4 tyranids for inquisition mission"); array_push(inquisition_missions, eINQUISITION_MISSION.tyranid_organism); } else { - log_message($"Couldn't find any planets with lvl 4 tyranids for inquisition mission") + log_message($"Couldn't find any planets with lvl 4 tyranids for inquisition mission"); } - if (found_demon_world){ + if (found_demon_world) { array_push(inquisition_missions, eINQUISITION_MISSION.demon_world); log_message($"Was able to find a _star with demons on it for inquisition mission"); } else { - log_message($"Couldn't find any planets with demons for inquisition mission") + log_message($"Couldn't find any planets with demons for inquisition mission"); } - - //if (string_count("Tau",obj_controller.useful_info)=0){ - // var found_tau = false; - // with(obj_star){ - // if (found_tau){ - // break; - // } - // for(var i = 1; i <= planets; i++) - // { - // if (p_tau[i]>4) { - // array_push(inquisition_missions, eINQUISITION_MISSION.ethereal); - // found_tau = true - // break; - // } - // } - // } - //} - - var chosen_mission = choose_array(inquisition_missions); - if (forced_mission != -1){ + + //if (string_count("Tau",obj_controller.useful_info)=0){ + // var found_tau = false; + // with(obj_star){ + // if (found_tau){ + // break; + // } + // for(var i = 1; i <= planets; i++) + // { + // if (p_tau[i]>4) { + // array_push(inquisition_missions, eINQUISITION_MISSION.ethereal); + // found_tau = true + // break; + // } + // } + // } + //} + + var chosen_mission = choose_array(inquisition_missions); + if (forced_mission != -1) { chosen_mission = forced_mission; } - switch (chosen_mission){ - case eINQUISITION_MISSION.purge: mission_inquistion_purge(); break; - case eINQUISITION_MISSION.inquisitor: mission_inquistion_hunt_inquisitor(); break; - case eINQUISITION_MISSION.spyrer: mission_inquistion_spyrer(); break; - case eINQUISITION_MISSION.artifact: mission_inquisition_artifact(); break; - case eINQUISITION_MISSION.tomb_world: mission_inquisition_tomb_world(necron_tomb_worlds); break; - case eINQUISITION_MISSION.tyranid_organism: mission_inquisition_tyranid_organism(tyranid_org_worlds); break; - case eINQUISITION_MISSION.ethereal: mission_inquisition_ethereal(); break; - case eINQUISITION_MISSION.demon_world: mission_inquisition_demon_world(demon_worlds); break; + switch (chosen_mission) { + case eINQUISITION_MISSION.purge: + mission_inquistion_purge(); + break; + case eINQUISITION_MISSION.inquisitor: + mission_inquistion_hunt_inquisitor(); + break; + case eINQUISITION_MISSION.spyrer: + mission_inquistion_spyrer(); + break; + case eINQUISITION_MISSION.artifact: + mission_inquisition_artifact(); + break; + case eINQUISITION_MISSION.tomb_world: + mission_inquisition_tomb_world(necron_tomb_worlds); + break; + case eINQUISITION_MISSION.tyranid_organism: + mission_inquisition_tyranid_organism(tyranid_org_worlds); + break; + case eINQUISITION_MISSION.ethereal: + mission_inquisition_ethereal(); + break; + case eINQUISITION_MISSION.demon_world: + mission_inquisition_demon_world(demon_worlds); + break; } - - - } } -function mission_inquisition_demon_world(demon_worlds){ +function mission_inquisition_demon_world(demon_worlds) { var _star = choose_array(demon_worlds); var planet = -1; - for(var i = 1; i <= _star.planets; i++){ - if (_star.p_demons[i] > 1){ + for (var i = 1; i <= _star.planets; i++) { + if (_star.p_demons[i] > 1) { planet = i; break; } } var eta = scr_mission_eta(_star.x, _star.y, 25); - var text=$"The Inquisitor is trusting you with a special mission. The planet {string(_star.name)} {scr_roman(planet)}"; - text+=$" has been uncovered as a Demon World. The taint of chaos must be eradicated from this system. Can your chapter handle this mission?"; - scr_popup("Inquisition Mission",text,"inquisition",$"demon_world|{string(_star.name)}|{string(planet)}|{string(eta+1)}|"); + var text = $"The Inquisitor is trusting you with a special mission. The planet {string(_star.name)} {scr_roman(planet)}"; + text += $" has been uncovered as a Demon World. The taint of chaos must be eradicated from this system. Can your chapter handle this mission?"; + scr_popup("Inquisition Mission", text, "inquisition", $"demon_world|{string(_star.name)}|{string(planet)}|{string(eta + 1)}|"); } -function mission_inquisition_ethereal(){ +function mission_inquisition_ethereal() { log_message("RE: Ethereal Capture"); var stars = scr_get_stars(); var _valid_stars = array_filter_ext(stars, function(_star, index) { - for(var i = 1; i <= _star.planets; i++){ - if (_star.p_owner[i]==eFACTION.Tau && _star.p_tau[i] >= 4) { + for (var i = 1; i <= _star.planets; i++) { + if (_star.p_owner[i] == eFACTION.Tau && _star.p_tau[i] >= 4) { return true; } } return false; }); - if (array_length(_valid_stars) == 0){ + if (array_length(_valid_stars) == 0) { exit; } var _star = array_random_element(_valid_stars); - + var planet = -1; - for(var i = 1; i <= _star.planets; i++){ - if (_star.p_owner[i]==eFACTION.Tau && _star.p_tau[i] >= 4){ + for (var i = 1; i <= _star.planets; i++) { + if (_star.p_owner[i] == eFACTION.Tau && _star.p_tau[i] >= 4) { planet = i; break; } } - var eta = scr_mission_eta(_star.x,_star.y,1); - eta = min(max(eta,12),50); + var eta = scr_mission_eta(_star.x, _star.y, 1); + eta = min(max(eta, 12), 50); var text = $"An Inquisitor is trusting you with a special mission."; - text +=$"They require that you capture a Tau Ethereal from the planet {string(_star.name)} {scr_roman(planet)} for research purposes. You have {string(eta)} months to locate and capture one. Can your chapter handle this mission?"; - scr_popup("Inquisition Mission",text,"inquisition",$"ethereal|{string(_star.name)}|{string(planet)}|{string(eta+1)}|"); - + text += $"They require that you capture a Tau Ethereal from the planet {string(_star.name)} {scr_roman(planet)} for research purposes. You have {string(eta)} months to locate and capture one. Can your chapter handle this mission?"; + scr_popup("Inquisition Mission", text, "inquisition", $"ethereal|{string(_star.name)}|{string(planet)}|{string(eta + 1)}|"); } -function mission_inquisition_tyranid_organism(worlds){ +function mission_inquisition_tyranid_organism(worlds) { log_message("RE: Gaunt Capture"); var _star = choose_array(worlds); var planet = -1; - for(var i = 1; i <= _star.planets; i++){ - if (_star.p_tyranids[i] > 4){ + for (var i = 1; i <= _star.planets; i++) { + if (_star.p_tyranids[i] > 4) { planet = i; break; } } var eta = scr_mission_eta(_star.x, _star.y, 1); - var eta = min(max(eta,6),50); - - var text=$"An Inquisitor is trusting you with a special mission. The planet {string(_star.name)} {scr_roman(planet)}"; - text+=" is ripe with Tyranid organisms. They require that you capture one of the Gaunt species for research purposes. Can your chapter handle this mission?"; - scr_popup("Inquisition Mission",text,"inquisition",$"tyranid_org|{string(_star.name)}|{string(planet)}|{string(eta+1)}|"); + var eta = min(max(eta, 6), 50); + var text = $"An Inquisitor is trusting you with a special mission. The planet {string(_star.name)} {scr_roman(planet)}"; + text += " is ripe with Tyranid organisms. They require that you capture one of the Gaunt species for research purposes. Can your chapter handle this mission?"; + scr_popup("Inquisition Mission", text, "inquisition", $"tyranid_org|{string(_star.name)}|{string(planet)}|{string(eta + 1)}|"); } -function mission_inquisition_tomb_world(tomb_worlds){ +function mission_inquisition_tomb_world(tomb_worlds) { log_message("RE: Necron Tomb Bombing"); - if (is_array(tomb_worlds)){ + if (is_array(tomb_worlds)) { var _star = array_random_element(tomb_worlds); } else { _star = tomb_worlds; @@ -200,44 +202,43 @@ function mission_inquisition_tomb_world(tomb_worlds){ var planet = scr_get_planet_with_feature(_star, P_features.Necron_Tomb); - if (planet == -1){ - planet = irandom_range(1,_star.planets); - array_push(_star.p_feature[planet],new NewPlanetFeature(P_features.Necron_Tomb)); + if (planet == -1) { + planet = irandom_range(1, _star.planets); + array_push(_star.p_feature[planet], new NewPlanetFeature(P_features.Necron_Tomb)); } - - var eta = scr_mission_eta(_star.x, _star.y,1) - if (global.cheat_debug){ + + var eta = scr_mission_eta(_star.x, _star.y, 1); + if (global.cheat_debug) { show_debug_message("mission popup"); } var _options = [ { - str1 :"Accept", + str1: "Accept", choice_func: init_mission_inquisition_tomb_world, }, { - str1 :"Refuse", + str1: "Refuse", choice_func: popup_default_close, } - ] + ]; var _pop_data = { - system : _star.name, - planet : planet, - estimate : eta, - mission : "necron", - options : _options, - } + system: _star.name, + planet: planet, + estimate: eta, + mission: "necron", + options: _options, + }; - var text=$"The Inquisition is trusting you with a special mission. They have reason to suspect the Necron Tomb on planet {string(_star.name)} {scr_roman(planet)}"; + var text = $"The Inquisition is trusting you with a special mission. They have reason to suspect the Necron Tomb on planet {string(_star.name)} {scr_roman(planet)}"; - text+=$" may become active. You are to send a small group of marines to plant a bomb deep inside, within {string(eta)} months. Can your chapter handle this mission?"; + text += $" may become active. You are to send a small group of marines to plant a bomb deep inside, within {string(eta)} months. Can your chapter handle this mission?"; - scr_popup("Inquisition Mission",text,"inquisition",_pop_data); + scr_popup("Inquisition Mission", text, "inquisition", _pop_data); } -function init_mission_inquisition_tomb_world(){ - +function init_mission_inquisition_tomb_world() { mission_star = star_by_name(pop_data.system); - if (mission_star == "none"){ + if (mission_star == "none") { popup_default_close(); exit; } @@ -259,17 +260,17 @@ function init_mission_inquisition_tomb_world(){ demand = 0; } add_new_inquis_mission(); - exit; + exit; } -function mission_inquisition_artifact(){ +function mission_inquisition_artifact() { var text; log_message("RE: Artifact Hold"); - text="The Inquisition is trusting you with a special mission. A local Inquisitor has a powerful artifact. You are to keep it safe, and NOT use it, until the artifact may be safely retrieved. Can your chapter handle this mission?"; - scr_popup("Inquisition Mission",text,"inquisition",$"artifact|bop|0|{string(irandom_range(6,26))}|"); + text = "The Inquisition is trusting you with a special mission. A local Inquisitor has a powerful artifact. You are to keep it safe, and NOT use it, until the artifact may be safely retrieved. Can your chapter handle this mission?"; + scr_popup("Inquisition Mission", text, "inquisition", $"artifact|bop|0|{string(irandom_range(6, 26))}|"); } -function mission_inquistion_hunt_inquisitor(star_id = -1){ +function mission_inquistion_hunt_inquisitor(star_id = -1) { log_message("RE: Inquisitor Hunt"); var stars = scr_get_stars(); @@ -285,150 +286,141 @@ function mission_inquistion_hunt_inquisitor(star_id = -1){ return false; });*/ - - if (star_id == -1){ + if (star_id == -1) { var _valid_stars = stars; - + if (array_length(_valid_stars) == 0) { log_error("RE: Inquisitor Hunt,couldn't find a _star"); exit; } - + var _star = array_random_element(_valid_stars); } else { _star = star_id; } - + var _gender = set_gender(); var _name = global.name_generator.generate_imperial_name(_gender); var planet = irandom_range(1, _star.planets); - - var eta = scr_mission_eta(_star.x,_star.y,1); - eta=max(eta, 8); - var text=$"The Inquisition is trusting you with a special mission. A radical inquisitor named {_name} will be visiting the {string(_star.name)} system in {string(eta)} month's time. They are highly suspect of heresy, and as such, are to be put down. Can your chapter handle this mission?"; + + var eta = scr_mission_eta(_star.x, _star.y, 1); + eta = max(eta, 8); + var text = $"The Inquisition is trusting you with a special mission. A radical inquisitor named {_name} will be visiting the {string(_star.name)} system in {string(eta)} month's time. They are highly suspect of heresy, and as such, are to be put down. Can your chapter handle this mission?"; if (obj_controller.demanding) { text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. A radical inquisitor is enroute to {_star.name}, expected within {estimate} months. They are to be silenced and removed."; } var _options = [ { - str1 :"Accept", + str1: "Accept", choice_func: init_mission_hunt_inquisitor, }, { - str1 :"Refuse", + str1: "Refuse", choice_func: popup_default_close, } ]; var _mission_data = { - inquisitor_name : _name, - inquisitor_gender : _gender, + inquisitor_name: _name, + inquisitor_gender: _gender, }; var _pop_data = { - system : _star.name, - planet : planet, - estimate : eta, - mission : "inquisitor", - options : _options, - mission_data : _mission_data, + system: _star.name, + planet: planet, + estimate: eta, + mission: "inquisitor", + options: _options, + mission_data: _mission_data, }; - scr_popup("Inquisition Mission",text,"inquisition",_pop_data); + scr_popup("Inquisition Mission", text, "inquisition", _pop_data); } /// @mixin obj_popup -function add_new_inquis_mission(){ - +function add_new_inquis_mission() { if (add_new_problem(pop_data.planet, pop_data.mission, pop_data.estimate, mission_star)) { new_star_event_marker("green"); mission_is_go = true; - } + } } -function init_mission_hunt_inquisitor(){ +function init_mission_hunt_inquisitor() { mission_star = star_by_name(pop_data.system); - if (mission_star == "none"){ + if (mission_star == "none") { popup_default_close(); exit; } scr_event_log("", $"Inquisition Mission Accepted: The radical Inquisitor {pop_data.mission_data.inquisitor_name} enroute to {mission_star.name} must be removed. Estimated arrival in {pop_data.estimate} months.", mission_star.name); - var _radical_inquisitor_fleet = instance_create(mission_star.x-irandom_range(-400,400),mission_star.y-irandom_range(-400,400),obj_en_fleet); - with (_radical_inquisitor_fleet){ + var _radical_inquisitor_fleet = instance_create(mission_star.x - irandom_range(-400, 400), mission_star.y - irandom_range(-400, 400), obj_en_fleet); + with (_radical_inquisitor_fleet) { base_inquis_fleet(); } fleet_add_cargo("radical_inquisitor", pop_data.mission_data, true, _radical_inquisitor_fleet); - _radical_inquisitor_fleet.action_x=mission_star.x; - _radical_inquisitor_fleet.action_y=mission_star.y; + _radical_inquisitor_fleet.action_x = mission_star.x; + _radical_inquisitor_fleet.action_y = mission_star.y; var _est = pop_data.estimate; - with (_radical_inquisitor_fleet){ - set_fleet_movement(false,"move",_est,_est); + with (_radical_inquisitor_fleet) { + set_fleet_movement(false, "move", _est, _est); } - if (add_new_problem(pop_data.planet, pop_data.mission, pop_data.estimate, mission_star,pop_data.mission_data)) { + if (add_new_problem(pop_data.planet, pop_data.mission, pop_data.estimate, mission_star, pop_data.mission_data)) { new_star_event_marker("green"); mission_is_go = true; } } -function mission_hunt_inquisitor_hear_out_radical_inquisitor(){ - +function mission_hunt_inquisitor_hear_out_radical_inquisitor() { var _offer = choose(1, 1, 2, 2, 3); - var _gender = pop_data.inquisitor_gender + var _gender = pop_data.inquisitor_gender; var _gender_third = string_gender_third_person(_gender); var gender_pronoun = string_gender_pronouns(_gender); if (_offer == 1) { replace_options( - [ + [ { - str1 : "Destroy their vessel", - choice_func : mission_hunt_inquisitor_destroy_inquisitor_ship, - + str1: "Destroy their vessel", + choice_func: mission_hunt_inquisitor_destroy_inquisitor_ship, }, { - str1 : "Take the artifact and then destroy them", - choice_func : mission_hunt_inquisitor_take_artifact_double_cross, + str1: "Take the artifact and then destroy them", + choice_func: mission_hunt_inquisitor_take_artifact_double_cross, }, { - str1 : "Take the artifact and spare them", - choice_func : mission_hunt_inquisitor_take_artifact_bribe, + str1: "Take the artifact and spare them", + choice_func: mission_hunt_inquisitor_take_artifact_bribe, } ] ); title = "Artifact Offered"; text = $"The Inquisitor claims that this is a massive misunderstanding, and {_gender_third} wishes to prove {gender_pronoun} innocence. If {global.chapter_name} allow their ship to leave {_gender_third} will give {global.chapter_name} an artifact."; exit; - } - - else if (_offer == 2) { + } else if (_offer == 2) { replace_options( - [ + [ { - str1 : "Destroy their vessel", - choice_func : mission_hunt_inquisitor_destroy_inquisitor_ship, - + str1: "Destroy their vessel", + choice_func: mission_hunt_inquisitor_destroy_inquisitor_ship, }, { - str1 : "Search their ship", - //choice_func : instance_destroy, // TODO: Implement proper ship search logic + str1: "Search their ship" + , //choice_func : instance_destroy, // TODO: Implement proper ship search logic }, { - str1 : "Spare them", - choice_func : mission_hunt_inquisitor_show_mercy, + str1: "Spare them", + choice_func: mission_hunt_inquisitor_show_mercy, } ] - ) + ); title = "Mercy Plea"; text = $"The Inquisitor claims that {_gender_third} has key knowledge that would grant the Imperium vital power over the forces of Chaos. If {global.chapter_name} allow {gender_pronoun} ship to leave the forces of Chaos within this sector will be weakened."; exit; - } - - else if (_offer == 3) { + } else if (_offer == 3) { with (obj_en_fleet) { if ((trade_goods == "male_her") || (trade_goods == "female_her")) { with (obj_p_fleet) { @@ -450,10 +442,10 @@ function mission_hunt_inquisitor_hear_out_radical_inquisitor(){ scr_event_log("", "Inquisition Mission Completed: The radical Inquisitor has been purged."); exit; } - exit; + exit; } -function mission_hunt_inquisitor_take_artifact_bribe(){ +function mission_hunt_inquisitor_take_artifact_bribe() { with (pop_data.inquisitor_ship) { action_x = choose(room_width * -1, room_width * 2); action_y = choose(room_height * -1, room_height * 2); @@ -462,7 +454,7 @@ function mission_hunt_inquisitor_take_artifact_bribe(){ set_fleet_movement(false); } var last_artifact = scr_add_artifact("random", "", 4); - + reset_popup_options(); title = "Inquisition Mission Completed"; @@ -473,18 +465,18 @@ function mission_hunt_inquisitor_take_artifact_bribe(){ scr_event_log("", "Inquisition Mission Completed: The radical Inquisitor has been purged."); add_event({ - e_id : "inquisitor_spared", - duration : irandom_range(6, 18) + 1, - variation : 1, + e_id: "inquisitor_spared", + duration: irandom_range(6, 18) + 1, + variation: 1, }); } -function mission_hunt_inquisitor_take_artifact_double_cross(){ +function mission_hunt_inquisitor_take_artifact_double_cross() { with (pop_data.inquisitor_ship) { - instance_destroy(); + instance_destroy(); } var last_artifact = scr_add_artifact("random", "", 4); - + reset_popup_options(); title = "Inquisition Mission Completed"; @@ -493,13 +485,9 @@ function mission_hunt_inquisitor_take_artifact_double_cross(){ image = "exploding_ship"; scr_event_log("", "Artifact recovered from radical Inquisitor."); scr_event_log("", "Inquisition Mission Completed: The radical Inquisitor has been purged."); - } - - -function mission_hunt_inquisitor_show_mercy(){ - +function mission_hunt_inquisitor_show_mercy() { with (pop_data.inquisitor_ship) { action_x = choose(room_width * -1, room_width * 2); action_y = choose(room_height * -1, room_height * 2); @@ -507,7 +495,7 @@ function mission_hunt_inquisitor_show_mercy(){ alarm[4] = 1; action_spd = 256; action = ""; - }; + } title = "Inquisition Mission Completed"; text = $"{global.chapter_name} allow the Inquisitor to leave, trusting in their words. If they truly do have key information it is a risk {global.chapter_name} are willing to take. What's the worst that could happen?"; @@ -517,22 +505,19 @@ function mission_hunt_inquisitor_show_mercy(){ scr_event_log("", "Inquisition Mission Completed?: The radical Inquisitor has been allowed to flee in order to weaken the forces of Chaos, as they promised."); add_event({ - e_id : "inquisitor_spared", - duration : irandom_range(6, 18) + 1, - variation : 2, - }) - + e_id: "inquisitor_spared", + duration: irandom_range(6, 18) + 1, + variation: 2, + }); } -function mission_hunt_inquisitor_destroy_inquisitor_ship(){ - +function mission_hunt_inquisitor_destroy_inquisitor_ship() { show_debug_message("mission_hunt_inquisitor_destroy_inquisitor_ship"); var _final_disp_mod = 0; if (obj_controller.demanding == 0) { _final_disp_mod += 1; - } - else if (obj_controller.demanding == 1) { + } else if (obj_controller.demanding == 1) { _final_disp_mod += choose(0, 0, 1); } @@ -551,100 +536,96 @@ function mission_hunt_inquisitor_destroy_inquisitor_ship(){ with (pop_data.inquisitor_ship) { instance_destroy(); } - exit; + exit; } -function hunt_inquisition_spared_inquisitor_consequence(event){ - var _diceh=roll_dice_chapter(1, 100, "high"); +function hunt_inquisition_spared_inquisitor_consequence(event) { + var _diceh = roll_dice_chapter(1, 100, "high"); - if (_diceh<=25){ - alarm[8]=1; - scr_loyalty("Crossing the Inquisition","+"); - scr_popup("Inquisition Crossed","","",""); + if (_diceh <= 25) { + alarm[8] = 1; + scr_loyalty("Crossing the Inquisition", "+"); + scr_popup("Inquisition Crossed", "", "", ""); } - if (_diceh>25) and (_diceh<=50){ - scr_loyalty("Crossing the Inquisition","+"); - scr_popup("Inquisition Crossed","","",""); + if ((_diceh > 25) && (_diceh <= 50)) { + scr_loyalty("Crossing the Inquisition", "+"); + scr_popup("Inquisition Crossed", "", "", ""); } - if (_diceh>50) and (_diceh<=85){ + if ((_diceh > 50) && (_diceh <= 85)) { //nothing happens for the minute } - if (_diceh>85) and (event.variation==2){ - scr_popup("Anonymous Message","You recieve an anonymous letter of thanks. It mentions that motions are underway to destroy any local forces of Chaos.","",""); - with(obj_star){ - for(var o=1; o<=planets; o++){ - p_heresy[o]=max(0,p_heresy[o]-10); + if ((_diceh > 85) && (event.variation == 2)) { + scr_popup("Anonymous Message", "You recieve an anonymous letter of thanks. It mentions that motions are underway to destroy any local forces of Chaos.", "", ""); + with (obj_star) { + for (var o = 1; o <= planets; o++) { + p_heresy[o] = max(0, p_heresy[o] - 10); } } } } - -function mission_inquistion_spyrer(){ +function mission_inquistion_spyrer() { log_message("RE: Spyrer"); var stars = scr_get_stars(); - var _valid_stars = array_filter_ext(stars, - function(_star,index){ - return scr_star_has_planet_with_type(_star,"Hive"); + var _valid_stars = array_filter_ext(stars, function(_star, index) { + return scr_star_has_planet_with_type(_star, "Hive"); }); - - if (array_length(_valid_stars) == 0){ + + if (array_length(_valid_stars) == 0) { log_error("RE: Spyrer, couldn't find _star"); exit; } var _star = array_random_element(_valid_stars); - var planet = scr_get_planet_with_type(_star,"Hive"); - var eta = scr_mission_eta(_star.x,_star.y,1); + var planet = scr_get_planet_with_type(_star, "Hive"); + var eta = scr_mission_eta(_star.x, _star.y, 1); eta = min(max(eta, 6), 50); - - - var text=$"The Inquisition is trusting you with a special mission. An experienced Spyrer on hive world {string(_star.name)} {scr_roman(planet)}"; + + var text = $"The Inquisition is trusting you with a special mission. An experienced Spyrer on hive world {string(_star.name)} {scr_roman(planet)}"; text += $" has began to hunt indiscriminately, and proven impossible to take down by conventional means. If they are not put down within {string(eta)} month's time panic is likely. Can your chapter handle this mission?"; - var mission_params = $"spyrer|{string(_star.name)}|{string(planet)}|{string(eta+1)}|"; - log_message($"Starting spyrer mission with params {mission_params}") - scr_popup("Inquisition Mission",text,"inquisition",mission_params); + var mission_params = $"spyrer|{string(_star.name)}|{string(planet)}|{string(eta + 1)}|"; + log_message($"Starting spyrer mission with params {mission_params}"); + scr_popup("Inquisition Mission", text, "inquisition", mission_params); } -function mission_inquistion_purge(){ +function mission_inquistion_purge() { log_message("RE: Purge"); - var mission_flavour = choose(1,1,1,2,2,3); - + var mission_flavour = choose(1, 1, 1, 2, 2, 3); + var stars = scr_get_stars(); var _valid_stars = []; - + if (mission_flavour == 3) { - _valid_stars = array_filter_ext(stars, function(_star,index){ - var hive_idx = scr_get_planet_with_type(_star,"Hive") + _valid_stars = array_filter_ext(stars, function(_star, index) { + var hive_idx = scr_get_planet_with_type(_star, "Hive"); return scr_is_planet_owned_by_allies(_star, hive_idx); }); } else { - _valid_stars = array_filter_ext(stars, - function(_star,index){ - var hive_idx = scr_get_planet_with_type(_star,"Hive") - var desert_idx = scr_get_planet_with_type(_star,"Desert") - var temperate_idx = scr_get_planet_with_type(_star,"Temperate") - var allied_hive = scr_is_planet_owned_by_allies(_star, hive_idx) - var allied_desert = scr_is_planet_owned_by_allies(_star, desert_idx) - var allied_temperate =scr_is_planet_owned_by_allies(_star, temperate_idx) - - return allied_hive || allied_desert || allied_temperate; + _valid_stars = array_filter_ext(stars, function(_star, index) { + var hive_idx = scr_get_planet_with_type(_star, "Hive"); + var desert_idx = scr_get_planet_with_type(_star, "Desert"); + var temperate_idx = scr_get_planet_with_type(_star, "Temperate"); + var allied_hive = scr_is_planet_owned_by_allies(_star, hive_idx); + var allied_desert = scr_is_planet_owned_by_allies(_star, desert_idx); + var allied_temperate = scr_is_planet_owned_by_allies(_star, temperate_idx); + + return allied_hive || allied_desert || allied_temperate; }); } - if (array_length(_valid_stars) == 0){ + if (array_length(_valid_stars) == 0) { log_error("RE: Purge, couldn't find _star"); exit; } - + var _star = array_random_element(_valid_stars); - + var planet = -1; if (mission_flavour == 3) { planet = scr_get_planet_with_type(_star, "Hive"); } else { - var hive_planet = scr_get_planet_with_type(_star,"Hive"); - var desert_planet = scr_get_planet_with_type(_star,"Desert"); - var temperate_planet = scr_get_planet_with_type(_star,"Temperate"); + var hive_planet = scr_get_planet_with_type(_star, "Hive"); + var desert_planet = scr_get_planet_with_type(_star, "Desert"); + var temperate_planet = scr_get_planet_with_type(_star, "Temperate"); if (scr_is_planet_owned_by_allies(_star, hive_planet)) { planet = hive_planet; } else if (scr_is_planet_owned_by_allies(_star, temperate_planet)) { @@ -653,150 +634,137 @@ function mission_inquistion_purge(){ planet = desert_planet; } } - - if (planet == -1){ + + if (planet == -1) { log_error("RE: Purge, couldn't find planet"); exit; } - - - var eta = infinity - with(obj_p_fleet){ - if (capital_number+frigate_number==0) { - eta = min(scr_mission_eta(_star.x,_star.y,1),eta); // this is wrong + + var eta = infinity; + with (obj_p_fleet) { + if (capital_number + frigate_number == 0) { + eta = min(scr_mission_eta(_star.x, _star.y, 1), eta); // this is wrong } } - eta = min(max(eta,12),100); - - var text="The Inquisition is trusting you with a special mission."; + eta = min(max(eta, 12), 100); - - - if (mission_flavour==1) { - text +=$" A number of high-ranking nobility on the planet {scr_roman(planet)} are being difficult and harboring heretical thoughts. They are to be selectively purged within {string(eta)} months. Can your chapter handle this mission?"; - } - else if (mission_flavour==2) { - text+=$" A powerful crimelord on the planet {scr_roman(planet)} is gaining an unacceptable amount of power and disrupting daily operations. They are to be selectively purged within {string(eta)} months. Can your chapter handle this mission?"; - } - else if (mission_flavour==3) { - text+=$" The mutants of hive world {scr_roman(planet)} are growing in numbers and ferocity, rising sporadically from the underhive. They are to be cleansed by promethium within {string(eta)} months. Can your chapter handle this mission?"; + var text = "The Inquisition is trusting you with a special mission."; + + if (mission_flavour == 1) { + text += $" A number of high-ranking nobility on the planet {scr_roman(planet)} are being difficult and harboring heretical thoughts. They are to be selectively purged within {string(eta)} months. Can your chapter handle this mission?"; + } else if (mission_flavour == 2) { + text += $" A powerful crimelord on the planet {scr_roman(planet)} is gaining an unacceptable amount of power and disrupting daily operations. They are to be selectively purged within {string(eta)} months. Can your chapter handle this mission?"; + } else if (mission_flavour == 3) { + text += $" The mutants of hive world {scr_roman(planet)} are growing in numbers and ferocity, rising sporadically from the underhive. They are to be cleansed by promethium within {string(eta)} months. Can your chapter handle this mission?"; } - - if (mission_flavour!=3) { - scr_popup("Inquisition Mission",text,"inquisition",$"purge|{string(_star.name)}|{string(planet)}|{string(real(eta+1))}|"); + + if (mission_flavour != 3) { + scr_popup("Inquisition Mission", text, "inquisition", $"purge|{string(_star.name)}|{string(planet)}|{string(real(eta + 1))}|"); + } else { + scr_popup("Inquisition Mission", text, "inquisition", $"cleanse|{string(_star.name)}|{string(planet)}|{string(real(eta + 1))}|"); } - else { - scr_popup("Inquisition Mission",text,"inquisition",$"cleanse|{string(_star.name)}|{string(planet)}|{string(real(eta+1))}|"); +} + +function mission_investigate_planet() { + var stars = scr_get_stars(); + var _valid_stars = array_filter_ext(stars, function(_star, index) { + if (scr_star_has_planet_with_feature(_star, P_features.Ancient_Ruins)) { + var fleet = instance_nearest(_star.x, _star.y, obj_p_fleet); + if (fleet == undefined || point_distance(_star.x, _star.y, fleet.x, fleet.y) >= 160) { + return true; + } + return false; + } + return false; + }); + + if (array_length(_valid_stars) == 0) { + log_error("RE: Investigate Planet, couldn't find a _star"); + exit; } -} + var _star = array_random_element(_valid_stars); + var planet = scr_get_planet_with_feature(_star, P_features.Ancient_Ruins); + if (planet == -1) { + log_error("RE: Investigate Planet, couldn't pick a planet"); + exit; + } -function mission_investigate_planet(){ - var stars = scr_get_stars(); - var _valid_stars = array_filter_ext(stars, - function(_star,index){ - if (scr_star_has_planet_with_feature(_star, P_features.Ancient_Ruins)){ - var fleet = instance_nearest(_star.x,_star.y,obj_p_fleet); - if (fleet == undefined || point_distance(_star.x,_star.y,fleet.x,fleet.y)>=160){ - return true; - } - return false; - } - return false; - }); - - if (array_length(_valid_stars) == 0){ - log_error("RE: Investigate Planet, couldn't find a _star"); - exit; - } - - var _star = array_random_element(_valid_stars); - var planet = scr_get_planet_with_feature(_star, P_features.Ancient_Ruins); - if (planet == -1){ - log_error("RE: Investigate Planet, couldn't pick a planet"); - exit; - } - - - var eta = infinity; - with(obj_p_fleet){ - if (action!=""){ - continue; - } - eta = min(eta, scr_mission_eta(_star.x,_star.y,1)); - } - eta = min(max(3,eta),100); - - var text=$"The Inquisition wishes for you to investigate {string(_star.name)} {scr_roman(planet)}"; - text+=$" Boots are expected to be planted on its surface over the course of your investigation."; - text += $" You have {string(eta)} months to complete this task."; - scr_popup("Inquisition Recon",text,"inquisition",$"recon|{string(_star.name)}|{string(planet)}|{string(eta)}|"); + var eta = infinity; + with (obj_p_fleet) { + if (action != "") { + continue; + } + eta = min(eta, scr_mission_eta(_star.x, _star.y, 1)); + } + eta = min(max(3, eta), 100); + var text = $"The Inquisition wishes for you to investigate {string(_star.name)} {scr_roman(planet)}"; + text += $" Boots are expected to be planted on its surface over the course of your investigation."; + text += $" You have {string(eta)} months to complete this task."; + scr_popup("Inquisition Recon", text, "inquisition", $"recon|{string(_star.name)}|{string(planet)}|{string(eta)}|"); } - /// @mixin obj_star -function setup_necron_tomb_raid(planet){ - log_message($"player on planet with necron mission {name} planet: {planet}") +function setup_necron_tomb_raid(planet) { + log_message($"player on planet with necron mission {name} planet: {planet}"); var have_bomb; have_bomb = scr_check_equip("Plasma Bomb", name, planet, 0); - log_message($"have bomb? {have_bomb} ") + log_message($"have bomb? {have_bomb} "); if (have_bomb > 0) { var tixt; tixt = $"Your marines on {planet_numeral_name(planet)}"; tixt += " are prepared and ready to enter the Necron Tombs. A Plasma Bomb is in tow."; var _number = instance_exists(obj_turn_end) ? obj_turn_end.current_popup : 0; var _pop_data = { - mission : "necron_tomb_excursion", - loc : name, - planet : planet, - estimate : 999, - number : _number, - mission_stage :1, - options : [ + mission: "necron_tomb_excursion", + loc: name, + planet: planet, + estimate: 999, + number: _number, + mission_stage: 1, + options: [ { - str1 : "Begin the Mission", - choice_func : necron_tomb_mission_start, + str1: "Begin the Mission", + choice_func: necron_tomb_mission_start, }, { - str1 : "Not Yet", - choice_func : instance_destroy, + str1: "Not Yet", + choice_func: instance_destroy, } - ] - } - scr_popup("Necron Tomb Excursion", tixt, $"necron_cave",_pop_data); - } + ], + }; + scr_popup("Necron Tomb Excursion", tixt, $"necron_cave", _pop_data); + } } - /// @mixin obj_popup -function necron_tomb_mission_start(){ +function necron_tomb_mission_start() { mission_star = star_by_name(pop_data.loc); planet = pop_data.planet; title = $"Necron Tunnels : {pop_data.mission_stage}"; replace_options( - [ + [ { - str1 : "Continue", - choice_func : necron_tomb_mission_sequence, - + str1: "Continue", + choice_func: necron_tomb_mission_sequence, }, { - str1 : "Return to the surface", - choice_func : instance_destroy, + str1: "Return to the surface", + choice_func: instance_destroy, } ] - ) + ); image = "necron_tunnels_1"; text = "Your marines enter the massive tunnel complex, following the energy readings. At first the walls are cramped and tiny, closing about them, but the tunnels widen at a rapid pace."; } -function necron_tomb_mission_sequence(){ +function necron_tomb_mission_sequence() { var battle; var player_forces = 0; var penalty = 0; - var roll = roll_dice_chapter(1, 100, "low"); + var roll = roll_dice_chapter(1, 100, "low"); battle = 0; instance_activate_all(); player_forces = mission_star.p_player[planet]; @@ -884,19 +852,18 @@ function necron_tomb_mission_sequence(){ instance_create(0, 0, obj_ncombat); _roster = new Roster(); var _pop_data = pop_data; - with (_roster){ + with (_roster) { roster_location = _pop_data.loc; roster_planet = _pop_data.planet; determine_full_roster(); only_locals(); update_roster(); - if (array_length(selected_units)){ + if (array_length(selected_units)) { setup_battle_formations(); add_to_battle(); - } + } } - delete _roster; - + delete _roster; mission_star = star_by_name(pop_data.loc); @@ -928,5 +895,5 @@ function necron_tomb_mission_sequence(){ instance_destroy(); } - exit; -} \ No newline at end of file + exit; +} diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index d10bb18cc6..fa76c450e9 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -1,411 +1,416 @@ enum P_features { - Sororitas_Cathedral, - Necron_Tomb, - Artifact, - STC_Fragment, - Ancient_Ruins, - Cave_Network, - Recruiting_World, - Monastery, - Warlord6, - OrkWarboss, - Warlord10, - Special_Force, - ChaosWarband, - Webway, - Secret_Base, - Starship, - Succession_War, - Mechanicus_Forge, - Reclamation_pools, - Capillary_Towers, - Daemonic_Incursion, - Victory_Shrine, - Arsenal, - Gene_Vault, - Forge, - Gene_Stealer_Cult, - Mission, - OrkStronghold - - }; - -enum base_types{ - Lair, + Sororitas_Cathedral, + Necron_Tomb, + Artifact, + STC_Fragment, + Ancient_Ruins, + Cave_Network, + Recruiting_World, + Monastery, + Warlord6, + OrkWarboss, + Warlord10, + Special_Force, + ChaosWarband, + Webway, + Secret_Base, + Starship, + Succession_War, + Mechanicus_Forge, + Reclamation_pools, + Capillary_Towers, + Daemonic_Incursion, + Victory_Shrine, + Arsenal, + Gene_Vault, + Forge, + Gene_Stealer_Cult, + Mission, + OrkStronghold, } -function PlayerForge() constructor{ - constructions = []; - size = 1; - techs_working = 0; - f_type = P_features.Forge; - vehicle_hanger=0; +enum base_types { + Lair, +} + +function PlayerForge() constructor { + constructions = []; + size = 1; + techs_working = 0; + f_type = P_features.Forge; + vehicle_hanger = 0; } // Function creates a new struct planet feature of a specified type -function NewPlanetFeature(feature_type, other_data={}) constructor{ - f_type = feature_type; - static reveal_to_player = function(){ - if (player_hidden == 1){ - player_hidden = 0; - } - } - switch(f_type){ - case P_features.Gene_Stealer_Cult: - PDF_control = 0; - sealed = 0; - player_hidden = 1; - planet_display = "Genestealer Cult"; - cult_age = 0; - hiding=true; - name = global.name_generator.generate_genestealer_cult_name(); - break; - case P_features.Necron_Tomb: - awake = 0; - sealed = 0; - player_hidden = 1 - planet_display = "Dormant Necron Tomb"; - break; - - case P_features.Secret_Base: - base_type = base_types.Lair; - inquis_hidden =1; - planet_display = "Hidden Secret Base"; - player_hidden = 0; - style = "UTL"; - if (struct_exists(other_data, "style")){ - style = other_data[$ "style"]; - } - built = obj_controller.turn +3; - forge = 0; - hippo=0; - beastarium=0; - torture=0; - narcotics=0; - relic=0; - cookery=0; - vox=0; - librarium=0; - throne=0; - stasis=0; - swimming=0; - stock=0; - break; - case P_features.Arsenal: - inquis_hidden = 1; - planet_display = "Arsenal"; - player_hidden = 0; - built = obj_controller.turn+3; - break; - case P_features.Gene_Vault: - inquis_hidden=1; - planet_display = "Arsenal"; - player_hidden = 0; - built = obj_controller.turn+3; - break; - case P_features.Starship: - f_type = P_features.Starship; - planet_display = "Ancient Starship"; - funds_spent = 0; - player_hidden = 0; - engineer_score = 0; - break; - case P_features.Ancient_Ruins: - static ruins_explored = scr_ruins_explored; - static explore = scr_explore_ruins; - static determine_race = scr_ruins_determine_race; - static recover_from_dead = scr_ruins_recover_from_dead; - static forces_defeated = scr_ruins_player_forces_defeated; - static find_starship = scr_ruins_find_starship; - static suprise_attack = scr_ruins_suprise_attack_player; - static ruins_combat_end=scr_ruins_combat_end; - scr_ancient_ruins_setup(); - break; - case P_features.STC_Fragment: - player_hidden = 1; - Fragment_type =0; - planet_display = "STC Fragment"; - break; - case P_features.Cave_Network: - player_hidden = 1; - cave_depth =irandom(3);//allow_multiple levels of caves, option to go deeper - planet_display = "Unexplored Cave Network"; - break; - case P_features.Sororitas_Cathedral: - player_hidden = 1; - planet_display = "Sororitas Cathedral"; - break; - case P_features.Artifact: - player_hidden = 1; - planet_display = "Artifact"; - break; - case P_features.OrkWarboss: - player_hidden = 1; - planet_display = "Ork Warboss"; - Warboss = "alive"; - name = global.name_generator.generate_ork_name(); - turns_static = 0; - break; - case P_features.OrkStronghold: - player_hidden = 1; - planet_display= "Ork Stronghold"; - tier = 1; - break; - case P_features.Monastery: - planet_display="Fortress Monastary"; - player_hidden = 0; - forge=0; - name=global.name_generator.generate_imperial_ship_name(); - break; - case P_features.Recruiting_World: - planet_display="Recruitment"; - player_hidden = 0; - recruit_type = 0; - recruit_cost = 0; - break; - case P_features.ChaosWarband: - if !(struct_exists(other_data, "patron")){ - patron = choose("slaanesh", "tzeentch", "khorne", "nurgle", "undivided"); - } else { - self.patron = other_data.patron; - } - default: - player_hidden = 1; - planet_display = 0; - } - if (global.cheat_debug){ - player_hidden = 0; - } - static load_json_data = function(data){ - var names = variable_struct_get_names(data); - for (var i = 0; i < array_length(names); i++) { - variable_struct_set(self, names[i], variable_struct_get(data, names[i])) +function NewPlanetFeature(feature_type, other_data = {}) constructor { + f_type = feature_type; + + static reveal_to_player = function() { + if (player_hidden == 1) { + player_hidden = 0; } - } -} -function move_feature_to_fleet(planet, feature_slot, fleet, cargo_key){ - var _feat = p_feature[planet][feature_slot]; - array_delete(p_feature[planet], feature_slot, 1); - fleet.cargo_data[$ cargo_key] = _feat; + }; + + switch (f_type) { + case P_features.Gene_Stealer_Cult: + PDF_control = 0; + sealed = 0; + player_hidden = 1; + planet_display = "Genestealer Cult"; + cult_age = 0; + hiding = true; + name = global.name_generator.generate_genestealer_cult_name(); + break; + case P_features.Necron_Tomb: + awake = 0; + sealed = 0; + player_hidden = 1; + planet_display = "Dormant Necron Tomb"; + break; + + case P_features.Secret_Base: + base_type = base_types.Lair; + inquis_hidden = 1; + planet_display = "Hidden Secret Base"; + player_hidden = 0; + style = "UTL"; + if (struct_exists(other_data, "style")) { + style = other_data[$ "style"]; + } + built = obj_controller.turn + 3; + forge = 0; + hippo = 0; + beastarium = 0; + torture = 0; + narcotics = 0; + relic = 0; + cookery = 0; + vox = 0; + librarium = 0; + throne = 0; + stasis = 0; + swimming = 0; + stock = 0; + break; + case P_features.Arsenal: + inquis_hidden = 1; + planet_display = "Arsenal"; + player_hidden = 0; + built = obj_controller.turn + 3; + break; + case P_features.Gene_Vault: + inquis_hidden = 1; + planet_display = "Arsenal"; + player_hidden = 0; + built = obj_controller.turn + 3; + break; + case P_features.Starship: + f_type = P_features.Starship; + planet_display = "Ancient Starship"; + funds_spent = 0; + player_hidden = 0; + engineer_score = 0; + break; + case P_features.Ancient_Ruins: + static ruins_explored = scr_ruins_explored; + static explore = scr_explore_ruins; + static determine_race = scr_ruins_determine_race; + static recover_from_dead = scr_ruins_recover_from_dead; + static forces_defeated = scr_ruins_player_forces_defeated; + static find_starship = scr_ruins_find_starship; + static suprise_attack = scr_ruins_suprise_attack_player; + static ruins_combat_end = scr_ruins_combat_end; + scr_ancient_ruins_setup(); + break; + case P_features.STC_Fragment: + player_hidden = 1; + Fragment_type = 0; + planet_display = "STC Fragment"; + break; + case P_features.Cave_Network: + player_hidden = 1; + cave_depth = irandom(3); //allow_multiple levels of caves, option to go deeper + planet_display = "Unexplored Cave Network"; + break; + case P_features.Sororitas_Cathedral: + player_hidden = 1; + planet_display = "Sororitas Cathedral"; + break; + case P_features.Artifact: + player_hidden = 1; + planet_display = "Artifact"; + break; + case P_features.OrkWarboss: + player_hidden = 1; + planet_display = "Ork Warboss"; + Warboss = "alive"; + name = global.name_generator.generate_ork_name(); + turns_static = 0; + break; + case P_features.OrkStronghold: + player_hidden = 1; + planet_display = "Ork Stronghold"; + tier = 1; + break; + case P_features.Monastery: + planet_display = "Fortress Monastary"; + player_hidden = 0; + forge = 0; + name = global.name_generator.generate_imperial_ship_name(); + break; + case P_features.Recruiting_World: + planet_display = "Recruitment"; + player_hidden = 0; + recruit_type = 0; + recruit_cost = 0; + break; + case P_features.ChaosWarband: + if (!struct_exists(other_data, "patron")) { + patron = choose("slaanesh", "tzeentch", "khorne", "nurgle", "undivided"); + } else { + self.patron = other_data.patron; + } + default: + player_hidden = 1; + planet_display = 0; + } + if (global.cheat_debug) { + player_hidden = 0; + } + + static load_json_data = function(data) { + var names = variable_struct_get_names(data); + for (var i = 0; i < array_length(names); i++) { + variable_struct_set(self, names[i], variable_struct_get(data, names[i])); + } + }; } -function move_feature_to_planet(cargo_key, star, planet){ - +function move_feature_to_fleet(planet, feature_slot, fleet, cargo_key) { + var _feat = p_feature[planet][feature_slot]; + array_delete(p_feature[planet], feature_slot, 1); + fleet.cargo_data[$ cargo_key] = _feat; } + +function move_feature_to_planet(cargo_key, star, planet) {} + // returns an array of all the positions that a certain planet feature occurs on th p_feature array of a planet // this works for both planet_Features and planet upgrades -function search_planet_features(planet, search_feature){ - var feature_count = array_length(planet); - var feature_positions = []; - if (feature_count > 0){ - for (var fc = 0; fc < feature_count; fc++){ - if (planet[fc].f_type == search_feature){ - array_push(feature_positions, fc); - } - } - } - return feature_positions; +function search_planet_features(planet, search_feature) { + var feature_count = array_length(planet); + var feature_positions = []; + if (feature_count > 0) { + for (var fc = 0; fc < feature_count; fc++) { + if (planet[fc].f_type == search_feature) { + array_push(feature_positions, fc); + } + } + } + return feature_positions; } -function return_planet_features(planet, search_feature){ - var feature_count = array_length(planet); - var feature_positions = []; - if (feature_count > 0){ - for (var fc = 0; fc < feature_count; fc++){ - if (planet[fc].f_type == search_feature){ - array_push(feature_positions, planet[fc]); - } - } - } - return feature_positions; +function return_planet_features(planet, search_feature) { + var feature_count = array_length(planet); + var feature_positions = []; + if (feature_count > 0) { + for (var fc = 0; fc < feature_count; fc++) { + if (planet[fc].f_type == search_feature) { + array_push(feature_positions, planet[fc]); + } + } + } + return feature_positions; } - // returns 1 if dearch feature is on at least one planet in system returns 0 is search feature is not found in system -function system_feature_bool(system, search_feature){ - var sys_bool = 0; - for (var sys =1; sys<5; sys++){ - sys_bool = planet_feature_bool(system[sys], search_feature) - if (sys_bool==1){ - break;} - } - return sys_bool; +function system_feature_bool(system, search_feature) { + var sys_bool = 0; + for (var sys = 1; sys < 5; sys++) { + sys_bool = planet_feature_bool(system[sys], search_feature); + if (sys_bool == 1) { + break; + } + } + return sys_bool; } - //returns 1 if feature found on given planet returns 0 if feature not found on planet -function planet_feature_bool(planet, search_feature){ - var feature_count = array_length(planet); - var feature_exists = 0; - if (feature_count > 0){ - for (var fc = 0; fc < feature_count; fc++){ - if (!is_array(search_feature)){ - if (planet[fc].f_type == search_feature){ - feature_exists = 1; - } - } else { - feature_exists = array_contains(search_feature,planet[fc].f_type); - } - if (feature_exists == 1){break;} - }} - return feature_exists; +function planet_feature_bool(planet, search_feature) { + var feature_count = array_length(planet); + var feature_exists = 0; + if (feature_count > 0) { + for (var fc = 0; fc < feature_count; fc++) { + if (!is_array(search_feature)) { + if (planet[fc].f_type == search_feature) { + feature_exists = 1; + } + } else { + feature_exists = array_contains(search_feature, planet[fc].f_type); + } + if (feature_exists == 1) { + break; + } + } + } + return feature_exists; } - //deletes all occurances of del_feature on planet -function delete_features(planet, del_feature){ - var delete_Array = search_planet_features(planet, del_feature); - if (array_length(delete_Array) >0){ - for (var d=0;d 0) { + for (var d = 0; d < array_length(delete_Array); d++) { + array_delete(planet, delete_Array[d], 1); + } + } } - // returns 1 if an awake necron tomb iin system -function awake_necron_star(star){ - for(var i = 1; i <= star.planets; i++){ - if(awake_tomb_world(star.p_feature[i]) == 1) - { - return i; - } - } - return 0 +function awake_necron_star(star) { + for (var i = 1; i <= star.planets; i++) { + if (awake_tomb_world(star.p_feature[i]) == 1) { + return i; + } + } + return 0; } - //returns 1 if awake tomb world on planet 0 if tombs on planet but not awake and 2 if no tombs on planet -function awake_tomb_world(planet){ - var awake_tomb = 0; - var tombs = search_planet_features(planet, P_features.Necron_Tomb); - if (array_length(tombs)>0){ - for (var tomb =0;tomb 0) { + for (var tomb = 0; tomb < array_length(tombs); tomb++) { + if (planet[tombs[tomb]].awake == 1) { + awake_tomb = 1; + } + if (awake_tomb == 1) { + break; + } + } + return awake_tomb; + } + return 2; } - //selas a tomb world and switche off awake so will no longer spawn necrons or necron fleets -function seal_tomb_world(planet){ - var awake_tomb = 0; - var tombs = search_planet_features(planet, P_features.Necron_Tomb); - if (array_length(tombs)>0){ - for (var tomb =0;tomb 0) { + for (var tomb = 0; tomb < array_length(tombs); tomb++) { + awake_tomb = 1; + planet[tombs[tomb]].awake = 0; + planet[tombs[tomb]].sealed = 1; + planet[tombs[tomb]].planet_display = "Sealed Necron Tomb"; + if (awake_tomb == 1) { + break; + } + } + } } - //awakens a tomb world so necrons and necron fleets will spawn -function awaken_tomb_world(planet){ - var awake_tomb = 0; - var tombs = search_planet_features(planet, P_features.Necron_Tomb); - if (array_length(tombs)>0){ - for (var tomb =0;tomb 0) { + for (var tomb = 0; tomb < array_length(tombs); tomb++) { + if (planet[tombs[tomb]].awake == 0) { + awake_tomb = 1; + planet[tombs[tomb]].awake = 1; + planet[tombs[tomb]].planet_display = "Active Necron Tomb"; + } + if (awake_tomb == 1) { + break; + } + } + } } - // creates alerts for discovering features on a planet function scr_planetary_feature(planet_num) { - var plan_feat_count = array_length(p_feature[planet_num]); - //need to iterate over features instead of just looking at first - for (var f= 0; f < plan_feat_count;f++){ - var feat = p_feature[planet_num][f]; - if (feat.player_hidden ==1){ - feat.player_hidden =0; - var numeral_n = planet_numeral_name(planet_num); - switch (feat.f_type){ - case P_features.Sororitas_Cathedral: - if (obj_controller.known[eFACTION.Ecclesiarchy]=0) then obj_controller.known[eFACTION.Ecclesiarchy]=1; - var lop=$"Sororitas Cathedral discovered on {numeral_n}."; - scr_alert("green","feature",lop,x,y); - scr_event_log("",lop); - if (p_heresy[planet_num]>10) then p_heresy[planet_num]-=10; - p_sisters[planet_num]=choose(2,2,3);goo=1; - break; - case P_features.Necron_Tomb: - var lop=$"Necron Tomb discovered on {numeral_n}."; - scr_alert("red","feature",lop,x,y); - scr_event_log("red",lop); - break; - case P_features.Artifact: - var lop=$"Artifact discovered on {numeral_n}."; - scr_alert("green","feature",lop,x,y); - scr_event_log("",lop); - break; - case P_features.STC_Fragment: - var lop=$"STC Fragment located on {numeral_n}."; - scr_alert("green","feature",lop,x,y); - scr_event_log("",lop); - break; - case P_features.Ancient_Ruins: - var lop=$"A {feat.ruins_size} Ancient Ruins discovered on {string(name)} {scr_roman(planet_num)}."; - scr_alert("green","feature",lop,x,y); - scr_event_log("",lop); - break; - case P_features.Cave_Network: - var lop=$"Extensive Cave Network discovered on {numeral_n}."; - scr_alert("green","feature",lop,x,y); - scr_event_log("",lop); - break; - case P_features.OrkWarboss: - var lop=$"Ork Warboss discovered on {numeral_n}."; - scr_alert("red","feature",lop,x,y); - scr_event_log("red",lop); - break; - } - } - } + var plan_feat_count = array_length(p_feature[planet_num]); + //need to iterate over features instead of just looking at first + for (var f = 0; f < plan_feat_count; f++) { + var feat = p_feature[planet_num][f]; + if (feat.player_hidden == 1) { + feat.player_hidden = 0; + var numeral_n = planet_numeral_name(planet_num); + switch (feat.f_type) { + case P_features.Sororitas_Cathedral: + if (obj_controller.known[eFACTION.Ecclesiarchy] == 0) { + obj_controller.known[eFACTION.Ecclesiarchy] = 1; + } + var lop = $"Sororitas Cathedral discovered on {numeral_n}."; + scr_alert("green", "feature", lop, x, y); + scr_event_log("", lop); + if (p_heresy[planet_num] > 10) { + p_heresy[planet_num] -= 10; + } + p_sisters[planet_num] = choose(2, 2, 3); + goo = 1; + break; + case P_features.Necron_Tomb: + var lop = $"Necron Tomb discovered on {numeral_n}."; + scr_alert("red", "feature", lop, x, y); + scr_event_log("red", lop); + break; + case P_features.Artifact: + var lop = $"Artifact discovered on {numeral_n}."; + scr_alert("green", "feature", lop, x, y); + scr_event_log("", lop); + break; + case P_features.STC_Fragment: + var lop = $"STC Fragment located on {numeral_n}."; + scr_alert("green", "feature", lop, x, y); + scr_event_log("", lop); + break; + case P_features.Ancient_Ruins: + var lop = $"A {feat.ruins_size} Ancient Ruins discovered on {string(name)} {scr_roman(planet_num)}."; + scr_alert("green", "feature", lop, x, y); + scr_event_log("", lop); + break; + case P_features.Cave_Network: + var lop = $"Extensive Cave Network discovered on {numeral_n}."; + scr_alert("green", "feature", lop, x, y); + scr_event_log("", lop); + break; + case P_features.OrkWarboss: + var lop = $"Ork Warboss discovered on {numeral_n}."; + scr_alert("red", "feature", lop, x, y); + scr_event_log("red", lop); + break; + } + } + } } -function create_starship_event(){ - var star = scr_random_find(2,true,"",""); - if(star == undefined){ - log_error("RE: couldn't find starship target"); - return false; - }else { - var planet=irandom(star.planets-1)+1; - array_push(star.p_feature[planet], new NewPlanetFeature(P_features.Starship)) - scr_event_log("","Ancient Starship discovered on "+string(star.name)+" "+scr_roman(planet)+".", star.name); - } +function create_starship_event() { + var star = scr_random_find(2, true, "", ""); + if (star == undefined) { + log_error("RE: couldn't find starship target"); + return false; + } else { + var planet = irandom(star.planets - 1) + 1; + array_push(star.p_feature[planet], new NewPlanetFeature(P_features.Starship)); + scr_event_log("", "Ancient Starship discovered on " + string(star.name) + " " + scr_roman(planet) + ".", star.name); + } } - - -function ground_mission_leave_it_function(){ - // Not worth it, mang - obj_controller.menu = 0; - obj_controller.managing = 0; - obj_controller.cooldown = 10; - with (obj_ground_mission) { - instance_destroy(); - } - instance_destroy(); +function ground_mission_leave_it_function() { + // Not worth it, mang + obj_controller.menu = 0; + obj_controller.managing = 0; + obj_controller.cooldown = 10; + with (obj_ground_mission) { + instance_destroy(); + } + instance_destroy(); } /// @mixin PlanetData -function discover_artifact_popup(feature){ +function discover_artifact_popup(feature) { obj_controller.menu = eMENU.Default; /*if ((planet_type == "Dead" || current_owner == eFACTION.Player)) { alarm[4] = 1; @@ -425,158 +430,171 @@ function discover_artifact_popup(feature){ } var _take_arti = { - str1 : "Swiftly take the Artifact", - choice_func : ground_forces_collect_artifact - } + str1: "Swiftly take the Artifact", + choice_func: ground_forces_collect_artifact, + }; if ((current_owner >= eFACTION.Tyranids) || ((current_owner == eFACTION.Ork) && (pdf <= 0))) { - pop.add_option([{ - str1 : "Let it be", - choice_func : ground_mission_leave_it_function, - }, _take_arti]); + pop.add_option( + [ + { + str1: "Let it be", + choice_func: ground_mission_leave_it_function, + }, + _take_arti + ] + ); } else { - var _opt1 = "Request audience with the "; - switch (current_owner) { - case eFACTION.Player: - case eFACTION.Imperium: - _opt1 += "Planetary Governor"; - pop.add_option({ - str1: "Gift the Artifact to the Sector Commander.", - choice_func : function(){ - gift_artifact(eFACTION.Imperium, false); - instance_destroy(); - }, - }); - break; - case eFACTION.Mechanicus: - _opt1 += "Mechanicus"; - pop.add_option({str1 : "Let it be. The Mechanicus' wrath is not lightly provoked.", choice_func : ground_mission_leave_it_function,}); - break; - case eFACTION.Inquisition: - _opt1 += "Inquisition"; - pop.add_option({choice_func : ground_mission_leave_it_function, str1 : "Let it be. The Inquisition's wrath is not lightly provoked."}); - break; - case eFACTION.Ecclesiarchy: - _opt1 += "Ecclesiarchy"; - pop.add_option({ - str1 : "Gift the Artifact to the Ecclesiarchy.", - choice_func : function(){ - gift_artifact(eFACTION.Ecclesiarchy, false); - instance_destroy(); - }, - }); - break; - case eFACTION.Eldar: - _opt1 += "Eldar"; - pop.add_option({ - str1 : "Gift the Artifact to the Eldar.", - choice_func : function(){ - gift_artifact(eFACTION.Eldar, false); - instance_destroy(); - }, - }); - break; - case eFACTION.Tau: - _opt1 += "Tau"; - pop.add_option({ - str1 : "Gift the Artifact to the Tau Empire.", - choice_func : function(){ - gift_artifact(eFACTION.Tau, false); - instance_destroy(); - }, - }); - break; - } + var _opt1 = "Request audience with the "; + switch (current_owner) { + case eFACTION.Player: + case eFACTION.Imperium: + _opt1 += "Planetary Governor"; + pop.add_option({ + str1: "Gift the Artifact to the Sector Commander.", + choice_func: function() { + gift_artifact(eFACTION.Imperium, false); + instance_destroy(); + }, + }); + break; + case eFACTION.Mechanicus: + _opt1 += "Mechanicus"; + pop.add_option({ + str1: "Let it be. The Mechanicus' wrath is not lightly provoked.", + choice_func: ground_mission_leave_it_function, + }); + break; + case eFACTION.Inquisition: + _opt1 += "Inquisition"; + pop.add_option({ + choice_func: ground_mission_leave_it_function, + str1: "Let it be. The Inquisition's wrath is not lightly provoked.", + }); + break; + case eFACTION.Ecclesiarchy: + _opt1 += "Ecclesiarchy"; + pop.add_option({ + str1: "Gift the Artifact to the Ecclesiarchy.", + choice_func: function() { + gift_artifact(eFACTION.Ecclesiarchy, false); + instance_destroy(); + }, + }); + break; + case eFACTION.Eldar: + _opt1 += "Eldar"; + pop.add_option({ + str1: "Gift the Artifact to the Eldar.", + choice_func: function() { + gift_artifact(eFACTION.Eldar, false); + instance_destroy(); + }, + }); + break; + case eFACTION.Tau: + _opt1 += "Tau"; + pop.add_option({ + str1: "Gift the Artifact to the Tau Empire.", + choice_func: function() { + gift_artifact(eFACTION.Tau, false); + instance_destroy(); + }, + }); + break; + } _opt1 += " regarding the Artifact."; - pop.add_option([ - { - str1 : _opt1, - choice_func : governor_negotiate_artifact - }, - _take_arti - ]); - } + pop.add_option( + [ + { + str1: _opt1, + choice_func: governor_negotiate_artifact, + }, + _take_arti + ] + ); + } } /// @mixin obj_star_select -function planet_selection_action(){ - var xx=__view_get( e__VW.XView, 0 )+0; - var yy=__view_get( e__VW.YView, 0 )+0; - if (instance_exists(target)){ - if (loading){ - obj_controller.selecting_planet = 0; - } - for (var i = 0;i 0) { pop.text = $"{_text}. The present Tech Priests stress they will not condone a mission to steal the STC Fragment."; } else if (techies > 0) { pop.text = $"{_text}. Taking it may be seen as an act of war. What is thy will?"; - pop.add_option({str1 : "Attempt to steal the STC Fragment.", choice_func:remove_stc_from_planet}); // TODO: Fix this option, as it crashes the game when the battle starts); + pop.add_option({ + str1: "Attempt to steal the STC Fragment.", + choice_func: remove_stc_from_planet, + }); // TODO: Fix this option, as it crashes the game when the battle starts); } else { pop.text = $"{_text}. Taking it may be seen as an act of war. The ground team has no Techmarines, so you have no choice but to leave it be."; } } else { - - var _text = $"An STC Fragment appears to be located upon {name()}" - if (techies > 0){ - array_push(options, {str1 : "Swiftly take the STC Fragment.", choice_func:remove_stc_from_planet}); - if (mechanicus_reps == 0){ - pop.text = $"{_text}; what it might contain is unknown. Your {obj_ini.role[100][16]}s wish to reclaim, identify, and put it to use immediately. What is thy will?"; - } else { - pop.text = $"{_text}. Your {obj_ini.role[100][16]}s wish to reclaim, identify, and put it to use immediately, and the Tech Priests wish to send it to the closest forge world. What is thy will?"; - } - } else if (mechanicus_reps > 0){ - pop.text = $"{_text}; what it might contain is unknown. The present Tech Priests wish to send it to Mars, and refuse to take the device off-world otherwise."; - } else{ - pop.text = $"{_text}; what it might contain is unknown. The ground team has no {obj_ini.role[100][16]}s or Tech Priests, so you have no choice but to leave it be or notify the Mechanicus about its location."; + var _text = $"An STC Fragment appears to be located upon {name()}"; + if (techies > 0) { + array_push(options, { + str1: "Swiftly take the STC Fragment.", + choice_func: remove_stc_from_planet, + }); + if (mechanicus_reps == 0) { + pop.text = $"{_text}; what it might contain is unknown. Your {obj_ini.role[100][16]}s wish to reclaim, identify, and put it to use immediately. What is thy will?"; + } else { + pop.text = $"{_text}. Your {obj_ini.role[100][16]}s wish to reclaim, identify, and put it to use immediately, and the Tech Priests wish to send it to the closest forge world. What is thy will?"; + } + } else if (mechanicus_reps > 0) { + pop.text = $"{_text}; what it might contain is unknown. The present Tech Priests wish to send it to Mars, and refuse to take the device off-world otherwise."; + } else { + pop.text = $"{_text}; what it might contain is unknown. The ground team has no {obj_ini.role[100][16]}s or Tech Priests, so you have no choice but to leave it be or notify the Mechanicus about its location."; } - array_push(options, {str1 : "Send it to the Adeptus Mechanicuss.", choice_func : send_stc_to_adeptus_mech}); + array_push(options, { + str1: "Send it to the Adeptus Mechanicuss.", + choice_func: send_stc_to_adeptus_mech, + }); } - array_push(options,{str1: "Leave it.", - choice_func : ground_mission_leave_it_function + array_push(options, { + str1: "Leave it.", + choice_func: ground_mission_leave_it_function, }); pop.add_option(options); } /// @mixin PlanetData -function check_for_artifact_grab_mission(){ - - if (has_feature(P_features.Artifact)){ - - var artifact=instance_create(system.x,system.y,obj_ground_mission);// Unloading / artifact crap - artifact.num=planet; - artifact.loc=obj_controller.selecting_location; - artifact.managing=obj_controller.managing; +function check_for_artifact_grab_mission() { + if (has_feature(P_features.Artifact)) { + var artifact = instance_create(system.x, system.y, obj_ground_mission); // Unloading / artifact crap + artifact.num = planet; + artifact.loc = obj_controller.selecting_location; + artifact.managing = obj_controller.managing; artifact.pdata = self; - with (artifact){ + with (artifact) { setup_planet_mission_group(); } discover_artifact_popup(get_features(P_features.Artifact)[0]); } } +/// @mixin obj_ground_mission +function ground_forces_collect_artifact() { + with (obj_ground_mission) { + scr_return_ship(pdata.system.name, self, pdata.planet); + var man_size, ship_id, comp, i; + i = 0; + ship_id = 0; + man_size = 0; + comp = 0; + ship_id = get_valid_player_ship("", loc); + var last_artifact = scr_add_artifact("random", "random", 4, loc, ship_id + 500); -/// @mixin obj_ground_mission -function ground_forces_collect_artifact(){ - with (obj_ground_mission){ - scr_return_ship(pdata.system.name,self,pdata.planet); + var i = 0; - var man_size,ship_id,comp,i; - i=0;ship_id=0;man_size=0;comp=0; - ship_id = get_valid_player_ship("", loc); + var mission = "bad"; + var mission_roll = irandom(100) + 1; + if (scr_has_adv("Ambushers")) { + mission_roll -= 15; + } + if (mission_roll <= 60) { + mission = "good"; + } // 135 + if (pdata.planet_type == "Dead") { + mission = "good"; + } + // mission="bad"; - var last_artifact = scr_add_artifact("random","random",4,loc,ship_id+500); + var pop; + pop = instance_create(0, 0, obj_popup); + pop.image = "artifact_recovered"; + pop.title = "Artifact Recovered!"; - var i=0; + if (mission == "good") { + pop.text = $"Your marines quickly converge upon the Artifact and remove it, before local forces have any idea of what is happening.##"; + pop.text += $"It has been stowed away upon {loc}. It appears to be a {obj_ini.artifact[last_artifact]} but should be brought home and identified posthaste."; + scr_event_log("", "Artifact has been forcibly recovered."); + if (pdata.planet_type != "Dead") { + if (pdata.current_owner == 2) { + obj_controller.disposition[2] -= 1; + } + if (pdata.current_owner == eFACTION.Mechanicus) { + obj_controller.disposition[3] -= 10; + } // max(obj_controller.disposition/4,10) + if (pdata.current_owner == 4) { + obj_controller.disposition[4] -= max(obj_controller.disposition[4] / 4, 10); + } + if (pdata.current_owner == 5) { + obj_controller.disposition[5] -= 3; + } + if (pdata.current_owner == 8) { + obj_controller.disposition[8] -= 3; + } + } + } + if (mission == "bad") { + pop.text = "Your marines converge upon the Artifact; resistance is light and easily dealt with. After a brief firefight the Artifact is retrieved.##"; + pop.text += $"It has been stowed away upon {loc}. It appears to be a " + string(obj_ini.artifact[last_artifact]) + " but should be brought home and identified posthaste."; + scr_event_log("red", "Artifact forcibly recovered. Collateral damage is caused."); - var mission="bad"; - var mission_roll=irandom(100)+1; - if (scr_has_adv("Ambushers")) then mission_roll-=15; - if (mission_roll<=60) then mission="good";// 135 - if (pdata.planet_type="Dead") then mission="good"; - // mission="bad"; + if (pdata.current_owner == 2) { + obj_controller.disposition[2] -= 2; + } + if (pdata.current_owner == eFACTION.Mechanicus) { + obj_controller.disposition[3] -= max(obj_controller.disposition[3] / 3, 20); + } + if (pdata.current_owner == 4) { + obj_controller.disposition[4] -= max(obj_controller.disposition[4] / 3, 20); + } + if (pdata.current_owner == 5) { + obj_controller.disposition[5] -= max(obj_controller.disposition[3] / 4, 15); + } + if (pdata.current_owner == 6) { + obj_controller.disposition[6] -= 15; + } + if (pdata.current_owner == 8) { + obj_controller.disposition[8] -= 8; + } - var pop; - pop=instance_create(0,0,obj_popup); - pop.image="artifact_recovered"; - pop.title="Artifact Recovered!"; + if (pdata.current_owner >= 3 && pdata.current_owner <= 6) { + scr_audience(pdata.current_owner, "artifact_angry",); + } + } - if (mission="good"){ - pop.text=$"Your marines quickly converge upon the Artifact and remove it, before local forces have any idea of what is happening.##"; - pop.text+=$"It has been stowed away upon {loc}. It appears to be a {obj_ini.artifact[last_artifact]} but should be brought home and identified posthaste."; - scr_event_log("","Artifact has been forcibly recovered."); - - if (pdata.planet_type!="Dead"){ - if (pdata.current_owner=2) then obj_controller.disposition[2]-=1; - if (pdata.current_owner=eFACTION.Mechanicus) then obj_controller.disposition[3]-=10;// max(obj_controller.disposition/4,10) - if (pdata.current_owner=4) then obj_controller.disposition[4]-=max(obj_controller.disposition[4]/4,10); - if (pdata.current_owner=5) then obj_controller.disposition[5]-=3; - if (pdata.current_owner=8) then obj_controller.disposition[8]-=3; - } - } - if (mission="bad"){ - pop.text="Your marines converge upon the Artifact; resistance is light and easily dealt with. After a brief firefight the Artifact is retrieved.##"; - pop.text+=$"It has been stowed away upon {loc}. It appears to be a "+string(obj_ini.artifact[last_artifact])+" but should be brought home and identified posthaste."; - scr_event_log("red","Artifact forcibly recovered. Collateral damage is caused."); - - if (pdata.current_owner=2) then obj_controller.disposition[2]-=2; - if (pdata.current_owner=eFACTION.Mechanicus) then obj_controller.disposition[3]-=max(obj_controller.disposition[3]/3,20); - if (pdata.current_owner=4) then obj_controller.disposition[4]-=max(obj_controller.disposition[4]/3,20); - if (pdata.current_owner=5) then obj_controller.disposition[5]-=max(obj_controller.disposition[3]/4,15); - if (pdata.current_owner=6) then obj_controller.disposition[6]-=15; - if (pdata.current_owner=8) then obj_controller.disposition[8]-=8; - - if (pdata.current_owner>=3 && pdata.current_owner<=6){ - scr_audience(pdata.current_owner, "artifact_angry",); - } - } - - - if (scr_has_adv("Tech-Scavengers")){ - - var ex1="",ex1_num=0,ex2="",ex2_num=0,ex3="",ex3_num=0; - - var stah=instance_nearest(x,y,obj_star); - - if (pdata.origional_owner==2){ - ex1="Meltagun"; - ex1_num=choose(2,3,4); - ex2="Flamer"; - ex2_num=choose(2,3,4); - ex3=choose("Power Fist","Chainsword","Bolt Pistol"); - ex3_num=choose(2,3,4,5); - } - if (pdata.origional_owner==3){ - ex1="Plasma Pistol"; - ex1_num=choose(1,2); - ex2="Power Armour"; - ex2_num=choose(2,3,4); - ex3=choose("Servo-arm","Bionics"); - ex3_num=choose(2,3,4); - } - if (pdata.origional_owner==5){ - ex1="Flamer"; - ex1_num=choose(3,4,5,6); - ex2="Heavy Flamer"; - ex2_num=choose(1,2,3); - ex3=choose("Chainsword","Bolt Pistol"); - ex3_num=choose(2,3,4,5); - } - - if (ex1!=""){ - pop.text+="##While they're at it your Battle Brothers also find "; - if (ex1_num>0){ - pop.text+=string(ex1_num)+" "+string(ex1); - } - if (ex2_num>0){ - pop.text+=", "+string(ex2_num)+" "+string(ex2); - } - if (ex3_num>0){ - pop.text+=", and "+string(ex3_num)+" "+string(ex3); - } - pop.text+="."; - scr_add_item(ex1,ex1_num); - scr_add_item(ex2,ex2_num); - scr_add_item(ex3,ex3_num); - } - } - - - with(obj_star_select){instance_destroy();} - with(obj_fleet_select){instance_destroy();} - pdata.delete_feature(P_features.Artifact) - - corrupt_artifact_collectors(last_artifact); - - obj_controller.trading_artifact=0; - clear_diplo_choices(); - obj_controller.menu=0; - instance_destroy(); - } -} + if (scr_has_adv("Tech-Scavengers")) { + var ex1 = "", ex1_num = 0, ex2 = "", ex2_num = 0, ex3 = "", ex3_num = 0; -function governor_negotiate_artifact(){ - with (obj_ground_mission){ - if (pdata.current_owner == 2){ - scr_return_ship(pdata.system.name,self,pdata.planet); - - var i=0; - var ship_id = get_valid_player_ship("", loc); - - i=0; - plan=instance_nearest(x,y,obj_star); - var last_artifact = scr_add_artifact("random","random",4,pdata.system.name,ship_id+500); - - obj_popup.image="artifact_recovered"; - obj_popup.title="Artifact Recovered!"; - obj_popup.text=$"The Planetary Governor hands over the Artifact without asking for compensation.##It has been safely stowed away upon {loc}. It appears to be a {obj_ini.artifact[last_artifact]} but should be brought home and identified posthaste."; - with(obj_star_select){instance_destroy();} - with(obj_fleet_select){instance_destroy();} - pdata.delete_feature(P_features.Artifact); - with(obj_popup){ - reset_popup_options(); - } - scr_event_log("","Planetary Governor hands over Artifact."); - - corrupt_artifact_collectors(last_artifact); - - obj_controller.trading_artifact=0; - instance_destroy(); - } else { - scr_toggle_diplomacy(); - obj_controller.cooldown = 10; - obj_controller.diplomacy = pdata.current_owner; - obj_controller.trading_artifact = 1; - with (obj_controller) { - scr_dialogue("artifact"); - } - instance_destroy(); - instance_destroy(obj_popup); - } - } + var stah = instance_nearest(x, y, obj_star); + if (pdata.origional_owner == 2) { + ex1 = "Meltagun"; + ex1_num = choose(2, 3, 4); + ex2 = "Flamer"; + ex2_num = choose(2, 3, 4); + ex3 = choose("Power Fist", "Chainsword", "Bolt Pistol"); + ex3_num = choose(2, 3, 4, 5); + } + if (pdata.origional_owner == 3) { + ex1 = "Plasma Pistol"; + ex1_num = choose(1, 2); + ex2 = "Power Armour"; + ex2_num = choose(2, 3, 4); + ex3 = choose("Servo-arm", "Bionics"); + ex3_num = choose(2, 3, 4); + } + if (pdata.origional_owner == 5) { + ex1 = "Flamer"; + ex1_num = choose(3, 4, 5, 6); + ex2 = "Heavy Flamer"; + ex2_num = choose(1, 2, 3); + ex3 = choose("Chainsword", "Bolt Pistol"); + ex3_num = choose(2, 3, 4, 5); + } + + if (ex1 != "") { + pop.text += "##While they're at it your Battle Brothers also find "; + if (ex1_num > 0) { + pop.text += string(ex1_num) + " " + string(ex1); + } + if (ex2_num > 0) { + pop.text += ", " + string(ex2_num) + " " + string(ex2); + } + if (ex3_num > 0) { + pop.text += ", and " + string(ex3_num) + " " + string(ex3); + } + pop.text += "."; + scr_add_item(ex1, ex1_num); + scr_add_item(ex2, ex2_num); + scr_add_item(ex3, ex3_num); + } + } + + with (obj_star_select) { + instance_destroy(); + } + with (obj_fleet_select) { + instance_destroy(); + } + pdata.delete_feature(P_features.Artifact); + + corrupt_artifact_collectors(last_artifact); + + obj_controller.trading_artifact = 0; + clear_diplo_choices(); + obj_controller.menu = 0; + instance_destroy(); + } } +function governor_negotiate_artifact() { + with (obj_ground_mission) { + if (pdata.current_owner == 2) { + scr_return_ship(pdata.system.name, self, pdata.planet); + + var i = 0; + var ship_id = get_valid_player_ship("", loc); + + i = 0; + plan = instance_nearest(x, y, obj_star); + var last_artifact = scr_add_artifact("random", "random", 4, pdata.system.name, ship_id + 500); + + obj_popup.image = "artifact_recovered"; + obj_popup.title = "Artifact Recovered!"; + obj_popup.text = $"The Planetary Governor hands over the Artifact without asking for compensation.##It has been safely stowed away upon {loc}. It appears to be a {obj_ini.artifact[last_artifact]} but should be brought home and identified posthaste."; + with (obj_star_select) { + instance_destroy(); + } + with (obj_fleet_select) { + instance_destroy(); + } + pdata.delete_feature(P_features.Artifact); + with (obj_popup) { + reset_popup_options(); + } + scr_event_log("", "Planetary Governor hands over Artifact."); -function remove_stc_from_planet(){ - with (obj_ground_mission){ - var comp,plan,i;i=0;comp=0;plan=0; - plan=instance_nearest(x,y,obj_star); + corrupt_artifact_collectors(last_artifact); + + obj_controller.trading_artifact = 0; + instance_destroy(); + } else { + scr_toggle_diplomacy(); + obj_controller.cooldown = 10; + obj_controller.diplomacy = pdata.current_owner; + obj_controller.trading_artifact = 1; + with (obj_controller) { + scr_dialogue("artifact"); + } + instance_destroy(); + instance_destroy(obj_popup); + } + } +} - var mission,mission_roll; - - var mission="bad"; - var mission_roll=floor(random(100))+1; +function remove_stc_from_planet() { + with (obj_ground_mission) { + var comp, plan, i; + i = 0; + comp = 0; + plan = 0; + plan = instance_nearest(x, y, obj_star); + var mission, mission_roll; - if (scr_has_adv("Ambushers")) then mission_roll-=15; - if (pdata.current_owner=eFACTION.Mechanicus) then mission_roll+=20; - if (mission_roll<=60) then mission="good";// 135 - if (pdata.planet_type="Dead"){ - mission="good"; - } - // mission="bad"; + var mission = "bad"; + var mission_roll = floor(random(100)) + 1; - var pop; - pop=instance_create(0,0,obj_popup); - pop.image="artifact_recovered"; - pop.title="STC Recovered!"; + if (scr_has_adv("Ambushers")) { + mission_roll -= 15; + } + if (pdata.current_owner == eFACTION.Mechanicus) { + mission_roll += 20; + } + if (mission_roll <= 60) { + mission = "good"; + } // 135 + if (pdata.planet_type == "Dead") { + mission = "good"; + } + // mission="bad"; - if (pdata.origional_owner!=3 || pdata.planet_type!="Forge"){ - pop.text="Your forces descend beneath the surface of the planet, delving deep into an ancient tomb. Automated defenses and locks are breached.##"; - pop.text+="The STC Fragment has been safely stowed away, and is ready to be decrypted or gifted at your convenience."; - scr_return_ship(pdata.system.name,self,pdata.planet); - } + var pop; + pop = instance_create(0, 0, obj_popup); + pop.image = "artifact_recovered"; + pop.title = "STC Recovered!"; + if (pdata.origional_owner != 3 || pdata.planet_type != "Forge") { + pop.text = "Your forces descend beneath the surface of the planet, delving deep into an ancient tomb. Automated defenses and locks are breached.##"; + pop.text += "The STC Fragment has been safely stowed away, and is ready to be decrypted or gifted at your convenience."; + scr_return_ship(pdata.system.name, self, pdata.planet); + } + if (mission == "good" && pdata.origional_owner == 3 && pdata.planet_type == "Forge") { + pop.text = "Your forces descend into the vaults of the Mechanicus Forge, bypassing sentries, automated defenses, and blast doors on the way.##"; + pop.text += "The STC Fragment has been safely recovered and stowed away. It is ready to be decrypted or gifted at your convenience."; - if (mission == "good" && pdata.origional_owner == 3 && pdata.planet_type == "Forge"){ - pop.text="Your forces descend into the vaults of the Mechanicus Forge, bypassing sentries, automated defenses, and blast doors on the way.##"; - pop.text+="The STC Fragment has been safely recovered and stowed away. It is ready to be decrypted or gifted at your convenience."; - - /*if (pdata.planet_type!="Dead"){ + /*if (pdata.planet_type!="Dead"){ if (pdata.current_owner=2) then obj_controller.disposition[2]-=1; if (pdata.current_owner=eFACTION.Mechanicus) then obj_controller.disposition[3]-=10;// max(obj_controller.disposition/4,10) if (pdata.current_owner=4) then obj_controller.disposition[4]-=max(obj_controller.disposition[4]/4,10); if (pdata.current_owner=5) then obj_controller.disposition[5]-=3; if (pdata.current_owner=8) then obj_controller.disposition[8]-=3; }*/ - scr_return_ship(pdata.system.name,self,pdata.planet); - } - if (mission="bad" && pdata.origional_owner=eFACTION.Mechanicus && pdata.planet_type="Forge"){ - /*pop.text="Your marines converge upon the STC Fragment; resistance is light and easily dealt with. After a brief firefight it is retrieved.##"; + scr_return_ship(pdata.system.name, self, pdata.planet); + } + if (mission == "bad" && pdata.origional_owner == eFACTION.Mechanicus && pdata.planet_type == "Forge") { + /*pop.text="Your marines converge upon the STC Fragment; resistance is light and easily dealt with. After a brief firefight it is retrieved.##"; pop.text+="The fragment been safely stowed away, and is ready to be decrypted or gifted at your convenience."; */ - - pop.image="thallax"; - pop.text="Your forces descend into the vaults of the Mechanicus Forge. Sentries, automated defenses, and blast doors stand in their way.##"; - pop.text+="Half-way through the mission a small army of Praetorian Servitors and Skitarii bear down upon your men. The Mechanicus guards seem to be upset."; - - /*if (pdata.current_owner=2) then obj_controller.disposition[2]-=2;*/ - if (pdata.current_owner=eFACTION.Mechanicus){obj_controller.disposition[3]-=40;} - /*if (pdata.current_owner=4) then obj_controller.disposition[4]-=max(obj_controller.disposition[4]/3,20); + + pop.image = "thallax"; + pop.text = "Your forces descend into the vaults of the Mechanicus Forge. Sentries, automated defenses, and blast doors stand in their way.##"; + pop.text += "Half-way through the mission a small army of Praetorian Servitors and Skitarii bear down upon your men. The Mechanicus guards seem to be upset."; + + /*if (pdata.current_owner=2) then obj_controller.disposition[2]-=2;*/ + if (pdata.current_owner == eFACTION.Mechanicus) { + obj_controller.disposition[3] -= 40; + } + /*if (pdata.current_owner=4) then obj_controller.disposition[4]-=max(obj_controller.disposition[4]/3,20); if (pdata.current_owner=5) then obj_controller.disposition[5]-=max(obj_controller.disposition[3]/4,15); if (pdata.current_owner=6) then obj_controller.disposition[6]-=15; if (pdata.current_owner=8) then obj_controller.disposition[8]-=8;*/ - - if (pdata.current_owner>3 && pdata.current_owner<=6){ - scr_audience(pdata.current_owner, "artifact_angry",); - } - if (pdata.current_owner=eFACTION.Mechanicus && obj_controller.faction_status[eFACTION.Mechanicus]!="War"){ - scr_audience(pdata.current_owner, "declare_war", -20); - } - - // Start battle - pop.battle_special=3.1; - obj_controller.trading_artifact=0; - clear_diplo_choices(); - obj_controller.menu=0; - - pop.loc=pdata.system.name; - pop.planet=pdata.planet; - - exit; - } - - - if (scr_has_adv("Tech-Scavengers")){ - var ex1,ex1_num,ex2,ex2_num,ex3,ex3_num; - ex1="";ex1_num=0;ex2="";ex2_num=0;ex3="";ex3_num=0; - - var stah;stah=instance_nearest(x,y,obj_star); - - if (pdata.origional_owner=2){ - ex1="Meltagun"; - ex1_num=choose(2,3,4); - ex2="Flamer"; - ex2_num=choose(2,3,4); - ex3=choose("Power Fist","Chainsword","Bolt Pistol"); - ex3_num=choose(2,3,4,5); - } - if (pdata.origional_owner=eFACTION.Mechanicus){ - ex1="Plasma Pistol"; - ex1_num=choose(1,2); - ex2="Power Armour"; - ex2_num=choose(2,3,4); - ex3=choose("Servo-arm","Bionics"); - ex3_num=choose(2,3,4); - } - if (pdata.origional_owner=5){ - ex1="Flamer";ex1_num=choose(3,4,5,6); - ex2="Heavy Flamer";ex2_num=choose(1,2,3); - ex3=choose("Chainsword","Bolt Pistol"); - ex3_num=choose(2,3,4,5); - } - - if (ex1!=""){ - pop.text+="##While they're at it your Battle Brothers also find "; - if (ex1_num>0) then pop.text+=string(ex1_num)+" "+string(ex1); - if (ex2_num>0) then pop.text+=", "+string(ex2_num)+" "+string(ex2); - if (ex3_num>0) then pop.text+=", and "+string(ex3_num)+" "+string(ex3); - pop.text+="."; - scr_add_item(ex1,ex1_num); - scr_add_item(ex2,ex2_num); - scr_add_item(ex3,ex3_num); - } - } - - - with(obj_star_select){instance_destroy();} - with(obj_fleet_select){instance_destroy();} - pdata.delete_feature(P_features.STC_Fragment); - scr_add_stc_fragment();// STC here - - - obj_controller.trading_artifact=0; - clear_diplo_choices(); - obj_controller.menu=0; - instance_destroy(); - - /* */ - /* */ - } - instance_destroy(); -} -function recieve_artifact_in_discussion(){ + if (pdata.current_owner > 3 && pdata.current_owner <= 6) { + scr_audience(pdata.current_owner, "artifact_angry",); + } + if (pdata.current_owner == eFACTION.Mechanicus && obj_controller.faction_status[eFACTION.Mechanicus] != "War") { + scr_audience(pdata.current_owner, "declare_war", -20); + } + + // Start battle + pop.battle_special = 3.1; + obj_controller.trading_artifact = 0; + clear_diplo_choices(); + obj_controller.menu = 0; + + pop.loc = pdata.system.name; + pop.planet = pdata.planet; + + exit; + } + + if (scr_has_adv("Tech-Scavengers")) { + var ex1, ex1_num, ex2, ex2_num, ex3, ex3_num; + ex1 = ""; + ex1_num = 0; + ex2 = ""; + ex2_num = 0; + ex3 = ""; + ex3_num = 0; + + var stah; + stah = instance_nearest(x, y, obj_star); + + if (pdata.origional_owner == 2) { + ex1 = "Meltagun"; + ex1_num = choose(2, 3, 4); + ex2 = "Flamer"; + ex2_num = choose(2, 3, 4); + ex3 = choose("Power Fist", "Chainsword", "Bolt Pistol"); + ex3_num = choose(2, 3, 4, 5); + } + if (pdata.origional_owner == eFACTION.Mechanicus) { + ex1 = "Plasma Pistol"; + ex1_num = choose(1, 2); + ex2 = "Power Armour"; + ex2_num = choose(2, 3, 4); + ex3 = choose("Servo-arm", "Bionics"); + ex3_num = choose(2, 3, 4); + } + if (pdata.origional_owner == 5) { + ex1 = "Flamer"; + ex1_num = choose(3, 4, 5, 6); + ex2 = "Heavy Flamer"; + ex2_num = choose(1, 2, 3); + ex3 = choose("Chainsword", "Bolt Pistol"); + ex3_num = choose(2, 3, 4, 5); + } + + if (ex1 != "") { + pop.text += "##While they're at it your Battle Brothers also find "; + if (ex1_num > 0) { + pop.text += string(ex1_num) + " " + string(ex1); + } + if (ex2_num > 0) { + pop.text += ", " + string(ex2_num) + " " + string(ex2); + } + if (ex3_num > 0) { + pop.text += ", and " + string(ex3_num) + " " + string(ex3); + } + pop.text += "."; + scr_add_item(ex1, ex1_num); + scr_add_item(ex2, ex2_num); + scr_add_item(ex3, ex3_num); + } + } + + with (obj_star_select) { + instance_destroy(); + } + with (obj_fleet_select) { + instance_destroy(); + } + pdata.delete_feature(P_features.STC_Fragment); + scr_add_stc_fragment(); // STC here - scr_return_ship(loc,self,num); + obj_controller.trading_artifact = 0; + clear_diplo_choices(); + obj_controller.menu = 0; + instance_destroy(); - var man_size,comp,plan,i; - i=0;man_size=0;comp=0;plan=0; - var ship_id = get_valid_player_ship("", loc); - plan=instance_nearest(x,y,obj_star); - var last_artifact = scr_add_artifact("random","random",4,loc,ship_id+500); + /* */ + /* */ + } + instance_destroy(); +} - var pop=instance_create(0,0,obj_popup); - pop.image="artifact_recovered"; - pop.title="Artifact Recovered!"; - pop.text=$"The Artifact has been safely stowed away upon {loc}. It appears to be a {obj_ini.artifact[last_artifact]} but should be brought home and identified posthaste."; - with(obj_star_select){instance_destroy();} - with(obj_fleet_select){instance_destroy();} - delete_features(plan.p_feature[num], P_features.Artifact); - scr_event_log("","Artifact recovered."); +function recieve_artifact_in_discussion() { + scr_return_ship(loc, self, num); - corrupt_artifact_collectors(last_artifact); + var man_size, comp, plan, i; + i = 0; + man_size = 0; + comp = 0; + plan = 0; + var ship_id = get_valid_player_ship("", loc); + plan = instance_nearest(x, y, obj_star); + var last_artifact = scr_add_artifact("random", "random", 4, loc, ship_id + 500); - obj_controller.trading_artifact=0; - clear_diplo_choices(); - instance_destroy(); + var pop = instance_create(0, 0, obj_popup); + pop.image = "artifact_recovered"; + pop.title = "Artifact Recovered!"; + pop.text = $"The Artifact has been safely stowed away upon {loc}. It appears to be a {obj_ini.artifact[last_artifact]} but should be brought home and identified posthaste."; + with (obj_star_select) { + instance_destroy(); + } + with (obj_fleet_select) { + instance_destroy(); + } + delete_features(plan.p_feature[num], P_features.Artifact); + scr_event_log("", "Artifact recovered."); + corrupt_artifact_collectors(last_artifact); + obj_controller.trading_artifact = 0; + clear_diplo_choices(); + instance_destroy(); } +function send_stc_to_adeptus_mech() { + with (obj_ground_mission) { + var _target_planet; + _target_planet = instance_nearest(x, y, obj_star); + pdata.delete_feature(P_features.STC_Fragment); + + scr_return_ship(pdata.system.name, self, pdata.planet); + + with (obj_star_select) { + instance_destroy(); + } + with (obj_fleet_select) { + instance_destroy(); + } + + scr_toggle_diplomacy(); + obj_controller.diplomacy = 3; + obj_controller.force_goodbye = 5; + + if (obj_controller.disposition[3] <= 10) { + obj_controller.disposition[3] += 5; + } + if ((obj_controller.disposition[3] > 10) && (obj_controller.disposition[3] <= 30)) { + obj_controller.disposition[3] += 7; + } + if ((obj_controller.disposition[3] > 30) && (obj_controller.disposition[3] <= 50)) { + obj_controller.disposition[3] += 9; + } + if (obj_controller.disposition[3] > 50) { + obj_controller.disposition[3] += 11; + } + + with (obj_controller) { + scr_dialogue("stc_thanks"); + } + + with (obj_temp2) { + instance_destroy(); + } + with (obj_temp7) { + instance_destroy(); + } + + if (obj_ini.fleet_type == ePlayerBase.home_world) { + with (obj_star) { + if ((owner == eFACTION.Player) && ((p_owner[1] == 1) || (p_owner[2] == eFACTION.Player))) { + instance_create(x, y, obj_temp2); + } + } + } + if (obj_ini.fleet_type != ePlayerBase.home_world) { + with (obj_p_fleet) { + // Get fleet star system + if ((capital_number > 0) && (action == "")) { + instance_create(instance_nearest(x, y, obj_star).x, instance_nearest(x, y, obj_star).y, obj_temp2); + } + if ((frigate_number > 0) && (action == "")) { + instance_create(instance_nearest(x, y, obj_star).x, instance_nearest(x, y, obj_star).y, obj_temp7); + } + } + } + + if (obj_ini.fleet_type != ePlayerBase.home_world) { + with (obj_p_fleet) { + if (action == "") { + instance_deactivate_object(instance_nearest(x, y, obj_star)); + } + } + } + + var _enemy_fleet; + var _target = -1; + + if (instance_exists(obj_temp2)) { + _target = nearest_star_with_ownership(obj_temp2.x, obj_temp2.y, obj_controller.diplomacy); + } else if (instance_exists(obj_temp7)) { + _target = nearest_star_with_ownership(obj_temp7.x, obj_temp7.y, obj_controller.diplomacy); + } else if ((!instance_exists(obj_temp2)) && (!instance_exists(obj_temp7)) && instance_exists(obj_p_fleet) && (obj_ini.fleet_type == ePlayerBase.home_world)) { + // If player fleet is flying about then get their target for new target + with (obj_p_fleet) { + var pop; + if ((capital_number > 0) && (action != "")) { + pop = instance_create(action_x, action_y, obj_temp2); + pop.action_eta = action_eta; + } + if ((frigate_number > 0) && (action != "")) { + pop = instance_create(action_x, action_y, obj_temp7); + pop.action_eta = action_eta; + } + } + } + + if (is_struct(_target)) { + _enemy_fleet = instance_create(_target.x, _target.y, obj_en_fleet); + + _enemy_fleet.owner = obj_controller.diplomacy; + _enemy_fleet.home_x = _target.x; + _enemy_fleet.home_y = _target.y; + _enemy_fleet.sprite_index = spr_fleet_mechanicus; -function send_stc_to_adeptus_mech(){ - with (obj_ground_mission){ - var _target_planet; - _target_planet = instance_nearest(x, y, obj_star); - pdata.delete_feature(P_features.STC_Fragment); - - scr_return_ship(pdata.system.name, self, pdata.planet); - - with (obj_star_select) { - instance_destroy(); - } - with (obj_fleet_select) { - instance_destroy(); - } - - scr_toggle_diplomacy(); - obj_controller.diplomacy = 3; - obj_controller.force_goodbye = 5; - - if (obj_controller.disposition[3] <= 10) { - obj_controller.disposition[3] += 5; - } - if ((obj_controller.disposition[3] > 10) && (obj_controller.disposition[3] <= 30)) { - obj_controller.disposition[3] += 7; - } - if ((obj_controller.disposition[3] > 30) && (obj_controller.disposition[3] <= 50)) { - obj_controller.disposition[3] += 9; - } - if (obj_controller.disposition[3] > 50) { - obj_controller.disposition[3] += 11; - } - - with (obj_controller) { - scr_dialogue("stc_thanks"); - } - - with (obj_temp2) { - instance_destroy(); - } - with (obj_temp7) { - instance_destroy(); - } - - if (obj_ini.fleet_type == ePlayerBase.home_world) { - with (obj_star) { - if ((owner == eFACTION.Player) && ((p_owner[1] == 1) || (p_owner[2] == eFACTION.Player))) { - instance_create(x, y, obj_temp2); - } - } - } - if (obj_ini.fleet_type != ePlayerBase.home_world) { - with (obj_p_fleet) { - // Get fleet star system - if ((capital_number > 0) && (action == "")) { - instance_create(instance_nearest(x, y, obj_star).x, instance_nearest(x, y, obj_star).y, obj_temp2); - } - if ((frigate_number > 0) && (action == "")) { - instance_create(instance_nearest(x, y, obj_star).x, instance_nearest(x, y, obj_star).y, obj_temp7); - } - } - } - - if (obj_ini.fleet_type != ePlayerBase.home_world) { - with (obj_p_fleet) { - if (action == "") { - instance_deactivate_object(instance_nearest(x, y, obj_star)); - } - } - } - - - var _enemy_fleet; - var _target = -1; - - if (instance_exists(obj_temp2)) { - _target = nearest_star_with_ownership(obj_temp2.x, obj_temp2.y, obj_controller.diplomacy); - } else if (instance_exists(obj_temp7)) { - _target = nearest_star_with_ownership(obj_temp7.x, obj_temp7.y, obj_controller.diplomacy); - } else if ((!instance_exists(obj_temp2)) && (!instance_exists(obj_temp7)) && instance_exists(obj_p_fleet) && (obj_ini.fleet_type == ePlayerBase.home_world)) { - // If player fleet is flying about then get their target for new target - with (obj_p_fleet) { - var pop; - if ((capital_number > 0) && (action != "")) { - pop = instance_create(action_x, action_y, obj_temp2); - pop.action_eta = action_eta; - } - if ((frigate_number > 0) && (action != "")) { - pop = instance_create(action_x, action_y, obj_temp7); - pop.action_eta = action_eta; - } - } - } - - if (is_struct(_target)) { - _enemy_fleet = instance_create(_target.x, _target.y, obj_en_fleet); - - _enemy_fleet.owner = obj_controller.diplomacy; - _enemy_fleet.home_x = _target.x; - _enemy_fleet.home_y = _target.y; - _enemy_fleet.sprite_index = spr_fleet_mechanicus; - - _enemy_fleet.image_index = 0; - _enemy_fleet.capital_number = 1; - _enemy_fleet.trade_goods = "Requisition!500!|"; - - if (obj_ini.fleet_type != ePlayerBase.home_world) { - if (instance_exists(obj_temp2)) { - _enemy_fleet.action_x = obj_temp2.x; - _enemy_fleet.action_y = obj_temp2.y; - _enemy_fleet.target = instance_nearest(_enemy_fleet.action_x, _enemy_fleet.action_y, obj_p_fleet); - } - if ((!instance_exists(obj_temp2)) && instance_exists(obj_temp7)) { - _enemy_fleet.action_x = obj_temp7.x; - _enemy_fleet.action_y = obj_temp7.y; - _enemy_fleet.target = instance_nearest(_enemy_fleet.action_x, _enemy_fleet.action_y, obj_p_fleet); - } - } - if (obj_ini.fleet_type == ePlayerBase.home_world) { - _target = instance_nearest(_enemy_fleet.x, _enemy_fleet.y, obj_temp2); - _enemy_fleet.action_x = _target.x; - _enemy_fleet.action_y = _target.y; - } - - with(_enemy_fleet){ - set_fleet_movement(); - } - } - - instance_activate_all(); - with (obj_temp2) { - instance_destroy(); - } - with (obj_temp7) { - instance_destroy(); - } - instance_destroy(); - } + _enemy_fleet.image_index = 0; + _enemy_fleet.capital_number = 1; + _enemy_fleet.trade_goods = "Requisition!500!|"; + + if (obj_ini.fleet_type != ePlayerBase.home_world) { + if (instance_exists(obj_temp2)) { + _enemy_fleet.action_x = obj_temp2.x; + _enemy_fleet.action_y = obj_temp2.y; + _enemy_fleet.target = instance_nearest(_enemy_fleet.action_x, _enemy_fleet.action_y, obj_p_fleet); + } + if ((!instance_exists(obj_temp2)) && instance_exists(obj_temp7)) { + _enemy_fleet.action_x = obj_temp7.x; + _enemy_fleet.action_y = obj_temp7.y; + _enemy_fleet.target = instance_nearest(_enemy_fleet.action_x, _enemy_fleet.action_y, obj_p_fleet); + } + } + if (obj_ini.fleet_type == ePlayerBase.home_world) { + _target = instance_nearest(_enemy_fleet.x, _enemy_fleet.y, obj_temp2); + _enemy_fleet.action_x = _target.x; + _enemy_fleet.action_y = _target.y; + } + with (_enemy_fleet) { + set_fleet_movement(); + } + } + + instance_activate_all(); + with (obj_temp2) { + instance_destroy(); + } + with (obj_temp7) { + instance_destroy(); + } + instance_destroy(); + } } diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index 556a24500a..2d6b6cbd1c 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -62,24 +62,9 @@ function scr_random_event(execute_now) { var events; if (player_luck == eLUCK.good) { - events = [ - eEVENT.space_hulk, - eEVENT.promotion, - eEVENT.strange_building, - eEVENT.sororitas, - eEVENT.rogue_trader, - eEVENT.inquisition_mission, - eEVENT.inquisition_planet, - eEVENT.mechanicus_mission - ]; + events = [eEVENT.space_hulk, eEVENT.promotion, eEVENT.strange_building, eEVENT.sororitas, eEVENT.rogue_trader, eEVENT.inquisition_mission, eEVENT.inquisition_planet, eEVENT.mechanicus_mission]; } else if (player_luck == eLUCK.neutral) { - events = [ - eEVENT.strange_behavior, - eEVENT.fleet_delay, - eEVENT.harlequins, - eEVENT.succession_war, - eEVENT.random_fun - ]; + events = [eEVENT.strange_behavior, eEVENT.fleet_delay, eEVENT.harlequins, eEVENT.succession_war, eEVENT.random_fun]; } else if (player_luck == eLUCK.bad) { events = [ eEVENT.warp_storms, @@ -265,15 +250,7 @@ function scr_random_event(execute_now) { } } else if (chosen_event == eEVENT.promotion) { log_message("RE: Promotion"); - var marine_and_company = scr_random_marine( - [ - obj_ini.role[100][8], - obj_ini.role[100][12], - obj_ini.role[100][9], - obj_ini.role[100][10] - ], - 0 - ); + var marine_and_company = scr_random_marine([obj_ini.role[100][8], obj_ini.role[100][12], obj_ini.role[100][9], obj_ini.role[100][10]], 0); if (marine_and_company == "none") { log_error("RE: Promotion, couldn't pick a space marine"); exit; diff --git a/scripts/scr_string_functions/scr_string_functions.gml b/scripts/scr_string_functions/scr_string_functions.gml index 154c304d95..698fdea64c 100644 --- a/scripts/scr_string_functions/scr_string_functions.gml +++ b/scripts/scr_string_functions/scr_string_functions.gml @@ -6,22 +6,21 @@ function string_upper_first(_string) { try { var _first_char = string_char_at(_string, 1); var _modified_string = _string; - + _first_char = string_upper(_first_char); - + _modified_string = string_delete(_modified_string, 1, 1); _modified_string = string_insert(_first_char, _modified_string, 1); - + return _modified_string; - } - catch(_exception) { + } catch (_exception) { handle_exception(_exception); - } + } } -function string_gender_third_person(gender){ +function string_gender_third_person(gender) { var _string = "they"; - switch(gender){ + switch (gender) { case eGENDER.Female: _string = "she"; break; @@ -33,15 +32,14 @@ function string_gender_third_person(gender){ return _string; } - -function string_gender_pronouns(gender){ - var _string = "their"; - switch(gender){ +function string_gender_pronouns(gender) { + var _string = "their"; + switch (gender) { case eGENDER.Female: - _string ="her" + _string = "her"; break; case eGENDER.Male: - _string ="his" + _string = "his"; break; case eGENDER.Neutral: _string = "their"; @@ -51,7 +49,6 @@ function string_gender_pronouns(gender){ return _string; } - /// @function string_plural /// @description This function formats a string into a plural form by adding affixes following common rules. /// @param {string} _string @@ -66,14 +63,11 @@ function string_plural(_string, _variable = 2) { var _last_two_chars = string_copy(_string, string_length(_string) - 1, 2); if (_last_char == "y") { return string_copy(_string, 1, string_length(_string) - 1) + "ies"; - } - else if (array_contains(["s", "x", "z", "ch", "sh"], _last_char)) { + } else if (array_contains(["s", "x", "z", "ch", "sh"], _last_char)) { return _string + "es"; - } - else if (_last_char == "f" || _last_two_chars == "fe") { + } else if (_last_char == "f" || _last_two_chars == "fe") { return string_copy(_string, 1, string_length(_string) - string_length(_last_two_chars)) + "ves"; - } - else { + } else { return _string + "s"; } } @@ -102,7 +96,7 @@ function string_truncate(_string, _max_width) { var i = string_length(_string); while (_text_width + _ellipsis_width > _max_width && i > 0) { i--; - _string = string_delete(_string, i+1, 1); + _string = string_delete(_string, i + 1, 1); _text_width = string_width(_string + _ellipsis); } return _string + _ellipsis; @@ -170,15 +164,15 @@ function integer_to_words(_integer, _capitalize_first = false, _ordinal = false) /// @param {string} _string /// @returns {string} function string_reverse(_string) { - var str,length,i,out,char; - str=_string - out="" - length=string_length(_string) - for(i=0;i 10) { - return ""; - } else { - var _flavour_text = flavour ? _flavours[_company_num - 1] : ""; - _company_num = string(_company_num) + _suffixes[_company_num - 1]; - var _converted_string = string_join(" ", _company_num, _flavour_text, _str_company); - return _converted_string; - } +function scr_convert_company_to_string(company_num, possessive = false, flavour = false) { + var _company_num = company_num; + var _suffixes = ["st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th"]; + var _flavours = ["Veteran", "Battle", "Battle", "Battle", "Battle", "Reserve", "Reserve", "Reserve", "Reserve", "Scout"]; + var _str_company = possessive ? "Company's" : "Company"; + + if ((_company_num < 1) || (_company_num > 10)) { + return ""; + } else { + var _flavour_text = flavour ? _flavours[_company_num - 1] : ""; + _company_num = string(_company_num) + _suffixes[_company_num - 1]; + var _converted_string = string_join(" ", _company_num, _flavour_text, _str_company); + return _converted_string; + } } /// @function scr_convert_company_to_string @@ -240,45 +234,98 @@ function scr_convert_company_to_string(company_num, possessive = false, flavour= /// @param {string} _string /// @returns {real} function string_to_integer(_string) { - // The purpose of this is to allow a marine's - // name to generate a semi-unique variable for the future display of veterency - // decorations when inspected in management. Whether it is odd, from 0-9, and so - // on can determine what shows on their picture at certain experience values. - - var lol,m1,val; - lol=_string;val=0; - m1=string_length(lol); - - repeat(m1){ - if (string_lower(string_char_at(lol,0))="a") then val+=1; - if (string_lower(string_char_at(lol,0))="b") then val+=2; - if (string_lower(string_char_at(lol,0))="c") then val+=3; - if (string_lower(string_char_at(lol,0))="d") then val+=4; - if (string_lower(string_char_at(lol,0))="e") then val+=5; - if (string_lower(string_char_at(lol,0))="f") then val+=6; - if (string_lower(string_char_at(lol,0))="g") then val+=7; - if (string_lower(string_char_at(lol,0))="h") then val+=8; - if (string_lower(string_char_at(lol,0))="i") then val+=9; - if (string_lower(string_char_at(lol,0))="j") then val+=10; - if (string_lower(string_char_at(lol,0))="k") then val+=11; - if (string_lower(string_char_at(lol,0))="l") then val+=12; - if (string_lower(string_char_at(lol,0))="m") then val+=13; - if (string_lower(string_char_at(lol,0))="n") then val+=14; - if (string_lower(string_char_at(lol,0))="o") then val+=15; - if (string_lower(string_char_at(lol,0))="p") then val+=16; - if (string_lower(string_char_at(lol,0))="q") then val+=17; - if (string_lower(string_char_at(lol,0))="r") then val+=18; - if (string_lower(string_char_at(lol,0))="s") then val+=19; - if (string_lower(string_char_at(lol,0))="t") then val+=20; - if (string_lower(string_char_at(lol,0))="u") then val+=21; - if (string_lower(string_char_at(lol,0))="v") then val+=22; - if (string_lower(string_char_at(lol,0))="w") then val+=23; - if (string_lower(string_char_at(lol,0))="x") then val+=24; - if (string_lower(string_char_at(lol,0))="y") then val+=25; - if (string_lower(string_char_at(lol,0))="z") then val+=26; - lol=string_delete(lol,0,1); + // The purpose of this is to allow a marine's + // name to generate a semi-unique variable for the future display of veterency + // decorations when inspected in management. Whether it is odd, from 0-9, and so + // on can determine what shows on their picture at certain experience values. + + var lol, m1, val; + lol = _string; + val = 0; + m1 = string_length(lol); + + repeat (m1) { + if (string_lower(string_char_at(lol, 0)) == "a") { + val += 1; + } + if (string_lower(string_char_at(lol, 0)) == "b") { + val += 2; + } + if (string_lower(string_char_at(lol, 0)) == "c") { + val += 3; + } + if (string_lower(string_char_at(lol, 0)) == "d") { + val += 4; + } + if (string_lower(string_char_at(lol, 0)) == "e") { + val += 5; + } + if (string_lower(string_char_at(lol, 0)) == "f") { + val += 6; + } + if (string_lower(string_char_at(lol, 0)) == "g") { + val += 7; + } + if (string_lower(string_char_at(lol, 0)) == "h") { + val += 8; + } + if (string_lower(string_char_at(lol, 0)) == "i") { + val += 9; + } + if (string_lower(string_char_at(lol, 0)) == "j") { + val += 10; + } + if (string_lower(string_char_at(lol, 0)) == "k") { + val += 11; + } + if (string_lower(string_char_at(lol, 0)) == "l") { + val += 12; + } + if (string_lower(string_char_at(lol, 0)) == "m") { + val += 13; + } + if (string_lower(string_char_at(lol, 0)) == "n") { + val += 14; + } + if (string_lower(string_char_at(lol, 0)) == "o") { + val += 15; + } + if (string_lower(string_char_at(lol, 0)) == "p") { + val += 16; + } + if (string_lower(string_char_at(lol, 0)) == "q") { + val += 17; + } + if (string_lower(string_char_at(lol, 0)) == "r") { + val += 18; + } + if (string_lower(string_char_at(lol, 0)) == "s") { + val += 19; + } + if (string_lower(string_char_at(lol, 0)) == "t") { + val += 20; + } + if (string_lower(string_char_at(lol, 0)) == "u") { + val += 21; + } + if (string_lower(string_char_at(lol, 0)) == "v") { + val += 22; + } + if (string_lower(string_char_at(lol, 0)) == "w") { + val += 23; + } + if (string_lower(string_char_at(lol, 0)) == "x") { + val += 24; + } + if (string_lower(string_char_at(lol, 0)) == "y") { + val += 25; + } + if (string_lower(string_char_at(lol, 0)) == "z") { + val += 26; + } + lol = string_delete(lol, 0, 1); } - return(val); + return val; } /// @description Replaces underscores with spaces and capitalizes the first letter of each word. @@ -286,20 +333,19 @@ function format_underscore_string(input_string) { // Split the string into words var words = string_split(input_string, "_"); var result = ""; - + // Loop through each word and capitalize the first letter - for (var i = 0; i < array_length(words); i++) - { + for (var i = 0; i < array_length(words); i++) { // Capitalize the first character and concatenate it with the rest of the word var word = string_upper_first(words[i]); result += word; - + // Add a space after each word (except for the last one) if (i < array_length(words) - 1) { result += " "; } } - + return result; } @@ -358,17 +404,16 @@ function string_starts_with_any(_str, _prefixes) { return false; } - //this can be way more efficient nby reading the string and finding keys rather than the other way around but until it satrts to cause issues i ccan;t be assed -function string_interpolate_from_struct(interpolate_string,data){ - var _names=struct_get_names(data); +function string_interpolate_from_struct(interpolate_string, data) { + var _names = struct_get_names(data); var _name_length = array_length(_names); show_debug_message(_names); - for (var i=0;i<_name_length;i++){ - var _name=_names[i]; + for (var i = 0; i < _name_length; i++) { + var _name = _names[i]; var _replace_string = "{" + $"{_name}" + "}"; show_debug_message(_replace_string); - interpolate_string = string_replace_all(interpolate_string, _replace_string, data[$_name]); + interpolate_string = string_replace_all(interpolate_string, _replace_string, data[$ _name]); } return interpolate_string; diff --git a/scripts/scr_trade/scr_trade.gml b/scripts/scr_trade/scr_trade.gml index e04a7025f8..9387627ca0 100644 --- a/scripts/scr_trade/scr_trade.gml +++ b/scripts/scr_trade/scr_trade.gml @@ -1,155 +1,154 @@ - -function TradeAttempt(diplomacy) constructor{ - diplomacy_faction = diplomacy; - relative_trade_values = { - "Test" : 5000, - "Requisition" : 1, - "Recruiting Planet" : obj_controller.disposition[2]<70 ? 4000 : 2000, - "License: Repair" : 750, - "License: Crusade" : 1500, - "Terminator Armour" : 400, - "Tartaros" : 900, - "Land Raider" : 800, - "Castellax Battle Automata" : 1200, - "Minor Artifact" : 250, - "Skitarii" : 15, - "Techpriest" : 450, - //"Condemnor Boltgun" : 20, - "Hellrifle" : 20, - "Incinerator" : 20, - "Crusader" : 20, - "Exterminatus" : 1500, - "Cyclonic Torpedo" : 3000, - "Eviscerator" : 20, - "Heavy Flamer" : 12, - "Inferno Bolts" : 5, - "Sister of Battle" : 40, - "Sister Hospitaler" : 75, - "Eldar Power Sword" : 50, - "Archeotech Laspistol" : 150, - "Ranger" : 100, - "Useful Information" : 600, - "Power Klaw" : 50, - "Ork Sniper" : 30, - "Flash Git" : 60, - "IOU" : 1, - } - demand_options = []; - offer_options = []; - - static clear_options = function(){ - trade_likely=""; - var _offer_length = array_length(offer_options); - var _demand_length = array_length(demand_options) - var trade_options = max(_demand_length,_offer_length) - for (var i=0;i 500 && diplomacy_faction==6){ - var got2=0; - with (obj_controller){ - repeat(10){ - if (got2<50){ - got2+=1; - if (quest[got2]="fund_elder") and (quest_faction[got2]=6){ - scr_dialogue("mission1_thanks"); - scr_quest(2,"fund_elder",6,0); - got2=50; - trading=0; - exit; - } - } - } - } - } - } else if (_opt.trade_type == "gene"){ - obj_controller.gene_seed-=_opt.number; - if (diplomacy_faction<=5) and (diplomacy_faction!=4){ - obj_controller.gene_sold += _opt.number; - } - if (diplomacy_faction>=6){ - obj_controller.gene_xeno += _opt.number; - } - } else if(_opt.trade_type == "stc"){ +function TradeAttempt(diplomacy) constructor { + diplomacy_faction = diplomacy; + relative_trade_values = { + "Test": 5000, + "Requisition": 1, + "Recruiting Planet": obj_controller.disposition[2] < 70 ? 4000 : 2000, + "License: Repair": 750, + "License: Crusade": 1500, + "Terminator Armour": 400, + "Tartaros": 900, + "Land Raider": 800, + "Castellax Battle Automata": 1200, + "Minor Artifact": 250, + "Skitarii": 15, + "Techpriest": 450, + //"Condemnor Boltgun" : 20, + "Hellrifle": 20, + "Incinerator": 20, + "Crusader": 20, + "Exterminatus": 1500, + "Cyclonic Torpedo": 3000, + "Eviscerator": 20, + "Heavy Flamer": 12, + "Inferno Bolts": 5, + "Sister of Battle": 40, + "Sister Hospitaler": 75, + "Eldar Power Sword": 50, + "Archeotech Laspistol": 150, + "Ranger": 100, + "Useful Information": 600, + "Power Klaw": 50, + "Ork Sniper": 30, + "Flash Git": 60, + "IOU": 1, + }; + demand_options = []; + offer_options = []; + + static clear_options = function() { + trade_likely = ""; + var _offer_length = array_length(offer_options); + var _demand_length = array_length(demand_options); + var trade_options = max(_demand_length, _offer_length); + for (var i = 0; i < trade_options; i++) { + if (i < _offer_length) { + offer_options[i].number = 0; + } + if (i < _demand_length) { + demand_options[i].number = 0; + } + } + }; + + clear_button = new UnitButtonObject({ + x1: 510, + y1: 649, + label: "Clear", + }); + clear_button.bind_method = clear_options; + clear_button.bind_scope = self; + + static successful_trade_attempt = function() { + var trading_object = {}; + for (var i = 0; i < array_length(demand_options); i++) { + var _opt = demand_options[i]; + if (_opt.number == 0) { + continue; + } + var _type = _opt.label; + if (_opt.trade_type == "equip") { + if (!struct_exists(trading_object, "items")) { + trading_object.items = {}; + } + trading_object.items[$ _type] = { + quality: "standard", + number: _opt.number, + }; + } else if (_opt.trade_type == "license") { + switch (_opt.label) { + case "Recruiting Planet": + obj_controller.recruiting_worlds_bought++; + obj_controller.liscensing = 5; + break; + case "License: Repair": + obj_controller.repair_ships = true; + break; + case "Useful Information": + obj_controller.liscensing = 5; + break; + case "License: Crusade": + obj_controller.liscensing = 2; + break; + } + } else if (_opt.trade_type == "req") { + obj_controller.requisition += _opt.number; + } else if (_opt.trade_type == "merc") { + if (!struct_exists(trading_object, "mercenaries")) { + trading_object.mercenaries = {}; + } + trading_object.mercenaries[$ _type] = { + quality: "standard", + number: _opt.number, + }; + } else if (_opt.trade_type == "arti") { + scr_add_artifact("random", "minor", true); + } else if (_opt.trade_type == "vehic") { + if (!struct_exists(trading_object, "vehicles")) { + trading_object.vehicles = {}; + } + trading_object.vehicles[$ _type] = { + quality: "standard", + number: _opt.number, + }; + } + } + for (var i = 0; i < array_length(offer_options); i++) { + var _opt = offer_options[i]; + if (_opt.number == 0) { + continue; + } + var _type = _opt.label; + if (_opt.trade_type == "equip") { + scr_add_item(_opt.label, -_opt.label); + } else if (_opt.trade_type == "req") { + obj_controller.requisition -= _opt.number; + if (_opt.number > 500 && diplomacy_faction == 6) { + var got2 = 0; + with (obj_controller) { + repeat (10) { + if (got2 < 50) { + got2 += 1; + if ((quest[got2] == "fund_elder") && (quest_faction[got2] == 6)) { + scr_dialogue("mission1_thanks"); + scr_quest(2, "fund_elder", 6, 0); + got2 = 50; + trading = 0; + exit; + } + } + } + } + } + } else if (_opt.trade_type == "gene") { + obj_controller.gene_seed -= _opt.number; + if ((diplomacy_faction <= 5) && (diplomacy_faction != 4)) { + obj_controller.gene_sold += _opt.number; + } + if (diplomacy_faction >= 6) { + obj_controller.gene_xeno += _opt.number; + } + } else if (_opt.trade_type == "stc") { for (var j = 0; j < 100; j += 1) { var p = choose(1, 2, 3); if (p == 1 && obj_controller.stc_wargear_un > 0) { @@ -165,525 +164,556 @@ function TradeAttempt(diplomacy) constructor{ break; } } - } else if(_opt.trade_type == "info"){ - obj_controller.info_chips-=_opt.number; - }else if (_opt.trade_type == "favour"){ - edit_faction_favour(diplomacy_faction,-_opt.number); - } - } - - var flit = setup_ai_trade_fleet(trade_from_star, diplomacy_faction); - - flit.cargo_data.player_goods = trading_object; - - flit.target = trade_to_obj; - with (flit){ - action_x=target.x; - action_y=target.y; - set_fleet_movement(); - } - - } - - static find_trade_locations = function(){ - var _stars_with_player_control = []; - with(obj_star){ - if (array_contains(p_owner, 1)){ - array_push(_stars_with_player_control, id) - } - } - - var player_fleet_targets = []; - - if (obj_ini.fleet_type != ePlayerBase.home_world || !array_length(_stars_with_player_control)){ - // with(obj_star){if (present_fleet[1]>0){x-=10000;y-=10000;}} - with(obj_p_fleet){// Get the nearest star system that is viable for creating the trading fleet - if ((capital_number>0 || frigate_number>0) && action=""){ - array_push(player_fleet_targets, id); - } - - } - } - - - // temp2: ideal trade target - // temp3: origin - // temp4: possible trade target - - - var viable_faction_trade_stars = []; - var _check_val = diplomacy_faction; - if (diplomacy_faction==4){ - _check_val = 2 - } - with(obj_star){// Get origin star system for enemy fleet - if (array_contains(p_owner, _check_val)){ - array_push(viable_faction_trade_stars, id); - } - if (_check_val=5){ - - var ahuh=0,q=0; - repeat(planets){ - q+=1; - if (p_owner[q]=5) then ahuh=1; - if (p_owner[q]<6) and (planet_feature_bool(p_feature[q],P_features.Sororitas_Cathedral) == 1) then ahuh=1; - } - if (ahuh=1){ - array_push(viable_faction_trade_stars, id); - } - - } - } - - if (!array_length(_stars_with_player_control) && !array_length(player_fleet_targets)){ - with (obj_controller){ - scr_dialogue("trade_error_1"); - trading = false; - } - return false - } - if (!array_length(viable_faction_trade_stars)){ - with (obj_controller){ - scr_dialogue("trade_error_2"); - trading = false; - } - return false - } - - trade_from_star = array_random_element(viable_faction_trade_stars); - - - if (!array_length(_stars_with_player_control) || (obj_ini.fleet_type!=ePlayerBase.home_world && array_length(player_fleet_targets))){ - trade_to_obj = array_random_element(player_fleet_targets); - } else if (!array_length(player_fleet_targets)){ - trade_to_obj = array_random_element(_stars_with_player_control); - } else { - trade_to_obj = choose(array_random_element(_stars_with_player_control), array_random_element(player_fleet_targets)); - } - return true; - } - static attempt_trade = function(){ - calculate_deal_chance(); - var attempt_rand = roll_dice_chapter(1, 100, "high"); - var _success = attempt_rand <= deal_chance; - if (_success){ - _success = find_trade_locations(); - show_debug_message("trade_success"); - if (_success){ - successful_trade_attempt(); - scr_dialogue("agree",{prepend:"[[Trade Accepted. Shipment initialized.]]"}); - //force_goodbye=1; - obj_controller.trading=0; - if (diplomacy_faction=6) or (diplomacy_faction=7) or (diplomacy_faction=8){ - scr_loyalty("Xeno Trade","+"); - } - } else { - show_debug_message("no trade locations"); - } - } else { - var _dip = diplomacy_faction; - with (obj_controller){ - var _rela=relationship_hostility_matrix(diplomacy); - if (trading_artifact==0){ - diplo_text="[[Trade Refused]]##"; - } else { - diplo_text=""; - } - annoyed[_dip] += 1; - scr_dialogue("disagree",{prepend:"[[Trade Refused]]"}); - rando=choose(1,2,3); - if (_rela=="hostile"){ - force_goodbye=1; - if (rando==1) then diplo_text+="You would offer me scraps for the keys to a kingdom? You are foolish and, worse, you are unaware of your own incompetence."; - if (rando==2) then diplo_text+="Do not attempt exchanges with those so far above you, lapdog of the Corpse Emperor, it makes you look even more idiotic than you already do."; - if (rando==3) then diplo_text+="I would spit upon this ‘offer' you bring before me but I find myself too amused by it."; - } - else if (_rela!="hostile"){ - if (rando==1) then diplo_text+="You may consider my response to be a ‘no' and assume my attitude to be whatever you like, Chapter Master."; - if (rando==2) then diplo_text+="Have a care that you do not overstep the mark, Chapter Master, I see no reason to accept such a trade."; - if (rando==3) then diplo_text+="An unreasonable trade, whatever our working relationship might be. I refuse."; - } - if (annoyed[_dip]>=10){ - force_goodbye=1; - turns_ignored[_dip]=max(turns_ignored[_dip],1); - diplo_last="disagree"; - diplo_char=0; - diplo_alpha=0; - exit; - } - } - show_debug_message("trade_fail"); - clear_options(); - } - - } - - offer_button = new UnitButtonObject({ - x1 : 630, - y1 : 649, - label : "Offer", - }); - offer_button.bind_method = function(){ - if (obj_controller.diplo_last !=" offer"){ - attempt_trade(); - } - } - offer_button.bind_scope = self; - - exit_button = new UnitButtonObject({ - x1 : 818, - y1 : 796, - label : "Exit", - }); - - exit_button.bind_method = function(){ - with (obj_controller){ - cooldown=8; - trading=0; + } else if (_opt.trade_type == "info") { + obj_controller.info_chips -= _opt.number; + } else if (_opt.trade_type == "favour") { + edit_faction_favour(diplomacy_faction, -_opt.number); + } + } + + var flit = setup_ai_trade_fleet(trade_from_star, diplomacy_faction); + + flit.cargo_data.player_goods = trading_object; + + flit.target = trade_to_obj; + with (flit) { + action_x = target.x; + action_y = target.y; + set_fleet_movement(); + } + }; + + static find_trade_locations = function() { + var _stars_with_player_control = []; + with (obj_star) { + if (array_contains(p_owner, 1)) { + array_push(_stars_with_player_control, id); + } + } + + var player_fleet_targets = []; + + if (obj_ini.fleet_type != ePlayerBase.home_world || !array_length(_stars_with_player_control)) { + // with(obj_star){if (present_fleet[1]>0){x-=10000;y-=10000;}} + with (obj_p_fleet) { + // Get the nearest star system that is viable for creating the trading fleet + if ((capital_number > 0 || frigate_number > 0) && action == "") { + array_push(player_fleet_targets, id); + } + } + } + + // temp2: ideal trade target + // temp3: origin + // temp4: possible trade target + + var viable_faction_trade_stars = []; + var _check_val = diplomacy_faction; + if (diplomacy_faction == 4) { + _check_val = 2; + } + with (obj_star) { + // Get origin star system for enemy fleet + if (array_contains(p_owner, _check_val)) { + array_push(viable_faction_trade_stars, id); + } + if (_check_val == 5) { + var ahuh = 0, q = 0; + repeat (planets) { + q += 1; + if (p_owner[q] == 5) { + ahuh = 1; + } + if ((p_owner[q] < 6) && (planet_feature_bool(p_feature[q], P_features.Sororitas_Cathedral) == 1)) { + ahuh = 1; + } + } + if (ahuh == 1) { + array_push(viable_faction_trade_stars, id); + } + } + } + + if (!array_length(_stars_with_player_control) && !array_length(player_fleet_targets)) { + with (obj_controller) { + scr_dialogue("trade_error_1"); + trading = false; + } + return false; + } + if (!array_length(viable_faction_trade_stars)) { + with (obj_controller) { + scr_dialogue("trade_error_2"); + trading = false; + } + return false; + } + + trade_from_star = array_random_element(viable_faction_trade_stars); + + if (!array_length(_stars_with_player_control) || (obj_ini.fleet_type != ePlayerBase.home_world && array_length(player_fleet_targets))) { + trade_to_obj = array_random_element(player_fleet_targets); + } else if (!array_length(player_fleet_targets)) { + trade_to_obj = array_random_element(_stars_with_player_control); + } else { + trade_to_obj = choose(array_random_element(_stars_with_player_control), array_random_element(player_fleet_targets)); + } + return true; + }; + + static attempt_trade = function() { + calculate_deal_chance(); + var attempt_rand = roll_dice_chapter(1, 100, "high"); + var _success = attempt_rand <= deal_chance; + if (_success) { + _success = find_trade_locations(); + show_debug_message("trade_success"); + if (_success) { + successful_trade_attempt(); + scr_dialogue("agree", { + prepend: "[[Trade Accepted. Shipment initialized.]]", + }); + //force_goodbye=1; + obj_controller.trading = 0; + if ((diplomacy_faction == 6) || (diplomacy_faction == 7) || (diplomacy_faction == 8)) { + scr_loyalty("Xeno Trade", "+"); + } + } else { + show_debug_message("no trade locations"); + } + } else { + var _dip = diplomacy_faction; + with (obj_controller) { + var _rela = relationship_hostility_matrix(diplomacy); + if (trading_artifact == 0) { + diplo_text = "[[Trade Refused]]##"; + } else { + diplo_text = ""; + } + annoyed[_dip] += 1; + scr_dialogue("disagree", { + prepend: "[[Trade Refused]]", + }); + rando = choose(1, 2, 3); + if (_rela == "hostile") { + force_goodbye = 1; + if (rando == 1) { + diplo_text += "You would offer me scraps for the keys to a kingdom? You are foolish and, worse, you are unaware of your own incompetence."; + } + if (rando == 2) { + diplo_text += "Do not attempt exchanges with those so far above you, lapdog of the Corpse Emperor, it makes you look even more idiotic than you already do."; + } + if (rando == 3) { + diplo_text += "I would spit upon this ‘offer' you bring before me but I find myself too amused by it."; + } + } else if (_rela != "hostile") { + if (rando == 1) { + diplo_text += "You may consider my response to be a ‘no' and assume my attitude to be whatever you like, Chapter Master."; + } + if (rando == 2) { + diplo_text += "Have a care that you do not overstep the mark, Chapter Master, I see no reason to accept such a trade."; + } + if (rando == 3) { + diplo_text += "An unreasonable trade, whatever our working relationship might be. I refuse."; + } + } + if (annoyed[_dip] >= 10) { + force_goodbye = 1; + turns_ignored[_dip] = max(turns_ignored[_dip], 1); + diplo_last = "disagree"; + diplo_char = 0; + diplo_alpha = 0; + exit; + } + } + show_debug_message("trade_fail"); + clear_options(); + } + }; + + offer_button = new UnitButtonObject({ + x1: 630, + y1: 649, + label: "Offer", + }); + offer_button.bind_method = function() { + if (obj_controller.diplo_last != " offer") { + attempt_trade(); + } + }; + offer_button.bind_scope = self; + + exit_button = new UnitButtonObject({ + x1: 818, + y1: 796, + label: "Exit", + }); + + exit_button.bind_method = function() { + with (obj_controller) { + cooldown = 8; + trading = 0; scr_dialogue("trade_close"); - click2=1; - if (trading_artifact!=0){ + click2 = 1; + if (trading_artifact != 0) { scr_toggle_diplomacy(); - with(obj_popup){ - instance_destroy(); + with (obj_popup) { + instance_destroy(); } - obj_ground_mission.alarm[1]=1; + obj_ground_mission.alarm[1] = 1; exit; - } - } - } - exit_button.bind_scope = self; - static new_demand_buttons = function(trade_disp, name, trade_type, max_take = 100000){ - var _option = new UnitButtonObject({ - label : name, - number : 0, - disp : trade_disp, - trade_type : trade_type, - max_take : max_take, - number_last : 0, - diplomacy_faction - }); - with (_option){ - bind_method = function(){ - if (max_take == 1){ - variable_struct_set(self, "number", 1); - } else { - get_diag_integer($"{label} wanted?", max_take, self, diplomacy_faction); - } - } - } - if (trader_disp < trade_disp){ - _option.disabled = true; - _option.tooltip = $"{trade_disp} disposition required"; - } - //_option.bind_scope = _option; - array_push(demand_options, _option); - } - - trader_disp = obj_controller.disposition[diplomacy_faction]; - - trade_req=obj_controller.requisition; - trade_gene=obj_controller.gene_seed; - trade_chip=obj_controller.stc_wargear_un+obj_controller.stc_vehicles_un+obj_controller.stc_ships_un; - trade_info=obj_controller.info_chips; - - switch (diplomacy_faction){ - case 2: - new_demand_buttons(0, "Requisition","req"); - new_demand_buttons(0, "Recruiting Planet", "license",1); - new_demand_buttons(0, "License: Repair","license",1); - new_demand_buttons(0, "License: Crusade","license",1); - break; - case 3: - new_demand_buttons(35, "Terminator Armour", "equip",5); - new_demand_buttons(20, "Land Raider", "vehic",1); - new_demand_buttons(40, "Minor Artifact", "arti",1); - new_demand_buttons(25, "Skitarii", "merc",200); - new_demand_buttons(55, "Techpriest", "merc",3); - break; - case 4: - new_demand_buttons(30, "Hellrifle", "equip",3); - new_demand_buttons(20, "Incinerator", "equip",10); - new_demand_buttons(25, "Crusader", "merc", 5); - new_demand_buttons(40, "Exterminatus", "equip",1); - new_demand_buttons(60, "Cyclonic Torpedo", "equip",1); - break; - case 5: - new_demand_buttons(20, "Eviscerator", "equip",10); - new_demand_buttons(30, "Heavy", "equip",10); - //new_demand_buttons(30, "Inferno Bolts", "equip"); - new_demand_buttons(40, "Sister of Battle", "merc",5); - new_demand_buttons(45, "Sister Hospitaler", "merc",3); - break; - case 6: - new_demand_buttons(-10, "Master Crafted Power Sword", "equip",3); - new_demand_buttons(-10, "Archeotech Laspistol", "equip",1); - new_demand_buttons(10, "Ranger", "merc",3); - new_demand_buttons(-15, "Useful Information", "license",1); - break; - case 7: - new_demand_buttons(-100, "Power Klaw", "equip",10); - new_demand_buttons(-100, "Ork Sniper", "merc",50); - new_demand_buttons(-100, "Flash Git", "merc",50); - break; - } - - static new_offer_option = function(trade_disp = -100, name, trade_type, max_count=1){ - var _option = new UnitButtonObject({ - label : name, - number : 0, - max_number : max_count, - disp : trade_disp, - trade_type : trade_type, - number_last : 0, - diplomacy_faction - }); - with (_option){ - bind_method = function(){ - if (max_number == 1){ - number = 1; - } else { - get_diag_integer($"{label} offered?",max_number, self, diplomacy_faction); - } - } - } - array_push(offer_options, _option); - } - - if (obj_controller.requisition > 0){ - new_offer_option(, "Requisition", "req", obj_controller.requisition); - } - - if (obj_controller.gene_seed > 0){ - new_offer_option(, "Gene Seed", "gene", obj_controller.gene_seed); - } - - if (trade_chip > 0){ - new_offer_option(, "STC Fragment","stc" ,trade_chip); - } - if (trade_info > 0){ - new_offer_option(, "Info Chip","info", trade_info); - } - - if (has_faction_favour(diplomacy_faction)){ - new_offer_option(, "IOU","favour", trade_info); - } - - static draw_trade_screen = function(){ - recalc_values = false; + } + } + }; + exit_button.bind_scope = self; + + static new_demand_buttons = function(trade_disp, name, trade_type, max_take = 100000) { + var _option = new UnitButtonObject({ + label: name, + number: 0, + disp: trade_disp, + trade_type: trade_type, + max_take: max_take, + number_last: 0, + diplomacy_faction, + }); + with (_option) { + bind_method = function() { + if (max_take == 1) { + variable_struct_set(self, "number", 1); + } else { + get_diag_integer($"{label} wanted?", max_take, self, diplomacy_faction); + } + }; + } + if (trader_disp < trade_disp) { + _option.disabled = true; + _option.tooltip = $"{trade_disp} disposition required"; + } + //_option.bind_scope = _option; + array_push(demand_options, _option); + }; + + trader_disp = obj_controller.disposition[diplomacy_faction]; + + trade_req = obj_controller.requisition; + trade_gene = obj_controller.gene_seed; + trade_chip = obj_controller.stc_wargear_un + obj_controller.stc_vehicles_un + obj_controller.stc_ships_un; + trade_info = obj_controller.info_chips; + + switch (diplomacy_faction) { + case 2: + new_demand_buttons(0, "Requisition", "req"); + new_demand_buttons(0, "Recruiting Planet", "license", 1); + new_demand_buttons(0, "License: Repair", "license", 1); + new_demand_buttons(0, "License: Crusade", "license", 1); + break; + case 3: + new_demand_buttons(35, "Terminator Armour", "equip", 5); + new_demand_buttons(20, "Land Raider", "vehic", 1); + new_demand_buttons(40, "Minor Artifact", "arti", 1); + new_demand_buttons(25, "Skitarii", "merc", 200); + new_demand_buttons(55, "Techpriest", "merc", 3); + break; + case 4: + new_demand_buttons(30, "Hellrifle", "equip", 3); + new_demand_buttons(20, "Incinerator", "equip", 10); + new_demand_buttons(25, "Crusader", "merc", 5); + new_demand_buttons(40, "Exterminatus", "equip", 1); + new_demand_buttons(60, "Cyclonic Torpedo", "equip", 1); + break; + case 5: + new_demand_buttons(20, "Eviscerator", "equip", 10); + new_demand_buttons(30, "Heavy", "equip", 10); + //new_demand_buttons(30, "Inferno Bolts", "equip"); + new_demand_buttons(40, "Sister of Battle", "merc", 5); + new_demand_buttons(45, "Sister Hospitaler", "merc", 3); + break; + case 6: + new_demand_buttons(-10, "Master Crafted Power Sword", "equip", 3); + new_demand_buttons(-10, "Archeotech Laspistol", "equip", 1); + new_demand_buttons(10, "Ranger", "merc", 3); + new_demand_buttons(-15, "Useful Information", "license", 1); + break; + case 7: + new_demand_buttons(-100, "Power Klaw", "equip", 10); + new_demand_buttons(-100, "Ork Sniper", "merc", 50); + new_demand_buttons(-100, "Flash Git", "merc", 50); + break; + } + + static new_offer_option = function(trade_disp = -100, name, trade_type, max_count = 1) { + var _option = new UnitButtonObject({ + label: name, + number: 0, + max_number: max_count, + disp: trade_disp, + trade_type: trade_type, + number_last: 0, + diplomacy_faction, + }); + with (_option) { + bind_method = function() { + if (max_number == 1) { + number = 1; + } else { + get_diag_integer($"{label} offered?", max_number, self, diplomacy_faction); + } + }; + } + array_push(offer_options, _option); + }; + + if (obj_controller.requisition > 0) { + new_offer_option(, "Requisition", "req", obj_controller.requisition); + } + + if (obj_controller.gene_seed > 0) { + new_offer_option(, "Gene Seed", "gene", obj_controller.gene_seed); + } + + if (trade_chip > 0) { + new_offer_option(, "STC Fragment", "stc", trade_chip); + } + if (trade_info > 0) { + new_offer_option(, "Info Chip", "info", trade_info); + } + + if (has_faction_favour(diplomacy_faction)) { + new_offer_option(, "IOU", "favour", trade_info); + } + + static draw_trade_screen = function() { + recalc_values = false; draw_set_color(CM_GREEN_COLOR); - draw_rectangle(342,326,486,673,1); - draw_rectangle(343,327,485,672,1);// Left Main Panel - draw_rectangle(504,371,741,641,1); - draw_rectangle(505,372,740,640,1);// Center panel - draw_rectangle(759,326,903,673,1); - draw_rectangle(760,327,902,672,1);// Right Main Panel - - draw_rectangle(342,326,486,371,1);// Left Title Panel - draw_rectangle(759,326,903,371,1);// Right Title Panel - + draw_rectangle(342, 326, 486, 673, 1); + draw_rectangle(343, 327, 485, 672, 1); // Left Main Panel + draw_rectangle(504, 371, 741, 641, 1); + draw_rectangle(505, 372, 740, 640, 1); // Center panel + draw_rectangle(759, 326, 903, 673, 1); + draw_rectangle(760, 327, 902, 672, 1); // Right Main Panel + + draw_rectangle(342, 326, 486, 371, 1); // Left Title Panel + draw_rectangle(759, 326, 903, 371, 1); // Right Title Panel + draw_set_font(fnt_40k_14b); draw_set_halign(fa_center); - draw_text(411,330,$"{obj_controller.faction[diplomacy_faction]}\nItems"); - draw_text(829,330,$"{global.chapter_name}\nItems"); - - if (trade_likely!="") then draw_text(623,348,$"[{trade_likely}]"); + draw_text(411, 330, $"{obj_controller.faction[diplomacy_faction]}\nItems"); + draw_text(829, 330, $"{global.chapter_name}\nItems"); + + if (trade_likely != "") { + draw_text(623, 348, $"[{trade_likely}]"); + } clear_button.draw(); offer_button.draw(); exit_button.draw(); - + draw_set_halign(fa_left); draw_set_font(fnt_40k_14); draw_set_color(CM_GREEN_COLOR); var _requested_count = 0; //if (obj_controller.trading_artifact = 0){ - for (var i=0;i 0){ - var _y_offset = 399 + (_requested_count * 20); - draw_sprite(spr_cancel_small,0,507,_y_offset); - if (point_and_click_sprite(507,_y_offset, spr_cancel_small)){ - _opt.number = 0; - recalc_values = true;; - } - - if (_opt.max_take > 1){ - draw_text(530,_y_offset,$"{_opt.label} : {_opt.number}"); - } else { - draw_text(530,_y_offset,$"{_opt.label}"); - } - _requested_count++; - } - } - //} - - var _requested_count = 0; - draw_text(507,529,$"{global.chapter_name}:"); - for (var i=0;i 0){ - var _y_offset = 547 + (_requested_count * 20); - draw_sprite(spr_cancel_small,0,507,_y_offset); - if (point_and_click_sprite(507,_y_offset, spr_cancel_small)){ - _opt.number = 0; - recalc_values = true;; - } - if (_opt.max_number > 1){ - draw_text(530,_y_offset,$"{_opt.label} : {_opt.number}"); - } else { - draw_text(530,_y_offset,$"{_opt.label}"); - } - _requested_count++; - } + for (var i = 0; i < array_length(demand_options); i++) { + var _opt = demand_options[i]; + if (_opt.number != _opt.number_last) { + recalc_values = true; + } + _opt.x1 = 347; + _opt.y1 = 382 + i * 48; + _opt.update_loc(); + _opt.number_last = _opt.number; + var _allow_click = _opt.disp <= trader_disp; + _opt.draw(_allow_click); + if (_opt.number > 0) { + var _y_offset = 399 + (_requested_count * 20); + draw_sprite(spr_cancel_small, 0, 507, _y_offset); + if (point_and_click_sprite(507, _y_offset, spr_cancel_small)) { + _opt.number = 0; + recalc_values = true; + } + + if (_opt.max_take > 1) { + draw_text(530, _y_offset, $"{_opt.label} : {_opt.number}"); + } else { + draw_text(530, _y_offset, $"{_opt.label}"); + } + _requested_count++; + } + } + //} + + var _requested_count = 0; + draw_text(507, 529, $"{global.chapter_name}:"); + for (var i = 0; i < array_length(offer_options); i++) { + var _opt = offer_options[i]; + if (_opt.number != _opt.number_last) { + recalc_values = true; + } + _opt.x1 = 347 + 419; + _opt.y1 = 382 + i * 48; + _opt.update_loc(); + _opt.draw(); + _opt.number_last = _opt.number; + if (_opt.number > 0) { + var _y_offset = 547 + (_requested_count * 20); + draw_sprite(spr_cancel_small, 0, 507, _y_offset); + if (point_and_click_sprite(507, _y_offset, spr_cancel_small)) { + _opt.number = 0; + recalc_values = true; + } + if (_opt.max_number > 1) { + draw_text(530, _y_offset, $"{_opt.label} : {_opt.number}"); + } else { + draw_text(530, _y_offset, $"{_opt.label}"); + } + _requested_count++; + } + } + + if (recalc_values) { + calculate_deal_chance(); + } + }; + + var _info_val = 0; + with (obj_controller) { + if ((random_event_next != eEVENT.none) && ((string_count("WL10|", useful_info) > 0) || (turn < chaos_turn)) && ((string_count("WL7|", useful_info) > 0) || (known[eFACTION.Ork] < 1)) && (string_count("WG|", useful_info) > 1) && (string_count("CM|", useful_info) > 0)) { + _info_val = 1000; + } + } + information_value = _info_val; + + static calculate_trader_trade_value = function() { + their_worth = 100; + + for (var i = 0; i < array_length(demand_options); i++) { + var _opt = demand_options[i]; + + if (_opt.number > 0 && struct_exists(relative_trade_values, _opt.label)) { + their_worth += _opt.number * relative_trade_values[$ _opt.label]; + if (_opt.label == "Artifact") { + var _faction_barrier = 0; + switch (diplomacy_faction) { + case 2: + _faction_barrier = 300; + break; + case 3: + _faction_barrier = 800; + break; + case 4: + _faction_barrier = 600; + break; + case 5: + _faction_barrier = 500; + break; + } + if (diplomacy_faction < 5) { + _faction_barrier = 1200; + } + their_worth += _faction_barrier; + } + } + } + }; + + static calculate_player_trade_value = function() { + my_worth = 0; + for (var i = 0; i < array_length(offer_options); i++) { + var _opt = offer_options[i]; + if (_opt.number <= 0) { + continue; + } + if (_opt.label == "Requisition") { + my_worth += _opt.number; + } else if (_opt.label == "Gene-Seed") { + if ((diplomacy_faction == 3) || (diplomacy_faction == 4)) { + my_worth += _opt.number * 30; + } + if ((diplomacy_faction == 2) || (diplomacy_faction == 5)) { + my_worth += _opt.number * 20; + } + if ((diplomacy_faction == 8) || (diplomacy_faction == 10)) { + my_worth += _opt.number * 50; + } + } else if (_opt.label == "Info Chip") { + if (diplomacy_faction == eFACTION.Mechanicus) { + my_worth += _opt.number * 100; // 20% bonus + } else { + my_worth += _opt.number * 80; + } + my_worth += _opt.number * 80; + } + + if (_opt.label == "STC Fragment") { + if (diplomacy_faction == 2) { + my_worth += _opt.number * 900; + } + if (diplomacy_faction == 3) { + my_worth += _opt.number * 1000; + } + if (diplomacy_faction == 4) { + my_worth += _opt.number * 1000; + } + if (diplomacy_faction == 5) { + my_worth += _opt.number * 900; + } + if (diplomacy_faction == 10) { + my_worth += _opt.number * 900; + } + + if (diplomacy_faction == 6) { + my_worth += _opt.number * 500; + } + if (diplomacy_faction == 7) { + my_worth += _opt.number * 500; + } + if (diplomacy_faction == 8) { + my_worth += _opt.number * 1000; + } + } + } + }; + + trade_likely = ""; + static chance_chart = ["Impossible", "Very Unlikely", "Unlikely", "Moderate Chance", "Likely", "Very Likely", "Unrefusable"]; + + static calculate_deal_chance = function() { + var def_penalty = 0; + var penalty = 0; + calculate_player_trade_value(); + calculate_trader_trade_value(); + + if (diplomacy_faction == 2) { + dif_penalty = 0.4; + penalty = 5; + } else if (diplomacy_faction == 3) { + dif_penalty = 0.6; + penalty = 5; + } else if (diplomacy_faction == 4) { + dif_penalty = 1; + penalty = 15; + } else if (diplomacy_faction == 5) { + dif_penalty = 0.8; + penalty = 0; + } else if (diplomacy_faction == 6) { + dif_penalty = 0.6; + penalty = 10; + } else if (diplomacy_faction == 7) { + dif_penalty = 0.4; + penalty = 20; + } else if (diplomacy_faction == 8) { + dif_penalty = 0.4; + penalty = 0; + } else if (diplomacy_faction == 10) { + dif_penalty = 1; + penalty = 0; } - if (recalc_values){ - calculate_deal_chance(); - } - } - var _info_val = 0; - with (obj_controller){ - if (random_event_next != eEVENT.none) and ((string_count("WL10|",useful_info)>0) or (turn0) or (known[eFACTION.Ork]<1)) and (string_count("WG|",useful_info)>1) and (string_count("CM|",useful_info)>0){ - _info_val=1000; - } - } - information_value = _info_val; - - static calculate_trader_trade_value = function(){ - - their_worth = 100; - - for (var i=0;i 0 && struct_exists(relative_trade_values, _opt.label)){ - their_worth+=_opt.number*relative_trade_values[$ _opt.label]; - if (_opt.label=="Artifact"){ - var _faction_barrier = 0; - switch (diplomacy_faction){ - case 2: - _faction_barrier = 300; - break; - case 3: - _faction_barrier = 800; - break; - case 4: - _faction_barrier = 600; - break; - case 5: - _faction_barrier = 500; - break; - } - if (diplomacy_faction < 5){ - _faction_barrier = 1200 - } - their_worth += _faction_barrier; - } - } - } - } - - static calculate_player_trade_value = function(){ - my_worth = 0; - for (var i = 0; i < array_length(offer_options); i++) { - var _opt = offer_options[i] - if (_opt.number<=0){ - continue; - } - if (_opt.label="Requisition"){ - my_worth += _opt.number; - } - - else if (_opt.label="Gene-Seed") { - if (diplomacy_faction=3) or (diplomacy_faction=4) then my_worth+=_opt.number*30; - if (diplomacy_faction=2) or (diplomacy_faction=5) then my_worth+=_opt.number*20; - if (diplomacy_faction=8) or (diplomacy_faction=10) then my_worth+=_opt.number*50; - } - - else if (_opt.label="Info Chip"){ - if (diplomacy_faction == eFACTION.Mechanicus){ - my_worth+=_opt.number*100;// 20% bonus - } else { - my_worth+=_opt.number*80; - } - my_worth+=_opt.number*80; - } - - if (_opt.label="STC Fragment") { - if (diplomacy_faction=2) then my_worth+=_opt.number*900; - if (diplomacy_faction=3) then my_worth+=_opt.number*1000; - if (diplomacy_faction=4) then my_worth+=_opt.number*1000; - if (diplomacy_faction=5) then my_worth+=_opt.number*900; - if (diplomacy_faction=10) then my_worth+=_opt.number*900; - - if (diplomacy_faction=6) then my_worth+=_opt.number*500; - if (diplomacy_faction=7) then my_worth+=_opt.number*500; - if (diplomacy_faction=8){ - my_worth+=_opt.number*1000; - } - } - } - } - - trade_likely = ""; - static chance_chart = ["Impossible", "Very Unlikely","Unlikely","Moderate Chance","Likely","Very Likely","Unrefusable"]; - static calculate_deal_chance = function(){ - - var def_penalty=0; - var penalty=0; - calculate_player_trade_value(); - calculate_trader_trade_value(); - - if (diplomacy_faction=2){ - dif_penalty=0.4; - penalty=5; - }else if (diplomacy_faction=3){ - dif_penalty=0.6; - penalty=5; - }else if (diplomacy_faction=4){ - dif_penalty=1; - penalty=15; - }else if (diplomacy_faction=5){ - dif_penalty=0.8; - penalty=0; - }else if (diplomacy_faction=6){ - dif_penalty=0.6; - penalty=10; - }else if (diplomacy_faction=7){ - dif_penalty=0.4; - penalty=20; - }else if (diplomacy_faction=8){ - dif_penalty=0.4; - penalty=0; - }else if (diplomacy_faction=10){ - dif_penalty=1; - penalty=0; - } - - deal_chance=(100-penalty)-(((their_worth-(my_worth*dif_penalty)))); - //show_debug_message($"{their_worth},{my_worth},{deal_chance}"); - var _chance = clamp(floor((deal_chance/20)), 0, 6); - - trade_likely = chance_chart[_chance]; - } + deal_chance = (100 - penalty) - (their_worth - (my_worth * dif_penalty)); + //show_debug_message($"{their_worth},{my_worth},{deal_chance}"); + var _chance = clamp(floor((deal_chance / 20)), 0, 6); + trade_likely = chance_chart[_chance]; + }; } - diff --git a/scripts/scr_ui_advisors/scr_ui_advisors.gml b/scripts/scr_ui_advisors/scr_ui_advisors.gml index 3073d82067..b2527d8e25 100644 --- a/scripts/scr_ui_advisors/scr_ui_advisors.gml +++ b/scripts/scr_ui_advisors/scr_ui_advisors.gml @@ -1,6 +1,5 @@ /// @mixin obj_controller function scr_ui_advisors() { - var xx, yy, blurp, eta, va; var romanNumerals; romanNumerals = scr_roman_numerals(); @@ -13,18 +12,15 @@ function scr_ui_advisors() { // This script draws all of the ADVISOR screens // ** Fleet ** - if (menu = eMENU.Fleet) { + if (menu == eMENU.Fleet) { scr_fleet_advisor(); - } - - - // ** Apothecarium ** - else if (menu = eMENU.Apothecarion) { + } else // ** Apothecarium ** + if (menu == eMENU.Apothecarion) { scr_apothecarium(); } // ** Reclusium ** - if ((floor(menu) == eMENU.Reclusiam)) { + if (floor(menu) == eMENU.Reclusiam) { draw_sprite(spr_rock_bg, 0, xx, yy); draw_set_alpha(0.75); @@ -42,9 +38,9 @@ function scr_ui_advisors() { draw_set_color(c_gray); draw_rectangle(xx + 945, yy + 66, xx + 1580, yy + 818, 1); - if (menu_adept = 0) { + if (menu_adept == 0) { // draw_sprite(spr_advisors,2,xx+16,yy+43); - if(struct_exists(obj_ini.custom_advisors, "chaplain")){ + if (struct_exists(obj_ini.custom_advisors, "chaplain")) { scr_image("advisor/splash", obj_ini.custom_advisors.chaplain, xx + 16, yy + 43, 310, 828); } else { scr_image("advisor/splash", 3, xx + 16, yy + 43, 310, 828); @@ -55,9 +51,9 @@ function scr_ui_advisors() { draw_set_color(c_gray); draw_set_font(fnt_40k_30b); draw_text_transformed(xx + 336 + 16, yy + 66, "Reclusium", 1, 1, 0); - draw_text_transformed(xx + 336 + 16, yy + 100, string_hash_to_newline("Master of Sanctity " + string(obj_ini.name[0, 2])), 0.6, 0.6, 0); + draw_text_transformed(xx + 336 + 16, yy + 100, string_hash_to_newline("Master of Sanctity " + string(obj_ini.name[0][2])), 0.6, 0.6, 0); } - if (menu_adept = 1) { + if (menu_adept == 1) { // draw_sprite(spr_advisors,0,xx+16,yy+43); scr_image("advisor/splash", 1, xx + 16, yy + 43, 310, 828); draw_set_halign(fa_left); @@ -70,42 +66,59 @@ function scr_ui_advisors() { draw_set_font(fnt_40k_14); draw_set_alpha(1); draw_set_color(c_gray); - if (temp[36] != "0") then blurp = $"Sir! You requested a report? Currently, we have deployed {temp[36]} {obj_ini.role[100, 14]}s to watch over the health of our Battle-Brothers in the field. We have an additional " + string(temp[37]) + " " + string(obj_ini.role[100, 14]) + "s who await only your order to carry the word to the troops."; - if (temp[36] = "0") then blurp = "Sir! You requested a report? Currently, we have {temp[37]} {obj_ini.role[100, 14]}s who await only your order to carry the word to the troops."; - // - if (global.chapter_name != "Space Wolves") and(global.chapter_name != "Iron Hands") { - blurp += "##Currently, we are training additional " + string(obj_ini.role[100, 14]) + " at a "; + if (temp[36] != "0") { + blurp = $"Sir! You requested a report? Currently, we have deployed {temp[36]} {obj_ini.role[100][14]}s to watch over the health of our Battle-Brothers in the field. We have an additional " + string(temp[37]) + " " + string(obj_ini.role[100][14]) + "s who await only your order to carry the word to the troops."; + } + if (temp[36] == "0") { + blurp = "Sir! You requested a report? Currently, we have {temp[37]} {obj_ini.role[100, 14]}s who await only your order to carry the word to the troops."; + } + // + if ((global.chapter_name != "Space Wolves") && (global.chapter_name != "Iron Hands")) { + blurp += "##Currently, we are training additional " + string(obj_ini.role[100][14]) + " at a "; var _recruit_rates = ARR_recruitment_rates; blurp += _recruit_rates[training_chaplain]; - if (training_chaplain>0 && training_chaplain <=6) { + if (training_chaplain > 0 && training_chaplain <= 6) { var training_points_values = ARR_chaplain_training_tiers; eta = floor((47 - chaplain_points) / training_points_values[training_chaplain]) + 1; } - // + // blurp += " rate"; - if (training_chaplain > 0) then blurp += " and expect to see a new one in " + string(eta) + " month's time."; - if (training_chaplain < 5) then blurp += "We can increase this rate, but it will require us to requisition additional facilities, as well as upkeep, Sir."; - if (penitorium = 0) then blurp += "##Our men have been behaving as they should. Not a single one is scheduled for corrective action of any type."; + if (training_chaplain > 0) { + blurp += " and expect to see a new one in " + string(eta) + " month's time."; + } + if (training_chaplain < 5) { + blurp += "We can increase this rate, but it will require us to requisition additional facilities, as well as upkeep, Sir."; + } + if (penitorium == 0) { + blurp += "##Our men have been behaving as they should. Not a single one is scheduled for corrective action of any type."; + } draw_set_font(fnt_40k_30b); draw_set_halign(fa_center); - if (menu == eMENU.Reclusiam){ + if (menu == eMENU.Reclusiam) { draw_text_transformed(xx + 1262, yy + 70, "Penitorium", 0.6, 0.6, 0); } - if (menu = 12.1) then draw_text_transformed(xx + 1262, yy + 70, "Scheduling Event", 0.6, 0.6, 0); + if (menu == 12.1) { + draw_text_transformed(xx + 1262, yy + 70, "Scheduling Event", 0.6, 0.6, 0); + } - if (penitorium > 0) and(menu != 12.1) { + if ((penitorium > 0) && (menu != 12.1)) { draw_set_font(fnt_40k_14); draw_set_halign(fa_left); - var behav = 0, - r_eta = 0,unit; + var behav = 0, r_eta = 0, unit; for (var qp = 1; qp <= min(36, penitorium); qp++) { unit = obj_ini.TTRPG[penit_co[qp]][penit_id[qp]]; - if (unit.corruption > 0) then r_eta = round((unit.corruption * unit.corruption) / 50); - if (unit.corruption >= 90) then r_eta = "Never"; - if (unit.corruption <= 0) then r_eta = "0"; + if (unit.corruption > 0) { + r_eta = round((unit.corruption * unit.corruption) / 50); + } + if (unit.corruption >= 90) { + r_eta = "Never"; + } + if (unit.corruption <= 0) { + r_eta = "0"; + } draw_rectangle(xx + 947, yy + 100 + ((qp - 1) * 20), xx + 1577, yy + 100 + (qp * 20), 1); draw_text(xx + 950, yy + 100 + ((qp - 1) * 20), string_hash_to_newline(unit.name_role())); draw_text(xx + 1200, yy + 100 + ((qp - 1) * 20), string_hash_to_newline("ETA: " + string(r_eta))); @@ -119,15 +132,17 @@ function scr_ui_advisors() { draw_set_alpha(1); draw_set_color(c_gray); - if (menu_adept = 1) { - blurp = "Your Chapter contains " + string(temp[36]) + " " + string(obj_ini.role[100, 14]) + "s.##"; - if (global.chapter_name != "Space Wolves") and(global.chapter_name != "Iron Hands") { - blurp += "Training of further " + string(obj_ini.role[100, 14]) + "s"; - if (training_chaplain >= 0 && training_chaplain <= 6){ + if (menu_adept == 1) { + blurp = "Your Chapter contains " + string(temp[36]) + " " + string(obj_ini.role[100][14]) + "s.##"; + if ((global.chapter_name != "Space Wolves") && (global.chapter_name != "Iron Hands")) { + blurp += "Training of further " + string(obj_ini.role[100][14]) + "s"; + if (training_chaplain >= 0 && training_chaplain <= 6) { var _recruit_pace = ARR_recruitment_pace; blurp += _recruit_pace[training_chaplain]; } - if (training_chaplain > 0) then blurp += " The next " + string(obj_ini.role[100, 14]) + " is expected in " + string(eta) + " months."; + if (training_chaplain > 0) { + blurp += " The next " + string(obj_ini.role[100][14]) + " is expected in " + string(eta) + " months."; + } } } @@ -144,86 +159,169 @@ function scr_ui_advisors() { var blurp2 = ""; // TODO rename fest_type and fest_scheduled into feast_type and feast_schedule and refactor scripts - if (menu_adept = 0) { - if (fest_scheduled = 0) { - if (global.chapter_name != "Space Wolves") and(global.chapter_name != "Iron Hands") then blurp2 = "As our bolters are charged with death for the Emperor's enemies, our thoughts are charged with his wisdom. As our bodies are armoured with Adamantium, our souls are protected with our loyalty- loyalty to Him, and loyalty to our brothers. The bonds of this brotherhood are worth revering, even if a lull in duty invites doubt and heresy. Should you wish to schedule a rousing event, or challenge, I will make it so. Under the careful watch of our " + string(obj_ini.role[100, 14]) + "s, our brothers' spirits may be lifted."; - if (global.chapter_name = "Space Wolves") then blurp2 = ""; - if (global.chapter_name = "Iron Hands") then blurp2 = ""; + if (menu_adept == 0) { + if (fest_scheduled == 0) { + if ((global.chapter_name != "Space Wolves") && (global.chapter_name != "Iron Hands")) { + blurp2 = "As our bolters are charged with death for the Emperor's enemies, our thoughts are charged with his wisdom. As our bodies are armoured with Adamantium, our souls are protected with our loyalty- loyalty to Him, and loyalty to our brothers. The bonds of this brotherhood are worth revering, even if a lull in duty invites doubt and heresy. Should you wish to schedule a rousing event, or challenge, I will make it so. Under the careful watch of our " + string(obj_ini.role[100][14]) + "s, our brothers' spirits may be lifted."; + } + if (global.chapter_name == "Space Wolves") { + blurp2 = ""; + } + if (global.chapter_name == "Iron Hands") { + blurp2 = ""; + } } - if (fest_scheduled = 1) { - if (fest_type != "Chapter Relic") then blurp2 = "A " + string(fest_type) + " has been scheduled on "; - if (fest_type = "Chapter Relic") then blurp2 = "Chapter Relic construction has been scheduled on "; + if (fest_scheduled == 1) { + if (fest_type != "Chapter Relic") { + blurp2 = "A " + string(fest_type) + " has been scheduled on "; + } + if (fest_type == "Chapter Relic") { + blurp2 = "Chapter Relic construction has been scheduled on "; + } - if (fest_planet = 0) then blurp2 += string(obj_ini.ship[fest_sid]); - if (fest_planet > 0) then blurp2 += string(fest_star) + " " + scr_roman(fest_wid); + if (fest_planet == 0) { + blurp2 += string(obj_ini.ship[fest_sid]); + } + if (fest_planet > 0) { + blurp2 += string(fest_star) + " " + scr_roman(fest_wid); + } - if (fest_honoring = 0) then blurp2 += ". "; - if (fest_honoring = 1) then blurp2 += " in your name. "; + if (fest_honoring == 0) { + blurp2 += ". "; + } + if (fest_honoring == 1) { + blurp2 += " in your name. "; + } // Specific company - if (fest_honoring = 2) { + if (fest_honoring == 2) { blurp2 += " in honor of the "; } - if (fest_honoring = 3) { + if (fest_honoring == 3) { blurp2 += " in honor of "; - blurp2 += string(obj_ini.role[fest_honor_co, fest_honor_id]) + " "; - blurp2 += string(obj_ini.name[fest_honor_co, fest_honor_id]) + " (" + romanNumerals[fest_honor_co] + " Company). "; + blurp2 += string(obj_ini.role[fest_honor_co][fest_honor_id]) + " "; + blurp2 += string(obj_ini.name[fest_honor_co][fest_honor_id]) + " (" + romanNumerals[fest_honor_co] + " Company). "; } - if (fest_honoring = 4) { // faction + if (fest_honoring == 4) { + // faction blurp2 += ", honoring "; } - if (fest_honoring = 5) then blurp2 += ", giving praise to The Emperor. "; - if (fest_honoring = 6) then blurp2 += " to honor our chapter. "; + if (fest_honoring == 5) { + blurp2 += ", giving praise to The Emperor. "; + } + if (fest_honoring == 6) { + blurp2 += " to honor our chapter. "; + } - if (fest_lav <= 1) then blurp2 += "Very little requisiton has been set aside for the event"; - if (fest_lav = 2) then blurp2 += "A minor amount of requisition has been dedicated for the event"; - if (fest_lav = 3) then blurp2 += "Moderate expenses are being made for the event"; - if (fest_lav = 4) then blurp2 += "A great amount of requisiton is set aside for the event"; - if (fest_lav = 5) then blurp2 += "The event is set to be lavish and excessive, with maximum requisition spent"; + if (fest_lav <= 1) { + blurp2 += "Very little requisiton has been set aside for the event"; + } + if (fest_lav == 2) { + blurp2 += "A minor amount of requisition has been dedicated for the event"; + } + if (fest_lav == 3) { + blurp2 += "Moderate expenses are being made for the event"; + } + if (fest_lav == 4) { + blurp2 += "A great amount of requisiton is set aside for the event"; + } + if (fest_lav == 5) { + blurp2 += "The event is set to be lavish and excessive, with maximum requisition spent"; + } - if (fest_repeats <= 1) then blurp2 += ". It is set to run for " + string(fest_repeats) + " month."; - if (fest_repeats > 1) then blurp2 += ". It is set to run for " + string(fest_repeats) + " months."; + if (fest_repeats <= 1) { + blurp2 += ". It is set to run for " + string(fest_repeats) + " month."; + } + if (fest_repeats > 1) { + blurp2 += ". It is set to run for " + string(fest_repeats) + " months."; + } - if (fest_type = "Great Feast") { - if (fest_feature1 = 1) and(fest_feature2 + fest_feature3 = 0) then blurp2 += " The feast will be made up entirely of a banquet."; - if (fest_feature1 = 1) and(fest_feature2 + fest_feature3 > 0) { + if (fest_type == "Great Feast") { + if ((fest_feature1 == 1) && (fest_feature2 + fest_feature3 == 0)) { + blurp2 += " The feast will be made up entirely of a banquet."; + } + if ((fest_feature1 == 1) && (fest_feature2 + fest_feature3 > 0)) { blurp2 += " The feast will primarily be made up of a banquet, although "; - if (fest_feature2 + fest_feature3 = 2) then blurp2 += "drugs and alcohol will be present for those who wish to partake."; - if (fest_feature2 = 1) and(fest_feature3 = 0) then blurp2 += "alcohol will also be present."; - if (fest_feature2 = 0) and(fest_feature3 = 1) then blurp2 += "drugs will also be present."; + if (fest_feature2 + fest_feature3 == 2) { + blurp2 += "drugs and alcohol will be present for those who wish to partake."; + } + if ((fest_feature2 == 1) && (fest_feature3 == 0)) { + blurp2 += "alcohol will also be present."; + } + if ((fest_feature2 == 0) && (fest_feature3 == 1)) { + blurp2 += "drugs will also be present."; + } } - if (fest_feature1 = 0) { - if (fest_feature2 = 1) and(fest_feature3 = 0) then blurp2 = " The feast will only be such in name, and actually primarily be composed of alcohol consumption and roudy behavior."; - if (fest_feature2 = 0) and(fest_feature3 = 1) then blurp2 = " The feast will only be such in name, and actually primarily be composed of lines of drugs and roudy behavior."; + if (fest_feature1 == 0) { + if ((fest_feature2 == 1) && (fest_feature3 == 0)) { + blurp2 = " The feast will only be such in name, and actually primarily be composed of alcohol consumption and roudy behavior."; + } + if ((fest_feature2 == 0) && (fest_feature3 == 1)) { + blurp2 = " The feast will only be such in name, and actually primarily be composed of lines of drugs and roudy behavior."; + } } } - if (fest_type = "Tournament") { - if (fest_feature3 = 1) then blurp2 += " Other Chapters have been invited to partake in the event, although it is not known who, if any, might show."; - if (fest_feature2 = 1) then blurp2 += " Spectators are encouraged, with efforts made to keep attending simple."; + if (fest_type == "Tournament") { + if (fest_feature3 == 1) { + blurp2 += " Other Chapters have been invited to partake in the event, although it is not known who, if any, might show."; + } + if (fest_feature2 == 1) { + blurp2 += " Spectators are encouraged, with efforts made to keep attending simple."; + } } - if (fest_type = "Deathmatch") { - if (fest_feature2 = 1) then blurp2 += " Spectators are encouraged, with efforts made to keep attending simple."; - if (fest_feature3 = 1) then blurp2 += " Smaller, similar deathmatches will be held for Imperial citizens who wish to partake."; + if (fest_type == "Deathmatch") { + if (fest_feature2 == 1) { + blurp2 += " Spectators are encouraged, with efforts made to keep attending simple."; + } + if (fest_feature3 == 1) { + blurp2 += " Smaller, similar deathmatches will be held for Imperial citizens who wish to partake."; + } } - if (fest_type = "Chapter Relic") { - if (fest_feature1 = 1) then blurp2 += " Our " + string(obj_ini.role[100, 16]) + "s aim to create a weapon."; - if (fest_feature2 = 1) then blurp2 += " Our " + string(obj_ini.role[100, 16]) + "s aim to create a suit of armour."; - if (fest_feature3 = 1) then blurp2 += " Our " + string(obj_ini.role[100, 16]) + "s aim to hone and strengthen an already existing relic."; + if (fest_type == "Chapter Relic") { + if (fest_feature1 == 1) { + blurp2 += " Our " + string(obj_ini.role[100][16]) + "s aim to create a weapon."; + } + if (fest_feature2 == 1) { + blurp2 += " Our " + string(obj_ini.role[100][16]) + "s aim to create a suit of armour."; + } + if (fest_feature3 == 1) { + blurp2 += " Our " + string(obj_ini.role[100][16]) + "s aim to hone and strengthen an already existing relic."; + } } - if (fest_type = "Imperial Mass") { - if (fest_feature2 = 1) then blurp2 += " An Ecclesiarchy priest has been requested to lead the sermons."; - if (fest_feature3 = 1) then blurp2 += " Adepta Sororita presence has been requested, to share in praising the Emperor."; + if (fest_type == "Imperial Mass") { + if (fest_feature2 == 1) { + blurp2 += " An Ecclesiarchy priest has been requested to lead the sermons."; + } + if (fest_feature3 == 1) { + blurp2 += " Adepta Sororita presence has been requested, to share in praising the Emperor."; + } } - if (fest_type = "Chapter Sermon") { - if (fest_feature1 = 1) and(fest_feature2 + fest_feature3 = 0) then blurp2 += " The Chapter Cult Sermon is pointedly sanctioned within the bounds of the Codex Astartes and Imperial tradition."; - if (fest_feature1 = 0) and(fest_feature2 + fest_feature3 = 0) then blurp2 += " The Chapter Cult Sermon contains some radical or questionable practices, but such is allowed, as our traditions."; - if (fest_feature2 = 1) then blurp2 += " Blood sacrifices are a primary focus with the sermon, celebrating martial prowess and our semi-divinity."; - if (fest_feature2 > 0) and(fest_feature3 = 1) then blurp2 += " Drugs will also be present for the ceremony."; - if (fest_feature2 = 0) and(fest_feature3 > 1) then blurp2 += " Mind-altering drugs will be a primary focus of the sermon."; + if (fest_type == "Chapter Sermon") { + if ((fest_feature1 == 1) && (fest_feature2 + fest_feature3 == 0)) { + blurp2 += " The Chapter Cult Sermon is pointedly sanctioned within the bounds of the Codex Astartes and Imperial tradition."; + } + if ((fest_feature1 == 0) && (fest_feature2 + fest_feature3 == 0)) { + blurp2 += " The Chapter Cult Sermon contains some radical or questionable practices, but such is allowed, as our traditions."; + } + if (fest_feature2 == 1) { + blurp2 += " Blood sacrifices are a primary focus with the sermon, celebrating martial prowess and our semi-divinity."; + } + if ((fest_feature2 > 0) && (fest_feature3 == 1)) { + blurp2 += " Drugs will also be present for the ceremony."; + } + if ((fest_feature2 == 0) && (fest_feature3 > 1)) { + blurp2 += " Mind-altering drugs will be a primary focus of the sermon."; + } } - if (fest_type = "Triumphal March") { - if (fest_feature1 = 1) then blurp2 += " Local Imperials will be required to attend our march- those that attempt to avoid our revelry are clearly heretics and will be dealt with as such."; - if (fest_feature2 = 1) then blurp2 += " Cadences and battle cries will honor our closest allies, giving them due credit where it is needed."; - if (fest_feature3 = 1) then blurp2 += " Bloody trophies of our conquests will be brandished to the populance."; + if (fest_type == "Triumphal March") { + if (fest_feature1 == 1) { + blurp2 += " Local Imperials will be required to attend our march- those that attempt to avoid our revelry are clearly heretics and will be dealt with as such."; + } + if (fest_feature2 == 1) { + blurp2 += " Cadences and battle cries will honor our closest allies, giving them due credit where it is needed."; + } + if (fest_feature3 == 1) { + blurp2 += " Bloody trophies of our conquests will be brandished to the populance."; + } } } } @@ -232,7 +330,7 @@ function scr_ui_advisors() { // draw_set_alpha(1);if (obj_controller.gene_seed<=0) or (obj_ini.zygote=1) then draw_set_alpha(0.5); -/* if (menu = 12.1) or(fest_sid + fest_wid > 0) then draw_set_alpha(0.25); + /* if (menu = 12.1) or(fest_sid + fest_wid > 0) then draw_set_alpha(0.25); draw_set_color(c_gray); draw_rectangle(xx + 560, yy + 780, xx + 682, yy + 805, 0); draw_set_alpha(1); @@ -284,7 +382,7 @@ function scr_ui_advisors() { draw_set_alpha(1); draw_set_font(fnt_40k_14); - if (menu = 12.1) { + if (menu == 12.1) { var che, cx, cy; draw_set_font(fnt_40k_14b); draw_set_color(c_gray); @@ -303,11 +401,17 @@ function scr_ui_advisors() { draw_set_font(fnt_40k_14); // Attendees - if (fest_attend != "") then draw_text_ext(xx + 962, yy + 550, string_hash_to_newline(string(fest_attend)), -1, 612); + if (fest_attend != "") { + draw_text_ext(xx + 962, yy + 550, string_hash_to_newline(string(fest_attend)), -1, 612); + } // Location type - if (fest_planet != 1) then che = 1; - if (fest_planet = 1) then che = 2; + if (fest_planet != 1) { + che = 1; + } + if (fest_planet == 1) { + che = 2; + } cx = xx + 990; cy = yy + 212; @@ -320,22 +424,30 @@ function scr_ui_advisors() { draw_sprite(spr_creation_check, che + 1, cx, cy); draw_set_alpha(1); // if (scr_hit(cx+31,cy,cx+260,cy+20)=true){tool1="Planet";tool2="Allows the use of vehicles, and bikes, but prevents this formation from being used during Raids.";} - if (scr_hit(cx, cy, cx + 32, cy + 32) = true) and(scr_click_left()) and(dropdown_open = 0) { + if ((scr_hit(cx, cy, cx + 32, cy + 32) == true) && scr_click_left() && (dropdown_open == 0)) { var onceh = 0; - if (onceh = 0) and((fest_planet = 0)) { + if ((onceh == 0) && (fest_planet == 0)) { onceh = 1; fest_planet = 1; fest_sid = 0; fest_wid = 0; fest_star = ""; - with(obj_dropdown_sel) { - if (target = "event_loc") then option[1] = ""; + with (obj_dropdown_sel) { + if (target == "event_loc") { + option[1] = ""; + } } } } - if (fest_planet = 1) then che = 1; - if (fest_planet = 0) then che = 2; - if (fest_type = "Triumphal March") then draw_set_alpha(0.5); + if (fest_planet == 1) { + che = 1; + } + if (fest_planet == 0) { + che = 2; + } + if (fest_type == "Triumphal March") { + draw_set_alpha(0.5); + } cx = xx + 1100; cy = yy + 212; @@ -349,41 +461,56 @@ function scr_ui_advisors() { draw_set_alpha(1); // if (scr_hit(cx+31,cy,cx+260,cy+20)=true){tool1="Planet";tool2="Allows the use of vehicles, and bikes, but prevents this formation from being used during Raids.";} - if (scr_hit(cx, cy, cx + 32, cy + 32) = true) and(scr_click_left()) and(dropdown_open = 0) { + if ((scr_hit(cx, cy, cx + 32, cy + 32) == true) && scr_click_left() && (dropdown_open == 0)) { var onceh = 0; - if (onceh = 0) and(fest_planet = 1) and(fest_type != "Triumphal March") { + if ((onceh == 0) && (fest_planet == 1) && (fest_type != "Triumphal March")) { onceh = 1; fest_planet = 0; fest_sid = 0; fest_wid = 0; fest_star = ""; - with(obj_dropdown_sel) { - if (target = "event_loc") then option[1] = ""; + with (obj_dropdown_sel) { + if (target == "event_loc") { + option[1] = ""; + } } } } draw_set_alpha(1); // Features - var fet_text = "", - fet_scale = 1; + var fet_text = "", fet_scale = 1; - if (fest_type = "Great Feast") then fet_text = "Banquet"; - if (fest_type = "Tournament") then fet_text = "Internal"; - if (fest_type = "Deathmatch") then fet_text = "Chapter Only"; - if (fest_type = "Chapter Relic") then fet_text = "Create Wargear"; - if (fest_type = "Chapter Sermon") then fet_text = "Sanctioned"; - if (fest_type = "Imperial Mass") { + if (fest_type == "Great Feast") { + fet_text = "Banquet"; + } + if (fest_type == "Tournament") { + fet_text = "Internal"; + } + if (fest_type == "Deathmatch") { + fet_text = "Chapter Only"; + } + if (fest_type == "Chapter Relic") { + fet_text = "Create Wargear"; + } + if (fest_type == "Chapter Sermon") { + fet_text = "Sanctioned"; + } + if (fest_type == "Imperial Mass") { fet_text = "Local"; fet_scale = 1; } - if (fest_type = "Triumphal March") { + if (fest_type == "Triumphal March") { fet_text = "Mandatory Attendance"; fet_scale = 0.7; } - if (fest_feature1 = 0) then che = 1; - if (fest_feature1 = 1) then che = 2; + if (fest_feature1 == 0) { + che = 1; + } + if (fest_feature1 == 1) { + che = 2; + } cx = xx + 1068 + 22; cy = yy + 326; @@ -396,44 +523,62 @@ function scr_ui_advisors() { draw_sprite(spr_creation_check, che + 1, cx, cy); draw_set_alpha(1); // if (scr_hit(cx+31,cy,cx+260,cy+20)=true){tool1="Planet";tool2="Allows the use of vehicles, and bikes, but prevents this formation from being used during Raids.";} - if (scr_hit(cx, cy, cx + 32, cy + 32) = true) and(scr_click_left()) and(dropdown_open = 0) { + if ((scr_hit(cx, cy, cx + 32, cy + 32) == true) && scr_click_left() && (dropdown_open == 0)) { var onceh = 0; - if (fest_type = "Tournament") or(fest_type = "Deathmatch") then onceh = 1; - if (onceh = 0) and(fest_feature1 = 0) { + if ((fest_type == "Tournament") || (fest_type == "Deathmatch")) { + onceh = 1; + } + if ((onceh == 0) && (fest_feature1 == 0)) { onceh = 1; fest_feature1 = 1; } - if (onceh = 0) and(fest_feature1 = 1) and(fest_type != "Chapter Relic") { + if ((onceh == 0) && (fest_feature1 == 1) && (fest_type != "Chapter Relic")) { onceh = 1; fest_feature1 = 0; } - if (fest_type = "Chapter Relic") and(fest_feature1 = 1) { + if ((fest_type == "Chapter Relic") && (fest_feature1 == 1)) { fest_feature3 = 0; fest_feature2 = 0; } } - if (fest_type = "Tournament") or(fest_type = "Deathmatch") and(fest_feature1 = 0) then fest_feature1 = 1; + if ((fest_type == "Tournament") || (fest_type == "Deathmatch") && (fest_feature1 == 0)) { + fest_feature1 = 1; + } - if (fest_type = "Great Feast") then fet_text = "Alcohol"; - if (fest_type = "Tournament") then fet_text = "Spectators"; - if (fest_type = "Deathmatch") then fet_text = "Spectators"; - if (fest_type = "Chapter Relic") then fet_text = "Create Armour"; - if (fest_type = "Imperial Mass") { + if (fest_type == "Great Feast") { + fet_text = "Alcohol"; + } + if (fest_type == "Tournament") { + fet_text = "Spectators"; + } + if (fest_type == "Deathmatch") { + fet_text = "Spectators"; + } + if (fest_type == "Chapter Relic") { + fet_text = "Create Armour"; + } + if (fest_type == "Imperial Mass") { fet_text = "Request Ecclesiarchy"; fet_scale = 0.75; } - if (fest_type = "Chapter Sermon") { + if (fest_type == "Chapter Sermon") { fet_text = "Blood Sacrifices"; fet_scale = 0.75; } - if (fest_type = "Triumphal March") { + if (fest_type == "Triumphal March") { fet_text = "Honor to Allies"; fet_scale = 0.75; } - if (fest_feature2 = 0) then che = 1; - if (fest_feature2 = 1) then che = 2; - if (fest_type = "Imperial Mass") and(known[5] = 0) then draw_set_alpha(0.5); + if (fest_feature2 == 0) { + che = 1; + } + if (fest_feature2 == 1) { + che = 2; + } + if ((fest_type == "Imperial Mass") && (known[5] == 0)) { + draw_set_alpha(0.5); + } cx = xx + 1228 + 22; cy = yy + 326; @@ -444,46 +589,60 @@ function scr_ui_advisors() { draw_sprite(spr_creation_check, che + 1, cx, cy); draw_set_alpha(1); // if (scr_hit(cx+31,cy,cx+260,cy+20)=true){tool1="Planet";tool2="Allows the use of vehicles, and bikes, but prevents this formation from being used during Raids.";} - if (scr_hit(cx, cy, cx + 32, cy + 32) = true) and(scr_click_left()) and(dropdown_open = 0) { + if ((scr_hit(cx, cy, cx + 32, cy + 32) == true) && scr_click_left() && (dropdown_open == 0)) { var onceh = 0; - if (fest_type = "Imperial Mass") and(known[5] = 0) then onceh = 1; - if (onceh = 0) and(fest_feature2 = 0) { + if ((fest_type == "Imperial Mass") && (known[5] == 0)) { + onceh = 1; + } + if ((onceh == 0) && (fest_feature2 == 0)) { onceh = 1; fest_feature2 = 1; } - if (onceh = 0) and(fest_feature2 = 1) and(fest_type != "Chapter Relic") { + if ((onceh == 0) && (fest_feature2 == 1) && (fest_type != "Chapter Relic")) { onceh = 1; fest_feature2 = 0; } - if (fest_type = "Chapter Relic") and(fest_feature2 = 1) { + if ((fest_type == "Chapter Relic") && (fest_feature2 == 1)) { fest_feature1 = 0; fest_feature3 = 0; } } - if (fest_type = "Great Feast") then fet_text = "Drugs"; - if (fest_type = "Chapter Relic") then fet_text = "Upgrade Existing"; - if (fest_type = "Chapter Sermon") then fet_text = "Drugs"; - if (fest_type = "Tournament") { + if (fest_type == "Great Feast") { + fet_text = "Drugs"; + } + if (fest_type == "Chapter Relic") { + fet_text = "Upgrade Existing"; + } + if (fest_type == "Chapter Sermon") { + fet_text = "Drugs"; + } + if (fest_type == "Tournament") { fet_text = "Invite Other Chapters"; fet_scale = 0.75; } - if (fest_type = "Deathmatch") { + if (fest_type == "Deathmatch") { fet_text = "Allow Other Competitors"; fet_scale = 0.7; } - if (fest_type = "Imperial Mass") { + if (fest_type == "Imperial Mass") { fet_text = "Request Sororitas"; fet_scale = 0.75; } - if (fest_type = "Triumphal March") { + if (fest_type == "Triumphal March") { fet_text = "Brandish Bloody Trophies"; fet_scale = 0.6; } - if (fest_feature3 = 0) then che = 1; - if (fest_feature3 = 1) then che = 2; - if (fest_type = "Imperial Mass") and(known[5] = 0) then draw_set_alpha(0.5); + if (fest_feature3 == 0) { + che = 1; + } + if (fest_feature3 == 1) { + che = 2; + } + if ((fest_type == "Imperial Mass") && (known[5] == 0)) { + draw_set_alpha(0.5); + } cx = xx + 1388 + 22; cy = yy + 326; @@ -494,30 +653,34 @@ function scr_ui_advisors() { draw_sprite(spr_creation_check, che + 1, cx, cy); draw_set_alpha(1); // if (scr_hit(cx+31,cy,cx+260,cy+20)=true){tool1="Planet";tool2="Allows the use of vehicles, and bikes, but prevents this formation from being used during Raids.";} - if (scr_hit(cx, cy, cx + 32, cy + 32) = true) and(scr_click_left()) and(dropdown_open = 0) { + if ((scr_hit(cx, cy, cx + 32, cy + 32) == true) && scr_click_left() && (dropdown_open == 0)) { var onceh = 0; - if (fest_type = "Imperial Mass") and(known[5] = 0) then onceh = 1; - if (onceh = 0) and(fest_feature3 = 0) { + if ((fest_type == "Imperial Mass") && (known[5] == 0)) { + onceh = 1; + } + if ((onceh == 0) && (fest_feature3 == 0)) { onceh = 1; fest_feature3 = 1; } - if (onceh = 0) and(fest_feature3 = 1) and(fest_type != "Chapter Relic") { + if ((onceh == 0) && (fest_feature3 == 1) && (fest_type != "Chapter Relic")) { onceh = 1; fest_feature3 = 0; } - if (fest_type = "Chapter Relic") and(fest_feature3 = 1) { + if ((fest_type == "Chapter Relic") && (fest_feature3 == 1)) { fest_feature1 = 0; fest_feature2 = 0; } } // Always at least one feature - if (fest_type != "Triumphal March") and(fest_type != "Chapter Sermon") { - if (fest_feature1 = 0) and(fest_feature2 = 0) and(fest_feature3 = 0) then fest_feature1 = 1; + if ((fest_type != "Triumphal March") && (fest_type != "Chapter Sermon")) { + if ((fest_feature1 == 0) && (fest_feature2 == 0) && (fest_feature3 == 0)) { + fest_feature1 = 1; + } } - // TODO Attendants - if (fest_attend = "") and((fest_wid > 0) or(fest_sid > 0)) { + // TODO Attendants + if ((fest_attend == "") && ((fest_wid > 0) || (fest_sid > 0))) { // determine attendants } @@ -525,15 +688,21 @@ function scr_ui_advisors() { var doable; doable = true; - if (requisition < fest_cost) then doable = false; - if (fest_wid = 0) and(fest_sid = 0) then doable = false; + if (requisition < fest_cost) { + doable = false; + } + if ((fest_wid == 0) && (fest_sid == 0)) { + doable = false; + } // Accept draw_set_halign(fa_left); draw_set_alpha(1); draw_set_color(c_gray); - if (doable = false) then draw_set_alpha(0.5); + if (doable == false) { + draw_set_alpha(0.5); + } draw_rectangle(xx + 1302, yy + 780, xx + 1433, yy + 805, 0); draw_set_alpha(1); @@ -544,9 +713,11 @@ function scr_ui_advisors() { draw_set_color(c_blue); // draw_set_color(16291875); - if (requisition < fest_cost) then draw_set_color(c_red); + if (requisition < fest_cost) { + draw_set_color(c_red); + } draw_text(xx + 1388, yy + 784, string_hash_to_newline(string(fest_cost))); - if (scr_hit(xx + 1302, yy + 780, xx + 1423, yy + 805) = true) and(doable = true) { + if ((scr_hit(xx + 1302, yy + 780, xx + 1423, yy + 805) == true) && (doable == true)) { draw_set_color(c_white); draw_set_alpha(0.2); draw_rectangle(xx + 1302, yy + 780, xx + 1433, yy + 805, 0); @@ -555,15 +726,18 @@ function scr_ui_advisors() { requisition -= fest_cost; fest_scheduled = 1; menu = 12; - with(obj_dropdown_sel) { + with (obj_dropdown_sel) { instance_destroy(); } - if (fest_repeats = 0) then fest_repeats = 1; - if (fest_display > 0) then fest_display_tags = obj_ini.artifact_tags[fest_display]; + if (fest_repeats == 0) { + fest_repeats = 1; + } + if (fest_display > 0) { + fest_display_tags = obj_ini.artifact_tags[fest_display]; + } // show_message(string(fest_display)); // show_message(string(fest_display_tags)); - } } @@ -574,7 +748,7 @@ function scr_ui_advisors() { draw_rectangle(xx + 1132, yy + 780, xx + 1253, yy + 805, 0); draw_set_color(c_black); draw_text(xx + 1192, yy + 783, string_hash_to_newline("Cancel")); - if (scr_hit(xx + 1132, yy + 780, xx + 1253, yy + 805) = true) { + if (scr_hit(xx + 1132, yy + 780, xx + 1253, yy + 805) == true) { draw_set_color(c_white); draw_set_alpha(0.2); draw_rectangle(xx + 1132, yy + 780, xx + 1253, yy + 805, 0); @@ -594,7 +768,7 @@ function scr_ui_advisors() { fest_repeats = 0; fest_warp = 0; menu = 12; - with(obj_dropdown_sel) { + with (obj_dropdown_sel) { instance_destroy(); } } @@ -606,20 +780,19 @@ function scr_ui_advisors() { // ** Librarium ** if (menu == 13) { - scr_librarium(); - } - - // ** Armamentarium ** - else if (menu == 14) { + scr_librarium(); + } else // ** Armamentarium ** + if (menu == 14) { scr_draw_armentarium(); - }else if (menu == 15) {// **recruiting** + } else if (menu == 15) { + // **recruiting** scr_draw_recruit_advisor(); } // *** Fleet advisor was here *** // ** Chapter Master ** - if (menu = 50) { + if (menu == 50) { draw_set_color(0); draw_sprite(spr_solid_bg, 0, xx, yy); draw_sprite(spr_master_splash, 0, xx, yy); @@ -649,9 +822,8 @@ function scr_ui_advisors() { draw_set_font(fnt_small); draw_set_halign(fa_left); - var eqp = "", - tempe = ""; - + var eqp = "", tempe = ""; + draw_text(xx + 222, yy + 83, "Equipment:"); draw_text(xx + 222.5, yy + 83.5, "Equipment:"); @@ -662,11 +834,14 @@ function scr_ui_advisors() { draw_text(xx + 222, yy + 200, "Kills:"); draw_text(xx + 222.5, yy + 200.5, "Kills:"); - draw_text_ext(xx + 222, yy + 216, string_hash_to_newline(string(tot_ki)), -1, 396); - var unit = fetch_unit([0,1]); - if (unit.ship_location == -1) then draw_text(xx + 222, yy + 380, string_hash_to_newline($"Current Location: {unit.location_string} {unit.planet_location}#Health: " + unit.hp() + "%")); - if (unit.ship_location>-1) then draw_text(xx + 222, yy + 380, string_hash_to_newline($"Current Location: Onboard {obj_ini.ship[unit.ship_location]}#Health: {unit.hp()}%")); + var unit = fetch_unit([0, 1]); + if (unit.ship_location == -1) { + draw_text(xx + 222, yy + 380, string_hash_to_newline($"Current Location: {unit.location_string} {unit.planet_location}#Health: " + unit.hp() + "%")); + } + if (unit.ship_location > -1) { + draw_text(xx + 222, yy + 380, string_hash_to_newline($"Current Location: Onboard {obj_ini.ship[unit.ship_location]}#Health: {unit.hp()}%")); + } draw_text(xx + 222.5, yy + 380.5, string_hash_to_newline("Current Location:#Health:")); draw_sprite(spr_arrow, 0, xx + 217, yy + 32); @@ -681,17 +856,24 @@ function scr_ui_advisors() { draw_set_color(0); draw_set_font(fnt_40k_14); - if (menu = 500) then draw_text_ext(xx + 370, yy + 72, string_hash_to_newline(string(temp[65])), -1, 660); - if (menu = 501) then draw_text_ext(xx + 370, yy + 72, string_hash_to_newline(string(temp[66])), -1, 660); - if (menu = 502) then draw_text_ext(xx + 370, yy + 72, string_hash_to_newline(string(temp[67])), -1, 660); - if (menu = 503) then draw_text_ext(xx + 370, yy + 72, string_hash_to_newline(string(temp[68])), -1, 660); + if (menu == 500) { + draw_text_ext(xx + 370, yy + 72, string_hash_to_newline(string(temp[65])), -1, 660); + } + if (menu == 501) { + draw_text_ext(xx + 370, yy + 72, string_hash_to_newline(string(temp[66])), -1, 660); + } + if (menu == 502) { + draw_text_ext(xx + 370, yy + 72, string_hash_to_newline(string(temp[67])), -1, 660); + } + if (menu == 503) { + draw_text_ext(xx + 370, yy + 72, string_hash_to_newline(string(temp[68])), -1, 660); + } draw_set_halign(fa_center); draw_text(xx + 702, yy + 695, $"{menu - 499} (Press Any Key)"); draw_set_halign(fa_left); - } - if (menu == eMENU.Manage) and (managing == 0) { + if ((menu == eMENU.Manage) && (managing == 0)) { draw_set_alpha(1); draw_sprite(spr_rock_bg, 0, xx, yy); draw_set_font(fnt_40k_30b); diff --git a/scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml b/scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml index ac541036f5..f0e50cbeac 100644 --- a/scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml +++ b/scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml @@ -1,473 +1,473 @@ -function draw_character_diplomacy_base_page(){ - add_draw_return_values(); - obj_controller.menu_lock = true; - if (!audience && !valid_diplomacy_options()){ - with (diplo_buttons){ - trade.draw(); - demand.draw(); - discuss.draw(); - alliance.draw(); - denounce.draw(); - praise.draw(); - declare_war.draw_shutter(praise.x1,alliance.y2,"WAR",0.4); - } - } else { - if (!valid_diplomacy_options()){ - diplo_buttons.denounce.draw(); - diplo_buttons.praise.draw(); - } - } - if (!valid_diplomacy_options() || force_goodbye){ - diplo_buttons.exit_button.draw(); - } - pop_draw_return_values(); +function draw_character_diplomacy_base_page() { + add_draw_return_values(); + obj_controller.menu_lock = true; + if (!audience && !valid_diplomacy_options()) { + with (diplo_buttons) { + trade.draw(); + demand.draw(); + discuss.draw(); + alliance.draw(); + denounce.draw(); + praise.draw(); + declare_war.draw_shutter(praise.x1, alliance.y2, "WAR", 0.4); + } + } else { + if (!valid_diplomacy_options()) { + diplo_buttons.denounce.draw(); + diplo_buttons.praise.draw(); + } + } + if (!valid_diplomacy_options() || force_goodbye) { + diplo_buttons.exit_button.draw(); + } + pop_draw_return_values(); } -function intro_to_diplomacy(faction_enum){ - with (obj_controller){ - var _new_diag = "intro"; - if (faction_enum!=4){ - if (known[faction_enum]==1) { - known[diplomacy]=2; - faction_justmet=1; - } - else if (known[faction_enum]>=2) { - _new_diag = "hello"; - } - } else { - if (known[eFACTION.Inquisition]==1) { - known[diplomacy]=2; - faction_justmet=1; - obj_controller.last_mission=turn+1; - } - else if (known[eFACTION.Inquisition]==3) { - known[faction_enum]=4; - faction_justmet=1; - obj_controller.last_mission=turn+1; - } - else if (known[faction_enum]>=4) { - _new_diag = "hello"; - } - } - scr_dialogue(_new_diag); - } +function intro_to_diplomacy(faction_enum) { + with (obj_controller) { + var _new_diag = "intro"; + if (faction_enum != 4) { + if (known[faction_enum] == 1) { + known[diplomacy] = 2; + faction_justmet = 1; + } else if (known[faction_enum] >= 2) { + _new_diag = "hello"; + } + } else { + if (known[eFACTION.Inquisition] == 1) { + known[diplomacy] = 2; + faction_justmet = 1; + obj_controller.last_mission = turn + 1; + } else if (known[eFACTION.Inquisition] == 3) { + known[faction_enum] = 4; + faction_justmet = 1; + obj_controller.last_mission = turn + 1; + } else if (known[faction_enum] >= 4) { + _new_diag = "hello"; + } + } + scr_dialogue(_new_diag); + } } +function exit_diplomacy_dialogue() { + obj_controller.menu_lock = false; + if (audio_is_playing(snd_blood) == true) { + scr_music("royal", 2000); + } -function exit_diplomacy_dialogue(){ - obj_controller.menu_lock = false; - if (audio_is_playing(snd_blood)==true) then scr_music("royal",2000); - - var _close_diplomacy = true; - if (complex_event==true) and (instance_exists(obj_temp_meeting)){ - complex_event=false; - with(obj_temp_meeting){ - instance_destroy(); + var _close_diplomacy = true; + if ((complex_event == true) && instance_exists(obj_temp_meeting)) { + complex_event = false; + with (obj_temp_meeting) { + instance_destroy(); } - if (instance_exists(obj_turn_end)){ - obj_turn_end.alarm[1]=1; + if (instance_exists(obj_turn_end)) { + obj_turn_end.alarm[1] = 1; } } - - if (trading_artifact!=0){ + + if (trading_artifact != 0) { clear_diplo_choices(); - cooldown=8; - if (trading_artifact == 2 && instance_exists(obj_ground_mission)){ - with (obj_ground_mission){ + cooldown = 8; + if (trading_artifact == 2 && instance_exists(obj_ground_mission)) { + with (obj_ground_mission) { recieve_artifact_in_discussion(); } } - trading_artifact=0; - with(obj_popup){ - obj_ground_mission.alarm[1]=1; + trading_artifact = 0; + with (obj_popup) { + obj_ground_mission.alarm[1] = 1; instance_destroy(); } } - if (force_goodbye==5){ + if (force_goodbye == 5) { clear_diplo_choices(); } - if (liscensing==2) and (repair_ships==0){ - cooldown=8; - var cru=instance_create(mouse_x,mouse_y,obj_crusade); - cru.owner=diplomacy; - cru.placing=true; - exit_all=0; - liscensing=0; - if (zoomed==0) then scr_zoom(); + if ((liscensing == 2) && (repair_ships == 0)) { + cooldown = 8; + var cru = instance_create(mouse_x, mouse_y, obj_crusade); + cru.owner = diplomacy; + cru.placing = true; + exit_all = 0; + liscensing = 0; + if (zoomed == 0) { + scr_zoom(); + } } - if (exit_all!=0){ - exit_all=0; + if (exit_all != 0) { + exit_all = 0; } - if (diplo_last=="artifact_thanks") and (force_goodbye!=0){ - scr_toggle_lib(); - _close_diplomacy = false; - } else if (diplo_last=="stc_thanks"){ - scr_toggle_armamentarium(); - _close_diplomacy = false; + if ((diplo_last == "artifact_thanks") && (force_goodbye != 0)) { + scr_toggle_lib(); + _close_diplomacy = false; + } else if (diplo_last == "stc_thanks") { + scr_toggle_armamentarium(); + _close_diplomacy = false; } // Exits back to diplomacy thing - if (audience==0){ - cooldown=8; - diplomacy=0; - force_goodbye=0; + if (audience == 0) { + cooldown = 8; + diplomacy = 0; + force_goodbye = 0; _close_diplomacy = false; } // No need to check for next audience - if (audience>0) and (instance_exists(obj_turn_end)){ - if (complex_event==false){ - - obj_turn_end.alarm[1]=1; + if ((audience > 0) && instance_exists(obj_turn_end)) { + if (complex_event == false) { + obj_turn_end.alarm[1] = 1; show_debug_message("next_audience"); } - if (complex_event=true){ + if (complex_event == true) { // TODO } } - if (_close_diplomacy){ - scr_toggle_diplomacy(); + if (_close_diplomacy) { + scr_toggle_diplomacy(); } } -function draw_diplomacy_diplo_text(){ + +function draw_diplomacy_diplo_text() { draw_set_font(fnt_40k_14); draw_set_alpha(1); draw_set_color(CM_GREEN_COLOR); draw_set_halign(fa_left); - draw_text_ext(336+16,209,string_hash_to_newline(string(diplo_txt)),-1,536); + draw_text_ext(336 + 16, 209, string_hash_to_newline(string(diplo_txt)), -1, 536); draw_set_halign(fa_center); - draw_line(xx+429,yy+710,xx+800,yy+710); + draw_line(xx + 429, yy + 710, xx + 800, yy + 710); } -function set_up_diplomacy_buttons(){ - diplo_buttons = {}; - audience_data = {}; - set_up_diplomacy_persons(); - //Trade button setup - diplo_buttons.trade = new UnitButtonObject({ - x1 : 400, - y1 : 720, - label : "Trade", - bind_scope : obj_controller, - style:"pixel" - }); - diplo_buttons.trade.bind_method = function(){ - if ((audience==0) and (force_goodbye==0)){ - trading=1; + +function set_up_diplomacy_buttons() { + diplo_buttons = {}; + audience_data = {}; + set_up_diplomacy_persons(); + //Trade button setup + diplo_buttons.trade = new UnitButtonObject({ + x1: 400, + y1: 720, + label: "Trade", + bind_scope: obj_controller, + style: "pixel", + }); + diplo_buttons.trade.bind_method = function() { + if ((audience == 0) && (force_goodbye == 0)) { + trading = 1; scr_dialogue("open_trade"); - cooldown=8; - click2=1; + cooldown = 8; + click2 = 1; trade_attempt = new TradeAttempt(diplomacy); - } - } - - - //Demand button setup - diplo_buttons.demand = new UnitButtonObject({ - x1 : 600, - y1 : 720, - label : "Demand", - bind_scope : obj_controller, - style:"pixel" - }); - diplo_buttons.demand.bind_method = function(){ - if ((audience==0) and (force_goodbye==0)){ - cooldown=8; - click2=1; - trading_demand=diplomacy; + } + }; + + //Demand button setup + diplo_buttons.demand = new UnitButtonObject({ + x1: 600, + y1: 720, + label: "Demand", + bind_scope: obj_controller, + style: "pixel", + }); + diplo_buttons.demand.bind_method = function() { + if ((audience == 0) && (force_goodbye == 0)) { + cooldown = 8; + click2 = 1; + trading_demand = diplomacy; scr_dialogue("trading_demand"); - } - } - - //Discuss button setup - diplo_buttons.discuss = new UnitButtonObject({ - x1 : 800, - y1 : 720, - label : "Discuss", - tooltip : "Unfinished", - bind_scope : obj_controller, - style:"pixel" - }); - - - //denounce button setup - diplo_buttons.denounce = new UnitButtonObject({ - x1 : 400, - y1 : diplo_buttons.trade.y2, - label : "Denounce", - bind_scope : obj_controller, - style:"pixel" - }); - - diplo_buttons.denounce.bind_method = function(){ - if (diplo_last!="denounced"){ + } + }; + + //Discuss button setup + diplo_buttons.discuss = new UnitButtonObject({ + x1: 800, + y1: 720, + label: "Discuss", + tooltip: "Unfinished", + bind_scope: obj_controller, + style: "pixel", + }); + + //denounce button setup + diplo_buttons.denounce = new UnitButtonObject({ + x1: 400, + y1: diplo_buttons.trade.y2, + label: "Denounce", + bind_scope: obj_controller, + style: "pixel", + }); + + diplo_buttons.denounce.bind_method = function() { + if (diplo_last != "denounced") { scr_dialogue("denounced"); - cooldown=8; - click2=1; - } - } - - diplo_buttons.praise = new UnitButtonObject({ - x1 : 600, - y1 : diplo_buttons.trade.y2, - label : "Praise", - bind_scope : obj_controller, - style:"pixel" - }); - - diplo_buttons.praise.bind_method = function(){ - if (diplo_last!="praised"){ + cooldown = 8; + click2 = 1; + } + }; + + diplo_buttons.praise = new UnitButtonObject({ + x1: 600, + y1: diplo_buttons.trade.y2, + label: "Praise", + bind_scope: obj_controller, + style: "pixel", + }); + + diplo_buttons.praise.bind_method = function() { + if (diplo_last != "praised") { scr_dialogue("praised"); - cooldown=8; - click2=1; - } - } - - diplo_buttons.alliance = new UnitButtonObject({ - x1 : 800, - y1 : diplo_buttons.trade.y2, - label : "Propose\nAlliance", - bind_scope : obj_controller, - style:"pixel" - }); - - - diplo_buttons.alliance.bind_method = function(){ - if (diplo_last!="propose_alliance"){ - cooldown=8; - click2=1; + cooldown = 8; + click2 = 1; + } + }; + + diplo_buttons.alliance = new UnitButtonObject({ + x1: 800, + y1: diplo_buttons.trade.y2, + label: "Propose\nAlliance", + bind_scope: obj_controller, + style: "pixel", + }); + + diplo_buttons.alliance.bind_method = function() { + if (diplo_last != "propose_alliance") { + cooldown = 8; + click2 = 1; scr_dialogue("propose_alliance"); - } - } - - diplo_buttons.exit_button = new UnitButtonObject({ - x1 : 818, - y1 : 795, - label : "Exit", - bind_scope : obj_controller, - color : CM_RED_COLOR, - }); - - diplo_buttons.exit_button.bind_method = exit_diplomacy_dialogue; - - - diplo_buttons.declare_war = new ShutterButton(); - var _war = diplo_buttons.declare_war; - _war.XX= 640; - _war.YY= diplo_buttons.alliance.y2; - _war.label = "DECLARE WAR"; - _war.tooltip = "Unfinished"; - _war.color = CM_RED_COLOR; - _war.cover_text= "Declare War"; - _war.bind_scope = obj_controller; - - diplo_buttons.main_slate = new DataSlate(); - diplo_buttons.main_slate.width = 570; - diplo_buttons.main_slate.height = 854; - diplo_buttons.main_slate.set_width = true; - diplo_buttons.main_slate.style = "decorated"; - set_up_rpgcharacter_diplomacy(); + } + }; + + diplo_buttons.exit_button = new UnitButtonObject({ + x1: 818, + y1: 795, + label: "Exit", + bind_scope: obj_controller, + color: CM_RED_COLOR, + }); + + diplo_buttons.exit_button.bind_method = exit_diplomacy_dialogue; + + diplo_buttons.declare_war = new ShutterButton(); + var _war = diplo_buttons.declare_war; + _war.XX = 640; + _war.YY = diplo_buttons.alliance.y2; + _war.label = "DECLARE WAR"; + _war.tooltip = "Unfinished"; + _war.color = CM_RED_COLOR; + _war.cover_text = "Declare War"; + _war.bind_scope = obj_controller; + + diplo_buttons.main_slate = new DataSlate(); + diplo_buttons.main_slate.width = 570; + diplo_buttons.main_slate.height = 854; + diplo_buttons.main_slate.set_width = true; + diplo_buttons.main_slate.style = "decorated"; + set_up_rpgcharacter_diplomacy(); } -function set_up_rpgcharacter_diplomacy(){ - with(obj_controller){ - diplo_buttons.meet_slate = new DataSlate(); - with(diplo_buttons.meet_slate){ - width = 572; - height = 188; - XX = 0; - YY = 712; - set_width = true; - style = "plain"; - } - diplo_buttons.cm_slate = new DataSlate(); - with(diplo_buttons.cm_slate){ - width = 572; - height = 188; - XX = 1031; - YY = 712; - set_width = true; - style = "plain"; - } - } +function set_up_rpgcharacter_diplomacy() { + with (obj_controller) { + diplo_buttons.meet_slate = new DataSlate(); + with (diplo_buttons.meet_slate) { + width = 572; + height = 188; + XX = 0; + YY = 712; + set_width = true; + style = "plain"; + } + diplo_buttons.cm_slate = new DataSlate(); + with (diplo_buttons.cm_slate) { + width = 572; + height = 188; + XX = 1031; + YY = 712; + set_width = true; + style = "plain"; + } + } } -function set_up_diplomacy_persons(){ - diplo_persons = { - } - diplo_persons.imperium = new ShutterButton(); - var _imp = diplo_persons.imperium; - _imp.image = known[eFACTION.Imperium] || global.cheat_debug? 3 : 4; - _imp._faction_enum = eFACTION.Imperium; - - diplo_persons.mechanicus = new ShutterButton(); - var _mechs = diplo_persons.mechanicus; - _mechs.image = known[eFACTION.Mechanicus] || global.cheat_debug? 5 : 6; - _mechs._faction_enum = eFACTION.Mechanicus; - - diplo_persons.inquisition = new ShutterButton(); - var _inquis = diplo_persons.inquisition; - _inquis.image = known[eFACTION.Inquisition]|| global.cheat_debug ? 7 : 8; - _inquis._faction_enum = eFACTION.Inquisition; - - diplo_persons.sisters = new ShutterButton(); - var _sisters = diplo_persons.sisters; - _sisters.image = known[eFACTION.Ecclesiarchy] || global.cheat_debug? 9 : 10; - _sisters._faction_enum = eFACTION.Ecclesiarchy; - - - - diplo_persons.eldar = new ShutterButton(); - var _eldar = diplo_persons.eldar; - if (faction_gender[eFACTION.Eldar]=1){ - _eldar.image = known[eFACTION.Eldar] || global.cheat_debug? 9 : 10; - } else { - _eldar.image = known[eFACTION.Eldar] || global.cheat_debug? 21 : 22; - } - _eldar._faction_enum = eFACTION.Eldar; - - - diplo_persons.ork = new ShutterButton(); - var _orks = diplo_persons.ork; - _orks.image = known[eFACTION.Ork] || global.cheat_debug? 13 : 14; - _orks._faction_enum = eFACTION.Ork; - - diplo_persons.tau = new ShutterButton(); - var _tau = diplo_persons.tau; - _tau.image = known[eFACTION.Tau] || global.cheat_debug? 15 : 16; - _tau._faction_enum = eFACTION.Tau; - - diplo_persons.chaos = new ShutterButton(); - var imm=19; - if (known[eFACTION.Chaos]>0 && faction_gender[eFACTION.Chaos]=2) then imm=27; - if (known[eFACTION.Chaos]<1 && faction_gender[eFACTION.Chaos]=1) then imm=20; - if (known[eFACTION.Chaos]<1 && faction_gender[eFACTION.Chaos]=2) then imm=28; - var _chaos = diplo_persons.chaos; - _chaos.image = imm; - _chaos._faction_enum = eFACTION.Chaos; - - var _shutters = [_imp, _mechs, _inquis, _sisters, _eldar, _orks, _tau, _chaos]; - - for (var i=0;i0){ - txt=$"{obj_controller.faction_title[_faction_enum]} {obj_controller.faction_leader[_faction_enum]}"; - } - draw_text_transformed(xx+169,yy+50,txt,0.7,0.7,0); - draw_text_transformed(xx+169,yy+65,$"Disposition: {obj_controller.disposition[_faction_enum]}",0.7,0.7,0); - scr_draw_rainbow(xx+250,yy+66,xx+400,yy+76,(obj_controller.disposition[_faction_enum]/200)+0.5); - - if (((obj_controller.known[_faction_enum]>0.7) and (obj_controller.faction_defeated[_faction_enum]=0) )|| global.cheat_debug) { - var _audience = management_buttons.audience; - _audience.update({ - x1: xx+169, - y1: yy+85, - }); - _audience.bind_method = function(){ - if (obj_controller.known[_faction_enum]!=0 || global.cheat_debug) and (obj_controller.turns_ignored[_faction_enum]==0){ - obj_controller.diplomacy = _faction_enum; - intro_to_diplomacy(_faction_enum); - } - - } - _audience.draw(); - var _ignore_status = obj_controller.ignore[_faction_enum] < 1 ? management_buttons.ignore : management_buttons.unignore; - - _ignore_status.update({ - x1: _audience.x2+1, - y1: yy+85, - }); - _ignore_status.draw(); - - - /*var fis;fis="[Request Audience]"; +function set_up_diplomacy_persons() { + diplo_persons = {}; + diplo_persons.imperium = new ShutterButton(); + var _imp = diplo_persons.imperium; + _imp.image = known[eFACTION.Imperium] || global.cheat_debug ? 3 : 4; + _imp._faction_enum = eFACTION.Imperium; + + diplo_persons.mechanicus = new ShutterButton(); + var _mechs = diplo_persons.mechanicus; + _mechs.image = known[eFACTION.Mechanicus] || global.cheat_debug ? 5 : 6; + _mechs._faction_enum = eFACTION.Mechanicus; + + diplo_persons.inquisition = new ShutterButton(); + var _inquis = diplo_persons.inquisition; + _inquis.image = known[eFACTION.Inquisition] || global.cheat_debug ? 7 : 8; + _inquis._faction_enum = eFACTION.Inquisition; + + diplo_persons.sisters = new ShutterButton(); + var _sisters = diplo_persons.sisters; + _sisters.image = known[eFACTION.Ecclesiarchy] || global.cheat_debug ? 9 : 10; + _sisters._faction_enum = eFACTION.Ecclesiarchy; + + diplo_persons.eldar = new ShutterButton(); + var _eldar = diplo_persons.eldar; + if (faction_gender[eFACTION.Eldar] == 1) { + _eldar.image = known[eFACTION.Eldar] || global.cheat_debug ? 9 : 10; + } else { + _eldar.image = known[eFACTION.Eldar] || global.cheat_debug ? 21 : 22; + } + _eldar._faction_enum = eFACTION.Eldar; + + diplo_persons.ork = new ShutterButton(); + var _orks = diplo_persons.ork; + _orks.image = known[eFACTION.Ork] || global.cheat_debug ? 13 : 14; + _orks._faction_enum = eFACTION.Ork; + + diplo_persons.tau = new ShutterButton(); + var _tau = diplo_persons.tau; + _tau.image = known[eFACTION.Tau] || global.cheat_debug ? 15 : 16; + _tau._faction_enum = eFACTION.Tau; + + diplo_persons.chaos = new ShutterButton(); + var imm = 19; + if (known[eFACTION.Chaos] > 0 && faction_gender[eFACTION.Chaos] == 2) { + imm = 27; + } + if (known[eFACTION.Chaos] < 1 && faction_gender[eFACTION.Chaos] == 1) { + imm = 20; + } + if (known[eFACTION.Chaos] < 1 && faction_gender[eFACTION.Chaos] == 2) { + imm = 28; + } + var _chaos = diplo_persons.chaos; + _chaos.image = imm; + _chaos._faction_enum = eFACTION.Chaos; + + var _shutters = [_imp, _mechs, _inquis, _sisters, _eldar, _orks, _tau, _chaos]; + + for (var i = 0; i < array_length(_shutters); i++) { + var _button = _shutters[i]; + with (_button) { + management_buttons = { + audience: new UnitButtonObject({ + style: "pixel", + label: "Request Audience" + , //tooltip: "." + }), + ignore: new UnitButtonObject({ + style: "pixel", + label: "Ignore" + , //tooltip: "." + }), + unignore: new UnitButtonObject({ + style: "pixel", + label: "Unignore", + tooltip: "Click here or press B to Toggle Unit Biography.", + }), + screen_slate: new DataSlate(), + }; + var _screen_slate = management_buttons.screen_slate; + _screen_slate.XX = XX + 10; + _screen_slate.YY = YY + 141; + _screen_slate.set_width = true; + _screen_slate.style = "plain"; + _screen_slate.width = 153; + _screen_slate.height = 135; + _screen_slate.inside_method = function() { + scr_image("diplomacy/icons", image, XX + 10, YY + 10, 153, 135); + }; + cover_text = obj_controller.faction[_faction_enum]; + inside_method = function() { + var yy = YY; + var xx = XX; + draw_set_font(fnt_40k_14b); + draw_set_halign(fa_left); + draw_text(xx + 169, yy + 35, obj_controller.faction[_faction_enum]); + management_buttons.screen_slate.draw_with_dimensions(xx + 5, yy + 5,); + draw_set_font(fnt_40k_14); + draw_set_halign(fa_right); + draw_text_transformed(xx + 420, yy + 20, obj_controller.faction_status[_faction_enum], 0.7, 0.7, 0); + draw_set_halign(fa_left); + var txt; + txt = "????"; + if (obj_controller.known[_faction_enum] > 0) { + txt = $"{obj_controller.faction_title[_faction_enum]} {obj_controller.faction_leader[_faction_enum]}"; + } + draw_text_transformed(xx + 169, yy + 50, txt, 0.7, 0.7, 0); + draw_text_transformed(xx + 169, yy + 65, $"Disposition: {obj_controller.disposition[_faction_enum]}", 0.7, 0.7, 0); + scr_draw_rainbow(xx + 250, yy + 66, xx + 400, yy + 76, (obj_controller.disposition[_faction_enum] / 200) + 0.5); + + if (((obj_controller.known[_faction_enum] > 0.7) && (obj_controller.faction_defeated[_faction_enum] == 0)) || global.cheat_debug) { + var _audience = management_buttons.audience; + _audience + .update({ + x1: xx + 169, + y1: yy + 85, + }); + _audience.bind_method = function() { + if ((obj_controller.known[_faction_enum] != 0 || global.cheat_debug) && (obj_controller.turns_ignored[_faction_enum] == 0)) { + obj_controller.diplomacy = _faction_enum; + intro_to_diplomacy(_faction_enum); + } + }; + _audience.draw(); + var _ignore_status = obj_controller.ignore[_faction_enum] < 1 ? management_buttons.ignore : management_buttons.unignore; + + _ignore_status + .update({ + x1: _audience.x2 + 1, + y1: yy + 85, + }); + _ignore_status.draw(); + + /*var fis;fis="[Request Audience]"; if (turns_ignored[2]>0) then fis=" "; if (ignore[eFACTION.Imperium]<1) then draw_text_transformed(xx+189,yy+354,string(fis)+" [Ignore]",0.7,0.7,0); if (ignore[eFACTION.Imperium]>=1) then draw_text_transformed(xx+189,yy+354,string(fis)+"[Unignore]",0.7,0.7,0);*/ - } - } - } - } + } + }; + } + } } -function faction_disposition_rating_string(diplomacy){ - with(obj_controller){ - var _disposition_rating = ""; - if (disposition[diplomacy]<=-20){ - _disposition_rating = ALLIANCE_GRADES[0]; - } else { - var _grade = clamp(floor((disposition[diplomacy] + 39)/20), 1, 7); - _disposition_rating = ALLIANCE_GRADES[_grade]; +function faction_disposition_rating_string(diplomacy) { + with (obj_controller) { + var _disposition_rating = ""; + if (disposition[diplomacy] <= -20) { + _disposition_rating = ALLIANCE_GRADES[0]; + } else { + var _grade = clamp(floor((disposition[diplomacy] + 39) / 20), 1, 7); + _disposition_rating = ALLIANCE_GRADES[_grade]; + } + return _disposition_rating; } - return _disposition_rating; - } } function scr_ui_diplomacy() { - if (menu != eMENU.Diplomacy){ - return; - } + if (menu != eMENU.Diplomacy) { + return; + } - var xx=__view_get( e__VW.XView, 0 )+0; - var yy=__view_get( e__VW.YView, 0 )+0; - var show_stuff=false; - var warning=0; + var xx = __view_get(e__VW.XView, 0) + 0; + var yy = __view_get(e__VW.YView, 0) + 0; + var show_stuff = false; + var warning = 0; - // This script draws all of the diplomacy stuff, up to and including trading. + // This script draws all of the diplomacy stuff, up to and including trading. - xx+=6; + xx += 6; draw_set_alpha(1); - draw_set_color(0); - draw_rectangle(xx,yy,xx+1600,yy+900,0); + draw_set_color(0); + draw_rectangle(xx, yy, xx + 1600, yy + 900, 0); draw_set_alpha(0.5); - draw_sprite(spr_rock_bg,0,xx,yy); - draw_set_alpha(1); - if (diplomacy==0){// Main diplomacy screen + draw_sprite(spr_rock_bg, 0, xx, yy); + draw_set_alpha(1); + if (diplomacy == 0) { + // Main diplomacy screen - /*draw_set_color(CM_GREEN_COLOR); + /*draw_set_color(CM_GREEN_COLOR); draw_rectangle(xx+31,yy+281,xx+438,yy+416,0); draw_rectangle(xx+31,yy+417,xx+438,yy+552,0); draw_rectangle(xx+31,yy+553,xx+438,yy+688,0); @@ -477,41 +477,37 @@ function scr_ui_diplomacy() { draw_rectangle(xx+451,yy+417,xx+858,yy+125+91,0); draw_rectangle(xx+451,yy+553,xx+858,yy+125+182,0); draw_rectangle(xx+451,yy+689,xx+858,yy+125+273,0);*/ - - - draw_set_color(CM_GREEN_COLOR); - draw_set_font(fnt_40k_30b); - draw_set_halign(fa_center); - draw_text(xx+800,yy+74,string_hash_to_newline("Diplomacy")); - - - xx+=55;yy-=20; - - diplo_persons.imperium.draw_shutter(xx+31, yy+281, false, 1.5, known[eFACTION.Imperium]>0.7 || global.cheat_debug); - diplo_persons.mechanicus.draw_shutter(xx+31, yy+417, false, 1.5, known[eFACTION.Mechanicus]>0.7 || global.cheat_debug); + draw_set_color(CM_GREEN_COLOR); + draw_set_font(fnt_40k_30b); + draw_set_halign(fa_center); + draw_text(xx + 800, yy + 74, string_hash_to_newline("Diplomacy")); + + xx += 55; + yy -= 20; + + diplo_persons.imperium.draw_shutter(xx + 31, yy + 281, false, 1.5, known[eFACTION.Imperium] > 0.7 || global.cheat_debug); + + diplo_persons.mechanicus.draw_shutter(xx + 31, yy + 417, false, 1.5, known[eFACTION.Mechanicus] > 0.7 || global.cheat_debug); - diplo_persons.inquisition.draw_shutter(xx+31, yy+553, false, 1.5, known[eFACTION.Inquisition]>0.7 || global.cheat_debug); + diplo_persons.inquisition.draw_shutter(xx + 31, yy + 553, false, 1.5, known[eFACTION.Inquisition] > 0.7 || global.cheat_debug); - diplo_persons.sisters.draw_shutter(xx+31, yy+689, false, 1.5, known[eFACTION.Ecclesiarchy]>0.7 || global.cheat_debug); + diplo_persons.sisters.draw_shutter(xx + 31, yy + 689, false, 1.5, known[eFACTION.Ecclesiarchy] > 0.7 || global.cheat_debug); - diplo_persons.eldar.draw_shutter(xx+1041, yy+281, false, 1.5, known[eFACTION.Eldar]>0.7 || global.cheat_debug); + diplo_persons.eldar.draw_shutter(xx + 1041, yy + 281, false, 1.5, known[eFACTION.Eldar] > 0.7 || global.cheat_debug); - diplo_persons.ork.draw_shutter(xx+1041, yy+417, false, 1.5, known[eFACTION.Ork]>0.7 || global.cheat_debug); + diplo_persons.ork.draw_shutter(xx + 1041, yy + 417, false, 1.5, known[eFACTION.Ork] > 0.7 || global.cheat_debug); - diplo_persons.tau.draw_shutter(xx+1041, yy+553, false, 1.5, known[eFACTION.Tau]>0.7 || global.cheat_debug); + diplo_persons.tau.draw_shutter(xx + 1041, yy + 553, false, 1.5, known[eFACTION.Tau] > 0.7 || global.cheat_debug); - diplo_persons.chaos.draw_shutter(xx+1041, yy+689, false, 1.5, known[eFACTION.Chaos]>0.7 || global.cheat_debug); + diplo_persons.chaos.draw_shutter(xx + 1041, yy + 689, false, 1.5, known[eFACTION.Chaos] > 0.7 || global.cheat_debug); - - scr_image("symbol",0,xx+138,yy+174,217,107); - scr_image("symbol",1,xx+525,yy+174,109,54); - scr_image("symbol",2,xx+1147,yy+174,217,107); - - + scr_image("symbol", 0, xx + 138, yy + 174, 217, 107); + scr_image("symbol", 1, xx + 525, yy + 174, 109, 54); + scr_image("symbol", 2, xx + 1147, yy + 174, 217, 107); - //draws chapter diplomacy - /*draw_rectangle(xx+451,yy+281,xx+675,yy+416,1); + //draws chapter diplomacy + /*draw_rectangle(xx+451,yy+281,xx+675,yy+416,1); draw_line(xx+604,yy+281,xx+604,yy+416); draw_rectangle(xx+451,yy+417,xx+675,yy+552,1); draw_line(xx+604,yy+417,xx+604,yy+553); @@ -520,157 +516,153 @@ function scr_ui_diplomacy() { draw_rectangle(xx+451,yy+689,xx+675,yy+824,1); draw_line(xx+604,yy+689,xx+604,yy+824); */ - - - - draw_set_font(fnt_40k_14b); - draw_set_halign(fa_left); - - //draw faction names, etc - /* + + draw_set_font(fnt_40k_14b); + draw_set_halign(fa_left); + + //draw faction names, etc + /* draw_text(xx+609,yy+285,"Chapter 1"); draw_text(xx+609,yy+421,"Chapter 2"); draw_text(xx+609,yy+557,"Chapter 3"); draw_text(xx+609,yy+693,"Chapter 4"); */ - - //render status, i.e. whether at war, that stuff - draw_set_font(fnt_40k_14); - draw_set_halign(fa_right); - - - draw_set_halign(fa_left); - var txt; - - //draw the meet chaos button - draw_set_halign(fa_left); - draw_set_color(CM_GREEN_COLOR); - draw_rectangle(xx+688,yy+240,xx+1028,yy+281,0); - draw_set_color(c_black); - draw_text_transformed(xx+688,yy+241," Meet Chaos Emmissary",0.7,0.7,0); - //color blending stuff if hovering over the meeting chaos icon - if (point_in_rectangle(mouse_x, mouse_y, xx+688,yy+240,xx+1028,yy+281)){ - draw_set_alpha(0.2); - draw_rectangle(xx+688,yy+240,xx+1028,yy+281,0); - draw_set_alpha(1); - }; - var x6,y6,x7,y7; - x6=0;y6=0;x7=0;y7=0; - xx-=55;yy+=20; - - - #region faction talks/ignore stuff - - - #endregion - } - - - xx=__view_get( e__VW.XView, 0 ); - yy=__view_get( e__VW.YView, 0 ); - - var _main_slate = diplo_buttons.main_slate - _main_slate.XX = xx+328; - _main_slate.YY = yy+175; - _main_slate.height = 545; - - if (diplomacy == -1){ - if (!is_struct(character_diplomacy)){ - show_debug_message("no valid diplomacy target"); - diplomacy = 0; - } else { - // draw_sprite(spr_diplo_splash,diplomacy,xx+916,yy+33); - - - } - } - - if (diplomacy>0){// Diplomacy - Speaking - var daemon; - daemon=false; - if (diplomacy>10) and (diplomacy<11) then daemon=true; - // draw_sprite(spr_diplo_splash,diplomacy,xx+916,yy+33); - if (diplomacy==10.1){ - // if (diplomacy=10.1) then draw_sprite(spr_diplomacy_dae,0,xx+16,yy+43); - daemon=true; - scr_image("diplomacy_daemon",0,xx+16,yy+43,310,828); - show_stuff=false; - if (scr_hit(360,143,884,180)){ - warning=1; - } - } - - if (daemon=false){ - if (diplomacy!=eFACTION.Eldar){ - scr_image("diplomacy/splash",diplomacy,xx+16,yy+43,310,828); - } - if (diplomacy!=eFACTION.Eldar) or ((diplomacy==eFACTION.Eldar) and (faction_gender[eFACTION.Eldar]=1)){ - scr_image("diplomacy/splash",diplomacy,xx+16,yy+16,310,828); - } - if (diplomacy==eFACTION.Eldar) and (faction_gender[eFACTION.Eldar]=2){ - scr_image("diplomacy/splash",11,xx+16,yy+16,310,828); - } - if (diplomacy==eFACTION.Chaos) and (faction_gender[eFACTION.Chaos]=2){ - scr_image("diplomacy/splash",12,xx+16,yy+43,310,828); - } - } - - draw_set_halign(fa_center); - draw_set_color(CM_GREEN_COLOR); - draw_set_font(fnt_40k_30b); - - var _diplomacy_faction_name=""; - var _diplomacy_faction_alligience=" (Imperium)"; - var _disposition_rating=""; - - - if (diplomacy>=6){ - _diplomacy_faction_alligience=""; - } - - - _diplomacy_faction_name = FACTION_NAMES[diplomacy]; - - draw_text_transformed(xx+622,yy+66,_diplomacy_faction_name,1,1,0); - - if (daemon=true){ - draw_text_transformed(xx+622,yy+104,"The Emmmisary",0.6,0.6,0); - show_stuff=true; - } else if (daemon=false){ - draw_text_transformed(xx+622,yy+104,$"{faction_title[diplomacy]} {faction_leader[diplomacy]} {_diplomacy_faction_alligience}",0.6,0.6,0); - } - - draw_set_font(fnt_40k_14); - if (daemon=false){ - _disposition_rating=$"Disposition: {faction_disposition_rating_string(diplomacy)} ({disposition[diplomacy]})"; - // draw_set_halign(fa_center); - draw_text(xx+622,yy+144,_disposition_rating); - scr_draw_rainbow(xx+366,yy+165,xx+871,yy+175,(disposition[diplomacy]/200)+0.5); - } - draw_set_color(c_gray); - draw_rectangle(xx+366,yy+165,xx+871,yy+175,1); - - show_stuff=true; - _main_slate.draw_with_dimensions(); - } - - if (warning=1 || diplomacy>=6){ + + //render status, i.e. whether at war, that stuff + draw_set_font(fnt_40k_14); + draw_set_halign(fa_right); + + draw_set_halign(fa_left); + var txt; + + //draw the meet chaos button + draw_set_halign(fa_left); + draw_set_color(CM_GREEN_COLOR); + draw_rectangle(xx + 688, yy + 240, xx + 1028, yy + 281, 0); + draw_set_color(c_black); + draw_text_transformed(xx + 688, yy + 241, " Meet Chaos Emmissary", 0.7, 0.7, 0); + //color blending stuff if hovering over the meeting chaos icon + if (point_in_rectangle(mouse_x, mouse_y, xx + 688, yy + 240, xx + 1028, yy + 281)) { + draw_set_alpha(0.2); + draw_rectangle(xx + 688, yy + 240, xx + 1028, yy + 281, 0); + draw_set_alpha(1); + } + var x6, y6, x7, y7; + x6 = 0; + y6 = 0; + x7 = 0; + y7 = 0; + xx -= 55; + yy += 20; + + #region faction talks/ignore stuff + + #endregion + } + + xx = __view_get(e__VW.XView, 0); + yy = __view_get(e__VW.YView, 0); + + var _main_slate = diplo_buttons.main_slate; + _main_slate.XX = xx + 328; + _main_slate.YY = yy + 175; + _main_slate.height = 545; + + if (diplomacy == -1) { + if (!is_struct(character_diplomacy)) { + show_debug_message("no valid diplomacy target"); + diplomacy = 0; + } else { + // draw_sprite(spr_diplo_splash,diplomacy,xx+916,yy+33); + } + } + + if (diplomacy > 0) { + // Diplomacy - Speaking + var daemon; + daemon = false; + if ((diplomacy > 10) && (diplomacy < 11)) { + daemon = true; + } + // draw_sprite(spr_diplo_splash,diplomacy,xx+916,yy+33); + if (diplomacy == 10.1) { + // if (diplomacy=10.1) then draw_sprite(spr_diplomacy_dae,0,xx+16,yy+43); + daemon = true; + scr_image("diplomacy_daemon", 0, xx + 16, yy + 43, 310, 828); + show_stuff = false; + if (scr_hit(360, 143, 884, 180)) { + warning = 1; + } + } + + if (daemon == false) { + if (diplomacy != eFACTION.Eldar) { + scr_image("diplomacy/splash", diplomacy, xx + 16, yy + 43, 310, 828); + } + if ((diplomacy != eFACTION.Eldar) || ((diplomacy == eFACTION.Eldar) && (faction_gender[eFACTION.Eldar] == 1))) { + scr_image("diplomacy/splash", diplomacy, xx + 16, yy + 16, 310, 828); + } + if ((diplomacy == eFACTION.Eldar) && (faction_gender[eFACTION.Eldar] == 2)) { + scr_image("diplomacy/splash", 11, xx + 16, yy + 16, 310, 828); + } + if ((diplomacy == eFACTION.Chaos) && (faction_gender[eFACTION.Chaos] == 2)) { + scr_image("diplomacy/splash", 12, xx + 16, yy + 43, 310, 828); + } + } + + draw_set_halign(fa_center); + draw_set_color(CM_GREEN_COLOR); + draw_set_font(fnt_40k_30b); + + var _diplomacy_faction_name = ""; + var _diplomacy_faction_alligience = " (Imperium)"; + var _disposition_rating = ""; + + if (diplomacy >= 6) { + _diplomacy_faction_alligience = ""; + } + + _diplomacy_faction_name = FACTION_NAMES[diplomacy]; + + draw_text_transformed(xx + 622, yy + 66, _diplomacy_faction_name, 1, 1, 0); + + if (daemon == true) { + draw_text_transformed(xx + 622, yy + 104, "The Emmmisary", 0.6, 0.6, 0); + show_stuff = true; + } else if (daemon == false) { + draw_text_transformed(xx + 622, yy + 104, $"{faction_title[diplomacy]} {faction_leader[diplomacy]} {_diplomacy_faction_alligience}", 0.6, 0.6, 0); + } + + draw_set_font(fnt_40k_14); + if (daemon == false) { + _disposition_rating = $"Disposition: {faction_disposition_rating_string(diplomacy)} ({disposition[diplomacy]})"; + // draw_set_halign(fa_center); + draw_text(xx + 622, yy + 144, _disposition_rating); + scr_draw_rainbow(xx + 366, yy + 165, xx + 871, yy + 175, (disposition[diplomacy] / 200) + 0.5); + } + draw_set_color(c_gray); + draw_rectangle(xx + 366, yy + 165, xx + 871, yy + 175, 1); + + show_stuff = true; + _main_slate.draw_with_dimensions(); + } + + if (warning == 1 || diplomacy >= 6) { var warn; - if (array_contains(XENOS_FACTIONS, diplomacy)){ - warn="Consorting with xenos will cause your disposition with the Imperium to lower."; + if (array_contains(XENOS_FACTIONS, diplomacy)) { + warn = "Consorting with xenos will cause your disposition with the Imperium to lower."; } else { - warn="Consorting with heretics will cause your disposition with the Imperium to plummet."; + warn = "Consorting with heretics will cause your disposition with the Imperium to plummet."; } draw_set_halign(fa_left); - draw_rectangle(mouse_x-2,mouse_y+20,mouse_x+2+string_width_ext(warn,-1,600),mouse_y+24+string_height_ext(warn,-1,600),0); + draw_rectangle(mouse_x - 2, mouse_y + 20, mouse_x + 2 + string_width_ext(warn, -1, 600), mouse_y + 24 + string_height_ext(warn, -1, 600), 0); draw_set_color(CM_GREEN_COLOR); - draw_rectangle(mouse_x-2,mouse_y+20,mouse_x+2+string_width_ext(warn,-1,600),mouse_y+24+string_height_ext(warn,-1,600),1); - draw_text_ext(mouse_x,mouse_y+22,warn,-1,600); + draw_rectangle(mouse_x - 2, mouse_y + 20, mouse_x + 2 + string_width_ext(warn, -1, 600), mouse_y + 24 + string_height_ext(warn, -1, 600), 1); + draw_text_ext(mouse_x, mouse_y + 22, warn, -1, 600); } - - //scr_dialogue(diplomacy_pathway); - basic_diplomacy_screen(); + //scr_dialogue(diplomacy_pathway); + basic_diplomacy_screen(); } diff --git a/scripts/scr_ui_manage/scr_ui_manage.gml b/scripts/scr_ui_manage/scr_ui_manage.gml index 5a31929ee1..56739e019f 100644 --- a/scripts/scr_ui_manage/scr_ui_manage.gml +++ b/scripts/scr_ui_manage/scr_ui_manage.gml @@ -55,19 +55,19 @@ function load_marines_into_ship(system, ship, units, reload = false) { } if (_unit_ship_id == -1) { - if (reload){ - if (_is_marine){ + if (reload) { + if (_is_marine) { _unit.last_ship = { uid: "", - name: "" + name: "", }; } else { - set_vehicle_last_ship(_unit, true) + set_vehicle_last_ship(_unit, true); } } - continue; + continue; } - if (_unit_ship_id 0) { - _psionic = $"{unit.psionic}/{_psy_powers_count}"; - _tooltip = generate_marine_powers_description_string(unit); - } + //mobility + var _data = { + tooltip: $"==Second Weapon==\n{is_struct(equip_data.weapon_two_data) ? equip_data.weapon_two_data.item_tooltip_desc_gen() : ""}", + colour: quality_color(unit.weapon_two_quality), + max_width: 187, + }; - // Corruption - if ((obj_controller.chaos_rating > 0) && (_psionic != "")) { - _psionic = $"{_psionic}\n{max(0, unit.corruption())}% Corruption."; - } + unit_manage_constants.wep2_string = new ReactiveString(unit.equipments_qual_string("wep2", true), 0, 0, _data); - unit_manage_constants.psy = new LabeledIcon(spr_icon_psyker, _psionic, 0, 0, { - icon_width : 24, - icon_height : 24, - tooltip: $"==Psychic Stats==\n{_tooltip}", - }); - // Damage Resistance - - var _res_tool = "Health damage taken by the marine is reduced by this percentage. This happens after the flat reduction from armor.\n\nContributing factors:\n"; - var equipment_types = ["armour", "weapon_one", "weapon_two", "mobility", "gear"]; - - for (var i = 0; i < array_length(equipment_types); i++) { - var equipment_type = equipment_types[i]; - var dr = 0; - var name = ""; - switch (equipment_type) { - case "armour": - dr = unit.get_armour_data("damage_resistance_mod"); - name = unit.get_armour_data("name"); - break; - case "weapon_one": - dr = unit.get_weapon_one_data("damage_resistance_mod"); - name = unit.get_weapon_one_data("name"); - break; - case "weapon_two": - dr = unit.get_weapon_two_data("damage_resistance_mod"); - name = unit.get_weapon_two_data("name"); - break; - case "mobility": - dr = unit.get_mobility_data("damage_resistance_mod"); - name = unit.get_mobility_data("name"); - break; - case "gear": - dr = unit.get_gear_data("damage_resistance_mod"); - name = unit.get_gear_data("name"); - break; - } - if (dr != 0) { - _res_tool += $"{name}: {dr}%\n"; - } - } - _res_tool += $"CON: {unit.constitution / 2}%\nEXP: {unit.experience / 10}%"; - - unit_manage_constants.damage_res = new LabeledIcon(spr_icon_iron_halo, $"{_damage_res}%",0,0,{ - icon_width : 24, - icon_height : 24, - tooltip: _res_tool, - }) - var _hp_val = $"{round(unit.hp())}/{round(unit.max_health())}"; - var _hp_tool = "A measure of how much punishment the creature can take. Marines can go into the negatives and still survive, but they'll require a bionic to become fighting fit once more.\n\nContributing factors:\n"; - _hp_tool += $"CON: {round(100 * (1 + ((unit.constitution - 40) * 0.025)))}\n"; - - for (var i = 0; i < array_length(equipment_types); i++) { - var equipment_type = equipment_types[i]; - var hp_mod = 0; - var name = ""; - switch (equipment_type) { - case "armour": - hp_mod = unit.get_armour_data("hp_mod"); - name = unit.get_armour_data("name"); - break; - case "weapon_one": - hp_mod = unit.get_weapon_one_data("hp_mod"); - name = unit.get_weapon_one_data("name"); - break; - case "weapon_two": - hp_mod = unit.get_weapon_two_data("hp_mod"); - name = unit.get_weapon_two_data("name"); - break; - case "mobility": - hp_mod = unit.get_mobility_data("hp_mod"); - name = unit.get_mobility_data("name"); - break; - case "gear": - hp_mod = unit.get_gear_data("hp_mod"); - name = unit.get_gear_data("name"); - break; + // Psyker things + var _psionic = ""; + var _psy_powers_known = unit.powers_known; + var _psy_powers_count = array_length(_psy_powers_known); + var _tooltip = ""; + if (_psy_powers_count > 0) { + _psionic = $"{unit.psionic}/{_psy_powers_count}"; + _tooltip = generate_marine_powers_description_string(unit); } - if (hp_mod != 0) { - _hp_tool += $"{name}: {format_number_with_sign(hp_mod)}%\n"; - } - } - unit_manage_constants.hp = new LabeledIcon(spr_icon_health, _hp_val, 0, 0, { - icon_width : 24, - icon_height : 24, - tooltip: _hp_tool, - }); - - - // ------------------------- - // Armour Rating - // ------------------------- - var _armour_val = $"{unit.armour_calc()}"; - var _armour_tool = "Reduces incoming damage at a flat rate. Certain enemies may attack in ways that may bypass your armor entirely, for example power weapons and some warp sorceries.\n\nContributing factors:\n"; - - for (var i = 0; i < array_length(equipment_types); i++) { - var equipment_type = equipment_types[i]; - var ac = 0; - var name = ""; - switch (equipment_type) { - case "armour": - ac = unit.get_armour_data("armour_value"); - name = unit.get_armour_data("name"); - break; - case "weapon_one": - ac = unit.get_weapon_one_data("armour_value"); - name = unit.get_weapon_one_data("name"); - break; - case "weapon_two": - ac = unit.get_weapon_two_data("armour_value"); - name = unit.get_weapon_two_data("name"); - break; - case "mobility": - ac = unit.get_mobility_data("armour_value"); - name = unit.get_mobility_data("name"); - break; - case "gear": - ac = unit.get_gear_data("armour_value"); - name = unit.get_gear_data("name"); - break; + // Corruption + if ((obj_controller.chaos_rating > 0) && (_psionic != "")) { + _psionic = $"{_psionic}\n{max(0, unit.corruption())}% Corruption."; } - if (ac != 0) { - _armour_tool += $"{name}: {ac}\n"; - } - } - if (obj_controller.stc_bonus[1] == 5 || obj_controller.stc_bonus[2] == 3) { - _armour_tool += "STC Bonus: x1.05\n"; - } + unit_manage_constants.psy = new LabeledIcon(spr_icon_psyker, _psionic, 0, 0, { + icon_width: 24, + icon_height: 24, + tooltip: $"==Psychic Stats==\n{_tooltip}", + }); + // Damage Resistance + + var _res_tool = "Health damage taken by the marine is reduced by this percentage. This happens after the flat reduction from armor.\n\nContributing factors:\n"; + var equipment_types = ["armour", "weapon_one", "weapon_two", "mobility", "gear"]; + + for (var i = 0; i < array_length(equipment_types); i++) { + var equipment_type = equipment_types[i]; + var dr = 0; + var name = ""; + switch (equipment_type) { + case "armour": + dr = unit.get_armour_data("damage_resistance_mod"); + name = unit.get_armour_data("name"); + break; + case "weapon_one": + dr = unit.get_weapon_one_data("damage_resistance_mod"); + name = unit.get_weapon_one_data("name"); + break; + case "weapon_two": + dr = unit.get_weapon_two_data("damage_resistance_mod"); + name = unit.get_weapon_two_data("name"); + break; + case "mobility": + dr = unit.get_mobility_data("damage_resistance_mod"); + name = unit.get_mobility_data("name"); + break; + case "gear": + dr = unit.get_gear_data("damage_resistance_mod"); + name = unit.get_gear_data("name"); + break; + } + if (dr != 0) { + _res_tool += $"{name}: {dr}%\n"; + } + } + _res_tool += $"CON: {unit.constitution / 2}%\nEXP: {unit.experience / 10}%"; - unit_manage_constants.armour = new LabeledIcon(spr_icon_shield2, _armour_val, 0, 0, { - icon_width : 24, - icon_height : 24, - tooltip: _armour_tool, - }); + unit_manage_constants.damage_res = new LabeledIcon(spr_icon_iron_halo, $"{_damage_res}%", 0, 0, { + icon_width: 24, + icon_height: 24, + tooltip: _res_tool, + }); + var _hp_val = $"{round(unit.hp())}/{round(unit.max_health())}"; + var _hp_tool = "A measure of how much punishment the creature can take. Marines can go into the negatives and still survive, but they'll require a bionic to become fighting fit once more.\n\nContributing factors:\n"; + _hp_tool += $"CON: {round(100 * (1 + ((unit.constitution - 40) * 0.025)))}\n"; + + for (var i = 0; i < array_length(equipment_types); i++) { + var equipment_type = equipment_types[i]; + var hp_mod = 0; + var name = ""; + switch (equipment_type) { + case "armour": + hp_mod = unit.get_armour_data("hp_mod"); + name = unit.get_armour_data("name"); + break; + case "weapon_one": + hp_mod = unit.get_weapon_one_data("hp_mod"); + name = unit.get_weapon_one_data("name"); + break; + case "weapon_two": + hp_mod = unit.get_weapon_two_data("hp_mod"); + name = unit.get_weapon_two_data("name"); + break; + case "mobility": + hp_mod = unit.get_mobility_data("hp_mod"); + name = unit.get_mobility_data("name"); + break; + case "gear": + hp_mod = unit.get_gear_data("hp_mod"); + name = unit.get_gear_data("name"); + break; + } + if (hp_mod != 0) { + _hp_tool += $"{name}: {format_number_with_sign(hp_mod)}%\n"; + } + } - unit_manage_constants.exp = new LabeledIcon(spr_icon_veteran, string(floor(unit.experience)), 0, 0, { - icon_width : 24, - icon_height : 24, - tooltip: $"==Experience==\nA measurement of how battle-hardened the unit is. Provides various bonuses across the board. Every 15 EXP, a new stat is assigned. Hover over the unit’s stats in the marine profile to see projected growth over time.", - }); + unit_manage_constants.hp = new LabeledIcon(spr_icon_health, _hp_val, 0, 0, { + icon_width: 24, + icon_height: 24, + tooltip: _hp_tool, + }); - // Melee Attack - var _melee = unit.melee_attack(); - unit_manage_constants.melee_attack = new LabeledIcon(spr_icon_weapon_skill, $"{round(_melee[0])}", 0, 0, { - icon_width : 24, - icon_height : 24, - tooltip: $"==Melee Attack==\n{_melee[1]}", - colour : unit.encumbered_melee? #bf4040 : CM_GREEN_COLOR - }); + // ------------------------- + // Armour Rating + // ------------------------- + var _armour_val = $"{unit.armour_calc()}"; + var _armour_tool = "Reduces incoming damage at a flat rate. Certain enemies may attack in ways that may bypass your armor entirely, for example power weapons and some warp sorceries.\n\nContributing factors:\n"; + + for (var i = 0; i < array_length(equipment_types); i++) { + var equipment_type = equipment_types[i]; + var ac = 0; + var name = ""; + switch (equipment_type) { + case "armour": + ac = unit.get_armour_data("armour_value"); + name = unit.get_armour_data("name"); + break; + case "weapon_one": + ac = unit.get_weapon_one_data("armour_value"); + name = unit.get_weapon_one_data("name"); + break; + case "weapon_two": + ac = unit.get_weapon_two_data("armour_value"); + name = unit.get_weapon_two_data("name"); + break; + case "mobility": + ac = unit.get_mobility_data("armour_value"); + name = unit.get_mobility_data("name"); + break; + case "gear": + ac = unit.get_gear_data("armour_value"); + name = unit.get_gear_data("name"); + break; + } + if (ac != 0) { + _armour_tool += $"{name}: {ac}\n"; + } + } - var _carry = _melee[2]; - unit_manage_constants.melee_burden = new LabeledIcon(spr_icon_weight, $"{_carry[0]}/{_carry[1]}", 0, 0, { - icon_width : 24, - icon_height : 24, - tooltip: $"==Melee Burden==\n{_carry[2]}", - colour : unit.encumbered_melee? #bf4040 : CM_GREEN_COLOR - }); + if (obj_controller.stc_bonus[1] == 5 || obj_controller.stc_bonus[2] == 3) { + _armour_tool += "STC Bonus: x1.05\n"; + } - // Ranged Attack - var _range = unit.ranged_attack(); - unit_manage_constants.ranged_attack = new LabeledIcon(spr_icon_ballistic_skill, $"{round(_range[0])}", 0, 0, { - icon_width : 24, - icon_height : 24, - tooltip: $"==Ranged Attack==\n{_range[1]}", - colour : unit.encumbered_ranged ? #bf4040 : CM_GREEN_COLOR - }); + unit_manage_constants.armour = new LabeledIcon(spr_icon_shield2, _armour_val, 0, 0, { + icon_width: 24, + icon_height: 24, + tooltip: _armour_tool, + }); - var _carry = _range[2]; - unit_manage_constants.ranged_burden = new LabeledIcon(spr_icon_weight, $"{_carry[0]}/{_carry[1]}", 0, 0, { - icon_width : 24, - icon_height : 24, - tooltip: $"==Ranged Burden==\n{_carry[2]}", - colour : unit.encumbered_ranged? #bf4040 : CM_GREEN_COLOR - }); + unit_manage_constants.exp = new LabeledIcon(spr_icon_veteran, string(floor(unit.experience)), 0, 0, { + icon_width: 24, + icon_height: 24, + tooltip: $"==Experience==\nA measurement of how battle-hardened the unit is. Provides various bonuses across the board. Every 15 EXP, a new stat is assigned. Hover over the unit’s stats in the marine profile to see projected growth over time.", + }); + // Melee Attack + var _melee = unit.melee_attack(); + unit_manage_constants.melee_attack = new LabeledIcon(spr_icon_weapon_skill, $"{round(_melee[0])}", 0, 0, { + icon_width: 24, + icon_height: 24, + tooltip: $"==Melee Attack==\n{_melee[1]}", + colour: unit.encumbered_melee ? #bf4040 : CM_GREEN_COLOR, + }); + var _carry = _melee[2]; + unit_manage_constants.melee_burden = new LabeledIcon(spr_icon_weight, $"{_carry[0]}/{_carry[1]}", 0, 0, { + icon_width: 24, + icon_height: 24, + tooltip: $"==Melee Burden==\n{_carry[2]}", + colour: unit.encumbered_melee ? #bf4040 : CM_GREEN_COLOR, + }); - // ------------------------- - // Bionics - // ------------------------- - var _bionic_val = $"{unit.bionics}"; - var _bionic_tool = "Bionic Augmentation is something a unit can do to both enhance their capabilities, but also replace a missing limb to get back into the fight."; - _bionic_tool += "\nThere is a limit of 10 Bionic augmentations. After that the damage is so extensive that a marine requires a dreadnought to keep going."; - _bionic_tool += "\nFor everyone else? It's time for the emperor's mercy."; - _bionic_tool += "\n\nCurrent Bionic Augmentations:\n"; + // Ranged Attack + var _range = unit.ranged_attack(); + unit_manage_constants.ranged_attack = new LabeledIcon(spr_icon_ballistic_skill, $"{round(_range[0])}", 0, 0, { + icon_width: 24, + icon_height: 24, + tooltip: $"==Ranged Attack==\n{_range[1]}", + colour: unit.encumbered_ranged ? #bf4040 : CM_GREEN_COLOR, + }); - var _body_parts = ARR_body_parts; - var _body_parts_display = ARR_body_parts_display; + var _carry = _range[2]; + unit_manage_constants.ranged_burden = new LabeledIcon(spr_icon_weight, $"{_carry[0]}/{_carry[1]}", 0, 0, { + icon_width: 24, + icon_height: 24, + tooltip: $"==Ranged Burden==\n{_carry[2]}", + colour: unit.encumbered_ranged ? #bf4040 : CM_GREEN_COLOR, + }); - for (var part = 0; part < array_length(_body_parts); part++) { - if (struct_exists(unit.body[$ _body_parts[part]], "bionic")) { - var part_display = _body_parts_display[part]; - _bionic_tool += $"Bionic {part_display}"; - switch (part_display) { - case "Left Leg": - case "Right Leg": - _bionic_tool += " (CON: +2 STR: +1 DEX: -2)\n"; - break; - case "Left Eye": - case "Right Eye": - _bionic_tool += " (CON: +1 WIS: +1 DEX: +1)\n"; - break; - case "Left Arm": - case "Right Arm": - _bionic_tool += " (CON: +2 STR: +2 WS: -1)\n"; - break; - case "Torso": - _bionic_tool += " (CON: +4 STR: +1 DEX: -1)\n"; - break; - case "Throat": - _bionic_tool += " (CHA: -1)\n"; - break; - case "Jaw": - case "Head": - _bionic_tool += " (CON: +1)\n"; - break; + // ------------------------- + // Bionics + // ------------------------- + var _bionic_val = $"{unit.bionics}"; + var _bionic_tool = "Bionic Augmentation is something a unit can do to both enhance their capabilities, but also replace a missing limb to get back into the fight."; + _bionic_tool += "\nThere is a limit of 10 Bionic augmentations. After that the damage is so extensive that a marine requires a dreadnought to keep going."; + _bionic_tool += "\nFor everyone else? It's time for the emperor's mercy."; + _bionic_tool += "\n\nCurrent Bionic Augmentations:\n"; + + var _body_parts = ARR_body_parts; + var _body_parts_display = ARR_body_parts_display; + + for (var part = 0; part < array_length(_body_parts); part++) { + if (struct_exists(unit.body[$ _body_parts[part]], "bionic")) { + var part_display = _body_parts_display[part]; + _bionic_tool += $"Bionic {part_display}"; + switch (part_display) { + case "Left Leg": + case "Right Leg": + _bionic_tool += " (CON: +2 STR: +1 DEX: -2)\n"; + break; + case "Left Eye": + case "Right Eye": + _bionic_tool += " (CON: +1 WIS: +1 DEX: +1)\n"; + break; + case "Left Arm": + case "Right Arm": + _bionic_tool += " (CON: +2 STR: +2 WS: -1)\n"; + break; + case "Torso": + _bionic_tool += " (CON: +4 STR: +1 DEX: -1)\n"; + break; + case "Throat": + _bionic_tool += " (CHA: -1)\n"; + break; + case "Jaw": + case "Head": + _bionic_tool += " (CON: +1)\n"; + break; + } } } - } - unit_manage_constants.bionics = new LabeledIcon(spr_icon_bionics, _bionic_val, 0, 0, { - icon_width : 24, - icon_height : 24, - tooltip: _bionic_tool, - }); + unit_manage_constants.bionics = new LabeledIcon(spr_icon_bionics, _bionic_val, 0, 0, { + icon_width: 24, + icon_height: 24, + tooltip: _bionic_tool, + }); - if (is_struct(unit_manage_image)) { - try { - unit_manage_image.destroy_image(); + if (is_struct(unit_manage_image)) { + try { + unit_manage_image.destroy_image(); + } + delete unit_manage_image; } - delete unit_manage_image; - } - unit_manage_image = unit.draw_unit_image(); + unit_manage_image = unit.draw_unit_image(); - temp[122] = unit.handle_stat_growth(); - /*if (man[sel]="vehicle"){ + temp[122] = unit.handle_stat_growth(); + /*if (man[sel]="vehicle"){ // TODO }*/ - } catch(_exception){ - //not sure handling with normal method exception could just be a pain here } + catch (_exception) {} //not sure handling with normal method exception could just be a pain here } -function company_specific_management(){ + +function company_specific_management() { add_draw_return_values(); draw_set_font(fnt_40k_30b); draw_set_halign(fa_center); @@ -485,35 +481,36 @@ function company_specific_management(){ } } // Draw the company followed by chapters name - draw_text(800, 74, $"{_company_name}, {global.chapter_name}"); - if (managing <= 10 ) { + draw_text(800, 74, $"{_company_name}, {global.chapter_name}"); + if (managing <= 10) { var _text_input = management_buttons.company_namer; - + obj_ini.company_title[managing] = _text_input.draw(obj_ini.company_title[managing]); _allow_shorts = !_text_input.allow_input; } else { _allow_shorts = true; } - if (allow_shortcuts){ + if (allow_shortcuts) { allow_shortcuts = _allow_shorts; } - pop_draw_return_values() + pop_draw_return_values(); } function alternative_manage_views(x1, y1) { //for some reason management_buttons keeps dying so hopefully this will solve the issue until something better can be found - if (!is_struct(management_buttons)){ + if (!is_struct(management_buttons)) { init_manage_buttons(); } var _squad_button = management_buttons.squad_toggle; - _squad_button.update({ - x1: x1 + 5, - y1: y1 + 6, - label: !obj_controller.view_squad && !obj_controller.company_report ? "Squad View" : "Company View", - keystroke: keyboard_check_pressed(ord("S")) && allow_shortcuts - }); + _squad_button + .update({ + x1: x1 + 5, + y1: y1 + 6, + label: !obj_controller.view_squad && !obj_controller.company_report ? "Squad View" : "Company View", + keystroke: keyboard_check_pressed(ord("S")) && allow_shortcuts, + }); - if (company_data.has_squads){ + if (company_data.has_squads) { if (_squad_button.draw(!text_bar)) { view_squad = !view_squad; if (view_squad) { @@ -524,24 +521,26 @@ function alternative_manage_views(x1, y1) { if (!view_squad) { var _profile_toggle = management_buttons.profile_toggle; - _profile_toggle.update({ - label: !unit_profile ? "Show Profile" : "Hide Profile", - x1: _squad_button.x2, - y1: _squad_button.y1, - keystroke: keyboard_check_pressed(ord("P")) && allow_shortcuts - }); + _profile_toggle + .update({ + label: !unit_profile ? "Show Profile" : "Hide Profile", + x1: _squad_button.x2, + y1: _squad_button.y1, + keystroke: keyboard_check_pressed(ord("P")) && allow_shortcuts, + }); if (_profile_toggle.draw(!text_bar)) { unit_profile = !unit_profile; } if (unit_profile) { var bio_toggle = management_buttons.bio_toggle; - bio_toggle.update({ - label: !unit_bio ? "Show Bio" : "Hide Bio", - x1: _profile_toggle.x2, - y1: _profile_toggle.y1, - keystroke: keyboard_check_pressed(ord("B")) && allow_shortcuts - }); + bio_toggle + .update({ + label: !unit_bio ? "Show Bio" : "Hide Bio", + x1: _profile_toggle.x2, + y1: _profile_toggle.y1, + keystroke: keyboard_check_pressed(ord("B")) && allow_shortcuts, + }); if (bio_toggle.draw(!text_bar)) { unit_bio = !unit_bio; } @@ -564,10 +563,11 @@ function alternative_manage_views(x1, y1) { } var _capture_button = management_buttons.capture_image; - _capture_button.update({ - x1: _last_button_x, - y1: _last_button_y - }); + _capture_button + .update({ + x1: _last_button_x, + y1: _last_button_y, + }); if (is_struct(obj_controller.unit_focus) && _capture_button.draw(!text_bar)) { // Capture the sprite frame as PNG @@ -590,7 +590,8 @@ function alternative_manage_views(x1, y1) { var index = 0; var path; - for (var i=0;i<=1000;i++){ // safety limit + for (var i = 0; i <= 1000; i++) { + // safety limit path = base_name + string(index) + extension; if (!file_exists(path)) { break; @@ -607,12 +608,11 @@ function alternative_manage_views(x1, y1) { } } - -function draw_sprite_and_unit_equip_data(){ +function draw_sprite_and_unit_equip_data() { draw_set_font(fnt_40k_14); - draw_set_halign(fa_left); + draw_set_halign(fa_left); // Swap between squad view and normal view - company_data.unit_ui_panel.inside_method = function(){ + company_data.unit_ui_panel.inside_method = function() { var _unit_tooltips = []; draw_set_color(c_gray); var xx = company_data.unit_ui_panel.XX; @@ -621,7 +621,7 @@ function draw_sprite_and_unit_equip_data(){ draw_set_font(fnt_40k_14b); if (is_struct(obj_controller.unit_focus)) { var selected_unit = obj_controller.unit_focus; //unit struct - if (!array_equals([selected_unit.company, selected_unit.marine_number], unit_manage_constants.current_data)){ + if (!array_equals([selected_unit.company, selected_unit.marine_number], unit_manage_constants.current_data)) { reset_manage_unit_constants(selected_unit); } ///tooltip_text stacks hover over type tooltips into an array and draws them last so as not to create drawing order issues @@ -672,7 +672,7 @@ function draw_sprite_and_unit_equip_data(){ var cur_squad = company_data.grab_current_squad(); var sgt_possible = cur_squad.type != "command_squad" && !selected_unit.IsSpecialist(SPECIALISTS_SQUAD_LEADERS); if (selected_unit != cur_squad.squad_leader) { - if (point_and_click(draw_unit_buttons([xx + 200 + 50, yy + 329], "Make Sgt", [1, 1], #50a076, , , sgt_possible ? 1 : 0.5)) && sgt_possible) { + if (point_and_click(draw_unit_buttons([xx + 200 + 50, yy + 329], "Make Sgt", [1, 1], #50a076,,, sgt_possible ? 1 : 0.5)) && sgt_possible) { cur_squad.change_sgt(selected_unit); } } @@ -689,7 +689,7 @@ function draw_sprite_and_unit_equip_data(){ y1: yy + 36, text1: "", text2: "", - text3: selected_unit.name() + text3: selected_unit.name(), }; _name_box.y2 = _name_box.y1 + 20; _name_box.y3 = _name_box.y2 + 20; @@ -709,7 +709,6 @@ function draw_sprite_and_unit_equip_data(){ draw_set_font(fnt_40k_30b); draw_text_transformed_outline(_name_box.x1, _name_box.y3, _name_box.text3, 0.7, 0.7, 0); - // Draw unit info draw_set_font(fnt_40k_14); // Left side of the screen @@ -719,118 +718,154 @@ function draw_sprite_and_unit_equip_data(){ // Equipment var _armour = unit_manage_constants.armour_string; - _armour.update({x1:x_left, y1 :yy + 179}); + _armour + .update({ + x1: x_left, + y1: yy + 179, + }); _armour.draw(); var _gear = unit_manage_constants.gear_string; - _gear.update({x1:x_left, y1 :yy + 305}); + _gear + .update({ + x1: x_left, + y1: yy + 305, + }); _gear.draw(); - var _mobi = unit_manage_constants.mobi_string; - _mobi.update({x1:x_left, y1 :yy + 326}); + _mobi + .update({ + x1: x_left, + y1: yy + 326, + }); _mobi.draw(); - var _wep1 = unit_manage_constants.wep1_string; - _wep1.update({x1:x_left, y1 :yy + 204}); + _wep1 + .update({ + x1: x_left, + y1: yy + 204, + }); _wep1.draw(); - var _wep2 = unit_manage_constants.wep2_string; - _wep2.update({x1:x_left, y1 :yy + 254}); + _wep2 + .update({ + x1: x_left, + y1: yy + 254, + }); - _wep2.draw(); + _wep2.draw(); // Stats // Bionics trackers - unit_manage_constants.bionics.update({ - x1 : x_left+84, - y1 : yy+63, - }); + unit_manage_constants + .bionics + .update({ + x1: x_left + 84, + y1: yy + 63, + }); unit_manage_constants.bionics.draw(); - unit_manage_constants.armour.update({ - x1 : x_left-6, - y1 : yy+87, - }); + unit_manage_constants + .armour + .update({ + x1: x_left - 6, + y1: yy + 87, + }); unit_manage_constants.armour.draw(); - unit_manage_constants.hp.update({ - x1 : x_left-6, - y1 : yy + 63, - }); + unit_manage_constants + .hp + .update({ + x1: x_left - 6, + y1: yy + 63, + }); unit_manage_constants.hp.draw(); // Experience - unit_manage_constants.exp.update({ - x1 : x_left-6, - y1 : yy + 39, - }); + unit_manage_constants + .exp + .update({ + x1: x_left - 6, + y1: yy + 39, + }); unit_manage_constants.exp.draw(); - unit_manage_constants.damage_res.update({ - x1 : x_left+84, - y1: yy+87, - }); + unit_manage_constants + .damage_res + .update({ + x1: x_left + 84, + y1: yy + 87, + }); unit_manage_constants.damage_res.draw(); - // Psyker things + // Psyker things - if (array_length(selected_unit.powers_known)){ - unit_manage_constants.psy.update({ - x1 : x_left+84, - y1: yy+39, - }); + if (array_length(selected_unit.powers_known)) { + unit_manage_constants + .psy + .update({ + x1: x_left + 84, + y1: yy + 39, + }); unit_manage_constants.psy.draw(); } - unit_manage_constants.melee_attack.update({ - x1 : x_left-6, - y1: yy+111, - }); + unit_manage_constants + .melee_attack + .update({ + x1: x_left - 6, + y1: yy + 111, + }); unit_manage_constants.melee_attack.draw(); - unit_manage_constants.ranged_attack.update({ - x1 : x_left-6, - y1: yy+135, - }); + unit_manage_constants + .ranged_attack + .update({ + x1: x_left - 6, + y1: yy + 135, + }); unit_manage_constants.ranged_attack.draw(); - unit_manage_constants.melee_burden.update({ - x1 : x_left+84, - y1: yy+111, - }); + unit_manage_constants + .melee_burden + .update({ + x1: x_left + 84, + y1: yy + 111, + }); unit_manage_constants.melee_burden.draw(); + unit_manage_constants + .ranged_burden + .update({ + x1: x_left + 84, + y1: yy + 135, + }); - unit_manage_constants.ranged_burden.update({ - x1 : x_left+84, - y1: yy+135, - }); - - unit_manage_constants.ranged_burden.draw(); - + unit_manage_constants.ranged_burden.draw(); } - setup_tooltip_list(_unit_tooltips) - } - if (!instance_exists(obj_popup)){ + setup_tooltip_list(_unit_tooltips); + }; + if (!instance_exists(obj_popup)) { company_data.unit_ui_panel.draw_with_dimensions(); } } + /// @mixin function scr_ui_manage() { if (combat != 0) { @@ -864,7 +899,7 @@ function scr_ui_manage() { } var unit, x1, x2, x3, y1, y2, y3, text; var tooltip_text = "", bionic_tooltip = ""; - company_data.tooltip_drawing = []; + company_data.tooltip_drawing = []; var xx = __view_get(e__VW.XView, 0) + 0, yy = __view_get(e__VW.YView, 0) + 0, bb = "", img = 0; // Draw BG @@ -882,14 +917,13 @@ function scr_ui_manage() { if (struct_exists(selection_data, "purpose")) { draw_text(xx + 800, yy + 74, $"{selection_data.purpose}"); } - if (selection_data.select_type == MissionSelectType.Squads){ + if (selection_data.select_type == MissionSelectType.Squads) { view_squad = true; } } draw_set_font(fnt_40k_14); - if (managing >= 0) { // Draw arrows draw_sprite_ext(spr_arrow, 0, xx + 25, yy + 70, 2, 2, 0, c_white, 1); // Back @@ -900,7 +934,7 @@ function scr_ui_manage() { x1: xx + 1008, y1: yy + 141, w: 568, - h: 681 + h: 681, }; right_ui_block.x2 = right_ui_block.x1 + right_ui_block.w; right_ui_block.y2 = right_ui_block.y1 + right_ui_block.h; @@ -909,7 +943,7 @@ function scr_ui_manage() { x1: right_ui_block.x1, y1: yy + 520, w: 569, - h: 302 + h: 302, }; actions_block.x2 = actions_block.x1 + actions_block.w; actions_block.y2 = actions_block.y1 + actions_block.h; @@ -919,7 +953,6 @@ function scr_ui_manage() { draw_rectangle_color_simple(actions_block.x1 + 1, actions_block.y1 + 1, actions_block.x2 - 1, actions_block.y2 - 1, 1, c_black); draw_rectangle_color_simple(actions_block.x1 + 2, actions_block.y1 + 2, actions_block.x2 - 2, actions_block.y2 - 2, 1, c_gray); - draw_set_color(c_white); // Back @@ -940,62 +973,62 @@ function scr_ui_manage() { //tooltip text to tell you if a unit is eligible for special roles - get_command_slots_data = function(){ + get_command_slots_data = function() { var _command_slots_data = [ { search_params: {}, role_group_params: { group: "captain_candidates", location: "", - opposite: false + opposite: false, }, purpose: $"{int_to_roman(managing)} Company Captain Candidates", purpose_code: "captain_promote", button_text: "New Captain Required", - unit_check: "captain" + unit_check: "captain", }, { search_params: { stat: [["weapon_skill", 44, "more"]], - companies: managing + companies: managing, }, role_group_params: { group: [SPECIALISTS_STANDARD, true, true], location: "", - opposite: true + opposite: true, }, purpose: $"{int_to_roman(managing)} Company Champion Candidates", purpose_code: "champion_promote", button_text: "Champion Required", - unit_check: "champion" + unit_check: "champion", }, { search_params: { - companies: managing + companies: managing, }, role_group_params: { group: [SPECIALISTS_STANDARD, true, true], location: "", - opposite: true + opposite: true, }, purpose: $"{int_to_roman(managing)} Company Ancient Candidates", purpose_code: "ancient_promote", button_text: "Ancient Required", - unit_check: "ancient" + unit_check: "ancient", }, { search_params: { - companies: [managing, 0] + companies: [managing, 0], }, role_group_params: { group: [SPECIALISTS_CHAPLAINS, false, false], location: "", - opposite: false + opposite: false, }, purpose: $"{int_to_roman(managing)} Company Chaplain Candidates", purpose_code: "chaplain_promote", button_text: "Chaplain Required", - unit_check: "chaplain" + unit_check: "chaplain", }, { search_params: { @@ -1004,12 +1037,12 @@ function scr_ui_manage() { role_group_params: { group: [SPECIALISTS_APOTHECARIES, false, false], location: "", - opposite: false + opposite: false, }, purpose: $"{int_to_roman(managing)} Company Apothecary Candidates", purpose_code: "apothecary_promote", button_text: "Apothecary Required", - unit_check: "apothecary" + unit_check: "apothecary", }, { search_params: { @@ -1018,35 +1051,35 @@ function scr_ui_manage() { role_group_params: { group: [SPECIALISTS_TECHS, false, false], location: "", - opposite: false + opposite: false, }, purpose: $"{int_to_roman(managing)} Company Tech Marine Candidates", purpose_code: "tech_marine_promote", button_text: "Tech Marine Required", - unit_check: "tech_marine" + unit_check: "tech_marine", } ]; - if(!scr_has_disadv("Psyker Intolerant")){ + if (!scr_has_disadv("Psyker Intolerant")) { array_push(_command_slots_data, { search_params: { - companies: [managing, 0] + companies: [managing, 0], }, role_group_params: { group: [SPECIALISTS_LIBRARIANS, false, false], location: "", - opposite: false + opposite: false, }, purpose: $"{int_to_roman(managing)} Company Librarian Candidates", purpose_code: "librarian_promote", button_text: "Librarian Required", - unit_check: "lib" + unit_check: "lib", }); } - + return _command_slots_data; - } - + }; + if (!obj_controller.view_squad) { var repetitions = min(man_max, MANAGE_MAN_SEE); man_count = 0; @@ -1070,14 +1103,14 @@ function scr_ui_manage() { } } - var _only_display_selected = (instance_exists(obj_popup) && (obj_popup.type == 5 || obj_popup.type == 5.1 || obj_popup.type == 6)); + var _only_display_selected = instance_exists(obj_popup) && (obj_popup.type == 5 || obj_popup.type == 5.1 || obj_popup.type == 6); for (var i = 0; i < max(0, repetitions); i++) { draw_set_font(fnt_40k_14); if (sel >= array_length(display_unit)) { break; } - while ((sel <= array_length(display_unit) - 1) && (man[sel] == "hide" || (man_sel[sel] != 1 && _only_display_selected))) { + while ((sel <= array_length(display_unit) - 1) && (man[sel] == "hide" || (man_sel[sel] != 1 && _only_display_selected))) { sel += 1; } if (sel >= array_length(display_unit)) { @@ -1146,7 +1179,7 @@ function scr_ui_manage() { yy += 8; var _draw_selec_buttons = !obj_controller.unit_profile && !stats_displayed; - if (_draw_selec_buttons && instance_exists(obj_popup)){ + if (_draw_selec_buttons && instance_exists(obj_popup)) { _draw_selec_buttons = obj_popup.type != POPUP_TYPE.EQUIP; } if (_draw_selec_buttons) { @@ -1161,7 +1194,7 @@ function scr_ui_manage() { if ((selected_unit.name() != "") && (selected_unit.race() != 0)) { draw_set_alpha(1); var xx = __view_get(e__VW.XView, 0) + 0, yy = __view_get(e__VW.YView, 0) + 0; - if ((obj_controller.unit_profile) && !instance_exists(obj_popup)) { + if (obj_controller.unit_profile && !instance_exists(obj_popup)) { stats_displayed = true; selected_unit.stat_display(true); //tooltip_draw(stat_x, stat_y+string_height(stat_display),0,0,100,17); @@ -1252,7 +1285,7 @@ function scr_ui_manage() { if (point_and_click([xx + 25, yy + 70, xx + 70, yy + 140])) { man_size = 0; man_current = 0; - menu = eMENU.Manage;; + menu = eMENU.Manage; } var top, temp1 = "", temp2 = "", temp3 = "", temp4 = "", temp5 = ""; @@ -1301,8 +1334,7 @@ function scr_ui_manage() { } } - -function draw_manage_selection_buttons(xx,yy){ +function draw_manage_selection_buttons(xx, yy) { var sel_loading = obj_controller.selecting_ship; var _non_control_loc = location_out_of_player_control(selecting_location); //draws hover over tooltips @@ -1502,14 +1534,14 @@ function draw_manage_selection_buttons(xx,yy){ button.label = "Manage Tags"; button.keystroke = keyboard_check(vk_shift) && keyboard_check_pressed(ord("F")); - button.tooltip = "Press Shift F" //Press Shift F"; + button.tooltip = "Press Shift F"; //Press Shift F"; button.alpha = 0.5; button.alpha = 1; if (button.draw()) { - if (!instance_exists(obj_popup)){ + if (!instance_exists(obj_popup)) { set_up_tag_manager(); - } else if (obj_popup.type == POPUP_TYPE.ADD_TAGS){ + } else if (obj_popup.type == POPUP_TYPE.ADD_TAGS) { instance_destroy(obj_popup); } } From 875758f787ae91670bf811b6770f84164030410a Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 15:46:28 -0500 Subject: [PATCH 28/45] Quick review of changes i've already made. --- scripts/scr_DataSlate/scr_DataSlate.gml | 1 - scripts/scr_buttons/scr_buttons.gml | 123 +-- .../scr_culture_visuals.gml | 749 +++--------------- 3 files changed, 140 insertions(+), 733 deletions(-) diff --git a/scripts/scr_DataSlate/scr_DataSlate.gml b/scripts/scr_DataSlate/scr_DataSlate.gml index 5086b80b0b..f8d40d9325 100644 --- a/scripts/scr_DataSlate/scr_DataSlate.gml +++ b/scripts/scr_DataSlate/scr_DataSlate.gml @@ -543,6 +543,5 @@ function ShutterButton() constructor { } else { return false; } - // pop_draw_return_values(); // Unreachable, commented to silence compiler message GM2047 }; } diff --git a/scripts/scr_buttons/scr_buttons.gml b/scripts/scr_buttons/scr_buttons.gml index a369fdac24..a1f30cbf01 100644 --- a/scripts/scr_buttons/scr_buttons.gml +++ b/scripts/scr_buttons/scr_buttons.gml @@ -204,21 +204,8 @@ function LabeledIcon(icon, text, x1 = 0, y1 = 0, data = false) constructor { /// @param {array} [scale=[1,1]] Scale factors [x,y]. /// @param {sprite} [hover_sprite=-1] Optional hover sprite. /// @returns {array} [x1, y1, x2, y2] bounding box. -function draw_sprite_as_button( - position, - choice_sprite, - scale = [ - 1, - 1 - ], - hover_sprite = -1 -) { - var _pos = [ - position[0], - position[1], - position[0] + (sprite_get_width(choice_sprite) * scale[0]), - position[1] + (sprite_get_height(choice_sprite) * scale[1]) - ]; +function draw_sprite_as_button(position, choice_sprite, scale = [1, 1], hover_sprite = -1) { + var _pos = [position[0], position[1], position[0] + (sprite_get_width(choice_sprite) * scale[0]), position[1] + (sprite_get_height(choice_sprite) * scale[1])]; draw_sprite_ext(choice_sprite, 0, position[0], position[1], scale[0], scale[1], 0, c_white, scr_hit(_pos) ? 1 : 0.9); return _pos; } @@ -235,20 +222,7 @@ function draw_sprite_as_button( /// @param {bool} [bg=false] Draw background rectangle. /// @param {color} [bg_color=c_black] Background color. /// @returns {array} [x1, y1, x2, y2] bounding box. -function draw_unit_buttons( - position, - text, - size_mod = [ - 1.5, - 1.5 - ], - colour = c_gray, - _halign = fa_center, - font = fnt_40k_14b, - alpha_mult = 1, - bg = false, - bg_color = c_black -) { +function draw_unit_buttons(position, text, size_mod = [1.5, 1.5], colour = c_gray, _halign = fa_center, font = fnt_40k_14b, alpha_mult = 1, bg = false, bg_color = c_black) { // TODO: fix halign usage // Store current state of all global vars add_draw_return_values(); @@ -288,12 +262,7 @@ function draw_unit_buttons( // Reset all global vars to their previous state pop_draw_return_values(); - return [ - position[0], - position[1], - x2, - y2 - ]; + return [position[0], position[1], x2, y2]; } function standard_loc_data() { @@ -402,7 +371,7 @@ function UnitButtonObject(data = false) constructor { _button_click_area = draw_unit_buttons(w > 0 ? [x1, y1, x2, y2] : [x1, y1], label, [text_scale, text_scale], active ? color : inactive_col,, font, _temp_alpha); } else if (style == "pixel") { var _widths = [sprite_get_width(spr_pixel_button_left), sprite_get_width(spr_pixel_button_middle), sprite_get_width(spr_pixel_button_right)]; - + var height_scale = h / sprite_get_height(spr_pixel_button_left); _widths[0] *= height_scale; _widths[2] *= height_scale; @@ -417,18 +386,18 @@ function UnitButtonObject(data = false) constructor { draw_set_halign(fa_center); draw_set_valign(fa_middle); draw_set_color(color); - + draw_text_transformed(_text_position_x, y1 + ((h * height_scale) / 2), label, text_scale, text_scale, 0); - + x2 = x1 + array_sum(_widths); y2 = y1 + h; _button_click_area = [x1, y1, x2, y2]; } - + if (scr_hit(x1, y1, x2, y2) && tooltip != "") { tooltip_draw(tooltip); } - + if (allow_click && active) { var clicked = point_and_click(_button_click_area) || keystroke; if (clicked) { @@ -464,23 +433,7 @@ function PurchaseButton(req) : UnitButtonObject() constructor { static draw = function(allow_click = true) { add_draw_return_values(); - var _but = draw_unit_buttons( - [ - x1, - y1, - x2, - y2 - ], - label, - [ - 1, - 1 - ], - color, -, -, - alpha - ); + var _but = draw_unit_buttons([x1, y1, x2, y2], label, [1, 1], color,,, alpha); var _sh = sprite_get_height(spr_requisition); var _scale = (y2 - y1) / _sh; draw_sprite_ext(spr_requisition, 0, x1, y2, _scale, _scale, 0, c_white, 1); @@ -502,7 +455,6 @@ function PurchaseButton(req) : UnitButtonObject() constructor { pop_draw_return_values(); return false; } - //pop_draw_return_values(); // Unreachable, commented to silence compiler message GM2047 }; } @@ -511,10 +463,7 @@ function slider_bar() constructor { y1 = 0; w = 102; h = 15; - value_limits = [ - 0, - 0 - ]; + value_limits = [0, 0]; value_increments = 1; value = 0; dragging = false; @@ -535,12 +484,7 @@ function slider_bar() constructor { if (dragging) { dragging = mouse_check_button(mb_left); } - var _rect = [ - x1, - y1, - x1 + w, - y1 + h - ]; + var _rect = [x1, y1, x1 + w, y1 + h]; draw_rectangle_array(_rect, 1); width_increments = w / ((value_limits[1] - value_limits[0]) / value_increments); var __rel_cur_pos = increments * (value - value_limits[0]); @@ -617,12 +561,7 @@ function TextBarArea(XX, YY, Max_width = 400, requires_input = false) constructo } } string_h = string_height("LOL"); - var rect = [ - xx - (bar_wid / 2), - yy, - xx + (bar_wid / 2), - yy - 8 + string_h - ]; + var rect = [xx - (bar_wid / 2), yy, xx + (bar_wid / 2), yy - 8 + string_h]; background.XX = rect[0]; background.YY = rect[1]; background.width = rect[2] - rect[0]; @@ -673,18 +612,7 @@ function TextBarArea(XX, YY, Max_width = 400, requires_input = false) constructo function drop_down(selection, draw_x, draw_y, options, open_marker) { add_draw_return_values(); if (selection != "") { - var drop_down_area = draw_unit_buttons( - [ - draw_x, - draw_y - ], - selection, - [ - 1, - 1 - ], - c_green - ); + var drop_down_area = draw_unit_buttons([draw_x, draw_y], selection, [1, 1], c_green); draw_set_color(c_red); if (array_length(options) > 1) { if (scr_hit(drop_down_area)) { @@ -694,22 +622,7 @@ function drop_down(selection, draw_x, draw_y, options, open_marker) { if (options[col] == selection) { continue; } - var cur_option = draw_unit_buttons( - [ - draw_x, - draw_y + roll_down_offset - ], - options[col], - [ - 1, - 1 - ], - c_red, -, -, -, - true - ); + var cur_option = draw_unit_buttons([draw_x, draw_y + roll_down_offset], options[col], [1, 1], c_red,,,, true); if (point_and_click(cur_option)) { selection = options[col]; open_marker = false; @@ -727,11 +640,7 @@ function drop_down(selection, draw_x, draw_y, options, open_marker) { } } } - return [ - selection, - open_marker - ]; - //pop_draw_return_values(); // Unreachable, commented to silence compiler message GM2047 + return [selection, open_marker]; } /// @function MultiSelect(options_array, title, data) diff --git a/scripts/scr_culture_visuals/scr_culture_visuals.gml b/scripts/scr_culture_visuals/scr_culture_visuals.gml index 09bd5f2fb9..3dcba86ad3 100644 --- a/scripts/scr_culture_visuals/scr_culture_visuals.gml +++ b/scripts/scr_culture_visuals/scr_culture_visuals.gml @@ -32,22 +32,8 @@ function load_visual_sets() { set_up_visual_overides(); - load_symbol_sets( - global.chapter_symbols, - "chapter_symbols", - [ - "pauldron", - "knees" - ] - ); - load_symbol_sets( - global.role_markings, - "role_markings", - [ - "pauldron", - "knees" - ] - ); + load_symbol_sets(global.chapter_symbols, "chapter_symbols", ["pauldron", "knees"]); + load_symbol_sets(global.role_markings, "role_markings", ["pauldron", "knees"]); } function load_symbol_sets(global_area, main_key, sub_sets) { @@ -352,10 +338,7 @@ function set_up_visual_overides() { global.modular_drawing_items = [ { sprite: spr_purity_seal, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "purity_seals", }, { @@ -399,30 +382,18 @@ global.modular_drawing_items = [ sprite: spr_binders_robe, role_type: [SPECIALISTS_LIBRARIANS], max_saturation: 40, - chapter_adv: [ - "Favoured By The Warp", - "Warp Touched" - ], + chapter_adv: ["Favoured By The Warp", "Warp Touched"], chapter_disadv: ["Warp Tainted"], - allow_either: [ - "chapter_adv", - "chapter_disadv" - ], + allow_either: ["chapter_adv", "chapter_disadv"], }, { position: "belt", body_types: [0], sprite: spr_binders_belt, role_type: [SPECIALISTS_LIBRARIANS], - chapter_adv: [ - "Favoured By The Warp", - "Warp Touched" - ], + chapter_adv: ["Favoured By The Warp", "Warp Touched"], chapter_disadv: ["Warp Tainted"], - allow_either: [ - "chapter_adv", - "chapter_disadv" - ], + allow_either: ["chapter_adv", "chapter_disadv"], max_saturation: 50, }, { @@ -433,22 +404,13 @@ global.modular_drawing_items = [ "gear": "Psychic Hood", }, prevent_others: true, - subcomponents: [ - [ - spr_blank, - spr_psy_hood_components - ] - ], + subcomponents: [[spr_blank, spr_psy_hood_components]], }, { sprite: spr_da_mk5_helm_crests, cultures: ["Knightly"], body_types: [0], - armours: [ - "MK3 Iron Armour", - "MK4 Maximus", - "MK5 Heresy" - ], + armours: ["MK3 Iron Armour", "MK4 Maximus", "MK5 Heresy"], position: "crest", assign_by_rank: 2, exp: { @@ -459,49 +421,29 @@ global.modular_drawing_items = [ sprite: spr_da_mk7_helm_crests, cultures: ["Knightly"], body_types: [0], - armours: [ - "MK7 Aquila", - "Power Armour", - "MK8 Errant", - "Artificer Armour" - ], + armours: ["MK7 Aquila", "Power Armour", "MK8 Errant", "Artificer Armour"], position: "crest", assign_by_rank: 2, }, { sprite: spr_terminator_laurel, - armours: [ - "Terminator Armour", - "Tartaros" - ], - roles: [ - eROLE.Captain, - eROLE.Champion - ], + armours: ["Terminator Armour", "Tartaros"], + roles: [eROLE.Captain, eROLE.Champion], position: "crown", body_types: [2], }, { sprite: spr_laurel, body_types: [0], - armours: [ - "Terminator Armour", - "Tartaros" - ], - roles: [ - eROLE.Captain, - eROLE.Champion - ], + armours: ["Terminator Armour", "Tartaros"], + roles: [eROLE.Captain, eROLE.Champion], position: "crown", }, { sprite: spr_special_helm, body_types: [0], armours_exclude: ["MK3 Iron Armour"], - roles: [ - eROLE.Captain, - eROLE.Champion - ], + roles: [eROLE.Captain, eROLE.Champion], assign_by_rank: 2, position: "mouth_variants", }, @@ -512,10 +454,7 @@ global.modular_drawing_items = [ position: "crest", }, { - cultures: [ - "Cthonian", - "Gothic" - ], + cultures: ["Cthonian", "Gothic"], sprite: spr_chap_trim_right, body_types: [0], position: "right_trim", @@ -553,10 +492,7 @@ global.modular_drawing_items = [ role_type: [SPECIALISTS_TECHS], body_types: [0], position: "tabbard", - allow_either: [ - "cultures", - "role_type" - ], + allow_either: ["cultures", "role_type"], }, { cultures: ["Knightly"], @@ -579,10 +515,7 @@ global.modular_drawing_items = [ role_type: [SPECIALISTS_TECHS], body_types: [2], position: "tabbard", - allow_either: [ - "cultures", - "role_type" - ], + allow_either: ["cultures", "role_type"], }, { cultures: ["Flame Cult"], @@ -616,30 +549,21 @@ global.modular_drawing_items = [ sprite: spr_mk7_mouth_prussian, body_types: [0], position: "chest_variants", - armours: [ - "MK8 Errant", - "MK7 Aquila" - ], + armours: ["MK8 Errant", "MK7 Aquila"], }, { cultures: ["Mongol"], sprite: spr_mk7_mongol_chest_variants, body_types: [0], position: "chest_variants", - armours: [ - "MK8 Errant", - "MK7 Aquila" - ], + armours: ["MK8 Errant", "MK7 Aquila"], }, { cultures: ["Gladiator"], sprite: spr_mk7_gladiator_chest, body_types: [0], position: "chest_variants", - armours: [ - "MK8 Errant", - "MK7 Aquila" - ], + armours: ["MK8 Errant", "MK7 Aquila"], }, { cultures: ["Mongol"], @@ -668,13 +592,7 @@ global.modular_drawing_items = [ body_types: [0], position: "backpack", assign_by_rank: 3, - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour"], }, { cultures: ["Alpha"], @@ -682,24 +600,14 @@ global.modular_drawing_items = [ body_types: [0], position: "backpack", assign_by_rank: 3, - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour"], }, { chapter_adv: ["Reverent Guardians"], sprite: spr_pack_brazier3, traits: ["zealous_faith"], body_types: [0], - allow_either: [ - "chapter_adv", - "traits", - "role_type" - ], + allow_either: ["chapter_adv", "traits", "role_type"], role_type: [SPECIALISTS_CHAPLAINS], position: "backpack_decoration", assign_by_rank: 4, @@ -721,36 +629,20 @@ global.modular_drawing_items = [ sprite: spr_roman_centurian_crest, shadows: spr_roman_centurian_crest_shadows, body_types: [0], - cultures: [ - "Roman", - "Greek", - "Gladiator" - ], + cultures: ["Roman", "Greek", "Gladiator"], position: "crest", role_type: [SPECIALISTS_CAPTAIN_CANDIDATES], assign_by_rank: 2, }, { sprite: spr_marksmans_honor, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "purity_seals", - stats: [ - [ - "ballistic_skill", - 50, - "exmore" - ] - ], + stats: [["ballistic_skill", 50, "exmore"]], }, { sprite: spr_crux_on_chain, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "purity_seals", exp: { min: 100, @@ -779,90 +671,50 @@ global.modular_drawing_items = [ }, { sprite: spr_mk7_complex_crux_belt, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "belt", offsets: { "Tartaros": { x: 7, }, }, - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour", - "Tartaros" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour", "Tartaros"], exp: { min: 100, }, }, { sprite: spr_crux_belt_fancy, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "belt", offsets: { "Tartaros": { x: 7, }, }, - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour", - "Tartaros" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour", "Tartaros"], assign_by_rank: 3, exp: { min: 100, }, }, { - cultures: [ - "Knightly", - "Crusader" - ], + cultures: ["Knightly", "Crusader"], sprite: spr_mk7_rope_belt, body_types: [0], position: "belt", - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour", - "MK4 Maximus" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour", "MK4 Maximus"], assign_by_rank: 2, }, { - cultures: [ - "Knightly", - "Crusader", - "Gladiator" - ], + cultures: ["Knightly", "Crusader", "Gladiator"], sprite: spr_lion_belt, body_types: [0], position: "belt", exp: { min: 70, }, - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour"], assign_by_rank: 2, }, { @@ -873,13 +725,7 @@ global.modular_drawing_items = [ exp: { min: 50, }, - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour"], assign_by_rank: 3, }, { @@ -888,173 +734,86 @@ global.modular_drawing_items = [ position: "belt", role_type: [SPECIALISTS_CHAPLAINS], cultures: ["Gothic"], - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour" - ], - allow_either: [ - "cultures", - "role_type" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour"], + allow_either: ["cultures", "role_type"], }, { sprite: spr_tech_belt, body_types: [0], position: "belt", role_type: [SPECIALISTS_TECHS], - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour"], }, { cultures: ["Feral"], sprite: spr_teeth, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "purity_seals", - traits: [ - "tyrannic_vet", - "beast_slayer", - "feral" - ], - allow_either: [ - "cultures", - "traits" - ], + traits: ["tyrannic_vet", "beast_slayer", "feral"], + allow_either: ["cultures", "traits"], }, { cultures: ["Knightly"], sprite: spr_mk7_knightly_chest, body_types: [0], position: "chest_variants", - armours: [ - "MK8 Errant", - "MK7 Aquila", - "Artificer Armour" - ], + armours: ["MK8 Errant", "MK7 Aquila", "Artificer Armour"], }, { sprite: spr_ultra_belt, cultures: ["Ultra"], - body_types: [ - 0, - 2 - ], + body_types: [0, 2], assign_by_rank: 3, position: "belt", - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour", - "Tartaros" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour", "Tartaros"], }, { - cultures: [ - "Roman", - "Gladiator" - ], + cultures: ["Roman", "Gladiator"], sprite: spr_roman_tabbard, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "tabbard", max_saturation: 50, assign_by_rank: 3, exp: { min: 50, }, - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour", - "Tartaros", - "MK4 Maximus", - "MK3 Iron Armour" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour", "Tartaros", "MK4 Maximus", "MK3 Iron Armour"], }, { cultures: ["Cthonian"], sprite: spr_cthonian_tabbard, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "tabbard", max_saturation: 50, assign_by_rank: 3, exp: { min: 50, }, - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour", - "Tartaros", - "MK4 Maximus", - "MK3 Iron Armour" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour", "Tartaros", "MK4 Maximus", "MK3 Iron Armour"], }, { - cultures: [ - "Cthonian", - "Prussian" - ], + cultures: ["Cthonian", "Prussian"], sprite: spr_chain_mail_tabbard, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "tabbard", max_saturation: 50, assign_by_rank: 3, exp: { min: 50, }, - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour", - "Tartaros", - "MK4 Maximus", - "MK3 Iron Armour" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour", "Tartaros", "MK4 Maximus", "MK3 Iron Armour"], }, { cultures: ["Ultra"], sprite: spr_ultra_tassels, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "purity_seals", exp: { min: 80, }, }, { - cultures: [ - "Ultra", - "Roman" - ], + cultures: ["Ultra", "Roman"], sprite: spr_ultra_backpack, body_types: [0], position: "backpack", @@ -1064,10 +823,7 @@ global.modular_drawing_items = [ }, }, { - cultures: [ - "Ultra", - "Roman" - ], + cultures: ["Ultra", "Roman"], sprite: spr_roman_cloak, body_types: [0], position: "cloak", @@ -1085,11 +841,7 @@ global.modular_drawing_items = [ sprite: spr_mk7_chest_ultra, body_types: [0], position: "chest_variants", - armours: [ - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour" - ], + armours: ["MK7 Aquila", "MK8 Errant", "Artificer Armour"], }, { max_saturation: 50, @@ -1100,10 +852,7 @@ global.modular_drawing_items = [ armours: ["Terminator Armour"], }, { - cultures: [ - "Feral", - "Gothic" - ], + cultures: ["Feral", "Gothic"], sprite: spr_skull_on_chain, body_types: [2], position: "purity_seals", @@ -1111,10 +860,7 @@ global.modular_drawing_items = [ { cultures: ["Knightly"], sprite: spr_sword_pendant, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "purity_seals", }, { @@ -1189,20 +935,14 @@ global.modular_drawing_items = [ body_types: [0], position: "right_pauldron_embeleshments", max_saturation: 15, - armours_exclude: [ - "MK5 Heresy", - "MK6 Corvus" - ], + armours_exclude: ["MK5 Heresy", "MK6 Corvus"], flip: true, }, { sprite: spr_bonding_studs_right, body_types: [0], position: "right_pauldron_embeleshments", - armours: [ - "MK5 Heresy", - "MK6 Corvus" - ], + armours: ["MK5 Heresy", "MK6 Corvus"], flip: true, }, { @@ -1211,15 +951,8 @@ global.modular_drawing_items = [ body_types: [0], position: "right_pauldron_embeleshments", max_saturation: 30, - traits: [ - "blunt", - "cunning", - "brute" - ], - allow_either: [ - "cultures", - "traits" - ], + traits: ["blunt", "cunning", "brute"], + allow_either: ["cultures", "traits"], flip: true, }, { @@ -1267,22 +1000,13 @@ global.modular_drawing_items = [ role_type: [SPECIALISTS_CHAPLAINS], }, { - cultures: [ - "Feral", - "Wolf Cult" - ], + cultures: ["Feral", "Wolf Cult"], sprite: spr_wolf_tail, - body_types: [ - 2, - 0 - ], + body_types: [2, 0], position: "purity_seals", }, { - cultures: [ - "Feral", - "Wolf Cult" - ], + cultures: ["Feral", "Wolf Cult"], sprite: spr_right_pauldron_fur_hanging, body_types: [0], position: "right_pauldron_hangings", @@ -1290,10 +1014,7 @@ global.modular_drawing_items = [ flip: true, }, { - cultures: [ - "Feral", - "Wolf Cult" - ], + cultures: ["Feral", "Wolf Cult"], sprite: spr_term_right_fur_hanging, body_types: [2], position: "right_pauldron_hangings", @@ -1310,10 +1031,7 @@ global.modular_drawing_items = [ { cultures: ["Runic"], sprite: spr_runes_hanging, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "purity_seals", }, { @@ -1321,11 +1039,7 @@ global.modular_drawing_items = [ sprite: spr_mk7_wolf_cult_chest_variants, body_types: [0], position: "chest_variants", - armours: [ - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour" - ], + armours: ["MK7 Aquila", "MK8 Errant", "Artificer Armour"], }, { cultures: ["Wolf Cult"], @@ -1344,22 +1058,10 @@ global.modular_drawing_items = [ { cultures: ["Wolf Cult"], sprite: spr_fur_tabbard, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], position: "tabbard", max_saturation: 20, - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour", - "Tartaros", - "MK4 Maximus", - "MK3 Iron Armour" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour", "Tartaros", "MK4 Maximus", "MK3 Iron Armour"], }, { cultures: ["Runic"], @@ -1404,15 +1106,8 @@ global.modular_drawing_items = [ position: "right_shin", body_types: [0], sprite: spr_right_shin_spikes, - traits: [ - "blunt", - "cunning", - "brute" - ], - allow_either: [ - "cultures", - "traits" - ], + traits: ["blunt", "cunning", "brute"], + allow_either: ["cultures", "traits"], cultures: ["Cthonian"], max_saturation: 80, exp: { @@ -1446,10 +1141,7 @@ global.modular_drawing_items = [ "right_leg": "bionic", }, prevent_others: true, - ban: [ - "right_knee", - "knees" - ], + ban: ["right_knee", "knees"], flip: true, }, { @@ -1460,10 +1152,7 @@ global.modular_drawing_items = [ "right_leg": "bionic", }, prevent_others: true, - ban: [ - "right_knee", - "knees" - ], + ban: ["right_knee", "knees"], flip: true, }, { @@ -1478,16 +1167,9 @@ global.modular_drawing_items = [ { position: "forehead", sprite: spr_helm_decorations, - body_types: [ - 0, - 2 - ], + body_types: [0, 2], max_saturation: 50, - roles: [ - eROLE.Sergeant, - eROLE.Champion, - eROLE.VeteranSergeant - ], + roles: [eROLE.Sergeant, eROLE.Champion, eROLE.VeteranSergeant], offsets: { "Terminator Armour": { y: -10, @@ -1499,12 +1181,7 @@ global.modular_drawing_items = [ sprite: spr_cata_right_arm, body_types: [2], armours: ["Cataphractii"], - subcomponents: [ - [ - spr_blank, - spr_cata_right_armtrim - ] - ], + subcomponents: [[spr_blank, spr_cata_right_armtrim]], flip: true, }, { @@ -1519,12 +1196,7 @@ global.modular_drawing_items = [ sprite: spr_cata_tabbard_leather, body_types: [2], armours: ["Cataphractii"], - subcomponents: [ - [ - spr_blank, - spr_cata_tabbard_leather_hangings - ] - ], + subcomponents: [[spr_blank, spr_cata_tabbard_leather_hangings]], }, { position: "tabbard", @@ -1545,12 +1217,7 @@ global.modular_drawing_items = [ sprite: spr_cata_right_leg, body_types: [2], armours: ["Cataphractii"], - subcomponents: [ - [ - spr_blank, - spr_cata_heavy_toe_right - ] - ], + subcomponents: [[spr_blank, spr_cata_heavy_toe_right]], flip: true, }, { @@ -1558,22 +1225,12 @@ global.modular_drawing_items = [ sprite: spr_cata_shoulder_hanging_leather_right, body_types: [2], armours: ["Cataphractii"], - subcomponents: [ - [ - spr_blank, - spr_cata_shoulder_hanging_leather_right_tips - ] - ], + subcomponents: [[spr_blank, spr_cata_shoulder_hanging_leather_right_tips]], overides: { "left_pauldron_embeleshments": spr_cata_shoulder_hanging_leather_left, "tabbard": spr_cata_tabbard_leather, }, - subcomponents: [ - [ - spr_blank, - spr_cata_shoulder_hanging_leather_right_tips - ] - ], + subcomponents: [[spr_blank, spr_cata_shoulder_hanging_leather_right_tips]], flip: true, }, { @@ -1592,30 +1249,13 @@ global.modular_drawing_items = [ body_types: [2], position: "right_trim", armours: ["Cataphractii"], - subcomponents: [ - [ - spr_blank, - spr_cata_right_trim - ], - [ - spr_blank, - spr_cata_right_trim_2 - ], - [ - spr_blank, - spr_cata_right_trim_1 - ] - ], + subcomponents: [[spr_blank, spr_cata_right_trim], [spr_blank, spr_cata_right_trim_2], [spr_blank, spr_cata_right_trim_1]], flip: true, }, { position: "foreground_item", sprite: spr_gear_combat_shield, - body_types: [ - 0, - 1, - 2 - ], + body_types: [0, 1, 2], offsets: { "Terminator Armour": { y: -10, @@ -1625,12 +1265,7 @@ global.modular_drawing_items = [ x: -8, }, }, - subcomponents: [ - [ - spr_blank, - spr_combat_shield_bottom_part - ] - ], + subcomponents: [[spr_blank, spr_combat_shield_bottom_part]], equipped: { "gear": "Combat Shield", }, @@ -1664,10 +1299,7 @@ global.modular_drawing_items = [ { position: "backpack_decoration", sprite: spr_angelic_wings, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], cultures: ["Angelic"], assign_by_rank: 2, equipment_has_tag: { @@ -1679,11 +1311,7 @@ global.modular_drawing_items = [ sprite: spr_mk7_leg_variants, body_types: [0], shadows: spr_mk7_leg_variants_shadows, - armours: [ - "MK7 Aquila", - "Artificer Armour", - "MK8 Errant" - ], + armours: ["MK7 Aquila", "Artificer Armour", "MK8 Errant"], max_saturation: 30, }, { @@ -1691,33 +1319,17 @@ global.modular_drawing_items = [ sprite: spr_mk7_complex_backpack, body_types: [0], shadows: spr_mk7_complex_backpack_shadow, - armours: [ - "MK7 Aquila", - "Artificer Armour", - "MK8 Errant" - ], + armours: ["MK7 Aquila", "Artificer Armour", "MK8 Errant"], }, { position: "right_leg", sprite: spr_techmarine_right_leg, body_types: [0], - armours: [ - "MK5 Heresy", - "MK6 Corvus", - "MK7 Aquila", - "MK8 Errant", - "Artificer Armour" - ], - traits: [ - "tinkerer", - "flesh_is_weak" - ], + armours: ["MK5 Heresy", "MK6 Corvus", "MK7 Aquila", "MK8 Errant", "Artificer Armour"], + traits: ["tinkerer", "flesh_is_weak"], role_type: [SPECIALISTS_TECHS], shadows: spr_techmarine_right_leg_shadow, - allow_either: [ - "traits", - "role_type" - ], + allow_either: ["traits", "role_type"], max_saturation: 50, flip: true, }, @@ -1726,24 +1338,14 @@ global.modular_drawing_items = [ body_types: [0], sprite: spr_techmarine_chest, max_saturation: 50, - traits: [ - "tinkerer", - "flesh_is_weak" - ], + traits: ["tinkerer", "flesh_is_weak"], role_type: [SPECIALISTS_TECHS], - allow_either: [ - "traits", - "role_type" - ], + allow_either: ["traits", "role_type"], }, // "head": spr_techmarine_head, { position: "right_arm", - armours: [ - "MK3 Iron Armour", - "Artificer Armour", - "MK5 Heresy" - ], + armours: ["MK3 Iron Armour", "Artificer Armour", "MK5 Heresy"], sprite: spr_mk3_right_arm, body_types: [0], flip: true, @@ -1751,10 +1353,7 @@ global.modular_drawing_items = [ }, { position: "right_arm", - armours: [ - "MK5 Heresy", - "Artificer Armour" - ], + armours: ["MK5 Heresy", "Artificer Armour"], sprite: spr_mk5_right_arm, body_types: [0], flip: true, @@ -1762,10 +1361,7 @@ global.modular_drawing_items = [ }, { position: "right_arm", - armours: [ - "MK4 Maximus", - "Artificer Armour" - ], + armours: ["MK4 Maximus", "Artificer Armour"], sprite: spr_mk4_right_arm, shadows: spr_mk4_right_arm_shadow, body_types: [0], @@ -1773,12 +1369,7 @@ global.modular_drawing_items = [ }, { position: "right_arm", - armours: [ - "MK7 Aquila", - "Artificer Armour", - "MK6 Corvus", - "MK8 Errant" - ], + armours: ["MK7 Aquila", "Artificer Armour", "MK6 Corvus", "MK8 Errant"], sprite: spr_mk7_right_arm, shadows: spr_mk7_right_arm_shadow, body_types: [0], @@ -1866,14 +1457,7 @@ global.modular_drawing_items = [ shadows: spr_tartaros_right_leg_shadows, body_types: [2], flip: true, - subcomponents: [ - [ - spr_blank, - spr_blank, - spr_blank, - spr_tartaros_leg_rivets - ] - ], + subcomponents: [[spr_blank, spr_blank, spr_blank, spr_tartaros_leg_rivets]], }, { position: "right_trim", @@ -2103,7 +1687,6 @@ function scr_get_body_data(body_item_key, body_slot = "none") { } return item_key_map; } - // return false; // Unreachable, commented to silence compiler message GM2047 } function generate_marine_body() { @@ -2176,50 +1759,26 @@ function generate_marine_body() { function add_purity_seal_markers() { if (irandom(3) == 0) { - body[$ "torso"][$ "purity_seal"] = [ - irandom(100), - irandom(100), - irandom(100), - irandom(100) - ]; + body[$ "torso"][$ "purity_seal"] = [irandom(100), irandom(100), irandom(100), irandom(100)]; } if (irandom(3) == 0) { - body[$ "left_arm"][$ "purity_seal"] = [ - irandom(100), - irandom(100), - irandom(100), - irandom(100) - ]; + body[$ "left_arm"][$ "purity_seal"] = [irandom(100), irandom(100), irandom(100), irandom(100)]; } if (irandom(3) == 0) { - body[$ "right_arm"][$ "purity_seal"] = [ - irandom(100), - irandom(100), - irandom(100), - irandom(100) - ]; + body[$ "right_arm"][$ "purity_seal"] = [irandom(100), irandom(100), irandom(100), irandom(100)]; } if (irandom(3) == 0) { - body[$ "left_leg"][$ "purity_seal"] = [ - irandom(100), - irandom(100), - irandom(100), - irandom(100) - ]; + body[$ "left_leg"][$ "purity_seal"] = [irandom(100), irandom(100), irandom(100), irandom(100)]; } if (irandom(3) == 0) { - body[$ "right_leg"][$ "purity_seal"] = [ - irandom(100), - irandom(100), - irandom(100), - irandom(100) - ]; + body[$ "right_leg"][$ "purity_seal"] = [irandom(100), irandom(100), irandom(100), irandom(100)]; } } function format_weapon_visuals(weapon_name) { + var _weapon_visual_data; if (struct_exists(global.weapon_visual_data, weapon_name)) { - var _weapon_visual_data = global.weapon_visual_data[$ weapon_name]; + _weapon_visual_data = global.weapon_visual_data[$ weapon_name]; } else { return []; } @@ -2293,10 +1852,7 @@ global.weapon_visual_data = { display_type: "ranged_twohand", new_weapon_draw: true, }, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], }, variants: [ { @@ -2320,10 +1876,7 @@ global.weapon_visual_data = { display_type: "ranged_twohand", }, sprite: spr_weapon_volkite_culverin, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], } ], }, @@ -2374,10 +1927,7 @@ global.weapon_visual_data = { display_type: "ranged_twohand", new_weapon_draw: true, }, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], }, variants: [ { @@ -2431,10 +1981,7 @@ global.weapon_visual_data = { display_type: "ranged_twohand", new_weapon_draw: true, }, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], }, variants: [ { @@ -2449,10 +1996,7 @@ global.weapon_visual_data = { display_type: "ranged_twohand", new_weapon_draw: true, }, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], }, variants: [ { @@ -2509,10 +2053,7 @@ global.weapon_visual_data = { display_type: "ranged_twohand", new_weapon_draw: true, }, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], }, variants: [ { @@ -2527,10 +2068,7 @@ global.weapon_visual_data = { display_type: "ranged_twohand", new_weapon_draw: true, }, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], }, variants: [ { @@ -2577,19 +2115,13 @@ global.weapon_visual_data = { display_type: "ranged_twohand", }, sprite: spr_weapon_hflamer, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], } ], }, "Lascannon": { base: { - body_types: [ - 0, - 1 - ], + body_types: [0, 1], weapon_data: { display_type: "ranged_twohand", }, @@ -2692,10 +2224,7 @@ global.weapon_visual_data = { }, "Multi-Melta": { base: { - body_types: [ - 0, - 1 - ], + body_types: [0, 1], weapon_data: { display_type: "ranged_twohand", }, @@ -3020,10 +2549,7 @@ global.weapon_visual_data = { display_type: "ranged_twohand", }, sprite: spr_weapon_plasc, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], }, { sprite: spr_dread_plasma_cannon, @@ -3049,10 +2575,7 @@ global.weapon_visual_data = { display_type: "ranged_twohand", }, sprite: spr_weapon_grav_cannon, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], } ], }, @@ -3070,10 +2593,7 @@ global.weapon_visual_data = { }, { sprite: spr_weapon_powfist, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], weapon_data: { display_type: "normal_fist", }, @@ -3094,10 +2614,7 @@ global.weapon_visual_data = { }, { sprite: spr_weapon_lightning1, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], weapon_data: { display_type: "normal_fist", }, @@ -3110,10 +2627,7 @@ global.weapon_visual_data = { display_type: "normal_fist", arm_type: 1, }, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], }, variants: [ { @@ -3149,10 +2663,7 @@ global.weapon_visual_data = { display_type: "normal_fist", arm_type: 1, }, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], }, variants: [ { @@ -3174,10 +2685,7 @@ global.weapon_visual_data = { display_type: "normal_fist", arm_type: 1, }, - body_types: [ - 0, - 1 - ], + body_types: [0, 1], }, variants: [ { @@ -3345,16 +2853,7 @@ global.weapon_visual_data = { variants: [ { sprite: spr_weapon_powswo, - subcomponents: [ - [ - spr_blank, - spr_pow_sword_cross_guard - ], - [ - spr_blank, - spr_pow_sword_blade_additions - ] - ], + subcomponents: [[spr_blank, spr_pow_sword_cross_guard], [spr_blank, spr_pow_sword_blade_additions]], }, { cultures: ["Mongol"], From f8fe233969ae53d64acbbe54bc41a593f6dec4fc Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 16:37:21 -0500 Subject: [PATCH 29/45] Huh the linter broke there for some reason that I can't figure out. --- scripts/is_specialist/is_specialist.gml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index 74c0a30020..f3a6fadecf 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -1,7 +1,3 @@ -❌ Formatting made the code invalid! -Syntax error at line 109, column 27: -unexpected '[$' - #macro SPECIALISTS_APOTHECARIES "apothecaries" #macro SPECIALISTS_CHAPLAINS "chaplains" #macro SPECIALISTS_LIBRARIANS "librarians" From 7771789791ae74f978b247600235fad64f6864d8 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 16:43:06 -0500 Subject: [PATCH 30/45] I lied it was glaringly obvious don't mix your struct string literals with an array of strings! --- scripts/is_specialist/is_specialist.gml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index f3a6fadecf..70c17abd44 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -32,7 +32,7 @@ function role_groups(group, include_trainee = false, include_heads = true) { switch (group) { case SPECIALISTS_STANDARD: - _role_list = [_roles[eROLE.Captain], _roles[eROLE.Dreadnought], $"Venerable {_roles[eROLE.Dreadnought]}", _roles[eROLE.Champion], _roles[eROLE.Chaplain], _roles[eROLE.Apothecary], _roles[eROLE.Techmarine], _roles[eROLE.Librarian], "Codiciery", "Lexicanum", _roles[eROLE.HonourGuard]]; + _role_list = [_roles[eROLE.Captain], _roles[eROLE.Dreadnought], ("Venerable " + _roles[eROLE.Dreadnought]), _roles[eROLE.Champion], _roles[eROLE.Chaplain], _roles[eROLE.Apothecary], _roles[eROLE.Techmarine], _roles[eROLE.Librarian], "Codiciery", "Lexicanum", _roles[eROLE.HonourGuard]]; if (include_trainee) { _role_list = array_concat(_role_list, role_groups(SPECIALISTS_TRAINEES)); } @@ -44,16 +44,16 @@ function role_groups(group, include_trainee = false, include_heads = true) { case SPECIALISTS_LIBRARIANS: _role_list = [_roles[eROLE.Librarian], "Codiciery", "Lexicanum"]; if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Librarian]} Aspirant"); + array_push(_role_list, (_roles[eROLE.Librarian] + " Aspirant")); } if (include_heads) { - array_push(_role_list, $"Chief {_roles[eROLE.Librarian]}"); + array_push(_role_list, "Chief {_roles[eROLE.Librarian]}"); } break; case SPECIALISTS_TECHS: _role_list = [_roles[eROLE.Techmarine], "Techpriest"]; if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Techmarine]} Aspirant"); + array_push(_role_list, (_roles[eROLE.Techmarine] + " Aspirant")); } if (include_heads) { array_push(_role_list, "Forge Master"); @@ -62,7 +62,7 @@ function role_groups(group, include_trainee = false, include_heads = true) { case SPECIALISTS_TECHMARINES: _role_list = [_roles[eROLE.Techmarine]]; if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Techmarine]} Aspirant"); + array_push(_role_list, (_roles[eROLE.Techmarine] + " Aspirant")); } if (include_heads) { array_push(_role_list, "Forge Master"); @@ -73,14 +73,14 @@ function role_groups(group, include_trainee = false, include_heads = true) { if (_chap_name == "Iron Hands") { array_push(_role_list, _roles[eROLE.Techmarine]); if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Techmarine]} Aspirant"); + array_push(_role_list, (_roles[eROLE.Techmarine] + " Aspirant")); } if (include_heads) { array_push(_role_list, "Forge Master"); } } if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Chaplain]} Aspirant"); + array_push(_role_list, (_roles[eROLE.Chaplain] + " Aspirant")); } if (include_heads) { array_push(_role_list, "Master of Sanctity"); @@ -91,14 +91,14 @@ function role_groups(group, include_trainee = false, include_heads = true) { if (_chap_name == "Space Wolves") { array_push(_role_list, _roles[eROLE.Chaplain]); if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Chaplain]} Aspirant"); + array_push(_role_list, (_roles[eROLE.Chaplain] + " Aspirant")); } if (include_heads) { array_push(_role_list, "Master of Sanctity"); } } if (include_trainee) { - array_push(_role_list, $"{_roles[eROLE.Apothecary]} Aspirant"); + array_push(_role_list, (_roles[eROLE.Apothecary] + " Aspirant")); } if (include_heads) { array_push(_role_list, "Master of the Apothecarion"); @@ -106,10 +106,10 @@ function role_groups(group, include_trainee = false, include_heads = true) { break; case SPECIALISTS_TRAINEES: - _role_list = [$"{_roles[eROLE.Librarian]} Aspirant", $"{_roles[eROLE.Apothecary]} Aspirant", $"{_roles[eROLE.Chaplain]} Aspirant", $"{_roles[eROLE.Techmarine]} Aspirant"]; + _role_list = [(_roles[eROLE.Librarian] + " Aspirant"), (_roles[eROLE.Apothecary] + " Aspirant"), (_roles[eROLE.Chaplain] + " Aspirant"), (_roles[eROLE.Techmarine] + " Aspirant")]; break; case SPECIALISTS_HEADS: - _role_list = ["Master of Sanctity", $"Chief {_roles[eROLE.Librarian]}", "Forge Master", obj_ini.role[100][eROLE.ChapterMaster], "Master of the Apothecarion"]; + _role_list = ["Master of Sanctity", ("Chief " + _roles[eROLE.Librarian]), "Forge Master", obj_ini.role[100][eROLE.ChapterMaster], "Master of the Apothecarion"]; break; case SPECIALISTS_VETERANS: _role_list = [_roles[eROLE.Veteran], _roles[eROLE.Terminator], _roles[eROLE.VeteranSergeant], _roles[eROLE.HonourGuard]]; @@ -124,7 +124,7 @@ function role_groups(group, include_trainee = false, include_heads = true) { _role_list = [_roles[eROLE.Captain], _roles[eROLE.Apothecary], _roles[eROLE.Chaplain], _roles[eROLE.Techmarine], _roles[eROLE.Librarian], "Codiciery", "Lexicanum", _roles[eROLE.Ancient], _roles[eROLE.Champion]]; break; case SPECIALISTS_DREADNOUGHTS: - _role_list = [_roles[eROLE.Dreadnought], $"Venerable {_roles[eROLE.Dreadnought]}"]; + _role_list = [_roles[eROLE.Dreadnought], ("Venerable " + _roles[eROLE.Dreadnought])]; break; case SPECIALISTS_CAPTAIN_CANDIDATES: _role_list = [_roles[eROLE.Sergeant], _roles[eROLE.VeteranSergeant], _roles[eROLE.Champion], _roles[eROLE.Captain], _roles[eROLE.Terminator], _roles[eROLE.Veteran], _roles[eROLE.Ancient]]; From 9d36c208b60af090a10f55b8780c4d8eeac7b424 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 16:55:10 -0500 Subject: [PATCH 31/45] Shush a silly compiler warning about type mismatches against what the jsdoc is saying. The jsdoc in this case was wrong based on the operation of role_groups(). --- scripts/is_specialist/is_specialist.gml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index 70c17abd44..477e34d79b 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -136,7 +136,7 @@ function role_groups(group, include_trainee = false, include_heads = true) { /// @description Checks if a given unit's role is a specialist within a specific role group. /// @param {string} unit_role The role of the unit to check. -/// @param {integer} type The type of specialist group to check (default is SPECIALISTS_STANDARD). +/// @param {string} type The type of specialist group to check (default is SPECIALISTS_STANDARD). /// @param {bool} include_trainee Whether to include trainee roles (default is false). /// @param {bool} include_heads Whether to include head roles (default is true). /// @returns {bool} From d2beaca32049341552cdac0569b0aa4a68f83f86 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 18:39:59 -0500 Subject: [PATCH 32/45] Don't name things too generic or else the loose typing of the language will get confused on if you are using a local var or a generic core library function. --- scripts/DebugView/DebugView.gml | 117 +++++++++++++++++--------------- 1 file changed, 63 insertions(+), 54 deletions(-) diff --git a/scripts/DebugView/DebugView.gml b/scripts/DebugView/DebugView.gml index 588445a1e5..236822f468 100644 --- a/scripts/DebugView/DebugView.gml +++ b/scripts/DebugView/DebugView.gml @@ -1,105 +1,114 @@ - -/// Slightly nicer syntax for working with dbg_views. -/// Functions can be chained for simpler construction. +/// Slightly nicer syntax for working with dbg_views. +/// Functions can be chained for simpler construction. /// Parameters passed into the "add_" functions should always match instance variable names. Local variables don't work with dbg_views. /// Creating a debug view opens the overlay automatically, finish construction with .hide() to prevent it from open automatically during regular play. /// @param {String} view_name the title of the view /// @param {Id.Instance|Struct} obj The object being debugged. Can be a regular struct, an instance or a full object function DebugView(view_name, obj) constructor { - - - - - obj_ref = obj; /// should stop adding duplicate controls if the view already exists - update = false; + _update = false; - if(struct_exists(obj_ref, view_name)){ - if(dbg_view_exists(obj_ref[$view_name])){ - view_ptr = obj_ref[$view_name]; - update = true; + if (struct_exists(obj_ref, view_name)) { + if (dbg_view_exists(obj_ref[$ view_name])) { + view_ptr = obj_ref[$ view_name]; + _update = true; } } else { - view_ptr = dbg_view(view_name, false); // calling dbg_view opens the overlay automatically + view_ptr = dbg_view(view_name, false); // calling dbg_view opens the overlay automatically variable_struct_set(obj_ref, view_name, view_ptr); } - - name = view_name; - - static add_watch = function (_name, _label = _name){ - if(update) return self; + + static add_watch = function(_name, _label = _name) { + if (_update) { + return self; + } dbg_watch(ref_create(self.obj_ref, _name), _label); return self; - } + }; - static add_slider_int = function(_name, min, max, label = _name, step = 1){ - if(update) return self; - dbg_slider_int(ref_create(self.obj_ref, _name), min, max, label, step); + static add_slider_int = function(_name, _min, _max, label = _name, step = 1) { + if (_update) { + return self; + } + dbg_slider_int(ref_create(self.obj_ref, _name), _min, _max, label, step); return self; - } + }; - static add_slider = function(_name, min, max, label = _name, step = 0.01){ - if(update) return self; - dbg_slider(ref_create(self.obj_ref, _name), min, max, label = name, step); + static add_slider = function(_name, _min, _max, label = _name, step = 0.01) { + if (_update) { + return self; + } + dbg_slider(ref_create(self.obj_ref, _name), _min, _max, label == name, step); return self; - } + }; - static add_checkbox = function(_name, _label = _name){ - if(update) return self; + static add_checkbox = function(_name, _label = _name) { + if (_update) { + return self; + } dbg_checkbox(ref_create(self.obj_ref, _name), _label); return self; - } + }; - static add_button = function(_label, fn){ - if(update) return self; + static add_button = function(_label, fn) { + if (_update) { + return self; + } dbg_button(_label, fn); return self; - } + }; static add_section = function(_name, _open = true) { - if(update) return self; + if (_update) { + return self; + } dbg_section(_name, true); return self; - } + }; - static show = function(){ - if(update) return self; + static show = function() { + if (_update) { + return self; + } show_debug_overlay(true); - if(struct_exists(self, "view_ptr")){ - dbg_set_view(self.view_ptr) + if (struct_exists(self, "view_ptr")) { + dbg_set_view(self.view_ptr); } return self; - } + }; - static hide = function(){ - if(update) return self; + static hide = function() { + if (_update) { + return self; + } show_debug_overlay(false); return self; - } + }; - static delete_view = function(){ + static delete_view = function() { dbg_view_delete(self.view_ptr); return self; - } + }; - static add_text = function(input, label){ - + static add_text = function(input, label) { dbg_text($"{label}: {input}"); return self; - } + }; /// quick and dirty way to display all variables of the given obj in a dbg section - static dump_props = function(){ - if(update) return self; + static dump_props = function() { + if (_update) { + return self; + } dbg_section("Dump Props"); var names = struct_get_names(self.obj_ref); - for(var i = 0; i < array_length(names); i++){ + for (var i = 0; i < array_length(names); i++) { dbg_watch(ref_create(self.obj_ref, names[i])); } return self; - } -} \ No newline at end of file + }; +} From 69e149fce1d3c3e6075b3024342bd56824280636 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 19:22:59 -0500 Subject: [PATCH 33/45] A bunch of linting as I chase down a couple warnings and work through a logic chain. --- objects/obj_creation/Create_0.gml | 1372 ++++++------- scripts/NameGenerator/NameGenerator.gml | 452 ++-- scripts/is_specialist/is_specialist.gml | 9 +- scripts/scr_PlanetData/scr_PlanetData.gml | 1614 ++++++++------- scripts/scr_dialogue/scr_dialogue.gml | 4 +- scripts/scr_event_code/scr_event_code.gml | 825 ++++---- .../scr_fleet_functions.gml | 1821 +++++++++-------- .../scr_forge_world_functions.gml | 332 ++- .../scr_player_fleet_functions.gml | 1161 ++++++----- 9 files changed, 3833 insertions(+), 3757 deletions(-) diff --git a/objects/obj_creation/Create_0.gml b/objects/obj_creation/Create_0.gml index 7e1d66e22d..b20134092d 100644 --- a/objects/obj_creation/Create_0.gml +++ b/objects/obj_creation/Create_0.gml @@ -1,18 +1,18 @@ - /** +/** * * obj_creation is used as part of the main menu new game and chapter creation logic * It contains data and logic for setting up custom chapters as well as populating the new game menu with data for pre-existing chapters. */ -keyboard_string=""; +keyboard_string = ""; #region Global Settings: volume, fullscreen etc ini_open("saves.ini"); -master_volume=ini_read_real("Settings","master_volume",1); -effect_volume=ini_read_real("Settings","effect_volume",1); -music_volume=ini_read_real("Settings","music_volume",1); -large_text=ini_read_real("Settings","large_text",0); -settings_heresy=ini_read_real("Settings","settings_heresy",0); -settings_fullscreen=ini_read_real("Settings","fullscreen",1); -settings_window_data=ini_read_string("Settings","window_data","fullscreen"); +master_volume = ini_read_real("Settings", "master_volume", 1); +effect_volume = ini_read_real("Settings", "effect_volume", 1); +music_volume = ini_read_real("Settings", "music_volume", 1); +large_text = ini_read_real("Settings", "large_text", 0); +settings_heresy = ini_read_real("Settings", "settings_heresy", 0); +settings_fullscreen = ini_read_real("Settings", "fullscreen", 1); +settings_window_data = ini_read_string("Settings", "window_data", "fullscreen"); ini_close(); #endregion @@ -30,7 +30,9 @@ icon_grid_left_edge = 441; /// Max number of columns of icons until a new row is made max_cols = 10; /// x coord of the right edge of the icon grid -icon_grid_right_edge = function() {return icon_grid_left_edge + (icon_gap_x * max_cols -1)}; // icon_gap_x * max number of desired columns - 1 +icon_grid_right_edge = function() { + return icon_grid_left_edge + (icon_gap_x * max_cols - 1); +}; // icon_gap_x * max number of desired columns - 1 /// y coord of Founding section heading founding_y = 133; /// y coord of Successor section heading @@ -41,58 +43,46 @@ custom_y = 463; other_y = 593; var view = new DebugView("Obj Creation Grid", self); -view.add_section("Icon Grid") -.add_slider_int("max_cols", 1, 15) -.add_slider_int("icon_width", 1 ,100) -.add_slider_int("icon_height", 1, 100) -.add_slider_int("icon_grid_left_edge", 1, 1000) -.add_slider_int("icon_gap_y", 1 , 300) -.add_slider_int("icon_gap_x", 1, 300) -.add_slider_int("icon_row_gap", 1, 300) -.add_section("Heading Positions") -.add_slider_int("founding_y", 1, 1000) -.add_slider_int("successor_y", 1, 1000) -.add_slider_int("custom_y", 1, 1000) -.add_slider_int("other_y", 1, 1000) -.hide(); +view.add_section("Icon Grid").add_slider_int("max_cols", 1, 15).add_slider_int("icon_width", 1, 100).add_slider_int("icon_height", 1, 100).add_slider_int("icon_grid_left_edge", 1, 1000).add_slider_int("icon_gap_y", 1, 300).add_slider_int("icon_gap_x", 1, 300).add_slider_int("icon_row_gap", 1, 300).add_section("Heading Positions").add_slider_int("founding_y", 1, 1000).add_slider_int("successor_y", 1, 1000).add_slider_int("custom_y", 1, 1000).add_slider_int("other_y", 1, 1000).hide(); #endregion -window_data=string(window_get_x())+"|"+string(window_get_y())+"|"+string(window_get_width())+"|"+string(window_get_height())+"|"; -window_old=window_data; -if (window_get_fullscreen()=1){ - window_old="fullscreen"; - window_data="fullscreen"; +window_data = string(window_get_x()) + "|" + string(window_get_y()) + "|" + string(window_get_width()) + "|" + string(window_get_height()) + "|"; +window_old = window_data; +if (window_get_fullscreen() == 1) { + window_old = "fullscreen"; + window_data = "fullscreen"; } -restarted=0; -custom_icon=0; +restarted = 0; +custom_icon = 0; /// Stores the chapter icon in one spot so we dont have to keep checking whether we're using a custom image or not every time we wanna display it somewhere global.chapter_id = 0; - audio_stop_all(); -audio_play_sound(snd_diboz,0,true); +audio_play_sound(snd_diboz, 0, true); audio_sound_gain(snd_diboz, 0, 0); -var nope=0; -if (master_volume=0) or (music_volume=0) then nope=1; -if (nope!=1){ - audio_sound_gain(snd_diboz,0.25*master_volume*music_volume,2000); +var nope = 0; +if ((master_volume == 0) || (music_volume == 0)) { + nope = 1; +} +if (nope != 1) { + audio_sound_gain(snd_diboz, 0.25 * master_volume * music_volume, 2000); } -global.load=-1; +global.load = -1; planet_types = ARR_planet_types; -skip=false; -premades=true; +skip = false; +premades = true; /// Opt in/out of loading from json vs hardcoded for specific chapters, this way i dont have to do all in one go to test use_chapter_object = false; -livery_picker = new ColourItem(100,230); +livery_picker = new ColourItem(100, 230); livery_picker.scr_unit_draw_data(); full_liveries = ""; company_liveries = ""; -complex_livery=false; +complex_livery = false; complex_selection = "sgt"; complex_depth_selection = 0; //TODO probably make this array based at some point ot match other unit data @@ -100,177 +90,186 @@ complex_livery_data = complex_livery_default(); left_data_slate = new DataSlate(); right_data_slate = new DataSlate(); standard_livery_components = 0; -enum LiveryComponents{ - Body, - Helm, - Trim, +enum LiveryComponents { + Body, + Helm, + Trim, } test_sprite = 0; -fade_in=50; -slate1=80; -slate2=0; -slate3=-2; -slate4=0; -slate5=0; -slate6=0; -change_slide=0; -goto_slide=1; -highlight=0; -highlighting=0; -old_highlight=0; +fade_in = 50; +slate1 = 80; +slate2 = 0; +slate3 = -2; +slate4 = 0; +slate5 = 0; +slate6 = 0; +change_slide = 0; +goto_slide = 1; +highlight = 0; +highlighting = 0; +old_highlight = 0; /// 1 = select chap, 2 = name, strength, adv/disadv, 3 = homeworld, discipline, 4 = livery, 5 = mutations, disposition, 6 = chapter master -slide=1; -slide_show=1; -cooldown=0; -name_bad=0; -heheh=0; -turn_selection_change=false; +slide = 1; +slide_show = 1; +cooldown = 0; +name_bad = 0; +heheh = 0; +turn_selection_change = false; draw_helms = true; var _culture_styles_array = []; -for (var i=0;i} obj_creation.all_advantages = []; var all_advantages = [ - { - name : "", - description : "", - value : 0, - }, - { - name : "Ambushers", - description : "Your chapter is especially trained with ambushing foes; they have a bonus to attack during the start of a battle.", - value : 30, - }, - { - name : "Boarders", - description : "Boarding other ships is the specialty of your chapter. Your chapter is more lethal when boarding ships, have dedicated boarding squads, and two extra strike cruisers.", - value : 30, - }, - { - name : "Bolter Drilling", - description : "Bolter drills are sacred to your chapter; all marines have increased attack with Bolter weaponry.", - value : 40, - meta : ["Weapon Specialty"] - }, - { - name : "Retinue of Renown", - description : "Your chapter master is guarded by renown heroes of the chapter. You start with a larger well-equipped Honour Guard.", - value : 20, - }, - { - name : "Crafters", - description : "Your chapter views artifacts as sacred; you start with better gear and maintain all equipment with more ease.", - value : 40, - meta : ["Gear Quality"] - }, - { - name : "Ancient Armoury", - description : "Your chapter is dedicated to preserving ancient wargear and as such have substantially higher amounts of rare Heresy-era armour and weapons than normal.", - value: 20,//I'm not sure, but it could be higher since now this trait will bring much more benefits. - meta : ["Gear Quality"] - }, - { - name : "Enemy: Eldar", - description : "Eldar are particularly hated by your chapter. When fighting Eldar damage is increased.", - value : 20, - meta : ["Main Enemy"], - }, - { - name : "Enemy: Fallen", - description : "Chaos Marines are particularly hated by your chapter. When fighting the traitors damage is increased.", - value : 20, - meta : ["Main Enemy"], - }, - { - name : "Enemy: Necrons", - description : "Necrons are particularly hated by your chapter. When fighting Necrons damage is increased.", - value : 20, - meta : ["Main Enemy"], - }, - { - name : "Enemy: Orks", - description : "Orks are particularly hated by your chapter. When fighting Orks damage is increased.", - value : 20, - meta : ["Main Enemy"] - }, - { - name : "Enemy: Tau", - description : "Tau are particularly hated by your chapter. When fighting Tau damage is increased.", - value : 20, - meta : ["Main Enemy"], - }, - { - name : "Enemy: Tyranids", - description : "Tyranids are particularly hated by your chapter. A large number of your veterans and marines are tyrannic war veterans and when fighting Tyranids damage is increased.", - value : 20, - meta : ["Main Enemy"], - }, - { - name : "Kings of Space", - description : "Veterans of naval combat, your chapter fleet has bonuses to offense, defence, an additional battle barge, and may always be controlled regardless of whether or not the Chapter Master is present.", - value : 40, - meta : ["Naval"], - }, - { - name : "Lightning Warriors", - description : "Your chapter's style of warfare is built around the speedy execution of battle. Infantry have boosted attack at the cost of defense as well as two additional Land speeders and Biker squads.", - perks : [ - "Reduced Chances of loosing equipment during raids by 15%", - "Marines mmore likely spawn with lightning warrior trait", - "3% increase to base boarding capabilities", - ], - value : 30, - meta : ["Doctrine"], - }, - { - name : "Paragon", - description : "You are a pale shadow of the primarchs. Larger, stronger, faster, your Chapter Master is on a higher level than most, gaining additional health and combat effectiveness.", - value : 10, - meta : ["Chapter Master"], - }, - { - name : "Warp Touched", //TODO: This is probably can be better handled as a positive seed mutation; - description : "Psychic mutations run rampant in your chapter. You have more marines with high psychic rating and aspirants are also more likely to be capable of harnessing powers of the warp.", - value : 20, - meta : ["Psyker Views","Librarians"], - }, - { - name : "Favoured By The Warp", - description : "Many marines in your chapter are favoured by the powers of the warp, making perils of the warp happen less frequently for them.", - value : 20, - }, - { - name : "Reverent Guardians", - description : "Your chapter places great faith in the Imperial Cult; you start with more Chaplains and any Ecclesiarchy disposition increases are enhanced.", - value : 20, - meta : ["Faith","Imperium Trust"], - }, - { - name : "Tech-Brothers", - description : "Your chapter has better ties to the mechanicus; you have more techmarines and higher mechanicus disposition.", - value : 20, - meta : ["Mechanicus Faith"], - }, - { - name : "Tech-Scavengers", - description : "Your Astartes have a knack for finding what has been lost. Items and wargear are periodically found and added to the Armamentarium.", - value : 30, - }, - { - name : "Siege Masters", - description : "Your chapter is familiar with the ins-and-outs of fortresses. They are better at defending and attacking fortifications. And better at garrisoning", - value : 20, - }, - { - name : "Devastator Doctrine", - description : "The steady advance of overwhelming firepower is your chapters combat doctrine each company has an additional Devastator squad, all infantry have boosted defence, and heavy weapons have increased attack.", - value : 40, - meta : ["Doctrine"], - }, - { - name : "Assault Doctrine", - description : "Your chapter prefers quick close quarter assaults on the enemy each Company has an additional Assault Squad and your marines are more skilled in melee.", - value : 20, - meta : ["Doctrine"], - }, - { - name : "Venerable Ancients", - description : "Even in death they still serve. Your chapter places a staunch reverence for its forebears and has a number of additional venerable dreadnoughts in service.", - value : 40, - meta : ["Doctrine"], - }, - { - name : "Medicae Primacy", - description : "Your chapter reveres its Apothecarion above all of it's specialist; You start with more Apothecaries.", - value : 20, - meta : ["Apothecaries"] - }, - { - name : "Ryzan Patronage", - description : "Your chapter has strong ties to the Forgeworld of Ryza as a result your Techmarines are privy to the secrets of their Techpriests enhancing your Plasma and Las weaponry.", - value : 40, - meta : ["Weapon Specialty"] - }, - { - name: "Elite Guard", - description: "Your chapter is an elite fighting force comprised almost exclusively of Veterans. All Tactical Marines are replaced by Veterans.", - value: 150, - meta: ["Specialists"] - }, - { - name : "Great Luck", - description: "This is actually really helpful and beneficial for your chapter. Trust me.", - value: 20, - meta: ["Luck"] - }, - ] - - -var new_adv,cur_adv; -for (var i=0;i} var all_disadvantages = [ { - name : "", - description : "", - value : 0, + name: "", + description: "", + value: 0, }, { - name : "Black Rage", - description : "Your marines are susceptible to Black Rage, having a chance each battle to become Death Company. These units are locked as Assault Marines and are fairly suicidal.", - value : 30, + name: "Black Rage", + description: "Your marines are susceptible to Black Rage, having a chance each battle to become Death Company. These units are locked as Assault Marines and are fairly suicidal.", + value: 30, }, { - name : "Blood Debt", - description : "Prevents your Chapter from recruiting new Astartes until enough of your marines, or enemies, have been killed. Incompatible with Penitent chapter types.", - value : 50, + name: "Blood Debt", + description: "Prevents your Chapter from recruiting new Astartes until enough of your marines, or enemies, have been killed. Incompatible with Penitent chapter types.", + value: 50, }, { - name : "Depleted Gene-seed Stocks", - description : "Your chapter has lost its gene-seed stocks in recent engagement. You start with no gene-seed.", - value : 20, + name: "Depleted Gene-seed Stocks", + description: "Your chapter has lost its gene-seed stocks in recent engagement. You start with no gene-seed.", + value: 20, }, { - name : "Fresh Blood", - description : "Due to being newly created your chapter has little special wargear or psykers.", - value : 20, - meta : ["Status"], - }, + name: "Fresh Blood", + description: "Due to being newly created your chapter has little special wargear or psykers.", + value: 20, + meta: ["Status"], + }, { - name : "Never Forgive", - description : "In the past traitors broke off from your chapter. They harbor incriminating secrets or heritical beliefs, and as thus, must be hunted down whenever possible.", - value : 20, + name: "Never Forgive", + description: "In the past traitors broke off from your chapter. They harbor incriminating secrets or heritical beliefs, and as thus, must be hunted down whenever possible.", + value: 20, }, { - name : "Shitty Luck", + name: "Shitty Luck", description: "This is actually really bad for your chapter. Trust me.", value: 20, - meta: ["Luck"] + meta: ["Luck"], }, { - name : "Sieged", - description : "A recent siege has reduced the number of your marines greatly. You retain a normal amount of equipment but some is damaged.", - value : 40, - meta : ["Status"], + name: "Sieged", + description: "A recent siege has reduced the number of your marines greatly. You retain a normal amount of equipment but some is damaged.", + value: 40, + meta: ["Status"], }, { - name : "Splintered", - description : "Your marines are unorganized and splintered. You require greater time to respond to threats en masse.", - value : 10, - meta : ["Location"], + name: "Splintered", + description: "Your marines are unorganized and splintered. You require greater time to respond to threats en masse.", + value: 10, + meta: ["Location"], }, { - name : "Suspicious", - description : "Some of your chapter's past actions or current practices make the inquisition suspicious. Their disposition is lowered.", - value : 10, - meta : ["Imperium Trust"], + name: "Suspicious", + description: "Some of your chapter's past actions or current practices make the inquisition suspicious. Their disposition is lowered.", + value: 10, + meta: ["Imperium Trust"], }, { - name : "Tech-Heresy", - description : "Your chapter does things that makes the Mechanicus upset. Mechanicus disposition is lowered and you have less Tech Marines. You start as a tech heretic tolerant chapter", - value : 20, - meta : ["Mechanicus Faith"], + name: "Tech-Heresy", + description: "Your chapter does things that makes the Mechanicus upset. Mechanicus disposition is lowered and you have less Tech Marines. You start as a tech heretic tolerant chapter", + value: 20, + meta: ["Mechanicus Faith"], }, { - name : "Tolerant", - description : "Your chapter is more lenient with xenos. All xeno disposition is slightly increased and all Imperial disposition is lowered.", - value : 10, + name: "Tolerant", + description: "Your chapter is more lenient with xenos. All xeno disposition is slightly increased and all Imperial disposition is lowered.", + value: 10, }, { - name : "Warp Tainted", - description : "Your chapter is tainted by the warp. Many of your marines are afflicted with it, making getting caught in perils of the warp less likely, but when caught - the results are devastating.", - value : 20, + name: "Warp Tainted", + description: "Your chapter is tainted by the warp. Many of your marines are afflicted with it, making getting caught in perils of the warp less likely, but when caught - the results are devastating.", + value: 20, }, { - name : "Psyker Intolerant", - description : "Witches are hated by your chapter. You cannot create Librarians but gain a little bonus attack against psykers.", - value : 30, - meta : ["Psyker Views"], + name: "Psyker Intolerant", + description: "Witches are hated by your chapter. You cannot create Librarians but gain a little bonus attack against psykers.", + value: 30, + meta: ["Psyker Views"], }, { - name : "Obliterated", - description : "A recent string of unfortunate events has left your chapter decimated. You have very little left, will your story continue?", - value : 80, - meta : ["Status"], + name: "Obliterated", + description: "A recent string of unfortunate events has left your chapter decimated. You have very little left, will your story continue?", + value: 80, + meta: ["Status"], }, { - name : "Poor Equipment", - description : "Whether due to being cut off from forge worlds or bad luck, your chapter no longer has enough high quality gear to go around. Your elite troops will have to make do with standard armour.", + name: "Poor Equipment", + description: "Whether due to being cut off from forge worlds or bad luck, your chapter no longer has enough high quality gear to go around. Your elite troops will have to make do with standard armour.", value: 10, - meta : ["Gear Quality"] + meta: ["Gear Quality"], }, { - name : "Enduring Angels", - description : "The Chapter's journey thus far has been arduous & unforgiving leaving them severely understrength yet not out of the fight. You begin with 5 fewer company's", - value : 30, - meta : ["Status"], + name: "Enduring Angels", + description: "The Chapter's journey thus far has been arduous & unforgiving leaving them severely understrength yet not out of the fight. You begin with 5 fewer company's", + value: 30, + meta: ["Status"], }, { - name : "Serpents Delight", - description : "Sleeper cells infiltrated your chapter. When they rose up for the decapitation strike,they slew the 5 most experienced company's and many of the HQ staff before being defeated", - value : 50, - meta : ["Status"], + name: "Serpents Delight", + description: "Sleeper cells infiltrated your chapter. When they rose up for the decapitation strike,they slew the 5 most experienced company's and many of the HQ staff before being defeated", + value: 50, + meta: ["Status"], }, { - name : "Weakened Apothecarion", - description : "Many of your chapter's Apothecaries have fallen in recent battles whether due to their incompetence or deliberate targetting.", - value : 20, - meta : ["Apothecaries"], + name: "Weakened Apothecarion", + description: "Many of your chapter's Apothecaries have fallen in recent battles whether due to their incompetence or deliberate targetting.", + value: 20, + meta: ["Apothecaries"], }, { - name : "Small Reclusiam", - description : "Your chapter cares little for its reclusiam compared to other chapters fewer marines have shown the desire to be chaplains.", - value : 20, - meta : ["Faith"], + name: "Small Reclusiam", + description: "Your chapter cares little for its reclusiam compared to other chapters fewer marines have shown the desire to be chaplains.", + value: 20, + meta: ["Faith"], }, { - name : "Barren Librarius", - description : "Your chapter has a smaller Librarius compared to other chapters due to having fewer potent psykers.", - value : 20, - meta : ["Psyker Views","Librarians"], - }, -] + name: "Barren Librarius", + description: "Your chapter has a smaller Librarius compared to other chapters due to having fewer potent psykers.", + value: 20, + meta: ["Psyker Views", "Librarians"], + } +]; -obj_creation.all_disadvantages = [] -var new_dis,cur_dis; -for (var i=0;i0){ - fade_in=-1; - slate1=-1; - slate=22; - slate3=22; - slate4=50; - - change_slide=0; - slide=2; - slide_show=2; - +if (global.restart > 0) { + fade_in = -1; + slate1 = -1; + slate = 22; + slate3 = 22; + slate4 = 50; + + change_slide = 0; + slide = 2; + slide_show = 2; + reset_creation_variables(); //with(obj_restart_vars){instance_destroy();} - global.restart=0; + global.restart = 0; } /* */ @@ -977,76 +945,42 @@ scr_colors_initialize(); /// todo turn this into an array of structs with dynamic access /// todo change references to colours by number to use the Colours enum - colour_to_find1 = shader_get_uniform(sReplaceColor, "f_Colour1"); - colour_to_set1 = shader_get_uniform(sReplaceColor, "f_Replace1"); - body_colour_find=[0/255,0/255,255/255]; - body_colour_replace=[ - col_r[main_color]/255, - col_g[main_color]/255, - col_b[main_color]/255, - - ] - - colour_to_find2 = shader_get_uniform(sReplaceColor, "f_Colour2"); - colour_to_set2 = shader_get_uniform(sReplaceColor, "f_Replace2"); - secondary_colour_find=[255/255,0/255,0/255]; - secondary_colour_replace=[ - col_r[secondary_color]/255, - col_g[secondary_color]/255, - col_b[secondary_color]/255, - - ]; - - colour_to_find3 = shader_get_uniform(sReplaceColor, "f_Colour3"); - colour_to_set3 = shader_get_uniform(sReplaceColor, "f_Replace3"); - - pauldron_colour_find=[255/255,255/255,0/255]; - pauldron_colour_replace=[ - col_r[right_pauldron]/255, - col_g[right_pauldron]/255, - col_b[right_pauldron]/255, - - ]; - - colour_to_find4 = shader_get_uniform(sReplaceColor, "f_Colour4"); - colour_to_set4 = shader_get_uniform(sReplaceColor, "f_Replace4"); - lens_colour_find=[0/255,255/255,0/255]; - lens_colour_replace=[ - col_r[lens_color]/255, - col_g[lens_color]/255, - col_b[lens_color]/255, - - ]; - - colour_to_find5 = shader_get_uniform(sReplaceColor, "f_Colour5"); - colour_to_set5 = shader_get_uniform(sReplaceColor, "f_Replace5"); - trim_colour_find=[255/255,0/255,255/255]; - trim_colour_replace=[ - col_r[main_trim]/255, - col_g[main_trim]/255, - col_b[main_trim]/255, - ]; - - colour_to_find6 = shader_get_uniform(sReplaceColor, "f_Colour6"); - colour_to_set6 = shader_get_uniform(sReplaceColor, "f_Replace6"); - pauldron2_colour_find=[250/255,250/255,250/255]; - pauldron2_colour_replace=[ - col_r[left_pauldron]/255, - col_g[left_pauldron]/255, - col_b[left_pauldron]/255, - - ]; - - colour_to_find7 = shader_get_uniform(sReplaceColor, "f_Colour7"); - colour_to_set7 = shader_get_uniform(sReplaceColor, "f_Replace7"); - - weapon_colour_find=[0/255,255/255,255/255]; - weapon_colour_replace=[ - col_r[weapon_color]/255, - col_g[weapon_color]/255, - col_b[weapon_color]/255, - ]; +colour_to_find1 = shader_get_uniform(sReplaceColor, "f_Colour1"); +colour_to_set1 = shader_get_uniform(sReplaceColor, "f_Replace1"); +body_colour_find = [0 / 255, 0 / 255, 255 / 255]; +body_colour_replace = [col_r[main_color] / 255, col_g[main_color] / 255, col_b[main_color] / 255]; + +colour_to_find2 = shader_get_uniform(sReplaceColor, "f_Colour2"); +colour_to_set2 = shader_get_uniform(sReplaceColor, "f_Replace2"); +secondary_colour_find = [255 / 255, 0 / 255, 0 / 255]; +secondary_colour_replace = [col_r[secondary_color] / 255, col_g[secondary_color] / 255, col_b[secondary_color] / 255]; + +colour_to_find3 = shader_get_uniform(sReplaceColor, "f_Colour3"); +colour_to_set3 = shader_get_uniform(sReplaceColor, "f_Replace3"); + +pauldron_colour_find = [255 / 255, 255 / 255, 0 / 255]; +pauldron_colour_replace = [col_r[right_pauldron] / 255, col_g[right_pauldron] / 255, col_b[right_pauldron] / 255]; + +colour_to_find4 = shader_get_uniform(sReplaceColor, "f_Colour4"); +colour_to_set4 = shader_get_uniform(sReplaceColor, "f_Replace4"); +lens_colour_find = [0 / 255, 255 / 255, 0 / 255]; +lens_colour_replace = [col_r[lens_color] / 255, col_g[lens_color] / 255, col_b[lens_color] / 255]; + +colour_to_find5 = shader_get_uniform(sReplaceColor, "f_Colour5"); +colour_to_set5 = shader_get_uniform(sReplaceColor, "f_Replace5"); +trim_colour_find = [255 / 255, 0 / 255, 255 / 255]; +trim_colour_replace = [col_r[main_trim] / 255, col_g[main_trim] / 255, col_b[main_trim] / 255]; + +colour_to_find6 = shader_get_uniform(sReplaceColor, "f_Colour6"); +colour_to_set6 = shader_get_uniform(sReplaceColor, "f_Replace6"); +pauldron2_colour_find = [250 / 255, 250 / 255, 250 / 255]; +pauldron2_colour_replace = [col_r[left_pauldron] / 255, col_g[left_pauldron] / 255, col_b[left_pauldron] / 255]; + +colour_to_find7 = shader_get_uniform(sReplaceColor, "f_Colour7"); +colour_to_set7 = shader_get_uniform(sReplaceColor, "f_Replace7"); + +weapon_colour_find = [0 / 255, 255 / 255, 255 / 255]; +weapon_colour_replace = [col_r[weapon_color] / 255, col_g[weapon_color] / 255, col_b[weapon_color] / 255]; /* */ action_set_alarm(30, 1); /* */ - diff --git a/scripts/NameGenerator/NameGenerator.gml b/scripts/NameGenerator/NameGenerator.gml index b883747918..e1018e92cb 100644 --- a/scripts/NameGenerator/NameGenerator.gml +++ b/scripts/NameGenerator/NameGenerator.gml @@ -1,232 +1,232 @@ function NameGenerator() constructor { - // TODO after save rework is finished, check if these static can be converted to instance versions - static LoadSimpleNames = function(file_name, fallback_value, json_names_property_name = "names") { - if (json_names_property_name == noone) { - json_names_property_name = "names"; - } + // TODO after save rework is finished, check if these static can be converted to instance versions + static LoadSimpleNames = function(file_name, fallback_value, json_names_property_name = "names") { + if (json_names_property_name == noone) { + json_names_property_name = "names"; + } - var file_loader = new JsonFileListLoader(); + var file_loader = new JsonFileListLoader(); - var load_result = file_loader.load_list_from_json_file($"main\\names\\{file_name}.json", [json_names_property_name]); + var load_result = file_loader.load_list_from_json_file($"main\\names\\{file_name}.json", [json_names_property_name]); - if (load_result.is_success) { - return load_result.values[$ json_names_property_name]; - } + if (load_result.is_success) { + return load_result.values[$ json_names_property_name]; + } - return [fallback_value]; - }; - - static LoadCompositeNames = function(file_name, json_names_property_names = ["prefixes", "suffixes", "special"]) { - if (json_names_property_names == noone) { - json_names_property_names = ["prefixes", "suffixes", "special"]; - } - - var file_loader = new JsonFileListLoader(); - - var load_result = file_loader.load_list_from_json_file($"main\\names\\{file_name}.json", json_names_property_names); - - var result = {}; - - for (var i = 0; i < array_length(json_names_property_names); i++) { - var _property_name = json_names_property_names[i]; - if (!is_string(_property_name)){ - continue; - } - if (load_result.is_success && struct_exists(load_result.values, _property_name)) { - result[$ _property_name] = load_result.values[$ _property_name]; - } else { - result[$ _property_name] = array_create(1, $"{_property_name} 1"); - } - } - - return result; - }; - - // vars // TODO put these into a struct or dict or something - sector_names = LoadSimpleNames("sector", "Sector 1"); - sector_used_names = []; - - star_names = LoadSimpleNames("star", "Star 1"); - star_used_names = []; - star_names_generic_counter = 0; // TODO once we migrate Star data to proper structs and jsons, this can probably be removed - - space_marines_names = LoadSimpleNames("space_marine", "Space Marine 1"); - space_marines_used_names = []; - - imperial_names = LoadSimpleNames("imperial", "Imperial 1"); - imperial_used_names = []; - - chaos_names = LoadSimpleNames("chaos", "Chaos 1"); - chaos_used_names = []; - - eldar_syllables = LoadCompositeNames("eldar", ["first_syllables", "second_syllables", "third_syllables"]); - - ork_name_composites = LoadCompositeNames("ork", ["prefixes", "suffixes", "special"]); - - imperial_ship_names = LoadSimpleNames("imperial_ship", "Imperial Ship 1"); - imperial_ship_used_names = []; - - ork_ship_names = LoadSimpleNames("ork_ship", "Ork Ship 1"); - ork_ship_used_names = []; - - hulk_name_composites = LoadCompositeNames("hulk", ["prefixes", "suffixes"]); - - tau_name_composites = LoadCompositeNames("tau", ["prefixes", "suffixes"]); - - genestealer_cult_names = LoadCompositeNames("genestealercult", ["main", "embelishment", "title"]); - - // init - - static SimpleNameGeneration = function(names, used_names, entity_name, reset_on_using_up_all_names = true) { - try { - if (array_length(names) == 0) { - var used_names_length = array_length(used_names); - if (reset_on_using_up_all_names) { - log_message($"Used up all {entity_name} names, resetting name lists"); - // TODO the 2 lines below could be simplified by swapping references, instead of copying and deleting - array_copy(names, 0, used_names, 0, used_names_length); - array_delete(used_names, 0, used_names_length); - } else { - log_error($"Used up all {entity_name} names. Generating a generic name. used_names_length = {used_names_length}; star_names_generic_counter = {star_names_generic_counter}."); - star_names_generic_counter++; - return $"{entity_name} {used_names_length + star_names_generic_counter}"; - } - } - - var name = array_pop(names); - array_push(used_names, name); - return name; - } catch (_exception) { - handle_exception(_exception); - return "name_error"; - } - }; - - static MultiSyllableNameGeneration = function(syllables, syllable_amount) { - try { - var random_first_syllable_list = syllables.first_syllables[irandom(array_length(syllables.first_syllables) - 1)]; - var name = random_first_syllable_list[irandom(array_length(random_first_syllable_list) - 1)]; - - if (syllable_amount >= 2) { - var random_second_syllable_list = syllables.second_syllables[irandom(array_length(syllables.second_syllables) - 1)]; - name += random_second_syllable_list[irandom(array_length(random_second_syllable_list) - 1)]; - } - - if (syllable_amount >= 3) { - var random_third_syllable_list = syllables.third_syllables[irandom(array_length(syllables.third_syllables) - 1)]; - name += array_random_element(random_third_syllable_list); - } - - return name; - } catch (_exception) { - handle_exception(_exception); - return "name_error"; - } - }; - - static ComplexTitledName = function(mains, embelishments, titles) { - try { - var require_embelishments = choose(true, false); - var require_titles = choose(true, false); - var name = array_random_element(array_random_element(mains)); - if (require_embelishments) { - name += " " + array_random_element(array_random_element(embelishments)); - } - if (require_titles) { - name += " " + array_random_element(array_random_element(titles)); - } - return name; - } catch (_exception) { - handle_exception(_exception); - return "name_error"; - } - }; - - static CompositeNameGeneration = function(composite_names, separate_components) { - try { - if (struct_exists(composite_names, "special") && is_array(composite_names.special) && array_length(composite_names.special) > 0) { - var use_special_name = irandom(200); - if (use_special_name == 0) { - return composite_names.special[irandom(array_length(composite_names.special) - 1)]; - } - } - - var random_composite_one_list = composite_names.prefixes[irandom(array_length(composite_names.prefixes) - 1)]; - var random_composite_two_list = composite_names.suffixes[irandom(array_length(composite_names.suffixes) - 1)]; - var composite_one = random_composite_one_list[irandom(array_length(random_composite_one_list) - 1)]; - var composite_two = random_composite_two_list[irandom(array_length(random_composite_two_list) - 1)]; - - var separator = ""; - - if (separate_components) { - separator = " "; - } - - return $"{composite_one}{separator}{composite_two}"; - } catch (_exception) { - handle_exception(_exception); - return "name_error"; - } - }; - - // Functions - // TODO rework these functions to be more generic, parameterized, e.g. generate_character_name(eFACTION.Imperial) etc. - static generate_sector_name = function() { - return SimpleNameGeneration(sector_names, sector_used_names, "Sector"); - }; - - static generate_star_name = function() { - return SimpleNameGeneration(star_names, star_used_names, "Star", false); - }; - - static generate_space_marine_name = function() { - return SimpleNameGeneration(space_marines_names, space_marines_used_names, "Space Marine"); - }; - - static generate_imperial_name = function(is_male = true) { - if (is_male) { - return SimpleNameGeneration(space_marines_names, space_marines_used_names, "Space Marine"); - } else { - return SimpleNameGeneration(imperial_names, imperial_used_names, "Imperial"); - } - }; - - static generate_genestealer_cult_name = function() { - return ComplexTitledName(genestealer_cult_names.main, genestealer_cult_names.embelishment, genestealer_cult_names.title); - }; - - static generate_chaos_name = function() { - return SimpleNameGeneration(chaos_names, chaos_used_names, "Chaos"); - }; - - static generate_eldar_name = function(syllable_amount = 2) { - return MultiSyllableNameGeneration(eldar_syllables, syllable_amount); - }; - - static generate_ork_name = function() { - return CompositeNameGeneration(ork_name_composites, false); - }; - - static generate_imperial_ship_name = function() { - return SimpleNameGeneration(imperial_ship_names, imperial_ship_used_names, "Imperial Ship"); - }; - - static generate_ork_ship_name = function() { - var ork_ship_name_count = max(array_length(ork_ship_names), array_length(ork_ship_used_names)); - - if (irandom(ork_ship_name_count) == 0) { - // Rare, special name - return $"{generate_space_marine_name()}'s Revenge"; - } - - return SimpleNameGeneration(ork_ship_names, ork_ship_used_names, "Ork Ship"); - }; - - static generate_hulk_name = function() { - return CompositeNameGeneration(hulk_name_composites, true); - }; - - static generate_tau_leader_name = function() { - return CompositeNameGeneration(tau_name_composites, true); - }; + return [fallback_value]; + }; + + static LoadCompositeNames = function(file_name, json_names_property_names = ["prefixes", "suffixes", "special"]) { + if (json_names_property_names == noone) { + json_names_property_names = ["prefixes", "suffixes", "special"]; + } + + var file_loader = new JsonFileListLoader(); + + var load_result = file_loader.load_list_from_json_file($"main\\names\\{file_name}.json", json_names_property_names); + + var result = {}; + + for (var i = 0; i < array_length(json_names_property_names); i++) { + var _property_name = json_names_property_names[i]; + if (!is_string(_property_name)) { + continue; + } + if (load_result.is_success && struct_exists(load_result.values, _property_name)) { + result[$ _property_name] = load_result.values[$ _property_name]; + } else { + result[$ _property_name] = array_create(1, $"{_property_name} 1"); + } + } + + return result; + }; + + // vars // TODO put these into a struct or dict or something + sector_names = LoadSimpleNames("sector", "Sector 1"); + sector_used_names = []; + + star_names = LoadSimpleNames("star", "Star 1"); + star_used_names = []; + star_names_generic_counter = 0; // TODO once we migrate Star data to proper structs and jsons, this can probably be removed + + space_marines_names = LoadSimpleNames("space_marine", "Space Marine 1"); + space_marines_used_names = []; + + imperial_names = LoadSimpleNames("imperial", "Imperial 1"); + imperial_used_names = []; + + chaos_names = LoadSimpleNames("chaos", "Chaos 1"); + chaos_used_names = []; + + eldar_syllables = LoadCompositeNames("eldar", ["first_syllables", "second_syllables", "third_syllables"]); + + ork_name_composites = LoadCompositeNames("ork", ["prefixes", "suffixes", "special"]); + + imperial_ship_names = LoadSimpleNames("imperial_ship", "Imperial Ship 1"); + imperial_ship_used_names = []; + + ork_ship_names = LoadSimpleNames("ork_ship", "Ork Ship 1"); + ork_ship_used_names = []; + + hulk_name_composites = LoadCompositeNames("hulk", ["prefixes", "suffixes"]); + + tau_name_composites = LoadCompositeNames("tau", ["prefixes", "suffixes"]); + + genestealer_cult_names = LoadCompositeNames("genestealercult", ["main", "embelishment", "title"]); + + // init + + static SimpleNameGeneration = function(names, used_names, entity_name, reset_on_using_up_all_names = true) { + try { + if (array_length(names) == 0) { + var used_names_length = array_length(used_names); + if (reset_on_using_up_all_names) { + log_message($"Used up all {entity_name} names, resetting name lists"); + // TODO the 2 lines below could be simplified by swapping references, instead of copying and deleting + array_copy(names, 0, used_names, 0, used_names_length); + array_delete(used_names, 0, used_names_length); + } else { + log_error($"Used up all {entity_name} names. Generating a generic name. used_names_length = {used_names_length}; star_names_generic_counter = {star_names_generic_counter}."); + star_names_generic_counter++; + return $"{entity_name} {used_names_length + star_names_generic_counter}"; + } + } + + var name = array_pop(names); + array_push(used_names, name); + return name; + } catch (_exception) { + handle_exception(_exception); + return "name_error"; + } + }; + + static MultiSyllableNameGeneration = function(syllables, syllable_amount) { + try { + var random_first_syllable_list = syllables.first_syllables[irandom(array_length(syllables.first_syllables) - 1)]; + var name = random_first_syllable_list[irandom(array_length(random_first_syllable_list) - 1)]; + + if (syllable_amount >= 2) { + var random_second_syllable_list = syllables.second_syllables[irandom(array_length(syllables.second_syllables) - 1)]; + name += random_second_syllable_list[irandom(array_length(random_second_syllable_list) - 1)]; + } + + if (syllable_amount >= 3) { + var random_third_syllable_list = syllables.third_syllables[irandom(array_length(syllables.third_syllables) - 1)]; + name += array_random_element(random_third_syllable_list); + } + + return name; + } catch (_exception) { + handle_exception(_exception); + return "name_error"; + } + }; + + static ComplexTitledName = function(mains, embelishments, titles) { + try { + var require_embelishments = choose(true, false); + var require_titles = choose(true, false); + var name = array_random_element(array_random_element(mains)); + if (require_embelishments) { + name += " " + array_random_element(array_random_element(embelishments)); + } + if (require_titles) { + name += " " + array_random_element(array_random_element(titles)); + } + return name; + } catch (_exception) { + handle_exception(_exception); + return "name_error"; + } + }; + + static CompositeNameGeneration = function(composite_names, separate_components) { + try { + if (struct_exists(composite_names, "special") && is_array(composite_names.special) && array_length(composite_names.special) > 0) { + var use_special_name = irandom(200); + if (use_special_name == 0) { + return composite_names.special[irandom(array_length(composite_names.special) - 1)]; + } + } + + var random_composite_one_list = composite_names.prefixes[irandom(array_length(composite_names.prefixes) - 1)]; + var random_composite_two_list = composite_names.suffixes[irandom(array_length(composite_names.suffixes) - 1)]; + var composite_one = random_composite_one_list[irandom(array_length(random_composite_one_list) - 1)]; + var composite_two = random_composite_two_list[irandom(array_length(random_composite_two_list) - 1)]; + + var separator = ""; + + if (separate_components) { + separator = " "; + } + + return $"{composite_one}{separator}{composite_two}"; + } catch (_exception) { + handle_exception(_exception); + return "name_error"; + } + }; + + // Functions + // TODO rework these functions to be more generic, parameterized, e.g. generate_character_name(eFACTION.Imperial) etc. + static generate_sector_name = function() { + return SimpleNameGeneration(sector_names, sector_used_names, "Sector"); + }; + + static generate_star_name = function() { + return SimpleNameGeneration(star_names, star_used_names, "Star", false); + }; + + static generate_space_marine_name = function() { + return SimpleNameGeneration(space_marines_names, space_marines_used_names, "Space Marine"); + }; + + static generate_imperial_name = function(is_male = true) { + if (is_male) { + return SimpleNameGeneration(space_marines_names, space_marines_used_names, "Space Marine"); + } else { + return SimpleNameGeneration(imperial_names, imperial_used_names, "Imperial"); + } + }; + + static generate_genestealer_cult_name = function() { + return ComplexTitledName(genestealer_cult_names.main, genestealer_cult_names.embelishment, genestealer_cult_names.title); + }; + + static generate_chaos_name = function() { + return SimpleNameGeneration(chaos_names, chaos_used_names, "Chaos"); + }; + + static generate_eldar_name = function(syllable_amount = 2) { + return MultiSyllableNameGeneration(eldar_syllables, syllable_amount); + }; + + static generate_ork_name = function() { + return CompositeNameGeneration(ork_name_composites, false); + }; + + static generate_imperial_ship_name = function() { + return SimpleNameGeneration(imperial_ship_names, imperial_ship_used_names, "Imperial Ship"); + }; + + static generate_ork_ship_name = function() { + var ork_ship_name_count = max(array_length(ork_ship_names), array_length(ork_ship_used_names)); + + if (irandom(ork_ship_name_count) == 0) { + // Rare, special name + return $"{generate_space_marine_name()}'s Revenge"; + } + + return SimpleNameGeneration(ork_ship_names, ork_ship_used_names, "Ork Ship"); + }; + + static generate_hulk_name = function() { + return CompositeNameGeneration(hulk_name_composites, true); + }; + + static generate_tau_leader_name = function() { + return CompositeNameGeneration(tau_name_composites, true); + }; } diff --git a/scripts/is_specialist/is_specialist.gml b/scripts/is_specialist/is_specialist.gml index 477e34d79b..5478398061 100644 --- a/scripts/is_specialist/is_specialist.gml +++ b/scripts/is_specialist/is_specialist.gml @@ -14,7 +14,7 @@ #macro SPECIALISTS_HEADS "heads" /// @description Retrieves the active roles from the game, either from the obj_creation or obj_ini object. -/// @returns {array} +/// @returns {array} function active_roles() { var _roles = instance_exists(obj_creation) ? obj_creation.role[100] : obj_ini.role[100]; return _roles; @@ -315,15 +315,14 @@ function collect_by_religeon(religion, sub_cult = "", location = "") { return _units; } -/// @description Processes the selection of units based on group parameters and updates controller data -/// @param {array} group The array of units to process for selection -/// @param {struct} selection_data Data structure containing selection parameters and state - enum MissionSelectType { Units, Squads, } +/// @description Processes the selection of units based on group parameters and updates controller data +/// @param {array} group The array of units to process for selection +/// @param {struct} selection_data Data structure containing selection parameters and state function group_selection(group, selection_data = {}) { try { var unit, s, unit_location; diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 96dc83e039..453eb8f5cc 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -3,16 +3,17 @@ #macro ARR_strength_descriptions ["none", "Minimal", "Sparse", "Moderate", "Numerous", "Very Numerous", "Overwhelming"]; -function PlanetData(planet, system) constructor{ -//safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere +function PlanetData(planet, system) constructor { + //safeguards // TODO LOW DEBUG_LOGGING // Log when tripped somewhere //disposition - if (system.dispo[planet] < -100 && system.dispo[planet] > -1000 && system.p_owner[planet] != eFACTION.Player ) { // Personal Rule code be doing some interesting things + if (system.dispo[planet] < -100 && system.dispo[planet] > -1000 && system.p_owner[planet] != eFACTION.Player) { + // Personal Rule code be doing some interesting things system.dispo[planet] = -100; // TODO LOW DISPOSITION_REVAMP // Consider revamping the disposition system } else if (system.dispo[planet] > 100) { system.dispo[planet] = 100; } -// - static large_pop_conversion = 1000000000; + // + static large_pop_conversion = 1000000000; self.planet = planet; self.system = system; @@ -22,7 +23,7 @@ function PlanetData(planet, system) constructor{ planet_type = system.p_type[planet]; operatives = system.p_operatives[planet]; - function add_operatives(new_ops){ + function add_operatives(new_ops) { array_push(system.p_operatives[planet], new_ops); operatives = system.p_operatives[planet]; } @@ -36,124 +37,134 @@ function PlanetData(planet, system) constructor{ is_craftworld = system.craftworld; is_hulk = system.space_hulk; - static set_player_disposition = function(new_dispo){ - player_disposition = new_dispo; + static set_player_disposition = function(new_dispo) { + player_disposition = new_dispo; system.dispo[planet] = player_disposition; - } + }; - static owner_faction_disposition = function(){ + static owner_faction_disposition = function() { return obj_controller.disposition[current_owner]; - } + }; - static set_population = function(new_population){ - population = new_population; - system.p_population[planet] = population; - } + static set_population = function(new_population) { + population = new_population; + system.p_population[planet] = population; + }; - static edit_population = function(edit_val){ - population = population + edit_val >= 0 ? population + edit_val : 0; - system.p_population[planet] = population; - } + static edit_population = function(edit_val) { + population = population + edit_val >= 0 ? population + edit_val : 0; + system.p_population[planet] = population; + }; //assumes a large pop figure and changes down if small pop planet - static population_small_conversion = function(pop_value){ - if (!large_population){ - pop_value *= large_pop_conversion; - } - return pop_value; - } - static population_large_conversion = function(pop_value){ - if (large_population){ + static population_small_conversion = function(pop_value) { + if (!large_population) { + pop_value *= large_pop_conversion; + } + return pop_value; + }; + + static population_large_conversion = function(pop_value) { + if (large_population) { pop_value /= large_pop_conversion; } return pop_value; - } + }; - static send_colony_ship = function(target, targ_planet, type){ + static send_colony_ship = function(target, targ_planet, type) { new_colony_fleet(system, planet, target, targ_planet, type); - } + }; - static set_new_owner = function(new_owner){ + static set_new_owner = function(new_owner) { system.p_owner[planet] = new_owner; current_owner = new_owner; - } - static return_to_first_owner = function(allow_player = false){ - if (!allow_player && origional_owner == eFACTION.Player){ - set_new_owner(eFACTION.Imperium); - } else { - set_new_owner(origional_owner); - } - } + }; - static add_disposition = function(alteration){ - var _new_dispo = clamp(player_disposition+alteration, 0, 100); - player_disposition = _new_dispo; - system.dispo[planet] = player_disposition; + static return_to_first_owner = function(allow_player = false) { + if (!allow_player && origional_owner == eFACTION.Player) { + set_new_owner(eFACTION.Imperium); + } else { + set_new_owner(origional_owner); + } + }; - } + static add_disposition = function(alteration) { + var _new_dispo = clamp(player_disposition + alteration, 0, 100); + player_disposition = _new_dispo; + system.dispo[planet] = player_disposition; + }; - static display_population = function(){ - if (large_population){ - return $"{population} B"; - } else { - return $"{scr_display_number(population)}"; - } - } + static display_population = function() { + if (large_population) { + return $"{population} B"; + } else { + return $"{scr_display_number(population)}"; + } + }; - static owner_status = function(){ - return obj_controller.faction_status[current_owner]; - } + static owner_status = function() { + return obj_controller.faction_status[current_owner]; + }; - static at_war = function(imperium=1, antagonism=0, war=1){ - var _at_war = false + static at_war = function(imperium = 1, antagonism = 0, war = 1) { + var _at_war = false; if (imperium) { - if (current_owner>5) then _at_war=true; + if (current_owner > 5) { + _at_war = true; + } } if (antagonism) { - if (owner_status()=="Antagonism") then _at_war=true; + if (owner_status() == "Antagonism") { + _at_war = true; + } } if (war) { - if (owner_status()=="War") then _at_war=true; + if (owner_status() == "War") { + _at_war = true; + } } return _at_war; - } + }; guardsmen = system.p_guardsmen[planet]; - static edit_guardsmen = function(edit_val){ + static edit_guardsmen = function(edit_val) { system.p_guardsmen[planet] = max(0, system.p_guardsmen[planet] + edit_val); guardsmen = system.p_guardsmen[planet]; - } + }; pdf = system.p_pdf[planet]; - fortification_level = system.p_fortified[planet]; - static alter_fortification = function(alteration){ - system.p_fortified[planet] += alteration; - fortification_level = system.p_fortified[planet]; - } + fortification_level = system.p_fortified[planet]; + + static alter_fortification = function(alteration) { + system.p_fortified[planet] += alteration; + fortification_level = system.p_fortified[planet]; + }; + + static recruit_pdf = function(percentage_pop) { + var new_pdf = population * (percentage_pop / 100); + edit_population(new_pdf * -1); + if (large_population) { + new_pdf *= large_pop_conversion; + } + pdf += new_pdf; + system.p_pdf[planet] = pdf; + return new_pdf; + }; - static recruit_pdf = function(percentage_pop){ - var new_pdf = population * (percentage_pop/100); - edit_population(new_pdf*-1); - if (large_population){ - new_pdf *= large_pop_conversion; - } - pdf += new_pdf; - system.p_pdf[planet] = pdf; - return new_pdf; - } star_station = system.p_station[planet]; pdf_loss_reduction = 0; // Whether or not player forces are on the planet player_forces = system.p_player[planet]; - static edit_player_forces = function(val){ - system.p_player[planet]+=val; + static edit_player_forces = function(val) { + system.p_player[planet] += val; player_forces = system.p_player[planet]; - } + }; + defence_lasers = system.p_lasers[planet]; defence_silos = system.p_silo[planet]; ground_defences = system.p_defenses[planet]; @@ -161,33 +172,33 @@ function PlanetData(planet, system) constructor{ // v how much of a problem they are from 1-5 planet_forces = array_create(14, 0); - try{ - planet_forces[1] = player_forces; + try { + planet_forces[1] = player_forces; - planet_forces[2] = guardsmen; + planet_forces[2] = guardsmen; - planet_forces[5] = system.p_sisters[planet]; - planet_forces[6] = system.p_eldar[planet]; - planet_forces[7] = system.p_orks[planet]; - planet_forces[8] = system.p_tau[planet]; - planet_forces[9] = system.p_tyranids[planet]; - planet_forces[10] = system.p_traitors[planet]; - planet_forces[11] = system.p_chaos[planet]+ system.p_demons[planet]; + planet_forces[5] = system.p_sisters[planet]; + planet_forces[6] = system.p_eldar[planet]; + planet_forces[7] = system.p_orks[planet]; + planet_forces[8] = system.p_tau[planet]; + planet_forces[9] = system.p_tyranids[planet]; + planet_forces[10] = system.p_traitors[planet]; + planet_forces[11] = system.p_chaos[planet] + system.p_demons[planet]; - planet_forces[13] = system.p_necrons[planet]; - }catch(_exception){ - handle_exception(_exception); - } + planet_forces[13] = system.p_necrons[planet]; + } catch (_exception) { + handle_exception(_exception); + } - static add_forces = function(faction, val){ - var _new_val = planet_forces[faction]+val; - return edit_forces(faction,_new_val); - } + static add_forces = function(faction, val) { + var _new_val = planet_forces[faction] + val; + return edit_forces(faction, _new_val); + }; - static edit_forces = function(faction, val){ - planet_forces[faction] = clamp(val,0,12); + static edit_forces = function(faction, val) { + planet_forces[faction] = clamp(val, 0, 12); var _new_val = planet_forces[faction]; - switch (faction){ + switch (faction) { case eFACTION.Ork: system.p_orks[planet] = _new_val; break; @@ -211,25 +222,22 @@ function PlanetData(planet, system) constructor{ break; case eFACTION.Ecclesiarchy: system.p_sisters[planet] = _new_val; - break; + break; } - return _new_val - - } - - + return _new_val; + }; - static assasinate_governor = function(assaination_type, discovery_modifier){ + static assasinate_governor = function(assaination_type, discovery_modifier) { var randa = roll_dice_chapter(1, 100, "high"); var randa2 = roll_dice(1, 100); //type 1 is install a sympathectic else it's a straight serf installation - if (assaination_type == 1){ + if (assaination_type == 1) { var _discovery_rate = 10; set_player_disposition(70 + floor(random_range(5, 15)) + 1); - var _text = $"Many of the successors for {name()} are removed or otherwise made indisposed. Your chapter ensures that the new Planetary Governor is sympathetic to your plight and more than willing to heed your advice. A powerful new ally may be in the making."; - scr_event_log("", $"Planetary Governor of {name()} assassinated. A more suitable Governor is installed."); + var _text = $"Many of the successors for {name()} are removed or otherwise made indisposed. Your chapter ensures that the new Planetary Governor is sympathetic to your plight and more than willing to heed your advice. A powerful new ally may be in the making."; + scr_event_log("", $"Planetary Governor of {name()} assassinated. A more suitable Governor is installed."); } else { var _discovery_rate = 25; if (origional_owner != 3) { @@ -241,227 +249,231 @@ function PlanetData(planet, system) constructor{ } if (randa2 <= (_discovery_rate * discovery_modifier)) { - if (assaination_type == 1){ + if (assaination_type == 1) { var _duration = ((choose(1, 2, 3, 4, 5, 6) + choose(1, 2, 3, 4, 5, 6)) * 6) + choose(-3, -2, -1, 0, 1, 2, 3); } else { var _duration = (choose(1, 2) * 6) + choose(-3, -2, -1, 0, 1, 2, 3); } add_event({ - duration : _duration, - e_id : "governor_assassination", - variant : assaination_type, - system : system.name, - planet : planet, + duration: _duration, + e_id: "governor_assassination", + variant: assaination_type, + system: system.name, + planet: planet, }); } return _text; - } - static grow_ork_forces = function(){ - var contin=0; - var rando=roll_dice(1,100);// This part handles the spreading + }; + + static grow_ork_forces = function() { + var contin = 0; + var rando = roll_dice(1, 100); // This part handles the spreading // if (rando<30){ var _non_deads = planets_without_type("dead", system); var _has_warboss = has_feature(P_features.OrkWarboss); var _has_stronghold = has_feature(P_features.OrkStronghold); var _build_ships = false; - if (_has_stronghold){ + if (_has_stronghold) { var _stronghold = get_features(P_features.OrkStronghold)[0]; } - if (_has_warboss){ + if (_has_warboss) { var _warboss = get_features(P_features.OrkWarboss)[0]; _warboss.turns_static++; } - if (array_length(_non_deads)>0 && rando>40){ + if (array_length(_non_deads) > 0 && rando > 40) { var _ork_spread_planet = array_random_element(_non_deads); - var _orks = planet_forces[eFACTION.Ork] + var _orks = planet_forces[eFACTION.Ork]; var _ork_target = system.p_orks[_ork_spread_planet]; - var _spread_orks = (current_owner==eFACTION.Ork && ((pdf + guardsmen + planet_forces[8] + planet_forces[10]+planet_forces[1]) == 0 )); - if (_spread_orks){ + var _spread_orks = current_owner == eFACTION.Ork && ((pdf + guardsmen + planet_forces[8] + planet_forces[10] + planet_forces[1]) == 0); + if (_spread_orks) { // determine maximum Ork presence on the source planet var _ork_max = planet_forces[eFACTION.Ork]; - if (_ork_max<5 && _ork_target<2) then system.p_orks[_ork_spread_planet]++; - if (_orks>4 && _ork_target<3){ + if (_ork_max < 5 && _ork_target < 2) { + system.p_orks[_ork_spread_planet]++; + } + if (_orks > 4 && _ork_target < 3) { system.p_orks[_ork_spread_planet]++; - if (_ork_target<3){ + if (_ork_target < 3) { system.p_orks[_ork_spread_planet]++; add_forces(eFACTION.Ork, -1); } } + } + } + contin = 0; + rando = roll_dice(1, 100); // This part handles the ship building + if ((population > 0 && pdf == 0 && guardsmen == 0 && planet_forces[10] == 0) && (planet_forces[eFACTION.Tau] == 0)) { + if (!large_population) { + set_population(population * 0.97); + } else { + edit_population(-0.01); + } + } + + var enemies_present = false; + with (system) { + for (var n = 0; n < array_length(_non_deads); n++) { + var plan = _non_deads[n]; + if ((planets >= 1) && ((p_pdf[plan] > 0) || (p_guardsmen[plan] > 0) || (p_traitors[plan] > 0) || (p_tau[plan] > 0))) { + enemies_present = true; + } } } - contin=0; - rando=roll_dice(1,100);// This part handles the ship building - if (population>0 && pdf==0 && guardsmen==0 && planet_forces[10]==0) and (planet_forces[eFACTION.Tau]==0){ - if (!large_population){ - set_population(population*0.97); - }else { - edit_population(-0.01); - } - - }; - - var enemies_present=false; - with (system){ - for (var n=0;n=1) and ((p_pdf[plan]>0) or (p_guardsmen[plan]>0) or (p_traitors[plan]>0) or (p_tau[plan]>0)){ - enemies_present=true; - } - } - } - - if (_has_warboss && !_has_stronghold){ - rando=roll_dice_chapter(1,100, "low"); - if (rando<30){ + + if (_has_warboss && !_has_stronghold) { + rando = roll_dice_chapter(1, 100, "low"); + if (rando < 30) { add_feature(P_features.OrkStronghold); } } else { - if (_has_stronghold){ + if (_has_stronghold) { growth = 0.01; - if (_has_warboss){ + if (_has_warboss) { growth *= 2; } - if (_stronghold.tier0) then rando-=10;// Empire bonus, was 15 before - + if (obj_controller.known[eFACTION.Ork] > 0) { + rando -= 10; + } // Empire bonus, was 15 before + // Check for industrial facilities - var fleet_buildable = ((planet_type!="Dead" && planet_type!="Lava") || _has_warboss || _has_stronghold); - if (fleet_buildable && planet_forces[eFACTION.Ork]>=4){// Used to not have Ice either - - if (instance_exists(obj_p_fleet)){ - var ppp=instance_nearest(x,y,obj_p_fleet); - if (point_distance(x,y,ppp.x,ppp.y)<50) and (ppp.action=""){ - exit; - }; + var fleet_buildable = (planet_type != "Dead" && planet_type != "Lava") || _has_warboss || _has_stronghold; + if (fleet_buildable && planet_forces[eFACTION.Ork] >= 4) { + // Used to not have Ice either + + if (instance_exists(obj_p_fleet)) { + var ppp = instance_nearest(x, y, obj_p_fleet); + if ((point_distance(x, y, ppp.x, ppp.y) < 50) && (ppp.action == "")) { + exit; + } } - if (planet_type == "Forge"){ - rando-=80; - } else if (planet_type == "Hive" || planet_type == "Temperate"){ - rando-=30; - }else if (planet_type == "Agri"){ - rando-=10; + if (planet_type == "Forge") { + rando -= 80; + } else if (planet_type == "Hive" || planet_type == "Temperate") { + rando -= 30; + } else if (planet_type == "Agri") { + rando -= 10; } - var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); - if (_ork_fleet=="none"){ - if (rando<=20){ - new_ork_fleet(x,y); - } + var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); + if (_ork_fleet == "none") { + if (rando <= 20) { + new_ork_fleet(x, y); + } } else { - - _build_ships = true; - - } - } + _build_ships = true; + } + } } - if (_build_ships){ + if (_build_ships) { var _pdata = self; - with (_ork_fleet){ - // Increase ship number for this object? - var rando=irandom(101); - if (obj_controller.known[eFACTION.Ork]>0) then rando-=10; + with (_ork_fleet) { + // Increase ship number for this object? + var rando = irandom(101); + if (obj_controller.known[eFACTION.Ork] > 0) { + rando -= 10; + } var _planet_type = _pdata.planet_type; - if (_planet_type=="Forge"){ - rando-=20; - } else if (_planet_type=="Hive"){ - rando-=10; - }else if (_planet_type=="Shrine" || _planet_type=="Temperate"){ - rando-=5; + if (_planet_type == "Forge") { + rando -= 20; + } else if (_planet_type == "Hive") { + rando -= 10; + } else if (_planet_type == "Shrine" || _planet_type == "Temperate") { + rando -= 5; } - if (rando<=15){// was 25 - rando=choose(1,1,1,1,1,1,1,2,2,2); - var _big_stronghold = false - if (_has_stronghold){ - if (_stronghold.tier>=2){ + if (rando <= 15) { + // was 25 + rando = choose(1, 1, 1, 1, 1, 1, 1, 2, 2, 2); + var _big_stronghold = false; + if (_has_stronghold) { + if (_stronghold.tier >= 2) { _big_stronghold = true; } } - if (_planet_type=="Forge" || _big_stronghold || _has_warboss){ - if (!irandom(10)){ + if (_planet_type == "Forge" || _big_stronghold || _has_warboss) { + if (!irandom(10)) { rando = 3; } - }else if (_has_stronghold || _planet_type=="Hive"){ - if (!irandom(30)){ + } else if (_has_stronghold || _planet_type == "Hive") { + if (!irandom(30)) { rando = 3; } } - if (capital_number<=0){ + if (capital_number <= 0) { rando = 3; } - switch(rando){ + switch (rando) { case 3: - capital_number+=1; + capital_number += 1; break; case 2: - frigate_number+=1; + frigate_number += 1; break; case 1: - escort_number+=1; + escort_number += 1; break; - } } - var ii=0; - ii+=capital_number; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); - if (ii<=1) then ii=1; - image_index=ii; + var ii = 0; + ii += capital_number; + ii += round((frigate_number / 2)); + ii += round((escort_number / 4)); + if (ii <= 1) { + ii = 1; + } + image_index = ii; //if big enough flee bugger off to new star - if (image_index>=5){ + if (image_index >= 5) { instance_deactivate_object(_pdata.system); - with(obj_star){ - if (is_dead_star()){ + with (obj_star) { + if (is_dead_star()) { instance_deactivate_object(id); } else { - if (owner == eFACTION.Ork || array_contains(p_owner, eFACTION.Ork)){ + if (owner == eFACTION.Ork || array_contains(p_owner, eFACTION.Ork)) { instance_deactivate_object(id); - } + } } } - var new_wagh_star = instance_nearest(x,y,obj_star); - if (instance_exists(new_wagh_star)){ - action_x=new_wagh_star.x; - action_y=new_wagh_star.y; + var new_wagh_star = instance_nearest(x, y, obj_star); + if (instance_exists(new_wagh_star)) { + action_x = new_wagh_star.x; + action_y = new_wagh_star.y; action = ""; set_fleet_movement(); } - } instance_activate_object(obj_star); } } - if (_has_warboss){ - rando=roll_dice(1,100)+10; + if (_has_warboss) { + rando = roll_dice(1, 100) + 10; var _ork_fleet = scr_orbiting_fleet(eFACTION.Ork, system); - if (_ork_fleet!="none" && rando < _warboss.turns_static){ + if (_ork_fleet != "none" && rando < _warboss.turns_static) { _warboss.turns_static = 0; _ork_fleet.cargo_data.ork_warboss = _warboss; delete_feature(P_features.OrkWarboss); - if (!_warboss.player_hidden || !irandom(5)){ - scr_alert("red","ork",$"{_warboss.name} departs {name()} as his waaagh gains momentum",0,0); + if (!_warboss.player_hidden || !irandom(5)) { + scr_alert("red", "ork", $"{_warboss.name} departs {name()} as his waaagh gains momentum", 0, 0); } } } - - } + }; deamons = system.p_demons[planet]; chaos_forces = system.p_chaos[planet]; @@ -477,14 +489,13 @@ function PlanetData(planet, system) constructor{ } } - corruption = system.p_heresy[planet]; - static alter_corruption = function(value){ - alter_planet_corruption(value, planet, system); - corruption = system.p_heresy[planet]; - } - + static alter_corruption = function(value) { + alter_planet_corruption(value, planet, system); + corruption = system.p_heresy[planet]; + }; + is_heretic = system.p_hurssy[planet]; heretic_timer = system.p_hurssy_time[planet]; @@ -494,71 +505,71 @@ function PlanetData(planet, system) constructor{ population_influences = system.p_influence[planet]; raided_this_turn = system.p_raided[planet]; - // + // governor = system.p_governor[planet]; problems = system.p_problem[planet]; problems_data = system.p_problem_other_data[planet]; problem_timers = system.p_timer[planet]; - static has_problem = function(problem){ - has_problem_planet(planet, problem, system); - } + static has_problem = function(problem) { + has_problem_planet(planet, problem, system); + }; - static remove_problem = function(problem){ - remove_planet_problem(planet ,problem,system) - } - static find_problem = function(problem){ - return find_problem_planet(planet, problem, system); - } + static remove_problem = function(problem) { + remove_planet_problem(planet, problem, system); + }; - static add_problem = function(problem, timer, other_data={}){ - return add_new_problem(planet, problem, timer,system, other_data); - } + static find_problem = function(problem) { + return find_problem_planet(planet, problem, system); + }; + static add_problem = function(problem, timer, other_data = {}) { + return add_new_problem(planet, problem, timer, system, other_data); + }; - static name = function(){ - var _name=""; + static name = function() { + var _name = ""; - _name = planet_numeral_name(planet, system); + _name = planet_numeral_name(planet, system); - return _name; - } + return _name; + }; - static xenos_and_heretics = function(){ - var xh_force = 0; - for (var i=5;i0){ - //TODO allow total tech point usage here - var _starship = get_features(P_features.Starship)[0]; - - var _engineer_score_start = _starship.engineer_score; - if (_starship.engineer_score<2000){ - for (var v=0;v0 && _starship.funds_spent<_target_spend){ - scr_alert("green","owner",$"{_requisition_spend} Requision spent on Ancient Ship repairs in materials and outfitting (outfitting {(_starship.funds_spent/_target_spend)*100}%)",system.x,system.y); - } - if (_starship.funds_spent>=_target_spend && _starship.engineer_score>=2000){// u2=tar; - //TODO refactor into general new ship logic - delete_feature(P_features.Starship); - - var locy=$"{name()}"; - - var flit=instance_create(system.x,system.y,obj_p_fleet); - - var _slaughter = new_player_ship("Gloriana", system.name, "Slaughtersong"); - add_ship_to_fleet(_slaughter, flit); - flit.oribiting = system.id; - - scr_popup($"Ancient Ship Restored",$"The ancient ship within the ruins of {locy} has been fully repaired. It is determined to be a Gloriana Class vessel and is bristling with golden age weaponry and armour. Your {string(obj_ini.role[100][16])}s are excited; the Slaughtersong is ready for it's maiden voyage, at your command.","",""); - } - } - }catch (_exception){ - handle_exception(_exception); - } - } - - static guard_score_calc = function(){ - guard_score = 0; - if (guardsmen < 500 && guardsmen>0) { - guard_score = 0.1; - } else if (guardsmen >= 100000000) { - guard_score = 7; - } else if (guardsmen >= 50000000) { - guard_score = 6; - } else if (guardsmen >= 15000000) { - guard_score = 5; - } else if (guardsmen >= 6000000) { - guard_score = 4; - } else if (guardsmen >= 1000000) { - guard_score = 3; - } else if (guardsmen >= 100000) { - guard_score = 2; - } else if (guardsmen >= 2000) { - guard_score = 1; - } else { - guard_score = 0.5; - } - - return guard_score; - } - - static continue_to_planet_battle = function(stop){ - - var _nids_real = planet_forces[eFACTION.Tyranids]; - var _nids_score = _nids_real < 4 ? 0 : _nids_real; - var _nid_diff = _nids_score-_nids_real; - - if (chaos_forces==6.1) and (_nids_real>0) then tyranids_score=_nids_real; - - if (current_owner == eFACTION.Tau){ - stop = (xenos_and_heretics() + _nid_diff + player_forces + planet_forces[eFACTION.Ecclesiarchy]) <= 0; - } - - if (stop){ - if (planet_forces[eFACTION.Ork]>0) and (planet_forces[eFACTION.Ecclesiarchy]>0) then stop=0; - } - - var imperium_forces = ((guardsmen>0) or (pdf>0) or (planet_forces[eFACTION.Ecclesiarchy]>0)); - - if (stop){ - if (planet_forces[eFACTION.Necrons]>=5 || planet_forces[eFACTION.Tyranids]>=5 && imperium_forces) then stop=0; - } - - - //tau fight imperial - if (stop){ - if (current_owner = eFACTION.Tau){ - if ((guardsmen>0) or (planet_forces[eFACTION.Ecclesiarchy]>0)) and ((pdf>0) or (planet_forces[eFACTION.Tau]>0)) then stop=0; - } - - } - - // Attack heretics whenever possible, even player controlled ones - if (stop){ - if (player_forces+pdf>0) and (guardsmen>0) and (obj_controller.faction_status[2]="War") then stop=0; - } - if (stop){ - if (player_forces+pdf>0) and (planet_forces[eFACTION.Ecclesiarchy]>0) and (obj_controller.faction_status[5]="War") then stop=0; - } - - return stop; - } - - static pdf_will_support_player = function(){ - if (current_owner== eFACTION.Tau){ - return false; - } - if (has_feature(P_features.Gene_Stealer_Cult) && current_owner==eFACTION.Tyranids){ - return false; - } - - if ((current_owner=1 || obj_controller.faction_status[2]!="War") && pdf){ - return true; - } - return false; - } - - static guard_attack_matrix = function(){ - var guard_attack = ""; - // if (p_eldar[planet]>0) and (p_owner[planet]!=6) then guard_attack="eldar"; - //if (planet_forces[eFACTION.Tau] + planet_forces[eFACTION.Ork] + planet_forces[eFACTION.Heretics]+ planet_forces[eFACTION.Chaos]) - if (planet_forces[eFACTION.Tau]>0) then guard_attack="tau"; - if (planet_forces[eFACTION.Ork]>0) then guard_attack="ork"; - if (planet_forces[eFACTION.Heretics]>0){ - // Always goes after traitors first, unless - guard_attack="traitors"; - if (planet_forces[eFACTION.Heretics]<=1 && planet_forces[eFACTION.Tau]>=4) and (current_owner!=8) then guard_attack="tau"; - } - if (planet_forces[eFACTION.Chaos]>0) then guard_attack="csm"; - if (pdf>0) and (current_owner=eFACTION.Tau) then guard_attack="pdf"; - - if (current_owner = eFACTION.Player){ - if (pdf>0 && obj_controller.faction_status[2]=="War") then guard_attack="pdf"; - } - if (planet_forces[eFACTION.Tyranids]<=1) and (planet_forces[eFACTION.Ork]>=4) then guard_attack="ork"; - // if (p_tyranids[planet]>0) and (guard_attack="") then guard_attack="tyranids"; - if (planet_forces[eFACTION.Tyranids]>=4){ - guard_attack="tyranids"; - }else if (planet_forces[eFACTION.Tyranids]>0){ - if (has_feature(P_features.Gene_Stealer_Cult)){ - var _hidden_cult = get_features(P_features.Gene_Stealer_Cult)[0].hiding; - if (!_hidden_cult){ - guard_attack="tyranids"; - }else if (population_influences[eFACTION.Tyranids]>=50){ - guard_attack="pdf"; + static recover_starship = function(techs) { + try { + var engineer_count = array_length(techs); + if (has_feature(P_features.Starship) && engineer_count > 0) { + //TODO allow total tech point usage here + var _starship = get_features(P_features.Starship)[0]; + + var _engineer_score_start = _starship.engineer_score; + if (_starship.engineer_score < 2000) { + for (var v = 0; v < engineer_count; v++) { + _starship.engineer_score += techs[v].technology / 2; + } + scr_alert("green", "owner", $"Ancient ship repairs {min((_starship.engineer_score / 2000) * 100, 100)}% complete", system.x, system.y); + } + + var _target_spend = 10000; + + var _maxr = floor(obj_controller.requisition / 50); + var _requisition_spend = min(_maxr * 50, array_length(techs) * 50, _target_spend - _starship.funds_spent); + obj_controller.requisition -= _requisition_spend; + _starship.funds_spent += _requisition_spend; + + if (_requisition_spend > 0 && _starship.funds_spent < _target_spend) { + scr_alert("green", "owner", $"{_requisition_spend} Requision spent on Ancient Ship repairs in materials and outfitting (outfitting {(_starship.funds_spent / _target_spend) * 100}%)", system.x, system.y); + } + if (_starship.funds_spent >= _target_spend && _starship.engineer_score >= 2000) { + // u2=tar; + //TODO refactor into general new ship logic + delete_feature(P_features.Starship); + + var locy = $"{name()}"; + + var flit = instance_create(system.x, system.y, obj_p_fleet); + + var _slaughter = new_player_ship("Gloriana", system.name, "Slaughtersong"); + add_ship_to_fleet(_slaughter, flit); + flit.oribiting = system.id; + + scr_popup($"Ancient Ship Restored", $"The ancient ship within the ruins of {locy} has been fully repaired. It is determined to be a Gloriana Class vessel and is bristling with golden age weaponry and armour. Your {string(obj_ini.role[100][16])}s are excited; the Slaughtersong is ready for it's maiden voyage, at your command.", "", ""); + } + } + } catch (_exception) { + handle_exception(_exception); + } + }; + + static guard_score_calc = function() { + guard_score = 0; + if (guardsmen < 500 && guardsmen > 0) { + guard_score = 0.1; + } else if (guardsmen >= 100000000) { + guard_score = 7; + } else if (guardsmen >= 50000000) { + guard_score = 6; + } else if (guardsmen >= 15000000) { + guard_score = 5; + } else if (guardsmen >= 6000000) { + guard_score = 4; + } else if (guardsmen >= 1000000) { + guard_score = 3; + } else if (guardsmen >= 100000) { + guard_score = 2; + } else if (guardsmen >= 2000) { + guard_score = 1; + } else { + guard_score = 0.5; + } + + return guard_score; + }; + + static continue_to_planet_battle = function(stop) { + var _nids_real = planet_forces[eFACTION.Tyranids]; + var _nids_score = _nids_real < 4 ? 0 : _nids_real; + var _nid_diff = _nids_score - _nids_real; + + if ((chaos_forces == 6.1) && (_nids_real > 0)) { + tyranids_score = _nids_real; + } + + if (current_owner == eFACTION.Tau) { + stop = (xenos_and_heretics() + _nid_diff + player_forces + planet_forces[eFACTION.Ecclesiarchy]) <= 0; + } + + if (stop) { + if ((planet_forces[eFACTION.Ork] > 0) && (planet_forces[eFACTION.Ecclesiarchy] > 0)) { + stop = 0; + } + } + + var imperium_forces = (guardsmen > 0) || (pdf > 0) || (planet_forces[eFACTION.Ecclesiarchy] > 0); + + if (stop) { + if (planet_forces[eFACTION.Necrons] >= 5 || planet_forces[eFACTION.Tyranids] >= 5 && imperium_forces) { + stop = 0; + } + } + + //tau fight imperial + if (stop) { + if (current_owner == eFACTION.Tau) { + if (((guardsmen > 0) || (planet_forces[eFACTION.Ecclesiarchy] > 0)) && ((pdf > 0) || (planet_forces[eFACTION.Tau] > 0))) { + stop = 0; + } + } + } + + // Attack heretics whenever possible, even player controlled ones + if (stop) { + if ((player_forces + pdf > 0) && (guardsmen > 0) && (obj_controller.faction_status[2] == "War")) { + stop = 0; + } + } + if (stop) { + if ((player_forces + pdf > 0) && (planet_forces[eFACTION.Ecclesiarchy] > 0) && (obj_controller.faction_status[5] == "War")) { + stop = 0; + } + } + + return stop; + }; + + static pdf_will_support_player = function() { + if (current_owner == eFACTION.Tau) { + return false; + } + if (has_feature(P_features.Gene_Stealer_Cult) && current_owner == eFACTION.Tyranids) { + return false; + } + + if ((current_owner == 1 || obj_controller.faction_status[2] != "War") && pdf) { + return true; + } + return false; + }; + + static guard_attack_matrix = function() { + var guard_attack = ""; + // if (p_eldar[planet]>0) and (p_owner[planet]!=6) then guard_attack="eldar"; + //if (planet_forces[eFACTION.Tau] + planet_forces[eFACTION.Ork] + planet_forces[eFACTION.Heretics]+ planet_forces[eFACTION.Chaos]) + if (planet_forces[eFACTION.Tau] > 0) { + guard_attack = "tau"; + } + if (planet_forces[eFACTION.Ork] > 0) { + guard_attack = "ork"; + } + if (planet_forces[eFACTION.Heretics] > 0) { + // Always goes after traitors first, unless + guard_attack = "traitors"; + if ((planet_forces[eFACTION.Heretics] <= 1 && planet_forces[eFACTION.Tau] >= 4) && (current_owner != 8)) { + guard_attack = "tau"; + } + } + if (planet_forces[eFACTION.Chaos] > 0) { + guard_attack = "csm"; + } + if ((pdf > 0) && (current_owner == eFACTION.Tau)) { + guard_attack = "pdf"; + } + + if (current_owner == eFACTION.Player) { + if (pdf > 0 && obj_controller.faction_status[2] == "War") { + guard_attack = "pdf"; + } + } + if ((planet_forces[eFACTION.Tyranids] <= 1) && (planet_forces[eFACTION.Ork] >= 4)) { + guard_attack = "ork"; + } + // if (p_tyranids[planet]>0) and (guard_attack="") then guard_attack="tyranids"; + if (planet_forces[eFACTION.Tyranids] >= 4) { + guard_attack = "tyranids"; + } else if (planet_forces[eFACTION.Tyranids] > 0) { + if (has_feature(P_features.Gene_Stealer_Cult)) { + var _hidden_cult = get_features(P_features.Gene_Stealer_Cult)[0].hiding; + if (!_hidden_cult) { + guard_attack = "tyranids"; + } else if (population_influences[eFACTION.Tyranids] >= 50) { + guard_attack = "pdf"; } - } else { - guard_attack="tyranids"; + } else { + guard_attack = "tyranids"; } - } else if (population_influences[eFACTION.Tyranids]>=50){ - guard_attack="pdf"; - } - - return guard_attack; - } - - - static pdf_attack_matrix = function(){ - var _no_notable_traitors = planet_forces[eFACTION.Heretics]<=1; - var _pdf_attack = ""; - if (planet_forces[eFACTION.Tyranids]>=4 && !has_feature(P_features.Gene_Stealer_Cult)){ - _pdf_attack = "tyranids"; - } - - if (_no_notable_traitors && _pdf_attack=="") { - if ((planet_forces[eFACTION.Ork]>=4)){ - _pdf_attack="ork"; - } else if (planet_forces[eFACTION.Tau]>=4 && current_owner!=8){ - _pdf_attack="tau"; - } - } - if (guardsmen && _pdf_attack==""){ - if (obj_controller.faction_status[2]=="War"){ - if (pdf_will_support_player()){ - _pdf_attack="guard"; - } - } else if (current_owner == eFACTION.Tau){ - _pdf_attack="guard"; - }else if (has_feature(P_features.Gene_Stealer_Cult) && population_influences[eFACTION.Tyranids]>=50){ - _pdf_attack="guard"; + } else if (population_influences[eFACTION.Tyranids] >= 50) { + guard_attack = "pdf"; + } + + return guard_attack; + }; + + static pdf_attack_matrix = function() { + var _no_notable_traitors = planet_forces[eFACTION.Heretics] <= 1; + var _pdf_attack = ""; + if (planet_forces[eFACTION.Tyranids] >= 4 && !has_feature(P_features.Gene_Stealer_Cult)) { + _pdf_attack = "tyranids"; + } + + if (_no_notable_traitors && _pdf_attack == "") { + if (planet_forces[eFACTION.Ork] >= 4) { + _pdf_attack = "ork"; + } else if (planet_forces[eFACTION.Tau] >= 4 && current_owner != 8) { + _pdf_attack = "tau"; } - } - - if (_pdf_attack==""){ - if (planet_forces[eFACTION.Chaos]>0){ - _pdf_attack="csm"; - } else if (planet_forces[eFACTION.Heretics]>0){ - _pdf_attack="traitors"; - } else if ((planet_forces[eFACTION.Ork]>0)){ - _pdf_attack="ork"; - } else if (planet_forces[eFACTION.Tau]>0) and (current_owner!=eFACTION.Tau){ - _pdf_attack="tau"; - } - } + } + if (guardsmen && _pdf_attack == "") { + if (obj_controller.faction_status[2] == "War") { + if (pdf_will_support_player()) { + _pdf_attack = "guard"; + } + } else if (current_owner == eFACTION.Tau) { + _pdf_attack = "guard"; + } else if (has_feature(P_features.Gene_Stealer_Cult) && population_influences[eFACTION.Tyranids] >= 50) { + _pdf_attack = "guard"; + } + } + + if (_pdf_attack == "") { + if (planet_forces[eFACTION.Chaos] > 0) { + _pdf_attack = "csm"; + } else if (planet_forces[eFACTION.Heretics] > 0) { + _pdf_attack = "traitors"; + } else if (planet_forces[eFACTION.Ork] > 0) { + _pdf_attack = "ork"; + } else if ((planet_forces[eFACTION.Tau] > 0) && (current_owner != eFACTION.Tau)) { + _pdf_attack = "tau"; + } + } // Always goes after traitors first, unless - return _pdf_attack; - } - - static pdf_loss_reduction_calc = function(){ - pdf_loss_reduction = fortification_level*0.001; - if (pdf_will_support_player()){ - pdf_loss_reduction+=garrison.viable_garrison*0.0005; - } - return pdf_loss_reduction; - } - - static pdf_defence_loss_to_orks = function(){ - var active_garrison = pdf_will_support_player() && garrison.viable_garrison>0; - if (planet_forces[eFACTION.Ork]>=4) and (pdf>=30000){ - pdf=floor(pdf*(min(0.95, 0.55+pdf_loss_reduction))); - } - else if (planet_forces[eFACTION.Ork]>=4 && pdf<30000 && pdf>=10000){ - pdf=active_garrison?pdf*0.4:0; - } - else if (planet_forces[eFACTION.Ork]>=3) and (pdf<10000){ - pdf=active_garrison?pdf*0.4:0; - } - else if (planet_forces[eFACTION.Ork]<3 && pdf>30000){ - pdf=floor(pdf*(min(0.95, 0.7+pdf_loss_reduction))); - } - if (planet_forces[eFACTION.Ork]>=2) and (pdf<2000){ pdf=0;} - if (planet_forces[eFACTION.Ork]>=1) and (pdf<200){ pdf=0;} + return _pdf_attack; + }; - system.p_pdf[planet] = pdf; - } + static pdf_loss_reduction_calc = function() { + pdf_loss_reduction = fortification_level * 0.001; + if (pdf_will_support_player()) { + pdf_loss_reduction += garrison.viable_garrison * 0.0005; + } + return pdf_loss_reduction; + }; + static pdf_defence_loss_to_orks = function() { + var active_garrison = pdf_will_support_player() && garrison.viable_garrison > 0; + if ((planet_forces[eFACTION.Ork] >= 4) && (pdf >= 30000)) { + pdf = floor(pdf * min(0.95, 0.55 + pdf_loss_reduction)); + } else if (planet_forces[eFACTION.Ork] >= 4 && pdf < 30000 && pdf >= 10000) { + pdf = active_garrison ? pdf * 0.4 : 0; + } else if ((planet_forces[eFACTION.Ork] >= 3) && (pdf < 10000)) { + pdf = active_garrison ? pdf * 0.4 : 0; + } else if (planet_forces[eFACTION.Ork] < 3 && pdf > 30000) { + pdf = floor(pdf * min(0.95, 0.7 + pdf_loss_reduction)); + } + if ((planet_forces[eFACTION.Ork] >= 2) && (pdf < 2000)) { + pdf = 0; + } + if ((planet_forces[eFACTION.Ork] >= 1) && (pdf < 200)) { + pdf = 0; + } - static planet_info_screen = function(){ - if (!instance_exists(obj_star_select)){ + system.p_pdf[planet] = pdf; + }; + + static planet_info_screen = function() { + if (!instance_exists(obj_star_select)) { exit; } - var improve=0 - var xx=15; - var yy=25; - var current_planet=planet; - var nm=scr_roman(current_planet), temp1=0; + var improve = 0; + var xx = 15; + var yy = 25; + var current_planet = planet; + var nm = scr_roman(current_planet), temp1 = 0; draw_set_halign(fa_center); draw_set_valign(fa_top); draw_set_font(fnt_40k_14); - + var _xenos_and_heretics = xenos_and_heretics(); - if (current_owner<=5) and (!_xenos_and_heretics){ - if (planet_forces[eFACTION.Player]>0||system.present_fleet[1]>0){ - if (fortification_level<5) then improve=1; + if ((current_owner <= 5) && (!_xenos_and_heretics)) { + if (planet_forces[eFACTION.Player] > 0 || system.present_fleet[1] > 0) { + if (fortification_level < 5) { + improve = 1; + } } } - + // Draw disposition here - var yyy=0; + var yyy = 0; var _succession = has_problem("succession"); - if ((player_disposition>=0 && current_owner<=5 && population>0)) and (_succession=0){ - var wack=0; + if ((player_disposition >= 0 && current_owner <= 5 && population > 0) && (_succession == 0)) { + var wack = 0; draw_set_color(c_blue); - draw_rectangle(xx+349,yy+175,xx+349+(min(100,player_disposition)*3.68),yy+192,0); + draw_rectangle(xx + 349, yy + 175, xx + 349 + (min(100, player_disposition) * 3.68), yy + 192, 0); } draw_set_color(c_gray); - draw_rectangle(xx+349,yy+175,xx+717,yy+192,1); + draw_rectangle(xx + 349, yy + 175, xx + 717, yy + 192, 1); draw_set_color(c_white); - - if (!_succession){ - if (player_disposition>=0) and (origional_owner<=5) and (current_owner<=5) and (population>0){ - draw_text(xx+534,yy+176,"Disposition: "+string(min(100,player_disposition))+"/100"); + if (!_succession) { + if ((player_disposition >= 0) && (origional_owner <= 5) && (current_owner <= 5) && (population > 0)) { + draw_text(xx + 534, yy + 176, "Disposition: " + string(min(100, player_disposition)) + "/100"); } - if (player_disposition>-30) and (player_disposition<0) and (current_owner<=5) and (population>0){ - draw_text(xx+534,yy+176,"Disposition: ???/100"); + if ((player_disposition > -30) && (player_disposition < 0) && (current_owner <= 5) && (population > 0)) { + draw_text(xx + 534, yy + 176, "Disposition: ???/100"); } - if ((player_disposition>=0) and (origional_owner<=5) and (current_owner>5)) or (population<=0){ - draw_text(xx+534,yy+176,"-------------"); + if (((player_disposition >= 0) && (origional_owner <= 5) && (current_owner > 5)) || (population <= 0)) { + draw_text(xx + 534, yy + 176, "-------------"); } - if (player_disposition<=-3000) then draw_text(xx+534,yy+176,"Disposition: N/A"); - } else if (_succession){ - draw_text(xx+534,yy+176,"War of _Succession"); + if (player_disposition <= -3000) { + draw_text(xx + 534, yy + 176, "Disposition: N/A"); + } + } else if (_succession) { + draw_text(xx + 534, yy + 176, "War of _Succession"); } draw_set_color(c_gray); // End draw disposition draw_set_color(c_gray); - draw_rectangle(xx+349,yy+193,xx+717,yy+210,0); - var bar_width = 717-349; - var bar_start_point = xx+349; - var bar_percent_length = (bar_width/100); + draw_rectangle(xx + 349, yy + 193, xx + 717, yy + 210, 0); + var bar_width = 717 - 349; + var bar_start_point = xx + 349; + var bar_percent_length = bar_width / 100; var current_bar_percent = 0; var hidden_cult = false; - if (has_feature(P_features.Gene_Stealer_Cult)){ + if (has_feature(P_features.Gene_Stealer_Cult)) { hidden_cult = get_features(P_features.Gene_Stealer_Cult)[0].hiding; - } - - for (var i=1;i<13;i++){ - if (population_influences[i]>0){ + } + + for (var i = 1; i < 13; i++) { + if (population_influences[i] > 0) { draw_set_color(global.star_name_colors[i]); - if (hidden_cult){ + if (hidden_cult) { draw_set_color(global.star_name_colors[eFACTION.Imperium]); } - var current_start = bar_start_point+(current_bar_percent*bar_percent_length) - draw_rectangle(current_start,yy+193,current_start+(bar_percent_length*population_influences[i]),yy+210,0); - current_bar_percent+=population_influences[i]; + var current_start = bar_start_point + (current_bar_percent * bar_percent_length); + draw_rectangle(current_start, yy + 193, current_start + (bar_percent_length * population_influences[i]), yy + 210, 0); + current_bar_percent += population_influences[i]; } draw_set_color(c_gray); } - draw_set_color(c_white); - draw_text(xx+534,yy+194,"Population Influence"); - yy+=20; + draw_set_color(c_white); + draw_text(xx + 534, yy + 194, "Population Influence"); + yy += 20; draw_set_font(fnt_40k_14b); draw_set_halign(fa_left); - if (!is_craftworld && !is_hulk) then draw_text(xx+480,yy+196,$"{system.name} {nm} ({planet_type})"); - if (is_craftworld) then draw_text(xx+480,yy+196,string(system.name)+" (Craftworld)"); + if (!is_craftworld && !is_hulk) { + draw_text(xx + 480, yy + 196, $"{system.name} {nm} ({planet_type})"); + } + if (is_craftworld) { + draw_text(xx + 480, yy + 196, string(system.name) + " (Craftworld)"); + } // if (is_craftworld=0) and (is_hulk=0) then draw_text(xx+534,yy+214,string(planet_type)+" World"); // if (is_craftworld=1) then draw_text(xx+594,yy+214,"Craftworld"); - if (is_hulk) then draw_text(xx+480,yy+196,"Space Hulk"); - + if (is_hulk) { + draw_text(xx + 480, yy + 196, "Space Hulk"); + } + // draw_sprite(spr_planet_splash,temp1,xx+349,yy+194); - scr_image("ui/planet",scr_planet_image_numbers(planet_type),xx+349,yy+194,128,128); - draw_rectangle(xx+349,yy+194,xx+477,yy+322,1); + scr_image("ui/planet", scr_planet_image_numbers(planet_type), xx + 349, yy + 194, 128, 128); + draw_rectangle(xx + 349, yy + 194, xx + 477, yy + 322, 1); draw_set_font(fnt_40k_14); - - var pop_string = $"Population: {display_population()}"; + var pop_string = $"Population: {display_population()}"; var _button_manager = obj_star_select.button_manager; - _button_manager.update({ - label:pop_string, - tooltip : "population data toggle with 'P'", - keystroke : press_exclusive(ord("P")), - x1 : xx+480, - y1 : yy+217, - w : 200, - h : 22 - }); + _button_manager + .update({ + label: pop_string, + tooltip: "population data toggle with 'P'", + keystroke: press_exclusive(ord("P")), + x1: xx + 480, + y1: yy + 217, + w: 200, + h: 22, + }); _button_manager.update_loc(); - if (_button_manager.draw()){ + if (_button_manager.draw()) { obj_star_select.population = !obj_star_select.population; - if (obj_star_select.population){ + if (obj_star_select.population) { obj_star_select.potential_doners = find_population_doners(system.id); } } - - if (is_craftworld=0) and (is_hulk=0){ - var y7=240,temp3=string(scr_display_number(guardsmen)); - if (guardsmen>0){ - draw_text(xx+480,yy+y7,$"Imperial Guard: {temp3}"); - y7+=20; + if ((is_craftworld == 0) && (is_hulk == 0)) { + var y7 = 240, temp3 = string(scr_display_number(guardsmen)); + if (guardsmen > 0) { + draw_text(xx + 480, yy + y7, $"Imperial Guard: {temp3}"); + y7 += 20; } - var temp4=string(scr_display_number(pdf)); - if (current_owner!=8){ - draw_text(xx+480,yy+y7,$"Defense Force: {temp4}"); + var temp4 = string(scr_display_number(pdf)); + if (current_owner != 8) { + draw_text(xx + 480, yy + y7, $"Defense Force: {temp4}"); } - if (current_owner=8){ - draw_text(xx+480,yy+y7,$"Gue'Vesa Force: {temp4}"); + if (current_owner == 8) { + draw_text(xx + 480, yy + y7, $"Gue'Vesa Force: {temp4}"); } } - - var temp5=""; - - - if (!is_hulk){ - if (improve=1){ + + var temp5 = ""; + + if (!is_hulk) { + if (improve == 1) { draw_set_color(c_green); - draw_rectangle(xx+481,yy+280,xx+716,yy+298,0); - draw_sprite(spr_requisition,0,xx+657,yy+283); - - - var improve_cost=1500,yep=0,o=0; - - if (scr_has_adv("Siege Masters")){ - improve_cost=1100; + draw_rectangle(xx + 481, yy + 280, xx + 716, yy + 298, 0); + draw_sprite(spr_requisition, 0, xx + 657, yy + 283); + + var improve_cost = 1500, yep = 0, o = 0; + + if (scr_has_adv("Siege Masters")) { + improve_cost = 1100; } - - draw_text_glow(xx+671, yy+281,improve_cost,16291875,0); - - if (scr_hit(xx+481,yy+282,xx+716,yy+300)){ + + draw_text_glow(xx + 671, yy + 281, improve_cost, 16291875, 0); + + if (scr_hit(xx + 481, yy + 282, xx + 716, yy + 300)) { draw_set_color(0); draw_set_alpha(0.2); - draw_rectangle(xx+481,yy+280,xx+716,yy+298,0); - if (scr_click_left()) and (obj_controller.requisition>=improve_cost){ - obj_controller.requisition-=improve_cost; + draw_rectangle(xx + 481, yy + 280, xx + 716, yy + 298, 0); + if (scr_click_left() && (obj_controller.requisition >= improve_cost)) { + obj_controller.requisition -= improve_cost; alter_fortification(1); - - if (player_disposition>0) and (player_disposition<=100){ - add_disposition(9-fortification_level); + + if ((player_disposition > 0) && (player_disposition <= 100)) { + add_disposition(9 - fortification_level); } } - } draw_set_alpha(1); draw_set_color(0); } - var forti_string = ["None", "Sparse","Light","Moderate","Heavy","Major","Extreme"]; + var forti_string = ["None", "Sparse", "Light", "Moderate", "Heavy", "Major", "Extreme"]; var planet_forti = $"Defenses: {forti_string[fortification_level]}"; - draw_text(xx+480,yy+280,planet_forti); + draw_text(xx + 480, yy + 280, planet_forti); } - + draw_set_color(c_gray); - - if (is_hulk=1){ - temp5="Integrity: "+string(floor(fortification_level*20))+"%"; - draw_text(xx+480,yy+280,temp5); + + if (is_hulk == 1) { + temp5 = "Integrity: " + string(floor(fortification_level * 20)) + "%"; + draw_text(xx + 480, yy + 280, temp5); } - - var temp6="???"; - var target_planet_heresy=corruption; + + var temp6 = "???"; + var target_planet_heresy = corruption; if (target_planet_heresy < 0) { - temp6 = "DEBUG: Heresy below 0!" + temp6 = "DEBUG: Heresy below 0!"; } else if (target_planet_heresy <= 10) { temp6 = "None"; } else if (target_planet_heresy <= 30) { @@ -1026,23 +1065,21 @@ function PlanetData(planet, system) constructor{ } else if (target_planet_heresy > 100) { temp6 = "DEBUG: Heresy above 100!"; } else { - temp6 = "DEBUG: Heresy somehow unknown value!" + temp6 = "DEBUG: Heresy somehow unknown value!"; } - draw_text(xx+480,yy+300,$"Corruption: {temp6}"); - - + draw_text(xx + 480, yy + 300, $"Corruption: {temp6}"); + draw_set_font(fnt_40k_14b); - draw_text(xx+349,yy+326,"Planetary Presence"); - draw_text(xx+535,yy+326,"Planetary Features"); + draw_text(xx + 349, yy + 326, "Planetary Presence"); + draw_text(xx + 535, yy + 326, "Planetary Features"); draw_set_font(fnt_40k_14); - - + var presence_text = ""; var faction_names = ["Adeptas", "Orks", "Tau", "Tyranids", "Chaos", "Traitors", "Daemons", "Necrons"]; var faction_ids = ["p_sisters", "p_orks", "p_tau", "p_tyranids", "p_traitors", "p_chaos", "p_demons", "p_necrons"]; var blurbs = ["Minima", "Parvus", "Moderatus", "Significus", "Enormicus", "Extremis"]; - + for (var t = 0; t < array_length(faction_names); t++) { var faction = faction_names[t]; var faction_id = faction_ids[t]; @@ -1065,59 +1102,61 @@ function PlanetData(planet, system) constructor{ } } - draw_text(xx+349,yy+346,string_hash_to_newline(string(presence_text))); - - - var to_show=0,temp9="";t=-1; + draw_text(xx + 349, yy + 346, string_hash_to_newline(string(presence_text))); - var fit = array_create(11, ""); + var to_show = 0, temp9 = ""; + t = -1; + + var fit = array_create(11, ""); var planet_displays = [], i; var feat_count, _cur_feature; var feat_count = array_length(features); var upgrade_count = array_length(upgrades); var size = ["", "Small", "", "Large"]; - if ( feat_count > 0){ - for (i =0; i < feat_count ;i++){ - cur_feature= features[i] - if (cur_feature.planet_display != 0){ - if (cur_feature.f_type == P_features.Gene_Stealer_Cult){ - if (!cur_feature.hiding){ + if (feat_count > 0) { + for (i = 0; i < feat_count; i++) { + cur_feature = features[i]; + if (cur_feature.planet_display != 0) { + if (cur_feature.f_type == P_features.Gene_Stealer_Cult) { + if (!cur_feature.hiding) { array_push(planet_displays, [cur_feature.planet_display, cur_feature]); } - }else if (cur_feature.player_hidden == 1){ - array_push(planet_displays, ["????", ""] ); - }else{ + } else if (cur_feature.player_hidden == 1) { + array_push(planet_displays, ["????", ""]); + } else { array_push(planet_displays, [cur_feature.planet_display, cur_feature]); } - if (cur_feature.f_type == P_features.Monastery){ - if (cur_feature.forge>0){ + if (cur_feature.f_type == P_features.Monastery) { + if (cur_feature.forge > 0) { var forge = cur_feature.forge_data; - var size_string= $"{size[forge.size]} Chapter Forge" + var size_string = $"{size[forge.size]} Chapter Forge"; array_push(planet_displays, [size_string, forge]); } - } + } } } } - if (upgrade_count>0){ - for (i =0; i < upgrade_count ;i++){ + if (upgrade_count > 0) { + for (i = 0; i < upgrade_count; i++) { var _upgrade = upgrades[i]; - if (_upgrade.f_type == P_features.Secret_Base){ - if (_upgrade.forge>0){ + if (_upgrade.f_type == P_features.Secret_Base) { + if (_upgrade.forge > 0) { var forge = _upgrade.forge_data; - var size_string= $"{size[forge.size]} Chapter Forge" + var size_string = $"{size[forge.size]} Chapter Forge"; array_push(planet_displays, [size_string, forge]); } } } } - for (i=0;i0){ - var current_planet=planet; + if (planet > 0) { + var current_planet = planet; draw_set_color(c_black); draw_set_halign(fa_center); - + /*if (obj_controller.recruiting_worlds_bought>0) and (system.p_owner[planet]<=5) and (obj_controller.faction_status[system.p_owner[planet]]!="War"){ if (string_count("Recr",system.p_feature[planet])=0){ button4="+Recruiting"; } }*/ - + /*if (origional_owner=1){ if (mouse_x>=xx+363) and (mouse_y>=yy+194) and (mouse_x0){ @@ -1167,166 +1208,159 @@ function PlanetData(planet, system) constructor{ } } }*/ - } - } - - static suffer_navy_bombard = function(strength){ - - - var kill = 0; - // Eh heh heh - if (planet_forces[eFACTION.Tyranids]>0){ - strength = strength>2 ? 2 : 0; - system.p_tyranids[planet]-=2; } - else if (planet_forces[eFACTION.Ork]>0){ - if (strength>2) then strength=2;if (strength<1) then strength=0; - system.p_orks[planet]-=2; - } - else if (current_owner=eFACTION.Tau) and (planet_forces[eFACTION.Tau]>0){ - strength = strength>2 ? 2 : 0; - system.p_tau[planet]-=2; - - kill = large_population ? strength*0.15 : strength*15000000 - } - else if (current_owner=8) and (pdf>0){ + }; - system.p_pdf[planet]-= strength*(irandom_range(49, 51) * 100000); - if (pdf<0){ - system.p_pdf[planet]=0; + static suffer_navy_bombard = function(strength) { + var kill = 0; + // Eh heh heh + if (planet_forces[eFACTION.Tyranids] > 0) { + strength = strength > 2 ? 2 : 0; + system.p_tyranids[planet] -= 2; + } else if (planet_forces[eFACTION.Ork] > 0) { + if (strength > 2) { + strength = 2; } - - kill = large_population ? strength*0.15 : strength*15000000 - } - else if (current_owner=10){ + if (strength < 1) { + strength = 0; + } + system.p_orks[planet] -= 2; + } else if ((current_owner == eFACTION.Tau) && (planet_forces[eFACTION.Tau] > 0)) { + strength = strength > 2 ? 2 : 0; + system.p_tau[planet] -= 2; + + kill = large_population ? strength * 0.15 : strength * 15000000; + } else if ((current_owner == 8) && (pdf > 0)) { + system.p_pdf[planet] -= strength * (irandom_range(49, 51) * 100000); + if (pdf < 0) { + system.p_pdf[planet] = 0; + } + + kill = large_population ? strength * 0.15 : strength * 15000000; + } else if (current_owner == 10) { + strength = strength > 2 ? 2 : 0; - strength = strength>2 ? 2 : 0; - - if (system.p_chaos[planet]>0){ - system.p_chaos[planet]=max(0,system.p_traitors[planet]-1); - } else if (system.p_traitors[planet]>0){ - system.p_traitors[planet]=max(0,system.p_traitors[planet]-2); + if (system.p_chaos[planet] > 0) { + system.p_chaos[planet] = max(0, system.p_traitors[planet] - 1); + } else if (system.p_traitors[planet] > 0) { + system.p_traitors[planet] = max(0, system.p_traitors[planet] - 2); + } + kill = strength * population_small_conversion(0.15); + if (system.p_heresy[planet] > 0) { + system.p_heresy[planet] = max(0, system.p_heresy[planet] - 5); } - kill = strength * population_small_conversion(0.15); - if (system.p_heresy[planet]>0) then system.p_heresy[planet]=max(0,system.p_heresy[planet]-5); } var _pop_percentage_kill = population > 0 ? (kill / population) * 100 : 0; - edit_population(kill*-1); - if (system.p_pdf[planet]<0) then system.p_pdf[planet]=0; - if (population_influences[eFACTION.Tyranids] > 3){ - var _max_influence_reduction = min(_pop_percentage_kill,population_influences[eFACTION.Tyranids]-3); - adjust_influence(eFACTION.Tyranids,-_max_influence_reduction,planet,system); - if (has_feature(P_features.Gene_Stealer_Cult)){ - if (population_influences[eFACTION.Tyranids]<20){ + edit_population(kill * -1); + if (system.p_pdf[planet] < 0) { + system.p_pdf[planet] = 0; + } + if (population_influences[eFACTION.Tyranids] > 3) { + var _max_influence_reduction = min(_pop_percentage_kill, population_influences[eFACTION.Tyranids] - 3); + adjust_influence(eFACTION.Tyranids, -_max_influence_reduction, planet, system); + if (has_feature(P_features.Gene_Stealer_Cult)) { + if (population_influences[eFACTION.Tyranids] < 20) { delete_feature(P_features.Gene_Stealer_Cult); } } } - - if (population+pdf<=0) and (current_owner=1) and (obj_controller.faction_status[eFACTION.Imperium]="War"){ - if (!has_feature(P_features.Monastery)){ - current_owner=2; - add_disposition(-50); + + if ((population + pdf <= 0) && (current_owner == 1) && (obj_controller.faction_status[eFACTION.Imperium] == "War")) { + if (!has_feature(P_features.Monastery)) { + current_owner = 2; + add_disposition(-50); } - } - } + } + }; - static create_planet_garrison = function(){ + static create_planet_garrison = function() { var company_data = obj_controller.company_data; var squad_index = company_data.company_squads[company_data.cur_squad]; - var current_squad=obj_ini.squads[squad_index]; - current_squad.set_location(system.name,0,planet); + var current_squad = obj_ini.squads[squad_index]; + current_squad.set_location(system.name, 0, planet); var _mission = obj_star_select.mission; - current_squad.assignment={ - type:_mission, - location:system.name, - ident:planet, + current_squad.assignment = { + type: _mission, + location: system.name, + ident: planet, }; var operation_data = { - type:"squad", - reference:squad_index, - job:_mission, - task_time : 0 + type: "squad", + reference: squad_index, + job: _mission, + task_time: 0, }; - add_operatives(operation_data) + add_operatives(operation_data); system.garrison = true; //if there was an outstanding mission to provide the given garrison var garrison_request = find_problem("provide_garrison"); - if (garrison_request>-1){ + if (garrison_request > -1) { init_garrison_mission(planet, system, garrison_request); } instance_destroy(obj_star_select); - } - + }; - static planet_selection_logic = function(){ + static planet_selection_logic = function() { var planet_is_allies = scr_is_planet_owned_by_allies(system, planet); - var garrison_issue = (!planet_is_allies || pdf<=0); - var _mission = variable_instance_exists(obj_star_select,"mission") ? obj_star_select.mission : ""; + var garrison_issue = !planet_is_allies || pdf <= 0; + var _mission = variable_instance_exists(obj_star_select, "mission") ? obj_star_select.mission : ""; - var _loading = obj_star_select.loading; + var _loading = obj_star_select.loading; var garrison_assignment = obj_controller.view_squad && _loading; - if (garrison_assignment && (garrison_issue && _mission=="garrison")){ + if (garrison_assignment && (garrison_issue && _mission == "garrison")) { planet_draw = c_red; - tooltip_draw("Can't garrison on non-friendly planet or planet with no friendly PDF", 150); + tooltip_draw("Can't garrison on non-friendly planet or planet with no friendly PDF", 150); } - if (mouse_check_button_pressed(mb_left)){ - if (garrison_assignment){ - if (!(garrison_issue && _mission=="garrison")){ + if (mouse_check_button_pressed(mb_left)) { + if (garrison_assignment) { + if (!(garrison_issue && _mission == "garrison")) { create_planet_garrison(); exit; } - } else if (!_loading){ + } else if (!_loading) { garrison = new GarrisonForce(operatives); system.garrison = garrison.garrison_force; - feature=""; - buttons_selected=false; - } else if (_loading && planet >0){ - - obj_controller.unload=planet; - obj_controller.return_object=system; - obj_controller.return_size=obj_controller.man_size; - edit_player_forces(obj_controller.man_size) - + feature = ""; + buttons_selected = false; + } else if (_loading && planet > 0) { + obj_controller.unload = planet; + obj_controller.return_object = system; + obj_controller.return_size = obj_controller.man_size; + edit_player_forces(obj_controller.man_size); + // 135 ; SPECIAL PLANET CRAP HERE - + // Recon Stuff - if (has_problem("recon")){ - var arti=instance_create(system.x,system.y,obj_temp7);// Unloading / artifact crap + if (has_problem("recon")) { + var arti = instance_create(system.x, system.y, obj_temp7); // Unloading / artifact crap - arti.num=planet; - arti.alarm[0]=1; - arti.loc=obj_controller.selecting_location; - arti.managing=obj_controller.managing; - arti.type="recon"; + arti.num = planet; + arti.alarm[0] = 1; + arti.loc = obj_controller.selecting_location; + arti.managing = obj_controller.managing; + arti.type = "recon"; - with (arti){ - setup_planet_mission_group() + with (arti) { + setup_planet_mission_group(); } } - if (!instance_exists(obj_ground_mission)){ + if (!instance_exists(obj_ground_mission)) { check_for_artifact_grab_mission(); - } - if (!instance_exists(obj_ground_mission)){ + } + if (!instance_exists(obj_ground_mission)) { check_for_stc_grab_mission(); } // Ancient Ruins - if (!instance_exists(obj_ground_mission)){ - scr_check_for_ruins_exploration(); + if (!instance_exists(obj_ground_mission)) { + scr_check_for_ruins_exploration(); } instance_destroy(obj_star_select); exit; - } - - } - } - + } + } + }; } - - - - diff --git a/scripts/scr_dialogue/scr_dialogue.gml b/scripts/scr_dialogue/scr_dialogue.gml index 393fa3ad88..3c128c929c 100644 --- a/scripts/scr_dialogue/scr_dialogue.gml +++ b/scripts/scr_dialogue/scr_dialogue.gml @@ -14,8 +14,8 @@ function interpret_diag_string(string_data, data) { // Case 2: Raw string if (is_string(string_data)) { return string_interpolate_from_struct(string_data, data); - } else // Case 3: Structs → interpret - if (is_struct(string_data)) { + } else if (is_struct(string_data)) { + // Case 3: Structs → interpret // Multipart sequences if (struct_exists(string_data, "multi_part")) { for (var i = 0; i < array_length(string_data.parts); i++) { diff --git a/scripts/scr_event_code/scr_event_code.gml b/scripts/scr_event_code/scr_event_code.gml index 35bf476edc..66062a55f9 100644 --- a/scripts/scr_event_code/scr_event_code.gml +++ b/scripts/scr_event_code/scr_event_code.gml @@ -1,460 +1,447 @@ - - -function add_event(event_data){ - var _inserted = false; - if (!struct_exists(event_data,"duration")){ - event_data.duration = 1; - } - for (var i=0;i= event_data.duration){ - array_insert(obj_controller.event, i, event_data); - _inserted = true; - break; - } - } - if (!_inserted){ - array_push(obj_controller.event, event_data); - } +function add_event(event_data) { + var _inserted = false; + if (!struct_exists(event_data, "duration")) { + event_data.duration = 1; + } + for (var i = 0; i < array_length(obj_controller.event); i++) { + var _event = obj_controller.event[i]; + if (_event.duration >= event_data.duration) { + array_insert(obj_controller.event, i, event_data); + _inserted = true; + break; + } + } + if (!_inserted) { + array_push(obj_controller.event, event_data); + } } -function find_event(e_id){ - var _event_found = -1; - for (var i=0;i= 0; i--){ - var _event = event[i]; - if (_event.e_id=="" || _event.duration<0){ - array_delete(event, i, 1); - continue; - } - - _event.duration-=1; - - if (_event.duration==0){ - if (_event.e_id=="game_over_man"){ - obj_controller.alarm[8]=1; - } - // Removes planetary governor installed by the chapter - if (_event.e_id == "remove_surf"){ +function event_end_turn_action() { + var _event_length = array_length(event); + for (var i = _event_length - 1; i >= 0; i--) { + var _event = event[i]; + if (_event.e_id == "" || _event.duration < 0) { + array_delete(event, i, 1); + continue; + } - var _star_name = _event.system; - var _event_star = star_by_name(_event.system); - var _planet = _event.planet; - if (_event_star!="none"){ - _event_star.dispo[_planet]=-10;// Resets - var twix=$"Inquisition executes Chapter Serf in control of {pllanet_numera_name(planet, _event_star)} and installs a new Planetary Governor."; - if (_event_star.p_owner[_planet]=eFACTION.Player){ - _event_star.p_owner[_planet]=_event_star.p_first[_planet]; - } - scr_alert("","",twix,0,0); - scr_event_log("",twix, _star_name); - } - } - // Changes relation to good - else if (_event.e_id=="enemy_imperium"){ - scr_alert("green","enemy","You have made amends with your enemy in the Imperium.",0,0); - disposition[eFACTION.Imperium]+=20; - scr_event_log("","Amends made with Imperium."); - } - else if (_event.e_id=="enemy_mechanicus"){ - scr_alert("green","enemy","You have made amends with your Mechanicus enemy.",0,0); - disposition[eFACTION.Mechanicus]+=20; - scr_event_log("","Amends made with Mechanicus enemy."); - } - else if (_event.e_id=="enemy_inquisition"){ - scr_alert("green","enemy","You have made amends with your enemy in the Inquisition.",0,0); - disposition[eFACTION.Inquisition]+=20; - scr_event_log("","Amends made with Inquisition enemy."); - } - else if (_event.e_id=="enemy_ecclesiarchy"){ - scr_alert("green","enemy","You have made amends with your enemy in the Ecclesiarchy.",0,0); - disposition[eFACTION.Ecclesiarchy]+=20; - scr_event_log("","Amends made with Ecclesiarchy enemy."); - } - // Sector commander losses its mind - else if (_event.e_id=="imperium_daemon"){ - var alert_string = $"Sector Commander {faction_leader[eFACTION.Imperium]} has gone insane." - scr_alert("red","lol",alert_string,0,0); - faction_defeated[eFACTION.Imperium]=1; - scr_event_log("red",alert_string); - } - // Starts chaos invasion - if (_event.e_id=="chaos_invasion"){ - var xx=0,yy=0,flee=0,dirr=0; - var star_id = scr_random_find(1,true,"",""); - if(star_id != undefined){ - scr_event_log("purple",$"Chaos Fleets exit the warp near the {star_id.name} system.", star_id.name); - for(var j=0; j<4; j++){ - dirr+=irandom_range(50,100); - xx=star_id.x+lengthdir_x(72,dirr); - yy=star_id.y+lengthdir_y(72,dirr); - flee=instance_create(xx,yy,obj_en_fleet); - flee.owner=eFACTION.Chaos; - flee.sprite_index=spr_fleet_chaos; - flee.image_index=4; - flee.capital_number=choose(0,1); - flee.frigate_number=choose(2,3); - flee.escort_number=choose(4,5,6); - flee.cargo_data.csm = true; - obj_controller.chaos_fleets+=1; - flee.action_x=star_id.x; - flee.action_y=star_id.y; - with(flee){ - set_fleet_movement(); - } - } - } - } - // Ships construction - if (_event.e_id == "ship_construction"){ - var new_ship_event=_event.ship_class; - var active_forges = []; - var chosen_star = false; - with(obj_star){ - if (owner==eFACTION.Mechanicus){ - for (f=1;f<=planets;f++){ - if (p_type[f]=="Forge") and (p_owner[f]==eFACTION.Mechanicus){ - array_push(active_forges,new PlanetData(f, self)); - } - } - } - } - if (array_length(active_forges)>0){ - var ship_spawn = active_forges[irandom(array_length(active_forges)-1)]; - var _new_player_fleet=instance_create(ship_spawn.system.x,ship_spawn.system.y,obj_p_fleet); + _event.duration -= 1; - // Creates the ship - var last_ship = new_player_ship(new_ship_event, ship_spawn.system.name); + if (_event.duration == 0) { + if (_event.e_id == "game_over_man") { + obj_controller.alarm[8] = 1; + } + // Removes planetary governor installed by the chapter + if (_event.e_id == "remove_surf") { + var _star_name = _event.system; + var _event_star = star_by_name(_event.system); + var _planet = _event.planet; + if (_event_star != "none") { + _event_star.dispo[_planet] = -10; // Resets + var twix = $"Inquisition executes Chapter Serf in control of {pllanet_numera_name(planet, _event_star)} and installs a new Planetary Governor."; + if (_event_star.p_owner[_planet] == eFACTION.Player) { + _event_star.p_owner[_planet] = _event_star.p_first[_planet]; + } + scr_alert("", "", twix, 0, 0); + scr_event_log("", twix, _star_name); + } + } else // Changes relation to good + if (_event.e_id == "enemy_imperium") { + scr_alert("green", "enemy", "You have made amends with your enemy in the Imperium.", 0, 0); + disposition[eFACTION.Imperium] += 20; + scr_event_log("", "Amends made with Imperium."); + } else if (_event.e_id == "enemy_mechanicus") { + scr_alert("green", "enemy", "You have made amends with your Mechanicus enemy.", 0, 0); + disposition[eFACTION.Mechanicus] += 20; + scr_event_log("", "Amends made with Mechanicus enemy."); + } else if (_event.e_id == "enemy_inquisition") { + scr_alert("green", "enemy", "You have made amends with your enemy in the Inquisition.", 0, 0); + disposition[eFACTION.Inquisition] += 20; + scr_event_log("", "Amends made with Inquisition enemy."); + } else if (_event.e_id == "enemy_ecclesiarchy") { + scr_alert("green", "enemy", "You have made amends with your enemy in the Ecclesiarchy.", 0, 0); + disposition[eFACTION.Ecclesiarchy] += 20; + scr_event_log("", "Amends made with Ecclesiarchy enemy."); + } else // Sector commander losses its mind + if (_event.e_id == "imperium_daemon") { + var alert_string = $"Sector Commander {faction_leader[eFACTION.Imperium]} has gone insane."; + scr_alert("red", "lol", alert_string, 0, 0); + faction_defeated[eFACTION.Imperium] = 1; + scr_event_log("red", alert_string); + } + // Starts chaos invasion + if (_event.e_id == "chaos_invasion") { + var xx = 0, yy = 0, flee = 0, dirr = 0; + var star_id = scr_random_find(1, true, "", ""); + if (star_id != undefined) { + scr_event_log("purple", $"Chaos Fleets exit the warp near the {star_id.name} system.", star_id.name); + for (var j = 0; j < 4; j++) { + dirr += irandom_range(50, 100); + xx = star_id.x + lengthdir_x(72, dirr); + yy = star_id.y + lengthdir_y(72, dirr); + flee = instance_create(xx, yy, obj_en_fleet); + flee.owner = eFACTION.Chaos; + flee.sprite_index = spr_fleet_chaos; + flee.image_index = 4; + flee.capital_number = choose(0, 1); + flee.frigate_number = choose(2, 3); + flee.escort_number = choose(4, 5, 6); + flee.cargo_data.csm = true; + obj_controller.chaos_fleets += 1; + flee.action_x = star_id.x; + flee.action_y = star_id.y; + with (flee) { + set_fleet_movement(); + } + } + } + } + // Ships construction + if (_event.e_id == "ship_construction") { + var new_ship_event = _event.ship_class; + var active_forges = []; + var chosen_star = false; + with (obj_star) { + if (owner == eFACTION.Mechanicus) { + for (f = 1; f <= planets; f++) { + if ((p_type[f] == "Forge") && (p_owner[f] == eFACTION.Mechanicus)) { + array_push(active_forges, new PlanetData(f, self)); + } + } + } + } + if (array_length(active_forges) > 0) { + var ship_spawn = active_forges[irandom(array_length(active_forges) - 1)]; + var _new_player_fleet = instance_create(ship_spawn.system.x, ship_spawn.system.y, obj_p_fleet); - add_ship_to_fleet(last_ship, _new_player_fleet) + // Creates the ship + var last_ship = new_player_ship(new_ship_event, ship_spawn.system.name); - // show_message(string(obj_ini.ship_class[last_ship])+":"+string(obj_ini.ship[last_ship])); + add_ship_to_fleet(last_ship, _new_player_fleet); - if (obj_ini.ship_size[last_ship]!=1) then scr_popup("Ship Constructed",$"Your new {obj_ini.ship_class[last_ship]} '{obj_ini.ship[last_ship]}' has finished being constructed. It is orbiting {ship_spawn.system.name} and awaits its maiden voyage.","shipyard",""); - if (obj_ini.ship_size[last_ship]==1) then scr_popup("Ship Constructed",$"Your new {obj_ini.ship_class[last_ship]} Escort '{obj_ini.ship[last_ship]}' has finished being constructed. It is orbiting {ship_spawn.system.name} and awaits its maiden voyage.","shipyard",""); - var bob=instance_create(ship_spawn.system.x+16,ship_spawn.system.y-24,obj_star_event); - bob.image_alpha=1; - bob.image_speed=1; - } - if (array_length(active_forges)==0){ - _event.duration=2; - scr_popup("Ship Construction halted",$"A lack of suitable forge worlds in the system has halted construction of your requested ship","shipyard",""); - } - } - // Spare the inquisitor - if (_event.e_id == "inquisitor_spared"){ - hunt_inquisition_spared_inquisitor_consequence(_event); - } + // show_message(string(obj_ini.ship_class[last_ship])+":"+string(obj_ini.ship[last_ship])); - if (_event.e_id == "strange_building"){ + if (obj_ini.ship_size[last_ship] != 1) { + scr_popup("Ship Constructed", $"Your new {obj_ini.ship_class[last_ship]} '{obj_ini.ship[last_ship]}' has finished being constructed. It is orbiting {ship_spawn.system.name} and awaits its maiden voyage.", "shipyard", ""); + } + if (obj_ini.ship_size[last_ship] == 1) { + scr_popup("Ship Constructed", $"Your new {obj_ini.ship_class[last_ship]} Escort '{obj_ini.ship[last_ship]}' has finished being constructed. It is orbiting {ship_spawn.system.name} and awaits its maiden voyage.", "shipyard", ""); + } + var bob = instance_create(ship_spawn.system.x + 16, ship_spawn.system.y - 24, obj_star_event); + bob.image_alpha = 1; + bob.image_speed = 1; + } + if (array_length(active_forges) == 0) { + _event.duration = 2; + scr_popup("Ship Construction halted", $"A lack of suitable forge worlds in the system has halted construction of your requested ship", "shipyard", ""); + } + } + // Spare the inquisitor + if (_event.e_id == "inquisitor_spared") { + hunt_inquisition_spared_inquisitor_consequence(_event); + } - var marine_name=_event.name; - var comp=_event.company; - var marine_num=_event.marine; - var _unit=fetch_unit([marine_num,comp]); - var item=_event.crafted; + if (_event.e_id == "strange_building") { + var marine_name = _event.name; + var comp = _event.company; + var marine_num = _event.marine; + var _unit = fetch_unit([marine_num, comp]); + var item = _event.crafted; - var killy=0,tixt=$"{obj_ini.role[100][16]} {marine_name} has finished his work- "; + var killy = 0, tixt = $"{obj_ini.role[100][16]} {marine_name} has finished his work- "; - if (item=="Icon"){ - tixt+=$"it is a {global.chapter_name} Icon wrought in metal, finely decorated. Pride for his chapter seems to have overtaken him. There are no corrections to be made and the item is placed where many may view it."; - } - if (item=="Statue"){ - tixt+="it is a small, finely crafted statue wrought in metal. The "+string(obj_ini.role[100][16])+" is scolded for the waste of material, but none daresay the quality of the piece."; - } - if (item=="Bike"){ - scr_add_item("Bike",1); - tixt+="it is a finely crafted Bike, conforming mostly to STC standards. The other "+string(obj_ini.role[100][16])+" are surprised at the rapid pace of his work."; - } - if (item=="Rhino"){ - scr_add_vehicle("Rhino",0,{},"Storm Bolter","Storm Bolter","","Artificer Hull","Dozer Blades"); - tixt+="it is a finely crafted Rhino, conforming to STC standards. The other "+string(obj_ini.role[100][16])+" are surprised at the rapid pace of his work."; - } - if (item=="Artifact"){ - scr_event_log("",string(obj_ini.role[100][16])+" "+string(marine_name)+" constructs an Artifact."); - var _last_artifact = scr_add_artifact("random_nodemon","",0); + if (item == "Icon") { + tixt += $"it is a {global.chapter_name} Icon wrought in metal, finely decorated. Pride for his chapter seems to have overtaken him. There are no corrections to be made and the item is placed where many may view it."; + } + if (item == "Statue") { + tixt += "it is a small, finely crafted statue wrought in metal. The " + string(obj_ini.role[100][16]) + " is scolded for the waste of material, but none daresay the quality of the piece."; + } + if (item == "Bike") { + scr_add_item("Bike", 1); + tixt += "it is a finely crafted Bike, conforming mostly to STC standards. The other " + string(obj_ini.role[100][16]) + " are surprised at the rapid pace of his work."; + } + if (item == "Rhino") { + scr_add_vehicle("Rhino", 0, {}, "Storm Bolter", "Storm Bolter", "", "Artificer Hull", "Dozer Blades"); + tixt += "it is a finely crafted Rhino, conforming to STC standards. The other " + string(obj_ini.role[100][16]) + " are surprised at the rapid pace of his work."; + } + if (item == "Artifact") { + scr_event_log("", string(obj_ini.role[100][16]) + " " + string(marine_name) + " constructs an Artifact."); + var _last_artifact = scr_add_artifact("random_nodemon", "", 0); - tixt+=$"some form of divine inspiration has seemed to have taken hold of him. An artifact {obj_ini.artifact[_last_artifact]} has been crafted."; - } - if (item=="baby"){ - _unit.edit_corruption(choose(8,12,16,20)) - tixt+="some form of horrendous statue. A weird amalgram of limbs and tentacles, the sheer atrocity of it is made worse by the tiny, baby-like form, the once natural shape of a human child twisted nearly beyond recognition."; - } - else if (item=="robot"){ - _unit.edit_corruption(choose(2,4,6,8,10)); - tixt+=$"some form of small, box-like robot. It seems to teeter around haphazardly, nearly falling over with each step. {_unit.name()} maintains that it has no AI, though the other "+string(obj_ini.role[100][16])+" express skepticism."; - _unit.add_trait("tech_heretic"); - } - else if (item=="demon"){ - _unit.edit_corruption(choose(8,12,16,20)); - tixt+="some form of horrendous statue. What was meant to be some sort of angel, or primarch, instead has a mishappen face that is hardly human in nature. Between the fetid, ragged feathers and empty sockets it is truly blasphemous."; - _unit.add_trait("tech_heretic"); - } - else if (item=="fusion"){ - //TODO if tech heretic chosen don't kill the dude - // _unit.corruption+=choose(70); - tixt+=$"some kind of ill-mannered ascension. One of your battle-brothers enters the armamentarium to find {marine_name} fused to a vehicle, his flesh twisted and submerged into the frame. Mechendrites and weapons fire upon the marine without warning, a windy scream eminating from the abomination. It takes several battle-brothers to take out what was once a "+string(obj_ini.role[100][16])+"."; + tixt += $"some form of divine inspiration has seemed to have taken hold of him. An artifact {obj_ini.artifact[_last_artifact]} has been crafted."; + } + if (item == "baby") { + _unit.edit_corruption(choose(8, 12, 16, 20)); + tixt += "some form of horrendous statue. A weird amalgram of limbs and tentacles, the sheer atrocity of it is made worse by the tiny, baby-like form, the once natural shape of a human child twisted nearly beyond recognition."; + } else if (item == "robot") { + _unit.edit_corruption(choose(2, 4, 6, 8, 10)); + tixt += $"some form of small, box-like robot. It seems to teeter around haphazardly, nearly falling over with each step. {_unit.name()} maintains that it has no AI, though the other " + string(obj_ini.role[100][16]) + " express skepticism."; + _unit.add_trait("tech_heretic"); + } else if (item == "demon") { + _unit.edit_corruption(choose(8, 12, 16, 20)); + tixt += "some form of horrendous statue. What was meant to be some sort of angel, or primarch, instead has a mishappen face that is hardly human in nature. Between the fetid, ragged feathers and empty sockets it is truly blasphemous."; + _unit.add_trait("tech_heretic"); + } else if (item == "fusion") { + //TODO if tech heretic chosen don't kill the dude + // _unit.corruption+=choose(70); + tixt += $"some kind of ill-mannered ascension. One of your battle-brothers enters the armamentarium to find {marine_name} fused to a vehicle, his flesh twisted and submerged into the frame. Mechendrites and weapons fire upon the marine without warning, a windy scream eminating from the abomination. It takes several battle-brothers to take out what was once a " + string(obj_ini.role[100][16]) + "."; - // This is causing the problem + // This is causing the problem - scr_kill_unit(comp,marine_num) - with(obj_ini){scr_company_order(0);} - } - if (item != "fusion"){ - var options = [ - { - str1:"Execute the heretic", - choice_func : function(){ - scr_kill_unit(pop_data.company, pop_data.marine_number); - var company_to_order = pop_data.company; - with (obj_ini) { - scr_company_order(company_to_order); - } - popup_default_close(); - } - }, - { - str1:"Move him to the Penitorium", - choice_func : function(){ - popup_default_close(); - } - }, - { - str1 : "I see no problem", - choice_func : popup_default_close, - } - ] - var _pop_data = { - options:options, - marine_number : marine_num, - company :comp, - marine_name : marine_name, - } - } else { - _pop_data = ""; - } + scr_kill_unit(comp, marine_num); + with (obj_ini) { + scr_company_order(0); + } + } + if (item != "fusion") { + var options = [ + { + str1: "Execute the heretic", + choice_func: function() { + scr_kill_unit(pop_data.company, pop_data.marine_number); + var company_to_order = pop_data.company; + with (obj_ini) { + scr_company_order(company_to_order); + } + popup_default_close(); + }, + }, + { + str1: "Move him to the Penitorium", + choice_func: function() { + popup_default_close(); + }, + }, + { + str1: "I see no problem", + choice_func: popup_default_close, + } + ]; + var _pop_data = { + options: options, + marine_number: marine_num, + company: comp, + marine_name: marine_name, + }; + } else { + _pop_data = ""; + } - scr_popup("He Built It",tixt,"tech_build",_pop_data); - } - if (_event.duration<=0){ - array_delete(event, i ,1); - continue; - } - } - } + scr_popup("He Built It", tixt, "tech_build", _pop_data); + } + if (_event.duration <= 0) { + array_delete(event, i, 1); + continue; + } + } + } } -function handle_discovered_governor_assasinations(){ - for (var i=0;i 1){ - break; - } - if (_event.e_id != "governor_assassination"){ - continue; - } - if (_event.duration == 1 && obj_controller.faction_status[eFACTION.Imperium]!="War"){ - var _disp_hit = _event.variant == 1 ? 2 : 4; - with(obj_star){ - for (var o=1;o<=planets;o++){ - if (p_owner == eFACTION.Imperium){ - if (dispo[o]>0) and (dispo[o]<90){ - dispo[o]=max(dispo[o]-_disp_hit,0); - } - } +function handle_discovered_governor_assasinations() { + for (var i = 0; i < array_length(obj_controller.event); i++) { + var _event = obj_controller.event[i]; + if (_event.duration > 1) { + break; + } + if (_event.e_id != "governor_assassination") { + continue; + } + if (_event.duration == 1 && obj_controller.faction_status[eFACTION.Imperium] != "War") { + var _disp_hit = _event.variant == 1 ? 2 : 4; + with (obj_star) { + for (var o = 1; o <= planets; o++) { + if (p_owner == eFACTION.Imperium) { + if ((dispo[o] > 0) && (dispo[o] < 90)) { + dispo[o] = max(dispo[o] - _disp_hit, 0); + } + } } } - if (_event.variant == 1){ - alter_dispositions([ - [eFACTION.Imperium, -7], - [eFACTION.Inquisition, -10], - [eFACTION.Ecclesiarchy, -5], - ]); + if (_event.variant == 1) { + alter_dispositions([[eFACTION.Imperium, -7], [eFACTION.Inquisition, -10], [eFACTION.Ecclesiarchy, -5]]); - if (obj_controller.disposition[4]>0 && obj_controller.disposition[2]>0){ - _event.e_id = "assassination_angryish"; - } - } else if (_event.variant == 2){ - alter_disposition(eFACTION.Inquisition, -3); - if (obj_controller.disposition[4]>0&& obj_controller.disposition[2]>0){ - _event.e_id = "assassination_angry"; - } + if (obj_controller.disposition[4] > 0 && obj_controller.disposition[2] > 0) { + _event.e_id = "assassination_angryish"; + } + } else if (_event.variant == 2) { + alter_disposition(eFACTION.Inquisition, -3); + if (obj_controller.disposition[4] > 0 && obj_controller.disposition[2] > 0) { + _event.e_id = "assassination_angry"; + } } - if (obj_controller.disposition[4]<=0) or (obj_controller.disposition[2]<=0){ - obj_controller.alarm[8]=1; - } else{ - scr_audience(4,_event.e_id,0,"",0,0,_event); + if ((obj_controller.disposition[4] <= 0) || (obj_controller.disposition[2] <= 0)) { + obj_controller.alarm[8] = 1; + } else { + scr_audience(4, _event.e_id, 0, "", 0, 0, _event); } - } - } + } + } } -function strange_build_event(){ - log_message("RE: Fey Mood"); - var _search_params = {trait : ["crafter","tinkerer"], trait_any : true} - var marine_and_company = scr_random_marine("",0, _search_params); - if (marine_and_company == "none"){ - marine_and_company = scr_random_marine("",0, "none"); - } - if(marine_and_company != "none"){ - var marine = marine_and_company[0]; - var company = marine_and_company[1]; - var text=""; - var _unit = fetch_unit(marine_and_company); - var role = _unit.role(); - text = _unit.name_role(); - text+=" is taken by a strange mood and starts building!"; +function strange_build_event() { + log_message("RE: Fey Mood"); + var _search_params = { + trait: ["crafter", "tinkerer"], + trait_any: true, + }; + var marine_and_company = scr_random_marine("", 0, _search_params); + if (marine_and_company == "none") { + marine_and_company = scr_random_marine("", 0, "none"); + } + if (marine_and_company != "none") { + var marine = marine_and_company[0]; + var company = marine_and_company[1]; + var text = ""; + var _unit = fetch_unit(marine_and_company); + var role = _unit.role(); + text = _unit.name_role(); + text += " is taken by a strange mood and starts building!"; + + var crafted_object; + var craft_roll = roll_dice_chapter(1, 100, "low"); + var heritical_item = false; - - var crafted_object; - var craft_roll=roll_dice_chapter(1, 100, "low"); - var heritical_item = false; - - //this bit should be improved, idk what duke was checking for here - //TODO make craft chance reflective of crafters skill, rewards players for having skilled tech area + //this bit should be improved, idk what duke was checking for here + //TODO make craft chance reflective of crafters skill, rewards players for having skilled tech area if (scr_has_disadv("Tech-Heresy")) { - craft_roll+=20; - } - if (_unit.has_trait("tech_heretic")){ - craft_roll+=60; - } - if (scr_has_adv("Crafter")) { - if (craft_roll>80) { - craft_roll-=10; - } - if (craft_roll<60) { - craft_roll+=10; - } + craft_roll += 20; + } + if (_unit.has_trait("tech_heretic")) { + craft_roll += 60; + } + if (scr_has_adv("Crafter")) { + if (craft_roll > 80) { + craft_roll -= 10; + } + if (craft_roll < 60) { + craft_roll += 10; + } } - if (craft_roll<=50){ - crafted_object=choose("Icon","Icon","Statue"); - } - else if ((craft_roll>50) && (craft_roll<=60)) { - crafted_object=choose("Bike","Rhino"); - } - else if ((craft_roll>60) && (craft_roll<=80)) { - crafted_object="Artifact"; - } - else { - crafted_object=choose("baby","robot","demon","fusion"); - heritical_item=1; - } - + if (craft_roll <= 50) { + crafted_object = choose("Icon", "Icon", "Statue"); + } else if ((craft_roll > 50) && (craft_roll <= 60)) { + crafted_object = choose("Bike", "Rhino"); + } else if ((craft_roll > 60) && (craft_roll <= 80)) { + crafted_object = "Artifact"; + } else { + crafted_object = choose("baby", "robot", "demon", "fusion"); + heritical_item = 1; + } + + add_event({ + e_id: "strange_building", + duration: 1, + name: _unit.name(), + company: company, + marine: marine, + crafted: crafted_object, + }); + + scr_popup("Can He Build marine?!?", text, "tech_build", ""); - add_event({ - e_id : "strange_building", - duration : 1, - name : _unit.name(), - company : company, - marine : marine, - crafted : crafted_object, - }) - - scr_popup("Can He Build marine?!?",text,"tech_build",""); - - var marine_is_planetside = _unit.planet_location>0; + var marine_is_planetside = _unit.planet_location > 0; if (marine_is_planetside && heritical_item) { - var _system = star_by_name(_unit.location_string); - var _planet = _unit.planet_location; - if (_system!="none"){ - with (_system){ - p_hurssy[_planet]+=6; - p_hurssy_time[_planet]=2; - } + var _system = star_by_name(_unit.location_string); + var _planet = _unit.planet_location; + if (_system != "none") { + with (_system) { + p_hurssy[_planet] += 6; + p_hurssy_time[_planet] = 2; + } } - } - else if (!marine_is_planetside and heritical_item){ + } else if (!marine_is_planetside && heritical_item) { var _fleet = find_ships_fleet(_unit.ship_location); - if (_fleet!="none"){ - //the intended code for here was to add some sort of chaos event on the ship stashed up ready to fire in a few turns + if (_fleet != "none") { + //the intended code for here was to add some sort of chaos event on the ship stashed up ready to fire in a few turns } } return true; - } - return false; -} -function make_faction_enemy_event(){ - log_message("RE: Enemy"); - - var factions = []; - if(obj_controller.known[eFACTION.Imperium] == 1){ - array_push(factions,2); - } - if(obj_controller.known[eFACTION.Mechanicus] == 1){ - array_push(factions,3); - } - if(obj_controller.known[eFACTION.Inquisition] == 1){ - array_push(factions,4); - } - if(obj_controller.known[eFACTION.Ecclesiarchy] == 1){ - array_push(factions,5); - } - - if(array_length(factions) == 0){ - log_error("RE: Enemy, no faction could be chosen"); - exit; - } - var chosen_faction = array_random_element(factions); - - var text = "You have made an enemy within the "; - var log = "An enemy has been made within the "; - var _e_name = ""; - switch(chosen_faction) { - case 2: - _e_name="enemy_imperium"; - text += "Imperium"; - log += "Imperium"; - break; - case 3: - _e_name="enemy_mechanicus"; - text += "Mechanicus"; - log += "Mechanicus"; - break; - case 4: - _e_name="enemy_inquisition"; - text += "Inquisition"; - log += "Inquisition"; - break; - case 5: - _e_name="enemy_ecclesiarchy"; - text += "Ecclesiarchy"; - log += "Ecclesiarchy"; - break; - default: - log_error("RE: Enemy, no faction could be chosen"); - exit; - } - if (_e_name != ""){ - add_event({ - duration : irandom_range(12,96), - e_id : _e_name, - }) - alter_disposition(chosen_faction, -20) - text +="; relations with them will be soured for the forseable future."; - scr_popup("Diplomatic Incident",text,"angry",""); - scr_event_log("red",string(log)); - return true; - } - return false; + } + return false; } +function make_faction_enemy_event() { + log_message("RE: Enemy"); -function event_dispose_of_mutated_gene(){ - if (pop_data.percent_remove > 0){ - obj_controller.gene_seed -= (obj_controller.gene_seed * (pop_data.percent_remove/100)) - } - popup_default_close(); -} \ No newline at end of file + var factions = []; + if (obj_controller.known[eFACTION.Imperium] == 1) { + array_push(factions, 2); + } + if (obj_controller.known[eFACTION.Mechanicus] == 1) { + array_push(factions, 3); + } + if (obj_controller.known[eFACTION.Inquisition] == 1) { + array_push(factions, 4); + } + if (obj_controller.known[eFACTION.Ecclesiarchy] == 1) { + array_push(factions, 5); + } + + if (array_length(factions) == 0) { + log_error("RE: Enemy, no faction could be chosen"); + exit; + } + var chosen_faction = array_random_element(factions); + + var text = "You have made an enemy within the "; + var log = "An enemy has been made within the "; + var _e_name = ""; + switch (chosen_faction) { + case 2: + _e_name = "enemy_imperium"; + text += "Imperium"; + log += "Imperium"; + break; + case 3: + _e_name = "enemy_mechanicus"; + text += "Mechanicus"; + log += "Mechanicus"; + break; + case 4: + _e_name = "enemy_inquisition"; + text += "Inquisition"; + log += "Inquisition"; + break; + case 5: + _e_name = "enemy_ecclesiarchy"; + text += "Ecclesiarchy"; + log += "Ecclesiarchy"; + break; + default: + log_error("RE: Enemy, no faction could be chosen"); + exit; + } + if (_e_name != "") { + add_event({ + duration: irandom_range(12, 96), + e_id: _e_name, + }); + alter_disposition(chosen_faction, -20); + text += "; relations with them will be soured for the forseable future."; + scr_popup("Diplomatic Incident", text, "angry", ""); + scr_event_log("red", string(log)); + return true; + } + return false; +} + +function event_dispose_of_mutated_gene() { + if (pop_data.percent_remove > 0) { + obj_controller.gene_seed -= obj_controller.gene_seed * (pop_data.percent_remove / 100); + } + popup_default_close(); +} diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 6c284fd4cb..57a3f622a5 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -1,25 +1,23 @@ - - -function distribute_strength_to_fleet(strength, fleet){ - while(strength>0){ - var ship_type = choose(1,1,1,1,2,2,3); - strength-=ship_type; - if (ship_type==1){ - fleet.escort_number++; - } else if (ship_type==2){ - fleet.frigate_number++; - }else if (ship_type==3){ - fleet.capital_number++; - } - } +function distribute_strength_to_fleet(strength, fleet) { + while (strength > 0) { + var ship_type = choose(1, 1, 1, 1, 2, 2, 3); + strength -= ship_type; + if (ship_type == 1) { + fleet.escort_number++; + } else if (ship_type == 2) { + fleet.frigate_number++; + } else if (ship_type == 3) { + fleet.capital_number++; + } + } } //to be run within with scope -function set_fleet_target(targ_x, targ_y, final_target){ - action_x = targ_x; - action_y = targ_y; - target = final_target; - action_eta=floor(point_distance(x,y,targ_x,targ_y)/128)+1; +function set_fleet_target(targ_x, targ_y, final_target) { + action_x = targ_x; + action_y = targ_y; + target = final_target; + action_eta = floor(point_distance(x, y, targ_x, targ_y) / 128) + 1; } function scr_valid_fleet_target(target) { @@ -32,7 +30,7 @@ function scr_valid_fleet_target(target) { } var valid = instance_exists(target); if (valid) { - valid = (target.object_index == obj_p_fleet || target.object_index == obj_en_fleet); + valid = target.object_index == obj_p_fleet || target.object_index == obj_en_fleet; } return valid; } @@ -74,367 +72,362 @@ function fleets_next_location(fleet = "none", visited = []) { return targ_location; } - -function chase_fleet_target_set(target){ - var targ_location = fleets_next_location(target); - if (targ_location!="none"){ - action_x=targ_location.x; - action_y=targ_location.y; - action=""; - set_fleet_movement(); - } +function chase_fleet_target_set(target) { + var targ_location = fleets_next_location(target); + if (targ_location != "none") { + action_x = targ_location.x; + action_y = targ_location.y; + action = ""; + set_fleet_movement(); + } } -function fleet_intercept_time_calculate(target_intercept){ - var intercept_time = -1 - targ_location = fleets_next_location(target_intercept); - if (instance_exists(targ_location)){ - intercept_time=floor(point_distance(x,y,action_x,action_y)/action_spd)+1; - } - return intercept_time; +function fleet_intercept_time_calculate(target_intercept) { + var intercept_time = -1; + targ_location = fleets_next_location(target_intercept); + if (instance_exists(targ_location)) { + intercept_time = floor(point_distance(x, y, action_x, action_y) / action_spd) + 1; + } + return intercept_time; } - -function get_largest_player_fleet(){ - - var chosen_fleet = "none"; - if (instance_exists(obj_p_fleet)){ - with(obj_p_fleet){ - if (point_in_rectangle(x, y, 0, 0, room_width, room_height) && (point_in_rectangle(action_x, action_y, 0, 0, room_width, room_height))){ - if (chosen_fleet=="none"){ - chosen_fleet=self; - continue; - } - if (!(capital_number==0 && chosen_fleet.capital_number==0)){ - if (capital_number>chosen_fleet.capital_number){ - chosen_fleet = self; - } - } else if (!(frigate_number==0 && chosen_fleet.frigate_number==0)) { - if (frigate_number>chosen_fleet.frigate_number){ - chosen_fleet = self; - } - }else if (!(escort_number==0 && chosen_fleet.escort_number==0)) { - if (escort_number>chosen_fleet.escort_number){ - chosen_fleet = self; - } - } - } - } - } - return chosen_fleet; +function get_largest_player_fleet() { + var chosen_fleet = "none"; + if (instance_exists(obj_p_fleet)) { + with (obj_p_fleet) { + if (point_in_rectangle(x, y, 0, 0, room_width, room_height) && point_in_rectangle(action_x, action_y, 0, 0, room_width, room_height)) { + if (chosen_fleet == "none") { + chosen_fleet = self; + continue; + } + if (!(capital_number == 0 && chosen_fleet.capital_number == 0)) { + if (capital_number > chosen_fleet.capital_number) { + chosen_fleet = self; + } + } else if (!(frigate_number == 0 && chosen_fleet.frigate_number == 0)) { + if (frigate_number > chosen_fleet.frigate_number) { + chosen_fleet = self; + } + } else if (!(escort_number == 0 && chosen_fleet.escort_number == 0)) { + if (escort_number > chosen_fleet.escort_number) { + chosen_fleet = self; + } + } + } + } + } + return chosen_fleet; } -function is_orbiting(fleet = "none"){ - if (fleet == "none"){ - if (action != "") then return false; - try { - var nearest = instance_nearest(x,y,obj_star); - if (point_distance(x,y,nearest.x, nearest.y)<10 && nearest.name != ""){ - orbiting = nearest.id; - return true - } - orbiting=false; - } catch(_exception){ - return false; - } - return false; - } else{ - with (fleet){ - return is_orbiting(); - } - } +function is_orbiting(fleet = "none") { + if (fleet == "none") { + if (action != "") { + return false; + } + try { + var nearest = instance_nearest(x, y, obj_star); + if (point_distance(x, y, nearest.x, nearest.y) < 10 && nearest.name != "") { + orbiting = nearest.id; + return true; + } + orbiting = false; + } catch (_exception) { + return false; + } + return false; + } else { + with (fleet) { + return is_orbiting(); + } + } } -function set_fleet_movement(fastest_route = true, new_action="move", minimum_eta=1, maximum_eta = 1000){ - - action = ""; - - if (action==""){ - turns_static = 0; - var mine, fleet; - var connected=0,cont=0,target_dist=0; - if (fastest_route){ - mine=instance_nearest(x,y,obj_star); - var star_travel = new FastestRouteAlgorithm(x,y,action_x,action_y, self.id,is_orbiting()); - var path = star_travel.final_array_path(); - if (array_length(path)>1){ - var targ = star_by_name(path[1]); - if (targ!="none"){ - array_delete(path,0,2); - complex_route = path; - action_x = targ.x; - action_y = targ.y; - set_fleet_movement(false, new_action); - } else { - set_fleet_movement(false, new_action); - } - } else { - set_fleet_movement(false, new_action); - } - } else { - - var _target_sys = instance_nearest(action_x,action_y,obj_star); - var _target_is_sys = false; - - if (instance_exists(_target_sys)){ - _target_is_sys = point_distance(_target_sys.x, _target_sys.y, action_x, action_y)<10; - } - - mine=instance_nearest(x,y,obj_star); - - var eta = calculate_fleet_eta(x,y,action_x,action_y,action_spd,_target_is_sys,is_orbiting(),warp_able); - action_eta = eta; - if (action_eta<=0) or (owner != eFACTION.Inquisition){ - action_eta=eta; - - } else if (owner = eFACTION.Inquisition) and (action_eta<2) and (string_count("_her",trade_goods)=0){ - action_eta=2; - } - if (is_orbiting()){ - if (owner != eFACTION.Eldar && mine.storm) then action_eta+=10000; - } - - // action_x=sys.x; - // action_y=sys.y; - orbiting = false; - action=new_action; - action_eta = clamp(action_eta, minimum_eta, maximum_eta) - } - } -} +function set_fleet_movement(fastest_route = true, new_action = "move", minimum_eta = 1, maximum_eta = 1000) { + action = ""; + + if (action == "") { + turns_static = 0; + var mine, fleet; + var connected = 0, cont = 0, target_dist = 0; + if (fastest_route) { + mine = instance_nearest(x, y, obj_star); + var star_travel = new FastestRouteAlgorithm(x, y, action_x, action_y, self.id, is_orbiting()); + var path = star_travel.final_array_path(); + if (array_length(path) > 1) { + var targ = star_by_name(path[1]); + if (targ != "none") { + array_delete(path, 0, 2); + complex_route = path; + action_x = targ.x; + action_y = targ.y; + set_fleet_movement(false, new_action); + } else { + set_fleet_movement(false, new_action); + } + } else { + set_fleet_movement(false, new_action); + } + } else { + var _target_sys = instance_nearest(action_x, action_y, obj_star); + var _target_is_sys = false; + if (instance_exists(_target_sys)) { + _target_is_sys = point_distance(_target_sys.x, _target_sys.y, action_x, action_y) < 10; + } + + mine = instance_nearest(x, y, obj_star); + + var eta = calculate_fleet_eta(x, y, action_x, action_y, action_spd, _target_is_sys, is_orbiting(), warp_able); + action_eta = eta; + if ((action_eta <= 0) || (owner != eFACTION.Inquisition)) { + action_eta = eta; + } else if ((owner == eFACTION.Inquisition) && (action_eta < 2) && (string_count("_her", trade_goods) == 0)) { + action_eta = 2; + } + if (is_orbiting()) { + if (owner != eFACTION.Eldar && mine.storm) { + action_eta += 10000; + } + } + + // action_x=sys.x; + // action_y=sys.y; + orbiting = false; + action = new_action; + action_eta = clamp(action_eta, minimum_eta, maximum_eta); + } + } +} //TODO build into unit struct -function load_unit_to_fleet(fleet, unit){ - var loaded = false; - var all_ships = fleet_full_ship_array(fleet); - - for (var i=0;iobj_ini.ship_carrying[ship_ident]){ - obj_ini.ship_carrying[ship_ident]+=unit.size; - unit.planet_location=0; - unit.location_string=obj_ini.ship_location[ship_ident]; - unit.ship_location=ship_ident; - loaded=true; - break - } - } - return loaded; +function load_unit_to_fleet(fleet, unit) { + var loaded = false; + var all_ships = fleet_full_ship_array(fleet); + + for (var i = 0; i < array_length(all_ships); i++) { + var ship_ident = all_ships[i]; + if (obj_ini.ship_capacity[ship_ident] > obj_ini.ship_carrying[ship_ident]) { + obj_ini.ship_carrying[ship_ident] += unit.size; + unit.planet_location = 0; + unit.location_string = obj_ini.ship_location[ship_ident]; + unit.ship_location = ship_ident; + loaded = true; + break; + } + } + return loaded; } -function calculate_fleet_eta(xx,yy,xxx,yyy, fleet_speed,star1=true, star2=true,warp_able=false){ - var warp_lane = false; - eta = 0; - //Some duke unfinished webway stuff copied here for reference - /*for (var w = 1;w<5;w++){ + +function calculate_fleet_eta(xx, yy, xxx, yyy, fleet_speed, star1 = true, star2 = true, warp_able = false) { + var warp_lane = false; + eta = 0; + //Some duke unfinished webway stuff copied here for reference + /*for (var w = 1;w<5;w++){ if (planet_feature_bool(mine.p_feature[w], P_features.Webway)==1) then web1=1; if (planet_feature_bool(sys.p_feature[w], P_features.Webway)==1) then web2=1; }*/ - if (star1 && star2){ - star1 = instance_nearest(xx,yy, obj_star); - star2 = instance_nearest(xxx,yyy, obj_star); - warp_lane = determine_warp_join(star1.id,star2.id); - } else if (star1){ - star1 = instance_nearest(xx,yy, obj_star); - } - eta=floor(point_distance(xx,yy,xxx,yyy)/fleet_speed)+1; - if (!warp_lane) then eta*=2; - if (warp_lane && warp_able) then eta = ceil(eta/warp_lane); - if (!star2) then return eta; - - //check end location for warp storm - if (instance_exists(star2)){ - if(star2.object_index == obj_star) { - if (star2.storm){ - eta += 10000; - } - } - - } - return eta; -} + if (star1 && star2) { + star1 = instance_nearest(xx, yy, obj_star); + star2 = instance_nearest(xxx, yyy, obj_star); + warp_lane = determine_warp_join(star1.id, star2.id); + } else if (star1) { + star1 = instance_nearest(xx, yy, obj_star); + } + eta = floor(point_distance(xx, yy, xxx, yyy) / fleet_speed) + 1; + if (!warp_lane) { + eta *= 2; + } + if (warp_lane && warp_able) { + eta = ceil(eta / warp_lane); + } + if (!star2) { + return eta; + } + //check end location for warp storm + if (instance_exists(star2)) { + if (star2.object_index == obj_star) { + if (star2.storm) { + eta += 10000; + } + } + } + return eta; +} function calculate_action_speed(fleet = "none", selected = false) { - try { - if (fleet == "none") { - var capitals = 0, frigates = 0, escorts = 0, i; - var _is_player_fleet = object_index == obj_p_fleet; - if (_is_player_fleet) { - if (!selected) { - player_fleet_ship_count(); - capitals = capital_number; - frigates = frigate_number; - escorts = escort_number; - } else { - //TODO extract to a fleet selected function - var types = selected_ship_types(); - capitals = types[0]; - frigates = types[1]; - escorts = types[2]; - } - } - var fleet_speed = 128; - if (capitals > 0) { - fleet_speed = 100; - } else if (frigates > 0) { - fleet_speed = 128; - } else if (escorts > 0) { - fleet_speed = 174; - } - if (_is_player_fleet) { - if ((obj_controller.stc_ships >= 6) && (fleet_speed >= 100)) { - fleet_speed *= 1.2; - } - } - return fleet_speed; - } else { - with (fleet) { - return calculate_action_speed(, selected); - } - } - } catch (_exception) { - handle_exception(_exception); - return 200; - } + try { + if (fleet == "none") { + var capitals = 0, frigates = 0, escorts = 0, i; + var _is_player_fleet = object_index == obj_p_fleet; + if (_is_player_fleet) { + if (!selected) { + player_fleet_ship_count(); + capitals = capital_number; + frigates = frigate_number; + escorts = escort_number; + } else { + //TODO extract to a fleet selected function + var types = selected_ship_types(); + capitals = types[0]; + frigates = types[1]; + escorts = types[2]; + } + } + var fleet_speed = 128; + if (capitals > 0) { + fleet_speed = 100; + } else if (frigates > 0) { + fleet_speed = 128; + } else if (escorts > 0) { + fleet_speed = 174; + } + if (_is_player_fleet) { + if ((obj_controller.stc_ships >= 6) && (fleet_speed >= 100)) { + fleet_speed *= 1.2; + } + } + return fleet_speed; + } else { + with (fleet) { + return calculate_action_speed(, selected); + } + } + } catch (_exception) { + handle_exception(_exception); + return 200; + } } +function scr_efleet_arrive_at_trade_loc() { + //if player fleet at star or player forces trade + var chase_fleet = false; -function scr_efleet_arrive_at_trade_loc(){ - //if player fleet at star or player forces trade - var chase_fleet = false; - - var _valid_fleet = false; - var _orbit = orbiting; - var _valid_planet = false; - - var _viewer = obj_controller.location_viewer; - if (orbiting.owner < 6 && _viewer.has_troops(orbiting.name)){ - _valid_planet = true; - } - - with (obj_p_fleet){ - if (x==_orbit.x && y==_orbit.y){ - _valid_fleet = true; - break; - } - } - - //iff no forces see iffleet to chase - if (!_valid_fleet && !_valid_planet){ - var _chase_target = -1; - if (instance_exists(target) && target.object_index == obj_p_fleet){ - _chase_target = target; - } else { - target = instance_nearest(x, y,obj_p_fleet); - } - var _chase_fleet = instance_exists(target) &&(target.action!="" || point_distance(x,y,target.x,target.y)>40) && obj_ini.fleet_type != ePlayerBase.home_world; - - if (_chase_fleet){ - if (!string_count("Inqis",trade_goods)){ - - - - if (target.action!="") { - action_x=target.action_x; - action_y=target.action_y; - } - else if (target.action=="" ){ - var _targ_star = instance_nearest(target.x,target.y,obj_star); - action_x=_targ_star.x; - action_y=_targ_star.y; - } - action=""; - set_fleet_movement(); - if (owner!=eFACTION.Eldar) then obj_controller.disposition[owner]-=1; - - } - } - - //if no fleet find a valid planet with player forces - if (action == ""){ - var _player_star = nearest_star_with_ownership(x, y, 1); - if (_player_star != "none"){ - action_x = _player_star.x; - action_y = _player_star.y; - set_fleet_movement(); - } else { - var _player_presence_stars = _viewer.player_force_stars(); - if (array_length(_player_presence_stars)){ - var _nearest_index = nearest_from_array(x, y,_player_presence_stars); - var _nearest = _player_presence_stars[_nearest_index]; - action_x = _nearest.x; - action_y = _nearest.y; - set_fleet_movement(); - } - } - - } - - //if no other viable options drop off at random imperial planet - if (action==""){ - var _imp = nearest_star_with_ownership(x, y, 2); - if (_imp != "none"){ - if (x == _imp.x && y==_imp.y){ - _valid_planet = true; - } else{ - action_x = _imp.x; - action_y = _imp.y; - set_fleet_movement(); - } - } - } - } - - if (_valid_fleet|| _valid_planet){ - + var _valid_fleet = false; + var _orbit = orbiting; + var _valid_planet = false; + + var _viewer = obj_controller.location_viewer; + if (orbiting.owner < 6 && _viewer.has_troops(orbiting.name)) { + _valid_planet = true; + } + + with (obj_p_fleet) { + if (x == _orbit.x && y == _orbit.y) { + _valid_fleet = true; + break; + } + } + + //iff no forces see iffleet to chase + if (!_valid_fleet && !_valid_planet) { + var _chase_target = -1; + if (instance_exists(target) && target.object_index == obj_p_fleet) { + _chase_target = target; + } else { + target = instance_nearest(x, y, obj_p_fleet); + } + var _chase_fleet = instance_exists(target) && (target.action != "" || point_distance(x, y, target.x, target.y) > 40) && obj_ini.fleet_type != ePlayerBase.home_world; + + if (_chase_fleet) { + if (!string_count("Inqis", trade_goods)) { + if (target.action != "") { + action_x = target.action_x; + action_y = target.action_y; + } else if (target.action == "") { + var _targ_star = instance_nearest(target.x, target.y, obj_star); + action_x = _targ_star.x; + action_y = _targ_star.y; + } + action = ""; + set_fleet_movement(); + if (owner != eFACTION.Eldar) { + obj_controller.disposition[owner] -= 1; + } + } + } + + //if no fleet find a valid planet with player forces + if (action == "") { + var _player_star = nearest_star_with_ownership(x, y, 1); + if (_player_star != "none") { + action_x = _player_star.x; + action_y = _player_star.y; + set_fleet_movement(); + } else { + var _player_presence_stars = _viewer.player_force_stars(); + if (array_length(_player_presence_stars)) { + var _nearest_index = nearest_from_array(x, y, _player_presence_stars); + var _nearest = _player_presence_stars[_nearest_index]; + action_x = _nearest.x; + action_y = _nearest.y; + set_fleet_movement(); + } + } + } + + //if no other viable options drop off at random imperial planet + if (action == "") { + var _imp = nearest_star_with_ownership(x, y, 2); + if (_imp != "none") { + if (x == _imp.x && y == _imp.y) { + _valid_planet = true; + } else { + action_x = _imp.x; + action_y = _imp.y; + set_fleet_movement(); + } + } + } + } + + if (_valid_fleet || _valid_planet) { var targ; - var cur_star=nearest_star_proper(x, y); - var bleh=""; - if (owner!=eFACTION.Inquisition) - bleh=$"{obj_controller.faction[owner]} Fleet finalizes trade at {cur_star.name}."; - else{ - bleh=$"Inquisitor Ship finalizes trade at {cur_star.name}."; + var cur_star = nearest_star_proper(x, y); + var bleh = ""; + if (owner != eFACTION.Inquisition) { + bleh = $"{obj_controller.faction[owner]} Fleet finalizes trade at {cur_star.name}."; + } else { + bleh = $"Inquisitor Ship finalizes trade at {cur_star.name}."; } log_message(bleh); - scr_alert("green","trade",bleh,cur_star.x,cur_star.y); - scr_event_log("",bleh,cur_star.name); - + scr_alert("green", "trade", bleh, cur_star.x, cur_star.y); + scr_event_log("", bleh, cur_star.name); + // Drop off here - if (fleet_has_cargo("player_goods")){ - scr_trade_dep(); + if (fleet_has_cargo("player_goods")) { + scr_trade_dep(); } - - if (target!=noone){ - target=noone; + + if (target != noone) { + target = noone; } - - if (owner==eFACTION.Eldar){ - cur_star = nearest_star_with_ownership(xx,yy, eFACTION.Eldar); - if (cur_star!="none"){ - cur_star=targ.x; - cur_star=targ.y; - } + + if (owner == eFACTION.Eldar) { + cur_star = nearest_star_with_ownership(xx, yy, eFACTION.Eldar); + if (cur_star != "none") { + cur_star = targ.x; + cur_star = targ.y; + } } else { - action_x=home_x; - action_y=home_y; - set_fleet_movement(); + action_x = home_x; + action_y = home_y; + set_fleet_movement(); } - trade_goods="return"; - if (action_eta==0){ - instance_destroy(); + trade_goods = "return"; + if (action_eta == 0) { + instance_destroy(); } return true; } return false; } - /// @function scr_orbiting_fleet(faction, system) /// @description Returns the ID of a fleet orbiting the given system/star that matches the specified faction. -/// @param {any|array} faction +/// @param {any|array} faction /// The faction identifier to check against. Can be a single faction ID or an array of multiple factions. -/// @param {any} [system="none"] +/// @param {any} [system="none"] /// The system instance or star to check. If `"none"`, the function uses the calling instance's position. /// @returns {real|string} The ID of the matching fleet instance, or `"none"` if no valid fleet is found. /// @@ -452,31 +445,30 @@ function scr_efleet_arrive_at_trade_loc(){ /// ``` /// -function scr_orbiting_fleet(faction, system="none"){ - var _found_fleet = "none"; - var _faction_list = is_array(faction); - var xx = system == "none" ? x : system.x; - var yy = system == "none" ? y : system.y; - with (obj_en_fleet){ - if (x==xx && y==yy){ - var _valid = false; - if (_faction_list){ - _valid = array_contains(faction, owner); - } else { - if (owner == faction){ - _valid = true; - } - } - if (_valid && action == ""){ - _found_fleet = id; - break; - } - } - } - return _found_fleet; +function scr_orbiting_fleet(faction, system = "none") { + var _found_fleet = "none"; + var _faction_list = is_array(faction); + var xx = system == "none" ? x : system.x; + var yy = system == "none" ? y : system.y; + with (obj_en_fleet) { + if (x == xx && y == yy) { + var _valid = false; + if (_faction_list) { + _valid = array_contains(faction, owner); + } else { + if (owner == faction) { + _valid = true; + } + } + if (_valid && action == "") { + _found_fleet = id; + break; + } + } + } + return _found_fleet; } - /// @function object_distance(obj_1, obj_2) /// @description Returns the distance in pixels between two instances or objects based on their `x` and `y` coordinates. /// @param {instance} obj_1 The first object or instance. @@ -492,14 +484,13 @@ function scr_orbiting_fleet(faction, system="none"){ /// ``` /// -function object_distance(obj_1, obj_2){ - return (point_distance(obj_1.x, obj_1.y,obj_2.x, obj_2.y )) +function object_distance(obj_1, obj_2) { + return point_distance(obj_1.x, obj_1.y, obj_2.x, obj_2.y); } - /// @function scr_orbiting_player_fleet(system) /// @description Returns the ID of the nearest player fleet orbiting the given system or star. -/// @param {any} [system="none"] +/// @param {any} [system="none"] /// The system instance or identifier to check. If `"none"`, the function checks the calling star instance. /// @returns {real} The instance ID of the orbiting player fleet, or -1 if none is found. /// @@ -511,232 +502,244 @@ function object_distance(obj_1, obj_2){ /// } /// ``` /// -function scr_orbiting_player_fleet(system = "none"){ - if (system == "none" && !(is_struct(self)) && object_index == obj_star){ - var _fleet = instance_nearest(x, y, obj_p_fleet); - if (object_distance(self, _fleet) > 0){ - return -1 - } else{ - return _fleet.id; - } - } else if system != "none"{ - try{ - with (system){ - return scr_orbiting_player_fleet(); - } - } catch(_exception){ - handle_exception(_exception); - } - } - - return -1; +function scr_orbiting_player_fleet(system = "none") { + if (system == "none" && !is_struct(self) && object_index == obj_star) { + var _fleet = instance_nearest(x, y, obj_p_fleet); + if (object_distance(self, _fleet) > 0) { + return -1; + } else { + return _fleet.id; + } + } else if (system != "none") { + try { + with (system) { + return scr_orbiting_player_fleet(); + } + } catch (_exception) { + handle_exception(_exception); + } + } + return -1; } -function get_orbiting_fleets(faction,system="none"){ - var _fleets = []; - var _faction_list = is_array(faction); - var xx = system == "none" ? x : system.x; - var yy = system == "none" ? y : system.y; - with (obj_en_fleet){ - if (x=xx && y==yy){ - var _valid = false; - if (_faction_list){ - _valid = array_contains(faction, owner); - } else { - if (owner == faction){ - _valid = true; - } - } - if (_valid && action == ""){ - array_push(_fleets, id); - } - } - } - return _fleets; +function get_orbiting_fleets(faction, system = "none") { + var _fleets = []; + var _faction_list = is_array(faction); + var xx = system == "none" ? x : system.x; + var yy = system == "none" ? y : system.y; + with (obj_en_fleet) { + if (x == xx && y == yy) { + var _valid = false; + if (_faction_list) { + _valid = array_contains(faction, owner); + } else { + if (owner == faction) { + _valid = true; + } + } + if (_valid && action == "") { + array_push(_fleets, id); + } + } + } + return _fleets; } -function sector_imperial_fleet_strength(){ - obj_controller.imp_ships = 0; +function sector_imperial_fleet_strength() { + obj_controller.imp_ships = 0; var _imperial_planet_count = 0; var _mech_worlds = 0; - with(obj_en_fleet){ - if (owner==eFACTION.Imperium){ - var _imperial_fleet_defence_score = capital_number + (frigate_number/2) + (escort_number/4); + with (obj_en_fleet) { + if (owner == eFACTION.Imperium) { + var _imperial_fleet_defence_score = capital_number + (frigate_number / 2) + (escort_number / 4); obj_controller.imp_ships += _imperial_fleet_defence_score; } } - with(obj_star){ - for (var i=0;i<=planets;i++){ - var _owner_imperial = (p_owner[i] < 5 && p_owner[i] > 1); + with (obj_star) { + for (var i = 0; i <= planets; i++) { + var _owner_imperial = p_owner[i] < 5 && p_owner[i] > 1; _imperial_planet_count += _owner_imperial; } - if (owner == eFACTION.Mechanicus){ + if (owner == eFACTION.Mechanicus) { _mech_worlds++; } } - max_fleet_strength = (_imperial_planet_count/8)*(_mech_worlds*3); + max_fleet_strength = (_imperial_planet_count / 8) * (_mech_worlds * 3); } -function fleet_star_draw_offsets(){ - var coords = [0,0]; - switch(owner){ - case eFACTION.Imperium: - if (!navy){ - coords = [0,-24];// - } else { - coords = [0,24]; - } - break; - case eFACTION.Mechanicus: - coords = [0,-32];// - break; - case eFACTION.Inquisition: - coords = [0,-32];// - break; - case eFACTION.Eldar: - coords = [-24,-24];// - break; - case eFACTION.Ork: - coords = [30,0];// - break; - case eFACTION.Tau: - coords = [-24,-24];// - break; - case eFACTION.Tyranids: - coords = [0,32];// - break; - case eFACTION.Chaos: - coords = [-30,0];// - break; - case eFACTION.Necrons: - coords = [32,32];// - break; - } - return coords; + +function fleet_star_draw_offsets() { + var coords = [0, 0]; + switch (owner) { + case eFACTION.Imperium: + if (!navy) { + coords = [0, -24]; // + } else { + coords = [0, 24]; + } + break; + case eFACTION.Mechanicus: + coords = [0, -32]; // + break; + case eFACTION.Inquisition: + coords = [0, -32]; // + break; + case eFACTION.Eldar: + coords = [-24, -24]; // + break; + case eFACTION.Ork: + coords = [30, 0]; // + break; + case eFACTION.Tau: + coords = [-24, -24]; // + break; + case eFACTION.Tyranids: + coords = [0, 32]; // + break; + case eFACTION.Chaos: + coords = [-30, 0]; // + break; + case eFACTION.Necrons: + coords = [32, 32]; // + break; + } + return coords; } + //TODO further split this shite up -function fleet_arrival_logic(){ - var cur_star, sta, steh_dist, old_x, old_y; - cur_star=instance_nearest(action_x,action_y,obj_star); +function fleet_arrival_logic() { + var cur_star, sta, steh_dist, old_x, old_y; + cur_star = instance_nearest(action_x, action_y, obj_star); x = cur_star.x; y = cur_star.y; - sta=instance_nearest(action_x,action_y,obj_star); + sta = instance_nearest(action_x, action_y, obj_star); is_orbiting(); - + // cur_star.present_fleets+=1;if (owner = eFACTION.Tau) then cur_star.tau_fleets+=1; - - - if (owner == eFACTION.Mechanicus){ - if (trade_goods == "mars_spelunk1"){ - trade_goods="mars_spelunk2"; - action_x=home_x; - action_y=home_y; - action_eta=52; + + if (owner == eFACTION.Mechanicus) { + if (trade_goods == "mars_spelunk1") { + trade_goods = "mars_spelunk2"; + action_x = home_x; + action_y = home_y; + action_eta = 52; action = "move"; exit; - } else if (trade_goods == "mars_spelunk2"){ + } else if (trade_goods == "mars_spelunk2") { // Unload techmarines nao plz - scr_mission_reward("mars_spelunk",instance_nearest(home_x,home_y,obj_star),1); + scr_mission_reward("mars_spelunk", instance_nearest(home_x, home_y, obj_star), 1); instance_destroy(); } } - - + //TODO create oppertunity to purge new colonisers if they have taint and the player has garrisons or control of the planet - if (fleet_has_cargo("colonize")){ - deploy_colonisers(cur_star); + if (fleet_has_cargo("colonize")) { + deploy_colonisers(cur_star); } - - - - - if (trade_goods=="return"){ + + if (trade_goods == "return") { // with(instance_nearest(x,y,obj_star)){present_fleets-=1;} instance_destroy(); } - - - - - if (owner == eFACTION.Inquisition){ - if (fleet_has_cargo("radical_inquisitor")){ - radical_inquisitor_mission_ship_arrival(); - exit; - } - } - - - if (!navy){ - if (trade_goods=="merge"){ - if (is_orbiting()){ - var _orbit = orbiting; - var _viable_merge = false; - var _merge_fleet = false; - var _imperial_fleets = get_orbiting_fleets(eFACTION.Imperium, _orbit); - for (var i=0;i0) then cancel=true; - if (string_count("merge",trade_goods)>0) then cancel=true; - if (trade_goods="cancel_inspection") then cancel=true; - if (trade_goods="|DELETE|") then cancel=true; - if (trade_goods="return") then cancel=true; - if (string_count("_her",trade_goods)>0) then cancel=true; - if (string_count("investigate_dead",trade_goods)>0) then cancel=true; - if (string_count("spelunk",trade_goods)>0) then cancel=true; - if (fleet_has_cargo("warband")) then cancel=true; - if (fleet_has_cargo("ork_warboss")) cancel=true; - if (fleet_has_cargo("csm")) then cancel=true; - - if (!cancel && ((trade_goods!="return" && owner!=eFACTION.Tyranids && owner!=eFACTION.Chaos) && (fleet_has_cargo("player_goods")))){ - if (scr_efleet_arrive_at_trade_loc()){ - exit; - } - - } + + if (owner == eFACTION.Inquisition) { + if (fleet_has_cargo("radical_inquisitor")) { + radical_inquisitor_mission_ship_arrival(); + exit; + } } - - if (owner==eFACTION.Inquisition) and (string_count("_her",trade_goods)=0){ - if (cur_star.owner == eFACTION.Player) and (trade_goods="cancel_inspection"){ + if (!navy) { + if (trade_goods == "merge") { + if (is_orbiting()) { + var _orbit = orbiting; + var _viable_merge = false; + var _merge_fleet = false; + var _imperial_fleets = get_orbiting_fleets(eFACTION.Imperium, _orbit); + for (var i = 0; i < array_length(_imperial_fleets); i++) { + var _fleet = _imperial_fleets[i]; + if (!_fleet.navy && _fleet.id != id) { + _viable_merge = true; + _merge_fleet = _fleet; + break; + } + } + if (_viable_merge) { + merge_fleets(_merge_fleet.id, id); + exit; + } else { + trade_goods = ""; + } + } + } + + var cancel = false; + if (string_count("Inqis", trade_goods) > 0) { + cancel = true; + } + if (string_count("merge", trade_goods) > 0) { + cancel = true; + } + if (trade_goods == "cancel_inspection") { + cancel = true; + } + if (trade_goods == "|DELETE|") { + cancel = true; + } + if (trade_goods == "return") { + cancel = true; + } + if (string_count("_her", trade_goods) > 0) { + cancel = true; + } + if (string_count("investigate_dead", trade_goods) > 0) { + cancel = true; + } + if (string_count("spelunk", trade_goods) > 0) { + cancel = true; + } + if (fleet_has_cargo("warband")) { + cancel = true; + } + if (fleet_has_cargo("ork_warboss")) { + cancel = true; + } + if (fleet_has_cargo("csm")) { + cancel = true; + } + + if (!cancel && ((trade_goods != "return" && owner != eFACTION.Tyranids && owner != eFACTION.Chaos) && fleet_has_cargo("player_goods"))) { + if (scr_efleet_arrive_at_trade_loc()) { + exit; + } + } + } + + if ((owner == eFACTION.Inquisition) && (string_count("_her", trade_goods) == 0)) { + if ((cur_star.owner == eFACTION.Player) && (trade_goods == "cancel_inspection")) { instance_deactivate_object(cur_star); - repeat(choose(1,2)){ - orbiting=instance_nearest(x,y,obj_star); + repeat (choose(1, 2)) { + orbiting = instance_nearest(x, y, obj_star); instance_deactivate_object(orbiting); } - - repeat(5){ - orbiting=instance_nearest(x,y,obj_star); - if (orbiting.owner = eFACTION.Eldar) then instance_deactivate_object(orbiting); + + repeat (5) { + orbiting = instance_nearest(x, y, obj_star); + if (orbiting.owner == eFACTION.Eldar) { + instance_deactivate_object(orbiting); + } } - - orbiting=instance_nearest(x,y,obj_star); - action_x=orbiting.x; - action_y=orbiting.y; + + orbiting = instance_nearest(x, y, obj_star); + action_x = orbiting.x; + action_y = orbiting.y; set_fleet_movement(); instance_activate_object(obj_star); - trade_goods+="|DELETE|"; + trade_goods += "|DELETE|"; exit; } } - - + /*if (owner = eFACTION.Imperium) and (guardsmen>0){// 135 ; guardsmen onto planet var en_p,en_planets,land,i; i=0;en_planets=0;land=0; @@ -772,392 +775,494 @@ function fleet_arrival_logic(){ } } }*/ - - - if (owner= eFACTION.Inquisition){ - if (string_count("DELETE",trade_goods)>0) then instance_destroy(); - if (obj_controller.known[eFACTION.Inquisition]=0) then obj_controller.known[eFACTION.Inquisition]=1; - } - - else if (owner=eFACTION.Tau) { + if (owner == eFACTION.Inquisition) { + if (string_count("DELETE", trade_goods) > 0) { + instance_destroy(); + } + if (obj_controller.known[eFACTION.Inquisition] == 0) { + obj_controller.known[eFACTION.Inquisition] = 1; + } + } else if (owner == eFACTION.Tau) { + if (instance_exists(obj_p_ship)) { + var p_ship = instance_nearest(x, y, obj_p_ship); + if ((p_ship.action == "") && (point_distance(x, y, p_ship.x, p_ship.y) < 80)) { + if (obj_controller.p_known[8] == 0) { + obj_controller.p_known[8] = 1; + } + } + } + } else if (owner == eFACTION.Tyranids) { + var mess = 1, plap = instance_nearest(action_x, action_y, obj_p_fleet); - if (instance_exists(obj_p_ship)){ - var p_ship=instance_nearest(x,y,obj_p_ship); - if (p_ship.action="") and (point_distance(x,y,p_ship.x,p_ship.y)<80){ - if (obj_controller.p_known[8]=0) then obj_controller.p_known[8]=1; + if (instance_exists(plap)) { + if (point_distance(plap.x, plap.y, action_x, action_y) < 80) { + mess = 0; } } - } - else if (owner=eFACTION.Tyranids){ - var mess=1,plap=instance_nearest(action_x,action_y,obj_p_fleet); - - if (instance_exists(plap)){ - if (point_distance(plap.x,plap.y,action_x,action_y)<80) then mess=0; + if ((mess == 1) && (sta.vision != 0)) { + scr_alert("red", "owner", $"Contact has been lost with {sta.name}!", sta.x, sta.y); + scr_event_log("red", $"Contact has been lost with {sta.name}."); + sta.vision = 0; } - - if (mess=1) and (sta.vision!=0){ - scr_alert("red","owner",$"Contact has been lost with {sta.name}!",sta.x,sta.y); - scr_event_log("red",$"Contact has been lost with {sta.name}.");sta.vision=0;} } - action_x=0; - action_y=0; - - - - - - + action_x = 0; + action_y = 0; + // 135 ; fleet chase - if (string_count("Inqis",trade_goods)>0) and (string_count("fleet",trade_goods)>0) and (!string_count("_her",trade_goods)) { + if ((string_count("Inqis", trade_goods) > 0) && (string_count("fleet", trade_goods) > 0) && (!string_count("_her", trade_goods))) { inquisition_fleet_inspection_chase(); } + old_x = x; + old_y = y; + x = -100; + y = -100; + + cur_star = instance_nearest(old_x, old_y, obj_en_fleet); + var mergus = false; + + mergus = cur_star.image_index; + if (mergus < 3) { + mergus = 0; + } + if (mergus >= 3) { + mergus = 10; + } + if ((owner == eFACTION.Tau) && (mergus >= 3)) { + mergus = 0; + } + if (string_count("_her", trade_goods) == 0) { + mergus = 99; + } // was 999 - old_x=x;old_y=y; - x=-100;y=-100; - - cur_star=instance_nearest(old_x,old_y,obj_en_fleet); - var mergus=false; - - mergus=cur_star.image_index; - if (mergus<3) then mergus=0; - if (mergus>=3) then mergus=10; - if (owner = eFACTION.Tau) and (mergus>=3) then mergus=0; - if (string_count("_her",trade_goods)=0) then mergus=99;// was 999 - // Think this might be causing the crash - if (owner=eFACTION.Tau) and (sta.present_fleet[eFACTION.Imperium]+sta.present_fleet[eFACTION.Player]>=1) - and (sta.present_fleet[eFACTION.Tau]=1) and (image_index=1) and (ret=0) then mergus=15; - if (cur_star.owner=eFACTION.Tau) and (owner=eFACTION.Tau) and (ret=1) then mergus=0; - - - - - if (owner=eFACTION.Tau) and (image_index=1){ + if ((owner == eFACTION.Tau) && (sta.present_fleet[eFACTION.Imperium] + sta.present_fleet[eFACTION.Player] >= 1) && (sta.present_fleet[eFACTION.Tau] == 1) && (image_index == 1) && (ret == 0)) { + mergus = 15; + } + if ((cur_star.owner == eFACTION.Tau) && (owner == eFACTION.Tau) && (ret == 1)) { + mergus = 0; + } + + if ((owner == eFACTION.Tau) && (image_index == 1)) { // show_message("Tau||| Other Owner: "+string(cur_star.owner)+" ret: "+string(ret)+" mergus: "+string(mergus)); } - - if (owner=eFACTION.Chaos) and (fleet_has_cargo("csm")) or ( fleet_has_cargo("warband")){ - mergus=0; + + if ((owner == eFACTION.Chaos) && fleet_has_cargo("csm") || fleet_has_cargo("warband")) { + mergus = 0; } // if (cur_star.owner!=owner) then mergus=0; - - - - - if (cur_star.x=old_x) and (cur_star.y=old_y) and (cur_star.owner=self.owner) and (cur_star.action="") and (mergus=1999){// Merge the fleets - cur_star.escort_number+=self.escort_number; - cur_star.frigate_number+=self.frigate_number;// show_message("Tau fleet merging"); - cur_star.capital_number+=self.capital_number; - cur_star.guardsmen+=self.guardsmen; - - - - cur_star=instance_nearest(old_x,old_y,obj_star); + + if ((cur_star.x == old_x) && (cur_star.y == old_y) && (cur_star.owner == self.owner) && (cur_star.action == "") && (mergus == 1999)) { + // Merge the fleets + cur_star.escort_number += self.escort_number; + cur_star.frigate_number += self.frigate_number; // show_message("Tau fleet merging"); + cur_star.capital_number += self.capital_number; + cur_star.guardsmen += self.guardsmen; + + cur_star = instance_nearest(old_x, old_y, obj_star); // if (cur_star.present_fleets>=1) then cur_star.present_fleets-=1; - if (owner = eFACTION.Tau){obj_controller.tau_fleets-=1;cur_star.tau_fleets-=1;} - if (owner = eFACTION.Chaos) then obj_controller.chaos_fleets-=1; - + if (owner == eFACTION.Tau) { + obj_controller.tau_fleets -= 1; + cur_star.tau_fleets -= 1; + } + if (owner == eFACTION.Chaos) { + obj_controller.chaos_fleets -= 1; + } + instance_destroy(); - }// End merge fleets - - - - if (owner=eFACTION.Tau) and (mergus=15){ // Get the fuck out - var new_star, stue;new_star=0;stue=0;ret=1; - - - instance_activate_object(obj_star);// new_star - stue=instance_nearest(x,y,obj_star); - - - - if (image_index=1){// Start influence thing - var tau_influence; - var tau_influence_chance=irandom(100)+1; - var tau_influence_planet=irandom(stue.planets)+1; - - with (stue){ - if (p_type[tau_influence_planet]!="Dead"){ - - scr_alert("green","owner",$"Tau ship broadcasts subversive messages to {planet_numeral_name(tau_influence_planet)}.",sta.x,sta.y); - tau_influence = p_influence[tau_influence_planet][eFACTION.Tau] - - if (tau_influence_chance<=70) and (tau_influence<70){ - adjust_influence[tau_influence_planet](eFACTION.Tau, 10, tau_influence_planet); - if (p_type[tau_influence_planet]=="Forge") then adjust_influence(eFACTION.Tau, -5, tau_influence_planet); + } // End merge fleets + + if ((owner == eFACTION.Tau) && (mergus == 15)) { + // Get the fuck out + var new_star, stue; + new_star = 0; + stue = 0; + ret = 1; + + instance_activate_object(obj_star); // new_star + stue = instance_nearest(x, y, obj_star); + + if (image_index == 1) { + // Start influence thing + var tau_influence; + var tau_influence_chance = irandom(100) + 1; + var tau_influence_planet = irandom(stue.planets) + 1; + + with (stue) { + if (p_type[tau_influence_planet] != "Dead") { + scr_alert("green", "owner", $"Tau ship broadcasts subversive messages to {planet_numeral_name(tau_influence_planet)}.", sta.x, sta.y); + tau_influence = p_influence[tau_influence_planet][eFACTION.Tau]; + + if ((tau_influence_chance <= 70) && (tau_influence < 70)) { + adjust_influence[tau_influence_planet](eFACTION.Tau, 10, tau_influence_planet); + if (p_type[tau_influence_planet] == "Forge") { + adjust_influence(eFACTION.Tau, -5, tau_influence_planet); + } } - - if (tau_influence_chance<=3) and (tau_influence<70){ + + if ((tau_influence_chance <= 3) && (tau_influence < 70)) { adjust_influence(eFACTION.Tau, 30, tau_influence_planet); - if (p_type[tau_influence_planet]=="Forge") then adjust_influence(eFACTION.Tau, -25, tau_influence_planet); + if (p_type[tau_influence_planet] == "Forge") { + adjust_influence(eFACTION.Tau, -25, tau_influence_planet); + } } } } - } - - - + } + instance_deactivate_object(stue); - - with(obj_star){ - if (owner != eFACTION.Tau) then instance_deactivate_object(instance_id); + + with (obj_star) { + if (owner != eFACTION.Tau) { + instance_deactivate_object(instance_id); + } } - - var good;good=0; - - repeat(100){ + + var good; + good = 0; + + repeat (100) { var xx, yy; - if (good=0){ - xx=x+choose(random(300),random(300)*-1); - yy=y+choose(random(300),random(300)*-1); - new_star=instance_nearest(xx,yy,obj_star); - if (new_star.owner!=eFACTION.Tau) then with(new_star){instance_deactivate_object(id);} - if (new_star.owner=eFACTION.Tau) then good=1; + if (good == 0) { + xx = x + choose(random(300), random(300) * -1); + yy = y + choose(random(300), random(300) * -1); + new_star = instance_nearest(xx, yy, obj_star); + if (new_star.owner != eFACTION.Tau) { + with (new_star) { + instance_deactivate_object(id); + } + } + if (new_star.owner == eFACTION.Tau) { + good = 1; + } } } - + // show_message("Get the fuck out working?: "+string(good)); - - if (new_star.owner=eFACTION.Tau){ + + if (new_star.owner == eFACTION.Tau) { // show_message("Tau fleet actually fleeing"); - action_x=new_star.x; - action_y=new_star.y; + action_x = new_star.x; + action_y = new_star.y; set_fleet_movement(); } - + instance_activate_object(obj_star); // This appears bugged } - - - - - - - x=old_x; - y=old_y; - + + x = old_x; + y = old_y; + var _csm = fleet_has_cargo("warband"); - if (cur_star.x=old_x) and (cur_star.y=old_y) and (cur_star.owner=self.owner) and (cur_star.action="") and ((owner = eFACTION.Tau) or (owner = eFACTION.Chaos)) and (mergus=10) and (!_csm){// Move somewhere new - var stue, stue2;stue=0;stue2=0; - var goood=0; - - with(obj_star){ - if (is_dead_star()){ - instance_deactivate_object(id); - } + if ((cur_star.x == old_x) && (cur_star.y == old_y) && (cur_star.owner == self.owner) && (cur_star.action == "") && ((owner == eFACTION.Tau) || (owner == eFACTION.Chaos)) && (mergus == 10) && (!_csm)) { + // Move somewhere new + var stue, stue2; + stue = 0; + stue2 = 0; + var goood = 0; + + with (obj_star) { + if (is_dead_star()) { + instance_deactivate_object(id); + } } - stue=instance_nearest(x,y,obj_star); + stue = instance_nearest(x, y, obj_star); instance_deactivate_object(stue); - repeat(10){ - if (goood=0){ - stue2=instance_nearest(x+choose(random(400),random(400)*-1),y+choose(random(400),random(400)*-1),obj_star); - if (owner = eFACTION.Tau) and (stue2.owner = eFACTION.Tau) then goood=1; - if (owner = eFACTION.Chaos) and (stue2.owner != eFACTION.Chaos) then goood=1; - if (stue2.planets=0) then goood=0; - if (stue.present_fleet[eFACTION.Imperium]>0) or (stue.present_fleet[eFACTION.Player]>0) then goood=0; - if (stue2.planets=1) and (stue2.p_type[1]="Dead") then goood=0; + repeat (10) { + if (goood == 0) { + stue2 = instance_nearest(x + choose(random(400), random(400) * -1), y + choose(random(400), random(400) * -1), obj_star); + if ((owner == eFACTION.Tau) && (stue2.owner == eFACTION.Tau)) { + goood = 1; + } + if ((owner == eFACTION.Chaos) && (stue2.owner != eFACTION.Chaos)) { + goood = 1; + } + if (stue2.planets == 0) { + goood = 0; + } + if ((stue.present_fleet[eFACTION.Imperium] > 0) || (stue.present_fleet[eFACTION.Player] > 0)) { + goood = 0; + } + if ((stue2.planets == 1) && (stue2.p_type[1] == "Dead")) { + goood = 0; } } - action_x=stue2.x; - action_y=stue2.y; - set_fleet_movement();// stue.present_fleets-=1; + } + action_x = stue2.x; + action_y = stue2.y; + set_fleet_movement(); // stue.present_fleets-=1; instance_activate_object(obj_star); } - - + // ORKS // Right here check to see if the fleet is being useless // If yes check for connected planet, see if not owned by orks // If not owned by orks then start heading that way // If the connected planet is owned by orks then choose a random one within 400 not owned by orks - - - if (owner == eFACTION.Ork){ - if (is_orbiting()){ - with (orbiting){ - ork_fleet_arrive_target(); - } - } - - var kay=0,temp5=0,temp6=0,temp7=0; - - var cur_star=instance_nearest(x,y,obj_star); - - + + if (owner == eFACTION.Ork) { + if (is_orbiting()) { + with (orbiting) { + ork_fleet_arrive_target(); + } + } + + var kay = 0, temp5 = 0, temp6 = 0, temp7 = 0; + + var cur_star = instance_nearest(x, y, obj_star); + // This is the new check to go along code; if doesn't add up to all planets = 7 then they exit - if (!is_dead_star(cur_star)){// KILL the enemy - if (cur_star.present_fleet[1]>1) or (cur_star.present_fleet[2]>1) then exit; + if (!is_dead_star(cur_star)) { + // KILL the enemy + if ((cur_star.present_fleet[1] > 1) || (cur_star.present_fleet[2] > 1)) { + exit; + } } - - if ((cur_star.owner = eFACTION.Chaos) and (image_index>=5) and (owner = eFACTION.Chaos)) or ((owner = eFACTION.Chaos) and (image_index>=5) and (cur_star.planets=0)){ - kay=50; + + if (((cur_star.owner == eFACTION.Chaos) && (image_index >= 5) && (owner == eFACTION.Chaos)) || ((owner == eFACTION.Chaos) && (image_index >= 5) && (cur_star.planets == 0))) { + kay = 50; } - if (kay=50){ - - if (owner = eFACTION.Ork) then with(obj_star){if (owner = eFACTION.Ork) then instance_deactivate_object(instance_id);} - - repeat(20){ - if (kay=50){ - temp5=x+choose(random(300),random(300)*-1); - temp6=y+choose(random(300),random(300)*-1); - temp7=instance_nearest(temp5,temp6,obj_star); - - if (owner = eFACTION.Ork) and (temp7.owner != eFACTION.Ork) and (temp7.planets>0) and (temp7.image_alpha>=1) then kay=55; - if (owner = eFACTION.Tau) and (temp7.owner != eFACTION.Tau) and (temp7.planets>0) and (temp7.image_alpha>=1) then kay=55; - if (owner = eFACTION.Chaos) and (temp7.owner != eFACTION.Chaos) and (temp7.planets>0) and (temp7.image_alpha>=1) then kay=55; + if (kay == 50) { + if (owner == eFACTION.Ork) { + with (obj_star) { + if (owner == eFACTION.Ork) { + instance_deactivate_object(instance_id); + } } } - - if (kay=55) and (instance_exists(temp7)){ - action_x=temp7.x; - action_y=temp7.y; + + repeat (20) { + if (kay == 50) { + temp5 = x + choose(random(300), random(300) * -1); + temp6 = y + choose(random(300), random(300) * -1); + temp7 = instance_nearest(temp5, temp6, obj_star); + + if ((owner == eFACTION.Ork) && (temp7.owner != eFACTION.Ork) && (temp7.planets > 0) && (temp7.image_alpha >= 1)) { + kay = 55; + } + if ((owner == eFACTION.Tau) && (temp7.owner != eFACTION.Tau) && (temp7.planets > 0) && (temp7.image_alpha >= 1)) { + kay = 55; + } + if ((owner == eFACTION.Chaos) && (temp7.owner != eFACTION.Chaos) && (temp7.planets > 0) && (temp7.image_alpha >= 1)) { + kay = 55; + } + } + } + + if ((kay == 55) && instance_exists(temp7)) { + action_x = temp7.x; + action_y = temp7.y; set_fleet_movement(); - + // cur_star.present_fleets-=1; } - + instance_activate_object(obj_star); } else { - cur_star.present_fleet[eFACTION.Ork]++; + cur_star.present_fleet[eFACTION.Ork]++; } - instance_activate_object(obj_star); - } - exit;// end of eta=0 + exit; // end of eta=0 } -function choose_fleet_sprite_image(){ - if (owner = eFACTION.Imperium && !fleet_has_cargo("colonize")){ - sprite_index=spr_fleet_imperial; +function choose_fleet_sprite_image() { + if (owner == eFACTION.Imperium && !fleet_has_cargo("colonize")) { + sprite_index = spr_fleet_imperial; + } else if (owner == eFACTION.Imperium && fleet_has_cargo("colonize")) { + sprite_index = spr_fleet_civilian; + } else if (owner == eFACTION.Mechanicus) { + sprite_index = spr_fleet_mechanicus; + } else if ((owner == eFACTION.Inquisition) && (string_count("_fleet", trade_goods) > 0) && (target > 0)) { + target = instance_nearest(target_x, target_y, obj_p_fleet); + } else if (owner == eFACTION.Inquisition) { + sprite_index = spr_fleet_inquisition; + } else if (owner == eFACTION.Eldar) { + sprite_index = spr_fleet_eldar; + } else if (owner == eFACTION.Ork) { + sprite_index = spr_fleet_ork; + } else if (owner == eFACTION.Tau) { + sprite_index = spr_fleet_tau; + } else if (owner == eFACTION.Tyranids) { + sprite_index = spr_fleet_tyranid; + } else if (owner == eFACTION.Chaos) { + sprite_index = spr_fleet_chaos; } - else if (owner = eFACTION.Imperium && fleet_has_cargo("colonize")){ - sprite_index=spr_fleet_civilian; - } - else if (owner == eFACTION.Mechanicus) { sprite_index=spr_fleet_mechanicus;} - else if (owner == eFACTION.Inquisition) && (string_count("_fleet",trade_goods)>0) and (target>0){ - target=instance_nearest(target_x,target_y,obj_p_fleet); - } - else if (owner == eFACTION.Inquisition) { sprite_index=spr_fleet_inquisition;} - else if (owner == eFACTION.Eldar) { sprite_index=spr_fleet_eldar;} - else if (owner == eFACTION.Ork) { sprite_index=spr_fleet_ork;} - else if (owner == eFACTION.Tau) { sprite_index=spr_fleet_tau;} - else if (owner == eFACTION.Tyranids) { sprite_index=spr_fleet_tyranid;} - else if (owner == eFACTION.Chaos) { sprite_index=spr_fleet_chaos;} - image_speed=0; + image_speed = 0; } +function merge_fleets(main_fleet, merge_fleet) { + main_fleet.capital_number += merge_fleet.capital_number; + main_fleet.frigate_number += merge_fleet.frigate_number; + main_fleet.escort_number += merge_fleet.escort_number; + var _merge_cargo = struct_get_names(merge_fleet.cargo_data); + //TODO custom merge stuff + for (var i = 0; i < array_length(_merge_cargo); i++) { + if (!struct_exists(main_fleet.cargo_data, _merge_cargo[i])) { + main_fleet.cargo_data[$ _merge_cargo[i]] = merge_fleet.cargo_data[$ _merge_cargo[i]]; + } + } + instance_destroy(merge_fleet.id); +} +function fleet_respond_crusade() { + if (owner != eFACTION.Imperium) { + exit; + } + if (!navy) { + exit; + } + if (orbiting.owner > eFACTION.Ecclesiarchy) { + exit; + } + if (trade_goods != "") { + exit; + } + if (action != "") { + exit; + } + if (guardsmen_unloaded > 0) { + exit; + } -function merge_fleets(main_fleet, merge_fleet){ - main_fleet.capital_number += merge_fleet.capital_number; - main_fleet.frigate_number += merge_fleet.frigate_number; - main_fleet.escort_number += merge_fleet.escort_number; - var _merge_cargo = struct_get_names(merge_fleet.cargo_data); - //TODO custom merge stuff - for (var i=0;i eFACTION.Ecclesiarchy) then exit; - if (trade_goods!="") then exit; - if (action!="") then exit; - if (guardsmen_unloaded>0) then exit; - - // Crusade AI - obj_controller.temp[88]=owner; - with(obj_crusade){ - if (owner!=obj_controller.temp[88]){ - y-=20000; - } - } - - var enemu; - //var cs - with(obj_star) { - var cs = instance_nearest(x,y,obj_crusade); - - if (point_distance(x,y,cs.x,cs.y)>cs.radius) { - y-=20000; - } - enemu=0; - - var nids = array_reduce(p_tyranids, function(prev, curr) { - return prev || curr > 3 - }, false); - - var tau = array_reduce(p_tau, function(prev, curr) { - return prev || curr > 0; - }, false); - - - enemu += nids + tau - - if (present_fleet[eFACTION.Eldar]>0) then enemu+=2; - if (present_fleet[eFACTION.Ork]>0) then enemu+=2; - if (present_fleet[eFACTION.Tau]>0) then enemu+=2; - if (present_fleet[eFACTION.Tyranids]>0) then enemu+=2; - if (present_fleet[eFACTION.Chaos]>0) then enemu+=2; - //nothing for heritics faction - if (present_fleet[eFACTION.Necrons]>0) then enemu+=2; + var enemu; + //var cs + with (obj_star) { + var cs = instance_nearest(x, y, obj_crusade); + if (point_distance(x, y, cs.x, cs.y) > cs.radius) { + y -= 20000; + } + enemu = 0; + + var nids = array_reduce( + p_tyranids, + function(prev, curr) { + return prev || curr > 3; + }, + false + ); + + var tau = array_reduce( + p_tau, + function(prev, curr) { + return prev || curr > 0; + }, + false + ); + + enemu += nids + tau; + + if (present_fleet[eFACTION.Eldar] > 0) { + enemu += 2; + } + if (present_fleet[eFACTION.Ork] > 0) { + enemu += 2; + } + if (present_fleet[eFACTION.Tau] > 0) { + enemu += 2; + } + if (present_fleet[eFACTION.Tyranids] > 0) { + enemu += 2; + } + if (present_fleet[eFACTION.Chaos] > 0) { + enemu += 2; + } + //nothing for heritics faction + if (present_fleet[eFACTION.Necrons] > 0) { + enemu += 2; + } + } + var ns = instance_nearest(x, y, obj_star); + var ok = false; + var max_dist = 800; + var min_dist = 40; + var to_ignore = [eFACTION.Imperium, eFACTION.Mechanicus, eFACTION.Inquisition, eFACTION.Ecclesiarchy]; + + var dist = point_distance(x, y, ns.x, ns.y); + var valid_target = !array_contains_ext(ns.p_owner, to_ignore, false); + if (valid_target && dist <= max_dist && dist >= min_dist && (owner == eFACTION.Imperium)) { + ok = true; } - var ns = instance_nearest(x,y,obj_star); - var ok=false; - var max_dist = 800; - var min_dist = 40; - var to_ignore = [eFACTION.Imperium, eFACTION.Mechanicus,eFACTION.Inquisition, eFACTION.Ecclesiarchy]; - - var dist = point_distance(x,y,ns.x,ns.y) - var valid_target = !array_contains_ext(ns.p_owner, to_ignore, false) - if valid_target and dist <= max_dist and dist >= min_dist and (owner = eFACTION.Imperium) - then ok = true; // if ((ns.owner>5) or (ns.owner = eFACTION.Player)) and (point_distance(x,y,ns.x,ns.y)<=max_dis) and (point_distance(x,y,ns.x,ns.y)>40) and (owner = eFACTION.Imperium){ - if (ok){ - action_x=ns.x; - action_y=ns.y; - set_fleet_movement(); - orbiting.present_fleet[owner]-=1; - home_x=orbiting.x; - home_y=orbiting.y; - + if (ok) { + action_x = ns.x; + action_y = ns.y; + set_fleet_movement(); + orbiting.present_fleet[owner] -= 1; + home_x = orbiting.x; + home_y = orbiting.y; + var i; - i=0; - repeat(orbiting.planets){ - i+=1; - if (orbiting.p_owner[i]=eFACTION.Imperium) and (orbiting.p_guardsmen[i]>500) { - guardsmen +=round(orbiting.p_guardsmen[i]/2); - orbiting.p_guardsmen[i]=round(orbiting.p_guardsmen[i]/2);} + i = 0; + repeat (orbiting.planets) { + i += 1; + if ((orbiting.p_owner[i] == eFACTION.Imperium) && (orbiting.p_guardsmen[i] > 500)) { + guardsmen += round(orbiting.p_guardsmen[i] / 2); + orbiting.p_guardsmen[i] = round(orbiting.p_guardsmen[i] / 2); + } + } + + alarm[5] = 2; + + with (obj_crusade) { + if (y < -10000) { + y += 20000; + } + } + with (obj_crusade) { + if (y < -10000) { + y += 20000; + } + } + with (obj_star) { + if (y < -10000) { + y += 20000; + } + } + with (obj_star) { + if (y < -10000) { + y += 20000; + } } - alarm[5]=2; - - with(obj_crusade){if (y<-10000) then y+=20000;} - with(obj_crusade){if (y<-10000) then y+=20000;} - with(obj_star){if (y<-10000) then y+=20000;} - with(obj_star){if (y<-10000) then y+=20000;} - exit; } - - with(obj_crusade){if (y<-10000) then y+=20000;} - with(obj_crusade){if (y<-10000) then y+=20000;} - with(obj_star){if (y<-10000) then y+=20000;} - with(obj_star){if (y<-10000) then y+=20000;} + + with (obj_crusade) { + if (y < -10000) { + y += 20000; + } + } + with (obj_crusade) { + if (y < -10000) { + y += 20000; + } + } + with (obj_star) { + if (y < -10000) { + y += 20000; + } + } + with (obj_star) { + if (y < -10000) { + y += 20000; + } + } } diff --git a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml index cb8caf3b9e..03ce9f8748 100644 --- a/scripts/scr_forge_world_functions/scr_forge_world_functions.gml +++ b/scripts/scr_forge_world_functions/scr_forge_world_functions.gml @@ -1,176 +1,175 @@ // Script assets have changed for v2.3.0 see // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information -function imperial_navy_fleet_construction(){ - // ** Check number of navy fleets ** +function imperial_navy_fleet_construction() { + // ** Check number of navy fleets ** - var new_navy_fleets = []; - with(obj_en_fleet){ - if (owner==eFACTION.Imperium) and (navy==1) { - array_push(new_navy_fleets, id); - } - } - //delete navy fleets if more than required - var navy_fleet_count = array_length(new_navy_fleets); - var cur_fleet; - if (navy_fleet_count>target_navy_number) { - for (var i=0;i target_navy_number) { + for (var i = 0; i < navy_fleet_count; i++) { + cur_fleet = new_navy_fleets[i]; + if (cur_fleet.guardsmen_unloaded) { + continue; + } else { + instance_destroy(cur_fleet); + navy_fleet_count--; + array_delete(new_navy_fleets, i, 1); + i--; + if (navy_fleet_count <= target_navy_number) { + break; + } + } + } + + //if system needs more navy fleets get forge world to make some + } else if (navy_fleet_count < target_navy_number) { + var forge_systems = []; + with (obj_star) { + var good = false; + for (var o = 1; o <= planets; o++) { + if ((p_type[o] == "Forge") && (p_owner[o] == eFACTION.Mechanicus) && (p_orks[o] + p_tau[o] + p_tyranids[o] + p_chaos[o] + p_traitors[o] + p_necrons[o] == 0)) { + var enemy_fleets = [eFACTION.Ork, eFACTION.Tau, eFACTION.Tyranids, eFACTION.Chaos, eFACTION.Necrons]; - //if system needs more navy fleets get forge world to make some - } else if (navy_fleet_count 1); - _imperial_planet_count += _owner_imperial; - if (p_type[i] == "Forge") then continue; - //probably abstract else where this could also be useful for - if (_owner_imperial){ - var _imperial_value = 0; - static planet_types_value = { - "Dead": 0, - "Ice" : 1, - "Temperate": 4, - "Feudal" : 3, - "Shrine" : 5, - "Agri" : 5, - "Death" : 2, - "Hive" : 5, - "Forge" : 7, - "Desert" : 2, - "Lava" : 2, - } - if (struct_exists(planet_types_value, p_type[i])){ - _imperial_value = planet_types_value[$ p_type[i]] + p_fortified[i]; - _system_value += _imperial_value; - } - } - } - if (struct_exists(_defence_fleet_log, name)){ - _system_value -= (_defence_fleet_log[$ name]*2); + for (var i = 0; i <= planets; i++) { + var _owner_imperial = p_owner[i] < 5 && p_owner[i] > 1; + _imperial_planet_count += _owner_imperial; + if (p_type[i] == "Forge") { + continue; + } + //probably abstract else where this could also be useful for + if (_owner_imperial) { + var _imperial_value = 0; + static planet_types_value = { + "Dead": 0, + "Ice": 1, + "Temperate": 4, + "Feudal": 3, + "Shrine": 5, + "Agri": 5, + "Death": 2, + "Hive": 5, + "Forge": 7, + "Desert": 2, + "Lava": 2, + }; + if (struct_exists(planet_types_value, p_type[i])) { + _imperial_value = planet_types_value[$ p_type[i]] + p_fortified[i]; + _system_value += _imperial_value; + } + } } - if (_system_value){ - if (array_length(_value_hierarchy) == 0){ - array_push(_value_hierarchy, [id, _system_value]); - } else { - for (var i=0;i_value_hierarchy[i][1]){ - array_insert(_value_hierarchy, i, [id, _system_value]); - break; - } - } - } + if (struct_exists(_defence_fleet_log, name)) { + _system_value -= _defence_fleet_log[$ name] * 2; + } + if (_system_value) { + if (array_length(_value_hierarchy) == 0) { + array_push(_value_hierarchy, [id, _system_value]); + } else { + for (var i = 0; i < array_length(_value_hierarchy); i++) { + if (_system_value > _value_hierarchy[i][1]) { + array_insert(_value_hierarchy, i, [id, _system_value]); + break; + } + } + } } //unknown function of temp5 same as temp6 but for mechanicus worlds - if (space_hulk || craftworld){ - instance_deactivate_object(id) + if (space_hulk || craftworld) { + instance_deactivate_object(id); } } // Former: var sha;sha=instance_number(obj_temp6)*1.3; var mechanicus_world_total = array_length(_mechanicus_worlds); - max_fleet_strength =(_imperial_planet_count/8)*(mechanicus_world_total*3);// new + max_fleet_strength = (_imperial_planet_count / 8) * (mechanicus_world_total * 3); // new - /*in order for new ships to spawn the number of total imperial ships must be smaller than + /*in order for new ships to spawn the number of total imperial ships must be smaller than one third of the total imperial star systems*/ - if (mechanicus_world_total>0 && imp_ships(12)*mechanicus_world_total){ - instance_activate_object(obj_star); - scr_alert("", "forge_world", "No new imperial defence ships built this month"); - return "no new imperial defence ships built this month"; - } - var forge=array_random_element(_mechanicus_worlds); - var _current_imperial_fleet = scr_orbiting_fleet(eFACTION.Imperium,forge); + if (mechanicus_world_total > 0 && imp_ships < max_fleet_strength) { + var rando = roll_dice(1, 100), rando2 = choose(1, 2, 2, 3, 3, 3); + if (rando > 12 * mechanicus_world_total) { + instance_activate_object(obj_star); + scr_alert("", "forge_world", "No new imperial defence ships built this month"); + return "no new imperial defence ships built this month"; + } + var forge = array_random_element(_mechanicus_worlds); + var _current_imperial_fleet = scr_orbiting_fleet(eFACTION.Imperium, forge); var _defence_fleet = false; - if (_current_imperial_fleet != "none"){ - if (!_current_imperial_fleet.navy){ - _defence_fleet = true; - } + if (_current_imperial_fleet != "none") { + if (!_current_imperial_fleet.navy) { + _defence_fleet = true; + } } else { - var _current_imperial_fleet = instance_create(forge.x,forge.y,obj_en_fleet); - _defence_fleet = true; - with (_current_imperial_fleet){ - navy = false - owner = eFACTION.Imperium; - choose_fleet_sprite_image(); - } + var _current_imperial_fleet = instance_create(forge.x, forge.y, obj_en_fleet); + _defence_fleet = true; + with (_current_imperial_fleet) { + navy = false; + owner = eFACTION.Imperium; + choose_fleet_sprite_image(); + } } - if (_defence_fleet && array_length(_value_hierarchy)){ - _current_imperial_fleet.trade_goods = "merge"; - switch(rando2){ + if (_defence_fleet && array_length(_value_hierarchy)) { + _current_imperial_fleet.trade_goods = "merge"; + switch (rando2) { case 1: _current_imperial_fleet.capital_number++; break; @@ -179,41 +178,34 @@ function build_planet_defence_fleets(){ break; case 3: _current_imperial_fleet.escort_number++; - break; - } - var _thirds = ceil(array_length(_value_hierarchy)/3); - var _nearest = false; - var _distance = 10000000; - for (var i=0;i<_thirds;i++){ - var _sys = _value_hierarchy[i]; - var _sys_distance = point_distance(forge.x, forge.y, _sys[0].x,_sys[0].y); - if (_sys_distance<_distance){ - _nearest = _sys[0].id; - _distance = _sys_distance; - } - } - - if (instance_exists(_nearest)){ - _current_imperial_fleet.action_x=_nearest.x; - _current_imperial_fleet.action_y=_nearest.y; - with (_current_imperial_fleet){ + break; + } + var _thirds = ceil(array_length(_value_hierarchy) / 3); + var _nearest = false; + var _distance = 10000000; + for (var i = 0; i < _thirds; i++) { + var _sys = _value_hierarchy[i]; + var _sys_distance = point_distance(forge.x, forge.y, _sys[0].x, _sys[0].y); + if (_sys_distance < _distance) { + _nearest = _sys[0].id; + _distance = _sys_distance; + } + } + + if (instance_exists(_nearest)) { + _current_imperial_fleet.action_x = _nearest.x; + _current_imperial_fleet.action_y = _nearest.y; + with (_current_imperial_fleet) { set_fleet_movement(); } instance_activate_object(obj_star); scr_alert("", "forge_world", $"New imperial defence ship sets off for {_nearest.name} from {forge.name}"); return $"New imperial defence ships set off for {_nearest.name} from {forge.name}"; - } + } } - + //the less mechanicus forge worlds the less likely to spawn a new fleet } instance_activate_object(obj_star); } - - - - - - - diff --git a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml index 47c4b41318..0ea5c1a204 100644 --- a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml +++ b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml @@ -1,648 +1,673 @@ // Script assets have changed for v2.3.0 see // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more informationype -function init_player_fleet_arrays(){ - ship=[]; - ship_uid=[]; - ship_owner=[]; - ship_class=[]; - ship_size=[]; - ship_leadership=[]; - ship_hp=[]; - ship_maxhp=[]; - - ship_location=[]; - ship_shields=[]; - ship_conditions=[]; - ship_speed=[]; - ship_turning=[]; - - ship_front_armour=[]; - ship_other_armour=[]; - ship_weapons=[]; - - ship_wep = array_create(6, ""); - ship_wep_facing=array_create(6, ""); - ship_wep_condition=array_create(6, ""); - - ship_capacity=[]; - ship_carrying=[]; - ship_contents=[]; - ship_turrets=[]; - ship_lost = []; +function init_player_fleet_arrays() { + ship = []; + ship_uid = []; + ship_owner = []; + ship_class = []; + ship_size = []; + ship_leadership = []; + ship_hp = []; + ship_maxhp = []; + + ship_location = []; + ship_shields = []; + ship_conditions = []; + ship_speed = []; + ship_turning = []; + + ship_front_armour = []; + ship_other_armour = []; + ship_weapons = []; + + ship_wep = array_create(6, ""); + ship_wep_facing = array_create(6, ""); + ship_wep_condition = array_create(6, ""); + + ship_capacity = []; + ship_carrying = []; + ship_contents = []; + ship_turrets = []; + ship_lost = []; } -function fleet_has_roles(fleet="none", roles){ - var all_ships = fleet_full_ship_array(fleet); - var unit; - for (var i=0;i<=10;i++){ - for (var s=0;s0){ - var target_planet = star_by_name(target_array[0]); - var nearest_planet = instance_nearest(x,y,obj_star); - var from_star = point_distance(nearest_planet.x,nearest_planet.y, x, y) <75; - var valid = target_planet!="none"; - if (valid){ - valid = !(target_planet.id == nearest_planet.id && from_star); - } - if (!valid){ - if (array_length(target_array)>1){ - target_planet = star_by_name(target_array[1]); - array_delete(target_array, 0, 2); - } else { - return "complex_route_finish"; - } - } else { - array_delete(target_array, 0, 1); - } - complex_route = target_array; - var from_x = from_star ? nearest_planet.x : x; - var from_y = from_star ? nearest_planet.y : y; - action_eta=calculate_fleet_eta(from_x,from_y,target_planet.x,target_planet.y, action_spd, from_star, ,warp_able); - action_x = target_planet.x; - action_y = target_planet.y; - action="move"; - just_left=true; - orbiting=0; - x=x+lengthdir_x(48,point_direction(x,y,action_x,action_y)); - y=y+lengthdir_y(48,point_direction(x,y,action_x,action_y)); +function set_new_player_fleet_course(target_array) { + if (array_length(target_array) > 0) { + var target_planet = star_by_name(target_array[0]); + var nearest_planet = instance_nearest(x, y, obj_star); + var from_star = point_distance(nearest_planet.x, nearest_planet.y, x, y) < 75; + var valid = target_planet != "none"; + if (valid) { + valid = !(target_planet.id == nearest_planet.id && from_star); + } + if (!valid) { + if (array_length(target_array) > 1) { + target_planet = star_by_name(target_array[1]); + array_delete(target_array, 0, 2); + } else { + return "complex_route_finish"; + } + } else { + array_delete(target_array, 0, 1); + } + complex_route = target_array; + var from_x = from_star ? nearest_planet.x : x; + var from_y = from_star ? nearest_planet.y : y; + action_eta = calculate_fleet_eta(from_x, from_y, target_planet.x, target_planet.y, action_spd, from_star,, warp_able); + action_x = target_planet.x; + action_y = target_planet.y; + action = "move"; + just_left = true; + orbiting = 0; + x = x + lengthdir_x(48, point_direction(x, y, action_x, action_y)); + y = y + lengthdir_y(48, point_direction(x, y, action_x, action_y)); set_fleet_location("Warp"); - } - + } } -function find_and_move_ship_between_fleets(out_fleet, in_fleet, index){ - var _class = player_ships_class(index); - var relative_index = -1; - switch (_class){ - case "capital": - relative_index = array_get_index(out_fleet.capital_num, index); - break; - case "frigate": - relative_index = array_get_index(out_fleet.frigate_num, index); - break; - case "escort": - relative_index = array_get_index(out_fleet.escort_num, index); - break; - } - if (relative_index!=-1){ - move_ship_between_player_fleets(out_fleet, in_fleet, _class, relative_index); - } +function find_and_move_ship_between_fleets(out_fleet, in_fleet, index) { + var _class = player_ships_class(index); + var relative_index = -1; + switch (_class) { + case "capital": + relative_index = array_get_index(out_fleet.capital_num, index); + break; + case "frigate": + relative_index = array_get_index(out_fleet.frigate_num, index); + break; + case "escort": + relative_index = array_get_index(out_fleet.escort_num, index); + break; + } + if (relative_index != -1) { + move_ship_between_player_fleets(out_fleet, in_fleet, _class, relative_index); + } } -function merge_player_fleets(main_fleet, merge_fleet){ - var _merge_ships = fleet_full_ship_array(merge_fleet); - for (var i=0;i0) and (en_strength>0){ - ratio=(en_strength/p_strength)*100; - } - - var esc_lost=0,frig_lost=0,cap_lost=0,which=0,sayd=0; - - i=-1;// var ship_lost,i; - var ship_lost = []; - - if (scr_has_adv("Kings of Space")) then _roll_100-=10; - if (_roll_100<=80) and (p_strength<=2) then _roll_100=-5; - - if (_roll_100!=-5){ - repeat(50){ - diceh=roll_dice_chapter(1, 100, "high"); - if (diceh<=ratio){ - ratio-=100; - var onceh=0; - - if (mfleet.escort_number>0) { - which=array_random_index(mfleet.escort_num); - sayd=mfleet.escort_num[which]; - if (!array_contains(ship_lost, sayd)){ - esc_lost+=1; - obj_ini.ship_hp[sayd]=0; - ship_lost[sayd]=1; - mfleet.escort_number-=1; - array_push(ship_lost, sayd); - } - } - else if (mfleet.frigate_number>0) { - which=array_random_index(mfleet.frigate_num); - sayd=mfleet.frigate_num[which]; - if (!array_contains(ship_lost, sayd)){ - frig_lost+=1; - obj_ini.ship_hp[sayd]=0; - ship_lost[sayd]=1; - mfleet.frigate_number-=1; - array_push(ship_lost, sayd); + + en_strength += cap_total * 4; + en_strength += frig_total * 2; + en_strength += escort_total; + + ratio = 9999; + if ((p_strength > 0) && (en_strength > 0)) { + ratio = (en_strength / p_strength) * 100; + } + + var esc_lost = 0, frig_lost = 0, cap_lost = 0, which = 0, sayd = 0; + + i = -1; // var ship_lost,i; + var ship_lost = []; + + if (scr_has_adv("Kings of Space")) { + _roll_100 -= 10; + } + if ((_roll_100 <= 80) && (p_strength <= 2)) { + _roll_100 = -5; + } + + if (_roll_100 != -5) { + repeat (50) { + diceh = roll_dice_chapter(1, 100, "high"); + if (diceh <= ratio) { + ratio -= 100; + var onceh = 0; + + if (mfleet.escort_number > 0) { + which = array_random_index(mfleet.escort_num); + sayd = mfleet.escort_num[which]; + if (!array_contains(ship_lost, sayd)) { + esc_lost += 1; + obj_ini.ship_hp[sayd] = 0; + ship_lost[sayd] = 1; + mfleet.escort_number -= 1; + array_push(ship_lost, sayd); + } + } else if (mfleet.frigate_number > 0) { + which = array_random_index(mfleet.frigate_num); + sayd = mfleet.frigate_num[which]; + if (!array_contains(ship_lost, sayd)) { + frig_lost += 1; + obj_ini.ship_hp[sayd] = 0; + ship_lost[sayd] = 1; + mfleet.frigate_number -= 1; + array_push(ship_lost, sayd); + } + } else if (mfleet.capital_number > 0) { + which = array_random_index(mfleet.capital_num); + sayd = mfleet.capital_num[which]; + if (!array_contains(ship_lost, sayd)) { + cap_lost += 1; + obj_ini.ship_hp[sayd] = 0; + ship_lost[sayd] = 1; + mfleet.capital_number -= 1; + array_push(ship_lost, sayd); + } } - } - else if (mfleet.capital_number>0) { - which=array_random_index(mfleet.capital_num); - sayd=mfleet.capital_num[which]; - if (!array_contains(ship_lost, sayd)){ - cap_lost+=1; - obj_ini.ship_hp[sayd]=0; - ship_lost[sayd]=1; - mfleet.capital_number-=1; - array_push(ship_lost, sayd); + if (!(mfleet.capital_number + mfleet.frigate_number + mfleet.escort_number)) { + break; } + // show_message("Ship lost"); } - if (!(mfleet.capital_number+mfleet.frigate_number+mfleet.escort_number)){ - break; - } - // show_message("Ship lost"); } - } - } - - obj_p_fleet.selected=0; - with(obj_fleet_select){ - instance_destroy(); - } - obj_controller.popup=0; - if (obj_controller.zoomed=1){ - with(obj_controller){ - scr_zoom(); + obj_p_fleet.selected = 0; + + with (obj_fleet_select) { + instance_destroy(); + } + obj_controller.popup = 0; + if (obj_controller.zoomed == 1) { + with (obj_controller) { + scr_zoom(); + } } - } - - type=POPUP_TYPE.BATTLE_OPTIONS; - title="Fleet Retreating"; - cooldown=15; - obj_controller.menu=0; - - // 139; - with(obj_temp_inq){instance_destroy();} - instance_create(obj_turn_end.battle_pobject[obj_turn_end.current_battle].x,obj_turn_end.battle_pobject[obj_turn_end.current_battle].y,obj_temp_inq); - with(obj_en_fleet){ - if (navy=1) and (point_distance(x,y,obj_temp_inq.x,obj_temp_inq.y)<40) and (trade_goods="player_hold") then trade_goods=""; - } - with(obj_temp_inq){instance_destroy();} - - if (esc_lost+frig_lost+cap_lost>0) and (mfleet.escort_number+mfleet.frigate_number+mfleet.capital_number>0){ - text="Your fleet is given the command to fall back. The vesels turn and prepare to enter the Warp, constantly under a hail of enemy fire. Some of your ships remain behind to draw off the attack and give the rest of your fleet a chance to escape. "; - - if (cap_lost=1) then text+=string(cap_lost)+" Battle Barge is destroyed. "; - if (frig_lost=1) then text+=string(frig_lost)+" Strike Cruiser is destroyed. "; - if (esc_lost=1) then text+=string(esc_lost)+" Escort is destroyed. "; - - if (cap_lost>1) then text+=string(cap_lost)+" Battle Barges were destroyed. "; - if (frig_lost>1) then text+=string(frig_lost)+" Strike Cruisers were destroyed. "; - if (esc_lost>1) then text+=string(esc_lost)+" Escorts were destroyed. "; - } - var text = "Your fleet is given the command to fall back. The vessels turn and prepare to enter the Warp, constantly under a hail of enemy fire. "; - if (esc_lost+frig_lost+cap_lost=0){ - text+="The entire fleet manages to escape with minimal damage."; - } - - if (mfleet.escort_number+mfleet.frigate_number+mfleet.capital_number=0){ - text+="All of your ships are destroyed attempting to flee."; - } - with (obj_p_fleet){ - scr_ini_ship_cleanup(); + type = POPUP_TYPE.BATTLE_OPTIONS; + title = "Fleet Retreating"; + cooldown = 15; + obj_controller.menu = 0; - if (player_fleet_ship_count() == 0){ + // 139; + with (obj_temp_inq) { instance_destroy(); - } else { - complex_route=[]; - } - } - with(obj_fleet_select){instance_destroy();} - - /* + } + instance_create(obj_turn_end.battle_pobject[obj_turn_end.current_battle].x, obj_turn_end.battle_pobject[obj_turn_end.current_battle].y, obj_temp_inq); + with (obj_en_fleet) { + if ((navy == 1) && (point_distance(x, y, obj_temp_inq.x, obj_temp_inq.y) < 40) && (trade_goods == "player_hold")) { + trade_goods = ""; + } + } + with (obj_temp_inq) { + instance_destroy(); + } + + if ((esc_lost + frig_lost + cap_lost > 0) && (mfleet.escort_number + mfleet.frigate_number + mfleet.capital_number > 0)) { + text = "Your fleet is given the command to fall back. The vesels turn and prepare to enter the Warp, constantly under a hail of enemy fire. Some of your ships remain behind to draw off the attack and give the rest of your fleet a chance to escape. "; + + if (cap_lost == 1) { + text += string(cap_lost) + " Battle Barge is destroyed. "; + } + if (frig_lost == 1) { + text += string(frig_lost) + " Strike Cruiser is destroyed. "; + } + if (esc_lost == 1) { + text += string(esc_lost) + " Escort is destroyed. "; + } + + if (cap_lost > 1) { + text += string(cap_lost) + " Battle Barges were destroyed. "; + } + if (frig_lost > 1) { + text += string(frig_lost) + " Strike Cruisers were destroyed. "; + } + if (esc_lost > 1) { + text += string(esc_lost) + " Escorts were destroyed. "; + } + } + var text = "Your fleet is given the command to fall back. The vessels turn and prepare to enter the Warp, constantly under a hail of enemy fire. "; + if (esc_lost + frig_lost + cap_lost == 0) { + text += "The entire fleet manages to escape with minimal damage."; + } + + if (mfleet.escort_number + mfleet.frigate_number + mfleet.capital_number == 0) { + text += "All of your ships are destroyed attempting to flee."; + } + + with (obj_p_fleet) { + scr_ini_ship_cleanup(); + + if (player_fleet_ship_count() == 0) { + instance_destroy(); + } else { + complex_route = []; + } + } + with (obj_fleet_select) { + instance_destroy(); + } + + /* with(obj_ini){scr_dead_marines(1);} with(obj_ini){scr_ini_ship_cleanup();} */ - } catch(_exception){ - handle_exception(_exception) - } + } catch (_exception) { + handle_exception(_exception); + } } -function fleet_full_ship_array(fleet="none", exclude_capitals=false, exclude_frigates = false, exclude_escorts = false){ - var all_ships = []; - var i; - var _ship_count = array_length(obj_ini.ship); - if (fleet=="none"){ - if (!exclude_capitals){ - for (i=0; i=0 && temp < array_length(obj_ini.ship_location)){ - obj_ini.ship_location[temp] = location; - } - } - var unit; - for (var co=0;co<=obj_ini.companies;co++){ - for (i=0;i= 0 && temp < array_length(obj_ini.ship_location)) { + obj_ini.ship_location[temp] = location; + } + } + var unit; + for (var co = 0; co <= obj_ini.companies; co++) { + for (i = 0; i < array_length(obj_ini.name[co]); i++) { + unit = fetch_unit([co, i]); + if (array_contains(fleet_ships, unit.ship_location)) { + unit.location_string = location; + } + } + } } -function selected_ship_types(){ - var capitals=0,frigates=0,escorts=0,i; - for (i=0; i Date: Sat, 27 Dec 2025 19:33:14 -0500 Subject: [PATCH 34/45] When you need to declare an empty instance, you should assign it the keyword 'noone' so that you are able to read through and see that it's an instance not another type of variable. --- .../scr_player_fleet_functions.gml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml index 0ea5c1a204..17d025d2e6 100644 --- a/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml +++ b/scripts/scr_player_fleet_functions/scr_player_fleet_functions.gml @@ -261,12 +261,12 @@ function find_ships_fleet(index) { return _chosen_fleet; } -function add_ship_to_fleet(index, _fleet = "none") { +function add_ship_to_fleet(index, fleet = noone) { var _escorts = ["Escort", "Hunter", "Gladius"]; var _capitals = ["Gloriana", "Battle Barge"]; var _frigates = ["Strike Cruiser"]; - if (_fleet == "none") { + if (fleet == noone) { if (array_contains(_capitals, obj_ini.ship_class[index])) { array_push(capital, obj_ini.ship[index]); array_push(capital_num, index); @@ -287,7 +287,7 @@ function add_ship_to_fleet(index, _fleet = "none") { escort_number++; } } else { - with (_fleet) { + with (fleet) { add_ship_to_fleet(index); } } @@ -473,10 +473,10 @@ function player_retreat_from_fleet_combat() { } } -function fleet_full_ship_array(fleet = "none", exclude_capitals = false, exclude_frigates = false, exclude_escorts = false) { +function fleet_full_ship_array(fleet = noone, exclude_capitals = false, exclude_frigates = false, exclude_escorts = false) { var all_ships = []; var _ship_count = array_length(obj_ini.ship); - if (fleet == "none") { + if (fleet == noone) { if (!exclude_capitals) { for (var i = 0; i < array_length(capital_num); i++) { if (capital_num[i] < _ship_count) { From c875bd6ea0827f699e9c39b4d551df72898a9d63 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 19:33:52 -0500 Subject: [PATCH 35/45] That darn overzealous linter I trust you less now o7. --- objects/obj_controller/Draw_64.gml | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/objects/obj_controller/Draw_64.gml b/objects/obj_controller/Draw_64.gml index 860f46ef23..06aa1611a7 100644 --- a/objects/obj_controller/Draw_64.gml +++ b/objects/obj_controller/Draw_64.gml @@ -77,18 +77,7 @@ if (!zoomed && !zui) { } } if (helpful_places != false) { - if ( - !instances_exist_any( - [ - obj_turn_end, - obj_ncombat, - obj_fleet, - obj_fleet_select, - obj_popup, - obj_star_select - ] - ) - ) { + if (!instances_exist_any([obj_turn_end, obj_ncombat, obj_fleet, obj_fleet_select, obj_popup, obj_star_select])) { helpful_places.draw(); } } @@ -166,16 +155,7 @@ if (!zoomed && !zui) { sector_imperial_fleet_strength(); } draw_text(850, 60, $"Sector Fleet Strength {imp_ships}/{max_fleet_strength}"); - if ( - scr_hit( - [ - 700, - 60, - 1000, - 80 - ] - ) - ) { + if (scr_hit(700, 60, 1000, 80)) { tooltip_draw("The relative strength of the imperial navy and defence fleet forces and their max supported strength. Increase The number of imperial aligned planets and active forge worlds to increase the limit"); } } // Checks if the chapter name is less than 140 chars, adjusts chapter_master_name_width accordingly From 1c0f50b879095b957406a82f57ff134d39dfd110 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sat, 27 Dec 2025 20:24:46 -0500 Subject: [PATCH 36/45] So the legacy code includes a bunch of 'compatibility functions' which according to yoyo are basically temp things to help your code transition from GM1 to GM2. We are far past that point and these can be replaced with native functions that don't scare you when you try to comprehend them. --- ...compatibility_report_040421_2234143414.txt | 30 ---------- objects/obj_en_fleet/Alarm_3.gml | 58 ++++++++++--------- objects/obj_popup/KeyPress_32.gml | 27 ++++++--- objects/obj_star/Alarm_3.gml | 4 +- scripts/instance_create/instance_create.gml | 24 ++++---- scripts/macros/macros.gml | 10 ++-- 6 files changed, 69 insertions(+), 84 deletions(-) diff --git a/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt b/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt index 5aa8d1dea6..3e85e746fc 100644 --- a/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt +++ b/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt @@ -495,12 +495,6 @@ ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\Chap ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\scripts\scr_chaos_alliance_test\scr_chaos_alliance_test.gml - 89: unexpected syntax error Too many errors - GML not processed : ${project_dir}\scripts\scr_chaos_alliance_test\scr_chaos_alliance_test.gml -Converting GML script: ${project_dir}\scripts\scr_zoom\scr_zoom.gml -Converted builtin - line 5: view_visible[0]=true -> __view_set( e__VW.Visible, 0, true ) -Converted builtin - line 5: view_visible[1]=false -> __view_set( e__VW.Visible, 1, false ) -Converted builtin - line 6: view_visible[0]=false -> __view_set( e__VW.Visible, 0, false ) -Converted builtin - line 6: view_visible[1]=true -> __view_set( e__VW.Visible, 1, true ) - Converting GML script: ${project_dir}\scripts\scr_start_load\scr_start_load.gml ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\scripts\scr_start_load\scr_start_load.gml - 272: unexpected syntax error ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\scripts\scr_start_load\scr_start_load.gml - 272: unexpected terminal operator new @@ -1060,12 +1054,6 @@ Converted builtin - line 230: view_yview[0] -> __view_get( e__VW.YView, 0 ) Converted builtin - line 231: view_yview[0] -> __view_get( e__VW.YView, 0 ) Converted builtin - line 248: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converting GML script: ${project_dir}\objects\obj_controller\KeyPress_32.gml -Converted builtin - line 33: view_visible[0]=false -> __view_set( e__VW.Visible, 0, false ) -Converted builtin - line 33: view_visible[1]=true -> __view_set( e__VW.Visible, 1, true ) -Converted builtin - line 34: view_visible[0]=true -> __view_set( e__VW.Visible, 0, true ) -Converted builtin - line 34: view_visible[1]=false -> __view_set( e__VW.Visible, 1, false ) - Converting GML script: ${project_dir}\objects\obj_mass_equip\Draw_0.gml Converted builtin - line 3: view_xview[0] -> __view_get( e__VW.XView, 0 ) Converted builtin - line 4: view_yview[0] -> __view_get( e__VW.YView, 0 ) @@ -1128,10 +1116,6 @@ Converted builtin - line 89: view_xview[0] -> __view_get( e__VW.XView, 0 ) Converted builtin - line 7: view_yview[0] -> __view_get( e__VW.YView, 0 ) Converted builtin - line 89: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converting GML script: ${project_dir}\objects\obj_p_fleet\Alarm_3.gml -Converted builtin - line 16: view_visible[0]=true -> __view_set( e__VW.Visible, 0, true ) -Converted builtin - line 16: view_visible[1]=false -> __view_set( e__VW.Visible, 1, false ) - Converting GML script: ${project_dir}\objects\obj_p_fleet\Mouse_50.gml Converted builtin - line 21: view_yview[0] -> __view_get( e__VW.YView, 0 ) Converted builtin - line 22: view_yview[0] -> __view_get( e__VW.YView, 0 ) @@ -1154,10 +1138,6 @@ Converting GML script: ${project_dir}\objects\obj_en_fleet\Alarm_4.gml Removing instance reference from builtin - line 7 : self. Converted builtin - line 7: instance_id -> instance_id_get( 0 ) -Converting GML script: ${project_dir}\objects\obj_en_fleet\Alarm_3.gml -Converted builtin - line 15: view_visible[0]=true -> __view_set( e__VW.Visible, 0, true ) -Converted builtin - line 15: view_visible[1]=false -> __view_set( e__VW.Visible, 1, false ) - Converting GML script: ${project_dir}\objects\obj_en_fleet\Alarm_1.gml ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\objects\obj_en_fleet\Alarm_1.gml - 908: unexpected syntax error ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\objects\obj_en_fleet\Alarm_1.gml - 908: unexpected terminal operator new @@ -1360,12 +1340,6 @@ Converted builtin - line 364: view_yview[0] -> __view_get( e__VW.YView, 0 ) Converted builtin - line 458: view_yview[0] -> __view_get( e__VW.YView, 0 ) Converted builtin - line 506: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converting GML script: ${project_dir}\objects\obj_popup\KeyPress_32.gml -Converted builtin - line 5: view_visible[0]=false -> __view_set( e__VW.Visible, 0, false ) -Converted builtin - line 5: view_visible[1]=true -> __view_set( e__VW.Visible, 1, true ) -Converted builtin - line 6: view_visible[0]=true -> __view_set( e__VW.Visible, 0, true ) -Converted builtin - line 6: view_visible[1]=false -> __view_set( e__VW.Visible, 1, false ) - Converting GML script: ${project_dir}\objects\obj_popup_dialogue\Step_0.gml Converted builtin - line 12: view_xview[0] -> __view_get( e__VW.XView, 0 ) Converted builtin - line 13: view_yview[0] -> __view_get( e__VW.YView, 0 ) @@ -1416,10 +1390,6 @@ Converted builtin - line 4: view_yview[0] -> __view_get( e__VW.YView, 0 ) Converting GML script: ${project_dir}\objects\obj_star\Alarm_4.gml Converted builtin - line 33: instance_id -> instance_id_get( 0 ) -Converting GML script: ${project_dir}\objects\obj_star\Alarm_3.gml -Converted builtin - line 16: view_visible[0]=true -> __view_set( e__VW.Visible, 0, true ) -Converted builtin - line 16: view_visible[1]=false -> __view_set( e__VW.Visible, 1, false ) - Converting GML script: ${project_dir}\objects\obj_star\Mouse_50.gml Converted builtin - line 17: view_yview[0] -> __view_get( e__VW.YView, 0 ) Converted builtin - line 18: view_yview[0] -> __view_get( e__VW.YView, 0 ) diff --git a/objects/obj_en_fleet/Alarm_3.gml b/objects/obj_en_fleet/Alarm_3.gml index 06089c2f8d..e13287f280 100644 --- a/objects/obj_en_fleet/Alarm_3.gml +++ b/objects/obj_en_fleet/Alarm_3.gml @@ -1,28 +1,32 @@ - if (obj_controller.zoomed=1){obj_controller.x=self.x;obj_controller.y=self.y;} - obj_controller.popup=2;// 1: fleet, 2: other fleet, 3: other - selected=1;obj_controller.fleet_minimized=0; - - - var xx=x,yy=y; - - obj_controller.selected=instance_nearest(xx,yy,obj_en_fleet); - - // obj_controller.selected=self; - obj_controller.sel_owner=self.owner; - // show_message(obj_controller.selected); - obj_controller.cooldown=8; - - if (obj_controller.zoomed=1){ - obj_controller.zoomed=0; - __view_set( e__VW.Visible, 0, true ); - __view_set( e__VW.Visible, 1, false ); - obj_cursor.image_xscale=1; - obj_cursor.image_yscale=1; - } - - // Pass variables to obj_controller.temp[t]=""; here - // Pass variables to obj_controller.temp[t]=""; here - with(obj_fleet_select){instance_destroy();} - instance_create(x,y,obj_fleet_select); - obj_fleet_select.owner=self.owner; +if (obj_controller.zoomed == 1) { + obj_controller.x = self.x; + obj_controller.y = self.y; +} +obj_controller.popup = 2; // 1: fleet, 2: other fleet, 3: other +selected = 1; +obj_controller.fleet_minimized = 0; +var xx = x, yy = y; + +obj_controller.selected = instance_nearest(xx, yy, obj_en_fleet); + +// obj_controller.selected=self; +obj_controller.sel_owner = self.owner; +// show_message(obj_controller.selected); +obj_controller.cooldown = 8; + +if (obj_controller.zoomed == 1) { + obj_controller.zoomed = 0; + view_visible[0] = false; + view_visible[1] = true; + obj_cursor.image_xscale = 1; + obj_cursor.image_yscale = 1; +} + +// Pass variables to obj_controller.temp[t]=""; here +// Pass variables to obj_controller.temp[t]=""; here +with (obj_fleet_select) { + instance_destroy(); +} +instance_create(x, y, obj_fleet_select); +obj_fleet_select.owner = self.owner; diff --git a/objects/obj_popup/KeyPress_32.gml b/objects/obj_popup/KeyPress_32.gml index 65148347ab..e1b4549fce 100644 --- a/objects/obj_popup/KeyPress_32.gml +++ b/objects/obj_popup/KeyPress_32.gml @@ -1,9 +1,20 @@ - - -if (type=99){ - var onceh;onceh=0; - if (obj_controller.zoomed=0) and (onceh=0){obj_controller.zoomed=1;onceh=1;__view_set( e__VW.Visible, 0, false );__view_set( e__VW.Visible, 1, true );obj_cursor.image_xscale=2;obj_cursor.image_yscale=2;} - if (obj_controller.zoomed=1) and (onceh=0){obj_controller.zoomed=0;onceh=1;__view_set( e__VW.Visible, 0, true );__view_set( e__VW.Visible, 1, false );obj_cursor.image_xscale=1;obj_cursor.image_yscale=1;} +if (type == 99) { + var onceh; + onceh = 0; + if ((obj_controller.zoomed == 0) && (onceh == 0)) { + obj_controller.zoomed = 1; + onceh = 1; + view_visible[0] = false; + view_visible[1] = true; + obj_cursor.image_xscale = 2; + obj_cursor.image_yscale = 2; + } + if ((obj_controller.zoomed == 1) && (onceh == 0)) { + obj_controller.zoomed = 0; + onceh = 1; + view_visible[0] = true; + view_visible[1] = false; + obj_cursor.image_xscale = 1; + obj_cursor.image_yscale = 1; + } } - - diff --git a/objects/obj_star/Alarm_3.gml b/objects/obj_star/Alarm_3.gml index a8451f5cf7..e43c784793 100644 --- a/objects/obj_star/Alarm_3.gml +++ b/objects/obj_star/Alarm_3.gml @@ -18,8 +18,8 @@ obj_controller.selecting_planet = 0; if (obj_controller.zoomed == 1) { obj_controller.zoomed = 0; - __view_set(e__VW.Visible, 0, true); - __view_set(e__VW.Visible, 1, false); + view_visible[0] = true; + view_visible[1] = false; obj_cursor.image_xscale = 1; obj_cursor.image_yscale = 1; } diff --git a/scripts/instance_create/instance_create.gml b/scripts/instance_create/instance_create.gml index c56ccf1310..6754b45e3b 100644 --- a/scripts/instance_create/instance_create.gml +++ b/scripts/instance_create/instance_create.gml @@ -3,23 +3,23 @@ /// @param {real} _x The x position the object will be created at. /// @param {real} _y The y position the object will be created at. /// @param {Asset.GMObject} _obj The object to create an instance of. -/// @returns {Asset.GMObject} +/// @returns {Id.Instance} function instance_create(_x, _y, _obj) { - var myDepth = object_get_depth(_obj); - return instance_create_depth(_x, _y, myDepth, _obj); + var myDepth = object_get_depth(_obj); + return instance_create_depth(_x, _y, myDepth, _obj); } /// @function instances_exist_any /// @description Checks if any of the provided instances exist /// @param {array} instance_set Array of instances to check for existence /// @returns {bool} -function instances_exist_any(instance_set = []){ - var _exists = false; - for (var i=0;i Date: Sun, 28 Dec 2025 09:54:09 -0500 Subject: [PATCH 37/45] Some initial work on normalizing usage of eFACTION enum instead of magic numbers. Beyond improving code readability, this also results in multiple bug fixes with the wrong data being assigned to the wrong faction. Nowhere near done because this touches a large part of the codebase. --- ChapterMaster.yyp | 2 - objects/obj_controller/Create_0.gml | 18 +- objects/obj_controller/Mouse_50.gml | 4 +- objects/obj_controller/Step_0.gml | 4 +- objects/obj_creation/Create_0.gml | 6 +- objects/obj_creation/Draw_0.gml | 18 +- objects/obj_creation/Step_0.gml | 6 +- objects/obj_ground_mission/Alarm_5.gml | 14 +- objects/obj_ncombat/Alarm_5.gml | 4 +- objects/obj_ncombat/Alarm_7.gml | 2 +- scripts/__view_set/__view_set.gml | 13 -- scripts/__view_set/__view_set.yy | 13 -- .../__view_set_internal.gml | 32 --- .../__view_set_internal.yy | 13 -- .../scr_chapter_random/scr_chapter_random.gml | 6 +- scripts/scr_cheatcode/scr_cheatcode.gml | 4 +- scripts/scr_demand/scr_demand.gml | 6 +- scripts/scr_dialogue/scr_dialogue.gml | 190 +++++++++--------- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 2 +- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 2 +- scripts/scr_event_code/scr_event_code.gml | 6 +- scripts/scr_event_gossip/scr_event_gossip.gml | 18 +- .../scr_imperial_manage_fleet_functions.gml | 2 +- .../scr_initialize_custom.gml | 6 +- .../scr_planetary_feature.gml | 12 +- .../scr_popup_functions.gml | 2 +- .../scr_system_search_helpers.gml | 2 +- scripts/scr_trade/scr_trade.gml | 2 +- 28 files changed, 168 insertions(+), 241 deletions(-) delete mode 100644 scripts/__view_set/__view_set.gml delete mode 100644 scripts/__view_set/__view_set.yy delete mode 100644 scripts/__view_set_internal/__view_set_internal.gml delete mode 100644 scripts/__view_set_internal/__view_set_internal.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index b26c7076e2..9ecdfbc284 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -711,8 +711,6 @@ {"id":{"name":"__init_global","path":"scripts/__init_global/__init_global.yy",},}, {"id":{"name":"__init_view","path":"scripts/__init_view/__init_view.yy",},}, {"id":{"name":"__view_get","path":"scripts/__view_get/__view_get.yy",},}, - {"id":{"name":"__view_set_internal","path":"scripts/__view_set_internal/__view_set_internal.yy",},}, - {"id":{"name":"__view_set","path":"scripts/__view_set/__view_set.yy",},}, {"id":{"name":"action_another_room","path":"scripts/action_another_room/action_another_room.yy",},}, {"id":{"name":"action_color","path":"scripts/action_color/action_color.yy",},}, {"id":{"name":"action_draw_ellipse","path":"scripts/action_draw_ellipse/action_draw_ellipse.yy",},}, diff --git a/objects/obj_controller/Create_0.gml b/objects/obj_controller/Create_0.gml index ee4bb74b7a..0836dd0e67 100644 --- a/objects/obj_controller/Create_0.gml +++ b/objects/obj_controller/Create_0.gml @@ -853,21 +853,21 @@ imperial_factions = [eFACTION.Imperium, eFACTION.Mechanicus, eFACTION.Inquisitio faction[0] = ""; disposition[0] = 0; faction[eFACTION.Player] = "Player"; -disposition[1] = 0; +disposition[eFACTION.Player] = 0; faction[eFACTION.Imperium] = "Imperium"; -disposition[3] = 0; -faction[3] = "Mechanicus"; -disposition[4] = 0; +disposition[eFACTION.Imperium] = 0; +faction[eFACTION.Mechanicus] = "Mechanicus"; +disposition[eFACTION.Mechanicus] = 0; faction[4] = "Inquisition"; disposition[4] = 0; faction[5] = "Ecclesiarchy"; disposition[5] = 0; // ** Initial disposition for Imperial factions ** if (instance_exists(obj_ini)) { - faction[2] = "Imperium"; - disposition[2] = obj_ini.imperium_disposition; - faction[3] = "Mechanicus"; - disposition[3] = obj_ini.mechanicus_disposition; + faction[eFACTION.Imperium] = "Imperium"; + disposition[eFACTION.Imperium] = obj_ini.imperium_disposition; + faction[eFACTION.Mechanicus] = "Mechanicus"; + disposition[eFACTION.Mechanicus] = obj_ini.mechanicus_disposition; faction[4] = "Inquisition"; disposition[4] = obj_ini.inquisition_disposition; faction[5] = "Ecclesiarchy"; @@ -992,7 +992,7 @@ known[eFACTION.Mechanicus] = 1; // eldar mission testing // known[eFACTION.Eldar]=2; // disposition[4]=90; -// disposition[3]=60; +// disposition[eFACTION.Mechanicus]=60; // ** Sets diplomacy annoyed status ** annoyed = array_create(14, 0); // ** Sets diplomacy ignore status ** diff --git a/objects/obj_controller/Mouse_50.gml b/objects/obj_controller/Mouse_50.gml index 0ca51e5bec..b1811e6da0 100644 --- a/objects/obj_controller/Mouse_50.gml +++ b/objects/obj_controller/Mouse_50.gml @@ -83,10 +83,10 @@ if ((menu == 15) && (cooldown <= 0)) { cooldown = 8000; if (obj_controller.faction_status[eFACTION.Mechanicus] != "War") { var _chapter_tech_count = scr_role_count("Techmarine", ""); - if (_chapter_tech_count >= ((disposition[3] / 2) + 5)) { + if (_chapter_tech_count >= ((disposition[eFACTION.Mechanicus] / 2) + 5)) { training_techmarine = 0; } - if (_chapter_tech_count < ((disposition[3] / 2) + 5)) { + if (_chapter_tech_count < ((disposition[eFACTION.Mechanicus] / 2) + 5)) { training_techmarine += 1; scr_income(); } diff --git a/objects/obj_controller/Step_0.gml b/objects/obj_controller/Step_0.gml index 68199fbac2..12730e3665 100644 --- a/objects/obj_controller/Step_0.gml +++ b/objects/obj_controller/Step_0.gml @@ -116,8 +116,8 @@ try { } if (cheatcode == "dep") { global.cheat_disp = 1; - obj_controller.disposition[2] = 100; - obj_controller.disposition[3] = 100; + obj_controller.disposition[eFACTION.Imperium] = 100; + obj_controller.disposition[eFACTION.Mechanicus] = 100; obj_controller.disposition[4] = 100; obj_controller.disposition[5] = 100; obj_controller.disposition[6] = 100; diff --git a/objects/obj_creation/Create_0.gml b/objects/obj_creation/Create_0.gml index b20134092d..31255ea45e 100644 --- a/objects/obj_creation/Create_0.gml +++ b/objects/obj_creation/Create_0.gml @@ -385,9 +385,9 @@ occulobe = 0; mucranoid = 0; disposition[0] = 0; -disposition[1] = 0; // Prog -disposition[2] = 0; // Imp -disposition[3] = 0; // Mech +disposition[eFACTION.Player] = 0; // Prog +disposition[eFACTION.Imperium] = 0; // Imp +disposition[eFACTION.Mechanicus] = 0; // Mech disposition[4] = 0; // Inq disposition[5] = 0; // Ecclesiarchy disposition[6] = 0; // Astartes diff --git a/objects/obj_creation/Draw_0.gml b/objects/obj_creation/Draw_0.gml index f3f630ec18..8cf43512bf 100644 --- a/objects/obj_creation/Draw_0.gml +++ b/objects/obj_creation/Draw_0.gml @@ -340,12 +340,12 @@ try { draw_set_font(fnt_40k_14b); draw_set_halign(fa_right); - draw_text(650, 550, string_hash_to_newline("Imperium (" + string(disposition[2]) + ")")); - draw_text(650, 575, string_hash_to_newline("Adeptus Mechanicus (" + string(disposition[3]) + ")")); + draw_text(650, 550, string_hash_to_newline("Imperium (" + string(disposition[eFACTION.Imperium]) + ")")); + draw_text(650, 575, string_hash_to_newline("Adeptus Mechanicus (" + string(disposition[eFACTION.Mechanicus]) + ")")); draw_text(650, 600, string_hash_to_newline("Ecclesiarchy (" + string(disposition[5]) + ")")); draw_text(650, 625, string_hash_to_newline("Inquisition (" + string(disposition[4]) + ")")); if (founding != ePROGENITOR.NONE) { - draw_text(650, 650, string_hash_to_newline("Progenitor (" + string(disposition[1]) + ")")); + draw_text(650, 650, string_hash_to_newline("Progenitor (" + string(disposition[eFACTION.Player]) + ")")); } draw_text(650, 675, "Adeptus Astartes (" + string(disposition[6]) + ")"); @@ -357,11 +357,11 @@ try { draw_rectangle(655, 552 + 100, 1150, 567 + 100, 1); } draw_rectangle(655, 552 + 125, 1150, 567 + 125, 1); - if (disposition[2] > 0) { - draw_rectangle(655, 552, 655 + (disposition[2] * 4.95), 567, 0); + if (disposition[eFACTION.Imperium] > 0) { + draw_rectangle(655, 552, 655 + (disposition[eFACTION.Imperium] * 4.95), 567, 0); } - if (disposition[3] > 0) { - draw_rectangle(655, 552 + 25, 655 + (disposition[3] * 4.95), 567 + 25, 0); + if (disposition[eFACTION.Mechanicus] > 0) { + draw_rectangle(655, 552 + 25, 655 + (disposition[eFACTION.Mechanicus] * 4.95), 567 + 25, 0); } if (disposition[5] > 0) { draw_rectangle(655, 552 + 50, 655 + (disposition[5] * 4.95), 567 + 50, 0); @@ -369,8 +369,8 @@ try { if (disposition[4] > 0) { draw_rectangle(655, 552 + 75, 655 + (disposition[4] * 4.95), 567 + 75, 0); } - if ((disposition[1] > 0) && (founding != ePROGENITOR.NONE)) { - draw_rectangle(655, 552 + 100, 655 + (disposition[1] * 4.95), 567 + 100, 0); + if ((disposition[eFACTION.Player] > 0) && (founding != ePROGENITOR.NONE)) { + draw_rectangle(655, 552 + 100, 655 + (disposition[eFACTION.Player] * 4.95), 567 + 100, 0); } if (disposition[6] > 0) { draw_rectangle(655, 552 + 125, 655 + (disposition[6] * 4.95), 567 + 125, 0); diff --git a/objects/obj_creation/Step_0.gml b/objects/obj_creation/Step_0.gml index 2f57804bf1..2fa50af89d 100644 --- a/objects/obj_creation/Step_0.gml +++ b/objects/obj_creation/Step_0.gml @@ -135,9 +135,9 @@ if (change_slide==35) or (change_slide==36) or (chapter_name=="Doom Benefactors" mucranoid=0; disposition[0]=0; - disposition[1]=0;// Prog - disposition[2]=0;// Imp - disposition[3]=0;// Mech + disposition[eFACTION.Player]=0;// Prog + disposition[eFACTION.Imperium]=0;// Imp + disposition[eFACTION.Mechanicus]=0;// Mech disposition[4]=0;// Inq disposition[5]=0;// Ecclesiarchy disposition[6]=0;// Astartes diff --git a/objects/obj_ground_mission/Alarm_5.gml b/objects/obj_ground_mission/Alarm_5.gml index c353d62d6e..4f3516f1da 100644 --- a/objects/obj_ground_mission/Alarm_5.gml +++ b/objects/obj_ground_mission/Alarm_5.gml @@ -28,8 +28,8 @@ if (mission="good") and (plan.p_first[num]=3) and (plan.p_type[num]="Forge"){ pop.text+="The STC Fragment has been safely recovered and stowed away. It is ready to be decrypted or gifted at your convenience."; /*if (plan.p_type[num]!="Dead"){ - if (plan.p_owner[num]=2) then obj_controller.disposition[2]-=1; - if (plan.p_owner[num]=3) then obj_controller.disposition[3]-=10;// max(obj_controller.disposition/4,10) + if (plan.p_owner[num]=eFACTION.Imperium) then obj_controller.disposition[eFACTION.Imperium]-=1; + if (plan.p_owner[num]=eFACTION.Mechanicus) then obj_controller.disposition[eFACTION.Mechanicus]-=10;// max(obj_controller.disposition/4,10) if (plan.p_owner[num]=4) then obj_controller.disposition[4]-=max(obj_controller.disposition[4]/4,10); if (plan.p_owner[num]=5) then obj_controller.disposition[5]-=3; if (plan.p_owner[num]=8) then obj_controller.disposition[8]-=3; @@ -46,17 +46,17 @@ if (mission="bad") and (plan.p_first[num]=3) and (plan.p_type[num]="Forge"){ pop.text="Your forces descend into the vaults of the Mechanicus Forge. Sentries, automated defenses, and blast doors stand in their way.##"; pop.text+="Half-way through the mission a small army of Praetorian Servitors and Skitarii bear down upon your men. The Mechanicus guards seem to be upset."; - /*if (plan.p_owner[num]=2) then obj_controller.disposition[2]-=2;*/ - if (plan.p_owner[num]=3){obj_controller.disposition[3]-=40;} + /*if (plan.p_owner[num]=eFACTION.Imperium) then obj_controller.disposition[eFACTION.Imperium]-=2;*/ + if (plan.p_owner[num]=eFACTION.Mechanicus){obj_controller.disposition[eFACTION.Mechanicus]-=40;} /*if (plan.p_owner[num]=4) then obj_controller.disposition[4]-=max(obj_controller.disposition[4]/3,20); - if (plan.p_owner[num]=5) then obj_controller.disposition[5]-=max(obj_controller.disposition[3]/4,15); + if (plan.p_owner[num]=5) then obj_controller.disposition[5]-=max(obj_controller.disposition[5]/4,15); if (plan.p_owner[num]=6) then obj_controller.disposition[6]-=15; if (plan.p_owner[num]=8) then obj_controller.disposition[8]-=8;*/ - if (plan.p_owner[num]>3) and (plan.p_owner[num]<=6){ + if (plan.p_owner[num]>=eFACTION.Inquisition) and (plan.p_owner[num]<=eFACTION.Eldar){ // Inquisition Ecclesiarchy Eldar did you mean for it to be these three factions scr_audience(plan.p_owner[num], "artifact_angry",); } - if (plan.p_owner[num]=3) and (obj_controller.faction_status[eFACTION.Mechanicus]!="War"){ + if (plan.p_owner[num]=eFACTION.Mechanicus) and (obj_controller.faction_status[eFACTION.Mechanicus]!="War"){ scr_audience(plan.p_owner[num], "declare_war", -20); } diff --git a/objects/obj_ncombat/Alarm_5.gml b/objects/obj_ncombat/Alarm_5.gml index 7fab91c1c9..b83d13893a 100644 --- a/objects/obj_ncombat/Alarm_5.gml +++ b/objects/obj_ncombat/Alarm_5.gml @@ -492,7 +492,7 @@ if (defeat == 0 && _reduce_power){ p_owner[battle_planet] = eFACTION.Player; } else if (p_first[battle_planet] == 3 || p_type[battle_planet]=="Forge"){ who_return="mechanicus"; - obj_controller.disposition[3] += 10; + obj_controller.disposition[eFACTION.Mechanicus] += 10; p_owner[battle_planet] = eFACTION.Mechanicus }else if (p_type[battle_planet]!="Dead"){ who_return="the governor"; @@ -733,7 +733,7 @@ if (obj_ini.omophagea){ // check for pdf/guardsmen eatme=roll_dice_chapter(1, 100, "high"); if (eatme<=10) and (allies>0){ - obj_controller.disposition[2]-=2; + obj_controller.disposition[eFACTION.Imperium]-=2; if (allies=1){ newline="Local PDF have been eaten!"; newline_color="red";scr_newtext(); diff --git a/objects/obj_ncombat/Alarm_7.gml b/objects/obj_ncombat/Alarm_7.gml index 608060cfb8..2d689e37c5 100644 --- a/objects/obj_ncombat/Alarm_7.gml +++ b/objects/obj_ncombat/Alarm_7.gml @@ -190,7 +190,7 @@ try { var ii=0,good=0; if (remove_planet_problem(battle_id, "mech_tomb", battle_object)){ - obj_controller.disposition[3]-=10; + obj_controller.disposition[eFACTION.Mechanicus]-=10; if (battle_special="study2a"){ scr_popup("Mechanicus Mission Failed","All of your Astartes and the Mechanicus Research party have been killed down to the last man. The research is a bust, and the Adeptus Mechanicus is furious with your chapter for not providing enough security. Relations with them are worse than before.","",""); diff --git a/scripts/__view_set/__view_set.gml b/scripts/__view_set/__view_set.gml deleted file mode 100644 index dad12bf633..0000000000 --- a/scripts/__view_set/__view_set.gml +++ /dev/null @@ -1,13 +0,0 @@ -function __view_set(argument0, argument1, argument2) { - var __prop = argument0; - var __index = argument1; - var __val = argument2; - - __view_set_internal(__prop, __index, __val); - - var __res = __view_get(__prop, __index); - - return __res; - - -} diff --git a/scripts/__view_set/__view_set.yy b/scripts/__view_set/__view_set.yy deleted file mode 100644 index 5413b519d4..0000000000 --- a/scripts/__view_set/__view_set.yy +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$GMScript":"v1", - "%Name":"__view_set", - "isCompatibility":true, - "isDnD":false, - "name":"__view_set", - "parent":{ - "name":"view", - "path":"folders/Scripts/compatibility/view.yy", - }, - "resourceType":"GMScript", - "resourceVersion":"2.0", -} \ No newline at end of file diff --git a/scripts/__view_set_internal/__view_set_internal.gml b/scripts/__view_set_internal/__view_set_internal.gml deleted file mode 100644 index b8211faabc..0000000000 --- a/scripts/__view_set_internal/__view_set_internal.gml +++ /dev/null @@ -1,32 +0,0 @@ -function __view_set_internal(argument0, argument1, argument2) { - var __prop = argument0; - var __index = argument1; - var __val = argument2; - var __cam = view_get_camera(__index) - - switch(__prop) - { - case e__VW.XView: camera_set_view_pos(__cam, __val, camera_get_view_y(__cam)); break; - case e__VW.YView: camera_set_view_pos(__cam, camera_get_view_x(__cam), __val); break; - case e__VW.WView: camera_set_view_size(__cam, __val, camera_get_view_height(__cam)); break; - case e__VW.HView: camera_set_view_size(__cam, camera_get_view_width(__cam), __val); break; - case e__VW.Angle: camera_set_view_angle(__cam, __val); break; - case e__VW.HBorder: camera_set_view_border(__cam, __val, camera_get_view_border_y(__cam)); break; - case e__VW.VBorder: camera_set_view_border(__cam, camera_get_view_border_x(__cam), __val); break; - case e__VW.HSpeed: camera_set_view_speed(__cam, __val, camera_get_view_speed_y(__cam)); break; - case e__VW.VSpeed: camera_set_view_speed(__cam, camera_get_view_speed_x(__cam), __val); break; - case e__VW.Object: camera_set_view_target(__cam, __val); break; - case e__VW.Visible: __res = view_set_visible(__index, __val); break; - case e__VW.XPort: __res = view_set_xport(__index, __val); break; - case e__VW.YPort: __res = view_set_yport(__index, __val); break; - case e__VW.WPort: __res = view_set_wport(__index, __val); break; - case e__VW.HPort: __res = view_set_hport(__index, __val); break; - case e__VW.Camera: __res = view_set_camera(__index, __val); break; - case e__VW.SurfaceID: __res = view_set_surface_id(__index, __val); break; - default: break; - }; - - return 0; - - -} diff --git a/scripts/__view_set_internal/__view_set_internal.yy b/scripts/__view_set_internal/__view_set_internal.yy deleted file mode 100644 index 749df98641..0000000000 --- a/scripts/__view_set_internal/__view_set_internal.yy +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$GMScript":"v1", - "%Name":"__view_set_internal", - "isCompatibility":true, - "isDnD":false, - "name":"__view_set_internal", - "parent":{ - "name":"view", - "path":"folders/Scripts/compatibility/view.yy", - }, - "resourceType":"GMScript", - "resourceVersion":"2.0", -} \ No newline at end of file diff --git a/scripts/scr_chapter_random/scr_chapter_random.gml b/scripts/scr_chapter_random/scr_chapter_random.gml index fae68c59c5..4556b808fc 100644 --- a/scripts/scr_chapter_random/scr_chapter_random.gml +++ b/scripts/scr_chapter_random/scr_chapter_random.gml @@ -90,9 +90,9 @@ function scr_chapter_random(custom_or_random) { mucranoid = 0; disposition = array_create(8, 0); // disposition[0]=0; - // disposition[1]=0;// Prog - // disposition[2]=0;// Imp - // disposition[3]=0;// Mech + // disposition[eFACTION.Player]=0;// Prog + // disposition[eFACTION.Imperium]=0;// Imp + // disposition[eFACTION.Mechanicus]=0;// Mech // disposition[4]=0;// Inq // disposition[5]=0;// Ecclesiarchy // disposition[6]=0;// Astartes diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 25eafdfbdc..4123189fc5 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -303,10 +303,10 @@ function scr_cheatcode(argument0) { } break; case "depimp": - obj_controller.disposition[2] = real(cheat_arguments[0]); + obj_controller.disposition[eFACTION.Imperium] = real(cheat_arguments[0]); break; case "depmec": - obj_controller.disposition[3] = real(cheat_arguments[0]); + obj_controller.disposition[eFACTION.Mechanicus] = real(cheat_arguments[0]); break; case "depinq": obj_controller.disposition[4] = real(cheat_arguments[0]); diff --git a/scripts/scr_demand/scr_demand.gml b/scripts/scr_demand/scr_demand.gml index d29b5d1448..420ad616a2 100644 --- a/scripts/scr_demand/scr_demand.gml +++ b/scripts/scr_demand/scr_demand.gml @@ -71,9 +71,9 @@ function scr_demand(demand_type) { } resistance=min(instance_number(obj_temp2),8); with(obj_temp2){instance_destroy();} - if (obj_controller.disposition[2]<30) then resistance+=1; - if (obj_controller.disposition[2]<10) then resistance+=2; - if (obj_controller.disposition[2]<=-60) then resistance+=100; + if (obj_controller.disposition[eFACTION.Imperium]<30) then resistance+=1; + if (obj_controller.disposition[eFACTION.Imperium]<10) then resistance+=2; + if (obj_controller.disposition[eFACTION.Imperium]<=-60) then resistance+=100; if (rela="hostile") or (faction_status[eFACTION.Imperium]="Antagonism") then resistance+=2; if (faction_status[eFACTION.Imperium]="War") then resistance+=3; diff --git a/scripts/scr_dialogue/scr_dialogue.gml b/scripts/scr_dialogue/scr_dialogue.gml index 3c128c929c..4b54e987fd 100644 --- a/scripts/scr_dialogue/scr_dialogue.gml +++ b/scripts/scr_dialogue/scr_dialogue.gml @@ -716,7 +716,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { }); } // ** Chaos ** - if (diplomacy == 10) { + if (diplomacy == eFACTION.Chaos) { if (diplo_keyphrase == "civilwar_begin") { diplo_text = "The Imperium, blinded by its own hypocrisy, drowns in corruption and stagnation.If it is civil war they desire, then civil war they shall have."; force_goodbye = 1; @@ -774,7 +774,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } diplo_text = tempd; } - if ((diplo_keyphrase == "hello") || ((diplo_keyphrase == "propose_alliance") && (faction_gender[10] == 2))) { + if ((diplo_keyphrase == "hello") || ((diplo_keyphrase == "propose_alliance") && (faction_gender[eFACTION.Chaos] == 2))) { scr_loyalty("Heretic Contact", "+"); if ((faction_gender[10] == 1) && (string_count("CHTRP|", obj_controller.useful_info) == 0)) { @@ -804,7 +804,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { }); } } - if ((disposition[10] > -80) && (chaos_rating == 0)) { + if ((disposition[eFACTION.Chaos] > -80) && (chaos_rating == 0)) { rando = choose(1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5); if (rando == 1) { diplo_text = "Ahhhh. You require something, " + string(obj_ini.master_name) + "?"; @@ -822,7 +822,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { diplo_text = "There are few reasons a Chapter Master might wish an audience, and they are all worthwhile. What can I and my forces do for you?"; } } - if (disposition[10] <= -80) { + if (disposition[eFACTION.Chaos] <= -80) { force_goodbye = 1; rando = choose(1, 2, 2, 3, 3); turns_ignored[10] += choose(3, 4, 5); @@ -848,12 +848,12 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } } - if ((faction_gender[10] == 1) && (string_count("CHTRP|", obj_controller.useful_info) > 0)) { + if ((faction_gender[eFACTION.Chaos] == 1) && (string_count("CHTRP|", obj_controller.useful_info) > 0)) { obj_controller.useful_info = string_replace(obj_controller.useful_info, "CHTRP|", "CHTRP2|"); diplo_text += "I almost refused to believe that my little trap hadn't done you in, but here you are. I may have misjudged you, " + string(obj_ini.master_name) + ". Of course I still intend to kill you, regardless, but I can give credit where credit is due."; force_goodbye = 1; } - if (faction_gender[10] == 2) { + if (faction_gender[eFACTION.Chaos] == 2) { force_goodbye = 1; turns_ignored[10] += choose(3, 4, 5); rando = choose(1, 2, 3); @@ -899,7 +899,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } if (diplo_keyphrase == "demand_refused") { - if ((faction_gender[10] == 1) && (rela == "hostile")) { + if ((faction_gender[eFACTION.Chaos] == 1) && (rela == "hostile")) { rando = choose(1, 2, 3); if (rando == 1) { diplo_text = "I spit upon your demands, loyalist dog. Beg your corpse Emperor for something instead."; @@ -987,8 +987,8 @@ function scr_dialogue(diplo_keyphrase, data = {}) { // TODO } if (diplo_keyphrase == "denounced") { - if (faction_gender[10] == 1) { - disposition[10] -= 1; + if (faction_gender[eFACTION.Chaos] == 1) { + disposition[eFACTION.Chaos] -= 1; var _diag_opts = ["You are nothing.", "Pathetic.", "I grow weary of your ineptitude.", "Judgement comes for all.", "Your kind will be destroyed, in time.", $"[{faction_leader[eFACTION.Inquisition]} lets out an amused, extremely confident chuckle.]", "Your soul will be mine.", "Do not trifle with me, worm.", "I have travelled the stars for millennia. Worlds have burned at my command, countless souls damned. The ground trembles with every step. Now I sit here and listen to you. Where did it all go so wrong?"]; diplo_text = array_random_element(_diag_opts); @@ -996,14 +996,14 @@ function scr_dialogue(diplo_keyphrase, data = {}) { if (irandom(9) == 9) { force_goodbye = 1; } - if (disposition[10] <= -80) { + if (disposition[eFACTION.Chaos] <= -80) { diplo_text = "Your end will soon be at hand; you need not rush toward it so eagerly."; force_goodbye = 1; } } } - if ((diplo_keyphrase == "praised") && (faction_gender[10] == 1)) { - if ((faction_justmet == 0) && (disposition[10] < -75)) { + if ((diplo_keyphrase == "praised") && (faction_gender[eFACTION.Chaos] == 1)) { + if ((faction_justmet == 0) && (disposition[eFACTION.Chaos] < -75)) { disposition[diplomacy] += choose(0, 0, 1); } if (faction_justmet == 1) { @@ -1148,7 +1148,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { goto: "disagree", }); } - if ((diplo_keyphrase == "propose_alliance") && (obj_controller.faction_gender[10] == 1)) { + if ((diplo_keyphrase == "propose_alliance") && (obj_controller.faction_gender[eFACTION.Chaos] == 1)) { var _found = false; var _star, _planet; with (obj_star) { @@ -1178,7 +1178,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } // ** Imperium ** - if (diplomacy == 2) { + if (diplomacy == eFACTION.Imperium) { if (diplo_keyphrase == "intro") { rando = choose(1, 2); if (rando == 1) { @@ -1564,7 +1564,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } // ** Mechanicus ** - if (diplomacy == 3) { + if (diplomacy == eFACTION.Mechanicus) { if (diplo_keyphrase == "intro") { rando = choose(1, 2); if (rando == 1) { @@ -1574,13 +1574,13 @@ function scr_dialogue(diplo_keyphrase, data = {}) { diplo_text = "[[The flesh is weak. " + string(faction_leader[eFACTION.Mechanicus]) + " believes in this part of the iron creed above all others, forcing all those under him to mirror his dedication. All meaty parts of his body have been removed, leaving only the most vital parts of his brain. His retinue display their rank by showing how little of their body remains.]]"; } diplo_text += "\n#"; - if ((disposition[3] > 30) && (disposition[3] < 60)) { + if ((disposition[eFACTION.Mechanicus] > 30) && (disposition[eFACTION.Mechanicus] < 60)) { tempd = "Greetings. I wish to see you bring the light of civilization to this sector, Chapter Master."; } - if ((disposition[3] <= 30) || scr_has_disadv("Tech-Heresy")) { + if ((disposition[eFACTION.Mechanicus] <= 30) || scr_has_disadv("Tech-Heresy")) { tempd = "You are impure, illogical and irritating. Keep your army of techno barbarians away from my territory."; } - if ((disposition[3] >= 60) || scr_has_adv("Tech-Brothers")) { + if ((disposition[eFACTION.Mechanicus] >= 60) || scr_has_adv("Tech-Brothers")) { tempd = "Hail, Chapter Master. Were it not a logical fallacy, I would wish you luck in your coming endeavors."; } diplo_text += tempd; @@ -1728,8 +1728,8 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "declare_war") { force_goodbye = 1; - turns_ignored[diplomacy] += 4; - known[diplomacy] = max(2, known[diplomacy]); + turns_ignored[eFACTION.Mechanicus] += 4; + known[eFACTION.Mechanicus] = max(2, known[eFACTION.Mechanicus]); diplo_text = "++ CORPUS FINIS+MACHINA MAGNUS+SANCTUS METALLUM+POTESTAS OMNISSIAH+OMNISSIAH VULT+DEATH TO THE ENEMIES OF THE MACHINE GOD ++"; } if (diplo_keyphrase == "accept_peace") { @@ -1740,7 +1740,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "denounced") { if (faction_justmet == 1) { - disposition[diplomacy] -= 5; + disposition[eFACTION.Mechanicus] -= 5; faction_justmet = 0; } rando = choose(1, 2, 3); @@ -1923,7 +1923,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } // ** Inquisition ** - if (diplomacy == 4) { + if (diplomacy == eFACTION.Inquisition) { if (diplo_keyphrase == "intro") { rando = choose(1, 1, 2); if (rando == 1) { @@ -2042,21 +2042,21 @@ function scr_dialogue(diplo_keyphrase, data = {}) { if (trading_artifact == 1) { diplo_text = ""; } - annoyed[diplomacy] += 2; - if ((rela == "friendly") && (annoyed[diplomacy] >= 8)) { + annoyed[eFACTION.Inquisition] += 2; + if ((rela == "friendly") && (annoyed[eFACTION.Inquisition] >= 8)) { diplo_text += "I cannot help you at this time and advise that you cease pressing the matter."; force_goodbye = 1; - turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 1); + turns_ignored[eFACTION.Inquisition] = max(turns_ignored[eFACTION.Inquisition], 1); diplo_last = string(diplo_keyphrase); diplo_char = 0; diplo_alpha = 0; exit; } - if ((rela == "neutral") && (annoyed[diplomacy] >= 6)) { + if ((rela == "neutral") && (annoyed[eFACTION.Inquisition] >= 6)) { diplo_text += "You are testing my patience, astartes."; force_goodbye = 1; - disposition[diplomacy] -= 2; - turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 1); + disposition[eFACTION.Inquisition] -= 2; + turns_ignored[eFACTION.Inquisition] = max(turns_ignored[eFACTION.Inquisition], 1); diplo_last = string(diplo_keyphrase); diplo_char = 0; diplo_alpha = 0; @@ -2086,9 +2086,9 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } if (rela == "hostile") { - disposition[diplomacy] -= 2; + disposition[eFACTION.Inquisition] -= 2; force_goodbye = 1; - turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 3); + turns_ignored[eFACTION.Inquisition] = max(turns_ignored[eFACTION.Inquisition], 3); if (rando == 1) { diplo_text += "Not even when the gates of the immaterium have closed, heretic!"; } @@ -2105,7 +2105,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if ((diplo_keyphrase == "declare_war") && (sorc == false)) { force_goodbye = 1; - turns_ignored[diplomacy] += 4; + turns_ignored[eFACTION.Inquisition] += 4; diplo_text = "You have stepped far beyond the acceptable conduct for an Astartes. Look to your sins and prepare to face the Emperor's judgment."; } if (diplo_keyphrase == "accept_peace") { @@ -2116,12 +2116,12 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "denounced") { if (faction_justmet == 1) { - disposition[diplomacy] -= 15; + disposition[eFACTION.Inquisition] -= 15; faction_justmet = 0; } rando = choose(1, 2, 3); if (rela == "friendly") { - disposition[diplomacy] -= choose(0, 1); + disposition[eFACTION.Inquisition] -= choose(0, 1); if (rando == 1) { diplo_text = "Words are wind and mean nothing between two servants of the Emperor's eternal glory."; } @@ -2133,7 +2133,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } if (rela == "neutral") { - disposition[diplomacy] -= 2; + disposition[eFACTION.Inquisition] -= 2; force_goodbye = 1; if (rando == 1) { diplo_text = "I cannot agree with what you have said, but perhaps you have your reasons. I hope they are good ones."; @@ -2146,7 +2146,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } if (rela == "hostile") { - disposition[diplomacy] -= 4; + disposition[eFACTION.Inquisition] -= 4; force_goodbye = 1; if (rando == 1) { diplo_text = "You dare besmirch the honour of the Inquisition!? You have crossed a line this day!"; @@ -2161,7 +2161,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "praised") { if (faction_justmet == 1) { - disposition[diplomacy] += 2; + disposition[eFACTION.Inquisition] += 2; faction_justmet = 0; } rando = choose(1, 2, 3); @@ -2188,7 +2188,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } if (rela == "hostile") { - disposition[diplomacy] -= 1; + disposition[eFACTION.Inquisition] -= 1; force_goodbye = 1; if (rando == 1) { diplo_text = "If you think kissing my boots will make me overlook your crimes you are sorely mistaken."; @@ -2337,9 +2337,9 @@ function scr_dialogue(diplo_keyphrase, data = {}) { if (rando == 3) { diplo_text = "You have handed away the root of the Imperium's most powerful warriors to foul xenos. Did you truly believe a crime of this magnitude would escape the eye of the Imperium?"; } - faction_status[diplomacy] = "War"; + faction_status[eFACTION.Inquisition] = "War"; var lol = ""; - lol = string(obj_controller.faction_title[diplomacy]) + " " + string(obj_controller.faction_leader[diplomacy]) + $" declares war on the {global.chapter_name}."; + lol = string(obj_controller.faction_title[eFACTION.Inquisition]) + " " + string(obj_controller.faction_leader[eFACTION.Inquisition]) + $" declares war on the {global.chapter_name}."; scr_event_log("red", lol); force_goodbye = 1; gene_xeno = 0; @@ -2513,10 +2513,10 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } if (diplo_keyphrase == "loyalty_zero") { - disposition[2] -= 20; - disposition[3] -= 15; - disposition[4] -= 20; - disposition[5] -= 20; + disposition[eFACTION.Imperium] -= 20; + disposition[eFACTION.Mechanicus] -= 15; + disposition[eFACTION.Inquisition] -= 20; + disposition[eFACTION.Ecclesiarchy] -= 20; diplo_text = "Your arrogant, blatant disregard for proper Imperial conduct can no longer go unanswered, Astartes. Time and time again you have ignored the Imperium's call to arms, refusing to strike out at the enemies of man when it was most needed, and callously ignored the Inquisition's wants. It has become clear that you are not in line with the High Lords of Terra and His will. This heresy must be cut from your Chapter like the festering blight it is. You may either atone for your Chapter's crimes, in penitence, or see it ground to dust around you."; // Speak your next words carefully, Chapter Master, for they may damn all the souls of your men to oblivion. @@ -2556,13 +2556,13 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } // ** Ecclesiarchy ** - if (diplomacy == 5) { + if (diplomacy == eFACTION.Ecclesiarchy) { var _diag_data = { faction_leader: faction_leader[eFACTION.Ecclesiarchy], sector: obj_ini.sector_name, relationship: rela, - annoyed: annoyed[diplomacy], - turns_ignored: turns_ignored[diplomacy], + annoyed: annoyed[eFACTION.Ecclesiarchy], + turns_ignored: turns_ignored[eFACTION.Ecclesiarchy], chapter_name: global.chapter_name, master_name: obj_ini.master_name, faction_status: obj_controller.faction_status[eFACTION.Ecclesiarchy], @@ -2581,10 +2581,10 @@ function scr_dialogue(diplo_keyphrase, data = {}) { if (trading_artifact == 1) { diplo_text = ""; } - annoyed[diplomacy] += 2; + annoyed[eFACTION.Ecclesiarchy] += 2; if ((rela == "neutral") && (_diag_data.annoyed >= 8)) { force_goodbye = 1; - turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 1); + turns_ignored[eFACTION.Ecclesiarchy] = max(turns_ignored[eFACTION.Ecclesiarchy], 1); diplo_last = string(diplo_keyphrase); diplo_char = 0; diplo_alpha = 0; @@ -2594,7 +2594,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { if (rela == "hostile") { force_goodbye = choose(0, 1); if (_diag_data.annoyed >= 4) { - turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 1); + turns_ignored[eFACTION.Ecclesiarchy] = max(turns_ignored[eFACTION.Ecclesiarchy], 1); diplo_last = string(diplo_keyphrase); diplo_char = 0; diplo_alpha = 0; @@ -2603,19 +2603,19 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "declare_war") { force_goodbye = 1; - turns_ignored[diplomacy] += 4; - known[diplomacy] = max(2, known[diplomacy]); + turns_ignored[eFACTION.Ecclesiarchy] += 4; + known[eFACTION.Ecclesiarchy] = max(2, known[eFACTION.Ecclesiarchy]); } if (diplo_keyphrase == "denounced") { if (faction_justmet == 1) { - disposition[diplomacy] -= 5; + disposition[eFACTION.Ecclesiarchy] -= 5; faction_justmet = 0; } scr_loyalty("Irreverance for His Servants", "+"); } if (diplo_keyphrase == "praised") { if (faction_justmet == 1) { - alter_disposition(diplomacy, 3); + alter_disposition(eFACTION.Ecclesiarchy, 3); faction_justmet = 0; } } @@ -2653,14 +2653,14 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } // ** Eldar ** - if (diplomacy == 6) { + if (diplomacy == eFACTION.Eldar) { if (string_count("intro", diplo_keyphrase) > 0) { - if (faction_gender[6] == 1) { - diplo_text = "[[" + string(faction_leader[diplomacy]) + " is a farseer, or witch, of the eldar. He is dressed in a typical fashion of his position, clad in flowing black cloth and bone-like armour. Almost seeming to relish in conflict, this xeno is known in local records for " + choose("sudden raid on trade vessels", "assassinating a pair of planetary govererners") + ". It is unlikely " + string(faction_leader[diplomacy]) + " will be receptive to diplomacy- further audiences are ill-advised.]]"; + if (faction_gender[eFACTION.Eldar] == 1) { + diplo_text = "[[" + string(faction_leader[eFACTION.Eldar]) + " is a farseer, or witch, of the eldar. He is dressed in a typical fashion of his position, clad in flowing black cloth and bone-like armour. Almost seeming to relish in conflict, this xeno is known in local records for " + choose("sudden raid on trade vessels", "assassinating a pair of planetary govererners") + ". It is unlikely " + string(faction_leader[diplomacy]) + " will be receptive to diplomacy- further audiences are ill-advised.]]"; } - if (faction_gender[6] == 2) { + if (faction_gender[eFACTION.Eldar] == 2) { rando = choose(1, 2, 3); - diplo_text = "[[" + string(faction_leader[diplomacy]) + " is a witch; an old farseer of eldar kind. While obviously a female, the grating voice and inhuman proportions are an unholy mockery of the human form. She seems to avoid contact with the Imperium, as is befitting a xeno. Little is known about " + string(faction_leader[diplomacy]) + ", other than "; + diplo_text = "[[" + string(faction_leader[eFACTION.Eldar]) + " is a witch; an old farseer of eldar kind. While obviously a female, the grating voice and inhuman proportions are an unholy mockery of the human form. She seems to avoid contact with the Imperium, as is befitting a xeno. Little is known about " + string(faction_leader[diplomacy]) + ", other than "; if (rando == 1) { diplo_text += "random1."; } @@ -2822,20 +2822,20 @@ function scr_dialogue(diplo_keyphrase, data = {}) { if (trading_artifact == 1) { diplo_text = ""; } - annoyed[diplomacy] += 2; - if ((rela == "friendly") && (annoyed[diplomacy] >= 6)) { + annoyed[eFACTION.Eldar] += 2; + if ((rela == "friendly") && (annoyed[eFACTION.Eldar] >= 6)) { diplo_text += "You test my boundries, " + string(obj_ini.master_name) + ", and I find tiresome."; force_goodbye = 1; - turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 2); + turns_ignored[eFACTION.Eldar] = max(turns_ignored[eFACTION.Eldar], 2); diplo_last = string(diplo_keyphrase); diplo_char = 0; diplo_alpha = 0; exit; } - if ((rela != "friendly") && (annoyed[diplomacy] >= 4)) { + if ((rela != "friendly") && (annoyed[eFACTION.Eldar] >= 4)) { diplo_text += choose("I will suffer your presence no longer.", "Expect consequences for this offense"); force_goodbye = 1; - turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 4); + turns_ignored[eFACTION.Eldar] = max(turns_ignored[eFACTION.Eldar], 4); diplo_last = string(diplo_keyphrase); diplo_char = 0; diplo_alpha = 0; @@ -2888,7 +2888,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "declare_war") { force_goodbye = 1; - turns_ignored[diplomacy] += 4; + turns_ignored[eFACTION.Eldar] += 4; diplo_text = "The Bloody-Handed God calls for your destruction. We shall only rest when your filth is cleansed from this sector."; } if (diplo_keyphrase == "accept_peace") { @@ -2899,7 +2899,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { }*/ if (diplo_keyphrase == "denounced") { if (faction_justmet == 1) { - disposition[diplomacy] -= 10; + disposition[eFACTION.Eldar] -= 10; faction_justmet = 0; } if (rela == "friendly") { @@ -2937,7 +2937,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "praised") { if (faction_justmet == 1) { - disposition[diplomacy] += 1; + disposition[eFACTION.Eldar] += 1; faction_justmet = 0; } if (rela == "friendly") { @@ -3192,9 +3192,9 @@ function scr_dialogue(diplo_keyphrase, data = {}) { // * Next random event * if (rando == 4) { scr_random_event(false); - if ((random_event_next == eEVENT.strange_behavior) && (obj_controller.disposition[6] < 15)) { + if ((random_event_next == eEVENT.strange_behavior) && (obj_controller.disposition[eFACTION.Eldar] < 15)) { diplo_text = "One of your Mon'keigh soldiers will no longer act as you expect him to. Be wary, when one Mon'keigh is influenced the rest of the herd will be."; - } else if ((random_event_next == eEVENT.strange_behavior) && (obj_controller.disposition[6] >= 15)) { + } else if ((random_event_next == eEVENT.strange_behavior) && (obj_controller.disposition[eFACTION.Eldar] >= 15)) { diplo_text = "One of your soldiers will no longer act as you expect him to. Be wary, when one is influenced the rest of the herd will be."; } else if (random_event_next == eEVENT.space_hulk) { diplo_text = "It comes from the warp, a relic from the past. It is steeped in the energies of the ethereal tides. Beware."; @@ -3241,7 +3241,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { // * Chaos warlord location * if (rando == 3) { obj_controller.useful_info += "WL10|"; - if (obj_controller.faction_gender[10] == 1) { + if (obj_controller.faction_gender[eFACTION.Chaos] == 1) { for (var i = 0; i < 5; i++) { if (found == 0) { instance_activate_object(obj_star); @@ -3270,7 +3270,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } } - if (obj_controller.faction_gender[10] == 2) { + if (obj_controller.faction_gender[eFACTION.Chaos] == 2) { diplo_text = "The Lord of Rage turns his foul gaze upon this sector. With it death and destruction will soon come. You had best be ready when it does."; } } @@ -3284,7 +3284,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { instance_destroy(); } with (obj_star) { - for (var i = 1; i <= 4; i++) { + for (var j = 1; j <= 4; j++) { if (planet_feature_bool(p_feature[1], P_features.OrkWarboss) == 1) { instance_create(x, y, obj_temp5); } @@ -3294,7 +3294,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { var you, nuum, plan = 0; you = instance_nearest(obj_temp5.x, obj_temp5.y, obj_star); nuum = you.name; - for (var i = 1; i <= you.planets; i++) { + for (var j = 1; j <= you.planets; j++) { if (planet_feature_bool(you.p_feature[1], P_features.OrkWarboss) == 1) { plan = i; } @@ -3458,28 +3458,28 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } // ** ORKZZZ ** - if (diplomacy == 7) { - if (disposition[diplomacy] >= 20) { + if (diplomacy == eFACTION.Ork) { + if (disposition[eFACTION.Ork] >= 20) { rela = "friendly"; } - if ((disposition[diplomacy] < 20) && (disposition[diplomacy] >= -20)) { + if ((disposition[eFACTION.Ork] < 20) && (disposition[eFACTION.Ork] >= -20)) { rela = "neutral"; } - if (disposition[diplomacy] < -20) { + if (disposition[eFACTION.Ork] < -20) { rela = "hostile"; } // * Request audience * if (diplo_keyphrase == "intro") { rando = choose(1, 2); if (rando == 1) { - diplo_text = "[[" + string(faction_leader[diplomacy]) + " is the scourge of the sector, a colossal green brute infamous for the destruction of a dozen worlds. He rules his vicious horde of xenos savages the only way greenskins know how; with brute force. Trophies from the champions of a score of races bedeck his armour, including many from " + string(choose("other Astartes", "the Tyranids", "the Tau Empire")) + ".]]"; + diplo_text = "[[" + string(faction_leader[eFACTION.Ork]) + " is the scourge of the sector, a colossal green brute infamous for the destruction of a dozen worlds. He rules his vicious horde of xenos savages the only way greenskins know how; with brute force. Trophies from the champions of a score of races bedeck his armour, including many from " + string(choose("other Astartes", "the Tyranids", "the Tau Empire")) + ".]]"; } if (rando == 2) { - diplo_text = "[[" + string(faction_leader[diplomacy]) + " is a veteran of countless engagements, leading his tribe into battle with an almost manic giddiness. His name is synonymous with extended campaigns of looting and senseless violence, even more so than the other members of his barbaric race. He and the rest of his tribe hail from the " + string(choose("Goffs", "Blood Axes", "Bad Moons", "Death Skulls", "Death Skulls")) + " clan.]]"; + diplo_text = "[[" + string(faction_leader[eFACTION.Ork]) + " is a veteran of countless engagements, leading his tribe into battle with an almost manic giddiness. His name is synonymous with extended campaigns of looting and senseless violence, even more so than the other members of his barbaric race. He and the rest of his tribe hail from the " + string(choose("Goffs", "Blood Axes", "Bad Moons", "Death Skulls", "Death Skulls")) + " clan.]]"; } diplo_text += "\n#"; if (scr_has_adv("Enemy: Orks")) { - diplo_text += "Oi Beaky! I ain't heard your name round here before! If ya eva get bored of havin' your ‘ead attached to your shouldas, good old " + string(faction_leader[diplomacy]) + " can sort dat out for ya!"; + diplo_text += "Oi Beaky! I ain't heard your name round here before! If ya eva get bored of havin' your ‘ead attached to your shouldas, good old " + string(faction_leader[eFACTION.Ork]) + " can sort dat out for ya!"; } else { if (scr_has_disadv("Tolerant")) { diplo_text += "You seem good for a scrap, ya beaky faced ponce! Bring your lads down my way some time and we'll have one!"; @@ -3491,13 +3491,13 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "new_warboss") { rando = choose(1, 1, 1, 2); - diplo_text = "[[" + string(faction_leader[diplomacy]) + " is the scourge of many sectors, a colossal green brute infamous for the destruction of dozens of worlds. His name is synonymous with extended campaigns of looting and senseless violence, even more so than the other members of his barbaric race. He and the rest of his tribe hail from the " + string(choose("Goffs", "Blood Axes", "Bad Moons", "Death Skulls", "Death Skulls")) + " clan. He is recently arrived to the sector, bringing with him a massive invasion fleet.]]"; + diplo_text = "[[" + string(faction_leader[eFACTION.Ork]) + " is the scourge of many sectors, a colossal green brute infamous for the destruction of dozens of worlds. His name is synonymous with extended campaigns of looting and senseless violence, even more so than the other members of his barbaric race. He and the rest of his tribe hail from the " + string(choose("Goffs", "Blood Axes", "Bad Moons", "Death Skulls", "Death Skulls")) + " clan. He is recently arrived to the sector, bringing with him a massive invasion fleet.]]"; diplo_text += "\n#"; if (rando == 1) { - diplo_text += "I've got good news, humie! " + string(faction_leader[diplomacy]) + " is da warboss now! An' ya know wot dat means? It means yer krumped! Krumped good an' well, just as soon as me Mekboys get dis piece o junk movin'. Thaz right! Get ready fer a foight, humies; me an' da boyz'll be antsy when we gets there, and it'd be downroight inhorspitotalibile not to give us a good one!"; + diplo_text += "I've got good news, humie! " + string(faction_leader[eFACTION.Ork]) + " is da warboss now! An' ya know wot dat means? It means yer krumped! Krumped good an' well, just as soon as me Mekboys get dis piece o junk movin'. Thaz right! Get ready fer a foight, humies; me an' da boyz'll be antsy when we gets there, and it'd be downroight inhorspitotalibile not to give us a good one!"; } if (rando == 2) { - diplo_text += "Tasty humie worldz. All dat loot. All dat MEAT. By Gork an Mork, we's gonna smash it all up wiv an ax, burn it to da ground and have a proppa meal! " + string(faction_leader[diplomacy]) + " is da warboss now, and I's commin for you humie! Git ready for da WWWAAAGGGGGGGGGGHHHHHHH!"; + diplo_text += "Tasty humie worldz. All dat loot. All dat MEAT. By Gork an Mork, we's gonna smash it all up wiv an ax, burn it to da ground and have a proppa meal! " + string(faction_leader[eFACTION.Ork]) + " is da warboss now, and I's commin for you humie! Git ready for da WWWAAAGGGGGGGGGGHHHHHHH!"; } } if (diplo_keyphrase == "hello") { @@ -3616,11 +3616,11 @@ function scr_dialogue(diplo_keyphrase, data = {}) { if (trading_artifact == 1) { diplo_text = ""; } - annoyed[diplomacy] += 2; - if (annoyed[diplomacy] >= 6) { + annoyed[eFACTION.Ork] += 2; + if (annoyed[eFACTION.Ork] >= 6) { diplo_text += "You'ze wasting my time."; force_goodbye = 1; - turns_ignored[diplomacy] = max(turns_ignored[diplomacy], 4); + turns_ignored[eFACTION.Ork] = max(turns_ignored[eFACTION.Ork], 4); diplo_last = string(diplo_keyphrase); diplo_char = 0; diplo_alpha = 0; @@ -3670,12 +3670,12 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "declare_war") { force_goodbye = 1; - turns_ignored[diplomacy] += 4; + turns_ignored[eFACTION.Ork] += 4; diplo_text = "Me boyz ain't fought anyone for... at least half a zoggin' hour! It's skrapping time and may da best ork win!"; } if (diplo_keyphrase == "denounced") { if (faction_justmet == 1) { - disposition[diplomacy] -= 5; + disposition[eFACTION.Ork] -= 5; faction_justmet = 0; } if (rela == "friendly") { @@ -3753,11 +3753,11 @@ function scr_dialogue(diplo_keyphrase, data = {}) { diplo_text = "Quick ta turn tail and kiss arse, ain't ya? It wun't help."; } if (rando == 3) { - diplo_text = string(faction_leader[diplomacy]) + " dun't like be called names by ‘umies, not even good ones."; + diplo_text = string(faction_leader[eFACTION.Ork]) + " dun't like be called names by ‘umies, not even good ones."; } } if (faction_justmet == 1) { - disposition[diplomacy] += 5; + disposition[eFACTION.Ork] += 5; faction_justmet = 0; } } @@ -3863,14 +3863,14 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } // ** Tau ** - if (diplomacy == 8) { + if (diplomacy == eFACTION.Tau) { if (diplo_keyphrase == "intro") { rando = choose(1, 2); if (rando == 1) { - tempd = "[[Tall and slender, its skin is blue and clammy-looking. Disgusting. Its face contains two large, expressionless eyes, a slit-like mouth, and a bizarre I-shaped gash between its eyes that must function as a nose. So this is " + string(faction_title[8]) + " " + string(faction_leader[eFACTION.Tau]) + ". This particular xenos is said to " + choose("have quite the silver tongue", "have negotiated the surrender of many Imperial worlds", "have a great deal of military backing.") + ".]]"; + tempd = "[[Tall and slender, its skin is blue and clammy-looking. Disgusting. Its face contains two large, expressionless eyes, a slit-like mouth, and a bizarre I-shaped gash between its eyes that must function as a nose. So this is " + string(faction_title[eFACTION.Tau]) + " " + string(faction_leader[eFACTION.Tau]) + ". This particular xenos is said to " + choose("have quite the silver tongue", "have negotiated the surrender of many Imperial worlds", "have a great deal of military backing.") + ".]]"; } if (rando == 2) { - tempd = "[[Tall and slender, its skin is a light blue and looks almost reptilian. A Y-shaped slit nestles between its eyes, and a mouth like a slit sits below that. This must be " + string(faction_title[8]) + " " + string(faction_leader[eFACTION.Tau]) + ". The Ordo Xenos tells us that this particular xeno " + choose("can sense weakness in a rock", "knows more than it will let on", "uses its words like a scalpel") + ".]]"; + tempd = "[[Tall and slender, its skin is a light blue and looks almost reptilian. A Y-shaped slit nestles between its eyes, and a mouth like a slit sits below that. This must be " + string(faction_title[eFACTION.Tau]) + " " + string(faction_leader[eFACTION.Tau]) + ". The Ordo Xenos tells us that this particular xeno " + choose("can sense weakness in a rock", "knows more than it will let on", "uses its words like a scalpel") + ".]]"; } tempd += "\n#"; rando = choose(1, 2); @@ -4020,7 +4020,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "declare_war") { force_goodbye = 1; - turns_ignored[diplomacy] += 4; + turns_ignored[eFACTION.Tau] += 4; diplo_text = "We have attempted diplomacy, Chapter Master. Time and again, Tau ambassadors have contacted your Imperium with peaceful intentions... and time and again they have been betrayed. No more. It is war, Space Marine. Surrender, or face the fury of those who dream of a Greater Good!"; } if (diplo_keyphrase == "accept_peace") { @@ -4031,7 +4031,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "denounced") { if (faction_justmet == 1) { - disposition[diplomacy] -= 2; + disposition[eFACTION.Tau] -= 2; faction_justmet = 0; } rando = choose(1, 2, 3); @@ -4073,7 +4073,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "praised") { if (faction_justmet == 1) { - disposition[diplomacy] += 4; + disposition[eFACTION.Tau] += 4; faction_justmet = 0; } rando = choose(1, 2, 3); diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 1a05acc620..060c36b674 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -528,7 +528,7 @@ function scr_enemy_ai_a() { obj_controller.disposition[3] -= 5; // obj_controller.disposition[3] refer to the disposition of the toaster jocks. } else if (planet_feature_bool(p_feature[_run], P_features.Sororitas_Cathedral) or(p_type[_run] == "Shrine")) { dispo[_run] -= 10; // diso[_run] is the disposition of the planet. where _run refer to the planet that is currently running the code. - obj_controller.disposition[5] -= 3; // obj_controller.disposition[2] refer to the disposition of the sororitas while 3 refer to mechanicus + obj_controller.disposition[5] -= 3; // obj_controller.disposition[eFACTION.Imperium] refer to the disposition of the sororitas while 3 refer to mechanicus } else dispo[_run] -= 5; } } // diso[_run] is the disposition of the planet. where _run refer to the planet that is currently running the code. diff --git a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml index 974fb2790c..a98646b944 100644 --- a/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml +++ b/scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml @@ -133,7 +133,7 @@ function scr_enemy_ai_d() { scr_event_log("","Fleet embarks upon Crusade."); }else { // hit loyalty here - obj_controller.disposition[2]-=5; + obj_controller.disposition[eFACTION.Imperium]-=5; obj_controller.disposition[4]-=10; scr_alert("red","crusade","No ships designated for Crusade.",x,y); scr_loyalty("Refusing to Crusade","+"); diff --git a/scripts/scr_event_code/scr_event_code.gml b/scripts/scr_event_code/scr_event_code.gml index 66062a55f9..0771911e76 100644 --- a/scripts/scr_event_code/scr_event_code.gml +++ b/scripts/scr_event_code/scr_event_code.gml @@ -272,17 +272,17 @@ function handle_discovered_governor_assasinations() { if (_event.variant == 1) { alter_dispositions([[eFACTION.Imperium, -7], [eFACTION.Inquisition, -10], [eFACTION.Ecclesiarchy, -5]]); - if (obj_controller.disposition[4] > 0 && obj_controller.disposition[2] > 0) { + if (obj_controller.disposition[4] > 0 && obj_controller.disposition[eFACTION.Imperium] > 0) { _event.e_id = "assassination_angryish"; } } else if (_event.variant == 2) { alter_disposition(eFACTION.Inquisition, -3); - if (obj_controller.disposition[4] > 0 && obj_controller.disposition[2] > 0) { + if (obj_controller.disposition[4] > 0 && obj_controller.disposition[eFACTION.Imperium] > 0) { _event.e_id = "assassination_angry"; } } - if ((obj_controller.disposition[4] <= 0) || (obj_controller.disposition[2] <= 0)) { + if ((obj_controller.disposition[4] <= 0) || (obj_controller.disposition[eFACTION.Imperium] <= 0)) { obj_controller.alarm[8] = 1; } else { scr_audience(4, _event.e_id, 0, "", 0, 0, _event); diff --git a/scripts/scr_event_gossip/scr_event_gossip.gml b/scripts/scr_event_gossip/scr_event_gossip.gml index 2e7f7d9645..a480329007 100644 --- a/scripts/scr_event_gossip/scr_event_gossip.gml +++ b/scripts/scr_event_gossip/scr_event_gossip.gml @@ -43,15 +43,15 @@ function scr_event_gossip(argument0) { with(obj_ground_mission){instance_destroy();}with(obj_star){if (owner = eFACTION.Chaos) then instance_create(x,y,obj_ground_mission);} if (instance_number(obj_ground_mission)>=8){p+=1;gossip[p]="chaos_numbers";}with(obj_ground_mission){instance_destroy();} - if (obj_controller.faction_status[eFACTION.Inquisition]!="War") and (obj_controller.disposition[4]<=25){p+=1;gossip[p]="low_dispo_inqi";} - if (obj_controller.faction_status[eFACTION.Imperium]!="War") and (obj_controller.disposition[2]<=25){p+=1;gossip[p]="low_dispo_impe";} - if (obj_controller.faction_status[eFACTION.Mechanicus]!="War") and (obj_controller.disposition[3]<=25){p+=1;gossip[p]="low_dispo_mech";} - - if (obj_controller.known[eFACTION.Eldar]>0) and (obj_controller.faction_defeated[6]=0) and (obj_controller.faction_status[eFACTION.Eldar]!="Allied"){p+=1;gossip[p]="smack_talk_eldar";} - if (obj_controller.known[eFACTION.Ork]>0) and (obj_controller.faction_defeated[7]=0) and (obj_controller.faction_status[eFACTION.Ork]!="Allied"){p+=1;gossip[p]="smack_talk_orks";} - if (obj_controller.known[eFACTION.Tau]>0) and (obj_controller.faction_defeated[8]=0) and (obj_controller.faction_status[eFACTION.Tau]!="Allied"){p+=1;gossip[p]="smack_talk_tau";} - if (obj_controller.known[eFACTION.Tyranids]>0) and (obj_controller.faction_defeated[9]=0) and (obj_controller.faction_status[eFACTION.Tyranids]!="Allied"){p+=1;gossip[p]="smack_talk_tyranids";} - if (obj_controller.known[eFACTION.Chaos]>0) and (obj_controller.faction_defeated[10]=0) and (obj_controller.faction_status[eFACTION.Chaos]!="Allied"){p+=1;gossip[p]="smack_talk_chaos";} + if (obj_controller.faction_status[eFACTION.Inquisition]!="War") and (obj_controller.disposition[eFACTION.Inquisition]<=25){p+=1;gossip[p]="low_dispo_inqi";} + if (obj_controller.faction_status[eFACTION.Imperium]!="War") and (obj_controller.disposition[eFACTION.Imperium]<=25){p+=1;gossip[p]="low_dispo_impe";} + if (obj_controller.faction_status[eFACTION.Mechanicus]!="War") and (obj_controller.disposition[eFACTION.Mechanicus]<=25){p+=1;gossip[p]="low_dispo_mech";} + + if (obj_controller.known[eFACTION.Eldar]>0) and (obj_controller.faction_defeated[eFACTION.Eldar]=0) and (obj_controller.faction_status[eFACTION.Eldar]!="Allied"){p+=1;gossip[p]="smack_talk_eldar";} + if (obj_controller.known[eFACTION.Ork]>0) and (obj_controller.faction_defeated[eFACTION.Ork]=0) and (obj_controller.faction_status[eFACTION.Ork]!="Allied"){p+=1;gossip[p]="smack_talk_orks";} + if (obj_controller.known[eFACTION.Tau]>0) and (obj_controller.faction_defeated[eFACTION.Tau]=0) and (obj_controller.faction_status[eFACTION.Tau]!="Allied"){p+=1;gossip[p]="smack_talk_tau";} + if (obj_controller.known[eFACTION.Tyranids]>0) and (obj_controller.faction_defeated[eFACTION.Tyranids]=0) and (obj_controller.faction_status[eFACTION.Tyranids]!="Allied"){p+=1;gossip[p]="smack_talk_tyranids";} + if (obj_controller.known[eFACTION.Chaos]>0) and (obj_controller.faction_defeated[eFACTION.Chaos]=0) and (obj_controller.faction_status[eFACTION.Chaos]!="Allied"){p+=1;gossip[p]="smack_talk_chaos";} // All of the custom ones above // Recent events below diff --git a/scripts/scr_imperial_manage_fleet_functions/scr_imperial_manage_fleet_functions.gml b/scripts/scr_imperial_manage_fleet_functions/scr_imperial_manage_fleet_functions.gml index c8c9c6d565..320f4a7812 100644 --- a/scripts/scr_imperial_manage_fleet_functions/scr_imperial_manage_fleet_functions.gml +++ b/scripts/scr_imperial_manage_fleet_functions/scr_imperial_manage_fleet_functions.gml @@ -117,7 +117,7 @@ function deploy_colonisers(star){ scr_alert("green","duhuhuhu",$"Imperial citizens recolonize {planet_numeral_name(r, star)} I.",star.x,star.y); - star.dispo[r]=min(obj_ini.imperium_disposition,obj_controller.disposition[2])+irandom_range(-4,4); + star.dispo[r]=min(obj_ini.imperium_disposition,obj_controller.disposition[eFACTION.Imperium])+irandom_range(-4,4); if (star.name=obj_ini.home_name) and (star.p_type[r]=obj_ini.home_type) and (obj_controller.homeworld_rule!=1) then star.dispo[r]=-5000; } } diff --git a/scripts/scr_initialize_custom/scr_initialize_custom.gml b/scripts/scr_initialize_custom/scr_initialize_custom.gml index 0b4f699a9c..b51ee44109 100644 --- a/scripts/scr_initialize_custom/scr_initialize_custom.gml +++ b/scripts/scr_initialize_custom/scr_initialize_custom.gml @@ -729,10 +729,10 @@ function scr_initialize_custom() { man_size = 0; psy_powers = obj_creation.discipline; - progenitor_disposition = obj_creation.disposition[1]; + progenitor_disposition = obj_creation.disposition[eFACTION.Player]; astartes_disposition = obj_creation.disposition[6]; - imperium_disposition = obj_creation.disposition[2]; - guard_disposition = obj_creation.disposition[2]; + imperium_disposition = obj_creation.disposition[eFACTION.Imperium]; + guard_disposition = obj_creation.disposition[eFACTION.Imperium]; inquisition_disposition = obj_creation.disposition[4]; ecclesiarchy_disposition = obj_creation.disposition[5]; mechanicus_disposition = obj_creation.disposition[3]; diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index fa76c450e9..a3c7922d80 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -702,8 +702,8 @@ function ground_forces_collect_artifact() { scr_event_log("", "Artifact has been forcibly recovered."); if (pdata.planet_type != "Dead") { - if (pdata.current_owner == 2) { - obj_controller.disposition[2] -= 1; + if (pdata.current_owner == eFACTION.Imperium) { + obj_controller.disposition[eFACTION.Imperium] -= 1; } if (pdata.current_owner == eFACTION.Mechanicus) { obj_controller.disposition[3] -= 10; @@ -724,8 +724,8 @@ function ground_forces_collect_artifact() { pop.text += $"It has been stowed away upon {loc}. It appears to be a " + string(obj_ini.artifact[last_artifact]) + " but should be brought home and identified posthaste."; scr_event_log("red", "Artifact forcibly recovered. Collateral damage is caused."); - if (pdata.current_owner == 2) { - obj_controller.disposition[2] -= 2; + if (pdata.current_owner == eFACTION.Imperium) { + obj_controller.disposition[eFACTION.Imperium] -= 2; } if (pdata.current_owner == eFACTION.Mechanicus) { obj_controller.disposition[3] -= max(obj_controller.disposition[3] / 3, 20); @@ -901,7 +901,7 @@ function remove_stc_from_planet() { pop.text += "The STC Fragment has been safely recovered and stowed away. It is ready to be decrypted or gifted at your convenience."; /*if (pdata.planet_type!="Dead"){ - if (pdata.current_owner=2) then obj_controller.disposition[2]-=1; + if (pdata.current_owner=2) then obj_controller.disposition[eFACTION.Imperium]-=1; if (pdata.current_owner=eFACTION.Mechanicus) then obj_controller.disposition[3]-=10;// max(obj_controller.disposition/4,10) if (pdata.current_owner=4) then obj_controller.disposition[4]-=max(obj_controller.disposition[4]/4,10); if (pdata.current_owner=5) then obj_controller.disposition[5]-=3; @@ -919,7 +919,7 @@ function remove_stc_from_planet() { pop.text = "Your forces descend into the vaults of the Mechanicus Forge. Sentries, automated defenses, and blast doors stand in their way.##"; pop.text += "Half-way through the mission a small army of Praetorian Servitors and Skitarii bear down upon your men. The Mechanicus guards seem to be upset."; - /*if (pdata.current_owner=2) then obj_controller.disposition[2]-=2;*/ + /*if (pdata.current_owner=2) then obj_controller.disposition[eFACTION.Imperium]-=2;*/ if (pdata.current_owner == eFACTION.Mechanicus) { obj_controller.disposition[3] -= 40; } diff --git a/scripts/scr_popup_functions/scr_popup_functions.gml b/scripts/scr_popup_functions/scr_popup_functions.gml index 7a27c8dccf..4766ba13ef 100644 --- a/scripts/scr_popup_functions/scr_popup_functions.gml +++ b/scripts/scr_popup_functions/scr_popup_functions.gml @@ -613,7 +613,7 @@ function default_popup_image_index(){ function allow_governor_successor(){ var randa = roll_dice_chapter(1, 100, "high"); var randa2 = roll_dice(1, 100); - p_data.set_player_disposition(obj_controller.disposition[2] + choose(-1, -2, -3, -4, 0, 1, 2, 3, 4)); + p_data.set_player_disposition(obj_controller.disposition[eFACTION.Imperium] + choose(-1, -2, -3, -4, 0, 1, 2, 3, 4)); var _text_last = ""; if (randa <= 3) { diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index c7d3ad3fee..22544ecfdd 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -452,7 +452,7 @@ function meet_system_governors(system){ with (system){ for (var i=1;i<=planets;i++){ if (p_first[i]<=5) and (dispo[i]>-30) and (dispo[i]<0){ - dispo[i]=min(obj_ini.imperium_disposition,obj_controller.disposition[2])+irandom(8)-4; + dispo[i]=min(obj_ini.imperium_disposition,obj_controller.disposition[eFACTION.Imperium])+irandom(8)-4; } } diff --git a/scripts/scr_trade/scr_trade.gml b/scripts/scr_trade/scr_trade.gml index 9387627ca0..ee505a5629 100644 --- a/scripts/scr_trade/scr_trade.gml +++ b/scripts/scr_trade/scr_trade.gml @@ -3,7 +3,7 @@ function TradeAttempt(diplomacy) constructor { relative_trade_values = { "Test": 5000, "Requisition": 1, - "Recruiting Planet": obj_controller.disposition[2] < 70 ? 4000 : 2000, + "Recruiting Planet": obj_controller.disposition[eFACTION.Imperium] < 70 ? 4000 : 2000, "License: Repair": 750, "License: Crusade": 1500, "Terminator Armour": 400, From 43abec9e86be39167a516faf2dbab334b954d72f Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sun, 28 Dec 2025 10:25:31 -0500 Subject: [PATCH 38/45] The omega lint push. --- objects/obj_creation/Alarm_0.gml | 90 +- objects/obj_creation/Alarm_1.gml | 16 +- objects/obj_creation/Create_0.gml | 150 +- objects/obj_creation/Draw_0.gml | 1557 ++-- objects/obj_creation/Step_0.gml | 445 +- objects/obj_en_fleet/Alarm_1.gml | 709 +- objects/obj_en_fleet/Alarm_11.gml | 9 +- objects/obj_en_fleet/Alarm_4.gml | 218 +- objects/obj_en_fleet/Alarm_5.gml | 30 +- objects/obj_en_fleet/Alarm_8.gml | 12 +- .../obj_en_fleet/Collision_obj_en_fleet.gml | 26 +- objects/obj_en_fleet/Collision_obj_pnunit.gml | 8 +- objects/obj_en_fleet/Create_0.gml | 180 +- objects/obj_en_fleet/Destroy_0.gml | 27 +- objects/obj_en_fleet/Draw_0.gml | 210 +- objects/obj_en_fleet/KeyPress_73.gml | 2 - objects/obj_en_fleet/Step_0.gml | 247 +- objects/obj_ground_mission/Alarm_0.gml | 7 +- objects/obj_ground_mission/Alarm_5.gml | 185 +- objects/obj_ground_mission/Alarm_7.gml | 3 - objects/obj_ground_mission/Create_0.gml | 19 +- objects/obj_ncombat/Alarm_0.gml | 6257 +++++++++-------- objects/obj_ncombat/Alarm_1.gml | 1114 ++- objects/obj_ncombat/Alarm_2.gml | 29 +- objects/obj_ncombat/Alarm_3.gml | 342 +- objects/obj_ncombat/Alarm_4.gml | 25 +- objects/obj_ncombat/Alarm_5.gml | 940 +-- objects/obj_ncombat/Alarm_6.gml | 5 +- objects/obj_ncombat/Alarm_7.gml | 843 ++- objects/obj_ncombat/Alarm_8.gml | 63 +- objects/obj_ncombat/Create_0.gml | 644 +- objects/obj_ncombat/Draw_0.gml | 126 +- objects/obj_ncombat/KeyPress_13.gml | 365 +- objects/obj_ncombat/KeyPress_67.gml | 11 +- objects/obj_ncombat/Step_0.gml | 172 +- objects/obj_popup/Alarm_0.gml | 54 +- objects/obj_popup/Create_0.gml | 499 +- objects/obj_popup/Destroy_0.gml | 135 +- objects/obj_popup/Draw_0.gml | 1 - objects/obj_popup/Draw_64.gml | 274 +- objects/obj_popup/Keyboard_13.gml | 57 +- objects/obj_popup/Keyboard_32.gml | 53 +- objects/obj_popup/Mouse_51.gml | 15 +- objects/obj_popup/Mouse_60.gml | 17 +- objects/obj_popup/Mouse_61.gml | 16 +- objects/obj_popup/Step_0.gml | 924 ++- objects/obj_star/Mouse_50.gml | 4 +- scripts/scr_PlanetData/scr_PlanetData.gml | 19 +- .../scr_chapter_random/scr_chapter_random.gml | 2058 +++--- scripts/scr_cheatcode/scr_cheatcode.gml | 72 +- scripts/scr_demand/scr_demand.gml | 774 +- scripts/scr_dialogue/scr_dialogue.gml | 455 +- scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml | 2131 +++--- scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml | 797 ++- scripts/scr_event_code/scr_event_code.gml | 22 +- scripts/scr_event_gossip/scr_event_gossip.gml | 818 ++- .../scr_imperial_manage_fleet_functions.gml | 122 +- .../scr_initialize_custom.gml | 5813 ++++++++------- .../scr_planetary_feature.gml | 50 +- .../scr_popup_functions.gml | 1023 ++- scripts/scr_random_event/scr_random_event.gml | 5 +- .../scr_system_search_helpers.gml | 823 ++- scripts/scr_trade/scr_trade.gml | 46 +- scripts/scr_void_click/scr_void_click.gml | 119 +- 64 files changed, 16758 insertions(+), 15524 deletions(-) diff --git a/objects/obj_creation/Alarm_0.gml b/objects/obj_creation/Alarm_0.gml index 38915d1e7b..b4c513bf31 100644 --- a/objects/obj_creation/Alarm_0.gml +++ b/objects/obj_creation/Alarm_0.gml @@ -1,72 +1,38 @@ - shader_reset(); - colour_to_find1 = shader_get_uniform(sReplaceColor, "f_Colour1"); - colour_to_set1 = shader_get_uniform(sReplaceColor, "f_Replace1"); - body_colour_find=[0/255,0/255,255/255]; - body_colour_replace=[ - col_r[main_color]/255, - col_g[main_color]/255, - col_b[main_color]/255, - - ] - - colour_to_find2 = shader_get_uniform(sReplaceColor, "f_Colour2"); - colour_to_set2 = shader_get_uniform(sReplaceColor, "f_Replace2"); - secondary_colour_find=[255/255,0/255,0/255]; - secondary_colour_replace=[ - col_r[secondary_color]/255, - col_g[secondary_color]/255, - col_b[secondary_color]/255, - - ]; - - colour_to_find3 = shader_get_uniform(sReplaceColor, "f_Colour3"); - colour_to_set3 = shader_get_uniform(sReplaceColor, "f_Replace3"); - - pauldron_colour_find=[255/255,255/255,0/255]; - pauldron_colour_replace=[ - col_r[right_pauldron]/255, - col_g[right_pauldron]/255, - col_b[right_pauldron]/255, +colour_to_find1 = shader_get_uniform(sReplaceColor, "f_Colour1"); +colour_to_set1 = shader_get_uniform(sReplaceColor, "f_Replace1"); +body_colour_find = [0 / 255, 0 / 255, 255 / 255]; +body_colour_replace = [col_r[main_color] / 255, col_g[main_color] / 255, col_b[main_color] / 255]; - ]; +colour_to_find2 = shader_get_uniform(sReplaceColor, "f_Colour2"); +colour_to_set2 = shader_get_uniform(sReplaceColor, "f_Replace2"); +secondary_colour_find = [255 / 255, 0 / 255, 0 / 255]; +secondary_colour_replace = [col_r[secondary_color] / 255, col_g[secondary_color] / 255, col_b[secondary_color] / 255]; - colour_to_find4 = shader_get_uniform(sReplaceColor, "f_Colour4"); - colour_to_set4 = shader_get_uniform(sReplaceColor, "f_Replace4"); - lens_colour_find=[0/255,255/255,0/255]; - lens_colour_replace=[ - col_r[lens_color]/255, - col_g[lens_color]/255, - col_b[lens_color]/255, +colour_to_find3 = shader_get_uniform(sReplaceColor, "f_Colour3"); +colour_to_set3 = shader_get_uniform(sReplaceColor, "f_Replace3"); - ]; +pauldron_colour_find = [255 / 255, 255 / 255, 0 / 255]; +pauldron_colour_replace = [col_r[right_pauldron] / 255, col_g[right_pauldron] / 255, col_b[right_pauldron] / 255]; - colour_to_find5 = shader_get_uniform(sReplaceColor, "f_Colour5"); - colour_to_set5 = shader_get_uniform(sReplaceColor, "f_Replace5"); - trim_colour_find=[255/255,0/255,255/255]; - trim_colour_replace=[ - col_r[main_trim]/255, - col_g[main_trim]/255, - col_b[main_trim]/255, - ]; +colour_to_find4 = shader_get_uniform(sReplaceColor, "f_Colour4"); +colour_to_set4 = shader_get_uniform(sReplaceColor, "f_Replace4"); +lens_colour_find = [0 / 255, 255 / 255, 0 / 255]; +lens_colour_replace = [col_r[lens_color] / 255, col_g[lens_color] / 255, col_b[lens_color] / 255]; - colour_to_find6 = shader_get_uniform(sReplaceColor, "f_Colour6"); - colour_to_set6 = shader_get_uniform(sReplaceColor, "f_Replace6"); - pauldron2_colour_find=[250/255,250/255,250/255]; - pauldron2_colour_replace=[ - col_r[left_pauldron]/255, - col_g[left_pauldron]/255, - col_b[left_pauldron]/255, +colour_to_find5 = shader_get_uniform(sReplaceColor, "f_Colour5"); +colour_to_set5 = shader_get_uniform(sReplaceColor, "f_Replace5"); +trim_colour_find = [255 / 255, 0 / 255, 255 / 255]; +trim_colour_replace = [col_r[main_trim] / 255, col_g[main_trim] / 255, col_b[main_trim] / 255]; - ]; +colour_to_find6 = shader_get_uniform(sReplaceColor, "f_Colour6"); +colour_to_set6 = shader_get_uniform(sReplaceColor, "f_Replace6"); +pauldron2_colour_find = [250 / 255, 250 / 255, 250 / 255]; +pauldron2_colour_replace = [col_r[left_pauldron] / 255, col_g[left_pauldron] / 255, col_b[left_pauldron] / 255]; - colour_to_find7 = shader_get_uniform(sReplaceColor, "f_Colour7"); - colour_to_set7 = shader_get_uniform(sReplaceColor, "f_Replace7"); +colour_to_find7 = shader_get_uniform(sReplaceColor, "f_Colour7"); +colour_to_set7 = shader_get_uniform(sReplaceColor, "f_Replace7"); - weapon_colour_find=[0/255,255/255,255/255]; - weapon_colour_replace=[ - col_r[weapon_color]/255, - col_g[weapon_color]/255, - col_b[weapon_color]/255, - ]; +weapon_colour_find = [0 / 255, 255 / 255, 255 / 255]; +weapon_colour_replace = [col_r[weapon_color] / 255, col_g[weapon_color] / 255, col_b[weapon_color] / 255]; diff --git a/objects/obj_creation/Alarm_1.gml b/objects/obj_creation/Alarm_1.gml index 696fe2c16c..1c5eba32c9 100644 --- a/objects/obj_creation/Alarm_1.gml +++ b/objects/obj_creation/Alarm_1.gml @@ -1,16 +1,16 @@ // Sets up fullscreen or windowed action_set_alarm(30, 1); -window_old=window_data; -window_data=string(window_get_x())+"|"+string(window_get_y())+"|"+string(window_get_width())+"|"+string(window_get_height())+"|"; -if (window_get_fullscreen()==1){ - window_old="fullscreen"; - window_data="fullscreen"; +window_old = window_data; +window_data = string(window_get_x()) + "|" + string(window_get_y()) + "|" + string(window_get_width()) + "|" + string(window_get_height()) + "|"; +if (window_get_fullscreen() == 1) { + window_old = "fullscreen"; + window_data = "fullscreen"; } -if (window_data!="fullscreen") and (window_get_fullscreen()=0){ - if (window_data!=window_old){ +if ((window_data != "fullscreen") && (window_get_fullscreen() == 0)) { + if (window_data != window_old) { ini_open("saves.ini"); - ini_write_string("Settings","window_data",string(window_get_x())+"|"+string(window_get_y())+"|"+string(window_get_width())+"|"+string(window_get_height())+"|"); + ini_write_string("Settings", "window_data", string(window_get_x()) + "|" + string(window_get_y()) + "|" + string(window_get_width()) + "|" + string(window_get_height()) + "|"); ini_close(); } } diff --git a/objects/obj_creation/Create_0.gml b/objects/obj_creation/Create_0.gml index 31255ea45e..635fe0ee29 100644 --- a/objects/obj_creation/Create_0.gml +++ b/objects/obj_creation/Create_0.gml @@ -120,153 +120,19 @@ draw_helms = true; var _culture_styles_array = []; for (var i = 0; i < array_length(global.culture_styles); i++) { - array_push(_culture_styles_array, { - str1: global.culture_styles[i], - font: fnt_40k_14b, - }); + array_push(_culture_styles_array, {str1: global.culture_styles[i], font: fnt_40k_14b}); } buttons = { home_world_recruit_share: new ToggleButton(), - complex_homeworld: new ToggleButton({ - x1: 550, - y1: 422, - active: false, - str1: "Spawn System Options", - tooltip: "Click for Complex Spawn System Options", - button_color: CM_GREEN_COLOR, - }), - home_spawn_loc_options: new RadioSet( - [ - { - str1: "Fringe", - font: fnt_40k_30b, - tooltip: "Your home system sits at the edge of the sector", - }, - { - str1: "Central", - font: fnt_40k_30b, - tooltip: "Your home system is relativly central in the sector", - } - ], - "Home Spwan\nLocation" - ), - recruit_home_relationship: new RadioSet( - [ - { - str1: "Share Planet", - font: fnt_40k_14b, - tooltip: "Your recruit world will be the same planet as your home world", - }, - { - str1: "Share System", - font: fnt_40k_14b, - tooltip: "Your recruit world will be in the the same system as your home world", - }, - { - str1: "Seperate", - font: fnt_40k_14b, - tooltip: "Your recruit world will be in a different system to your homeworld", - } - ], - "Recruit world" - ), - home_warp: new RadioSet( - [ - { - str1: "Secluded", - font: fnt_40k_14b, - tooltip: "Your home system is logistically secluded with no major warp routes", - }, - { - str1: "Connected", - font: fnt_40k_14b, - tooltip: "Your home system is connected to the larger imperium and system by warp routes", - }, - { - str1: "Warp Hub", - font: fnt_40k_14b, - tooltip: "Your home system is in a very stable warp area, accessible by several warp lanes", - } - ], - "Home warp access" - ), - home_planets: new RadioSet( - [ - { - str1: "one", - font: fnt_40k_14b, - }, - { - str1: "two", - font: fnt_40k_14b, - }, - { - str1: "three", - font: fnt_40k_14b, - }, - { - str1: "four", - font: fnt_40k_14b, - } - ], - "Home System Planets" - ), + complex_homeworld: new ToggleButton({x1: 550, y1: 422, active: false, str1: "Spawn System Options", tooltip: "Click for Complex Spawn System Options", button_color: CM_GREEN_COLOR}), + home_spawn_loc_options: new RadioSet([{str1: "Fringe", font: fnt_40k_30b, tooltip: "Your home system sits at the edge of the sector"}, {str1: "Central", font: fnt_40k_30b, tooltip: "Your home system is relativly central in the sector"}], "Home Spwan\nLocation"), + recruit_home_relationship: new RadioSet([{str1: "Share Planet", font: fnt_40k_14b, tooltip: "Your recruit world will be the same planet as your home world"}, {str1: "Share System", font: fnt_40k_14b, tooltip: "Your recruit world will be in the the same system as your home world"}, {str1: "Seperate", font: fnt_40k_14b, tooltip: "Your recruit world will be in a different system to your homeworld"}], "Recruit world"), + home_warp: new RadioSet([{str1: "Secluded", font: fnt_40k_14b, tooltip: "Your home system is logistically secluded with no major warp routes"}, {str1: "Connected", font: fnt_40k_14b, tooltip: "Your home system is connected to the larger imperium and system by warp routes"}, {str1: "Warp Hub", font: fnt_40k_14b, tooltip: "Your home system is in a very stable warp area, accessible by several warp lanes"}], "Home warp access"), + home_planets: new RadioSet([{str1: "one", font: fnt_40k_14b}, {str1: "two", font: fnt_40k_14b}, {str1: "three", font: fnt_40k_14b}, {str1: "four", font: fnt_40k_14b}], "Home System Planets"), culture_styles: new MultiSelect(_culture_styles_array, "Chapter Visual Styles"), - company_liveries_choice: new RadioSet( - [ - { - str1: "HQ", - font: fnt_40k_14b, - }, - { - str1: "I", - font: fnt_40k_14b, - }, - { - str1: "II", - font: fnt_40k_14b, - }, - { - str1: "III", - font: fnt_40k_14b, - }, - { - str1: "IV", - font: fnt_40k_14b, - }, - { - str1: "V", - font: fnt_40k_14b, - }, - { - str1: "VI", - font: fnt_40k_14b, - }, - { - str1: "VII", - font: fnt_40k_14b, - }, - { - str1: "VIII", - font: fnt_40k_14b, - }, - { - str1: "IX", - font: fnt_40k_14b, - }, - { - str1: "X", - font: fnt_40k_14b, - } - ], - "Companies" - ), - livery_switch: new UnitButtonObject({ - x1: 570, - y1: 215, - label: "Simple Livery", - }), + company_liveries_choice: new RadioSet([{str1: "HQ", font: fnt_40k_14b}, {str1: "I", font: fnt_40k_14b}, {str1: "II", font: fnt_40k_14b}, {str1: "III", font: fnt_40k_14b}, {str1: "IV", font: fnt_40k_14b}, {str1: "V", font: fnt_40k_14b}, {str1: "VI", font: fnt_40k_14b}, {str1: "VII", font: fnt_40k_14b}, {str1: "VIII", font: fnt_40k_14b}, {str1: "IX", font: fnt_40k_14b}, {str1: "X", font: fnt_40k_14b}], "Companies"), + livery_switch: new UnitButtonObject({x1: 570, y1: 215, label: "Simple Livery"}), }; with (buttons) { diff --git a/objects/obj_creation/Draw_0.gml b/objects/obj_creation/Draw_0.gml index 8cf43512bf..e87f61a864 100644 --- a/objects/obj_creation/Draw_0.gml +++ b/objects/obj_creation/Draw_0.gml @@ -1,790 +1,781 @@ - add_draw_return_values(); draw_set_valign(fa_top); try { - //read - // 850,860 - - var xx, yy; - xx = 375; - yy = 10; - - tooltip = ""; - tooltip2 = ""; - draw_set_alpha(1); - // draw_sprite(spr_creation_slate,0,xx,yy); - scr_image("creation/slate", 1, xx, yy, 850, 860); - draw_set_alpha(1 - (slate1 / 30)); - // draw_sprite(spr_creation_slate,1,xx,yy); - scr_image("creation/slate", 2, xx, yy, 850, 860); - - draw_set_color(5998382); - if (slate2 > 0) { - if (slate2 <= 10) { - draw_set_alpha(slate2 / 10); - } - if (slate2 > 10) { - draw_set_alpha(1 - ((slate2 - 10) / 10)); - } - draw_line(xx + 30, yy + 70 + (slate2 * 36), xx + 790, yy + 70 + (slate2 * 36)); - } - if (slate3 > 0) { - if (slate3 <= 10) { - draw_set_alpha(slate3 / 10); - } - if (slate3 > 10) { - draw_set_alpha(1 - ((slate3 - 10) / 10)); - } - draw_line(xx + 30, yy + 70 + (slate3 * 36), xx + 790, yy + 70 + (slate3 * 36)); - } - - allow_colour_click = (custom == eCHAPTER_TYPE.CUSTOM) && (!instance_exists(obj_creation_popup)); - - draw_set_alpha(slate4 / 30); - if (slate4 > 0) { - /* Chapter Selection grid */ - if (slide == eCREATIONSLIDES.CHAPTERSELECT) { - draw_chapter_select() - }; - } - - var yar; - yar = 0; - - if (slide >= 2) { - tooltip = ""; - tooltip2 = ""; - - if (goto_slide != 1) { - if (custom == eCHAPTER_TYPE.CUSTOM) { - draw_sprite(spr_creation_other, 4, 0, 68); - } - if (custom == eCHAPTER_TYPE.RANDOM) { - draw_sprite(spr_creation_other, 5, 0, 68); - } - - draw_set_color(CM_GREEN_COLOR); - draw_rectangle(0, 68, 374, 781, 1); - } - - draw_set_color(0); - - var sprx = 436, spry = 74, sprw = 128, sprh = 128; - if (global.chapter_icon.sprite != -1){ - draw_sprite_stretched(global.chapter_icon.sprite, 0, sprx, spry, sprw, sprh); - } else { - // red (?) - draw_sprite_stretched(global.chapter_icons_map[? "unknown"], 0, sprx, spry, sprw, sprh); - } - - obj_cursor.image_index = 0; - if (scr_hit(436, 74, 436 + 128, 74 + 128) && (popup == "")) { - obj_cursor.image_index = 1; - tooltip = "Chapter Icon"; - tooltip2 = "Your Chapter's icon. Click to edit."; - } - - if (slide == eCREATIONSLIDES.CHAPTERTRAITS) { - var _chapter_icon; - if (founding == ePROGENITOR.NONE) { - _chapter_icon = global.chapter_icons_map[? "unknown"]; - } else if (founding == ePROGENITOR.RANDOM) { - _chapter_icon = global.chapter_icons_map[? "random"] - } else { - _chapter_icon = global.chapter_icons_map[? founding_chapters[founding - 1].icon_name]; - } - - draw_set_alpha(0.33); - draw_sprite_stretched(_chapter_icon, 0, 1164 - 128, 74, 128, 128); - draw_set_alpha(1); - - draw_set_font(fnt_40k_30b); - if (scr_hit(1164 - 128, 74, 1164, 74 + 128)) { - tooltip = "Founding Chapter"; - tooltip2 = "The parent Chapter whos Gene-Seed your own originates from."; - } - - if (custom == eCHAPTER_TYPE.CUSTOM) { - draw_sprite_stretched(spr_creation_arrow, 0, 1164 - 194, 160, 32, 32); - draw_sprite_stretched(spr_creation_arrow, 1, 1164 - 144, 160, 32, 32); - - if (scr_hit(1164 - 194, 149, 1164 - 162, 193)) { - obj_cursor.image_index = 1; - if (scr_click_left()) { - founding--; - if (founding == -1) { - founding = ePROGENITOR.RANDOM; - } - } - } - if (scr_hit(1164 - 144, 149, 1164 - 112, 193)) { - obj_cursor.image_index = 1; - if (scr_click_left()) { - founding++; - if (founding == 11) { - founding = ePROGENITOR.NONE; - } - } - } - } - } - } - - /* Chapter Naming, Points assignment, advantages/disadvantages */ - if (slide == eCREATIONSLIDES.CHAPTERTRAITS) { - draw_chapter_trait_select() - } - - /* Homeworld, Flagship, Psychic discipline, Aspirant Trial */ - - else if (slide == eCREATIONSLIDES.CHAPTERHOME){ - draw_chapter_homeworld_select() - } - - /* Livery, Roles */ - - else if (slide == eCREATIONSLIDES.CHAPTERLIVERY) { - scr_livery_setup(); - } else if (slide == eCREATIONSLIDES.CHAPTERROLES) { - scr_role_setup(); - } - - /* Gene Seed Mutations, Disposition */ - - else if (slide == eCREATIONSLIDES.CHAPTERGENE) { - draw_set_color(CM_GREEN_COLOR); - draw_set_font(fnt_40k_30b); - draw_set_halign(fa_center); - draw_set_alpha(1); - - tooltip = ""; - tooltip2 = ""; - obj_cursor.image_index = 0; - - draw_text(800, 80, string_hash_to_newline(string(chapter_name))); - - draw_set_color(CM_GREEN_COLOR); - draw_set_halign(fa_left); - draw_text_transformed(580, 118, string_hash_to_newline("Successor Chapters: " + string(successors)), 0.6, 0.6, 0); - draw_set_font(fnt_40k_14b); - - draw_rectangle(445, 200, 1125, 202, true); - - draw_set_halign(fa_center); - draw_set_font(fnt_40k_30b); - draw_text_transformed(800, 210, string_hash_to_newline("Gene-Seed Mutations"), 0.6, 0.6, 0); - if (purity == 10) { - draw_text_transformed(800, 230, $"The gene-seed is perfectly pure", 0.5, 0.5, 0); - } else { - if (mutations > mutations_selected) { - draw_text_transformed(800, 230, $"Select {mutations - mutations_selected} more, according to your purity score", 0.5, 0.5, 0); - } else { - draw_text_transformed(800, 230, $"The gene-seed is mutated enough", 0.5, 0.5, 0); - draw_set_alpha(0.5); - } - } - draw_set_halign(fa_left); - - var x1, y1, spac = 34; - - if (custom != eCHAPTER_TYPE.CUSTOM || purity == 10) { - draw_set_alpha(0.5); - } - var mutations_defects = [{ - t_tip: "Anemic Preomnor", - t_tip2: "Your Astartes lack the detoxifying gland called the Preomnor- they are more susceptible to poisons and toxins.", - data: preomnor, - mutation_points: 1 - }, { - t_tip: "Disturbing Voice", - t_tip2: "Your Astartes have a voice like a creaking door or a rumble. Decreases Imperium and Imperial Guard disposition.", - data: voice, - mutation_points: 1, - disposition: [ - [eFACTION.Imperium, -8] - ] - }, { - t_tip: "Doomed", - t_tip2: "Your Chapter cannot make more Astartes until enough research is generated. Counts as four mutations.", - data: doomed, - mutation_points: 4, - disposition: [ - [eFACTION.Imperium, -8], - [6, 8] - ] - }, { - t_tip: "Faulty Lyman's Ear", - t_tip2: "Lacking a working Lyman's ear, all deep-striked Astartes receive moderate penalties to both attack and defense.", - data: lyman, - mutation_points: 1 - }, { - t_tip: "Hyper-Stimulated Omophagea", - t_tip2: "After every battle the Astartes have a chance to feast upon their fallen enemies, or seldom, their allies.", - data: omophagea, - mutation_points: 1 - }, { - t_tip: "Hyperactive Ossmodula", - t_tip2: "Instead of wound tissue bone is generated; Apothecaries must spend twice the normal time healing your Astartes.", - data: ossmodula, - mutation_points: 1 - }, { - t_tip: "Lost Zygote", - t_tip2: "One of the Zygotes is faulty or missing. The Astartes only have one each and generate half the normal Gene-Seed.", - data: zygote, - mutation_points: 2 - }, { - t_tip: "Inactive Sus-an Membrane", - t_tip2: "Your Astartes do not have a Sus-an Membrane; they cannot enter suspended animation and receive more casualties as a result.", - data: membrane, - mutation_points: 1 - }, { - t_tip: "Missing Betchers Gland", - t_tip2: "Your Astartes cannot spit acid, and as a result, have slightly less attack in melee combat.", - data: betchers, - mutation_points: 1 - }, { - t_tip: "Mutated Catalepsean Node", - t_tip2: "Your Astartes have reduced awareness when tired. Slightly less attack in ranged and melee combat.", - data: catalepsean, - mutation_points: 1 - }, { - t_tip: "Oolitic Secretions", - t_tip2: "Either by secretions or radiation, your Astartes have an unusual or strange skin color. Decreases disposition.", - data: secretions, - mutation_points: 1, - disposition: [ - [eFACTION.Imperium, -8] - ] - }, { - t_tip: "Oversensitive Occulobe", - t_tip2: "Your Astartes are no longer immune to stun grenades, bright lights, and have a massive penalty during morning battles.", - data: occulobe, - mutation_points: 1, - disposition: [ - [eFACTION.Imperium, -8] - ] - }, { - t_tip: "Rampant Mucranoid", - t_tip2: "Your Astartes' Mucranoid cannot be turned off; the slime lowers most dispositions and occasionally damages their armour.", - data: mucranoid, - mutation_points: 1, - disposition: [ - [1, -4], - [eFACTION.Imperium, -8], - [3, -4], - [4, -4], - [5, -4], - [6, -4] - ] - }]; - x1 = 450; - y1 = 260; - for (var i = 0; i < array_length(mutations_defects); i++) { - mutation_data = mutations_defects[i]; - draw_sprite(spr_creation_check, mutation_data.data, x1, y1); - if (point_and_click([x1, y1, x1 + 32, y1 + 32]) && allow_colour_click) { - var onceh = 0; - if (mutation_data.data) { - mutation_data.data = 0; - mutations_selected -= mutation_data.mutation_points; - if (struct_exists(mutation_data, "disposition")) { - for (var s = 0; s < array_length(mutation_data.disposition); s++) { - disposition[mutation_data.disposition[s][0]] -= mutation_data.disposition[s][1]; - } - } - } else if ((!mutation_data.data) && (mutations > mutations_selected)) { - mutation_data.data = 1; - mutations_selected += mutation_data.mutation_points; - if (struct_exists(mutation_data, "disposition")) { - for (var s = 0; s < array_length(mutation_data.disposition); s++) { - disposition[mutation_data.disposition[s][0]] += mutation_data.disposition[s][1]; - } - } - } - } - draw_text_transformed(x1 + 30, y1 + 4, mutation_data.t_tip, 0.4, 0.4, 0); - if (scr_hit(x1, y1, x1 + 250, y1 + 20)) { - tooltip = mutation_data.t_tip; - tooltip2 = mutation_data.t_tip2; - } - y1 += spac; - if (i == 6) { - x1 = 750; - y1 = 260; - } - } - preomnor = mutations_defects[0].data; - voice = mutations_defects[1].data; - doomed = mutations_defects[2].data; - lyman = mutations_defects[3].data; - omophagea = mutations_defects[4].data; - ossmodula = mutations_defects[5].data; - zygote = mutations_defects[6].data; - membrane = mutations_defects[7].data; - betchers = mutations_defects[8].data; - catalepsean = mutations_defects[9].data; - secretions = mutations_defects[10].data; - occulobe = mutations_defects[11].data; - mucranoid = mutations_defects[12].data; - - draw_set_alpha(1); - - draw_line(445, 505, 1125, 505); - draw_line(445, 506, 1125, 505); - draw_line(445, 507, 1125, 507); - - draw_set_font(fnt_40k_30b); - draw_set_halign(fa_center); - draw_text_transformed(800, 515, string_hash_to_newline("Starting Disposition"), 0.6, 0.6, 0); - - draw_set_font(fnt_40k_14b); - draw_set_halign(fa_right); - - draw_text(650, 550, string_hash_to_newline("Imperium (" + string(disposition[eFACTION.Imperium]) + ")")); - draw_text(650, 575, string_hash_to_newline("Adeptus Mechanicus (" + string(disposition[eFACTION.Mechanicus]) + ")")); - draw_text(650, 600, string_hash_to_newline("Ecclesiarchy (" + string(disposition[5]) + ")")); - draw_text(650, 625, string_hash_to_newline("Inquisition (" + string(disposition[4]) + ")")); - if (founding != ePROGENITOR.NONE) { - draw_text(650, 650, string_hash_to_newline("Progenitor (" + string(disposition[eFACTION.Player]) + ")")); - } - draw_text(650, 675, "Adeptus Astartes (" + string(disposition[6]) + ")"); - - draw_rectangle(655, 552, 1150, 567, 1); - draw_rectangle(655, 552 + 25, 1150, 567 + 25, 1); - draw_rectangle(655, 552 + 50, 1150, 567 + 50, 1); - draw_rectangle(655, 552 + 75, 1150, 567 + 75, 1); - if (founding != ePROGENITOR.NONE) { - draw_rectangle(655, 552 + 100, 1150, 567 + 100, 1); - } - draw_rectangle(655, 552 + 125, 1150, 567 + 125, 1); - if (disposition[eFACTION.Imperium] > 0) { - draw_rectangle(655, 552, 655 + (disposition[eFACTION.Imperium] * 4.95), 567, 0); - } - if (disposition[eFACTION.Mechanicus] > 0) { - draw_rectangle(655, 552 + 25, 655 + (disposition[eFACTION.Mechanicus] * 4.95), 567 + 25, 0); - } - if (disposition[5] > 0) { - draw_rectangle(655, 552 + 50, 655 + (disposition[5] * 4.95), 567 + 50, 0); - } - if (disposition[4] > 0) { - draw_rectangle(655, 552 + 75, 655 + (disposition[4] * 4.95), 567 + 75, 0); - } - if ((disposition[eFACTION.Player] > 0) && (founding != ePROGENITOR.NONE)) { - draw_rectangle(655, 552 + 100, 655 + (disposition[eFACTION.Player] * 4.95), 567 + 100, 0); - } - if (disposition[6] > 0) { - draw_rectangle(655, 552 + 125, 655 + (disposition[6] * 4.95), 567 + 125, 0); - } - } - - /* Chapter Master */ - if (slide == eCREATIONSLIDES.CHAPTERMASTER) { - draw_set_color(CM_GREEN_COLOR); - draw_set_font(fnt_40k_30b); - draw_set_halign(fa_center); - draw_set_alpha(1); - var yar; - yar = 0; - - tooltip = ""; - tooltip2 = ""; - obj_cursor.image_index = 0; - - draw_set_color(CM_GREEN_COLOR); - draw_set_halign(fa_left); - draw_text_transformed(580, 100, string_hash_to_newline("Chapter Master Name: "), 0.9, 0.9, 0); - draw_set_font(fnt_40k_14b); - - if ((text_selected != "cm") || (custom == eCHAPTER_TYPE.PREMADE)) { - draw_text_ext(580, 144, string_hash_to_newline(string(chapter_master_name)), -1, 580); - } - if ((custom != eCHAPTER_TYPE.PREMADE) && (restarted == 0)) { - if ((text_selected == "cm") && (text_bar > 30)) { - draw_text(580, 144, string_hash_to_newline(string(chapter_master_name))); - } - if ((text_selected == "cm") && (text_bar <= 30)) { - draw_text(580, 144, string_hash_to_newline(string(chapter_master_name) + "|")); - } - var str_width, hei; - str_width = max(350, string_width(string_hash_to_newline(chapter_master_name))); - hei = string_height(string_hash_to_newline(chapter_master_name)); - if (scr_hit(580 - 2, 144 - 2, 582 + str_width, 146 + hei)) { - obj_cursor.image_index = 2; - if (scr_click_left() && !instance_exists(obj_creation_popup)) { - text_selected = "cm"; - keyboard_string = chapter_master_name; - } - } - if (text_selected == "cm") { - chapter_master_name = keyboard_string; - } - draw_rectangle(580 - 2, 144 - 2, 582 + 350, 146 + hei, 1); - - var _refresh_cm_name_btn = [943, 142, 947 + hei, 146 + hei]; - draw_unit_buttons(_refresh_cm_name_btn, "?", [1, 1], CM_GREEN_COLOR, , fnt_40k_14b); - if (point_and_click(_refresh_cm_name_btn)) { - var _new_cm_name = global.name_generator.generate_space_marine_name(); - show_debug_message($"regen name of chapter_master_name from {chapter_master_name} to {_new_cm_name}"); - chapter_master_name = _new_cm_name; - } - } - - draw_line(445, 200, 1125, 200); - draw_line(445, 201, 1125, 201); - draw_line(445, 202, 1125, 202); - - draw_set_font(fnt_40k_30b); - draw_text_transformed(444, 215, string_hash_to_newline("Select Two Weapons"), 0.6, 0.6, 0); - draw_text_transformed(444, 240, string_hash_to_newline("Melee"), 0.6, 0.6, 0); - draw_text_transformed(800, 240, string_hash_to_newline("Ranged"), 0.6, 0.6, 0); - - var x6, y6, spac; - var melee_choice_order = 0; - var melee_choice_weapon = ""; - x6 = 444; - y6 = 265; - spac = 25; - if ((custom == eCHAPTER_TYPE.PREMADE) || (restarted > 0)) { - draw_set_alpha(0.5); - } - - repeat (8) { - melee_choice_order += 1; - if (melee_choice_order == 1) { - melee_choice_weapon = "Twin Power Fists"; - } - if (melee_choice_order == 2) { - melee_choice_weapon = "Twin Lightning Claws"; - } - if (melee_choice_order == 3) { - melee_choice_weapon = "Relic Blade"; - } - if (melee_choice_order == 4) { - melee_choice_weapon = "Thunder Hammer"; - } - if (melee_choice_order == 5) { - melee_choice_weapon = "Power Sword"; - } - if (melee_choice_order == 6) { - melee_choice_weapon = "Power Axe"; - } - if (melee_choice_order == 7) { - melee_choice_weapon = "Eviscerator"; - } - if (melee_choice_order == 8) { - melee_choice_weapon = "Force Staff"; - } - - yar = 0; - if (chapter_master_melee == melee_choice_order) { - yar = 1; - } - draw_sprite(spr_creation_check, yar, x6, y6); - yar = 0; - if (point_and_click([x6, y6, x6 + 32, y6 + 32]) && (custom != eCHAPTER_TYPE.PREMADE) && (restarted == 0) && (!instance_exists(obj_creation_popup))) { - var onceh; - onceh = 0; - if ((chapter_master_melee == melee_choice_order) && (onceh == 0)) { - chapter_master_melee = 0; - onceh = 1; - } - if ((chapter_master_melee != melee_choice_order) && (onceh == 0)) { - chapter_master_melee = melee_choice_order; - onceh = 1; - } - } - draw_text_transformed(x6 + 30, y6 + 4, string_hash_to_newline(melee_choice_weapon), 0.4, 0.4, 0); - y6 += spac; - } - - x6 = 800; - y6 = 265; - var ranged_choice_order = 0; - var ranged_choice_weapon = ""; - var ranged_options = ["", "Boltstorm Gauntlet", "Infernus Pistol", "Plasma Pistol", "Plasma Gun", "Master Crafted Heavy Bolter", "Master Crafted Meltagun", "Storm Shield", ""]; - if (array_contains([1, 2, 7], chapter_master_melee)) { - draw_set_alpha(0.5); - chapter_master_ranged = 1; - } - repeat (7) { - ranged_choice_order += 1; - yar = 0; - if (chapter_master_ranged == ranged_choice_order) { - yar = 1; - } - draw_sprite(spr_creation_check, yar, x6, y6); - yar = 0; - if (point_and_click([x6, y6, x6 + 32, y6 + 32]) && (custom != eCHAPTER_TYPE.PREMADE) && (restarted == 0) && (!instance_exists(obj_creation_popup)) && (!array_contains([1, 2, 7], chapter_master_melee))) { - var onceh = 0; - if (chapter_master_ranged == ranged_choice_order) { - chapter_master_ranged = 0; - } else if (chapter_master_ranged != ranged_choice_order) { - chapter_master_ranged = ranged_choice_order; - } - } - draw_text_transformed(x6 + 30, y6 + 4, ranged_options[ranged_choice_order], 0.4, 0.4, 0); - y6 += spac; - } - - draw_set_alpha(1); - - draw_line(445, 490, 1125, 490); - draw_line(445, 491, 1125, 491); - draw_line(445, 492, 1125, 492); - - draw_set_font(fnt_40k_30b); - // draw_text_transformed(444,505,"Select Speciality",0.6,0.6,0); - draw_set_halign(fa_center); - - var psy_intolerance = array_contains(dis, "Psyker Intolerant"); - if ((chapter_master_specialty == 3) && ((race[100, 17] == 0) || psy_intolerance)) { - chapter_master_speciality = choose(1, 2); - } - x6 = 474; - y6 = 500; - h = 0; - it = ""; - var leader_types = [["", ""], ["Born Leader", "You always know the right words to inspire your men or strike doubt in the hearts of the enemy. Increases Disposition and Grants a +10% Requisition Income Bonus."], ["Champion", "Even before your rise to Chapter Master you were a renowned warrior, nearly without compare. Increases Chapter Master Experience, Melee Damage, and Ranged Damage."], ["Psyker", "The impossible is nothing to you; despite being a Psyker you have slowly risen to lead a Chapter. Chapter Master gains every Power within the chosen Discipline."]]; - repeat (3) { - h += 1; - var cur_leader_type = leader_types[h]; - draw_set_alpha(1); - var nope = (h == 3) && ((race[100, 17] == 0) || psy_intolerance); - if (nope) { - draw_set_alpha(0.5); - } - if ((custom != eCHAPTER_TYPE.CUSTOM) || (restarted > 0)) { - draw_set_alpha(0.5); - } - - // draw_sprite(spr_cm_specialty,h-1,x6,y6); - scr_image("commander", h - 1, x6, y6, 162, 208); - - draw_text_transformed(x6 + 81, y6 + 214, cur_leader_type[0], 0.5, 0.5, 0); - - draw_sprite(spr_creation_check, chapter_master_specialty == h, x6, y6 + 214); - - if (point_and_click([x6, y6 + 214, x6 + 32, y6 + 32 + 214]) && (custom == eCHAPTER_TYPE.CUSTOM) && (restarted == 0) && (nope == 0)) { - var onceh = 0; - if ((chapter_master_specialty != h) && (onceh == 0)) { - chapter_master_specialty = h; - onceh = 1; - } - } - if (scr_hit(x6, y6 + 214, x6 + 162, y6 + 234) && (nope == 0)) { - tooltip = cur_leader_type[0]; - tooltip2 = cur_leader_type[1]; - } - - x6 += 240; - draw_set_alpha(1); - } - - //adds "Save Chapter" button if custom chapter in a save slot - - if (custom != eCHAPTER_TYPE.PREMADE && global.chapter_id != eCHAPTERS.UNKNOWN) { - /// save chapter box - var _sc_box = { - x1: 980, - y1: 135, - w: 180, - h: 35 - }; - _sc_box.y2 = _sc_box.y1 + _sc_box.h; - _sc_box.x2 = _sc_box.x1 + _sc_box.w; - - draw_set_font(fnt_40k_30b); - draw_rectangle(_sc_box.x1, _sc_box.y1, _sc_box.x2, _sc_box.y2, true); - draw_text_transformed(_sc_box.x1 + 90, _sc_box.y1 + 5, string("Save Chapter"), 0.6, 0.6, 0); - draw_set_font(fnt_40k_14b); - if (scr_hit(_sc_box.x1, _sc_box.y1, _sc_box.x2, _sc_box.y2)) { - tooltip = "Do you want to save your chapter?"; - tooltip2 = "Click to save your chapter"; - if (scr_click_left()) { - scr_save_chapter(global.chapter_id); - - tooltip = "Do you want to save your chapter?"; - tooltip2 = "Chapter Saved!"; - } - } - } - } - - /* */ - - // 850,860 - - var xx, yy; - xx = 375; - yy = 10; - - if (change_slide > 0) { - draw_set_color(c_black); - if (change_slide == 3) { - if (slate5 <= 0) { - slate5 = 1; - } - if ((slate5 >= 5) && (slate6 == 0)) { - slate6 = 1; - } - } - if (change_slide <= 30) { - draw_set_alpha(change_slide / 30); - } - if (change_slide > 40) { - draw_set_alpha(2.33 - (change_slide / 30)); - } - draw_rectangle(430, 66, 702, 750, 0); - draw_rectangle(703, 80, 1171, 750, 0); - draw_rectangle(518, 750, 1075, 820, 0); - } - - draw_set_color(5998382); - if (slate5 > 0) { - if (slate5 <= 30) { - draw_set_alpha(slate5 / 30); - } - if (slate5 > 30) { - draw_set_alpha(1 - ((slate5 - 30) / 30)); - } - draw_line(xx + 30, yy + 70 + (slate5 * 12), xx + 790, yy + 70 + (slate5 * 12)); - } - if (slate6 > 0) { - if (slate6 <= 30) { - draw_set_alpha(slate6 / 30); - } - if (slate6 > 30) { - draw_set_alpha(1 - ((slate6 - 30) / 30)); - } - draw_line(xx + 30, yy + 70 + (slate6 * 12), xx + 790, yy + 70 + (slate6 * 12)); - } - - if (fade_in > 0) { - draw_set_alpha(fade_in / 50); - draw_set_color(0); - draw_rectangle(0, 0, room_width, room_height, 0); - } - draw_set_alpha(1); - // draw_set_color(c_red); - // draw_text(mouse_x+20,mouse_y+20,string(change_slide)); - - if (slide == 1) { - draw_set_alpha(slate4 / 30); - if (slide == 1) { - draw_sprite(spr_creation_arrow, 2, 607, 761); - } - if (slide != 1) { - draw_sprite(spr_creation_arrow, 0, 607, 761); - } - draw_sprite(spr_creation_arrow, 3, 927, 761); - - var q, x3, y3; - q = 1; - x3 = (room_width / 2) - 77; - y3 = 790; - draw_set_color(CM_GREEN_COLOR); - repeat (7) { - draw_circle(x3, y3, 10, 1); - draw_circle(x3, y3, 9.5, 1); - draw_circle(x3, y3, 9, 1); - - if (slide == q) { - draw_circle(x3, y3, 8.5, 0); - } - if (slide != q) { - draw_circle(x3, y3, 8.5, 1); - } - x3 += 25; - q += 1; - } - } - - if ((slide >= eCREATIONSLIDES.CHAPTERTRAITS) || (goto_slide >= eCREATIONSLIDES.CHAPTERTRAITS)) { - draw_set_alpha(1); - draw_sprite(spr_creation_arrow, 0, 607, 761); - draw_sprite(spr_creation_arrow, 1, 927, 761); - if (slide == eCREATIONSLIDES.CHAPTERSELECT) { - draw_sprite(spr_creation_arrow, 2, 607, 761); - } - - // skip to end >> button - if ((slide >= eCREATIONSLIDES.CHAPTERTRAITS) && (slide < eCREATIONSLIDES.CHAPTERMASTER) && (custom != eCHAPTER_TYPE.CUSTOM)) { - draw_set_alpha(0.8); - if ((popup == "") && ((change_slide >= 70) || (change_slide <= 0)) && scr_hit(927 + 64 + 12, 761 + 12, 927 + 128 - 12, 761 + 64 - 12)) { - draw_set_alpha(1); - } - draw_sprite(spr_creation_arrow, 4, 927 + 64, 761); - if ((popup == "") && ((change_slide >= 70) || (change_slide <= 0)) && (point_and_click([927 + 64 + 12, 761 + 12, 927 + 128 - 12, 761 + 64 - 12]))) { - scr_creation(2); - scr_creation(3); - scr_creation(4); - scr_creation(5); - scr_creation(6); - scr_creation(7); - } - } - draw_set_alpha(1); - - var q = 1, x3 = (room_width / 2) - 77, y3 = 790; - draw_set_color(CM_GREEN_COLOR); - repeat (7) { - draw_circle(x3, y3, 10, 1); - draw_circle(x3, y3, 9.5, 1); - draw_circle(x3, y3, 9, 1); - - if (slide_show == q) { - draw_circle(x3, y3, 8.5, 0); - } - if (slide_show != q) { - draw_circle(x3, y3, 8.5, 1); - } - x3 += 25; - q += 1; - } - - //TODO refactor to make arrow buttoon objects - if ((popup == "") && ((change_slide >= 70) || (change_slide <= 0)) && (!instance_exists(obj_creation_popup))) { - if (point_and_click([925, 756, 997, 824])) { - // Next slide - if (slide >= eCREATIONSLIDES.CHAPTERTRAITS && slide <= eCREATIONSLIDES.CHAPTERMASTER) { - scr_creation(slide); - } - } - - if (point_and_click([604, 756, 675, 824])) { - // Previous slide - change_slide = 1; - goto_slide = slide - 1; - popup = ""; - if (goto_slide == eCREATIONSLIDES.CHAPTERSELECT) { - highlight = 0; - highlighting = 0; - old_highlight = 0; - } - } - } - } - - if (tooltip != "" && tooltip2 != "" && change_slide <= 0) { - draw_set_alpha(1); - draw_set_color(0); - draw_set_halign(fa_left); - draw_set_font(fnt_40k_14b); - var _width1 = string_width_ext(string_hash_to_newline(tooltip), -1, 500); - draw_set_font(fnt_40k_14); - var _width2 = string_width_ext(string_hash_to_newline(tooltip2), -1, 500); - var _height = string_height_ext(string_hash_to_newline(tooltip2), -1, 500); - - draw_rectangle(mouse_x + 18, mouse_y + 20, mouse_x + max(_width1, _width2) + 24, mouse_y + 44 + _height, 0); - draw_set_color(CM_GREEN_COLOR); - draw_rectangle(mouse_x + 18, mouse_y + 20, mouse_x + max(_width1, _width2) + 24, mouse_y + 44 + _height, 1); - draw_set_font(fnt_40k_14b); - draw_text(mouse_x + 22, mouse_y + 22, string_hash_to_newline(string(tooltip))); - draw_set_font(fnt_40k_14); - draw_text_ext(mouse_x + 22, mouse_y + 42, string_hash_to_newline(string(tooltip2)), -1, 500); - } + //read + // 850,860 + + var xx, yy; + xx = 375; + yy = 10; + + tooltip = ""; + tooltip2 = ""; + draw_set_alpha(1); + // draw_sprite(spr_creation_slate,0,xx,yy); + scr_image("creation/slate", 1, xx, yy, 850, 860); + draw_set_alpha(1 - (slate1 / 30)); + // draw_sprite(spr_creation_slate,1,xx,yy); + scr_image("creation/slate", 2, xx, yy, 850, 860); + + draw_set_color(5998382); + if (slate2 > 0) { + if (slate2 <= 10) { + draw_set_alpha(slate2 / 10); + } + if (slate2 > 10) { + draw_set_alpha(1 - ((slate2 - 10) / 10)); + } + draw_line(xx + 30, yy + 70 + (slate2 * 36), xx + 790, yy + 70 + (slate2 * 36)); + } + if (slate3 > 0) { + if (slate3 <= 10) { + draw_set_alpha(slate3 / 10); + } + if (slate3 > 10) { + draw_set_alpha(1 - ((slate3 - 10) / 10)); + } + draw_line(xx + 30, yy + 70 + (slate3 * 36), xx + 790, yy + 70 + (slate3 * 36)); + } + + allow_colour_click = (custom == eCHAPTER_TYPE.CUSTOM) && (!instance_exists(obj_creation_popup)); + + draw_set_alpha(slate4 / 30); + if (slate4 > 0) { + /* Chapter Selection grid */ + if (slide == eCREATIONSLIDES.CHAPTERSELECT) { + draw_chapter_select(); + } + } + + var yar; + yar = 0; + + if (slide >= 2) { + tooltip = ""; + tooltip2 = ""; + + if (goto_slide != 1) { + if (custom == eCHAPTER_TYPE.CUSTOM) { + draw_sprite(spr_creation_other, 4, 0, 68); + } + if (custom == eCHAPTER_TYPE.RANDOM) { + draw_sprite(spr_creation_other, 5, 0, 68); + } + + draw_set_color(CM_GREEN_COLOR); + draw_rectangle(0, 68, 374, 781, 1); + } + + draw_set_color(0); + + var sprx = 436, spry = 74, sprw = 128, sprh = 128; + if (global.chapter_icon.sprite != -1) { + draw_sprite_stretched(global.chapter_icon.sprite, 0, sprx, spry, sprw, sprh); + } else { + // red (?) + draw_sprite_stretched(global.chapter_icons_map[? "unknown"], 0, sprx, spry, sprw, sprh); + } + + obj_cursor.image_index = 0; + if (scr_hit(436, 74, 436 + 128, 74 + 128) && (popup == "")) { + obj_cursor.image_index = 1; + tooltip = "Chapter Icon"; + tooltip2 = "Your Chapter's icon. Click to edit."; + } + + if (slide == eCREATIONSLIDES.CHAPTERTRAITS) { + var _chapter_icon; + if (founding == ePROGENITOR.NONE) { + _chapter_icon = global.chapter_icons_map[? "unknown"]; + } else if (founding == ePROGENITOR.RANDOM) { + _chapter_icon = global.chapter_icons_map[? "random"]; + } else { + _chapter_icon = global.chapter_icons_map[? founding_chapters[founding - 1].icon_name]; + } + + draw_set_alpha(0.33); + draw_sprite_stretched(_chapter_icon, 0, 1164 - 128, 74, 128, 128); + draw_set_alpha(1); + + draw_set_font(fnt_40k_30b); + if (scr_hit(1164 - 128, 74, 1164, 74 + 128)) { + tooltip = "Founding Chapter"; + tooltip2 = "The parent Chapter whos Gene-Seed your own originates from."; + } + + if (custom == eCHAPTER_TYPE.CUSTOM) { + draw_sprite_stretched(spr_creation_arrow, 0, 1164 - 194, 160, 32, 32); + draw_sprite_stretched(spr_creation_arrow, 1, 1164 - 144, 160, 32, 32); + + if (scr_hit(1164 - 194, 149, 1164 - 162, 193)) { + obj_cursor.image_index = 1; + if (scr_click_left()) { + founding--; + if (founding == -1) { + founding = ePROGENITOR.RANDOM; + } + } + } + if (scr_hit(1164 - 144, 149, 1164 - 112, 193)) { + obj_cursor.image_index = 1; + if (scr_click_left()) { + founding++; + if (founding == 11) { + founding = ePROGENITOR.NONE; + } + } + } + } + } + } + + /* Chapter Naming, Points assignment, advantages/disadvantages */ + if (slide == eCREATIONSLIDES.CHAPTERTRAITS) { + draw_chapter_trait_select(); + } else /* Homeworld, Flagship, Psychic discipline, Aspirant Trial */ + + if (slide == eCREATIONSLIDES.CHAPTERHOME) { + draw_chapter_homeworld_select(); + } else /* Livery, Roles */ + + if (slide == eCREATIONSLIDES.CHAPTERLIVERY) { + scr_livery_setup(); + } else if (slide == eCREATIONSLIDES.CHAPTERROLES) { + scr_role_setup(); + } else /* Gene Seed Mutations, Disposition */ + + if (slide == eCREATIONSLIDES.CHAPTERGENE) { + draw_set_color(CM_GREEN_COLOR); + draw_set_font(fnt_40k_30b); + draw_set_halign(fa_center); + draw_set_alpha(1); + + tooltip = ""; + tooltip2 = ""; + obj_cursor.image_index = 0; + + draw_text(800, 80, string_hash_to_newline(string(chapter_name))); + + draw_set_color(CM_GREEN_COLOR); + draw_set_halign(fa_left); + draw_text_transformed(580, 118, string_hash_to_newline("Successor Chapters: " + string(successors)), 0.6, 0.6, 0); + draw_set_font(fnt_40k_14b); + + draw_rectangle(445, 200, 1125, 202, true); + + draw_set_halign(fa_center); + draw_set_font(fnt_40k_30b); + draw_text_transformed(800, 210, string_hash_to_newline("Gene-Seed Mutations"), 0.6, 0.6, 0); + if (purity == 10) { + draw_text_transformed(800, 230, $"The gene-seed is perfectly pure", 0.5, 0.5, 0); + } else { + if (mutations > mutations_selected) { + draw_text_transformed(800, 230, $"Select {mutations - mutations_selected} more, according to your purity score", 0.5, 0.5, 0); + } else { + draw_text_transformed(800, 230, $"The gene-seed is mutated enough", 0.5, 0.5, 0); + draw_set_alpha(0.5); + } + } + draw_set_halign(fa_left); + + var x1, y1, spac = 34; + + if (custom != eCHAPTER_TYPE.CUSTOM || purity == 10) { + draw_set_alpha(0.5); + } + var mutations_defects = [ + { + t_tip: "Anemic Preomnor", + t_tip2: "Your Astartes lack the detoxifying gland called the Preomnor- they are more susceptible to poisons and toxins.", + data: preomnor, + mutation_points: 1, + }, + { + t_tip: "Disturbing Voice", + t_tip2: "Your Astartes have a voice like a creaking door or a rumble. Decreases Imperium and Imperial Guard disposition.", + data: voice, + mutation_points: 1, + disposition: [[eFACTION.Imperium, -8]], + }, + { + t_tip: "Doomed", + t_tip2: "Your Chapter cannot make more Astartes until enough research is generated. Counts as four mutations.", + data: doomed, + mutation_points: 4, + disposition: [[eFACTION.Imperium, -8], [6, 8]], + }, + { + t_tip: "Faulty Lyman's Ear", + t_tip2: "Lacking a working Lyman's ear, all deep-striked Astartes receive moderate penalties to both attack and defense.", + data: lyman, + mutation_points: 1, + }, + { + t_tip: "Hyper-Stimulated Omophagea", + t_tip2: "After every battle the Astartes have a chance to feast upon their fallen enemies, or seldom, their allies.", + data: omophagea, + mutation_points: 1, + }, + { + t_tip: "Hyperactive Ossmodula", + t_tip2: "Instead of wound tissue bone is generated; Apothecaries must spend twice the normal time healing your Astartes.", + data: ossmodula, + mutation_points: 1, + }, + { + t_tip: "Lost Zygote", + t_tip2: "One of the Zygotes is faulty or missing. The Astartes only have one each and generate half the normal Gene-Seed.", + data: zygote, + mutation_points: 2, + }, + { + t_tip: "Inactive Sus-an Membrane", + t_tip2: "Your Astartes do not have a Sus-an Membrane; they cannot enter suspended animation and receive more casualties as a result.", + data: membrane, + mutation_points: 1, + }, + { + t_tip: "Missing Betchers Gland", + t_tip2: "Your Astartes cannot spit acid, and as a result, have slightly less attack in melee combat.", + data: betchers, + mutation_points: 1, + }, + { + t_tip: "Mutated Catalepsean Node", + t_tip2: "Your Astartes have reduced awareness when tired. Slightly less attack in ranged and melee combat.", + data: catalepsean, + mutation_points: 1, + }, + { + t_tip: "Oolitic Secretions", + t_tip2: "Either by secretions or radiation, your Astartes have an unusual or strange skin color. Decreases disposition.", + data: secretions, + mutation_points: 1, + disposition: [[eFACTION.Imperium, -8]], + }, + { + t_tip: "Oversensitive Occulobe", + t_tip2: "Your Astartes are no longer immune to stun grenades, bright lights, and have a massive penalty during morning battles.", + data: occulobe, + mutation_points: 1, + disposition: [[eFACTION.Imperium, -8]], + }, + { + t_tip: "Rampant Mucranoid", + t_tip2: "Your Astartes' Mucranoid cannot be turned off; the slime lowers most dispositions and occasionally damages their armour.", + data: mucranoid, + mutation_points: 1, + disposition: [[1, -4], [eFACTION.Imperium, -8], [3, -4], [4, -4], [5, -4], [6, -4]], + } + ]; + x1 = 450; + y1 = 260; + for (var i = 0; i < array_length(mutations_defects); i++) { + mutation_data = mutations_defects[i]; + draw_sprite(spr_creation_check, mutation_data.data, x1, y1); + if (point_and_click([x1, y1, x1 + 32, y1 + 32]) && allow_colour_click) { + var onceh = 0; + if (mutation_data.data) { + mutation_data.data = 0; + mutations_selected -= mutation_data.mutation_points; + if (struct_exists(mutation_data, "disposition")) { + for (var s = 0; s < array_length(mutation_data.disposition); s++) { + disposition[mutation_data.disposition[s][0]] -= mutation_data.disposition[s][1]; + } + } + } else if ((!mutation_data.data) && (mutations > mutations_selected)) { + mutation_data.data = 1; + mutations_selected += mutation_data.mutation_points; + if (struct_exists(mutation_data, "disposition")) { + for (var s = 0; s < array_length(mutation_data.disposition); s++) { + disposition[mutation_data.disposition[s][0]] += mutation_data.disposition[s][1]; + } + } + } + } + draw_text_transformed(x1 + 30, y1 + 4, mutation_data.t_tip, 0.4, 0.4, 0); + if (scr_hit(x1, y1, x1 + 250, y1 + 20)) { + tooltip = mutation_data.t_tip; + tooltip2 = mutation_data.t_tip2; + } + y1 += spac; + if (i == 6) { + x1 = 750; + y1 = 260; + } + } + preomnor = mutations_defects[0].data; + voice = mutations_defects[1].data; + doomed = mutations_defects[2].data; + lyman = mutations_defects[3].data; + omophagea = mutations_defects[4].data; + ossmodula = mutations_defects[5].data; + zygote = mutations_defects[6].data; + membrane = mutations_defects[7].data; + betchers = mutations_defects[8].data; + catalepsean = mutations_defects[9].data; + secretions = mutations_defects[10].data; + occulobe = mutations_defects[11].data; + mucranoid = mutations_defects[12].data; + + draw_set_alpha(1); + + draw_line(445, 505, 1125, 505); + draw_line(445, 506, 1125, 505); + draw_line(445, 507, 1125, 507); + + draw_set_font(fnt_40k_30b); + draw_set_halign(fa_center); + draw_text_transformed(800, 515, string_hash_to_newline("Starting Disposition"), 0.6, 0.6, 0); + + draw_set_font(fnt_40k_14b); + draw_set_halign(fa_right); + + draw_text(650, 550, string_hash_to_newline("Imperium (" + string(disposition[eFACTION.Imperium]) + ")")); + draw_text(650, 575, string_hash_to_newline("Adeptus Mechanicus (" + string(disposition[eFACTION.Mechanicus]) + ")")); + draw_text(650, 600, string_hash_to_newline("Ecclesiarchy (" + string(disposition[5]) + ")")); + draw_text(650, 625, string_hash_to_newline("Inquisition (" + string(disposition[4]) + ")")); + if (founding != ePROGENITOR.NONE) { + draw_text(650, 650, string_hash_to_newline("Progenitor (" + string(disposition[eFACTION.Player]) + ")")); + } + draw_text(650, 675, "Adeptus Astartes (" + string(disposition[6]) + ")"); + + draw_rectangle(655, 552, 1150, 567, 1); + draw_rectangle(655, 552 + 25, 1150, 567 + 25, 1); + draw_rectangle(655, 552 + 50, 1150, 567 + 50, 1); + draw_rectangle(655, 552 + 75, 1150, 567 + 75, 1); + if (founding != ePROGENITOR.NONE) { + draw_rectangle(655, 552 + 100, 1150, 567 + 100, 1); + } + draw_rectangle(655, 552 + 125, 1150, 567 + 125, 1); + if (disposition[eFACTION.Imperium] > 0) { + draw_rectangle(655, 552, 655 + (disposition[eFACTION.Imperium] * 4.95), 567, 0); + } + if (disposition[eFACTION.Mechanicus] > 0) { + draw_rectangle(655, 552 + 25, 655 + (disposition[eFACTION.Mechanicus] * 4.95), 567 + 25, 0); + } + if (disposition[5] > 0) { + draw_rectangle(655, 552 + 50, 655 + (disposition[5] * 4.95), 567 + 50, 0); + } + if (disposition[4] > 0) { + draw_rectangle(655, 552 + 75, 655 + (disposition[4] * 4.95), 567 + 75, 0); + } + if ((disposition[eFACTION.Player] > 0) && (founding != ePROGENITOR.NONE)) { + draw_rectangle(655, 552 + 100, 655 + (disposition[eFACTION.Player] * 4.95), 567 + 100, 0); + } + if (disposition[6] > 0) { + draw_rectangle(655, 552 + 125, 655 + (disposition[6] * 4.95), 567 + 125, 0); + } + } + + /* Chapter Master */ + if (slide == eCREATIONSLIDES.CHAPTERMASTER) { + draw_set_color(CM_GREEN_COLOR); + draw_set_font(fnt_40k_30b); + draw_set_halign(fa_center); + draw_set_alpha(1); + var yar; + yar = 0; + + tooltip = ""; + tooltip2 = ""; + obj_cursor.image_index = 0; + + draw_set_color(CM_GREEN_COLOR); + draw_set_halign(fa_left); + draw_text_transformed(580, 100, string_hash_to_newline("Chapter Master Name: "), 0.9, 0.9, 0); + draw_set_font(fnt_40k_14b); + + if ((text_selected != "cm") || (custom == eCHAPTER_TYPE.PREMADE)) { + draw_text_ext(580, 144, string_hash_to_newline(string(chapter_master_name)), -1, 580); + } + if ((custom != eCHAPTER_TYPE.PREMADE) && (restarted == 0)) { + if ((text_selected == "cm") && (text_bar > 30)) { + draw_text(580, 144, string_hash_to_newline(string(chapter_master_name))); + } + if ((text_selected == "cm") && (text_bar <= 30)) { + draw_text(580, 144, string_hash_to_newline(string(chapter_master_name) + "|")); + } + var str_width, hei; + str_width = max(350, string_width(string_hash_to_newline(chapter_master_name))); + hei = string_height(string_hash_to_newline(chapter_master_name)); + if (scr_hit(580 - 2, 144 - 2, 582 + str_width, 146 + hei)) { + obj_cursor.image_index = 2; + if (scr_click_left() && !instance_exists(obj_creation_popup)) { + text_selected = "cm"; + keyboard_string = chapter_master_name; + } + } + if (text_selected == "cm") { + chapter_master_name = keyboard_string; + } + draw_rectangle(580 - 2, 144 - 2, 582 + 350, 146 + hei, 1); + + var _refresh_cm_name_btn = [943, 142, 947 + hei, 146 + hei]; + draw_unit_buttons(_refresh_cm_name_btn, "?", [1, 1], CM_GREEN_COLOR,, fnt_40k_14b); + if (point_and_click(_refresh_cm_name_btn)) { + var _new_cm_name = global.name_generator.generate_space_marine_name(); + show_debug_message($"regen name of chapter_master_name from {chapter_master_name} to {_new_cm_name}"); + chapter_master_name = _new_cm_name; + } + } + + draw_line(445, 200, 1125, 200); + draw_line(445, 201, 1125, 201); + draw_line(445, 202, 1125, 202); + + draw_set_font(fnt_40k_30b); + draw_text_transformed(444, 215, string_hash_to_newline("Select Two Weapons"), 0.6, 0.6, 0); + draw_text_transformed(444, 240, string_hash_to_newline("Melee"), 0.6, 0.6, 0); + draw_text_transformed(800, 240, string_hash_to_newline("Ranged"), 0.6, 0.6, 0); + + var x6, y6, spac; + var melee_choice_order = 0; + var melee_choice_weapon = ""; + x6 = 444; + y6 = 265; + spac = 25; + if ((custom == eCHAPTER_TYPE.PREMADE) || (restarted > 0)) { + draw_set_alpha(0.5); + } + + repeat (8) { + melee_choice_order += 1; + if (melee_choice_order == 1) { + melee_choice_weapon = "Twin Power Fists"; + } + if (melee_choice_order == 2) { + melee_choice_weapon = "Twin Lightning Claws"; + } + if (melee_choice_order == 3) { + melee_choice_weapon = "Relic Blade"; + } + if (melee_choice_order == 4) { + melee_choice_weapon = "Thunder Hammer"; + } + if (melee_choice_order == 5) { + melee_choice_weapon = "Power Sword"; + } + if (melee_choice_order == 6) { + melee_choice_weapon = "Power Axe"; + } + if (melee_choice_order == 7) { + melee_choice_weapon = "Eviscerator"; + } + if (melee_choice_order == 8) { + melee_choice_weapon = "Force Staff"; + } + + yar = 0; + if (chapter_master_melee == melee_choice_order) { + yar = 1; + } + draw_sprite(spr_creation_check, yar, x6, y6); + yar = 0; + if (point_and_click([x6, y6, x6 + 32, y6 + 32]) && (custom != eCHAPTER_TYPE.PREMADE) && (restarted == 0) && (!instance_exists(obj_creation_popup))) { + var onceh; + onceh = 0; + if ((chapter_master_melee == melee_choice_order) && (onceh == 0)) { + chapter_master_melee = 0; + onceh = 1; + } + if ((chapter_master_melee != melee_choice_order) && (onceh == 0)) { + chapter_master_melee = melee_choice_order; + onceh = 1; + } + } + draw_text_transformed(x6 + 30, y6 + 4, string_hash_to_newline(melee_choice_weapon), 0.4, 0.4, 0); + y6 += spac; + } + + x6 = 800; + y6 = 265; + var ranged_choice_order = 0; + var ranged_choice_weapon = ""; + var ranged_options = ["", "Boltstorm Gauntlet", "Infernus Pistol", "Plasma Pistol", "Plasma Gun", "Master Crafted Heavy Bolter", "Master Crafted Meltagun", "Storm Shield", ""]; + if (array_contains([1, 2, 7], chapter_master_melee)) { + draw_set_alpha(0.5); + chapter_master_ranged = 1; + } + repeat (7) { + ranged_choice_order += 1; + yar = 0; + if (chapter_master_ranged == ranged_choice_order) { + yar = 1; + } + draw_sprite(spr_creation_check, yar, x6, y6); + yar = 0; + if (point_and_click([x6, y6, x6 + 32, y6 + 32]) && (custom != eCHAPTER_TYPE.PREMADE) && (restarted == 0) && (!instance_exists(obj_creation_popup)) && (!array_contains([1, 2, 7], chapter_master_melee))) { + var onceh = 0; + if (chapter_master_ranged == ranged_choice_order) { + chapter_master_ranged = 0; + } else if (chapter_master_ranged != ranged_choice_order) { + chapter_master_ranged = ranged_choice_order; + } + } + draw_text_transformed(x6 + 30, y6 + 4, ranged_options[ranged_choice_order], 0.4, 0.4, 0); + y6 += spac; + } + + draw_set_alpha(1); + + draw_line(445, 490, 1125, 490); + draw_line(445, 491, 1125, 491); + draw_line(445, 492, 1125, 492); + + draw_set_font(fnt_40k_30b); + // draw_text_transformed(444,505,"Select Speciality",0.6,0.6,0); + draw_set_halign(fa_center); + + var psy_intolerance = array_contains(dis, "Psyker Intolerant"); + if ((chapter_master_specialty == 3) && ((race[100][17] == 0) || psy_intolerance)) { + chapter_master_speciality = choose(1, 2); + } + x6 = 474; + y6 = 500; + h = 0; + it = ""; + var leader_types = [["", ""], ["Born Leader", "You always know the right words to inspire your men or strike doubt in the hearts of the enemy. Increases Disposition and Grants a +10% Requisition Income Bonus."], ["Champion", "Even before your rise to Chapter Master you were a renowned warrior, nearly without compare. Increases Chapter Master Experience, Melee Damage, and Ranged Damage."], ["Psyker", "The impossible is nothing to you; despite being a Psyker you have slowly risen to lead a Chapter. Chapter Master gains every Power within the chosen Discipline."]]; + repeat (3) { + h += 1; + var cur_leader_type = leader_types[h]; + draw_set_alpha(1); + var nope = (h == 3) && ((race[100][17] == 0) || psy_intolerance); + if (nope) { + draw_set_alpha(0.5); + } + if ((custom != eCHAPTER_TYPE.CUSTOM) || (restarted > 0)) { + draw_set_alpha(0.5); + } + + // draw_sprite(spr_cm_specialty,h-1,x6,y6); + scr_image("commander", h - 1, x6, y6, 162, 208); + + draw_text_transformed(x6 + 81, y6 + 214, cur_leader_type[0], 0.5, 0.5, 0); + + draw_sprite(spr_creation_check, chapter_master_specialty == h, x6, y6 + 214); + + if (point_and_click([x6, y6 + 214, x6 + 32, y6 + 32 + 214]) && (custom == eCHAPTER_TYPE.CUSTOM) && (restarted == 0) && (nope == 0)) { + var onceh = 0; + if ((chapter_master_specialty != h) && (onceh == 0)) { + chapter_master_specialty = h; + onceh = 1; + } + } + if (scr_hit(x6, y6 + 214, x6 + 162, y6 + 234) && (nope == 0)) { + tooltip = cur_leader_type[0]; + tooltip2 = cur_leader_type[1]; + } + + x6 += 240; + draw_set_alpha(1); + } + + //adds "Save Chapter" button if custom chapter in a save slot + + if (custom != eCHAPTER_TYPE.PREMADE && global.chapter_id != eCHAPTERS.UNKNOWN) { + /// save chapter box + var _sc_box = { + x1: 980, + y1: 135, + w: 180, + h: 35, + }; + _sc_box.y2 = _sc_box.y1 + _sc_box.h; + _sc_box.x2 = _sc_box.x1 + _sc_box.w; + + draw_set_font(fnt_40k_30b); + draw_rectangle(_sc_box.x1, _sc_box.y1, _sc_box.x2, _sc_box.y2, true); + draw_text_transformed(_sc_box.x1 + 90, _sc_box.y1 + 5, string("Save Chapter"), 0.6, 0.6, 0); + draw_set_font(fnt_40k_14b); + if (scr_hit(_sc_box.x1, _sc_box.y1, _sc_box.x2, _sc_box.y2)) { + tooltip = "Do you want to save your chapter?"; + tooltip2 = "Click to save your chapter"; + if (scr_click_left()) { + scr_save_chapter(global.chapter_id); + + tooltip = "Do you want to save your chapter?"; + tooltip2 = "Chapter Saved!"; + } + } + } + } + + /* */ + + // 850,860 + + var xx, yy; + xx = 375; + yy = 10; + + if (change_slide > 0) { + draw_set_color(c_black); + if (change_slide == 3) { + if (slate5 <= 0) { + slate5 = 1; + } + if ((slate5 >= 5) && (slate6 == 0)) { + slate6 = 1; + } + } + if (change_slide <= 30) { + draw_set_alpha(change_slide / 30); + } + if (change_slide > 40) { + draw_set_alpha(2.33 - (change_slide / 30)); + } + draw_rectangle(430, 66, 702, 750, 0); + draw_rectangle(703, 80, 1171, 750, 0); + draw_rectangle(518, 750, 1075, 820, 0); + } + + draw_set_color(5998382); + if (slate5 > 0) { + if (slate5 <= 30) { + draw_set_alpha(slate5 / 30); + } + if (slate5 > 30) { + draw_set_alpha(1 - ((slate5 - 30) / 30)); + } + draw_line(xx + 30, yy + 70 + (slate5 * 12), xx + 790, yy + 70 + (slate5 * 12)); + } + if (slate6 > 0) { + if (slate6 <= 30) { + draw_set_alpha(slate6 / 30); + } + if (slate6 > 30) { + draw_set_alpha(1 - ((slate6 - 30) / 30)); + } + draw_line(xx + 30, yy + 70 + (slate6 * 12), xx + 790, yy + 70 + (slate6 * 12)); + } + + if (fade_in > 0) { + draw_set_alpha(fade_in / 50); + draw_set_color(0); + draw_rectangle(0, 0, room_width, room_height, 0); + } + draw_set_alpha(1); + // draw_set_color(c_red); + // draw_text(mouse_x+20,mouse_y+20,string(change_slide)); + + if (slide == 1) { + draw_set_alpha(slate4 / 30); + if (slide == 1) { + draw_sprite(spr_creation_arrow, 2, 607, 761); + } + if (slide != 1) { + draw_sprite(spr_creation_arrow, 0, 607, 761); + } + draw_sprite(spr_creation_arrow, 3, 927, 761); + + var q, x3, y3; + q = 1; + x3 = (room_width / 2) - 77; + y3 = 790; + draw_set_color(CM_GREEN_COLOR); + repeat (7) { + draw_circle(x3, y3, 10, 1); + draw_circle(x3, y3, 9.5, 1); + draw_circle(x3, y3, 9, 1); + + if (slide == q) { + draw_circle(x3, y3, 8.5, 0); + } + if (slide != q) { + draw_circle(x3, y3, 8.5, 1); + } + x3 += 25; + q += 1; + } + } + + if ((slide >= eCREATIONSLIDES.CHAPTERTRAITS) || (goto_slide >= eCREATIONSLIDES.CHAPTERTRAITS)) { + draw_set_alpha(1); + draw_sprite(spr_creation_arrow, 0, 607, 761); + draw_sprite(spr_creation_arrow, 1, 927, 761); + if (slide == eCREATIONSLIDES.CHAPTERSELECT) { + draw_sprite(spr_creation_arrow, 2, 607, 761); + } + + // skip to end >> button + if ((slide >= eCREATIONSLIDES.CHAPTERTRAITS) && (slide < eCREATIONSLIDES.CHAPTERMASTER) && (custom != eCHAPTER_TYPE.CUSTOM)) { + draw_set_alpha(0.8); + if ((popup == "") && ((change_slide >= 70) || (change_slide <= 0)) && scr_hit(927 + 64 + 12, 761 + 12, 927 + 128 - 12, 761 + 64 - 12)) { + draw_set_alpha(1); + } + draw_sprite(spr_creation_arrow, 4, 927 + 64, 761); + if ((popup == "") && ((change_slide >= 70) || (change_slide <= 0)) && point_and_click([927 + 64 + 12, 761 + 12, 927 + 128 - 12, 761 + 64 - 12])) { + scr_creation(2); + scr_creation(3); + scr_creation(4); + scr_creation(5); + scr_creation(6); + scr_creation(7); + } + } + draw_set_alpha(1); + + var q = 1, x3 = (room_width / 2) - 77, y3 = 790; + draw_set_color(CM_GREEN_COLOR); + repeat (7) { + draw_circle(x3, y3, 10, 1); + draw_circle(x3, y3, 9.5, 1); + draw_circle(x3, y3, 9, 1); + + if (slide_show == q) { + draw_circle(x3, y3, 8.5, 0); + } + if (slide_show != q) { + draw_circle(x3, y3, 8.5, 1); + } + x3 += 25; + q += 1; + } + + //TODO refactor to make arrow buttoon objects + if ((popup == "") && ((change_slide >= 70) || (change_slide <= 0)) && (!instance_exists(obj_creation_popup))) { + if (point_and_click([925, 756, 997, 824])) { + // Next slide + if (slide >= eCREATIONSLIDES.CHAPTERTRAITS && slide <= eCREATIONSLIDES.CHAPTERMASTER) { + scr_creation(slide); + } + } + + if (point_and_click([604, 756, 675, 824])) { + // Previous slide + change_slide = 1; + goto_slide = slide - 1; + popup = ""; + if (goto_slide == eCREATIONSLIDES.CHAPTERSELECT) { + highlight = 0; + highlighting = 0; + old_highlight = 0; + } + } + } + } + + if (tooltip != "" && tooltip2 != "" && change_slide <= 0) { + draw_set_alpha(1); + draw_set_color(0); + draw_set_halign(fa_left); + draw_set_font(fnt_40k_14b); + var _width1 = string_width_ext(string_hash_to_newline(tooltip), -1, 500); + draw_set_font(fnt_40k_14); + var _width2 = string_width_ext(string_hash_to_newline(tooltip2), -1, 500); + var _height = string_height_ext(string_hash_to_newline(tooltip2), -1, 500); + + draw_rectangle(mouse_x + 18, mouse_y + 20, mouse_x + max(_width1, _width2) + 24, mouse_y + 44 + _height, 0); + draw_set_color(CM_GREEN_COLOR); + draw_rectangle(mouse_x + 18, mouse_y + 20, mouse_x + max(_width1, _width2) + 24, mouse_y + 44 + _height, 1); + draw_set_font(fnt_40k_14b); + draw_text(mouse_x + 22, mouse_y + 22, string_hash_to_newline(string(tooltip))); + draw_set_font(fnt_40k_14); + draw_text_ext(mouse_x + 22, mouse_y + 42, string_hash_to_newline(string(tooltip2)), -1, 500); + } } catch (_exception) { - handle_exception(_exception); + handle_exception(_exception); room_goto(Main_Menu); } diff --git a/objects/obj_creation/Step_0.gml b/objects/obj_creation/Step_0.gml index 2fa50af89d..d31b9338ce 100644 --- a/objects/obj_creation/Step_0.gml +++ b/objects/obj_creation/Step_0.gml @@ -1,15 +1,15 @@ -if (slide==1){ - if (keyboard_string=="137"){ - highlight=18; - cooldown=8000; - chapter_name="Doom Benefactors"; +if (slide == 1) { + if (keyboard_string == "137") { + highlight = 18; + cooldown = 8000; + chapter_name = "Doom Benefactors"; scr_chapter_new(chapter_name); - keyboard_string=""; - if (chapter_name!="nopw_nopw"){ - custom=eCHAPTER_TYPE.PREMADE; - change_slide=1; - goto_slide=2; - chapter_string=chapter_name; + keyboard_string = ""; + if (chapter_name != "nopw_nopw") { + custom = eCHAPTER_TYPE.PREMADE; + change_slide = 1; + goto_slide = 2; + chapter_string = chapter_name; } scr_creation(2); scr_creation(3); @@ -19,212 +19,279 @@ if (slide==1){ } } // Play audio -if (slate5==1) or (slate6==1){ - if (master_volume>0) and (effect_volume>0){ - audio_play_sound(snd_buzz,0,0); - audio_sound_gain(snd_buzz,1*master_volume*effect_volume,0); +if ((slate5 == 1) || (slate6 == 1)) { + if ((master_volume > 0) && (effect_volume > 0)) { + audio_play_sound(snd_buzz, 0, 0); + audio_sound_gain(snd_buzz, 1 * master_volume * effect_volume, 0); } } +if (fade_in > 0) { + fade_in -= 1; +} +if ((fade_in <= 0) && (slate1 > 0)) { + slate1 -= 1; +} +if ((slate1 <= 0) && (slate2 < 20)) { + slate2 += 1; +} +if ((slate1 <= 0) && (slate3 < 20)) { + slate3 += 1; +} -if (fade_in>0) then fade_in-=1; -if (fade_in<=0) and (slate1>0) then slate1-=1; -if (slate1<=0) and (slate2<20) then slate2+=1; -if (slate1<=0) and (slate3<20) then slate3+=1; - -if (slate2>=7) and (slate4<30) then slate4+=1; +if ((slate2 >= 7) && (slate4 < 30)) { + slate4 += 1; +} -if (slate5>=1) and (slate5<=60) then slate5+=1; -if (slate5=61) then slate5=0; -if (slate6>=1) and (slate6<=60) then slate6+=1; -if (slate6=61) then slate6=0; +if ((slate5 >= 1) && (slate5 <= 60)) { + slate5 += 1; +} +if (slate5 == 61) { + slate5 = 0; +} +if ((slate6 >= 1) && (slate6 <= 60)) { + slate6 += 1; +} +if (slate6 == 61) { + slate6 = 0; +} -if (slate4>=30){ - if (floor(random(660))==5) and (slate5<=0) then slate5=1; - if (floor(random(660))==6) and (slate6<=0) then slate6=1; +if (slate4 >= 30) { + if ((floor(random(660)) == 5) && (slate5 <= 0)) { + slate5 = 1; + } + if ((floor(random(660)) == 6) && (slate6 <= 0)) { + slate6 = 1; + } } -if (change_slide>0){change_slide+=1;} -if (change_slide>0){change_slide+=1;} -if (change_slide>=100) then change_slide=-1; -if (change_slide>=100) then change_slide=-1; +if (change_slide > 0) { + change_slide += 1; +} +if (change_slide > 0) { + change_slide += 1; +} +if (change_slide >= 100) { + change_slide = -1; +} +if (change_slide >= 100) { + change_slide = -1; +} // Sets up a new chapter with default options -if (change_slide==35) or (change_slide==36) or (chapter_name=="Doom Benefactors") or (chapter_string=="Doom Benefactors"){ - if (goto_slide==1){ - highlight=0; - highlighting=0; - old_highlight=0; - - text_selected="none"; - text_bar=0; - tooltip=""; - tooltip2=""; - popup=""; - temp=0; - target_gear=0; - tab=0; - - chapter_name="Unnamed"; - chapter_string="Unnamed"; - custom=eCHAPTER_TYPE.PREMADE; - founding=ePROGENITOR.NONE; - points=0; - maxpoints=100; - fleet_type=1; - strength=5; - cooperation=5; - purity=5; - stability=90; - for(var i=0; i<16; i++){ - adv[i]=""; - adv_num[i]=0; - dis[i]=""; - dis_num[i]=0; +if ((change_slide == 35) || (change_slide == 36) || (chapter_name == "Doom Benefactors") || (chapter_string == "Doom Benefactors")) { + if (goto_slide == 1) { + highlight = 0; + highlighting = 0; + old_highlight = 0; + + text_selected = "none"; + text_bar = 0; + tooltip = ""; + tooltip2 = ""; + popup = ""; + temp = 0; + target_gear = 0; + tab = 0; + + chapter_name = "Unnamed"; + chapter_string = "Unnamed"; + custom = eCHAPTER_TYPE.PREMADE; + founding = ePROGENITOR.NONE; + points = 0; + maxpoints = 100; + fleet_type = 1; + strength = 5; + cooperation = 5; + purity = 5; + stability = 90; + for (var i = 0; i < 16; i++) { + adv[i] = ""; + adv_num[i] = 0; + dis[i] = ""; + dis_num[i] = 0; } - homeworld="Temperate"; - homeworld_name=global.name_generator.generate_star_name(); - recruiting="Death"; - recruiting_name=global.name_generator.generate_star_name(); - flagship_name=global.name_generator.generate_imperial_ship_name(); - recruiting_exists=1; - homeworld_exists=1; - homeworld_rule=1; - aspirant_trial=eTrials.BLOODDUEL; - discipline="librarius"; - battle_cry="For the Emperor"; - main_color=1; - secondary_color=1; - main_trim=1; + homeworld = "Temperate"; + homeworld_name = global.name_generator.generate_star_name(); + recruiting = "Death"; + recruiting_name = global.name_generator.generate_star_name(); + flagship_name = global.name_generator.generate_imperial_ship_name(); + recruiting_exists = 1; + homeworld_exists = 1; + homeworld_rule = 1; + aspirant_trial = eTrials.BLOODDUEL; + discipline = "librarius"; + battle_cry = "For the Emperor"; + main_color = 1; + secondary_color = 1; + main_trim = 1; // Left/Right pauldron - left_pauldron=1; - right_pauldron=1; - lens_color=1; - weapon_color=1; - col_special=0; - color_to_main=""; - color_to_secondary=""; - color_to_trim=""; - color_to_pauldron=""; - color_to_pauldron2=""; - color_to_lens=""; - color_to_weapon=""; - trim=1; - hapothecary=global.name_generator.generate_space_marine_name(); - hchaplain=global.name_generator.generate_space_marine_name(); - clibrarian=global.name_generator.generate_space_marine_name(); - fmaster=global.name_generator.generate_space_marine_name(); - recruiter=global.name_generator.generate_space_marine_name(); - admiral=global.name_generator.generate_space_marine_name(); - equal_specialists=0; - load_to_ships=[2,0,0]; - successors=0; - mutations=0; - mutations_selected=0; - preomnor=0; - voice=0; - doomed=0; - lyman=0; - omophagea=0; - ossmodula=0; - membrane=0; - zygote=0; - betchers=0; - catalepsean=0; - secretions=0; - occulobe=0; - mucranoid=0; - - disposition[0]=0; - disposition[eFACTION.Player]=0;// Prog - disposition[eFACTION.Imperium]=0;// Imp - disposition[eFACTION.Mechanicus]=0;// Mech - disposition[4]=0;// Inq - disposition[5]=0;// Ecclesiarchy - disposition[6]=0;// Astartes - disposition[7]=0;// Reserved - - chapter_master_name=global.name_generator.generate_space_marine_name(); - chapter_master_melee=1; - chapter_master_ranged=1; - chapter_master_specialty=2; - } - slide=goto_slide; - slide_show=goto_slide; -} - -if (text_selected!="") and (text_selected!="none") then text_bar+=1; -if (text_bar>60) then text_bar=1; - -if (cooldown>0) and (cooldown<=5000) then cooldown-=1; + left_pauldron = 1; + right_pauldron = 1; + lens_color = 1; + weapon_color = 1; + col_special = 0; + color_to_main = ""; + color_to_secondary = ""; + color_to_trim = ""; + color_to_pauldron = ""; + color_to_pauldron2 = ""; + color_to_lens = ""; + color_to_weapon = ""; + trim = 1; + hapothecary = global.name_generator.generate_space_marine_name(); + hchaplain = global.name_generator.generate_space_marine_name(); + clibrarian = global.name_generator.generate_space_marine_name(); + fmaster = global.name_generator.generate_space_marine_name(); + recruiter = global.name_generator.generate_space_marine_name(); + admiral = global.name_generator.generate_space_marine_name(); + equal_specialists = 0; + load_to_ships = [2, 0, 0]; + successors = 0; + mutations = 0; + mutations_selected = 0; + preomnor = 0; + voice = 0; + doomed = 0; + lyman = 0; + omophagea = 0; + ossmodula = 0; + membrane = 0; + zygote = 0; + betchers = 0; + catalepsean = 0; + secretions = 0; + occulobe = 0; + mucranoid = 0; + + disposition[0] = 0; + disposition[eFACTION.Player] = 0; // Prog + disposition[eFACTION.Imperium] = 0; // Imp + disposition[eFACTION.Mechanicus] = 0; // Mech + disposition[4] = 0; // Inq + disposition[5] = 0; // Ecclesiarchy + disposition[6] = 0; // Astartes + disposition[7] = 0; // Reserved + + chapter_master_name = global.name_generator.generate_space_marine_name(); + chapter_master_melee = 1; + chapter_master_ranged = 1; + chapter_master_specialty = 2; + } + slide = goto_slide; + slide_show = goto_slide; +} + +if ((text_selected != "") && (text_selected != "none")) { + text_bar += 1; +} +if (text_bar > 60) { + text_bar = 1; +} + +if ((cooldown > 0) && (cooldown <= 5000)) { + cooldown -= 1; +} // Checks if the name already exists -if (custom==eCHAPTER_TYPE.CUSTOM){ - name_bad=0; - if (chapter_name=="") then name_bad=1; - if (chapter_name=="Dark Angels") then name_bad=1; - if (chapter_name=="White Scars") then name_bad=1; - if (chapter_name=="Space Wolves") then name_bad=1; - if (chapter_name=="Imperial Fists") then name_bad=1; - if (chapter_name=="Blood Angels") then name_bad=1; - if (chapter_name=="Iron Hands") then name_bad=1; - if (chapter_name=="Ultramarines") then name_bad=1; - if (chapter_name=="Salamanders") then name_bad=1; - if (chapter_name=="Raven Guard") then name_bad=1; - if (chapter_name=="Blood Ravens") then name_bad=1; - if (chapter_name=="Doom Benefactors") then name_bad=1; - if (chapter_name=="Crimson Fists") then name_bad=1; - if (chapter_name=="Minotaurs") then name_bad=1; - if (chapter_name=="Black Templars") then name_bad=1; - if (chapter_name=="Soul Drinkers") then name_bad=1; -} -var good=0; -if (array_length(col)>0){ - if (color_to_main!=""){ - main_color = max(array_find_value(col,color_to_main),0); +if (custom == eCHAPTER_TYPE.CUSTOM) { + name_bad = 0; + if (chapter_name == "") { + name_bad = 1; + } + if (chapter_name == "Dark Angels") { + name_bad = 1; + } + if (chapter_name == "White Scars") { + name_bad = 1; + } + if (chapter_name == "Space Wolves") { + name_bad = 1; + } + if (chapter_name == "Imperial Fists") { + name_bad = 1; + } + if (chapter_name == "Blood Angels") { + name_bad = 1; + } + if (chapter_name == "Iron Hands") { + name_bad = 1; + } + if (chapter_name == "Ultramarines") { + name_bad = 1; + } + if (chapter_name == "Salamanders") { + name_bad = 1; + } + if (chapter_name == "Raven Guard") { + name_bad = 1; + } + if (chapter_name == "Blood Ravens") { + name_bad = 1; + } + if (chapter_name == "Doom Benefactors") { + name_bad = 1; + } + if (chapter_name == "Crimson Fists") { + name_bad = 1; + } + if (chapter_name == "Minotaurs") { + name_bad = 1; + } + if (chapter_name == "Black Templars") { + name_bad = 1; + } + if (chapter_name == "Soul Drinkers") { + name_bad = 1; + } +} +var good = 0; +if (array_length(col) > 0) { + if (color_to_main != "") { + main_color = max(array_find_value(col, color_to_main), 0); color_to_main = ""; } - if (color_to_secondary!=""){ - secondary_color = max(array_find_value(col,color_to_secondary),0); + if (color_to_secondary != "") { + secondary_color = max(array_find_value(col, color_to_secondary), 0); color_to_secondary = ""; } - if (color_to_trim!=""){ - main_trim = max(array_find_value(col,color_to_trim),0); + if (color_to_trim != "") { + main_trim = max(array_find_value(col, color_to_trim), 0); color_to_trim = ""; } - if (color_to_pauldron!=""){ - right_pauldron = max(array_find_value(col,color_to_pauldron),0); - color_to_pauldron = ""; + if (color_to_pauldron != "") { + right_pauldron = max(array_find_value(col, color_to_pauldron), 0); + color_to_pauldron = ""; } - if (color_to_pauldron2!=""){ - left_pauldron = max(array_find_value(col,color_to_pauldron2),0); + if (color_to_pauldron2 != "") { + left_pauldron = max(array_find_value(col, color_to_pauldron2), 0); color_to_pauldron2 = ""; } - if (color_to_lens!=""){ - lens_color = max(array_find_value(col,color_to_lens),0); - color_to_lens = ""; + if (color_to_lens != "") { + lens_color = max(array_find_value(col, color_to_lens), 0); + color_to_lens = ""; } - if (color_to_weapon!=""){ - weapon_color = max(array_find_value(col,color_to_weapon),0); + if (color_to_weapon != "") { + weapon_color = max(array_find_value(col, color_to_weapon), 0); color_to_weapon = ""; } } -if (company_liveries == ""){ +if (company_liveries == "") { livery_picker.scr_unit_draw_data(-1); - company_liveries = array_create(11,variable_clone(livery_picker.map_colour)); + company_liveries = array_create(11, variable_clone(livery_picker.map_colour)); } -if (full_liveries == ""){ +if (full_liveries == "") { var struct_cols = { - main_color :main_color, - secondary_color:secondary_color, - main_trim:main_trim, - right_pauldron:right_pauldron, - left_pauldron:left_pauldron, - lens_color:lens_color, - weapon_color:weapon_color - } + main_color: main_color, + secondary_color: secondary_color, + main_trim: main_trim, + right_pauldron: right_pauldron, + left_pauldron: left_pauldron, + lens_color: lens_color, + weapon_color: weapon_color, + }; livery_picker.scr_unit_draw_data(); - livery_picker.set_default_armour(struct_cols,col_special); - full_liveries = array_create(21,variable_clone(livery_picker.map_colour)); + livery_picker.set_default_armour(struct_cols, col_special); + full_liveries = array_create(21, variable_clone(livery_picker.map_colour)); full_liveries[eROLE.Librarian] = livery_picker.set_default_librarian(struct_cols); full_liveries[eROLE.Chaplain] = livery_picker.set_default_chaplain(struct_cols); @@ -233,8 +300,8 @@ if (full_liveries == ""){ full_liveries[eROLE.Techmarine] = livery_picker.set_default_techmarines(struct_cols); livery_picker.scr_unit_draw_data(); - livery_picker.set_default_armour(struct_cols,col_special); + livery_picker.set_default_armour(struct_cols, col_special); } // on left mouse release, if greater than 5000 and less than 9000, set cooldown to 0 -// if >=9000 then don't decrease at all +// if >=9000 then don't decrease at all diff --git a/objects/obj_en_fleet/Alarm_1.gml b/objects/obj_en_fleet/Alarm_1.gml index 93ce5b0489..048974e926 100644 --- a/objects/obj_en_fleet/Alarm_1.gml +++ b/objects/obj_en_fleet/Alarm_1.gml @@ -1,117 +1,133 @@ +try_and_report_loop("enemy fleet main end turn action", function() { + var orb = orbiting; + if ((round(owner) != eFACTION.Imperium) && (navy == 1)) { + owner = noone; + } -try_and_report_loop("enemy fleet main end turn action",function(){ -var orb=orbiting; - -if (round(owner)!=eFACTION.Imperium) and (navy=1){ - owner= noone; -} - -//TODO centralise orbiting logic -var _is_orbiting = is_orbiting(); -if (orbiting != 0 && action=="" && owner!=noone){ - var orbiting_found=_is_orbiting; - if (orbiting_found){ - orbiting_found = variable_instance_exists(orbiting, "present_fleet"); - if (orbiting_found){ - orbiting.present_fleet[owner]+=1; + //TODO centralise orbiting logic + var _is_orbiting = is_orbiting(); + if (orbiting != 0 && action == "" && owner != noone) { + var orbiting_found = _is_orbiting; + if (orbiting_found) { + orbiting_found = variable_instance_exists(orbiting, "present_fleet"); + if (orbiting_found) { + orbiting.present_fleet[owner] += 1; + } + } else if (!orbiting_found) { + orbiting = instance_nearest(x, y, obj_star); + orbiting.present_fleet[owner]++; } - } - else if (!orbiting_found) { - orbiting = instance_nearest(x,y,obj_star); - orbiting.present_fleet[owner]++; } -} -var _khorne_cargo = fleet_has_cargo("warband"); -if (_khorne_cargo && owner=eFACTION.Chaos) { - khorne_fleet_cargo(); -} - -if (_is_orbiting) { - turns_static++; - if (turns_static>5 && owner==eFACTION.Ork){ - if (!irandom(7)){ - ork_fleet_move(); - _is_orbiting=false; - } - } - if (instance_exists(obj_crusade)){ - try{ - fleet_respond_crusade(); - } catch(_exception) { - handle_exception(_exception); - } - } -} else { - turns_static = 0; -} - - - - -var dir=0; -var ret=0; - -if (navy && action=="" && _is_orbiting) { - navy_orbiting_planet_end_turn_action(); -} -else if (action=="" && _is_orbiting){ - var max_dis=400; - - - if (orbiting.owner=eFACTION.Player) and (obj_controller.faction_status[eFACTION.Imperium]="War") and (owner=eFACTION.Imperium){ - for (var i=1;i<=orbiting.planets;i++){ - if (orbiting.p_owner[i]=1) then orbiting.p_pdf[i]-=capital_number*50000; - if (orbiting.p_owner[i]=1) then orbiting.p_pdf[i]-=frigate_number*10000; - if (orbiting.p_pdf[i]<0) then orbiting.p_pdf[i]=0; - } + var _khorne_cargo = fleet_has_cargo("warband"); + if (_khorne_cargo && owner == eFACTION.Chaos) { + khorne_fleet_cargo(); } - - // 1355; - - - if (instance_exists(obj_crusade)) and (owner=eFACTION.Ork) and (orbiting.owner=eFACTION.Ork){// Ork crusade AI - var max_dis; - max_dis=400; - - var fleet_owner = owner; - with(obj_crusade){if (owner!=fleet_owner){x-=40000;}} - - with(obj_star){ - var ns=instance_nearest(x,y,obj_crusade); - if (point_distance(x,y,ns.x,ns.y)>ns.radius){x-=40000;} - if (owner=ns.owner){x-=40000;} + if (_is_orbiting) { + turns_static++; + if (turns_static > 5 && owner == eFACTION.Ork) { + if (!irandom(7)) { + ork_fleet_move(); + _is_orbiting = false; + } } - - var ns=instance_nearest(x,y,obj_star); - if (ns.owner != eFACTION.Ork) and (point_distance(x,y,ns.x,ns.y)<=max_dis) and (point_distance(x,y,ns.x,ns.y)>40) and (instance_exists(obj_crusade)) and (image_index>3){ - action_x=ns.x; - action_y=ns.y; - set_fleet_movement(); - home_x=orbiting.x; - home_y=orbiting.y; - exit; + if (instance_exists(obj_crusade)) { + try { + fleet_respond_crusade(); + } catch (_exception) { + handle_exception(_exception); + } } - - with(obj_star){ - if (x<-30000) then x+=40000; - if (x<-30000) then x+=40000; - if (x<-30000) then x+=40000; + } else { + turns_static = 0; + } + + var dir = 0; + var ret = 0; + + if (navy && action == "" && _is_orbiting) { + navy_orbiting_planet_end_turn_action(); + } else if (action == "" && _is_orbiting) { + var max_dis = 400; + + if ((orbiting.owner == eFACTION.Player) && (obj_controller.faction_status[eFACTION.Imperium] == "War") && (owner == eFACTION.Imperium)) { + for (var i = 1; i <= orbiting.planets; i++) { + if (orbiting.p_owner[i] == 1) { + orbiting.p_pdf[i] -= capital_number * 50000; + } + if (orbiting.p_owner[i] == 1) { + orbiting.p_pdf[i] -= frigate_number * 10000; + } + if (orbiting.p_pdf[i] < 0) { + orbiting.p_pdf[i] = 0; + } + } } - with(obj_crusade){ - if (x<-30000) then x+=40000; - if (x<-30000) then x+=40000; - if (x<-30000) then x+=40000; + + // 1355; + + if (instance_exists(obj_crusade) && (owner == eFACTION.Ork) && (orbiting.owner == eFACTION.Ork)) { + // Ork crusade AI + var max_dis; + max_dis = 400; + + var fleet_owner = owner; + with (obj_crusade) { + if (owner != fleet_owner) { + x -= 40000; + } + } + + with (obj_star) { + var ns = instance_nearest(x, y, obj_crusade); + if (point_distance(x, y, ns.x, ns.y) > ns.radius) { + x -= 40000; + } + if (owner == ns.owner) { + x -= 40000; + } + } + + var ns = instance_nearest(x, y, obj_star); + if ((ns.owner != eFACTION.Ork) && (point_distance(x, y, ns.x, ns.y) <= max_dis) && (point_distance(x, y, ns.x, ns.y) > 40) && instance_exists(obj_crusade) && (image_index > 3)) { + action_x = ns.x; + action_y = ns.y; + set_fleet_movement(); + home_x = orbiting.x; + home_y = orbiting.y; + exit; + } + + with (obj_star) { + if (x < -30000) { + x += 40000; + } + if (x < -30000) { + x += 40000; + } + if (x < -30000) { + x += 40000; + } + } + with (obj_crusade) { + if (x < -30000) { + x += 40000; + } + if (x < -30000) { + x += 40000; + } + if (x < -30000) { + x += 40000; + } + } } - } - - - instance_activate_object(obj_star); - instance_activate_object(obj_crusade); - instance_activate_object(obj_en_fleet); - - /*if (action="") and (owner = eFACTION.Imperium){// Defend nearby systems and return when done + + instance_activate_object(obj_star); + instance_activate_object(obj_crusade); + instance_activate_object(obj_en_fleet); + + /*if (action="") and (owner = eFACTION.Imperium){// Defend nearby systems and return when done with(obj_star){ // 137 ; might want for it to defend under other circumstances @@ -149,100 +165,132 @@ else if (action=="" && _is_orbiting){ with(obj_temp3){instance_destroy();} }*/ - - - - if (owner=eFACTION.Inquisition){ - var valid = true; - if (instance_exists(target)){ - if (instance_nearest(target.x,target.y, obj_star).id != instance_nearest(x,y, obj_star).id){ - valid=false; + + if (owner == eFACTION.Inquisition) { + var valid = true; + if (instance_exists(target)) { + if (instance_nearest(target.x, target.y, obj_star).id != instance_nearest(x, y, obj_star).id) { + valid = false; + } } - } - if (((orbiting.owner = eFACTION.Player || system_feature_bool(orbiting.p_feature, P_features.Monastery)) or (obj_ini.fleet_type != ePlayerBase.home_world)) and (trade_goods!="cancel_inspection") && valid){ - if (obj_controller.disposition[6]>=60) then scr_loyalty("Xeno Associate","+"); - if (obj_controller.disposition[7]>=60) then scr_loyalty("Xeno Associate","+"); - if (obj_controller.disposition[8]>=60) then scr_loyalty("Xeno Associate","+"); - - if (orbiting.p_owner[2]=1) and (orbiting.p_heresy[2]>=60) then scr_loyalty("Heretic Homeworld","+"); - - var whom=-1; - whom = inquisitor; - var inquisitors = obj_controller.inquisitor; - var inquis_string = $"Inquisitor {whom>-1 ? inquisitors[whom] : inquisitors[0]}"; - - // INVESTIGATE DEAD HERE 137 ; INVESTIGATE DEAD HERE 137 ; INVESTIGATE DEAD HERE 137 ; INVESTIGATE DEAD HERE 137 ; - var cur_star,t,type,cha,dem,tem1,tem1_base,perc,popup; - t=0;type=0;cha=0;dem=0;tem1=0;popup=0;perc=0;tem1_base=0; - - cur_star=instance_nearest(x,y,obj_star); - - if (string_count("investigate",trade_goods)>0){ - // Check for xenos or demon-equip items on those planets - //TODO update this to check weapon or artifact tags - var e=0,ia=-1,ca=0; - var _unit; - repeat(4400){ - if (ca<=10) and (ca>=0){ - ia+=1; - if (ia=400){ca+=1;ia=1; - if (ca=11) then ca=-5;} - if (ca>=0) and (ca<11){ - _unit=fetch_unit([ca,ia]); - if (_unit.location_string=cur_star.name) and (_unit.planet_location>0){ - if (_unit.role()="Ork Sniper") and (obj_ini.race[ca,ia]!=1){tem1_base=3;} - if (_unit.role()="Flash Git") and (obj_ini.race[ca,ia]!=1){tem1_base=3;} - if (_unit.role()="Ranger") and (obj_ini.race[ca,ia]!=1){tem1_base=3;} - if (_unit.equipped_artifact_tag("daemon")){ - tem1_base+=3; - dem+=1; + if (((orbiting.owner == eFACTION.Player || system_feature_bool(orbiting.p_feature, P_features.Monastery)) || (obj_ini.fleet_type != ePlayerBase.home_world)) && (trade_goods != "cancel_inspection") && valid) { + if (obj_controller.disposition[6] >= 60) { + scr_loyalty("Xeno Associate", "+"); + } + if (obj_controller.disposition[7] >= 60) { + scr_loyalty("Xeno Associate", "+"); + } + if (obj_controller.disposition[8] >= 60) { + scr_loyalty("Xeno Associate", "+"); + } + + if ((orbiting.p_owner[2] == 1) && (orbiting.p_heresy[2] >= 60)) { + scr_loyalty("Heretic Homeworld", "+"); + } + + var whom = -1; + whom = inquisitor; + var inquisitors = obj_controller.inquisitor; + var inquis_string = $"Inquisitor {whom > -1 ? inquisitors[whom] : inquisitors[0]}"; + + // INVESTIGATE DEAD HERE 137 ; INVESTIGATE DEAD HERE 137 ; INVESTIGATE DEAD HERE 137 ; INVESTIGATE DEAD HERE 137 ; + var cur_star, t, type, cha, dem, tem1, tem1_base, perc, popup; + t = 0; + type = 0; + cha = 0; + dem = 0; + tem1 = 0; + popup = 0; + perc = 0; + tem1_base = 0; + + cur_star = instance_nearest(x, y, obj_star); + + if (string_count("investigate", trade_goods) > 0) { + // Check for xenos or demon-equip items on those planets + //TODO update this to check weapon or artifact tags + var e = 0, ia = -1, ca = 0; + var _unit; + repeat (4400) { + if ((ca <= 10) && (ca >= 0)) { + ia += 1; + if (ia == 400) { + ca += 1; + ia = 1; + if (ca == 11) { + ca = -5; + } + } + if ((ca >= 0) && (ca < 11)) { + _unit = fetch_unit([ca, ia]); + if ((_unit.location_string == cur_star.name) && (_unit.planet_location > 0)) { + if ((_unit.role() == "Ork Sniper") && (obj_ini.race[ca][ia] != 1)) { + tem1_base = 3; + } + if ((_unit.role() == "Flash Git") && (obj_ini.race[ca][ia] != 1)) { + tem1_base = 3; + } + if ((_unit.role() == "Ranger") && (obj_ini.race[ca][ia] != 1)) { + tem1_base = 3; + } + if (_unit.equipped_artifact_tag("daemon")) { + tem1_base += 3; + dem += 1; + } } } } } + repeat (cur_star.planets) { + t += 1; + inquisitor_contraband_take_popup(_cur_star, planet); + } + } else if (string_count("investigate", trade_goods) == 0) { + inquisition_inspection_logic(); } - repeat(cur_star.planets){ - t+=1; - inquisitor_contraband_take_popup(_cur_star,planet); + // End Test-Slave Incubator Crap + + if (obj_controller.known[eFACTION.Inquisition] == 1) { + obj_controller.known[eFACTION.Inquisition] = 3; } - }else if (string_count("investigate",trade_goods)==0){ - inquisition_inspection_logic(); - } - // End Test-Slave Incubator Crap - - if (obj_controller.known[eFACTION.Inquisition]=1){obj_controller.known[eFACTION.Inquisition]=3;} - if (obj_controller.known[eFACTION.Inquisition]=2){obj_controller.known[eFACTION.Inquisition]=4;} - - orbiting=instance_nearest(x,y,obj_star); - - // 135; - if (obj_controller.loyalty_hidden<=0){// obj_controller.alarm[7]=1;global.defeat=2; - var moo=false; - if (obj_controller.penitent=1) and (moo=false){ - obj_controller.alarm[8]=1; - moo=true; + if (obj_controller.known[eFACTION.Inquisition] == 2) { + obj_controller.known[eFACTION.Inquisition] = 4; } - if (obj_controller.penitent=0) and (moo=false) then scr_audience(4,"loyalty_zero",0,"",0,0); + + orbiting = instance_nearest(x, y, obj_star); + + // 135; + if (obj_controller.loyalty_hidden <= 0) { + // obj_controller.alarm[7]=1;global.defeat=2; + var moo = false; + if ((obj_controller.penitent == 1) && (moo == false)) { + obj_controller.alarm[8] = 1; + moo = true; + } + if ((obj_controller.penitent == 0) && (moo == false)) { + scr_audience(4, "loyalty_zero", 0, "", 0, 0); + } + } + + exit_star = distance_removed_star(x, y, choose(2, 3, 4)); + action_x = exit_star.x; + action_y = exit_star.y; + orbiting = exit_star; + set_fleet_movement(); + trade_goods = "|DELETE|"; + exit; } - - exit_star=distance_removed_star(x,y, choose(2,3,4)); - action_x=exit_star.x; - action_y=exit_star.y; - orbiting=exit_star; - set_fleet_movement(); - trade_goods="|DELETE|"; - exit; - } - } - - if (owner=eFACTION.Tau){ - if (instance_exists(obj_p_fleet)) and (obj_controller.known[eFACTION.Tau]==0){ - var p_ship =instance_nearest(x,y,obj_p_fleet); - if (p_ship.action="") and (point_distance(x,y,p_ship.x,p_ship.y)<=80) then obj_controller.known[eFACTION.Tau] = 1; } - - - /*if (image_index>=4){ + + if (owner == eFACTION.Tau) { + if (instance_exists(obj_p_fleet) && (obj_controller.known[eFACTION.Tau] == 0)) { + var p_ship = instance_nearest(x, y, obj_p_fleet); + if ((p_ship.action == "") && (point_distance(x, y, p_ship.x, p_ship.y) <= 80)) { + obj_controller.known[eFACTION.Tau] = 1; + } + } + + /*if (image_index>=4){ with(obj_star){ if (owner = eFACTION.Tau) and (present_fleets>0) and (tau_fleets=0){ instance_create(x,y,obj_temp5); @@ -258,159 +306,172 @@ else if (action=="" && _is_orbiting){ } with(obj_temp5){instance_destroy();} }*/ - } - - if (owner == eFACTION.Tyranids) {// Juggle bio-resources - if (capital_number*2>frigate_number){ - capital_number-=1;frigate_number+=2; - } - - if (capital_number*4>escort_number){ - var rand; - rand=choose(1,2,3,4); - if (rand=4) then escort_number+=1; } - - - - if (capital_number>0){ - var capitals_engaged=0; - with (orbiting){ - for (var i=1;i frigate_number) { + capital_number -= 1; + frigate_number += 2; } - } - - - var n=false; - with (orbiting){ - n = is_dead_star(); - } - - if (n){ - var xx,yy,good, plin, plin2; - xx=0;yy=0;good=0;plin=0;plin2=0; - - if (capital_number>5) then n=5; - - instance_deactivate_object(orbiting); - - repeat(100){ - if (good!=5){ - xx=self.x+random_range(-300,300); - yy=self.y+random_range(-300,300); - if (good=0) then plin=instance_nearest(xx,yy,obj_star); - if (good=1) and (n=5) then plin2=instance_nearest(xx,yy,obj_star); - - good = !array_contains(plin.p_type, "dead"); - - if (good=1) and (n=5){ - if (!instance_exists(plin2)) then exit; - if (!array_contains(plin.p_type, "dead")) then good++ - - var new_fleet; - new_fleet=instance_create(x,y,obj_en_fleet); - new_fleet.capital_number=floor(capital_number*0.4); - new_fleet.frigate_number=floor(frigate_number*0.4); - new_fleet.escort_number=floor(escort_number*0.4); - - capital_number-=new_fleet.capital_number; - frigate_number-=new_fleet.frigate_number; - escort_number-=new_fleet.escort_number; - - new_fleet.owner=eFACTION.Tyranids; - new_fleet.sprite_index=spr_fleet_tyranid; - new_fleet.image_index=1; - - /*with(new_fleet){ + if (capital_number * 4 > escort_number) { + var rand; + rand = choose(1, 2, 3, 4); + if (rand == 4) { + escort_number += 1; + } + } + + if (capital_number > 0) { + var capitals_engaged = 0; + with (orbiting) { + for (var i = 1; i < planets; i++) { + if (capitals_engaged == capital_number) { + break; + } + if (p_type[i] != "Dead") { + p_tyranids[4] = 5; + capitals_engaged += 1; + } + } + } + } + + var n = false; + with (orbiting) { + n = is_dead_star(); + } + + if (n) { + var xx, yy, good, plin, plin2; + xx = 0; + yy = 0; + good = 0; + plin = 0; + plin2 = 0; + + if (capital_number > 5) { + n = 5; + } + + instance_deactivate_object(orbiting); + + repeat (100) { + if (good != 5) { + xx = self.x + random_range(-300, 300); + yy = self.y + random_range(-300, 300); + if (good == 0) { + plin = instance_nearest(xx, yy, obj_star); + } + if ((good == 1) && (n == 5)) { + plin2 = instance_nearest(xx, yy, obj_star); + } + + good = !array_contains(plin.p_type, "dead"); + + if ((good == 1) && (n == 5)) { + if (!instance_exists(plin2)) { + exit; + } + if (!array_contains(plin.p_type, "dead")) { + good++; + } + + var new_fleet; + new_fleet = instance_create(x, y, obj_en_fleet); + new_fleet.capital_number = floor(capital_number * 0.4); + new_fleet.frigate_number = floor(frigate_number * 0.4); + new_fleet.escort_number = floor(escort_number * 0.4); + + capital_number -= new_fleet.capital_number; + frigate_number -= new_fleet.frigate_number; + escort_number -= new_fleet.escort_number; + + new_fleet.owner = eFACTION.Tyranids; + new_fleet.sprite_index = spr_fleet_tyranid; + new_fleet.image_index = 1; + + /*with(new_fleet){ var ii;ii=0;ii+=capital_number;ii+=round((frigate_number/2));ii+=round((escort_number/4)); if (ii<=1) then ii=1;image_index=ii; }*/ - - new_fleet.action_x=plin2.x; - new_fleet.action_y=plin2.y; - with(new_fleet){ - set_fleet_movement(); + + new_fleet.action_x = plin2.x; + new_fleet.action_y = plin2.y; + with (new_fleet) { + set_fleet_movement(); + } + break; + } + + if ((good == 1) && instance_exists(plin)) { + action_x = plin.x; + action_y = plin.y; + set_fleet_movement(); + if (n != 5) { + good = 5; + } } - break; - } - - - if (good=1) and (instance_exists(plin)){ - action_x=plin.x; - action_y=plin.y; - set_fleet_movement(); - if (n!=5) then good=5; } } + instance_activate_object(obj_star); } - instance_activate_object(obj_star); } } -} + if ((action == "move") && (action_eta > 5000)) { + var woop = instance_nearest(x, y, obj_star); + if (woop.storm == 0) { + action_eta -= 10000; + } else { + if (!instance_nearest(target_x, target_y, obj_star).storm) { + action_eta -= 10000; + } + } + } else if ((action == "move") && (action_eta < 5000)) { + if (instance_nearest(action_x, action_y, obj_star).storm > 0) { + exit; + } + if (action_x + action_y == 0) { + exit; + } -if (action=="move") and (action_eta>5000){ - var woop = instance_nearest(x,y,obj_star); - if (woop.storm=0){ - action_eta-=10000; - } else { - if !(instance_nearest(target_x,target_y,obj_star).storm){ - action_eta-=10000; - } - } -} - -else if (action="move") and (action_eta<5000){ - if (instance_nearest(action_x,action_y,obj_star).storm>0) then exit; - if (action_x+action_y=0) then exit; - - var dos=0; - dos=point_distance(x,y,action_x,action_y); - orbiting=dos/action_eta; - dir=point_direction(x,y,action_x,action_y); - - x=x+lengthdir_x(orbiting,dir); - y=y+lengthdir_y(orbiting,dir); - - action_eta-=1; - - /*if (owner>5){ - - }*/ - - if (action_eta==2) and (owner=eFACTION.Inquisition) && (inquisitor>-1){ - inquisitor_ship_approaches(); - } else if (action_eta==0) { - action = ""; - if (array_length(complex_route)>0){ - var target_loc = star_by_name(complex_route[0]); - if (target_loc != "none"){ - array_delete(complex_route, 0, 1); - action_x = target_loc.x; - action_y = target_loc.y; - target = target_loc; - set_fleet_movement(false); - } else { - complex_route = []; - fleet_arrival_logic(); - } - } else { - fleet_arrival_logic(); - } - - } - -} + var dos = 0; + dos = point_distance(x, y, action_x, action_y); + orbiting = dos / action_eta; + dir = point_direction(x, y, action_x, action_y); + + x = x + lengthdir_x(orbiting, dir); + y = y + lengthdir_y(orbiting, dir); + action_eta -= 1; + /*if (owner>5){ + + }*/ + if ((action_eta == 2) && (owner == eFACTION.Inquisition) && (inquisitor > -1)) { + inquisitor_ship_approaches(); + } else if (action_eta == 0) { + action = ""; + if (array_length(complex_route) > 0) { + var target_loc = star_by_name(complex_route[0]); + if (target_loc != "none") { + array_delete(complex_route, 0, 1); + action_x = target_loc.x; + action_y = target_loc.y; + target = target_loc; + set_fleet_movement(false); + } else { + complex_route = []; + fleet_arrival_logic(); + } + } else { + fleet_arrival_logic(); + } + } + } }); /* */ diff --git a/objects/obj_en_fleet/Alarm_11.gml b/objects/obj_en_fleet/Alarm_11.gml index a93f240b24..b24fa477f1 100644 --- a/objects/obj_en_fleet/Alarm_11.gml +++ b/objects/obj_en_fleet/Alarm_11.gml @@ -1,6 +1,5 @@ - -if (is_orbiting()){ - if (owner!=1) then orbiting.present_fleet[owner]+=1; +if (is_orbiting()) { + if (owner != 1) { + orbiting.present_fleet[owner] += 1; + } } - - diff --git a/objects/obj_en_fleet/Alarm_4.gml b/objects/obj_en_fleet/Alarm_4.gml index 5e07d20081..a384424599 100644 --- a/objects/obj_en_fleet/Alarm_4.gml +++ b/objects/obj_en_fleet/Alarm_4.gml @@ -1,108 +1,128 @@ +try_and_report_loop("fleet alarm 4", function() { + if (action != "") { + var sys, sys_dist, mine, connected, fleet, cont; + sys_dist = 9999; + connected = 0; + cont = 0; -try_and_report_loop("fleet alarm 4", function(){ -if (action!=""){ - var sys, sys_dist, mine, connected, fleet, cont; - sys_dist=9999;connected=0;cont=0; - - fleet=instance_id_get( 0 ); - sys=instance_nearest(action_x,action_y,obj_star); - sys_dist=point_distance(action_x,action_y,sys.x,sys.y); - act_dist=point_distance(x,y,sys.x,sys.y); - mine=instance_nearest(x,y,obj_star); - if (mine.x=sys.x2) and (mine.y=sys.y2) then connected=1; - - var eta;eta=0; - eta=floor(point_distance(x,y,action_x,action_y)/action_spd)+1; - if (connected=0) then eta=eta*2; - if (connected=1) then connected=1; - - if (owner=eFACTION.Inquisition) and (action_eta<2) then action_eta=2; - // action_x=sys.x; - // action_y=sys.y; - action="move"; - - if (owner != eFACTION.Eldar) and (mine.storm>0) then action_eta+=10000; - - x=x+lengthdir_x(24,point_direction(x,y,sys.x,sys.y)); - y=y+lengthdir_y(24,point_direction(x,y,sys.x,sys.y)); -} - - - - - - -if (action==""){ - var sys, sys_dist, mine, connected, fleet, cont, target_dist; - sys_dist=9999;connected=0;cont=0;target_dist=0; - - fleet=id; - sys=instance_nearest(action_x,action_y,obj_star); - sys_dist=point_distance(action_x,action_y,sys.x,sys.y); - if (scr_valid_fleet_target(target)){ - target_dist=point_distance(x,y,target.action_x,target.action_y); - } else { - target=0; - } - - act_dist=point_distance(x,y,sys.x,sys.y); - mine=instance_nearest(x,y,obj_star); - - // if (owner = eFACTION.Tau) then mine.tau_fleets-=1; - // if (owner = eFACTION.Tau) and (image_index!=1) then mine.tau_fleets-=1; - // mine.present_fleets-=1; - - connected = determine_warp_join(mine, sys); - cont=1; - - - if (cont=1){ - cont=20; - } - - if (cont=20){// Move the entire fleet, don't worry about the other crap - turns_static = 0; - var eta=0; - - if (trade_goods!="") and (owner != eFACTION.Tyranids) and (owner != eFACTION.Chaos) and (string_count("Inqis",trade_goods)=0) and (string_count("merge",trade_goods)=0)and (string_count("_her",trade_goods)=0) and (trade_goods!="cancel_inspection") and (trade_goods!="return"){ - if (scr_valid_fleet_target(target)){ - if (target.action!=""){ - if (target_dist>sys_dist){ - action_x=target.action_x; - action_y=target.action_y; - sys=instance_nearest(action_x,action_y,obj_star); - } - } - } else { - target = 0; - } + fleet = instance_id_get(0); + sys = instance_nearest(action_x, action_y, obj_star); + sys_dist = point_distance(action_x, action_y, sys.x, sys.y); + act_dist = point_distance(x, y, sys.x, sys.y); + mine = instance_nearest(x, y, obj_star); + if ((mine.x == sys.x2) && (mine.y == sys.y2)) { + connected = 1; } - - eta=floor(point_distance(x,y,action_x,action_y)/action_spd)+1; - if (connected=0) then eta=eta*2; - if (connected=1) then connected=1; - - if (action_eta<=0) or (owner != eFACTION.Inquisition){ - action_eta=eta; - if (owner = eFACTION.Inquisition) and (action_eta<2) and (string_count("_her",trade_goods)=0) then action_eta=2; + + var eta; + eta = 0; + eta = floor(point_distance(x, y, action_x, action_y) / action_spd) + 1; + if (connected == 0) { + eta = eta * 2; + } + if (connected == 1) { + connected = 1; + } + + if ((owner == eFACTION.Inquisition) && (action_eta < 2)) { + action_eta = 2; } - - if (owner != eFACTION.Eldar) and (mine.storm>0) then action_eta+=10000; - // action_x=sys.x; // action_y=sys.y; - action="move"; - - if (minimum_eta>action_eta) and (minimum_eta>0) then action_eta=minimum_eta; - minimum_eta=0; - if (etah>action_eta) and (etah!=0) then action_eta=etah; - - x=x+lengthdir_x(24,point_direction(x,y,sys.x,sys.y)); - y=y+lengthdir_y(24,point_direction(x,y,sys.x,sys.y)); + action = "move"; + + if ((owner != eFACTION.Eldar) && (mine.storm > 0)) { + action_eta += 10000; + } + + x = x + lengthdir_x(24, point_direction(x, y, sys.x, sys.y)); + y = y + lengthdir_y(24, point_direction(x, y, sys.x, sys.y)); } -} -etah=0; + if (action == "") { + var sys, sys_dist, mine, connected, fleet, cont, target_dist; + sys_dist = 9999; + connected = 0; + cont = 0; + target_dist = 0; -}); + fleet = id; + sys = instance_nearest(action_x, action_y, obj_star); + sys_dist = point_distance(action_x, action_y, sys.x, sys.y); + if (scr_valid_fleet_target(target)) { + target_dist = point_distance(x, y, target.action_x, target.action_y); + } else { + target = 0; + } + + act_dist = point_distance(x, y, sys.x, sys.y); + mine = instance_nearest(x, y, obj_star); + + // if (owner = eFACTION.Tau) then mine.tau_fleets-=1; + // if (owner = eFACTION.Tau) and (image_index!=1) then mine.tau_fleets-=1; + // mine.present_fleets-=1; + + connected = determine_warp_join(mine, sys); + cont = 1; + + if (cont == 1) { + cont = 20; + } + + if (cont == 20) { + // Move the entire fleet, don't worry about the other crap + turns_static = 0; + var eta = 0; + if ((trade_goods != "") && (owner != eFACTION.Tyranids) && (owner != eFACTION.Chaos) && (string_count("Inqis", trade_goods) == 0) && (string_count("merge", trade_goods) == 0) && (string_count("_her", trade_goods) == 0) && (trade_goods != "cancel_inspection") && (trade_goods != "return")) { + if (scr_valid_fleet_target(target)) { + if (target.action != "") { + if (target_dist > sys_dist) { + action_x = target.action_x; + action_y = target.action_y; + sys = instance_nearest(action_x, action_y, obj_star); + } + } + } else { + target = 0; + } + } + + eta = floor(point_distance(x, y, action_x, action_y) / action_spd) + 1; + if (connected == 0) { + eta = eta * 2; + } + if (connected == 1) { + connected = 1; + } + + if ((action_eta <= 0) || (owner != eFACTION.Inquisition)) { + action_eta = eta; + if ((owner == eFACTION.Inquisition) && (action_eta < 2) && (string_count("_her", trade_goods) == 0)) { + action_eta = 2; + } + } + + if ((owner != eFACTION.Eldar) && (mine.storm > 0)) { + action_eta += 10000; + } + + // action_x=sys.x; + // action_y=sys.y; + action = "move"; + + if ((minimum_eta > action_eta) && (minimum_eta > 0)) { + action_eta = minimum_eta; + } + minimum_eta = 0; + if ((etah > action_eta) && (etah != 0)) { + action_eta = etah; + } + + x = x + lengthdir_x(24, point_direction(x, y, sys.x, sys.y)); + y = y + lengthdir_y(24, point_direction(x, y, sys.x, sys.y)); + } + } + + etah = 0; +}); diff --git a/objects/obj_en_fleet/Alarm_5.gml b/objects/obj_en_fleet/Alarm_5.gml index 12f3a9d555..5f31ff9eb2 100644 --- a/objects/obj_en_fleet/Alarm_5.gml +++ b/objects/obj_en_fleet/Alarm_5.gml @@ -1,21 +1,21 @@ +if (action_eta > obj_controller.temp[90]) { + obj_controller.temp[90] = action_eta; +} +if (action_eta < obj_controller.temp[90]) { + action_eta = obj_controller.temp[90]; +} +rep -= 1; +if (rep > 0) { + alarm[5] = 1; +} - -if (action_eta>obj_controller.temp[90]) then obj_controller.temp[90]=action_eta; -if (action_eta0) then alarm[5]=1; - -if (rep=0){ +if (rep == 0) { // if (id mod 2 == 0) then action_eta=obj_controller.temp[90]; // else{action_eta=obj_controller.temp[90]-1;} - action_eta=obj_controller.temp[90]-choose(0,1); - - rep=3; - alarm[5]=-1; -} + action_eta = obj_controller.temp[90] - choose(0, 1); + rep = 3; + alarm[5] = -1; +} diff --git a/objects/obj_en_fleet/Alarm_8.gml b/objects/obj_en_fleet/Alarm_8.gml index 4588a997bc..c2b74fb6d2 100644 --- a/objects/obj_en_fleet/Alarm_8.gml +++ b/objects/obj_en_fleet/Alarm_8.gml @@ -1,11 +1,7 @@ - var wop; -wop=instance_nearest(x,y,obj_star); -if (instance_exists(wop)){ - if (point_distance(x,y,wop.x,wop.y)<=40){ - wop.present_fleet[owner]+=1; +wop = instance_nearest(x, y, obj_star); +if (instance_exists(wop)) { + if (point_distance(x, y, wop.x, wop.y) <= 40) { + wop.present_fleet[owner] += 1; } } - - - diff --git a/objects/obj_en_fleet/Collision_obj_en_fleet.gml b/objects/obj_en_fleet/Collision_obj_en_fleet.gml index 85d0164c9f..9bca41449a 100644 --- a/objects/obj_en_fleet/Collision_obj_en_fleet.gml +++ b/objects/obj_en_fleet/Collision_obj_en_fleet.gml @@ -1,26 +1,20 @@ - -if (last_turn_check == obj_controller.turn){ +if (last_turn_check == obj_controller.turn) { exit; } var _same_navy = navy == other.navy; -if (other.owner==self.owner && _same_navy){ - if !((action_x=other.action_x) and (action_y=other.action_y)) then exit; - - - if ((trade_goods!="") && (other.trade_goods!="") && !fleet_has_cargo("colonize") && !fleet_has_cargo("colonize", other)){ - - - if (action_x=other.action_x) and (action_y=other.action_y) and (!(fleet_has_cargo("ork_warboss"))) and ( !(fleet_has_cargo("ork_warboss", other))){ - +if (other.owner == self.owner && _same_navy) { + if (!((action_x == other.action_x) && (action_y == other.action_y))) { + exit; + } - if (string_count("!",trade_goods)>0) and (string_count("!",other.trade_goods)>0){ - if (id>other.id){ - merge_fleets(other.id, self.id); + if ((trade_goods != "") && (other.trade_goods != "") && !fleet_has_cargo("colonize") && !fleet_has_cargo("colonize", other)) { + if ((action_x == other.action_x) && (action_y == other.action_y) && !fleet_has_cargo("ork_warboss") && !fleet_has_cargo("ork_warboss", other)) { + if ((string_count("!", trade_goods) > 0) && (string_count("!", other.trade_goods) > 0)) { + if (id > other.id) { + merge_fleets(other.id, self.id); } } } } } last_turn_check = obj_controller.turn; - - diff --git a/objects/obj_en_fleet/Collision_obj_pnunit.gml b/objects/obj_en_fleet/Collision_obj_pnunit.gml index 8abfbfce8a..8d4a544c4b 100644 --- a/objects/obj_en_fleet/Collision_obj_pnunit.gml +++ b/objects/obj_en_fleet/Collision_obj_pnunit.gml @@ -1,7 +1,8 @@ - exit; -if (other.sprite_index!=self.sprite_index) then exit;// No colonists and fleets bashing together +if (other.sprite_index != self.sprite_index) { + exit; +} // No colonists and fleets bashing together //if (other.action="") and (action="") and (other.owner=owner) and (string_count("her",trade_goods)=0) and (string_count("her",string(other.trade_goods))=0){ // if (obj_controller.faction_status[eFACTION.Imperium]="War") and (instance_nearest(x,y,obj_star).owner = eFACTION.Player) and (owner = eFACTION.Imperium) and (other.owner = eFACTION.Imperium){ @@ -13,5 +14,4 @@ if (other.sprite_index!=self.sprite_index) then exit;// No colonists and fleets // with(other){instance_destroy();} // } // } -//} - +//} diff --git a/objects/obj_en_fleet/Create_0.gml b/objects/obj_en_fleet/Create_0.gml index 9d4dedc716..763009de6e 100644 --- a/objects/obj_en_fleet/Create_0.gml +++ b/objects/obj_en_fleet/Create_0.gml @@ -1,141 +1,145 @@ - -owner=0; -capital_number=0; -frigate_number=0; -escort_number=0; -guardsmen=0; -home_x=0; -home_y=0; -selected=0; -ret=0; -hurt=0; -orbiting=0; -rep=3; -minimum_eta=2; +owner = 0; +capital_number = 0; +frigate_number = 0; +escort_number = 0; +guardsmen = 0; +home_x = 0; +home_y = 0; +selected = 0; +ret = 0; +hurt = 0; +orbiting = 0; +rep = 3; +minimum_eta = 2; turns_static = 0; -navy=0; -guardsmen_ratio=0; -guardsmen_unloaded=0; +navy = 0; +guardsmen_ratio = 0; +guardsmen_unloaded = 0; complex_route = []; warp_able = false; -ii_check=floor(random(5))+1; -etah=0; -safe=0; +ii_check = floor(random(5)) + 1; +etah = 0; +safe = 0; last_turn_check = 0; //TODO set up special save method for faction specific fleet variables -inquisitor=-1; +inquisitor = -1; cargo_data = {}; -image_xscale=1.25; -image_yscale=1.25; - -var i=-1; -repeat(21){i+=1; - capital[i]=""; - capital_num[i]=0; - capital_sel[i]=1; - capital_imp[i]=0; - - capital_max_imp[i]=0; -} +image_xscale = 1.25; +image_yscale = 1.25; -var i;i=-1; -repeat(31){i+=1; - frigate[i]=""; - frigate_num[i]=0; - frigate_sel[i]=1; - frigate_imp[i]=0; - frigate_max_imp[i]=0; -} +var i = -1; +repeat (21) { + i += 1; + capital[i] = ""; + capital_num[i] = 0; + capital_sel[i] = 1; + capital_imp[i] = 0; -var i;i=-1; -repeat(31){i+=1; - escort[i]=""; - escort_num[i]=0; - escort_sel[i]=1; - escort_imp[i]=0; - escort_max_imp[i]=0; + capital_max_imp[i] = 0; } -image_speed=0; - +var i; +i = -1; +repeat (31) { + i += 1; + frigate[i] = ""; + frigate_num[i] = 0; + frigate_sel[i] = 1; + frigate_imp[i] = 0; + frigate_max_imp[i] = 0; +} -action=""; -action_x=0; -action_y=0; -target=noone; -target_x=0; -target_y=0; -action_spd=64; -if (owner<=6) then action_spd=128; -action_eta=0; -connected=0; -loaded=0; +var i; +i = -1; +repeat (31) { + i += 1; + escort[i] = ""; + escort_num[i] = 0; + escort_sel[i] = 1; + escort_imp[i] = 0; + escort_max_imp[i] = 0; +} -trade_goods=""; +image_speed = 0; + +action = ""; +action_x = 0; +action_y = 0; +target = noone; +target_x = 0; +target_y = 0; +action_spd = 64; +if (owner <= 6) { + action_spd = 128; +} +action_eta = 0; +connected = 0; +loaded = 0; +trade_goods = ""; -capital_health=100; -frigate_health=100; -escort_health=100; +capital_health = 100; +frigate_health = 100; +escort_health = 100; -alarm[8]=1; +alarm[8] = 1; -#region save/load serialization +#region save/load serialization -/// Called from save function to take all object variables and convert them to a json savable format and return it -serialize = function(){ +/// Called from save function to take all object variables and convert them to a json savable format and return it +serialize = function() { var object_fleet = self; - + var save_data = { obj: object_get_name(object_index), x, y, - cargo_data : cargo_data, - } - + cargo_data: cargo_data, + }; + var excluded_from_save = ["temp", "serialize", "deserialize"]; copy_serializable_fields(object_fleet, save_data, excluded_from_save); return save_data; -} -deserialize = function(save_data){ - var exclusions = ["id","cargo_data"]; // skip automatic setting of certain vars, handle explicitly later +}; +deserialize = function(save_data) { + var exclusions = ["id", "cargo_data"]; // skip automatic setting of certain vars, handle explicitly later // Automatic var setting var all_names = struct_get_names(save_data); var _len = array_length(all_names); - for(var i = 0; i < _len; i++){ + for (var i = 0; i < _len; i++) { var var_name = all_names[i]; - if(array_contains(exclusions, var_name)){ + if (array_contains(exclusions, var_name)) { continue; } var loaded_value = struct_get(save_data, var_name); // show_debug_message($"en_fleet {en_fleet_instance.id} - var: {var_name} - val: {loaded_value}"); try { - variable_struct_set(self, var_name, loaded_value); - } catch (e){ + variable_struct_set(self, var_name, loaded_value); + } catch (e) { show_debug_message(e); } } - if(struct_exists(save_data, "cargo_data")){ + if (struct_exists(save_data, "cargo_data")) { variable_struct_set(self, "cargo_data", save_data.cargo_data); show_debug_message("cargo_data"); - if (fleet_has_cargo("ork_warboss")){ + if (fleet_has_cargo("ork_warboss")) { show_debug_message("warboss_fleet"); var _boss = new NewPlanetFeature(P_features.OrkWarboss); - _boss.load_json_data(cargo_data.ork_warboss) + _boss.load_json_data(cargo_data.ork_warboss); cargo_data.ork_warboss = _boss; - } - } + } + } - if(save_data.orbiting != 0 && action == ""){ + if (save_data.orbiting != 0 && action == "") { var nearest_star = instance_nearest(x, y, obj_star); orbiting = nearest_star; // show_debug_message($"p_fleet id {id} deserialized: {self}"); } -} +}; -#endregion \ No newline at end of file +#endregion diff --git a/objects/obj_en_fleet/Destroy_0.gml b/objects/obj_en_fleet/Destroy_0.gml index fc746b0f66..2815712e7c 100644 --- a/objects/obj_en_fleet/Destroy_0.gml +++ b/objects/obj_en_fleet/Destroy_0.gml @@ -1,27 +1,24 @@ - - /*if (owner = eFACTION.Chaos){ show_message("Trade Goods: "+string(trade_goods)+"#Alarms: "+string(alarm[0])+"|"+string(alarm[1])+"|"+string(alarm[2])+"|"+string(alarm[4])); }*/ - -if (action="") and (orbiting!=0){ - if (orbiting=instance_nearest(x, y, obj_star)){ - orbiting.present_fleet[owner]-=1; +if ((action == "") && (orbiting != 0)) { + if (orbiting == instance_nearest(x, y, obj_star)) { + orbiting.present_fleet[owner] -= 1; } - orbiting=0; + orbiting = 0; } - - -if (instance_exists(obj_controller)){ - if (fleet_has_cargo("warband")) and (obj_controller.faction_defeated[10]=0){ +if (instance_exists(obj_controller)) { + if (fleet_has_cargo("warband") && (obj_controller.faction_defeated[10] == 0)) { destroy_khorne_fleet(); } - if (fleet_has_cargo("ork_warboss")) and (obj_controller.faction_defeated[7]<=0) and (safe=0){ - obj_controller.faction_defeated[7]=1; - scr_event_log("","Enemy Leader Assassinated: Ork Warboss"); - if (instance_exists(obj_turn_end)) then scr_alert("","ass","Warboss "+string(obj_controller.faction_leader[eFACTION.Ork])+" has been killed.",0,0); + if (fleet_has_cargo("ork_warboss") && (obj_controller.faction_defeated[7] <= 0) && (safe == 0)) { + obj_controller.faction_defeated[7] = 1; + scr_event_log("", "Enemy Leader Assassinated: Ork Warboss"); + if (instance_exists(obj_turn_end)) { + scr_alert("", "ass", "Warboss " + string(obj_controller.faction_leader[eFACTION.Ork]) + " has been killed.", 0, 0); + } } } diff --git a/objects/obj_en_fleet/Draw_0.gml b/objects/obj_en_fleet/Draw_0.gml index 5495065c42..0402947b0c 100644 --- a/objects/obj_en_fleet/Draw_0.gml +++ b/objects/obj_en_fleet/Draw_0.gml @@ -1,164 +1,195 @@ - -if ((obj_controller.menu!= 0) || !instance_exists(obj_star)) then exit; +if ((obj_controller.menu != 0) || !instance_exists(obj_star)) { + exit; +} var scale = obj_controller.scale_mod; -if (owner = eFACTION.Eldar) and (instance_exists(orbiting)) and (obj_controller.is_test_map=true){ +if ((owner == eFACTION.Eldar) && instance_exists(orbiting) && (obj_controller.is_test_map == true)) { draw_set_color(c_red); - draw_line_width(x,y,orbiting.x,orbiting.y,1); + draw_line_width(x, y, orbiting.x, orbiting.y, 1); } var draw_icon = false; -if (x<0) or (x>room_width) or (y<0) or (y>room_height) then exit; -if (image_alpha=0) then exit; +if ((x < 0) || (x > room_width) || (y < 0) || (y > room_height)) { + exit; +} +if (image_alpha == 0) { + exit; +} -var coords = [0,0]; -var near_star = instance_nearest(x,y, obj_star); -if (x==near_star.x && y==near_star.y){ +var coords = [0, 0]; +var near_star = instance_nearest(x, y, obj_star); +if (x == near_star.x && y == near_star.y) { var coords = fleet_star_draw_offsets(); } +if (image_index > 9) { + image_index = 9; +} -if (image_index>9) then image_index=9; - - -var m_dist=point_distance(mouse_x,mouse_y,x+(coords[0]*scale),y+((coords[1])*scale+(12*scale))); -var within=false; -if (!obj_controller.zoomed){ - if (m_dist<=16*scale) and (!instance_exists(obj_ingame_menu)) then within=1; +var m_dist = point_distance(mouse_x, mouse_y, x + (coords[0] * scale), y + (coords[1] * scale + (12 * scale))); +var within = false; +if (!obj_controller.zoomed) { + if ((m_dist <= 16 * scale) && (!instance_exists(obj_ingame_menu))) { + within = 1; + } } -if (obj_controller.zoomed=1){ +if (obj_controller.zoomed == 1) { var faction_colour = global.star_name_colors[owner]; draw_set_color(faction_colour); - - if (owner == eFACTION.Imperium) and (navy=0) then draw_set_alpha(0.5); - draw_circle(x,y,12,0); + + if ((owner == eFACTION.Imperium) && (navy == 0)) { + draw_set_alpha(0.5); + } + draw_circle(x, y, 12, 0); draw_set_alpha(1); - if (m_dist<=16) and (!instance_exists(obj_ingame_menu)) then within=1; + if ((m_dist <= 16) && (!instance_exists(obj_ingame_menu))) { + within = 1; + } } // if (obj_controller.selected!=0) and (selected=1) then within=1; -if (obj_controller.selecting_planet>0){ - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249){ - if (instance_exists(obj_star_select)){if (obj_star_select.button1!="") then within=0;} +if (obj_controller.selecting_planet > 0) { + if ((mouse_x >= __view_get(e__VW.XView, 0) + 529) && (mouse_y >= __view_get(e__VW.YView, 0) + 234) && (mouse_x < __view_get(e__VW.XView, 0) + 611) && (mouse_y < __view_get(e__VW.YView, 0) + 249)) { + if (instance_exists(obj_star_select)) { + if (obj_star_select.button1 != "") { + within = 0; + } + } } - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234+16) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249+16){ - if (instance_exists(obj_star_select)){if (obj_star_select.button2!="") then within=0;} + if ((mouse_x >= __view_get(e__VW.XView, 0) + 529) && (mouse_y >= __view_get(e__VW.YView, 0) + 234 + 16) && (mouse_x < __view_get(e__VW.XView, 0) + 611) && (mouse_y < __view_get(e__VW.YView, 0) + 249 + 16)) { + if (instance_exists(obj_star_select)) { + if (obj_star_select.button2 != "") { + within = 0; + } + } } - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234+32) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249+32){ - if (instance_exists(obj_star_select)){if (obj_star_select.button3!="") then within=0;} + if ((mouse_x >= __view_get(e__VW.XView, 0) + 529) && (mouse_y >= __view_get(e__VW.YView, 0) + 234 + 32) && (mouse_x < __view_get(e__VW.XView, 0) + 611) && (mouse_y < __view_get(e__VW.YView, 0) + 249 + 32)) { + if (instance_exists(obj_star_select)) { + if (obj_star_select.button3 != "") { + within = 0; + } + } } } -if (action!=""){ - draw_set_halign(fa_left);draw_set_alpha(1); +if (action != "") { + draw_set_halign(fa_left); + draw_set_alpha(1); draw_set_color(c_white); - draw_line_width(x,y,action_x,action_y,1); - // + draw_line_width(x, y, action_x, action_y, 1); + // draw_set_font(fnt_40k_14b); - if (obj_controller.zoomed=0) then draw_text_transformed(x+12,y,string_hash_to_newline("ETA "+string(action_eta)),1,1,0); - if (obj_controller.zoomed=1) then draw_text_transformed(x+24,y,string_hash_to_newline("ETA "+string(action_eta)),2,2,0);// was 1.4 + if (obj_controller.zoomed == 0) { + draw_text_transformed(x + 12, y, string_hash_to_newline("ETA " + string(action_eta)), 1, 1, 0); + } + if (obj_controller.zoomed == 1) { + draw_text_transformed(x + 24, y, string_hash_to_newline("ETA " + string(action_eta)), 2, 2, 0); + } // was 1.4 } -switch(owner){ +switch (owner) { case eFACTION.Ork: - var _has_warboss =false; - if (fleet_has_cargo("ork_warboss")){ + var _has_warboss = false; + if (fleet_has_cargo("ork_warboss")) { draw_icon = true; _has_warboss = true; } } -var fleet_descript=""; -if (within=1) or (selected>0){ +var fleet_descript = ""; +if ((within == 1) || (selected > 0)) { draw_set_color(CM_GREEN_COLOR); draw_set_font(fnt_40k_14b); draw_set_halign(fa_center); - - var fleet_descript=""; - if (owner = eFACTION.Player) then fleet_descript="Renegade Fleet"; - if (owner = eFACTION.Imperium){ - if (navy=1){ - fleet_descript="Imperial Navy"; - }else{ - fleet_descript="Defense Fleet"; + + var fleet_descript = ""; + if (owner == eFACTION.Player) { + fleet_descript = "Renegade Fleet"; + } + if (owner == eFACTION.Imperium) { + if (navy == 1) { + fleet_descript = "Imperial Navy"; + } else { + fleet_descript = "Defense Fleet"; } } - if (navy=0){ - if (owner = eFACTION.Imperium){ - if (fleet_has_cargo("colonize")){ - fleet_descript="Imperial Colonists" - } else if ((trade_goods!="") and (trade_goods!="merge")){ - fleet_descript="Trade Fleet"; + if (navy == 0) { + if (owner == eFACTION.Imperium) { + if (fleet_has_cargo("colonize")) { + fleet_descript = "Imperial Colonists"; + } else if ((trade_goods != "") && (trade_goods != "merge")) { + fleet_descript = "Trade Fleet"; } } } // if (navy=1) then fleet_descript=string(trade_goods)+" ("+string(guardsmen_unloaded)+"/"+string(guardsmen_ratio)+")"; - switch(owner){ + switch (owner) { case eFACTION.Mechanicus: - fleet_descript="Mechanicus Fleet"; + fleet_descript = "Mechanicus Fleet"; break; case eFACTION.Inquisition: - fleet_descript="Inquisitor Ship"; + fleet_descript = "Inquisitor Ship"; break; case eFACTION.Eldar: - fleet_descript="Eldar Fleet"; - break; + fleet_descript = "Eldar Fleet"; + break; case eFACTION.Ork: - fleet_descript="Ork Fleet"; - if (_has_warboss){ + fleet_descript = "Ork Fleet"; + if (_has_warboss) { var _warboss = cargo_data.ork_warboss; - fleet_descript += $"\nWarboss {_warboss.name}" + fleet_descript += $"\nWarboss {_warboss.name}"; } - break; + break; case eFACTION.Tau: - fleet_descript="Tau Fleet"; + fleet_descript = "Tau Fleet"; break; case eFACTION.Tyranids: - fleet_descript="Hive Fleet"; + fleet_descript = "Hive Fleet"; break; case eFACTION.Chaos: - fleet_descript="Heretic Fleet"; - if (fleet_has_cargo("warband") || fleet_has_cargo("csm")){ - fleet_descript=string(obj_controller.faction_leader[eFACTION.Chaos])+"'s Fleet"; - if (string_count("s's Fleet",fleet_descript)>0) then fleet_descript=string_replace(fleet_descript,"s's Fleet","s' Fleet"); + fleet_descript = "Heretic Fleet"; + if (fleet_has_cargo("warband") || fleet_has_cargo("csm")) { + fleet_descript = string(obj_controller.faction_leader[eFACTION.Chaos]) + "'s Fleet"; + if (string_count("s's Fleet", fleet_descript) > 0) { + fleet_descript = string_replace(fleet_descript, "s's Fleet", "s' Fleet"); + } } - break; + break; case eFACTION.Necrons: - fleet_descript="Necron Fleet"; - break; + fleet_descript = "Necron Fleet"; + break; } // if (owner = eFACTION.Imperium) and (navy=1){fleet_descript=string(capital_max_imp[1]+frigate_max_imp[1]+escort_max_imp[1]);} - - if (global.cheat_debug=true){ - fleet_descript+="C"+string(capital_number)+"|F"+string(frigate_number)+"|E"+string(escort_number); + + if (global.cheat_debug == true) { + fleet_descript += "C" + string(capital_number) + "|F" + string(frigate_number) + "|E" + string(escort_number); } - + // fleet_descript=string(capital_number)+"|"+string(frigate_number)+"|"+string(escort_number); // fleet_descript+="|"+string(trade_goods); - + draw_set_halign(fa_left); } -if (fleet_descript!="" && within){ +if (fleet_descript != "" && within) { tooltip_draw(fleet_descript); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12*scale,0); + draw_circle(x + (coords[0] * scale), y + coords[1] * scale, 12 * scale, 0); } else { var faction_colour = global.star_name_colors[owner]; draw_set_color(faction_colour); draw_set_alpha(0.5); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12*scale,0); + draw_circle(x + (coords[0] * scale), y + coords[1] * scale, 12 * scale, 0); draw_set_alpha(1); - if (navy && owner == eFACTION.Imperium){ + if (navy && owner == eFACTION.Imperium) { draw_set_color(global.star_name_colors[eFACTION.Mechanicus]); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12*scale,1); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12.1*scale,1); - draw_circle(x+(coords[0]*scale),y+(coords[1])*scale,12.2*scale,1); + draw_circle(x + (coords[0] * scale), y + coords[1] * scale, 12 * scale, 1); + draw_circle(x + (coords[0] * scale), y + coords[1] * scale, 12.1 * scale, 1); + draw_circle(x + (coords[0] * scale), y + coords[1] * scale, 12.2 * scale, 1); } } -if (draw_icon){ - draw_sprite_ext(spr_faction_icons, owner,x+(coords[0]*scale)-(32*scale),y+(coords[1]*scale)-(32*scale),1*scale,1*scale,0,c_white,1) +if (draw_icon) { + draw_sprite_ext(spr_faction_icons, owner, x + (coords[0] * scale) - (32 * scale), y + (coords[1] * scale) - (32 * scale), 1 * scale, 1 * scale, 0, c_white, 1); } -draw_sprite_ext(sprite_index,image_index,x+(coords[0]*scale),y+(coords[1]*scale),1*scale,1*scale,0,c_white,1); - +draw_sprite_ext(sprite_index, image_index, x + (coords[0] * scale), y + (coords[1] * scale), 1 * scale, 1 * scale, 0, c_white, 1); /*if (owner = eFACTION.Ork){ draw_set_font(fnt_small); @@ -167,11 +198,10 @@ draw_sprite_ext(sprite_index,image_index,x+(coords[0]*scale),y+(coords[1]*scale) draw_text(x,y+32,string(escort_number)+"/"+string(frigate_number)+"/"+string(capital_number)); }*/ - -if (instance_exists(target)){ +if (instance_exists(target)) { draw_set_color(c_red); draw_set_alpha(0.5); - draw_line(x,y,target.x,target.y); + draw_line(x, y, target.x, target.y); draw_set_alpha(1); } diff --git a/objects/obj_en_fleet/KeyPress_73.gml b/objects/obj_en_fleet/KeyPress_73.gml index f7e351f855..871f147a6a 100644 --- a/objects/obj_en_fleet/KeyPress_73.gml +++ b/objects/obj_en_fleet/KeyPress_73.gml @@ -1,4 +1,3 @@ - /*if (navy=1){ var fid,tot,i;i=-1; fid=self.id;tot=0; @@ -9,6 +8,5 @@ show_message("Fleet: "+string(fid)+"#Action: "+string(trade_goods)+"#E"+string(escort_number)+"|F"+string(frigate_number)+"|C:"+string(capital_number)+"#Total Guardsmen: "+string(scr_display_number(tot))); }*/ - /* */ /* */ diff --git a/objects/obj_en_fleet/Step_0.gml b/objects/obj_en_fleet/Step_0.gml index 00144c38dc..d1822afaf2 100644 --- a/objects/obj_en_fleet/Step_0.gml +++ b/objects/obj_en_fleet/Step_0.gml @@ -1,131 +1,186 @@ +if ((global.load >= 0) || instance_exists(obj_saveload)) { + exit; +} -if (global.load>=0) or (instance_exists(obj_saveload)) then exit; - -if (action!="") and (orbiting!=0){ - if (instance_exists(orbiting)){ - if (variable_instance_exists(orbiting, "present_fleet")){ - orbiting.present_fleet[owner]-=1; - orbiting=0; +if ((action != "") && (orbiting != 0)) { + if (instance_exists(orbiting)) { + if (variable_instance_exists(orbiting, "present_fleet")) { + orbiting.present_fleet[owner] -= 1; + orbiting = 0; } else { - orbiting = instance_nearest(x, y , obj_star); + orbiting = instance_nearest(x, y, obj_star); var cur_owner_fleet = orbiting.present_fleet[owner]; - orbiting.present_fleet[owner] = cur_owner_fleet> 0? cur_owner_fleet-1 : cur_owner_fleet=0; - orbiting=0; + orbiting.present_fleet[owner] = cur_owner_fleet > 0 ? cur_owner_fleet - 1 : cur_owner_fleet == 0; + orbiting = 0; } } } -if (capital_number<0) then capital_number=0; -if (frigate_number<0) then frigate_number=0; -if (escort_number<0) then escort_number=0; +if (capital_number < 0) { + capital_number = 0; +} +if (frigate_number < 0) { + frigate_number = 0; +} +if (escort_number < 0) { + escort_number = 0; +} -if ((owner != eFACTION.Inquisition) and (capital_number+frigate_number+escort_number<=0) and !fleet_has_cargo("colonize")) then instance_destroy(); +if ((owner != eFACTION.Inquisition) && (capital_number + frigate_number + escort_number <= 0) && !fleet_has_cargo("colonize")) { + instance_destroy(); +} -if (owner = eFACTION.Tau) and (x<0) or (y<0) then instance_destroy(); +if ((owner == eFACTION.Tau) && (x < 0) || (y < 0)) { + instance_destroy(); +} + +if ((target > 0) && instance_exists(target)) { + target_x = target.x; + target_y = target.y; +} -if (target>0) and (instance_exists(target)){target_x=target.x;target_y=target.y;} +ii_check -= 1; -ii_check-=1; +if (ii_check == 0) { + ii_check = 10; -if (ii_check=0){ - ii_check=10; - - if (owner != eFACTION.Eldar) and (owner != eFACTION.Inquisition){ - var ii=0; - ii+=capital_number; - ii+=round((frigate_number/2)); - ii+=round((escort_number/4)); - if (ii<=1) then ii=1; - image_index=ii; - image_index=min(image_index,9); + if ((owner != eFACTION.Eldar) && (owner != eFACTION.Inquisition)) { + var ii = 0; + ii += capital_number; + ii += round((frigate_number / 2)); + ii += round((escort_number / 4)); + if (ii <= 1) { + ii = 1; + } + image_index = ii; + image_index = min(image_index, 9); } - if (owner = eFACTION.Eldar){ - var ii;ii=0;ii+=capital_number;ii+=round((frigate_number/2));ii+=round((escort_number/4)); - if (ii<=1) then ii=1;image_index=ii; - image_index=min(image_index,5); + if (owner == eFACTION.Eldar) { + var ii; + ii = 0; + ii += capital_number; + ii += round((frigate_number / 2)); + ii += round((escort_number / 4)); + if (ii <= 1) { + ii = 1; + } + image_index = ii; + image_index = min(image_index, 5); + } + if (owner == eFACTION.Inquisition) { + image_index = 1; } - if (owner = eFACTION.Inquisition) then image_index=1; - } - -if (owner = eFACTION.Tyranids){ - image_alpha=0; - if (instance_exists(obj_p_fleet)){ - var bundy;bundy=instance_nearest(x,y,obj_p_fleet); - if (bundy.action="") and (self.action="") and (point_distance(bundy.x,bundy.y,x,y)<90) and (bundy.x>x) and (bundy.y x) && (bundy.y < y)) { + image_alpha = 1; + } + } + if ((instance_nearest(x, y - 32, obj_star).vision == 1) && (action == "")) { + image_alpha = 1; } - if (instance_nearest(x,y-32,obj_star).vision=1) and (action="") then image_alpha=1; } - - - - -if (owner = eFACTION.Tau) and (action_spd!=32) then action_spd=32; +if ((owner == eFACTION.Tau) && (action_spd != 32)) { + action_spd = 32; +} // if (owner = eFACTION.Tau) and (image_index>1) -if (owner = eFACTION.Mechanicus){ - if (action!="") then direction=point_direction(x,y,action_x,action_y); - image_angle=direction; +if (owner == eFACTION.Mechanicus) { + if (action != "") { + direction = point_direction(x, y, action_x, action_y); + } + image_angle = direction; +} +if ((owner == eFACTION.Eldar) && (trade_goods != "") && (action == "move")) { + action_eta = 1; } -if (owner = eFACTION.Eldar) and (trade_goods!="") and (action="move") then action_eta=1; +if ((owner == eFACTION.Tau) && (action == "") && (obj_controller.tau_messenger >= 30) && (frigate_number > 0) && (escort_number + capital_number > 0)) { + obj_controller.tau_messenger = 0; -if (owner = eFACTION.Tau) and (action="") and (obj_controller.tau_messenger>=30) and (frigate_number>0) and (escort_number+capital_number>0){ - obj_controller.tau_messenger=0; - var fleet, good, stir, xx, yy; - stir=0;xx=0;yy=0;good=0; - - fleet=instance_nearest(x,y,obj_star); - fleet.tau_fleets+=1;fleet.present_fleets+=1; + stir = 0; + xx = 0; + yy = 0; + good = 0; + + fleet = instance_nearest(x, y, obj_star); + fleet.tau_fleets += 1; + fleet.present_fleets += 1; instance_deactivate_object(fleet); - - fleet=instance_create(x,y,obj_en_fleet); - fleet.owner = eFACTION.Tau;fleet.action_spd=32;fleet.frigate_number=1;fleet.sprite_index=spr_fleet_tau;fleet.image_index=1; - frigate_number-=1; - - repeat(50){ - if (good=0){ - xx=x+round(choose(random(500),random(500)*-1)); - yy=y+round(choose(random(500),random(500)*-1)); - - stir=instance_nearest(xx,yy,obj_star); - if (stir.planets!=0) and (stir.owner = eFACTION.Imperium) then good=1; - if (stir.planets=1) and (stir.p_type[1]="Dead") then good=0; + + fleet = instance_create(x, y, obj_en_fleet); + fleet.owner = eFACTION.Tau; + fleet.action_spd = 32; + fleet.frigate_number = 1; + fleet.sprite_index = spr_fleet_tau; + fleet.image_index = 1; + frigate_number -= 1; + + repeat (50) { + if (good == 0) { + xx = x + round(choose(random(500), random(500) * -1)); + yy = y + round(choose(random(500), random(500) * -1)); + + stir = instance_nearest(xx, yy, obj_star); + if ((stir.planets != 0) && (stir.owner == eFACTION.Imperium)) { + good = 1; + } + if ((stir.planets == 1) && (stir.p_type[1] == "Dead")) { + good = 0; + } } - - if (good=1){ - fleet.action_x=stir.x; - fleet.action_y=stir.y; - with(fleet){ + + if (good == 1) { + fleet.action_x = stir.x; + fleet.action_y = stir.y; + with (fleet) { set_fleet_movement(); } } } - - instance_activate_object(obj_star); -} - - - -if (owner = eFACTION.Tyranids) and (trade_goods=""){ - trade_goods=choose("Spore Clouds","Health","Armour","Speed","Turn","Turret"); - trade_goods+="|"; - trade_goods+=choose("Spore Clouds","Health","Armour","Speed","Turn","Turret"); - trade_goods+="|"; + instance_activate_object(obj_star); } -if (global.load>=0){ - if (owner = eFACTION.Imperium) then sprite_index=spr_fleet_imperial; - if (owner = eFACTION.Mechanicus) then sprite_index=spr_fleet_mechanicus; - if (owner = eFACTION.Inquisition) then sprite_index=spr_fleet_inquisition; - if (owner = eFACTION.Eldar) then sprite_index=spr_fleet_eldar; - if (owner = eFACTION.Ork) then sprite_index=spr_fleet_ork; - if (owner = eFACTION.Tau) then sprite_index=spr_fleet_tau; - if (owner = eFACTION.Tyranids) then sprite_index=spr_fleet_tyranid; - if (owner = eFACTION.Chaos) then sprite_index=spr_fleet_chaos; +if ((owner == eFACTION.Tyranids) && (trade_goods == "")) { + trade_goods = choose("Spore Clouds", "Health", "Armour", "Speed", "Turn", "Turret"); + trade_goods += "|"; + trade_goods += choose("Spore Clouds", "Health", "Armour", "Speed", "Turn", "Turret"); + trade_goods += "|"; } -if (image_index=0) then image_index=1; +if (global.load >= 0) { + if (owner == eFACTION.Imperium) { + sprite_index = spr_fleet_imperial; + } + if (owner == eFACTION.Mechanicus) { + sprite_index = spr_fleet_mechanicus; + } + if (owner == eFACTION.Inquisition) { + sprite_index = spr_fleet_inquisition; + } + if (owner == eFACTION.Eldar) { + sprite_index = spr_fleet_eldar; + } + if (owner == eFACTION.Ork) { + sprite_index = spr_fleet_ork; + } + if (owner == eFACTION.Tau) { + sprite_index = spr_fleet_tau; + } + if (owner == eFACTION.Tyranids) { + sprite_index = spr_fleet_tyranid; + } + if (owner == eFACTION.Chaos) { + sprite_index = spr_fleet_chaos; + } +} +if (image_index == 0) { + image_index = 1; +} diff --git a/objects/obj_ground_mission/Alarm_0.gml b/objects/obj_ground_mission/Alarm_0.gml index 8a5cc06fed..593d19a258 100644 --- a/objects/obj_ground_mission/Alarm_0.gml +++ b/objects/obj_ground_mission/Alarm_0.gml @@ -4,10 +4,11 @@ if (num > 0) { stah = instance_nearest(x, y, obj_star); obj_controller.menu = 0; - if (planet_feature_bool(stah.p_feature[num], P_features.STC_Fragment) == 1) { // STC is present + if (planet_feature_bool(stah.p_feature[num], P_features.STC_Fragment) == 1) { + // STC is present } - if (planet_feature_bool(stah.p_feature[num], P_features.Artifact) == 1) { // Artifact is present - + if (planet_feature_bool(stah.p_feature[num], P_features.Artifact) == 1) { + // Artifact is present } } diff --git a/objects/obj_ground_mission/Alarm_5.gml b/objects/obj_ground_mission/Alarm_5.gml index 4f3516f1da..6afaa73295 100644 --- a/objects/obj_ground_mission/Alarm_5.gml +++ b/objects/obj_ground_mission/Alarm_5.gml @@ -1,32 +1,41 @@ - -var comp,plan,i;i=0;comp=0;plan=0; -plan=instance_nearest(x,y,obj_star); - -var mission,mission_roll; -mission="bad";mission_roll=floor(random(100))+1; -if (scr_has_adv("Ambushers")) then mission_roll-=15; -if (plan.p_owner[num]=3) then mission_roll+=20; -if (mission_roll<=60) then mission="good";// 135 -if (plan.p_type[num]="Dead") then mission="good"; +var comp, plan, i; +i = 0; +comp = 0; +plan = 0; +plan = instance_nearest(x, y, obj_star); + +var mission, mission_roll; +mission = "bad"; +mission_roll = floor(random(100)) + 1; +if (scr_has_adv("Ambushers")) { + mission_roll -= 15; +} +if (plan.p_owner[num] == 3) { + mission_roll += 20; +} +if (mission_roll <= 60) { + mission = "good"; +} // 135 +if (plan.p_type[num] == "Dead") { + mission = "good"; +} // mission="bad"; var pop; -pop=instance_create(0,0,obj_popup); -pop.image="artifact_recovered"; -pop.title="STC Recovered!"; - -if (plan.p_first[num]!=3) or (plan.p_type[num]!="Forge"){ - pop.text="Your forces descend beneath the surface of the planet, delving deep into an ancient tomb. Automated defenses and locks are breached.##"; - pop.text+="The STC Fragment has been safely stowed away, and is ready to be decrypted or gifted at your convenience."; - scr_return_ship(loc,self,num); +pop = instance_create(0, 0, obj_popup); +pop.image = "artifact_recovered"; +pop.title = "STC Recovered!"; + +if ((plan.p_first[num] != 3) || (plan.p_type[num] != "Forge")) { + pop.text = "Your forces descend beneath the surface of the planet, delving deep into an ancient tomb. Automated defenses and locks are breached.##"; + pop.text += "The STC Fragment has been safely stowed away, and is ready to be decrypted or gifted at your convenience."; + scr_return_ship(loc, self, num); } +if ((mission == "good") && (plan.p_first[num] == 3) && (plan.p_type[num] == "Forge")) { + pop.text = "Your forces descend into the vaults of the Mechanicus Forge, bypassing sentries, automated defenses, and blast doors on the way.##"; + pop.text += "The STC Fragment has been safely recovered and stowed away. It is ready to be decrypted or gifted at your convenience."; - -if (mission="good") and (plan.p_first[num]=3) and (plan.p_type[num]="Forge"){ - pop.text="Your forces descend into the vaults of the Mechanicus Forge, bypassing sentries, automated defenses, and blast doors on the way.##"; - pop.text+="The STC Fragment has been safely recovered and stowed away. It is ready to be decrypted or gifted at your convenience."; - /*if (plan.p_type[num]!="Dead"){ if (plan.p_owner[num]=eFACTION.Imperium) then obj_controller.disposition[eFACTION.Imperium]-=1; if (plan.p_owner[num]=eFACTION.Mechanicus) then obj_controller.disposition[eFACTION.Mechanicus]-=10;// max(obj_controller.disposition/4,10) @@ -34,85 +43,115 @@ if (mission="good") and (plan.p_first[num]=3) and (plan.p_type[num]="Forge"){ if (plan.p_owner[num]=5) then obj_controller.disposition[5]-=3; if (plan.p_owner[num]=8) then obj_controller.disposition[8]-=3; }*/ - scr_return_ship(loc,self,num); + scr_return_ship(loc, self, num); } -if (mission="bad") and (plan.p_first[num]=3) and (plan.p_type[num]="Forge"){ +if ((mission == "bad") && (plan.p_first[num] == 3) && (plan.p_type[num] == "Forge")) { /*pop.text="Your marines converge upon the STC Fragment; resistance is light and easily dealt with. After a brief firefight it is retrieved.##"; pop.text+="The fragment been safely stowed away, and is ready to be decrypted or gifted at your convenience."; */ - - pop.image="thallax"; - pop.text="Your forces descend into the vaults of the Mechanicus Forge. Sentries, automated defenses, and blast doors stand in their way.##"; - pop.text+="Half-way through the mission a small army of Praetorian Servitors and Skitarii bear down upon your men. The Mechanicus guards seem to be upset."; - + + pop.image = "thallax"; + pop.text = "Your forces descend into the vaults of the Mechanicus Forge. Sentries, automated defenses, and blast doors stand in their way.##"; + pop.text += "Half-way through the mission a small army of Praetorian Servitors and Skitarii bear down upon your men. The Mechanicus guards seem to be upset."; + /*if (plan.p_owner[num]=eFACTION.Imperium) then obj_controller.disposition[eFACTION.Imperium]-=2;*/ - if (plan.p_owner[num]=eFACTION.Mechanicus){obj_controller.disposition[eFACTION.Mechanicus]-=40;} + if (plan.p_owner[num] == eFACTION.Mechanicus) { + obj_controller.disposition[eFACTION.Mechanicus] -= 40; + } /*if (plan.p_owner[num]=4) then obj_controller.disposition[4]-=max(obj_controller.disposition[4]/3,20); if (plan.p_owner[num]=5) then obj_controller.disposition[5]-=max(obj_controller.disposition[5]/4,15); if (plan.p_owner[num]=6) then obj_controller.disposition[6]-=15; if (plan.p_owner[num]=8) then obj_controller.disposition[8]-=8;*/ - - if (plan.p_owner[num]>=eFACTION.Inquisition) and (plan.p_owner[num]<=eFACTION.Eldar){ // Inquisition Ecclesiarchy Eldar did you mean for it to be these three factions + + if ((plan.p_owner[num] >= eFACTION.Inquisition) && (plan.p_owner[num] <= eFACTION.Eldar)) { + // Inquisition Ecclesiarchy Eldar did you mean for it to be these three factions scr_audience(plan.p_owner[num], "artifact_angry",); } - if (plan.p_owner[num]=eFACTION.Mechanicus) and (obj_controller.faction_status[eFACTION.Mechanicus]!="War"){ + if ((plan.p_owner[num] == eFACTION.Mechanicus) && (obj_controller.faction_status[eFACTION.Mechanicus] != "War")) { scr_audience(plan.p_owner[num], "declare_war", -20); } - + // Start battle - pop.battle_special=3.1; - obj_controller.trading_artifact=0; + pop.battle_special = 3.1; + obj_controller.trading_artifact = 0; clear_diplo_choices(); - obj_controller.menu=0; - - pop.loc=plan.name; - pop.planet=num; - - exit; -} + obj_controller.menu = 0; + pop.loc = plan.name; + pop.planet = num; -if (scr_has_adv("Tech-Scavengers")){ - var ex1,ex1_num,ex2,ex2_num,ex3,ex3_num; - ex1="";ex1_num=0;ex2="";ex2_num=0;ex3="";ex3_num=0; - - var stah;stah=instance_nearest(x,y,obj_star); + exit; +} - if (stah.p_first[num]=2){ - ex1="Meltagun";ex1_num=choose(2,3,4);ex2="Flamer";ex2_num=choose(2,3,4); - ex3=choose("Power Fist","Chainsword","Bolt Pistol");ex3_num=choose(2,3,4,5); +if (scr_has_adv("Tech-Scavengers")) { + var ex1, ex1_num, ex2, ex2_num, ex3, ex3_num; + ex1 = ""; + ex1_num = 0; + ex2 = ""; + ex2_num = 0; + ex3 = ""; + ex3_num = 0; + + var stah; + stah = instance_nearest(x, y, obj_star); + + if (stah.p_first[num] == 2) { + ex1 = "Meltagun"; + ex1_num = choose(2, 3, 4); + ex2 = "Flamer"; + ex2_num = choose(2, 3, 4); + ex3 = choose("Power Fist", "Chainsword", "Bolt Pistol"); + ex3_num = choose(2, 3, 4, 5); } - if (stah.p_first[num]=3){ - ex1="Plasma Pistol";ex1_num=choose(1,2);ex2="Power Armour";ex2_num=choose(2,3,4); - ex3=choose("Servo-arm","Bionics");ex3_num=choose(2,3,4); + if (stah.p_first[num] == 3) { + ex1 = "Plasma Pistol"; + ex1_num = choose(1, 2); + ex2 = "Power Armour"; + ex2_num = choose(2, 3, 4); + ex3 = choose("Servo-arm", "Bionics"); + ex3_num = choose(2, 3, 4); } - if (stah.p_first[num]=5){ - ex1="Flamer";ex1_num=choose(3,4,5,6);ex2="Heavy Flamer";ex2_num=choose(1,2,3); - ex3=choose("Chainsword","Bolt Pistol");ex3_num=choose(2,3,4,5); + if (stah.p_first[num] == 5) { + ex1 = "Flamer"; + ex1_num = choose(3, 4, 5, 6); + ex2 = "Heavy Flamer"; + ex2_num = choose(1, 2, 3); + ex3 = choose("Chainsword", "Bolt Pistol"); + ex3_num = choose(2, 3, 4, 5); } - - if (ex1!=""){ - pop.text+="##While they're at it your Battle Brothers also find "; - if (ex1_num>0) then pop.text+=string(ex1_num)+" "+string(ex1); - if (ex2_num>0) then pop.text+=", "+string(ex2_num)+" "+string(ex2); - if (ex3_num>0) then pop.text+=", and "+string(ex3_num)+" "+string(ex3); - pop.text+="."; - scr_add_item(ex1,ex1_num);scr_add_item(ex2,ex2_num);scr_add_item(ex3,ex3_num); + + if (ex1 != "") { + pop.text += "##While they're at it your Battle Brothers also find "; + if (ex1_num > 0) { + pop.text += string(ex1_num) + " " + string(ex1); + } + if (ex2_num > 0) { + pop.text += ", " + string(ex2_num) + " " + string(ex2); + } + if (ex3_num > 0) { + pop.text += ", and " + string(ex3_num) + " " + string(ex3); + } + pop.text += "."; + scr_add_item(ex1, ex1_num); + scr_add_item(ex2, ex2_num); + scr_add_item(ex3, ex3_num); } } - -with(obj_star_select){instance_destroy();} -with(obj_fleet_select){instance_destroy();} +with (obj_star_select) { + instance_destroy(); +} +with (obj_fleet_select) { + instance_destroy(); +} delete_features(plan.p_feature[num], P_features.STC_Fragment); -scr_add_stc_fragment();// STC here - +scr_add_stc_fragment(); // STC here -obj_controller.trading_artifact=0; +obj_controller.trading_artifact = 0; clear_diplo_choices(); -obj_controller.menu=0; +obj_controller.menu = 0; instance_destroy(); /* */ diff --git a/objects/obj_ground_mission/Alarm_7.gml b/objects/obj_ground_mission/Alarm_7.gml index b28b04f643..e69de29bb2 100644 --- a/objects/obj_ground_mission/Alarm_7.gml +++ b/objects/obj_ground_mission/Alarm_7.gml @@ -1,3 +0,0 @@ - - - diff --git a/objects/obj_ground_mission/Create_0.gml b/objects/obj_ground_mission/Create_0.gml index be55b9cbec..a1008cfa88 100644 --- a/objects/obj_ground_mission/Create_0.gml +++ b/objects/obj_ground_mission/Create_0.gml @@ -1,13 +1,12 @@ - -num=0; -loc=""; -managing=0; -ruins_race=0; -ruins_battle=0; -battle_threat=0; -battle_loc=""; -ship_id=0; -obj=0; +num = 0; +loc = ""; +managing = 0; +ruins_race = 0; +ruins_battle = 0; +battle_threat = 0; +battle_loc = ""; +ship_id = 0; +obj = 0; recoverable_gene_seed = 0; action_eta = 0; diff --git a/objects/obj_ncombat/Alarm_0.gml b/objects/obj_ncombat/Alarm_0.gml index c802268901..67536c6ca3 100644 --- a/objects/obj_ncombat/Alarm_0.gml +++ b/objects/obj_ncombat/Alarm_0.gml @@ -1,584 +1,576 @@ // Sets up the number of enemies based on the threath level, enemy type and specific story events -try{ -if (battle_special = "cs_meeting_battle5") then alpha_strike = 1; - -instance_activate_object(obj_enunit); - -// show_message("Leader?: "+string(leader)); - -// if (enemy=1) then show_message("exiting obj_ncombat_Alarm 0_2 due to enemy=1"); -if (enemy = 1) { - instance_activate_object(obj_enunit); - exit; -} - -if (battle_special = "study2a") or(battle_special = "study2b") { - ally = 3; - ally_forces = 1; -} -instance_activate_object(obj_pnunit); -if (!instance_exists(obj_pnunit)) then exit; -xxx = instance_nearest(1000, 240, obj_pnunit); -xxx = xxx.x + 80; - -if (string_count("spyrer", battle_special) > 0) or(string_count("fallen", battle_special) > 0) or(string_count("mech", battle_special) > 0) or(battle_special = "space_hulk") or(battle_special = "study2a") or(battle_special = "study2b") then fortified = 0; - -var i = 0, - u; -i = xxx / 10; - -if (fortified > 1) and(enemy + threat != 17) { - u = instance_create(0, 0, obj_nfort); - u.image_speed = 0; - u.image_alpha = 0.5; - - if (fortified = 2) { - u.ac[1] = 30; - u.hp[1] = 400; - } - if (fortified = 3) { - u.ac[1] = 40; - u.hp[1] = 800; - } - if (fortified = 4) { - u.ac[1] = 40; - u.hp[1] = 1250; - } - if (fortified = 5) { - u.ac[1] = 40; - u.hp[1] = 1500; - } - - if (siege = 1) and(fortified > 0) and(defending = true) { - global_attack = global_attack * 1.1; - u.hp[1] = round(u.hp[1] * 1.2); - } - - u.maxhp[1] = u.hp[1]; -} - -for (var j = 0; j < 10; j++) { - i -= 1; - u = instance_create(i * 10, 240, obj_enunit); - u.column = i - ((xxx / 10) - 10); -} -// *** Enemy Forces Special Event *** -// * Malcadon Spyrer * -if (string_count("spyrer", battle_special) > 0) { - fortified = 0; - with(obj_enunit) { - instance_destroy(); - } - u = instance_create(10, 240, obj_enunit); - enemy_dudes = "1"; - u.dudes[1] = "Malcadon Spyrer"; - u.dudes_num[1] = 1; - u.dudes_num[1] = 1; - enemies[1] = 1; - u.flank = 1; -} - -if (battle_special == "protect_raiders") { - fortified = 0; - threat = 3; - u = instance_create(20, 240, obj_enunit); - u.dudes[1] = "Dire Avenger"; - u.dudes_num[1] = 40; - u.dudes_special[1] = "shimmershield"; - u.dudes[2] = "Dire Avenger Exarch"; - u.dudes_num[2] = 4; - u.dudes_special[2] = "shimmershield"; - u.dudes[3] = "Autarch"; - u.dudes_num[3] = 1; - u.dudes[4] = "Farseer"; - u.dudes_num[4] = 1; - u.dudes_special[4] = "farseer_powers"; - u.dudes[5] = "Night Spinner"; - u.dudes_num[5] = 1; - u.enemy = eFACTION.Eldar; -} -// * Small Fallen Group * -if (battle_special = "fallen1") { - fortified = 0; - with(obj_enunit) { - instance_destroy(); - } - u = instance_create(80, 240, obj_enunit); - enemy_dudes = "1"; - u.dudes[1] = "Fallen"; - u.dudes_num[1] = 1; - enemies[1] = 1; -} -// * Large Fallen Group * -if (battle_special = "fallen2") { - fortified = 0; - with(obj_enunit) { - instance_destroy(); - } - u = instance_create(80, 240, obj_enunit); - enemy_dudes = "1"; - u.dudes[1] = "Fallen"; - u.dudes_num[1] = choose(1, 1, 2, 2, 3); - enemies[1] = u.dudes_num[1]; -} -// * Praetorian Servitor Group * -if (string_count("mech", battle_special) > 0) { - fortified = 0; - with(obj_enunit) { - instance_destroy(); - } - u = instance_create(xxx + 10, 240, obj_enunit); - enemy_dudes = ""; - u.dudes[1] = "Thallax"; - u.dudes_num[1] = 4; - enemies[1] = 4; - u.dudes[2] = "Praetorian Servitor"; - u.dudes_num[2] = 6; - enemies[2] = 6; -} -// * Greater Daemon * -if (battle_special = "ship_demon") { - fortified = 0; - with(obj_enunit) { - instance_destroy(); - } - enemy = 10; - u = instance_create(10, 240, obj_enunit); - enemy_dudes = "1"; - u.dudes[1] = choose("Greater Daemon of Khorne", "Greater Daemon of Slaanesh", "Greater Daemon of Tzeentch", "Greater Daemon of Nurgle"); - u.dudes_num[1] = 1; - enemies[1] = 1; - u.flank = 1; - u.engaged = 1; - with(instance_nearest(x + 1000, 240, obj_pnunit)) { - engaged = 1; - } -} -// * Necron Wraith Group * -if (battle_special = "wraith_attack") { - fortified = 0; - with(obj_enunit) { - instance_destroy(); - } - u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit) - .x + 10, 240, obj_enunit); - enemy_dudes = "2"; - u.dudes[1] = "Necron Wraith"; - u.dudes_num[1] = 1; - enemies[1] = 1; - u.dudes[2] = "Necron Wraith"; - u.dudes_num[2] = 1; - enemies[2] = 1; - u.engaged = 1; // u.flank=1; - with(instance_nearest(x + 1000, 240, obj_pnunit)) { - engaged = 1; - } -} -// * Canoptek Spyder Group * -if (battle_special = "spyder_attack") { - fortified = 0; - with(obj_enunit) { - instance_destroy(); - } - u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit) - .x + 10, 240, obj_enunit); - enemy_dudes = "21"; - u.dudes[1] = "Canoptek Spyder"; - u.dudes_num[1] = 1; - enemies[1] = u.dudes[1]; - u.dudes[2] = "Canoptek Scarab"; - u.dudes_num[2] = 20; - enemies[2] = u.dudes[2]; - u.engaged = 1; // u.flank=1; - with(instance_nearest(x + 1000, 240, obj_pnunit)) { - engaged = 1; - } -} -// * Tomb Stalker Group * -if (battle_special = "stalker_attack") { - fortified = 0; - with(obj_enunit) { - instance_destroy(); - } - u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit) - .x + 10, 240, obj_enunit); - enemy_dudes = "1"; - u.dudes[1] = "Tomb Stalker"; - u.dudes_num[1] = 1; - enemies[1] = 1; - u.engaged = 1; // u.flank=1; - with(instance_nearest(x + 1000, 240, obj_pnunit)) { - engaged = 1; - } -} -// * Chaos Space Marine Elite Group * -if (battle_special = "cs_meeting_battle5") or(battle_special = "cs_meeting_battle6") { - fortified = 0; - with(obj_enunit) { - instance_destroy(); - } - u = instance_create(xxx + 20, 240, obj_enunit); - enemy_dudes = ""; - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - u.dudes[2] = "Greater Daemon of Tzeentch"; - u.dudes_num[2] = 1; - enemies[2] = 1; - u.dudes[3] = "Greater Daemon of Slaanesh"; - u.dudes_num[3] = 1; - enemies[3] = 1; - u = instance_create(xxx + 10, 240, obj_enunit); - enemy_dudes = ""; - u.dudes[1] = "Venerable Chaos Terminator"; - u.dudes_num[1] = 20; - enemies[1] = 20; -} -// * Chaos Space Marine Elite Company * -if (battle_special = "cs_meeting_battle10") { - fortified = 0; - with(obj_enunit) { - instance_destroy(); - } - u = instance_create(xxx + 20, 240, obj_enunit); - enemy_dudes = ""; - u.dudes[1] = "Greater Daemon of Tzeentch"; - u.dudes_num[1] = 1; - enemies[1] = 1; - u.dudes[2] = "Greater Daemon of Slaanesh"; - u.dudes_num[2] = 1; - enemies[2] = 1; - u.dudes[3] = "Venerable Chaos Terminator"; - u.dudes_num[3] = 20; - enemies[3] = 20; - u = instance_create(xxx + 10, 240, obj_enunit); - enemy_dudes = ""; - u.dudes[1] = "Venerable Chaos Chosen"; - u.dudes_num[1] = 40; - enemies[1] = 40; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 3; - enemies[2] = 3; -} -// * Tomb world attack enemy setup * -if (battle_special = "wake1_attack") { - enemy = 13; - threat = 2; -} -if (battle_special = "wake2_attack") { - enemy = 13; - threat = 3; -} -if (battle_special = "wake3_attack") { - enemy = 13; - threat = 5; -} -// * Tomb world study attack enemy setup * -if (battle_special = "study2a") { - enemy = 13; - threat = 2; -} -if (battle_special = "study2b") { - enemy = 13; - threat = 3; -} -// ** Space Hulk Forces ** -if (battle_special = "space_hulk") { - var make, modi; - // show_message("space hulk battle, player forces: "+string(player_forces)); - with(obj_enunit) { - instance_destroy(); - } - // * Ork Space Hulk * - if (enemy = 7) { - modi = random_range(0.80, 1.20) + 1; - make = round(max(3, player_starting_dudes * modi)); - - u = instance_create(instance_nearest(x - 1000, 240, obj_pnunit) - .x - 10, 240, obj_enunit); - u.dudes[1] = "Meganob"; - u.dudes_num[1] = make; - enemies[1] = u.dudes[1]; - u.engaged = 1; - u.flank = 1; - with(instance_nearest(x - 1000, 240, obj_pnunit)) { - engaged = 1; - } - - u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit) - .x + 20, 240, obj_enunit); - u.dudes[1] = "Slugga Boy"; - u.dudes_num[1] = make; - enemies[1] = u.dudes[1]; - - u.dudes[2] = "Shoota Boy"; - u.dudes_num[2] = make; - enemies[2] = u.dudes[2]; - - hulk_forces = make * 3; - } - // * Genestealer Space Hulk * - if (enemy = 9) { - modi = random_range(0.80, 1.20) + 1; - make = round(max(3, player_starting_dudes * modi)) * 2; - - u = instance_create(instance_nearest(x - 1000, 240, obj_pnunit) - .x - 10, 240, obj_enunit); - u.dudes[1] = "Genestealer"; - u.dudes_num[1] = round(make / 3); - enemies[1] = u.dudes[1]; - u.engaged = 1; - u.flank = 1; - with(instance_nearest(x - 1000, 240, obj_pnunit)) { - engaged = 1; - } - - u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit) - .x + 10, 240, obj_enunit); - u.dudes[1] = "Genestealer"; - u.dudes_num[1] = round(make / 3); - enemies[1] = u.dudes[1]; - - u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit) - .x + 50, 240, obj_enunit); - u.dudes[1] = "Genestealer"; - u.dudes_num[1] = make - (round(make / 3) * 2); - enemies[1] = u.dudes[1]; - - hulk_forces = make; - } - // * CSM Space Hulk * - if (enemy = 10) { - var make, modi; - modi = random_range(0.80, 1.20) + 1; - make = round(max(3, player_starting_dudes * modi)); - - u = instance_create(instance_nearest(x - 1000, 240, obj_pnunit) - .x - 10, 240, obj_enunit); - u.dudes[1] = "Chaos Terminator"; - u.dudes_num[1] = round(make * 0.25); - enemies[1] = u.dudes[1]; - u.engaged = 1; - u.flank = 1; - with(instance_nearest(x - 1000, 240, obj_pnunit)) { - engaged = 1; - } - - u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit) - .x + 10, 240, obj_enunit); - u.dudes[1] = "Chaos Space Marine"; - u.dudes_num[1] = round(make * 0.25); - enemies[1] = u.dudes[1]; - - u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit) - .x + 50, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = round(make * 0.5); - enemies[1] = u.dudes[1]; - - hulk_forces = make; - } - - // show_message(string(instance_number(obj_enunit))+"x enemy blocks"); - instance_activate_object(obj_enunit); - exit; -} -// ** Story Reveal of a Chaos World ** -if (battle_special = "WL10_reveal") { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "3300"; - - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - - u.dudes[2] = "Greater Daemon of Tzeentch"; - u.dudes_num[2] = 1; - - u.dudes[3] = "Greater Daemon of Slaanesh"; - u.dudes_num[3] = 1; - - u.dudes[4] = "Venerable Chaos Terminator"; - u.dudes_num[4] = 20; - - u.dudes[5] = "Venerable Chaos Chosen"; - u.dudes_num[5] = 50; - // u.dudes[4]="Chaos Basilisk";u.dudes_num[4]=18; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - // u.dudes[1]="Chaos Leman Russ";u.dudes_num[1]=40; - u.dudes[1] = "Chaos Sorcerer"; - u.dudes_num[1] = 4; - u.dudes[2] = "Chaos Space Marine"; - u.dudes_num[2] = 100; - u.dudes[3] = "Havoc"; - u.dudes_num[3] = 20; - u.dudes[4] = "Raptor"; - u.dudes_num[4] = 20; - u.dudes[5] = "Bloodletter"; - u.dudes_num[5] = 30; - // u.dudes[3]="Vindicator";u.dudes_num[3]=10; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Rhino"; - u.dudes_num[1] = 30; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 4; - u.dudes[3] = "Heldrake"; - u.dudes_num[3] = 2; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Cultist Elite"; - u.dudes_num[1] = 1500; - // u.dudes[2]="Cultist Elite";u.dudes_num[2]=1500; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 3; - // u.dudes[3]="Predator";u.dudes_num[3]=6; - // u.dudes[4]="Vindicator";u.dudes_num[4]=3; - // u.dudes[5]="Land Raider";u.dudes_num[5]=2; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 40, 240, obj_enunit); - // u.dudes[1]="Mutant";u.dudes_num[1]=8000; - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 1500; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 3; - instance_deactivate_object(u); -} -// ** Story late reveal of a Chaos World ** -if (battle_special = "WL10_later") { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "200"; - - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - u.dudes[2] = "Greater Daemon of Tzeentch"; - u.dudes_num[2] = 1; - u.dudes[3] = "Greater Daemon of Slaanesh"; - u.dudes_num[3] = 1; - u.dudes[4] = "Venerable Chaos Terminator"; - u.dudes_num[4] = 20; - u.dudes[5] = "Venerable Chaos Chosen"; - u.dudes_num[5] = 50; - // u.dudes[4]="Chaos Basilisk";u.dudes_num[4]=18; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - // u.dudes[1]="Chaos Leman Russ";u.dudes_num[1]=40; - u.dudes[1] = "Chaos Sorcerer"; - u.dudes_num[1] = 2; - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 100; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 1; - instance_deactivate_object(u); -} -// * Imperial Guard Force * -if (enemy = 2) { - guard_total = threat; - guard_score = 6; - - /*if (guard_total>=15000000) then guard_score=6; +try { + if (battle_special == "cs_meeting_battle5") { + alpha_strike = 1; + } + + instance_activate_object(obj_enunit); + + // show_message("Leader?: "+string(leader)); + + // if (enemy=1) then show_message("exiting obj_ncombat_Alarm 0_2 due to enemy=1"); + if (enemy == 1) { + instance_activate_object(obj_enunit); + exit; + } + + if ((battle_special == "study2a") || (battle_special == "study2b")) { + ally = 3; + ally_forces = 1; + } + instance_activate_object(obj_pnunit); + if (!instance_exists(obj_pnunit)) { + exit; + } + xxx = instance_nearest(1000, 240, obj_pnunit); + xxx = xxx.x + 80; + + if ((string_count("spyrer", battle_special) > 0) || (string_count("fallen", battle_special) > 0) || (string_count("mech", battle_special) > 0) || (battle_special == "space_hulk") || (battle_special == "study2a") || (battle_special == "study2b")) { + fortified = 0; + } + + var i = 0, u; + i = xxx / 10; + + if ((fortified > 1) && (enemy + threat != 17)) { + u = instance_create(0, 0, obj_nfort); + u.image_speed = 0; + u.image_alpha = 0.5; + + if (fortified == 2) { + u.ac[1] = 30; + u.hp[1] = 400; + } + if (fortified == 3) { + u.ac[1] = 40; + u.hp[1] = 800; + } + if (fortified == 4) { + u.ac[1] = 40; + u.hp[1] = 1250; + } + if (fortified == 5) { + u.ac[1] = 40; + u.hp[1] = 1500; + } + + if ((siege == 1) && (fortified > 0) && (defending == true)) { + global_attack = global_attack * 1.1; + u.hp[1] = round(u.hp[1] * 1.2); + } + + u.maxhp[1] = u.hp[1]; + } + + for (var j = 0; j < 10; j++) { + i -= 1; + u = instance_create(i * 10, 240, obj_enunit); + u.column = i - ((xxx / 10) - 10); + } + // *** Enemy Forces Special Event *** + // * Malcadon Spyrer * + if (string_count("spyrer", battle_special) > 0) { + fortified = 0; + with (obj_enunit) { + instance_destroy(); + } + u = instance_create(10, 240, obj_enunit); + enemy_dudes = "1"; + u.dudes[1] = "Malcadon Spyrer"; + u.dudes_num[1] = 1; + u.dudes_num[1] = 1; + enemies[1] = 1; + u.flank = 1; + } + + if (battle_special == "protect_raiders") { + fortified = 0; + threat = 3; + u = instance_create(20, 240, obj_enunit); + u.dudes[1] = "Dire Avenger"; + u.dudes_num[1] = 40; + u.dudes_special[1] = "shimmershield"; + u.dudes[2] = "Dire Avenger Exarch"; + u.dudes_num[2] = 4; + u.dudes_special[2] = "shimmershield"; + u.dudes[3] = "Autarch"; + u.dudes_num[3] = 1; + u.dudes[4] = "Farseer"; + u.dudes_num[4] = 1; + u.dudes_special[4] = "farseer_powers"; + u.dudes[5] = "Night Spinner"; + u.dudes_num[5] = 1; + u.enemy = eFACTION.Eldar; + } + // * Small Fallen Group * + if (battle_special == "fallen1") { + fortified = 0; + with (obj_enunit) { + instance_destroy(); + } + u = instance_create(80, 240, obj_enunit); + enemy_dudes = "1"; + u.dudes[1] = "Fallen"; + u.dudes_num[1] = 1; + enemies[1] = 1; + } + // * Large Fallen Group * + if (battle_special == "fallen2") { + fortified = 0; + with (obj_enunit) { + instance_destroy(); + } + u = instance_create(80, 240, obj_enunit); + enemy_dudes = "1"; + u.dudes[1] = "Fallen"; + u.dudes_num[1] = choose(1, 1, 2, 2, 3); + enemies[1] = u.dudes_num[1]; + } + // * Praetorian Servitor Group * + if (string_count("mech", battle_special) > 0) { + fortified = 0; + with (obj_enunit) { + instance_destroy(); + } + u = instance_create(xxx + 10, 240, obj_enunit); + enemy_dudes = ""; + u.dudes[1] = "Thallax"; + u.dudes_num[1] = 4; + enemies[1] = 4; + u.dudes[2] = "Praetorian Servitor"; + u.dudes_num[2] = 6; + enemies[2] = 6; + } + // * Greater Daemon * + if (battle_special == "ship_demon") { + fortified = 0; + with (obj_enunit) { + instance_destroy(); + } + enemy = 10; + u = instance_create(10, 240, obj_enunit); + enemy_dudes = "1"; + u.dudes[1] = choose("Greater Daemon of Khorne", "Greater Daemon of Slaanesh", "Greater Daemon of Tzeentch", "Greater Daemon of Nurgle"); + u.dudes_num[1] = 1; + enemies[1] = 1; + u.flank = 1; + u.engaged = 1; + with (instance_nearest(x + 1000, 240, obj_pnunit)) { + engaged = 1; + } + } + // * Necron Wraith Group * + if (battle_special == "wraith_attack") { + fortified = 0; + with (obj_enunit) { + instance_destroy(); + } + u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit).x + 10, 240, obj_enunit); + enemy_dudes = "2"; + u.dudes[1] = "Necron Wraith"; + u.dudes_num[1] = 1; + enemies[1] = 1; + u.dudes[2] = "Necron Wraith"; + u.dudes_num[2] = 1; + enemies[2] = 1; + u.engaged = 1; // u.flank=1; + with (instance_nearest(x + 1000, 240, obj_pnunit)) { + engaged = 1; + } + } + // * Canoptek Spyder Group * + if (battle_special == "spyder_attack") { + fortified = 0; + with (obj_enunit) { + instance_destroy(); + } + u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit).x + 10, 240, obj_enunit); + enemy_dudes = "21"; + u.dudes[1] = "Canoptek Spyder"; + u.dudes_num[1] = 1; + enemies[1] = u.dudes[1]; + u.dudes[2] = "Canoptek Scarab"; + u.dudes_num[2] = 20; + enemies[2] = u.dudes[2]; + u.engaged = 1; // u.flank=1; + with (instance_nearest(x + 1000, 240, obj_pnunit)) { + engaged = 1; + } + } + // * Tomb Stalker Group * + if (battle_special == "stalker_attack") { + fortified = 0; + with (obj_enunit) { + instance_destroy(); + } + u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit).x + 10, 240, obj_enunit); + enemy_dudes = "1"; + u.dudes[1] = "Tomb Stalker"; + u.dudes_num[1] = 1; + enemies[1] = 1; + u.engaged = 1; // u.flank=1; + with (instance_nearest(x + 1000, 240, obj_pnunit)) { + engaged = 1; + } + } + // * Chaos Space Marine Elite Group * + if ((battle_special == "cs_meeting_battle5") || (battle_special == "cs_meeting_battle6")) { + fortified = 0; + with (obj_enunit) { + instance_destroy(); + } + u = instance_create(xxx + 20, 240, obj_enunit); + enemy_dudes = ""; + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + u.dudes[2] = "Greater Daemon of Tzeentch"; + u.dudes_num[2] = 1; + enemies[2] = 1; + u.dudes[3] = "Greater Daemon of Slaanesh"; + u.dudes_num[3] = 1; + enemies[3] = 1; + u = instance_create(xxx + 10, 240, obj_enunit); + enemy_dudes = ""; + u.dudes[1] = "Venerable Chaos Terminator"; + u.dudes_num[1] = 20; + enemies[1] = 20; + } + // * Chaos Space Marine Elite Company * + if (battle_special == "cs_meeting_battle10") { + fortified = 0; + with (obj_enunit) { + instance_destroy(); + } + u = instance_create(xxx + 20, 240, obj_enunit); + enemy_dudes = ""; + u.dudes[1] = "Greater Daemon of Tzeentch"; + u.dudes_num[1] = 1; + enemies[1] = 1; + u.dudes[2] = "Greater Daemon of Slaanesh"; + u.dudes_num[2] = 1; + enemies[2] = 1; + u.dudes[3] = "Venerable Chaos Terminator"; + u.dudes_num[3] = 20; + enemies[3] = 20; + u = instance_create(xxx + 10, 240, obj_enunit); + enemy_dudes = ""; + u.dudes[1] = "Venerable Chaos Chosen"; + u.dudes_num[1] = 40; + enemies[1] = 40; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 3; + enemies[2] = 3; + } + // * Tomb world attack enemy setup * + if (battle_special == "wake1_attack") { + enemy = 13; + threat = 2; + } + if (battle_special == "wake2_attack") { + enemy = 13; + threat = 3; + } + if (battle_special == "wake3_attack") { + enemy = 13; + threat = 5; + } + // * Tomb world study attack enemy setup * + if (battle_special == "study2a") { + enemy = 13; + threat = 2; + } + if (battle_special == "study2b") { + enemy = 13; + threat = 3; + } + // ** Space Hulk Forces ** + if (battle_special == "space_hulk") { + var make, modi; + // show_message("space hulk battle, player forces: "+string(player_forces)); + with (obj_enunit) { + instance_destroy(); + } + // * Ork Space Hulk * + if (enemy == 7) { + modi = random_range(0.80, 1.20) + 1; + make = round(max(3, player_starting_dudes * modi)); + + u = instance_create(instance_nearest(x - 1000, 240, obj_pnunit).x - 10, 240, obj_enunit); + u.dudes[1] = "Meganob"; + u.dudes_num[1] = make; + enemies[1] = u.dudes[1]; + u.engaged = 1; + u.flank = 1; + with (instance_nearest(x - 1000, 240, obj_pnunit)) { + engaged = 1; + } + + u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit).x + 20, 240, obj_enunit); + u.dudes[1] = "Slugga Boy"; + u.dudes_num[1] = make; + enemies[1] = u.dudes[1]; + + u.dudes[2] = "Shoota Boy"; + u.dudes_num[2] = make; + enemies[2] = u.dudes[2]; + + hulk_forces = make * 3; + } + // * Genestealer Space Hulk * + if (enemy == 9) { + modi = random_range(0.80, 1.20) + 1; + make = round(max(3, player_starting_dudes * modi)) * 2; + + u = instance_create(instance_nearest(x - 1000, 240, obj_pnunit).x - 10, 240, obj_enunit); + u.dudes[1] = "Genestealer"; + u.dudes_num[1] = round(make / 3); + enemies[1] = u.dudes[1]; + u.engaged = 1; + u.flank = 1; + with (instance_nearest(x - 1000, 240, obj_pnunit)) { + engaged = 1; + } + + u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit).x + 10, 240, obj_enunit); + u.dudes[1] = "Genestealer"; + u.dudes_num[1] = round(make / 3); + enemies[1] = u.dudes[1]; + + u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit).x + 50, 240, obj_enunit); + u.dudes[1] = "Genestealer"; + u.dudes_num[1] = make - (round(make / 3) * 2); + enemies[1] = u.dudes[1]; + + hulk_forces = make; + } + // * CSM Space Hulk * + if (enemy == 10) { + var make, modi; + modi = random_range(0.80, 1.20) + 1; + make = round(max(3, player_starting_dudes * modi)); + + u = instance_create(instance_nearest(x - 1000, 240, obj_pnunit).x - 10, 240, obj_enunit); + u.dudes[1] = "Chaos Terminator"; + u.dudes_num[1] = round(make * 0.25); + enemies[1] = u.dudes[1]; + u.engaged = 1; + u.flank = 1; + with (instance_nearest(x - 1000, 240, obj_pnunit)) { + engaged = 1; + } + + u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit).x + 10, 240, obj_enunit); + u.dudes[1] = "Chaos Space Marine"; + u.dudes_num[1] = round(make * 0.25); + enemies[1] = u.dudes[1]; + + u = instance_create(instance_nearest(x + 1000, 240, obj_pnunit).x + 50, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = round(make * 0.5); + enemies[1] = u.dudes[1]; + + hulk_forces = make; + } + + // show_message(string(instance_number(obj_enunit))+"x enemy blocks"); + instance_activate_object(obj_enunit); + exit; + } + // ** Story Reveal of a Chaos World ** + if (battle_special == "WL10_reveal") { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "3300"; + + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + + u.dudes[2] = "Greater Daemon of Tzeentch"; + u.dudes_num[2] = 1; + + u.dudes[3] = "Greater Daemon of Slaanesh"; + u.dudes_num[3] = 1; + + u.dudes[4] = "Venerable Chaos Terminator"; + u.dudes_num[4] = 20; + + u.dudes[5] = "Venerable Chaos Chosen"; + u.dudes_num[5] = 50; + // u.dudes[4]="Chaos Basilisk";u.dudes_num[4]=18; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + // u.dudes[1]="Chaos Leman Russ";u.dudes_num[1]=40; + u.dudes[1] = "Chaos Sorcerer"; + u.dudes_num[1] = 4; + u.dudes[2] = "Chaos Space Marine"; + u.dudes_num[2] = 100; + u.dudes[3] = "Havoc"; + u.dudes_num[3] = 20; + u.dudes[4] = "Raptor"; + u.dudes_num[4] = 20; + u.dudes[5] = "Bloodletter"; + u.dudes_num[5] = 30; + // u.dudes[3]="Vindicator";u.dudes_num[3]=10; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Rhino"; + u.dudes_num[1] = 30; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 4; + u.dudes[3] = "Heldrake"; + u.dudes_num[3] = 2; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Cultist Elite"; + u.dudes_num[1] = 1500; + // u.dudes[2]="Cultist Elite";u.dudes_num[2]=1500; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 3; + // u.dudes[3]="Predator";u.dudes_num[3]=6; + // u.dudes[4]="Vindicator";u.dudes_num[4]=3; + // u.dudes[5]="Land Raider";u.dudes_num[5]=2; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 40, 240, obj_enunit); + // u.dudes[1]="Mutant";u.dudes_num[1]=8000; + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 1500; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 3; + instance_deactivate_object(u); + } + // ** Story late reveal of a Chaos World ** + if (battle_special == "WL10_later") { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "200"; + + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + u.dudes[2] = "Greater Daemon of Tzeentch"; + u.dudes_num[2] = 1; + u.dudes[3] = "Greater Daemon of Slaanesh"; + u.dudes_num[3] = 1; + u.dudes[4] = "Venerable Chaos Terminator"; + u.dudes_num[4] = 20; + u.dudes[5] = "Venerable Chaos Chosen"; + u.dudes_num[5] = 50; + // u.dudes[4]="Chaos Basilisk";u.dudes_num[4]=18; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + // u.dudes[1]="Chaos Leman Russ";u.dudes_num[1]=40; + u.dudes[1] = "Chaos Sorcerer"; + u.dudes_num[1] = 2; + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 100; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 1; + instance_deactivate_object(u); + } + // * Imperial Guard Force * + if (enemy == 2) { + guard_total = threat; + guard_score = 6; + + /*if (guard_total>=15000000) then guard_score=6; if (guard_total<15000000) and (guard_total>=6000000) then guard_score=5; if (guard_total<6000000) and (guard_total>=1000000) then guard_score=4; if (guard_total<1000000) and (guard_total>=50000) then guard_score=3; if (guard_total<50000) and (guard_total>=500) then guard_score=2; if (guard_total<500) then guard_score=1;*/ - // guard_effective=floor(guard_total)/8; - - var f = 0, - guar = threat / 10; - - // Guardsmen - u = instance_create(xxx, 240, obj_enunit); - enemy_dudes = threat; - u.dudes[1] = "Imperial Guardsman"; - u.dudes_num[1] = round(guar / 5); - enemies[1] = u.dudes[1]; - instance_deactivate_object(u); - - f = round(threat / 20000); - // Leman Russ D and Ogryn - if (f > 0) { - u = instance_create(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Leman Russ Demolisher"; - u.dudes_num[1] = f; - enemies[1] = u.dudes[1]; - f = max(10, round(threat / 6650)); - u.dudes[2] = "Ogryn"; - u.dudes_num[2] = f; - enemies[2] = u.dudes[2]; - instance_deactivate_object(u); - } - - // Chimera and Leman Russ - f = max(1, round(threat / 10000)); - u = instance_create(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Leman Russ Battle Tank"; - u.dudes_num[1] = f; - enemies[1] = u.dudes[1]; - f = max(1, round(threat / 20000)); - u.dudes[2] = "Chimera"; - u.dudes_num[2] = f; - enemies[2] = u.dudes[2]; - instance_deactivate_object(u); - - // More Guard - u = instance_create(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Imperial Guardsman"; - u.dudes_num[1] = round(guar / 5); - enemies[1] = u.dudes[1]; - - u = instance_create(xxx + 40, 240, obj_enunit); - u.dudes[1] = "Imperial Guardsman"; - u.dudes_num[1] = round(guar / 5); - enemies[1] = u.dudes[1]; - - u = instance_create(xxx + 50, 240, obj_enunit); - u.dudes[1] = "Imperial Guardsman"; - u.dudes_num[1] = round(guar / 5); - enemies[1] = u.dudes[1]; - - u = instance_create(xxx + 60, 240, obj_enunit); - u.dudes[1] = "Imperial Guardsman"; - u.dudes_num[1] = round(guar / 5); - enemies[1] = u.dudes[1]; - - u = instance_create(xxx + 70, 240, obj_enunit); - f = round(threat / 50000); - - // Basilisk and Heavy Weapons - if (f > 0) { - u.dudes[1] = "Basilisk"; - u.dudes_num[1] = f; - enemies[1] = u.dudes[1]; - u.dudes[2] = "Heavy Weapons Team"; - u.dudes_num[2] = round(threat / 10000); - enemies[2] = u.dudes[2]; - } - // Heavy Weapons - else { - u.dudes[1] = "Heavy Weapons Team"; - u.dudes_num[1] = round(threat / 10000); - enemies[1] = u.dudes[1]; - } - - f = round(threat / 40000); - // Vendetta - if (f > 0) { - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Vendetta"; - u.dudes_num[1] = f; - u.flank = 1; - u.flyer = 1; - } - - /*u=instance_nearest(xxx,240,obj_enunit);enemy_dudes=threat; + // guard_effective=floor(guard_total)/8; + + var f = 0, guar = threat / 10; + + // Guardsmen + u = instance_create(xxx, 240, obj_enunit); + enemy_dudes = threat; + u.dudes[1] = "Imperial Guardsman"; + u.dudes_num[1] = round(guar / 5); + enemies[1] = u.dudes[1]; + instance_deactivate_object(u); + + f = round(threat / 20000); + // Leman Russ D and Ogryn + if (f > 0) { + u = instance_create(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Leman Russ Demolisher"; + u.dudes_num[1] = f; + enemies[1] = u.dudes[1]; + f = max(10, round(threat / 6650)); + u.dudes[2] = "Ogryn"; + u.dudes_num[2] = f; + enemies[2] = u.dudes[2]; + instance_deactivate_object(u); + } + + // Chimera and Leman Russ + f = max(1, round(threat / 10000)); + u = instance_create(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Leman Russ Battle Tank"; + u.dudes_num[1] = f; + enemies[1] = u.dudes[1]; + f = max(1, round(threat / 20000)); + u.dudes[2] = "Chimera"; + u.dudes_num[2] = f; + enemies[2] = u.dudes[2]; + instance_deactivate_object(u); + + // More Guard + u = instance_create(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Imperial Guardsman"; + u.dudes_num[1] = round(guar / 5); + enemies[1] = u.dudes[1]; + + u = instance_create(xxx + 40, 240, obj_enunit); + u.dudes[1] = "Imperial Guardsman"; + u.dudes_num[1] = round(guar / 5); + enemies[1] = u.dudes[1]; + + u = instance_create(xxx + 50, 240, obj_enunit); + u.dudes[1] = "Imperial Guardsman"; + u.dudes_num[1] = round(guar / 5); + enemies[1] = u.dudes[1]; + + u = instance_create(xxx + 60, 240, obj_enunit); + u.dudes[1] = "Imperial Guardsman"; + u.dudes_num[1] = round(guar / 5); + enemies[1] = u.dudes[1]; + + u = instance_create(xxx + 70, 240, obj_enunit); + f = round(threat / 50000); + + // Basilisk and Heavy Weapons + if (f > 0) { + u.dudes[1] = "Basilisk"; + u.dudes_num[1] = f; + enemies[1] = u.dudes[1]; + u.dudes[2] = "Heavy Weapons Team"; + u.dudes_num[2] = round(threat / 10000); + enemies[2] = u.dudes[2]; + } else // Heavy Weapons + { + u.dudes[1] = "Heavy Weapons Team"; + u.dudes_num[1] = round(threat / 10000); + enemies[1] = u.dudes[1]; + } + + f = round(threat / 40000); + // Vendetta + if (f > 0) { + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Vendetta"; + u.dudes_num[1] = f; + u.flank = 1; + u.flyer = 1; + } + + /*u=instance_nearest(xxx,240,obj_enunit);enemy_dudes=threat; u.dudes[1]="Imperial Guardsman";u.dudes_num[1]=floor(guard_effective*0.6);enemies[1]=u.dudes[1]; u.dudes[2]="Heavy Weapons Team";u.dudes_num[2]=min(1000,floor(guard_effective*0.1));enemies[2]=u.dudes[2]; if (threat>1){u.dudes[3]="Leman Russ Battle Tank";u.dudes_num[3]=min(1000,floor(guard_effective*0.1));enemies[3]=u.dudes[3];} @@ -587,2542 +579,2585 @@ if (enemy = 2) { u.dudes[1]="Imperial Guardsman";u.dudes_num[1]=floor(guard_effective*0.6);enemies[1]=u.dudes[1]; u.dudes[2]="Heavy Weapons Team";u.dudes_num[2]=min(1000,floor(guard_effective*0.1));enemies[2]=u.dudes[2]; if (threat>1){u.dudes[3]="Leman Russ Battle Tank";u.dudes_num[3]=min(1000,floor(guard_effective*0.1));enemies[3]=u.dudes[3];}*/ + } + + // ** Aeldar Force ** + if (enemy == 6) { + // Ranger Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "20"; + + u.dudes[1] = "Pathfinder"; + u.dudes_num[1] = 1; + enemies[1] = u.dudes[1]; + u.dudes[2] = "Ranger"; + u.dudes_num[2] = 10; + enemies[2] = u.dudes[2]; + u.dudes[3] = "Striking Scorpian"; + u.dudes_num[3] = 10; + enemies[3] = u.dudes[3]; + } + // Harlequin Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "9"; + + u.dudes[1] = "Athair"; + u.dudes_num[1] = 1; + enemies[1] = u.dudes[1]; + u.dudes[2] = "Warlock"; + u.dudes_num[2] = 2; + enemies[2] = u.dudes[2]; + u.dudes[3] = "Trouper"; + u.dudes_num[3] = 6; + enemies[3] = u.dudes[3]; + } + // Craftworld Small Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "24"; + + u.dudes[1] = "Warlock"; + u.dudes_num[1] = 1; + enemies[1] = u.dudes[1]; + enemies_num[1] = 1; + u.dudes[2] = choose("Howling Banshee", "Striking Scorpian"); + u.dudes_num[2] = 8; + enemies[2] = u.dudes[2]; + u.dudes[3] = "Dire Avenger"; + u.dudes_num[3] = 15; + enemies[3] = u.dudes[3]; + if (leader == 1) { + u.dudes[4] = "Leader"; + u.dudes_num[4] = 1; + enemies[4] = 1; + enemies_num[4] = 1; + if (obj_controller.faction_gender[6] == 2) { + u.dudes[2] = "Howling Banshee"; + } + if (obj_controller.faction_gender[6] == 2) { + u.dudes[2] = "Dark Reapers"; + } + } + } + // Craftworld Medium Group + if (threat == 2) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "100"; + + u.dudes[1] = "Dire Avenger"; + u.dudes_num[1] = 56; + u.dudes_special[1] = "shimmershield"; + u.dudes[2] = "Dire Avenger Exarch"; + u.dudes_num[2] = 4; + u.dudes_special[2] = "shimmershield"; + u.dudes[3] = "Autarch"; + u.dudes_num[3] = 1; + u.dudes[4] = "Farseer"; + u.dudes_num[4] = 1; + u.dudes_special[4] = "farseer_powers"; + u.dudes[5] = "Night Spinner"; + u.dudes_num[5] = 1; + // Spawn leader + if (leader == 1) { + u.dudes[4] = "Leader"; + u.dudes_num[4] = 1; + enemies[4] = 1; + enemies_num[4] = 1; + } + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Fire Dragon"; + u.dudes_num[1] = 7; + u.dudes[2] = "Fire Dragon Exarch"; + u.dudes_num[2] = 1; + u.dudes[3] = "Warp Spider"; + u.dudes_num[3] = 7; + u.dudes_special[3] = "warp_jump"; + u.dudes[4] = "Warp Spider Exarch"; + u.dudes_num[4] = 1; + u.dudes_special[4] = "warp_jump"; + u.dudes[5] = "Howling Banshee"; + u.dudes_num[5] = 9; + u.dudes_special[5] = "banshee_mask"; + u.dudes[6] = "Howling Banshee Exarch"; + u.dudes_num[6] = 1; + u.dudes_special[6] = "banshee_mask"; + u.dudes[7] = "Striking Scorpian"; + u.dudes_num[7] = 9; + u.dudes[8] = "Striking Scorpian Exarch"; + u.dudes_num[8] = 1; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Falcon"; + u.dudes_num[1] = 2; + } + // Craftworld Large Group + if (threat == 3) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "300"; + + u.dudes[1] = "Dire Avenger"; + u.dudes_num[1] = 140; + u.dudes_special[1] = "shimmershield"; + u.dudes[2] = "Dire Avenger Exarch"; + u.dudes_num[2] = 10; + u.dudes_special[2] = "shimmershield"; + u.dudes[3] = "Autarch"; + u.dudes_num[3] = 1; + u.dudes[4] = "Farseer"; + u.dudes_num[4] = 1; + u.dudes_special[4] = "farseer_powers"; + // Spawn Leader + if (leader == 1) { + u.dudes[4] = "Leader"; + u.dudes_num[4] = 1; + enemies[4] = 1; + enemies_num[4] = 1; + } + u.dudes[5] = "Fire Prism"; + u.dudes_num[5] = 3; + u.dudes[6] = "Avatar"; + u.dudes_num[6] = 1; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Fire Dragon"; + u.dudes_num[1] = 18; + u.dudes[2] = "Fire Dragon Exarch"; + u.dudes_num[2] = 2; + u.dudes[3] = "Warp Spider"; + u.dudes_num[3] = 18; + u.dudes_special[3] = "warp_jump"; + u.dudes[4] = "Warp Spider Exarch"; + u.dudes_num[4] = 2; + u.dudes_special[4] = "warp_jump"; + u.dudes[5] = "Howling Banshee"; + u.dudes_num[5] = 28; + u.dudes_special[5] = "banshee_mask"; + u.dudes[6] = "Howling Banshee Exarch"; + u.dudes_num[6] = 2; + u.dudes_special[6] = "banshee_mask"; + u.dudes[7] = "Striking Scorpian"; + u.dudes_num[7] = 19; + u.dudes[8] = "Striking Scorpian Exarch"; + u.dudes_num[8] = 1; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Falcon"; + u.dudes_num[1] = 5; + u.dudes[2] = "Vyper"; + u.dudes_num[2] = 12; + u.dudes[3] = "Wraithguard"; + u.dudes_num[3] = 30; + u.dudes[4] = "Wraithlord"; + u.dudes_num[4] = 2; + } + // Craftworld Small Army + if (threat == 4) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "1100"; + + u.dudes[1] = "Dire Avenger"; + u.dudes_num[1] = 280; + u.dudes_special[1] = "shimmershield"; + u.dudes[2] = "Dire Avenger Exarch"; + u.dudes_num[2] = 20; + u.dudes_special[2] = "shimmershield"; + u.dudes[3] = "Autarch"; + u.dudes_num[3] = 3; + u.dudes[4] = "Farseer"; + u.dudes_num[4] = 2; + u.dudes_special[4] = "farseer_powers"; + // Spawn Leader + if (leader == 1) { + u.dudes[4] = "Leader"; + u.dudes_num[4] = 1; + enemies[4] = 1; + enemies_num[4] = 1; + } + u.dudes[5] = "Fire Prism"; + u.dudes_num[5] = 3; + u.dudes[6] = "Avatar"; + u.dudes_num[6] = 1; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Warlock"; + u.dudes_num[1] = 40; + u.dudes[2] = "Guardian"; + u.dudes_num[2] = 400; + u.dudes[3] = "Grav Platform"; + u.dudes_num[3] = 20; + u.dudes[4] = "Dark Reaper"; + u.dudes_num[4] = 18; + u.dudes[5] = "Dark Reaper Exarch"; + u.dudes_num[5] = 2; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Fire Dragon"; + u.dudes_num[1] = 36; + u.dudes[2] = "Fire Dragon Exarch"; + u.dudes_num[2] = 4; + u.dudes[3] = "Warp Spider"; + u.dudes_num[3] = 36; + u.dudes_special[3] = "warp_jump"; + u.dudes[4] = "Warp Spider Exarch"; + u.dudes_num[4] = 4; + u.dudes_special[4] = "warp_jump"; + u.dudes[5] = "Howling Banshee"; + u.dudes_num[5] = 36; + u.dudes_special[5] = "banshee_mask"; + u.dudes[6] = "Howling Banshee Exarch"; + u.dudes_num[6] = 4; + u.dudes_special[6] = "banshee_mask"; + u.dudes[7] = "Striking Scorpian"; + u.dudes_num[7] = 38; + u.dudes[8] = "Striking Scorpian Exarch"; + u.dudes_num[8] = 2; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Falcon"; + u.dudes_num[1] = 12; + u.dudes[2] = "Vyper"; + u.dudes_num[2] = 20; + u.dudes[3] = "Wraithguard"; + u.dudes_num[3] = 90; + u.dudes[4] = "Wraithlord"; + u.dudes_num[4] = 5; + u.dudes[5] = "Shining Spear"; + u.dudes_num[5] = 40; + } + // Craftworld Medium Army + if (threat == 5) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "2500"; + + u.dudes[1] = "Dire Avenger"; + u.dudes_num[1] = 450; + u.dudes_special[1] = "shimmershield"; + u.dudes[2] = "Dire Avenger Exarch"; + u.dudes_num[2] = 50; + u.dudes_special[2] = "shimmershield"; + u.dudes[3] = "Autarch"; + u.dudes_num[3] = 5; + u.dudes[4] = "Farseer"; + u.dudes_num[4] = 3; + u.dudes_special[4] = "farseer_powers"; + // Spawn Leader + if (leader == 1) { + u.dudes[4] = "Leader"; + u.dudes_num[4] = 1; + enemies[4] = 1; + enemies_num[4] = 1; + } + u.dudes[5] = "Fire Prism"; + u.dudes_num[5] = 6; + u.dudes[6] = "Mighty Avatar"; + u.dudes_num[6] = 1; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Warlock"; + u.dudes_num[1] = 80; + u.dudes[2] = "Guardian"; + u.dudes_num[2] = 1200; + u.dudes[3] = "Grav Platform"; + u.dudes_num[3] = 40; + u.dudes[4] = "Dark Reaper"; + u.dudes_num[4] = 36; + u.dudes[5] = "Dark Reaper Exarch"; + u.dudes_num[5] = 4; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Fire Dragon"; + u.dudes_num[1] = 72; + u.dudes[2] = "Fire Dragon Exarch"; + u.dudes_num[2] = 8; + u.dudes[3] = "Warp Spider"; + u.dudes_num[3] = 72; + u.dudes_special[3] = "warp_jump"; + u.dudes[4] = "Warp Spider Exarch"; + u.dudes_num[4] = 8; + u.dudes_special[4] = "warp_jump"; + u.dudes[5] = "Howling Banshee"; + u.dudes_num[5] = 72; + u.dudes_special[5] = "banshee_mask"; + u.dudes[6] = "Howling Banshee Exarch"; + u.dudes_num[6] = 8; + u.dudes_special[6] = "banshee_mask"; + u.dudes[7] = "Striking Scorpian"; + u.dudes_num[7] = 72; + u.dudes[8] = "Striking Scorpian Exarch"; + u.dudes_num[8] = 8; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Falcon"; + u.dudes_num[1] = 24; + u.dudes[2] = "Vyper"; + u.dudes_num[2] = 40; + u.dudes[3] = "Wraithguard"; + u.dudes_num[3] = 180; + u.dudes[4] = "Wraithlord"; + u.dudes_num[4] = 10; + u.dudes[5] = "Shining Spear"; + u.dudes_num[5] = 80; + } + // Craftworld Large Army + if (threat == 6) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "5000"; + + u.dudes[1] = "Dire Avenger"; + u.dudes_num[1] = 540; + u.dudes_special[1] = "shimmershield"; + u.dudes[2] = "Dire Avenger Exarch"; + u.dudes_num[2] = 60; + u.dudes_special[2] = "shimmershield"; + u.dudes[3] = "Autarch"; + u.dudes_num[3] = 8; + u.dudes[4] = "Farseer"; + u.dudes_num[4] = 4; + u.dudes_special[4] = "farseer_powers"; + // Spawn Leader + if (leader == 1) { + u.dudes[4] = "Leader"; + u.dudes_num[4] = 1; + enemies[4] = 1; + enemies_num[4] = 1; + } + u.dudes[5] = "Fire Prism"; + u.dudes_num[5] = 12; + u.dudes[6] = "Godly Avatar"; + u.dudes_num[6] = 1; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Warlock"; + u.dudes_num[1] = 100; + u.dudes[2] = "Guardian"; + u.dudes_num[2] = 3000; + u.dudes[3] = "Grav Platform"; + u.dudes_num[3] = 80; + u.dudes[4] = "Dark Reaper"; + u.dudes_num[4] = 72; + u.dudes[5] = "Dark Reaper Exarch"; + u.dudes_num[5] = 8; + u.dudes[6] = "Phantom Titan"; + u.dudes_num[6] = 2; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Fire Dragon"; + u.dudes_num[1] = 144; + u.dudes[2] = "Fire Dragon Exarch"; + u.dudes_num[2] = 16; + u.dudes[3] = "Warp Spider"; + u.dudes_num[3] = 144; + u.dudes_special[3] = "warp_jump"; + u.dudes[4] = "Warp Spider Exarch"; + u.dudes_num[4] = 16; + u.dudes_special[4] = "warp_jump"; + u.dudes[5] = "Howling Banshee"; + u.dudes_num[5] = 144; + u.dudes_special[5] = "banshee_mask"; + u.dudes[6] = "Howling Banshee Exarch"; + u.dudes_num[6] = 16; + u.dudes_special[6] = "banshee_mask"; + u.dudes[7] = "Striking Scorpian"; + u.dudes_num[7] = 144; + u.dudes[8] = "Striking Scorpian Exarch"; + u.dudes_num[8] = 16; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Falcon"; + u.dudes_num[1] = 48; + u.dudes[2] = "Vyper"; + u.dudes_num[2] = 80; + u.dudes[3] = "Wraithguard"; + u.dudes_num[3] = 360; + u.dudes[4] = "Wraithlord"; + u.dudes_num[4] = 20; + u.dudes[5] = "Shining Spear"; + u.dudes_num[5] = 160; + } + } + + // ** Sisters Force ** + if (enemy == 5) { + // Small Sister Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "110"; + + u.dudes[1] = "Celestian"; + u.dudes_num[1] = 1; + enemies[1] = u.dudes[1]; + // Spawn Leader + if (leader == 1) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + enemies_num[1] = 1; + } + u.dudes[2] = "Battle Sister"; + u.dudes_num[2] = 4; + enemies[2] = u.dudes[2]; + u.dudes[3] = "Priest"; + u.dudes_num[3] = 10; + enemies[3] = u.dudes[3]; + u.dudes[4] = "Follower"; + u.dudes_num[4] = 100; + enemies[4] = u.dudes[4]; + } + // Medium Sister Group + if (threat == 2) { + u = instance_nearest(xxx + 10, 240, obj_enunit); + enemy_dudes = "nearly 400"; + + u.dudes[1] = "Celestian"; + u.dudes_num[1] = 1; + // Spawn Leader + if (leader == 1) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + enemies_num[1] = 1; + } + u.dudes[2] = "Battle Sister"; + u.dudes_num[2] = 50; + u.dudes[3] = "Follower"; + u.dudes_num[3] = 300; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Arco-Flagellent"; + u.dudes_num[1] = 50; + u.dudes[2] = "Chimera"; + u.dudes_num[2] = 3; + } + // Large Sister Group + if (threat == 3) { + u = instance_nearest(xxx + 30, 240, obj_enunit); + enemy_dudes = "1000"; + + u.dudes[1] = "Palatine"; + u.dudes_num[1] = 1; + // Spawn Leader + if (leader == 1) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + enemies_num[1] = 1; + } + u.dudes[2] = "Battle Sister"; + u.dudes_num[2] = 200; + u.dudes[3] = "Celestian"; + u.dudes_num[3] = 40; + u.dudes[4] = "Retributor"; + u.dudes_num[4] = 50; + u.dudes[5] = "Priest"; + u.dudes_num[5] = 60; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Seraphim"; + u.dudes_num[1] = 50; + u.dudes[2] = "Dominion"; + u.dudes_num[2] = 50; + u.dudes[3] = "Immolator"; + u.dudes_num[3] = 4; + u.dudes[4] = "Exorcist"; + u.dudes_num[4] = 2; + instance_deactivate_object(u); + + u = instance_nearest(xxx, 240, obj_enunit); + u.dudes[1] = "Follower"; + u.dudes_num[1] = 450; + u.dudes[2] = "Sister Repentia"; + u.dudes_num[2] = 50; + u.dudes[3] = "Arco-Flagellent"; + u.dudes_num[3] = 30; + u.dudes[4] = "Penitent Engine"; + u.dudes_num[4] = 4; + } + // Small Sister Army + if (threat == 4) { + u = instance_nearest(xxx + 30, 240, obj_enunit); + enemy_dudes = "4000"; + + u.dudes[1] = "Palatine"; + u.dudes_num[1] = 2; + // Spawn Leader + if (leader == 1) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + enemies_num[1] = 1; + } + u.dudes[2] = "Battle Sister"; + u.dudes_num[2] = 1000; + u.dudes[3] = "Celestian"; + u.dudes_num[3] = 150; + u.dudes[4] = "Retributor"; + u.dudes_num[4] = 150; + u.dudes[5] = "Priest"; + u.dudes_num[5] = 150; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Seraphim"; + u.dudes_num[1] = 200; + u.dudes[2] = "Dominion"; + u.dudes_num[2] = 200; + u.dudes[3] = "Immolator"; + u.dudes_num[3] = 15; + u.dudes[4] = "Exorcist"; + u.dudes_num[4] = 6; + u.dudes[5] = "Follower"; + u.dudes_num[5] = 600; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Follower"; + u.dudes_num[1] = 1500; + u.dudes[2] = "Sister Repentia"; + u.dudes_num[2] = 100; + u.dudes[3] = "Arco-Flagellent"; + u.dudes_num[3] = 30; + u.dudes[4] = "Penitent Engine"; + u.dudes_num[4] = 4; + u.dudes[5] = "Mistress"; + u.dudes_num[5] = 10; + } + // Medium Sister Army + if (threat == 5) { + u = instance_nearest(xxx + 40, 240, obj_enunit); + enemy_dudes = "8000"; + + u.dudes[1] = "Palatine"; + u.dudes_num[1] = 2; + // Spawn Leader + if (leader == 1) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + enemies_num[1] = 1; + } + u.dudes[2] = "Battle Sister"; + u.dudes_num[2] = 1000; + u.dudes[3] = "Celestian"; + u.dudes_num[3] = 150; + u.dudes[4] = "Retributor"; + u.dudes_num[4] = 200; + u.dudes[5] = "Priest"; + u.dudes_num[5] = 200; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Battle Sister"; + u.dudes_num[1] = 1000; + u.dudes[2] = "Celestian"; + u.dudes_num[2] = 150; + u.dudes[3] = "Retributor"; + u.dudes_num[3] = 200; + u.dudes[4] = "Priest"; + u.dudes_num[4] = 200; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Seraphim"; + u.dudes_num[1] = 200; + u.dudes[2] = "Dominion"; + u.dudes_num[2] = 200; + u.dudes[3] = "Immolator"; + u.dudes_num[3] = 25; + u.dudes[4] = "Exorcist"; + u.dudes_num[4] = 10; + u.dudes[5] = "Follower"; + u.dudes_num[5] = 2000; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Follower"; + u.dudes_num[1] = 2000; + u.dudes[2] = "Sister Repentia"; + u.dudes_num[2] = 300; + u.dudes[3] = "Arco-Flagellent"; + u.dudes_num[3] = 100; + u.dudes[4] = "Penitent Engine"; + u.dudes_num[4] = 15; + u.dudes[5] = "Mistress"; + u.dudes_num[5] = 30; + } + // Large Sister Army + if (threat == 6) { + u = instance_nearest(xxx + 50, 240, obj_enunit); + enemy_dudes = "12000"; + + u.dudes[1] = "Palatine"; + u.dudes_num[1] = 1; + // Spawn Leader + if (leader == 1) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + enemies_num[1] = 1; + } + u.dudes[2] = "Battle Sister"; + u.dudes_num[2] = 1500; + u.dudes[3] = "Celestian"; + u.dudes_num[3] = 150; + u.dudes[4] = "Retributor"; + u.dudes_num[4] = 200; + u.dudes[5] = "Priest"; + u.dudes_num[5] = 200; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 40, 240, obj_enunit); + u.dudes[1] = "Battle Sister"; + u.dudes_num[1] = 1500; + u.dudes[2] = "Celestian"; + u.dudes_num[2] = 150; + u.dudes[3] = "Retributor"; + u.dudes_num[3] = 200; + u.dudes[4] = "Priest"; + u.dudes_num[4] = 200; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Seraphim"; + u.dudes_num[1] = 200; + u.dudes[2] = "Dominion"; + u.dudes_num[2] = 200; + u.dudes[3] = "Immolator"; + u.dudes_num[3] = 50; + u.dudes[4] = "Exorcist"; + u.dudes_num[4] = 20; + u.dudes[5] = "Follower"; + u.dudes_num[5] = 2000; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Follower"; + u.dudes_num[1] = 2000; + u.dudes[2] = "Sister Repentia"; + u.dudes_num[2] = 500; + u.dudes[3] = "Arco-Flagellent"; + u.dudes_num[3] = 250; + u.dudes[4] = "Penitent Engine"; + u.dudes_num[4] = 30; + u.dudes[5] = "Mistress"; + u.dudes_num[5] = 50; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Follower"; + u.dudes_num[1] = 3000; + } + } + + // ** Orks Forces ** + if (enemy == 7) { + // u=instance_create(-10,240,obj_enunit); + // u.dudes[1]="Stormboy";u.dudes_num[1]=2500;u.flank=1;// enemies[1]=u.dudes[1]; + + // Small Ork Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "100"; + + u.dudes[1] = "Meganob"; + u.dudes_num[1] = 1; + enemies[1] = u.dudes[1]; + u.dudes[2] = "Slugga Boy"; + u.dudes_num[2] = 50; + enemies[2] = u.dudes[2]; + u.dudes[3] = "Shoota Boy"; + u.dudes_num[3] = 50; + enemies[3] = u.dudes[3]; + // Spawn Leader + if (leader == 1) { + u.dudes[4] = "Leader"; + u.dudes_num[4] = 1; + enemies[4] = 1; + enemies_num[4] = 1; + } + } + // Medium Ork Group + if (threat == 2) { + u = instance_nearest(xxx + 10, 240, obj_enunit); + enemy_dudes = "nearly 350"; + + u.dudes[1] = "Slugga Boy"; + u.dudes_num[1] = 50; + u.dudes[2] = "Shoota Boy"; + u.dudes_num[2] = 50; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Minor Warboss"; + u.dudes_num[1] = 1; + u.dudes[2] = "Meganob"; + u.dudes_num[2] = 5; + u.dudes[3] = "Slugga Boy"; + u.dudes_num[3] = 70; + u.dudes[4] = "Ard Boy"; + u.dudes_num[4] = 70; + u.dudes[5] = "Shoota Boy"; + u.dudes_num[5] = 100; + // Spawn Leader + if (leader == 1) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + enemies_num[1] = 1; + } + } + // Large Ork Group + if (threat == 3) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "over a 1000"; + + u.dudes[1] = "Slugga Boy"; + u.dudes_num[1] = 300; + u.dudes[2] = "Ard Boy"; + u.dudes_num[2] = 150; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Deff Dread"; + u.dudes_num[1] = 9; + u.dudes[2] = "Battlewagon"; + u.dudes_num[2] = 6; + u.dudes[3] = "Mekboy"; + u.dudes_num[3] = 1; + u.dudes[4] = "Flash Git"; + u.dudes_num[4] = 12; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Warboss"; + u.dudes_num[1] = 1; + // Spawn Leader + if (leader == 1) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + enemies_num[1] = 1; + } + u.dudes[2] = "Meganob"; + u.dudes_num[2] = 10; + u.dudes[3] = "Slugga Boy"; + u.dudes_num[3] = 100; + u.dudes[4] = "Ard Boy"; + u.dudes_num[4] = 150; + u.dudes[5] = "Shoota Boy"; + u.dudes_num[5] = 350; + } + // Small Ork Army + if (threat == 4) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "a green tide of over 3600"; + + u.dudes[1] = "Slugga Boy"; + u.dudes_num[1] = 600; + u.dudes[2] = "Ard Boy"; + u.dudes_num[2] = 300; + u.dudes[3] = "Gretchin"; + u.dudes_num[3] = 1000; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Deff Dread"; + u.dudes_num[1] = 21; + u.dudes[2] = "Battlewagon"; + u.dudes_num[2] = 12; + u.dudes[3] = "Mekboy"; + u.dudes_num[3] = 3; + u.dudes[4] = "Flash Git"; + u.dudes_num[4] = 30; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Warboss"; + u.dudes_num[1] = 1; + // Spawn Leader + if (leader == 1) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + enemies_num[1] = 1; + } + u.dudes[2] = "Meganob"; + u.dudes_num[2] = 30; + u.dudes[3] = "Slugga Boy"; + u.dudes_num[3] = 300; + u.dudes[4] = "Ard Boy"; + u.dudes_num[4] = 450; + u.dudes[5] = "Shoota Boy"; + u.dudes_num[5] = 1000; + } + // Medium Ork Army + if (threat == 5) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "a green tide of over 7000"; + + u.dudes[1] = "Slugga Boy"; + u.dudes_num[1] = 1200; + u.dudes[2] = "Ard Boy"; + u.dudes_num[2] = 600; + u.dudes[3] = "Gretchin"; + u.dudes_num[3] = 2000; + u.dudes[4] = "Tank Busta"; + u.dudes_num[4] = 100; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Deff Dread"; + u.dudes_num[1] = 40; + u.dudes[2] = "Battlewagon"; + u.dudes_num[2] = 18; + u.dudes[3] = "Mekboy"; + u.dudes_num[3] = 6; + u.dudes[4] = "Flash Git"; + u.dudes_num[4] = 50; + u.dudes[5] = "Kommando"; + u.dudes_num[5] = 20; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Warboss"; + u.dudes_num[1] = 1; + // Spawn Leader + if (leader == 1) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + enemies_num[1] = 1; + } + u.dudes[2] = "Meganob"; + u.dudes_num[2] = 80; + u.dudes[3] = "Slugga Boy"; + u.dudes_num[3] = 600; + u.dudes[4] = "Ard Boy"; + u.dudes_num[4] = 900; + u.dudes[5] = "Shoota Boy"; + u.dudes_num[5] = 2000; + } + // Large Ork Army + if (threat == 6) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "a WAAAAGH!! of 11000"; + + u.dudes[1] = "Slugga Boy"; + u.dudes_num[1] = 1200; + u.dudes[2] = "Ard Boy"; + u.dudes_num[2] = 600; + u.dudes[3] = "Gretchin"; + u.dudes_num[3] = 2000; + u.dudes[4] = "Tank Busta"; + u.dudes_num[4] = 100; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Deff Dread"; + u.dudes_num[1] = 40; + u.dudes[2] = "Battlewagon"; + u.dudes_num[2] = 18; + u.dudes[3] = "Mekboy"; + u.dudes_num[3] = 6; + u.dudes[4] = "Flash Git"; + u.dudes_num[4] = 50; + u.dudes[5] = "Kommando"; + u.dudes_num[5] = 20; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Slugga Boy"; + u.dudes_num[1] = 1200; + u.dudes[2] = "Ard Boy"; + u.dudes_num[2] = 600; + u.dudes[3] = "Gretchin"; + u.dudes_num[3] = 2000; + u.dudes[4] = "Tank Busta"; + u.dudes_num[4] = 100; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Deff Dread"; + u.dudes_num[1] = 40; + u.dudes[2] = "Battlewagon"; + u.dudes_num[2] = 18; + u.dudes[3] = "Mekboy"; + u.dudes_num[3] = 6; + u.dudes[4] = "Flash Git"; + u.dudes_num[4] = 50; + u.dudes[5] = "Kommando"; + u.dudes_num[5] = 20; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 40, 240, obj_enunit); + u.dudes[1] = "Big Warboss"; + u.dudes_num[1] = 1; + // Spawn Leader + if (leader == 1) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + enemies[1] = 1; + enemies_num[1] = 1; + } + u.dudes[2] = "Meganob"; + u.dudes_num[2] = 80; + u.dudes[3] = "Slugga Boy"; + u.dudes_num[3] = 600; + u.dudes[4] = "Ard Boy"; + u.dudes_num[4] = 900; + u.dudes[5] = "Shoota Boy"; + u.dudes_num[5] = 2000; + } + } + + // ** Tau Forces ** + if (enemy == 8) { + // Small Tau Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "11"; + + u.dudes[1] = "XV8 Crisis"; + u.dudes_num[1] = 1; + u.dudes[2] = "Fire Warrior"; + u.dudes_num[2] = 20; + u.dudes[3] = "Kroot"; + u.dudes_num[3] = 20; + enemies[3] = u.dudes[3]; + } + // Medium Tau Group + if (threat == 2) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "100"; + + u.dudes[1] = "XV8 Commander"; + u.dudes_num[1] = 1; + u.dudes[2] = "XV8 Bodyguard"; + u.dudes_num[2] = 6; + u.dudes[3] = "Shield Drone"; + u.dudes_num[3] = 4; + u.dudes[4] = "XV88 Broadside"; + u.dudes_num[4] = 3; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Fire Warrior"; + u.dudes_num[1] = 60; + u.dudes[2] = "Kroot"; + u.dudes_num[2] = 60; + u.dudes[3] = "Pathfinder"; + u.dudes_num[3] = 20; + u.dudes[4] = "XV8 Crisis"; + u.dudes_num[4] = 12; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Hammerhead"; + u.dudes_num[1] = 2; + u.dudes[2] = "Devilfish"; + u.dudes_num[2] = 4; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "XV25 Stealthsuit"; + u.dudes_num[1] = 6; + u.flank = 1; + } + // Large Tau Group + if (threat == 3) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "100"; + + u.dudes[1] = "XV8 Commander"; + u.dudes_num[1] = 1; + u.dudes[2] = "XV8 Bodyguard"; + u.dudes_num[2] = 9; + u.dudes[3] = "Shield Drone"; + u.dudes_num[3] = 8; + u.dudes[4] = "XV88 Broadside"; + u.dudes_num[4] = 6; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Fire Warrior"; + u.dudes_num[1] = 200; + u.dudes[2] = "Kroot"; + u.dudes_num[2] = 150; + u.dudes[3] = "Pathfinder"; + u.dudes_num[3] = 40; + u.dudes[4] = "XV8 Crisis"; + u.dudes_num[4] = 24; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Hammerhead"; + u.dudes_num[1] = 5; + u.dudes[2] = "Devilfish"; + u.dudes_num[2] = 10; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "XV25 Stealthsuit"; + u.dudes_num[1] = 12; + u.flank = 1; + } + // Small Tau Army + if (threat == 4) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "100"; + + u.dudes[1] = "XV8 Commander"; + u.dudes_num[1] = 1; + u.dudes[2] = "XV8 Bodyguard"; + u.dudes_num[2] = 9; + u.dudes[3] = "Shield Drone"; + u.dudes_num[3] = 8; + u.dudes[4] = "XV88 Broadside"; + u.dudes_num[4] = 12; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Fire Warrior"; + u.dudes_num[1] = 800; + u.dudes[2] = "Kroot"; + u.dudes_num[2] = 500; + u.dudes[3] = "Pathfinder"; + u.dudes_num[3] = 60; + u.dudes[4] = "XV8 Crisis"; + u.dudes_num[4] = 48; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Hammerhead"; + u.dudes_num[1] = 40; + u.dudes[2] = "Devilfish"; + u.dudes_num[2] = 15; + u.dudes[3] = "XV8 Crisis"; + u.dudes_num[3] = 48; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "XV25 Stealthsuit"; + u.dudes_num[1] = 12; + u.flank = 1; + u.dudes[2] = "XV8 (Brightknife)"; + u.dudes_num[2] = 6; + u.flank = 1; + } + // Medium Tau Army + if (threat == 5) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "4000"; + + u.dudes[1] = "XV8 Commander"; + u.dudes_num[1] = 2; + u.dudes[2] = "XV8 Bodyguard"; + u.dudes_num[2] = 18; + u.dudes[3] = "Shield Drone"; + u.dudes_num[3] = 20; + u.dudes[4] = "XV88 Broadside"; + u.dudes_num[4] = 24; + u.dudes[5] = "Vespid"; + u.dudes_num[4] = 30; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Fire Warrior"; + u.dudes_num[1] = 1000; + u.dudes[2] = "Kroot"; + u.dudes_num[2] = 700; + u.dudes[3] = "Pathfinder"; + u.dudes_num[3] = 100; + u.dudes[4] = "XV8 Crisis"; + u.dudes_num[4] = 80; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Fire Warrior"; + u.dudes_num[1] = 1000; + u.dudes[2] = "Kroot"; + u.dudes_num[2] = 700; + u.dudes[3] = "Pathfinder"; + u.dudes_num[3] = 100; + u.dudes[4] = "XV8 Crisis"; + u.dudes_num[4] = 80; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Hammerhead"; + u.dudes_num[1] = 40; + u.dudes[2] = "Devilfish"; + u.dudes_num[2] = 40; + u.dudes[3] = "XV8 Crisis"; + u.dudes_num[3] = 48; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "XV25 Stealthsuit"; + u.dudes_num[1] = 12; + u.flank = 1; + u.dudes[2] = "XV8 (Brightknife)"; + u.dudes_num[2] = 18; + u.flank = 1; + } + // Large Tau Army + if (threat == 6) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "6000"; + + u.dudes[1] = "XV8 Commander"; + u.dudes_num[1] = 2; + u.dudes[2] = "XV8 Bodyguard"; + u.dudes_num[2] = 18; + u.dudes[3] = "Shield Drone"; + u.dudes_num[3] = 20; + u.dudes[4] = "XV88 Broadside"; + u.dudes_num[4] = 36; + u.dudes[5] = "Vespid"; + u.dudes_num[4] = 60; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Fire Warrior"; + u.dudes_num[1] = 1000; + u.dudes[2] = "Kroot"; + u.dudes_num[2] = 700; + u.dudes[3] = "Pathfinder"; + u.dudes_num[3] = 100; + u.dudes[4] = "XV8 Crisis"; + u.dudes_num[4] = 80; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Fire Warrior"; + u.dudes_num[1] = 1000; + u.dudes[2] = "Kroot"; + u.dudes_num[2] = 700; + u.dudes[3] = "Pathfinder"; + u.dudes_num[3] = 100; + u.dudes[4] = "XV8 Crisis"; + u.dudes_num[4] = 80; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Fire Warrior"; + u.dudes_num[1] = 1000; + u.dudes[2] = "Kroot"; + u.dudes_num[2] = 700; + u.dudes[3] = "Pathfinder"; + u.dudes_num[3] = 100; + u.dudes[4] = "XV8 Crisis"; + u.dudes_num[4] = 80; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 40, 240, obj_enunit); + u.dudes[1] = "Hammerhead"; + u.dudes_num[1] = 40; + u.dudes[2] = "Devilfish"; + u.dudes_num[2] = 80; + u.dudes[3] = "XV8 Crisis"; + u.dudes_num[3] = 80; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "XV25 Stealthsuit"; + u.dudes_num[1] = 12; + u.flank = 1; + u.dudes[2] = "XV8 (Brightknife)"; + u.dudes_num[2] = 24; + u.flank = 1; + } + } + + // ** Tyranid Forces ** + // Tyranid story event + if ((enemy == 9) && (battle_special == "tyranid_org")) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "81"; + u.dudes[1] = "Termagaunt"; + u.dudes_num[1] = 40; + u.dudes[2] = "Hormagaunt"; + u.dudes_num[2] = 40; + // u.dudes[3]="Lictor";u.dudes_num[3]=1; + } + if ((enemy == 9) && (battle_special != "tyranid_org")) { + // Small Genestealer Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "11"; + + u.dudes[1] = "Genestealer"; + u.dudes_num[1] = 10; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Lictor"; + u.dudes_num[1] = 1; + u.flank = 1; + } + // Medium Genestealer Group + if (threat == 2) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "100"; + + u.dudes[1] = "Genestealer Patriarch"; + u.dudes_num[1] = 1; + u.dudes[2] = "Genestealer"; + u.dudes_num[2] = 30; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 150; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Lictor"; + u.dudes_num[1] = 1; + u.flank = 1; + } + // Large Genestealer Group + if (threat == 3) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "100"; + + u.dudes[1] = "Genestealer Patriarch"; + u.dudes_num[1] = 1; + u.dudes[2] = "Genestealer"; + u.dudes_num[2] = 120; + u.dudes[3] = "Armoured Limousine"; + u.dudes_num[3] = 20; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 600; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Lictor"; + u.dudes_num[1] = 6; + u.flank = 1; + } + // Small Tyranid Army + if (threat == 4) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "7000"; + + u.dudes[1] = "Hive Tyrant"; + u.dudes_num[1] = 1; + u.dudes[2] = "Tyrant Guard"; + u.dudes_num[2] = 16; + u.dudes[3] = "Tyranid Warrior"; + u.dudes_num[3] = 40; + u.dudes[4] = "Zoanthrope"; + u.dudes_num[4] = 10; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Termagaunt"; + u.dudes_num[1] = 1500; + u.dudes[2] = "Hormagaunt"; + u.dudes_num[2] = 800; + u.dudes[3] = "Carnifex"; + u.dudes_num[3] = 5; + u.dudes[4] = "Tyranid Warrior"; + u.dudes_num[4] = 30; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Termagaunt"; + u.dudes_num[1] = 1500; + u.dudes[2] = "Hormagaunt"; + u.dudes_num[2] = 800; + u.dudes[3] = "Carnifex"; + u.dudes_num[3] = 5; + u.dudes[4] = "Tyranid Warrior"; + u.dudes_num[4] = 30; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Termagaunt"; + u.dudes_num[1] = 1500; + u.dudes[2] = "Hormagaunt"; + u.dudes_num[2] = 800; + u.dudes[3] = "Carnifex"; + u.dudes_num[3] = 5; + u.dudes[4] = "Tyranid Warrior"; + u.dudes_num[4] = 30; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 40, 240, obj_enunit); + u.dudes[1] = "Carnifex"; + u.dudes_num[1] = 6; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Lictor"; + u.dudes_num[1] = 15; + u.flank = 1; + } + // Medium Tyranid Army + if (threat == 5) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "15000"; + + u.dudes[1] = "Hive Tyrant"; + u.dudes_num[1] = 2; + u.dudes[2] = "Tyrant Guard"; + u.dudes_num[2] = 32; + u.dudes[3] = "Tyranid Warrior"; + u.dudes_num[3] = 80; + u.dudes[4] = "Zoanthrope"; + u.dudes_num[4] = 20; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Termagaunt"; + u.dudes_num[1] = 3300; + u.dudes[2] = "Hormagaunt"; + u.dudes_num[2] = 1600; + u.dudes[3] = "Carnifex"; + u.dudes_num[3] = 10; + u.dudes[4] = "Tyranid Warrior"; + u.dudes_num[4] = 30; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Termagaunt"; + u.dudes_num[1] = 3300; + u.dudes[2] = "Hormagaunt"; + u.dudes_num[2] = 1600; + u.dudes[3] = "Carnifex"; + u.dudes_num[3] = 10; + u.dudes[4] = "Tyranid Warrior"; + u.dudes_num[4] = 30; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Termagaunt"; + u.dudes_num[1] = 3300; + u.dudes[2] = "Hormagaunt"; + u.dudes_num[2] = 1600; + u.dudes[3] = "Carnifex"; + u.dudes_num[3] = 10; + u.dudes[4] = "Tyranid Warrior"; + u.dudes_num[4] = 60; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 40, 240, obj_enunit); + u.dudes[1] = "Carnifex"; + u.dudes_num[1] = 20; + u.dudes[2] = "Zoanthrope"; + u.dudes_num[2] = 10; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Lictor"; + u.dudes_num[1] = 20; + u.flank = 1; + } + // Large Tyranid Army + if (threat == 6) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "45000"; + + u.dudes[1] = "Hive Tyrant"; + u.dudes_num[1] = 4; + u.dudes[2] = "Tyrant Guard"; + u.dudes_num[2] = 64; + u.dudes[3] = "Tyranid Warrior"; + u.dudes_num[3] = 160; + u.dudes[4] = "Zoanthrope"; + u.dudes_num[4] = 40; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Termagaunt"; + u.dudes_num[1] = 10000; + u.dudes[2] = "Hormagaunt"; + u.dudes_num[2] = 4000; + u.dudes[3] = "Carnifex"; + u.dudes_num[3] = 15; + u.dudes[4] = "Tyranid Warrior"; + u.dudes_num[4] = 90; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Termagaunt"; + u.dudes_num[1] = 10000; + u.dudes[2] = "Hormagaunt"; + u.dudes_num[2] = 4000; + u.dudes[3] = "Carnifex"; + u.dudes_num[3] = 15; + u.dudes[4] = "Tyranid Warrior"; + u.dudes_num[4] = 90; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Termagaunt"; + u.dudes_num[1] = 10000; + u.dudes[2] = "Hormagaunt"; + u.dudes_num[2] = 4000; + u.dudes[3] = "Carnifex"; + u.dudes_num[3] = 15; + u.dudes[4] = "Tyranid Warrior"; + u.dudes_num[4] = 90; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 40, 240, obj_enunit); + u.dudes[1] = "Carnifex"; + u.dudes_num[1] = 40; + u.dudes[2] = "Zoanthrope"; + u.dudes_num[2] = 20; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Lictor"; + u.dudes_num[1] = 40; + u.flank = 1; + } + } + + // ** Chaos Forces ** + if ((enemy == 10) && (battle_special != "ship_demon") && (battle_special != "fallen1") && (battle_special != "fallen2") && (battle_special != "WL10_reveal") && (battle_special != "WL10_later") && (string_count("cs_meeting_battle", battle_special) == 0)) { + // u=instance_create(-10,240,obj_enunit); + // u.dudes[1]="Stormboy";u.dudes_num[1]=2500;u.flank=1;// enemies[1]=u.dudes[1]; + // Small Chaos Cult Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "150"; + + u.dudes[1] = "Arch Heretic"; + u.dudes_num[1] = 1; + enemies[1] = u.dudes[1]; + u.dudes[2] = "Cultist Elite"; + u.dudes_num[2] = 30; + enemies[2] = u.dudes[2]; + u.dudes[3] = "Cultist"; + u.dudes_num[3] = 120; + enemies[3] = u.dudes[3]; + } + // Medium Chaos Cult Group + if (threat == 2) { + u = instance_nearest(xxx + 10, 240, obj_enunit); + enemy_dudes = "nearly 400"; + + u.dudes[1] = "Arch Heretic"; + u.dudes_num[1] = 1; + u.dudes[2] = "Cultist Elite"; + u.dudes_num[2] = 50; + u.dudes[3] = "Cultist"; + u.dudes_num[3] = 300; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 50; + u.dudes[2] = "Technical"; + u.dudes_num[2] = 6; + } + // Large Chaos Cult Group + if (threat == 3) { + u = instance_nearest(xxx + 20, 240, obj_enunit); + enemy_dudes = "1000"; + + u.dudes[1] = "Arch Heretic"; + u.dudes_num[1] = 1; + u.dudes[2] = "Cultist Elite"; + u.dudes_num[2] = 100; + u.dudes[3] = "Mutants"; + u.dudes_num[3] = 200; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Technical"; + u.dudes_num[1] = 9; + u.dudes[2] = "Chaos Leman Russ"; + u.dudes_num[2] = 6; + u.dudes[3] = "Cultist"; + u.dudes_num[3] = 200; + instance_deactivate_object(u); + + u = instance_nearest(xxx, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 200; + u.dudes[2] = "Mutant"; + u.dudes_num[2] = 300; + } + // Small Chaos Cult Army + if (threat == 4) { + u = instance_nearest(xxx + 20, 240, obj_enunit); + enemy_dudes = "4000"; + + u.dudes[1] = "Arch Heretic"; + u.dudes_num[1] = 1; + u.dudes[2] = "Cultist Elite"; + u.dudes_num[2] = 400; + u.dudes[3] = "Chaos Basilisk"; + u.dudes_num[3] = 6; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Mutant"; + u.dudes_num[1] = 1500; + u.dudes[2] = "Chaos Leman Russ"; + u.dudes_num[2] = 21; + u.dudes[3] = "Defiler"; + u.dudes_num[3] = 5; + instance_deactivate_object(u); + + u = instance_nearest(xxx, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 600; + u.dudes[2] = "Mutant"; + u.dudes_num[2] = 1500; + } + // Medium Chaos Cult Army + if (threat == 5) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "8000"; + + u.dudes[1] = "Daemonhost"; + u.dudes_num[1] = 1; + u.dudes[2] = "Chaos Terminator"; + u.dudes_num[2] = 10; + u.dudes[3] = "Cultist Elite"; + u.dudes_num[3] = 400; + u.dudes[4] = "Chaos Basilisk"; + u.dudes_num[4] = 9; + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Chaos Leman Russ"; + u.dudes_num[1] = 40; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 12; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Mutant"; + u.dudes_num[1] = 2000; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 1000; + u.dudes[2] = "Mutant"; + u.dudes_num[2] = 2000; + instance_deactivate_object(u); + + u = instance_nearest(xxx, 40, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 1000; + u.dudes[2] = "Mutant"; + u.dudes_num[2] = 2000; + instance_deactivate_object(u); + } + // Large Chaos Cult Army + if (threat == 6) { + u = instance_nearest(xxx + 40, 240, obj_enunit); + enemy_dudes = "12000"; + + u.dudes[1] = "Greater Daemon of " + string(choose("Slaanesh", "Khorne", "Nurgle", "Tzeentch,", "Tzeentch")); + u.dudes_num[1] = 2; + u.dudes[2] = "Chaos Terminator"; + u.dudes_num[2] = 20; + u.dudes[3] = "Chaos Basilisk"; + u.dudes_num[3] = 18; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Chaos Leman Russ"; + u.dudes_num[1] = 80; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 20; + u.dudes[3] = "Vindicator"; + u.dudes_num[3] = 10; + instance_deactivate_object(u); + + u = instance_nearest(xxx, 240, obj_enunit); + u.dudes[1] = "Mutant"; + u.dudes_num[1] = 8000; + u.dudes[2] = "Cultist Elite"; + u.dudes_num[2] = 4000; + u.dudes[3] = "Havoc"; + u.dudes_num[3] = 50; + u.dudes[4] = "Chaos Space Marine"; + u.dudes_num[4] = 50; + instance_deactivate_object(u); + } + // Chaos Daemons Army + if (threat == 7) { + u = instance_nearest(xxx + 40, 240, obj_enunit); + u.neww = 1; + enemy_dudes = ""; + + u.dudes[1] = "Greater Daemon of Slaanesh"; + u.dudes_num[1] = 1; + u.dudes[2] = "Greater Daemon of Slaanesh"; + u.dudes_num[2] = 1; + // u.dudes[3]="Greater Daemon of Slaanesh";u.dudes_num[3]=1; + u.dudes[4] = "Greater Daemon of Tzeentch"; + u.dudes_num[4] = 1; + u.dudes[5] = "Greater Daemon of Tzeentch"; + u.dudes_num[5] = 1; + // u.dudes[6]="Greater Daemon of Tzeentch";u.dudes_num[6]=1; + u.dudes[7] = "Soul Grinder"; + u.dudes_num[7] = 3; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.neww = 1; + u.dudes[1] = "Greater Daemon of Khorne"; + u.dudes_num[1] = 1; + u.dudes[2] = "Greater Daemon of Khorne"; + u.dudes_num[2] = 1; + // u.dudes[3]="Greater Daemon of Khorne";u.dudes_num[3]=1; + u.dudes[4] = "Greater Daemon of Nurgle"; + u.dudes_num[4] = 1; + u.dudes[5] = "Greater Daemon of Nurgle"; + u.dudes_num[5] = 1; + // u.dudes[6]="Greater Daemon of Nurgle";u.dudes_num[6]=1; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Bloodletter"; + u.dudes_num[1] = 800; + u.dudes[2] = "Daemonette"; + u.dudes_num[2] = 800; + u.dudes[3] = "Plaguebearer"; + u.dudes_num[3] = 800; + u.dudes[4] = "Pink Horror"; + u.dudes_num[4] = 800; + u.dudes[5] = "Maulerfiend"; + u.dudes_num[5] = 3; + instance_deactivate_object(u); + + // u=instance_nearest(xxx+10,240,obj_enunit); + // u.dudes[1]="Mutant";u.dudes_num[1]=6000; + // instance_deactivate_object(u); + } + } + + // ** Chaos Space Marines Forces ** + if ((enemy == 11) && (battle_special != "ChaosWarband") && (string_count("cs_meeting_battle", battle_special) == 0)) { + // Small CSM Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "5"; + + u.dudes[1] = "Chaos Space Marine"; + u.dudes_num[1] = 5; + enemies[1] = u.dudes[1]; + u.dudes[2] = "Cultist"; + u.dudes_num[2] = 30; + enemies[2] = u.dudes[2]; + } + // Medium CSM Group + if (threat == 2) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "41"; + + u.dudes[1] = "Chaos Chosen"; + u.dudes_num[1] = 1; + u.dudes[2] = "Chaos Space Marine"; + u.dudes_num[2] = 35; + u.dudes[3] = "Havoc"; + u.dudes_num[3] = 5; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 100; + u.dudes[2] = "Rhino"; + u.dudes_num[2] = 2; + u.dudes[3] = "Predator"; + u.dudes_num[3] = 4; + } + // Large CSM Group + if (threat == 3) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "over 100"; + + u.dudes[1] = "Chaos Lord"; + u.dudes_num[1] = 1; + u.dudes[2] = "Chaos Sorcerer"; + u.dudes_num[2] = 1; + u.dudes[3] = "Chaos Chosen"; + u.dudes_num[3] = 10; + u.dudes[4] = "Chaos Space Marine"; + u.dudes_num[4] = 100; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Rhino"; + u.dudes_num[1] = 6; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 2; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 300; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 3; + u.dudes[3] = "Predator"; + u.dudes_num[3] = 6; + u.dudes[4] = "Land Raider"; + u.dudes_num[4] = 2; + } + // Small CSM Army + if (threat == 4) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "over 700"; + + u.dudes[1] = "Chaos Lord"; + u.dudes_num[1] = 1; + u.dudes[2] = "Chaos Sorcerer"; + u.dudes_num[2] = 2; + u.dudes[3] = "Chaos Chosen"; + u.dudes_num[3] = 10; + // u.dudes[4]="Chaos Terminator";u.dudes_num[4]=5; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Chaos Space Marine"; + u.dudes_num[1] = 250; + u.dudes[2] = "Havoc"; + u.dudes_num[2] = 20; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Rhino"; + u.dudes_num[1] = 15; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 4; + u.dudes[3] = "Heldrake"; + u.dudes_num[3] = 1; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 600; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 3; + u.dudes[3] = "Predator"; + u.dudes_num[3] = 6; + u.dudes[4] = "Vindicator"; + u.dudes_num[4] = 3; + u.dudes[5] = "Land Raider"; + u.dudes_num[5] = 2; + } + // Medium CSM Army + if (threat == 5) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "over 1200"; + + u.dudes[1] = "Chaos Lord"; + u.dudes_num[1] = 1; + u.dudes[2] = "Chaos Sorcerer"; + u.dudes_num[2] = 3; + u.dudes[3] = "Chaos Chosen"; + u.dudes_num[3] = 20; + u.dudes[4] = "Obliterator"; + u.dudes_num[4] = 6; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Chaos Space Marine"; + u.dudes_num[1] = 600; + u.dudes[2] = "Havoc"; + u.dudes_num[2] = 40; + u.dudes[3] = "Raptor"; + u.dudes_num[3] = 40; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Rhino"; + u.dudes_num[1] = 25; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 8; + u.dudes[3] = "Heldrake"; + u.dudes_num[3] = 3; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 600; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 5; + u.dudes[3] = "Predator"; + u.dudes_num[3] = 10; + u.dudes[4] = "Vindicator"; + u.dudes_num[4] = 6; + u.dudes[5] = "Land Raider"; + u.dudes_num[5] = 3; + u.dudes[6] = "Possessed"; + u.dudes_num[6] = 30; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Chaos Terminator"; + u.dudes_num[1] = 10; + u.flank = 1; + } + // Large CSM Army + if (threat == 6) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "2000"; + + u.dudes[1] = "Chaos Lord"; + u.dudes_num[1] = 2; + u.dudes[2] = "Chaos Sorcerer"; + u.dudes_num[2] = 10; + u.dudes[3] = "Chaos Chosen"; + u.dudes_num[3] = 40; + u.dudes[4] = "Obliterator"; + u.dudes_num[4] = 12; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Chaos Space Marine"; + u.dudes_num[1] = 800; + u.dudes[2] = "Havoc"; + u.dudes_num[2] = 50; + u.dudes[3] = "Raptor"; + u.dudes_num[3] = 50; + u.dudes[4] = choose("Noise Marine", "Plague Marine", "Khorne Berzerker", "Rubric Marine"); + u.dudes_num[3] = 50; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Rhino"; + u.dudes_num[1] = 30; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 10; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Cultist"; + u.dudes_num[1] = 1200; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 10; + u.dudes[3] = "Predator"; + u.dudes_num[3] = 20; + u.dudes[4] = "Vindicator"; + u.dudes_num[4] = 15; + u.dudes[5] = "Land Raider"; + u.dudes_num[5] = 6; + u.dudes[6] = "Possessed"; + u.dudes_num[6] = 60; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 40, 240, obj_enunit); + u.dudes[1] = "Heldrake"; + u.dudes_num[1] = 6; + u.flank = 1; + u.flyer = 1; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Chaos Terminator"; + u.dudes_num[1] = 20; + u.flank = 1; + } + } + + // ** World Eaters Forces ** + if ((enemy == 11) && (battle_special == "ChaosWarband")) { + // Small WE Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "20"; + + u.dudes[1] = "Khorne Berzerker"; + u.dudes_num[1] = 15; + enemies[1] = u.dudes[1]; + // Spawn Leader + if (obj_controller.faction_defeated[10] == 0) { + u.dudes[2] = "Leader"; + u.dudes_num[2] = 1; + } + u.dudes[3] = "World Eaters Veteran"; + u.dudes_num[3] = 5; + } + // Medium WE Group + if (threat == 2) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "135"; + + u.dudes[1] = "Chaos Chosen"; + u.dudes_num[1] = 1; + // Spawn Leader + if (obj_controller.faction_defeated[10] == 0) { + u.dudes[1] = "Leader"; + } + u.dudes[2] = "Khorne Berzerker"; + u.dudes_num[2] = 35; + u.dudes[3] = "World Eaters Veteran"; + u.dudes_num[3] = 5; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "World Eater"; + u.dudes_num[1] = 100; + u.dudes[2] = "Rhino"; + u.dudes_num[2] = 2; + u.dudes[3] = "Vindicator"; + u.dudes_num[3] = 4; + } + // Large WE Group + if (threat == 3) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "over 200"; + + u.dudes[1] = "Chaos Chosen"; + u.dudes_num[1] = 1; + // Spawn Leader + if (obj_controller.faction_defeated[10] == 0) { + u.dudes[1] = "Leader"; + } + u.dudes[2] = "Greater Daemon of Khorne"; + u.dudes_num[2] = 1; + u.dudes[3] = "World Eater Terminator"; + u.dudes_num[3] = 10; + u.dudes[4] = "World Eater"; + u.dudes_num[4] = 100; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Rhino"; + u.dudes_num[1] = 6; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 2; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Khorne Berzerker"; + u.dudes_num[1] = 100; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 5; + u.dudes[3] = "Vindicator"; + u.dudes_num[3] = 6; + u.dudes[4] = "Land Raider"; + u.dudes_num[4] = 4; + } + // Small WE Army + if (threat == 4) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "over 300"; + + u.dudes[1] = "Chaos Chosen"; + u.dudes_num[1] = 1; + // Spawn Leader + if (obj_controller.faction_defeated[10] == 0) { + u.dudes[1] = "Leader"; + } + u.dudes[2] = "Greater Daemon of Khorne"; + u.dudes_num[2] = 2; + u.dudes[3] = "World Eater Terminator"; + u.dudes_num[3] = 10; + // u.dudes[4]="Chaos Terminator";u.dudes_num[4]=5; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "World Eaters Veteran"; + u.dudes_num[1] = 250; + u.dudes[2] = "Possessed"; + u.dudes_num[2] = 20; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Vindicator"; + u.dudes_num[1] = 15; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 4; + u.dudes[3] = "Heldrake"; + u.dudes_num[3] = 1; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Khorne Berzerker"; + u.dudes_num[1] = 300; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 3; + u.dudes[3] = "Predator"; + u.dudes_num[3] = 6; + u.dudes[4] = "Vindicator"; + u.dudes_num[4] = 3; + u.dudes[5] = "Land Raider"; + u.dudes_num[5] = 2; + } + // Medium WE Army + if (threat == 5) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "over 900"; + + u.dudes[1] = "Chaos Chosen"; + u.dudes_num[1] = 1; + // Spawn Leader + if (obj_controller.faction_defeated[10] == 0) { + u.dudes[1] = "Leader"; + } + u.dudes[2] = "Greater Daemon of Khorne"; + u.dudes_num[2] = 3; + u.dudes[3] = "World Eater Terminator"; + u.dudes_num[3] = 20; + u.dudes[4] = "Helbrute"; + u.dudes_num[4] = 6; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "World Eaters Veteran"; + u.dudes_num[1] = 600; + u.dudes[2] = "Possessed"; + u.dudes_num[2] = 40; + u.dudes[3] = "Possessed"; + u.dudes_num[3] = 40; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Vindicator"; + u.dudes_num[1] = 15; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 8; + u.dudes[3] = "Heldrake"; + u.dudes_num[3] = 3; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Khorne Berzerker"; + u.dudes_num[1] = 300; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 5; + u.dudes[3] = "Predator"; + u.dudes_num[3] = 10; + u.dudes[4] = "Vindicator"; + u.dudes_num[4] = 6; + u.dudes[5] = "Land Raider"; + u.dudes_num[5] = 3; + u.dudes[6] = "Possessed"; + u.dudes_num[6] = 30; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Chaos Terminator"; + u.dudes_num[1] = 10; + u.flank = 1; + } + // Large WE Army + if (threat >= 6) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "1300"; + + u.dudes[1] = "Chaos Lord"; + u.dudes_num[1] = 2; + // Spawn Leader + if (obj_controller.faction_defeated[10] == 0) { + u.dudes[1] = "Leader"; + u.dudes_num[1] = 1; + } + u.dudes[2] = "Greater Daemon of Khorne"; + u.dudes_num[2] = 5; + u.dudes[3] = "World Eaters Terminator"; + u.dudes_num[3] = 40; + u.dudes[4] = "Helbrute"; + u.dudes_num[4] = 10; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "World Eaters Veteran"; + u.dudes_num[1] = 800; + u.dudes[2] = "Possessed"; + u.dudes_num[2] = 50; + u.dudes[3] = "Possessed"; + u.dudes_num[3] = 50; + u.dudes[4] = "Khorne Berzerker"; + u.dudes_num[3] = 50; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Vindicator"; + u.dudes_num[1] = 20; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 10; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Khorne Berzerker"; + u.dudes_num[1] = 500; + u.dudes[2] = "Helbrute"; + u.dudes_num[2] = 10; + u.dudes[3] = "Predator"; + u.dudes_num[3] = 15; + u.dudes[4] = "Vindicator"; + u.dudes_num[4] = 20; + u.dudes[5] = "Land Raider"; + u.dudes_num[5] = 6; + u.dudes[6] = "Possessed"; + u.dudes_num[6] = 60; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 40, 240, obj_enunit); + u.dudes[1] = "Heldrake"; + u.dudes_num[1] = 6; + u.flank = 1; + u.flyer = 1; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "World Eaters Terminator"; + u.dudes_num[1] = 20; + u.flank = 1; + } + } + + // ** Daemon Forces ** + if (enemy == 12) { + // If we want to have multiple story events regarding specific Chaos Gods, we could name slaa into gods and just check the value? TBD + var slaa = false; + if (battle_special == "ruins_eldar") { + slaa = true; + } + // Small Daemon Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "5"; + + u.dudes[1] = choose("Bloodletter", "Daemonette", "Plaguebearer", "Pink Horror"); + if (slaa) { + u.dudes[1] = "Daemonette"; + } + u.dudes_num[1] = 5; + enemies[1] = u.dudes[1]; + u.dudes[2] = "Cultist Elite"; + u.dudes_num[2] = 30; + enemies[2] = u.dudes[2]; + } + // Medium Daemon Group + if (threat == 2) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "90"; + + u.dudes[1] = choose("Bloodletter", "Daemonette", "Plaguebearer", "Pink Horror"); + if (slaa) { + u.dudes[1] = "Daemonette"; + } + u.dudes_num[1] = 30; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = choose("Bloodletter", "Daemonette", "Plaguebearer", "Pink Horror"); + if (slaa) { + u.dudes[1] = "Daemonette"; + } + u.dudes_num[1] = 30; + u.dudes[2] = "Defiler"; + u.dudes_num[2] = 1; + } + // Large Daemon Group + if (threat == 3) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "240"; + + u.dudes[1] = "Greater Daemon of " + choose("Tzeentch", "Slaanesh", "Nurgle", "Khorne"); + if (slaa) { + u.dudes[1] = "Greater Daemon of Slaanesh"; + } + u.dudes_num[1] = 1; + u.dudes[2] = "Chaos Sorcerer"; + u.dudes_num[2] = 1; + u.dudes[3] = "Pink Horror"; + if (slaa) { + u.dudes[3] = "Daemonette"; + } + u.dudes_num[3] = 60; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Defiler"; + u.dudes_num[1] = 2; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + if (slaa) { + u.dudes[1] = "Daemonette"; + u.dudes_num[1] = 240; + } else { + u.dudes[1] = "Bloodletter"; + u.dudes_num[1] = 60; + u.dudes[2] = "Plaguebearer"; + u.dudes_num[2] = 60; + u.dudes[3] = "Daemonette"; + u.dudes_num[3] = 60; + u.dudes[4] = "Maulerfiend"; + u.dudes_num[4] = 2; + } + } + // Small Daemon Army + if (threat == 4) { + u = instance_nearest(xxx + 40, 240, obj_enunit); + enemy_dudes = "400"; + u.neww = 1; + + u.dudes[1] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch")); + if (slaa) { + u.dudes[1] = "Greater Daemon of Slaanesh"; + } + u.dudes_num[1] = 1; + u.dudes[2] = "Greater Daemon of " + string(choose("Nurgle", "Khorne")); + if (slaa) { + u.dudes[2] = "Greater Daemon of Slaanesh"; + } + u.dudes_num[2] = 1; + // u.dudes[6]="Greater Daemon of Tzeentch";u.dudes_num[6]=1; + u.dudes[3] = "Soul Grinder"; + u.dudes_num[3] = 1; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + if (slaa) { + u.dudes[1] = "Daemonette"; + u.dudes_num[1] = 400; + u.dudes[2] = "Maulerfiend"; + u.dudes_num[2] = 2; + } else { + u.dudes[1] = "Bloodletter"; + u.dudes_num[1] = 100; + u.dudes[2] = "Daemonette"; + u.dudes_num[2] = 100; + u.dudes[3] = "Plaguebearer"; + u.dudes_num[3] = 100; + u.dudes[4] = "Pink Horror"; + u.dudes_num[4] = 100; + u.dudes[5] = "Maulerfiend"; + u.dudes_num[5] = 2; + } + instance_deactivate_object(u); + } + // Medium Daemon Army + if (threat == 5) { + u = instance_nearest(xxx + 40, 240, obj_enunit); + enemy_dudes = "1000"; + u.neww = 1; + + u.dudes[1] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); + if (slaa) { + u.dudes[1] = "Greater Daemon of Slaanesh"; + } + u.dudes_num[1] = 1; + u.dudes[2] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); + if (slaa) { + u.dudes[2] = "Greater Daemon of Slaanesh"; + } + u.dudes_num[2] = 1; + u.dudes[3] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); + if (slaa) { + u.dudes[3] = "Greater Daemon of Slaanesh"; + } + u.dudes_num[3] = 1; + u.dudes[4] = "Soul Grinder"; + u.dudes_num[4] = 2; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + if (slaa) { + u.dudes[1] = "Daemonette"; + u.dudes_num[1] = 1000; + u.dudes[2] = "Maulerfiend"; + u.dudes_num[2] = 2; + } else { + u.dudes[1] = "Bloodletter"; + u.dudes_num[1] = 250; + u.dudes[2] = "Daemonette"; + u.dudes_num[2] = 250; + u.dudes[3] = "Plaguebearer"; + u.dudes_num[3] = 250; + u.dudes[4] = "Pink Horror"; + u.dudes_num[4] = 250; + u.dudes[5] = "Maulerfiend"; + u.dudes_num[5] = 2; + } + instance_deactivate_object(u); + } + // Large Daemon Army + if (threat == 6) { + u = instance_nearest(xxx + 40, 240, obj_enunit); + enemy_dudes = "2000"; + u.neww = 1; + + u.dudes[1] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); + if (slaa) { + u.dudes[1] = "Greater Daemon of Slaanesh"; + } + u.dudes_num[1] = 1; + u.dudes[2] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); + if (slaa) { + u.dudes[2] = "Greater Daemon of Slaanesh"; + } + u.dudes_num[2] = 1; + u.dudes[3] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); + if (slaa) { + u.dudes[3] = "Greater Daemon of Slaanesh"; + } + u.dudes_num[3] = 1; + u.dudes[4] = "Soul Grinder"; + u.dudes_num[4] = 1; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.neww = 1; + u.dudes[1] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); + if (slaa) { + u.dudes[1] = "Greater Daemon of Slaanesh"; + } + u.dudes_num[1] = 1; + u.dudes[2] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); + if (slaa) { + u.dudes[2] = "Greater Daemon of Slaanesh"; + } + u.dudes_num[2] = 1; + u.dudes[3] = "Soul Grinder"; + u.dudes_num[3] = 1; + instance_deactivate_object(u); + + u = instance_nearest(xxx + 20, 240, obj_enunit); + if (slaa) { + u.dudes[1] = "Daemonette"; + u.dudes_num[1] = 2000; + u.dudes[2] = "Maulerfiend"; + u.dudes_num[2] = 3; + } else { + u.dudes[1] = "Bloodletter"; + u.dudes_num[1] = 500; + u.dudes[2] = "Daemonette"; + u.dudes_num[2] = 500; + u.dudes[3] = "Plaguebearer"; + u.dudes_num[3] = 500; + u.dudes[4] = "Pink Horror"; + u.dudes_num[4] = 500; + u.dudes[5] = "Maulerfiend"; + u.dudes_num[5] = 3; + } + instance_deactivate_object(u); + } + } + + // ** Necron Forces ** + if ((enemy == 13) && ((string_count("_attack", battle_special) == 0) || (string_count("wake", battle_special) > 0))) { + // Small Necron Group + if (threat == 1) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "11"; + + u.dudes[1] = "Necron Destroyer"; + u.dudes_num[1] = 1; + enemies[1] = u.dudes[1]; + u.dudes[2] = "Necron Warrior"; + u.dudes_num[2] = 10; + enemies[2] = u.dudes[2]; + } + // Medium Necron Group + if (threat == 2) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "54"; + + u.dudes[1] = "Necron Destroyer"; + u.dudes_num[1] = 1; + u.dudes[2] = "Necron Warrior"; + u.dudes_num[2] = 20; + u.dudes[3] = "Necron Immortal"; + u.dudes_num[3] = 10; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Necron Warrior"; + u.dudes_num[1] = 20; + u.dudes[2] = "Canoptek Spyder"; + u.dudes_num[2] = 3; + } + // Large Necron Group + if (threat == 3) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "110"; + + u.dudes[1] = "Necron Overlord"; + u.dudes_num[1] = 1; + u.dudes[2] = "Necron Destroyer"; + u.dudes_num[2] = 3; + u.dudes[3] = "Lychguard"; + u.dudes_num[3] = 5; + u.dudes[4] = "Necron Warrior"; + u.dudes_num[4] = 100; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Canoptek Spyder"; + u.dudes_num[1] = 6; + u.dudes[2] = "Canoptek Scarab"; + u.dudes_num[2] = 120; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Doomsday Arc"; + u.dudes_num[1] = 2; + u.dudes[2] = "Monolith"; + u.dudes_num[2] = 1; + } + // Small Necron Army + if (threat == 4) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "290"; + + u.dudes[1] = "Necron Overlord"; + u.dudes_num[1] = 1; + u.dudes[2] = "Necron Destroyer"; + u.dudes_num[2] = 6; + u.dudes[3] = "Lychguard"; + u.dudes_num[3] = 10; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Necron Warrior"; + u.dudes_num[1] = 250; + u.dudes[2] = "Necron Immortal"; + u.dudes_num[2] = 20; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Canoptek Spyder"; + u.dudes_num[1] = 6; + u.dudes[2] = "Canoptek Scarab"; + u.dudes_num[2] = 120; + u.dudes[3] = "Tomb Stalker"; + u.dudes_num[3] = 1; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Doomsday Arc"; + u.dudes_num[1] = 2; + u.dudes[2] = "Monolith"; + u.dudes_num[2] = 1; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Necron Wraith"; + u.dudes_num[1] = 6; + u.flank = 1; + } + // Medium Necron Army + if (threat == 5) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "700"; + + u.dudes[1] = "Necron Overlord"; + u.dudes_num[1] = 1; + u.dudes[2] = "Necron Destroyer"; + u.dudes_num[2] = 12; + u.dudes[3] = "Lychguard"; + u.dudes_num[3] = 20; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Necron Warrior"; + u.dudes_num[1] = 600; + u.dudes[2] = "Necron Immortal"; + u.dudes_num[2] = 40; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Canoptek Spyder"; + u.dudes_num[1] = 12; + u.dudes[2] = "Canoptek Scarab"; + u.dudes_num[2] = 240; + u.dudes[3] = "Tomb Stalker"; + u.dudes_num[3] = 2; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Doomsday Arc"; + u.dudes_num[1] = 4; + u.dudes[2] = "Monolith"; + u.dudes_num[2] = 2; + u.dudes[3] = "Necron Destroyer"; + u.dudes_num[3] = 12; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Necron Wraith"; + u.dudes_num[1] = 12; + u.flank = 1; + } + // Large Necron Army + if (threat == 6) { + u = instance_nearest(xxx, 240, obj_enunit); + enemy_dudes = "1000"; + + u.dudes[1] = "Necron Overlord"; + u.dudes_num[1] = 2; + u.dudes[2] = "Necron Destroyer"; + u.dudes_num[2] = 20; + u.dudes[3] = "Lychguard"; + u.dudes_num[3] = 40; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 10, 240, obj_enunit); + u.dudes[1] = "Necron Warrior"; + u.dudes_num[1] = 800; + u.dudes[2] = "Necron Immortal"; + u.dudes_num[2] = 50; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 20, 240, obj_enunit); + u.dudes[1] = "Canoptek Spyder"; + u.dudes_num[1] = 16; + u.dudes[2] = "Canoptek Scarab"; + u.dudes_num[2] = 320; + u.dudes[3] = "Tomb Stalker"; + u.dudes_num[3] = 3; + + instance_deactivate_object(u); + u = instance_nearest(xxx + 30, 240, obj_enunit); + u.dudes[1] = "Doomsday Arc"; + u.dudes_num[1] = 6; + u.dudes[2] = "Monolith"; + u.dudes_num[2] = 2; + u.dudes[3] = "Necron Destroyer"; + u.dudes_num[3] = 20; + + u = instance_create(0, 240, obj_enunit); + u.dudes[1] = "Necron Wraith"; + u.dudes_num[1] = 24; + u.flank = 1; + } + } + + // ** Set up player defenses ** + if (player_defenses + player_silos > 0) { + u = instance_create(-50, 240, obj_pnunit); + u.defenses = 1; + + for (var i = 1; i <= 3; i++) { + u.veh_co[i] = 0; + u.veh_id[i] = 0; + u.veh_type[i] = "Defenses"; + u.veh_hp[i] = 1000; + u.veh_ac[i] = 1000; + u.veh_dead[i] = 0; + u.veh_hp_multiplier[i] = 1; + } + + u.veh_wep1[1] = "Heavy Bolter Emplacement"; + u.veh_wep1[2] = "Missile Launcher Emplacement"; + u.veh_wep1[3] = "Missile Silo"; + u.veh = 3; + u.sprite_index = spr_weapon_blank; + } + + instance_activate_object(obj_enunit); +} catch (_exception) { + handle_exception(_exception); + instance_destroy(obj_enunit); + instance_destroy(obj_pnunit); + instance_destroy(obj_ncombat); } - -// ** Aeldar Force ** -if (enemy = 6) { - // Ranger Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "20"; - - u.dudes[1] = "Pathfinder"; - u.dudes_num[1] = 1; - enemies[1] = u.dudes[1]; - u.dudes[2] = "Ranger"; - u.dudes_num[2] = 10; - enemies[2] = u.dudes[2]; - u.dudes[3] = "Striking Scorpian"; - u.dudes_num[3] = 10; - enemies[3] = u.dudes[3]; - } - // Harlequin Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "9"; - - u.dudes[1] = "Athair"; - u.dudes_num[1] = 1; - enemies[1] = u.dudes[1]; - u.dudes[2] = "Warlock"; - u.dudes_num[2] = 2; - enemies[2] = u.dudes[2]; - u.dudes[3] = "Trouper"; - u.dudes_num[3] = 6; - enemies[3] = u.dudes[3]; - } - // Craftworld Small Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "24"; - - u.dudes[1] = "Warlock"; - u.dudes_num[1] = 1; - enemies[1] = u.dudes[1]; - enemies_num[1] = 1; - u.dudes[2] = choose("Howling Banshee", "Striking Scorpian"); - u.dudes_num[2] = 8; - enemies[2] = u.dudes[2]; - u.dudes[3] = "Dire Avenger"; - u.dudes_num[3] = 15; - enemies[3] = u.dudes[3]; - if (leader = 1) { - u.dudes[4] = "Leader"; - u.dudes_num[4] = 1; - enemies[4] = 1; - enemies_num[4] = 1; - if (obj_controller.faction_gender[6] = 2) then u.dudes[2] = "Howling Banshee"; - if (obj_controller.faction_gender[6] = 2) then u.dudes[2] = "Dark Reapers"; - } - } - // Craftworld Medium Group - if (threat = 2) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "100"; - - u.dudes[1] = "Dire Avenger"; - u.dudes_num[1] = 56; - u.dudes_special[1] = "shimmershield"; - u.dudes[2] = "Dire Avenger Exarch"; - u.dudes_num[2] = 4; - u.dudes_special[2] = "shimmershield"; - u.dudes[3] = "Autarch"; - u.dudes_num[3] = 1; - u.dudes[4] = "Farseer"; - u.dudes_num[4] = 1; - u.dudes_special[4] = "farseer_powers"; - u.dudes[5] = "Night Spinner"; - u.dudes_num[5] = 1; - // Spawn leader - if (leader = 1) { - u.dudes[4] = "Leader"; - u.dudes_num[4] = 1; - enemies[4] = 1; - enemies_num[4] = 1; - } - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Fire Dragon"; - u.dudes_num[1] = 7; - u.dudes[2] = "Fire Dragon Exarch"; - u.dudes_num[2] = 1; - u.dudes[3] = "Warp Spider"; - u.dudes_num[3] = 7; - u.dudes_special[3] = "warp_jump"; - u.dudes[4] = "Warp Spider Exarch"; - u.dudes_num[4] = 1; - u.dudes_special[4] = "warp_jump"; - u.dudes[5] = "Howling Banshee"; - u.dudes_num[5] = 9; - u.dudes_special[5] = "banshee_mask"; - u.dudes[6] = "Howling Banshee Exarch"; - u.dudes_num[6] = 1; - u.dudes_special[6] = "banshee_mask"; - u.dudes[7] = "Striking Scorpian"; - u.dudes_num[7] = 9; - u.dudes[8] = "Striking Scorpian Exarch"; - u.dudes_num[8] = 1; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Falcon"; - u.dudes_num[1] = 2; - } - // Craftworld Large Group - if (threat = 3) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "300"; - - u.dudes[1] = "Dire Avenger"; - u.dudes_num[1] = 140; - u.dudes_special[1] = "shimmershield"; - u.dudes[2] = "Dire Avenger Exarch"; - u.dudes_num[2] = 10; - u.dudes_special[2] = "shimmershield"; - u.dudes[3] = "Autarch"; - u.dudes_num[3] = 1; - u.dudes[4] = "Farseer"; - u.dudes_num[4] = 1; - u.dudes_special[4] = "farseer_powers"; - // Spawn Leader - if (leader = 1) { - u.dudes[4] = "Leader"; - u.dudes_num[4] = 1; - enemies[4] = 1; - enemies_num[4] = 1; - } - u.dudes[5] = "Fire Prism"; - u.dudes_num[5] = 3; - u.dudes[6] = "Avatar"; - u.dudes_num[6] = 1; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Fire Dragon"; - u.dudes_num[1] = 18; - u.dudes[2] = "Fire Dragon Exarch"; - u.dudes_num[2] = 2; - u.dudes[3] = "Warp Spider"; - u.dudes_num[3] = 18; - u.dudes_special[3] = "warp_jump"; - u.dudes[4] = "Warp Spider Exarch"; - u.dudes_num[4] = 2; - u.dudes_special[4] = "warp_jump"; - u.dudes[5] = "Howling Banshee"; - u.dudes_num[5] = 28; - u.dudes_special[5] = "banshee_mask"; - u.dudes[6] = "Howling Banshee Exarch"; - u.dudes_num[6] = 2; - u.dudes_special[6] = "banshee_mask"; - u.dudes[7] = "Striking Scorpian"; - u.dudes_num[7] = 19; - u.dudes[8] = "Striking Scorpian Exarch"; - u.dudes_num[8] = 1; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Falcon"; - u.dudes_num[1] = 5; - u.dudes[2] = "Vyper"; - u.dudes_num[2] = 12; - u.dudes[3] = "Wraithguard"; - u.dudes_num[3] = 30; - u.dudes[4] = "Wraithlord"; - u.dudes_num[4] = 2; - } - // Craftworld Small Army - if (threat = 4) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "1100"; - - u.dudes[1] = "Dire Avenger"; - u.dudes_num[1] = 280; - u.dudes_special[1] = "shimmershield"; - u.dudes[2] = "Dire Avenger Exarch"; - u.dudes_num[2] = 20; - u.dudes_special[2] = "shimmershield"; - u.dudes[3] = "Autarch"; - u.dudes_num[3] = 3; - u.dudes[4] = "Farseer"; - u.dudes_num[4] = 2; - u.dudes_special[4] = "farseer_powers"; - // Spawn Leader - if (leader = 1) { - u.dudes[4] = "Leader"; - u.dudes_num[4] = 1; - enemies[4] = 1; - enemies_num[4] = 1; - } - u.dudes[5] = "Fire Prism"; - u.dudes_num[5] = 3; - u.dudes[6] = "Avatar"; - u.dudes_num[6] = 1; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Warlock"; - u.dudes_num[1] = 40; - u.dudes[2] = "Guardian"; - u.dudes_num[2] = 400; - u.dudes[3] = "Grav Platform"; - u.dudes_num[3] = 20; - u.dudes[4] = "Dark Reaper"; - u.dudes_num[4] = 18; - u.dudes[5] = "Dark Reaper Exarch"; - u.dudes_num[5] = 2; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Fire Dragon"; - u.dudes_num[1] = 36; - u.dudes[2] = "Fire Dragon Exarch"; - u.dudes_num[2] = 4; - u.dudes[3] = "Warp Spider"; - u.dudes_num[3] = 36; - u.dudes_special[3] = "warp_jump"; - u.dudes[4] = "Warp Spider Exarch"; - u.dudes_num[4] = 4; - u.dudes_special[4] = "warp_jump"; - u.dudes[5] = "Howling Banshee"; - u.dudes_num[5] = 36; - u.dudes_special[5] = "banshee_mask"; - u.dudes[6] = "Howling Banshee Exarch"; - u.dudes_num[6] = 4; - u.dudes_special[6] = "banshee_mask"; - u.dudes[7] = "Striking Scorpian"; - u.dudes_num[7] = 38; - u.dudes[8] = "Striking Scorpian Exarch"; - u.dudes_num[8] = 2; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Falcon"; - u.dudes_num[1] = 12; - u.dudes[2] = "Vyper"; - u.dudes_num[2] = 20; - u.dudes[3] = "Wraithguard"; - u.dudes_num[3] = 90; - u.dudes[4] = "Wraithlord"; - u.dudes_num[4] = 5; - u.dudes[5] = "Shining Spear"; - u.dudes_num[5] = 40; - } - // Craftworld Medium Army - if (threat = 5) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "2500"; - - u.dudes[1] = "Dire Avenger"; - u.dudes_num[1] = 450; - u.dudes_special[1] = "shimmershield"; - u.dudes[2] = "Dire Avenger Exarch"; - u.dudes_num[2] = 50; - u.dudes_special[2] = "shimmershield"; - u.dudes[3] = "Autarch"; - u.dudes_num[3] = 5; - u.dudes[4] = "Farseer"; - u.dudes_num[4] = 3; - u.dudes_special[4] = "farseer_powers"; - // Spawn Leader - if (leader = 1) { - u.dudes[4] = "Leader"; - u.dudes_num[4] = 1; - enemies[4] = 1; - enemies_num[4] = 1; - } - u.dudes[5] = "Fire Prism"; - u.dudes_num[5] = 6; - u.dudes[6] = "Mighty Avatar"; - u.dudes_num[6] = 1; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Warlock"; - u.dudes_num[1] = 80; - u.dudes[2] = "Guardian"; - u.dudes_num[2] = 1200; - u.dudes[3] = "Grav Platform"; - u.dudes_num[3] = 40; - u.dudes[4] = "Dark Reaper"; - u.dudes_num[4] = 36; - u.dudes[5] = "Dark Reaper Exarch"; - u.dudes_num[5] = 4; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Fire Dragon"; - u.dudes_num[1] = 72; - u.dudes[2] = "Fire Dragon Exarch"; - u.dudes_num[2] = 8; - u.dudes[3] = "Warp Spider"; - u.dudes_num[3] = 72; - u.dudes_special[3] = "warp_jump"; - u.dudes[4] = "Warp Spider Exarch"; - u.dudes_num[4] = 8; - u.dudes_special[4] = "warp_jump"; - u.dudes[5] = "Howling Banshee"; - u.dudes_num[5] = 72; - u.dudes_special[5] = "banshee_mask"; - u.dudes[6] = "Howling Banshee Exarch"; - u.dudes_num[6] = 8; - u.dudes_special[6] = "banshee_mask"; - u.dudes[7] = "Striking Scorpian"; - u.dudes_num[7] = 72; - u.dudes[8] = "Striking Scorpian Exarch"; - u.dudes_num[8] = 8; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Falcon"; - u.dudes_num[1] = 24; - u.dudes[2] = "Vyper"; - u.dudes_num[2] = 40; - u.dudes[3] = "Wraithguard"; - u.dudes_num[3] = 180; - u.dudes[4] = "Wraithlord"; - u.dudes_num[4] = 10; - u.dudes[5] = "Shining Spear"; - u.dudes_num[5] = 80; - } - // Craftworld Large Army - if (threat = 6) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "5000"; - - u.dudes[1] = "Dire Avenger"; - u.dudes_num[1] = 540; - u.dudes_special[1] = "shimmershield"; - u.dudes[2] = "Dire Avenger Exarch"; - u.dudes_num[2] = 60; - u.dudes_special[2] = "shimmershield"; - u.dudes[3] = "Autarch"; - u.dudes_num[3] = 8; - u.dudes[4] = "Farseer"; - u.dudes_num[4] = 4; - u.dudes_special[4] = "farseer_powers"; - // Spawn Leader - if (leader = 1) { - u.dudes[4] = "Leader"; - u.dudes_num[4] = 1; - enemies[4] = 1; - enemies_num[4] = 1; - } - u.dudes[5] = "Fire Prism"; - u.dudes_num[5] = 12; - u.dudes[6] = "Godly Avatar"; - u.dudes_num[6] = 1; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Warlock"; - u.dudes_num[1] = 100; - u.dudes[2] = "Guardian"; - u.dudes_num[2] = 3000; - u.dudes[3] = "Grav Platform"; - u.dudes_num[3] = 80; - u.dudes[4] = "Dark Reaper"; - u.dudes_num[4] = 72; - u.dudes[5] = "Dark Reaper Exarch"; - u.dudes_num[5] = 8; - u.dudes[6] = "Phantom Titan"; - u.dudes_num[6] = 2; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Fire Dragon"; - u.dudes_num[1] = 144; - u.dudes[2] = "Fire Dragon Exarch"; - u.dudes_num[2] = 16; - u.dudes[3] = "Warp Spider"; - u.dudes_num[3] = 144; - u.dudes_special[3] = "warp_jump"; - u.dudes[4] = "Warp Spider Exarch"; - u.dudes_num[4] = 16; - u.dudes_special[4] = "warp_jump"; - u.dudes[5] = "Howling Banshee"; - u.dudes_num[5] = 144; - u.dudes_special[5] = "banshee_mask"; - u.dudes[6] = "Howling Banshee Exarch"; - u.dudes_num[6] = 16; - u.dudes_special[6] = "banshee_mask"; - u.dudes[7] = "Striking Scorpian"; - u.dudes_num[7] = 144; - u.dudes[8] = "Striking Scorpian Exarch"; - u.dudes_num[8] = 16; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Falcon"; - u.dudes_num[1] = 48; - u.dudes[2] = "Vyper"; - u.dudes_num[2] = 80; - u.dudes[3] = "Wraithguard"; - u.dudes_num[3] = 360; - u.dudes[4] = "Wraithlord"; - u.dudes_num[4] = 20; - u.dudes[5] = "Shining Spear"; - u.dudes_num[5] = 160; - } -} - -// ** Sisters Force ** -if (enemy = 5) { - // Small Sister Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "110"; - - u.dudes[1] = "Celestian"; - u.dudes_num[1] = 1; - enemies[1] = u.dudes[1]; - // Spawn Leader - if (leader = 1) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - enemies_num[1] = 1; - } - u.dudes[2] = "Battle Sister"; - u.dudes_num[2] = 4; - enemies[2] = u.dudes[2]; - u.dudes[3] = "Priest"; - u.dudes_num[3] = 10; - enemies[3] = u.dudes[3]; - u.dudes[4] = "Follower"; - u.dudes_num[4] = 100; - enemies[4] = u.dudes[4]; - } - // Medium Sister Group - if (threat = 2) { - u = instance_nearest(xxx + 10, 240, obj_enunit); - enemy_dudes = "nearly 400"; - - u.dudes[1] = "Celestian"; - u.dudes_num[1] = 1; - // Spawn Leader - if (leader = 1) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - enemies_num[1] = 1; - } - u.dudes[2] = "Battle Sister"; - u.dudes_num[2] = 50; - u.dudes[3] = "Follower"; - u.dudes_num[3] = 300; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Arco-Flagellent"; - u.dudes_num[1] = 50; - u.dudes[2] = "Chimera"; - u.dudes_num[2] = 3; - } - // Large Sister Group - if (threat = 3) { - u = instance_nearest(xxx + 30, 240, obj_enunit); - enemy_dudes = "1000"; - - u.dudes[1] = "Palatine"; - u.dudes_num[1] = 1; - // Spawn Leader - if (leader = 1) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - enemies_num[1] = 1; - } - u.dudes[2] = "Battle Sister"; - u.dudes_num[2] = 200; - u.dudes[3] = "Celestian"; - u.dudes_num[3] = 40; - u.dudes[4] = "Retributor"; - u.dudes_num[4] = 50; - u.dudes[5] = "Priest"; - u.dudes_num[5] = 60; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Seraphim"; - u.dudes_num[1] = 50; - u.dudes[2] = "Dominion"; - u.dudes_num[2] = 50; - u.dudes[3] = "Immolator"; - u.dudes_num[3] = 4; - u.dudes[4] = "Exorcist"; - u.dudes_num[4] = 2; - instance_deactivate_object(u); - - u = instance_nearest(xxx, 240, obj_enunit); - u.dudes[1] = "Follower"; - u.dudes_num[1] = 450; - u.dudes[2] = "Sister Repentia"; - u.dudes_num[2] = 50; - u.dudes[3] = "Arco-Flagellent"; - u.dudes_num[3] = 30; - u.dudes[4] = "Penitent Engine"; - u.dudes_num[4] = 4; - } - // Small Sister Army - if (threat = 4) { - u = instance_nearest(xxx + 30, 240, obj_enunit); - enemy_dudes = "4000"; - - u.dudes[1] = "Palatine"; - u.dudes_num[1] = 2; - // Spawn Leader - if (leader = 1) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - enemies_num[1] = 1; - } - u.dudes[2] = "Battle Sister"; - u.dudes_num[2] = 1000; - u.dudes[3] = "Celestian"; - u.dudes_num[3] = 150; - u.dudes[4] = "Retributor"; - u.dudes_num[4] = 150; - u.dudes[5] = "Priest"; - u.dudes_num[5] = 150; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Seraphim"; - u.dudes_num[1] = 200; - u.dudes[2] = "Dominion"; - u.dudes_num[2] = 200; - u.dudes[3] = "Immolator"; - u.dudes_num[3] = 15; - u.dudes[4] = "Exorcist"; - u.dudes_num[4] = 6; - u.dudes[5] = "Follower"; - u.dudes_num[5] = 600; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Follower"; - u.dudes_num[1] = 1500; - u.dudes[2] = "Sister Repentia"; - u.dudes_num[2] = 100; - u.dudes[3] = "Arco-Flagellent"; - u.dudes_num[3] = 30; - u.dudes[4] = "Penitent Engine"; - u.dudes_num[4] = 4; - u.dudes[5] = "Mistress"; - u.dudes_num[5] = 10; - } - // Medium Sister Army - if (threat = 5) { - u = instance_nearest(xxx + 40, 240, obj_enunit); - enemy_dudes = "8000"; - - u.dudes[1] = "Palatine"; - u.dudes_num[1] = 2; - // Spawn Leader - if (leader = 1) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - enemies_num[1] = 1; - } - u.dudes[2] = "Battle Sister"; - u.dudes_num[2] = 1000; - u.dudes[3] = "Celestian"; - u.dudes_num[3] = 150; - u.dudes[4] = "Retributor"; - u.dudes_num[4] = 200; - u.dudes[5] = "Priest"; - u.dudes_num[5] = 200; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Battle Sister"; - u.dudes_num[1] = 1000; - u.dudes[2] = "Celestian"; - u.dudes_num[2] = 150; - u.dudes[3] = "Retributor"; - u.dudes_num[3] = 200; - u.dudes[4] = "Priest"; - u.dudes_num[4] = 200; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Seraphim"; - u.dudes_num[1] = 200; - u.dudes[2] = "Dominion"; - u.dudes_num[2] = 200; - u.dudes[3] = "Immolator"; - u.dudes_num[3] = 25; - u.dudes[4] = "Exorcist"; - u.dudes_num[4] = 10; - u.dudes[5] = "Follower"; - u.dudes_num[5] = 2000; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Follower"; - u.dudes_num[1] = 2000; - u.dudes[2] = "Sister Repentia"; - u.dudes_num[2] = 300; - u.dudes[3] = "Arco-Flagellent"; - u.dudes_num[3] = 100; - u.dudes[4] = "Penitent Engine"; - u.dudes_num[4] = 15; - u.dudes[5] = "Mistress"; - u.dudes_num[5] = 30; - } - // Large Sister Army - if (threat = 6) { - u = instance_nearest(xxx + 50, 240, obj_enunit); - enemy_dudes = "12000"; - - u.dudes[1] = "Palatine"; - u.dudes_num[1] = 1; - // Spawn Leader - if (leader = 1) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - enemies_num[1] = 1; - } - u.dudes[2] = "Battle Sister"; - u.dudes_num[2] = 1500; - u.dudes[3] = "Celestian"; - u.dudes_num[3] = 150; - u.dudes[4] = "Retributor"; - u.dudes_num[4] = 200; - u.dudes[5] = "Priest"; - u.dudes_num[5] = 200; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 40, 240, obj_enunit); - u.dudes[1] = "Battle Sister"; - u.dudes_num[1] = 1500; - u.dudes[2] = "Celestian"; - u.dudes_num[2] = 150; - u.dudes[3] = "Retributor"; - u.dudes_num[3] = 200; - u.dudes[4] = "Priest"; - u.dudes_num[4] = 200; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Seraphim"; - u.dudes_num[1] = 200; - u.dudes[2] = "Dominion"; - u.dudes_num[2] = 200; - u.dudes[3] = "Immolator"; - u.dudes_num[3] = 50; - u.dudes[4] = "Exorcist"; - u.dudes_num[4] = 20; - u.dudes[5] = "Follower"; - u.dudes_num[5] = 2000; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Follower"; - u.dudes_num[1] = 2000; - u.dudes[2] = "Sister Repentia"; - u.dudes_num[2] = 500; - u.dudes[3] = "Arco-Flagellent"; - u.dudes_num[3] = 250; - u.dudes[4] = "Penitent Engine"; - u.dudes_num[4] = 30; - u.dudes[5] = "Mistress"; - u.dudes_num[5] = 50; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Follower"; - u.dudes_num[1] = 3000; - } -} - -// ** Orks Forces ** -if (enemy = 7) { - // u=instance_create(-10,240,obj_enunit); - // u.dudes[1]="Stormboy";u.dudes_num[1]=2500;u.flank=1;// enemies[1]=u.dudes[1]; - - // Small Ork Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "100"; - - u.dudes[1] = "Meganob"; - u.dudes_num[1] = 1; - enemies[1] = u.dudes[1]; - u.dudes[2] = "Slugga Boy"; - u.dudes_num[2] = 50; - enemies[2] = u.dudes[2]; - u.dudes[3] = "Shoota Boy"; - u.dudes_num[3] = 50; - enemies[3] = u.dudes[3]; - // Spawn Leader - if (leader = 1) { - u.dudes[4] = "Leader"; - u.dudes_num[4] = 1; - enemies[4] = 1; - enemies_num[4] = 1; - } - } - // Medium Ork Group - if (threat = 2) { - u = instance_nearest(xxx + 10, 240, obj_enunit); - enemy_dudes = "nearly 350"; - - u.dudes[1] = "Slugga Boy"; - u.dudes_num[1] = 50; - u.dudes[2] = "Shoota Boy"; - u.dudes_num[2] = 50; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Minor Warboss"; - u.dudes_num[1] = 1; - u.dudes[2] = "Meganob"; - u.dudes_num[2] = 5; - u.dudes[3] = "Slugga Boy"; - u.dudes_num[3] = 70; - u.dudes[4] = "Ard Boy"; - u.dudes_num[4] = 70; - u.dudes[5] = "Shoota Boy"; - u.dudes_num[5] = 100; - // Spawn Leader - if (leader = 1) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - enemies_num[1] = 1; - } - } - // Large Ork Group - if (threat = 3) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "over a 1000"; - - u.dudes[1] = "Slugga Boy"; - u.dudes_num[1] = 300; - u.dudes[2] = "Ard Boy"; - u.dudes_num[2] = 150; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Deff Dread"; - u.dudes_num[1] = 9; - u.dudes[2] = "Battlewagon"; - u.dudes_num[2] = 6; - u.dudes[3] = "Mekboy"; - u.dudes_num[3] = 1; - u.dudes[4] = "Flash Git"; - u.dudes_num[4] = 12; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Warboss"; - u.dudes_num[1] = 1; - // Spawn Leader - if (leader = 1) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - enemies_num[1] = 1; - } - u.dudes[2] = "Meganob"; - u.dudes_num[2] = 10; - u.dudes[3] = "Slugga Boy"; - u.dudes_num[3] = 100; - u.dudes[4] = "Ard Boy"; - u.dudes_num[4] = 150; - u.dudes[5] = "Shoota Boy"; - u.dudes_num[5] = 350; - } - // Small Ork Army - if (threat = 4) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "a green tide of over 3600"; - - u.dudes[1] = "Slugga Boy"; - u.dudes_num[1] = 600; - u.dudes[2] = "Ard Boy"; - u.dudes_num[2] = 300; - u.dudes[3] = "Gretchin"; - u.dudes_num[3] = 1000; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Deff Dread"; - u.dudes_num[1] = 21; - u.dudes[2] = "Battlewagon"; - u.dudes_num[2] = 12; - u.dudes[3] = "Mekboy"; - u.dudes_num[3] = 3; - u.dudes[4] = "Flash Git"; - u.dudes_num[4] = 30; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Warboss"; - u.dudes_num[1] = 1; - // Spawn Leader - if (leader = 1) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - enemies_num[1] = 1; - } - u.dudes[2] = "Meganob"; - u.dudes_num[2] = 30; - u.dudes[3] = "Slugga Boy"; - u.dudes_num[3] = 300; - u.dudes[4] = "Ard Boy"; - u.dudes_num[4] = 450; - u.dudes[5] = "Shoota Boy"; - u.dudes_num[5] = 1000; - } - // Medium Ork Army - if (threat = 5) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "a green tide of over 7000"; - - u.dudes[1] = "Slugga Boy"; - u.dudes_num[1] = 1200; - u.dudes[2] = "Ard Boy"; - u.dudes_num[2] = 600; - u.dudes[3] = "Gretchin"; - u.dudes_num[3] = 2000; - u.dudes[4] = "Tank Busta"; - u.dudes_num[4] = 100; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Deff Dread"; - u.dudes_num[1] = 40; - u.dudes[2] = "Battlewagon"; - u.dudes_num[2] = 18; - u.dudes[3] = "Mekboy"; - u.dudes_num[3] = 6; - u.dudes[4] = "Flash Git"; - u.dudes_num[4] = 50; - u.dudes[5] = "Kommando"; - u.dudes_num[5] = 20; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Warboss"; - u.dudes_num[1] = 1; - // Spawn Leader - if (leader = 1) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - enemies_num[1] = 1; - } - u.dudes[2] = "Meganob"; - u.dudes_num[2] = 80; - u.dudes[3] = "Slugga Boy"; - u.dudes_num[3] = 600; - u.dudes[4] = "Ard Boy"; - u.dudes_num[4] = 900; - u.dudes[5] = "Shoota Boy"; - u.dudes_num[5] = 2000; - } - // Large Ork Army - if (threat = 6) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "a WAAAAGH!! of 11000"; - - u.dudes[1] = "Slugga Boy"; - u.dudes_num[1] = 1200; - u.dudes[2] = "Ard Boy"; - u.dudes_num[2] = 600; - u.dudes[3] = "Gretchin"; - u.dudes_num[3] = 2000; - u.dudes[4] = "Tank Busta"; - u.dudes_num[4] = 100; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Deff Dread"; - u.dudes_num[1] = 40; - u.dudes[2] = "Battlewagon"; - u.dudes_num[2] = 18; - u.dudes[3] = "Mekboy"; - u.dudes_num[3] = 6; - u.dudes[4] = "Flash Git"; - u.dudes_num[4] = 50; - u.dudes[5] = "Kommando"; - u.dudes_num[5] = 20; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Slugga Boy"; - u.dudes_num[1] = 1200; - u.dudes[2] = "Ard Boy"; - u.dudes_num[2] = 600; - u.dudes[3] = "Gretchin"; - u.dudes_num[3] = 2000; - u.dudes[4] = "Tank Busta"; - u.dudes_num[4] = 100; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Deff Dread"; - u.dudes_num[1] = 40; - u.dudes[2] = "Battlewagon"; - u.dudes_num[2] = 18; - u.dudes[3] = "Mekboy"; - u.dudes_num[3] = 6; - u.dudes[4] = "Flash Git"; - u.dudes_num[4] = 50; - u.dudes[5] = "Kommando"; - u.dudes_num[5] = 20; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 40, 240, obj_enunit); - u.dudes[1] = "Big Warboss"; - u.dudes_num[1] = 1; - // Spawn Leader - if (leader = 1) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - enemies[1] = 1; - enemies_num[1] = 1; - } - u.dudes[2] = "Meganob"; - u.dudes_num[2] = 80; - u.dudes[3] = "Slugga Boy"; - u.dudes_num[3] = 600; - u.dudes[4] = "Ard Boy"; - u.dudes_num[4] = 900; - u.dudes[5] = "Shoota Boy"; - u.dudes_num[5] = 2000; - } -} - -// ** Tau Forces ** -if (enemy = 8) { - // Small Tau Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "11"; - - u.dudes[1] = "XV8 Crisis"; - u.dudes_num[1] = 1; - u.dudes[2] = "Fire Warrior"; - u.dudes_num[2] = 20; - u.dudes[3] = "Kroot"; - u.dudes_num[3] = 20; - enemies[3] = u.dudes[3]; - } - // Medium Tau Group - if (threat = 2) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "100"; - - u.dudes[1] = "XV8 Commander"; - u.dudes_num[1] = 1; - u.dudes[2] = "XV8 Bodyguard"; - u.dudes_num[2] = 6; - u.dudes[3] = "Shield Drone"; - u.dudes_num[3] = 4; - u.dudes[4] = "XV88 Broadside"; - u.dudes_num[4] = 3; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Fire Warrior"; - u.dudes_num[1] = 60; - u.dudes[2] = "Kroot"; - u.dudes_num[2] = 60; - u.dudes[3] = "Pathfinder"; - u.dudes_num[3] = 20; - u.dudes[4] = "XV8 Crisis"; - u.dudes_num[4] = 12; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Hammerhead"; - u.dudes_num[1] = 2; - u.dudes[2] = "Devilfish"; - u.dudes_num[2] = 4; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "XV25 Stealthsuit"; - u.dudes_num[1] = 6; - u.flank = 1; - } - // Large Tau Group - if (threat = 3) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "100"; - - u.dudes[1] = "XV8 Commander"; - u.dudes_num[1] = 1; - u.dudes[2] = "XV8 Bodyguard"; - u.dudes_num[2] = 9; - u.dudes[3] = "Shield Drone"; - u.dudes_num[3] = 8; - u.dudes[4] = "XV88 Broadside"; - u.dudes_num[4] = 6; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Fire Warrior"; - u.dudes_num[1] = 200; - u.dudes[2] = "Kroot"; - u.dudes_num[2] = 150; - u.dudes[3] = "Pathfinder"; - u.dudes_num[3] = 40; - u.dudes[4] = "XV8 Crisis"; - u.dudes_num[4] = 24; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Hammerhead"; - u.dudes_num[1] = 5; - u.dudes[2] = "Devilfish"; - u.dudes_num[2] = 10; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "XV25 Stealthsuit"; - u.dudes_num[1] = 12; - u.flank = 1; - } - // Small Tau Army - if (threat = 4) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "100"; - - u.dudes[1] = "XV8 Commander"; - u.dudes_num[1] = 1; - u.dudes[2] = "XV8 Bodyguard"; - u.dudes_num[2] = 9; - u.dudes[3] = "Shield Drone"; - u.dudes_num[3] = 8; - u.dudes[4] = "XV88 Broadside"; - u.dudes_num[4] = 12; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Fire Warrior"; - u.dudes_num[1] = 800; - u.dudes[2] = "Kroot"; - u.dudes_num[2] = 500; - u.dudes[3] = "Pathfinder"; - u.dudes_num[3] = 60; - u.dudes[4] = "XV8 Crisis"; - u.dudes_num[4] = 48; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Hammerhead"; - u.dudes_num[1] = 40; - u.dudes[2] = "Devilfish"; - u.dudes_num[2] = 15; - u.dudes[3] = "XV8 Crisis"; - u.dudes_num[3] = 48; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "XV25 Stealthsuit"; - u.dudes_num[1] = 12; - u.flank = 1; - u.dudes[2] = "XV8 (Brightknife)"; - u.dudes_num[2] = 6; - u.flank = 1; - } - // Medium Tau Army - if (threat = 5) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "4000"; - - u.dudes[1] = "XV8 Commander"; - u.dudes_num[1] = 2; - u.dudes[2] = "XV8 Bodyguard"; - u.dudes_num[2] = 18; - u.dudes[3] = "Shield Drone"; - u.dudes_num[3] = 20; - u.dudes[4] = "XV88 Broadside"; - u.dudes_num[4] = 24; - u.dudes[5] = "Vespid"; - u.dudes_num[4] = 30; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Fire Warrior"; - u.dudes_num[1] = 1000; - u.dudes[2] = "Kroot"; - u.dudes_num[2] = 700; - u.dudes[3] = "Pathfinder"; - u.dudes_num[3] = 100; - u.dudes[4] = "XV8 Crisis"; - u.dudes_num[4] = 80; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Fire Warrior"; - u.dudes_num[1] = 1000; - u.dudes[2] = "Kroot"; - u.dudes_num[2] = 700; - u.dudes[3] = "Pathfinder"; - u.dudes_num[3] = 100; - u.dudes[4] = "XV8 Crisis"; - u.dudes_num[4] = 80; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Hammerhead"; - u.dudes_num[1] = 40; - u.dudes[2] = "Devilfish"; - u.dudes_num[2] = 40; - u.dudes[3] = "XV8 Crisis"; - u.dudes_num[3] = 48; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "XV25 Stealthsuit"; - u.dudes_num[1] = 12; - u.flank = 1; - u.dudes[2] = "XV8 (Brightknife)"; - u.dudes_num[2] = 18; - u.flank = 1; - } - // Large Tau Army - if (threat = 6) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "6000"; - - u.dudes[1] = "XV8 Commander"; - u.dudes_num[1] = 2; - u.dudes[2] = "XV8 Bodyguard"; - u.dudes_num[2] = 18; - u.dudes[3] = "Shield Drone"; - u.dudes_num[3] = 20; - u.dudes[4] = "XV88 Broadside"; - u.dudes_num[4] = 36; - u.dudes[5] = "Vespid"; - u.dudes_num[4] = 60; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Fire Warrior"; - u.dudes_num[1] = 1000; - u.dudes[2] = "Kroot"; - u.dudes_num[2] = 700; - u.dudes[3] = "Pathfinder"; - u.dudes_num[3] = 100; - u.dudes[4] = "XV8 Crisis"; - u.dudes_num[4] = 80; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Fire Warrior"; - u.dudes_num[1] = 1000; - u.dudes[2] = "Kroot"; - u.dudes_num[2] = 700; - u.dudes[3] = "Pathfinder"; - u.dudes_num[3] = 100; - u.dudes[4] = "XV8 Crisis"; - u.dudes_num[4] = 80; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Fire Warrior"; - u.dudes_num[1] = 1000; - u.dudes[2] = "Kroot"; - u.dudes_num[2] = 700; - u.dudes[3] = "Pathfinder"; - u.dudes_num[3] = 100; - u.dudes[4] = "XV8 Crisis"; - u.dudes_num[4] = 80; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 40, 240, obj_enunit); - u.dudes[1] = "Hammerhead"; - u.dudes_num[1] = 40; - u.dudes[2] = "Devilfish"; - u.dudes_num[2] = 80; - u.dudes[3] = "XV8 Crisis"; - u.dudes_num[3] = 80; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "XV25 Stealthsuit"; - u.dudes_num[1] = 12; - u.flank = 1; - u.dudes[2] = "XV8 (Brightknife)"; - u.dudes_num[2] = 24; - u.flank = 1; - } -} - -// ** Tyranid Forces ** -// Tyranid story event -if (enemy = 9) and(battle_special = "tyranid_org") { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "81"; - u.dudes[1] = "Termagaunt"; - u.dudes_num[1] = 40; - u.dudes[2] = "Hormagaunt"; - u.dudes_num[2] = 40; - // u.dudes[3]="Lictor";u.dudes_num[3]=1; -} -if (enemy = 9) and(battle_special != "tyranid_org") { - // Small Genestealer Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "11"; - - u.dudes[1] = "Genestealer"; - u.dudes_num[1] = 10; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Lictor"; - u.dudes_num[1] = 1; - u.flank = 1; - } - // Medium Genestealer Group - if (threat = 2) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "100"; - - u.dudes[1] = "Genestealer Patriarch"; - u.dudes_num[1] = 1; - u.dudes[2] = "Genestealer"; - u.dudes_num[2] = 30; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 150; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Lictor"; - u.dudes_num[1] = 1; - u.flank = 1; - } - // Large Genestealer Group - if (threat = 3) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "100"; - - u.dudes[1] = "Genestealer Patriarch"; - u.dudes_num[1] = 1; - u.dudes[2] = "Genestealer"; - u.dudes_num[2] = 120; - u.dudes[3] = "Armoured Limousine"; - u.dudes_num[3] = 20; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 600; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Lictor"; - u.dudes_num[1] = 6; - u.flank = 1; - } - // Small Tyranid Army - if (threat = 4) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "7000"; - - u.dudes[1] = "Hive Tyrant"; - u.dudes_num[1] = 1; - u.dudes[2] = "Tyrant Guard"; - u.dudes_num[2] = 16; - u.dudes[3] = "Tyranid Warrior"; - u.dudes_num[3] = 40; - u.dudes[4] = "Zoanthrope"; - u.dudes_num[4] = 10; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Termagaunt"; - u.dudes_num[1] = 1500; - u.dudes[2] = "Hormagaunt"; - u.dudes_num[2] = 800; - u.dudes[3] = "Carnifex"; - u.dudes_num[3] = 5; - u.dudes[4] = "Tyranid Warrior"; - u.dudes_num[4] = 30; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Termagaunt"; - u.dudes_num[1] = 1500; - u.dudes[2] = "Hormagaunt"; - u.dudes_num[2] = 800; - u.dudes[3] = "Carnifex"; - u.dudes_num[3] = 5; - u.dudes[4] = "Tyranid Warrior"; - u.dudes_num[4] = 30; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Termagaunt"; - u.dudes_num[1] = 1500; - u.dudes[2] = "Hormagaunt"; - u.dudes_num[2] = 800; - u.dudes[3] = "Carnifex"; - u.dudes_num[3] = 5; - u.dudes[4] = "Tyranid Warrior"; - u.dudes_num[4] = 30; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 40, 240, obj_enunit); - u.dudes[1] = "Carnifex"; - u.dudes_num[1] = 6; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Lictor"; - u.dudes_num[1] = 15; - u.flank = 1; - } - // Medium Tyranid Army - if (threat = 5) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "15000"; - - u.dudes[1] = "Hive Tyrant"; - u.dudes_num[1] = 2; - u.dudes[2] = "Tyrant Guard"; - u.dudes_num[2] = 32; - u.dudes[3] = "Tyranid Warrior"; - u.dudes_num[3] = 80; - u.dudes[4] = "Zoanthrope"; - u.dudes_num[4] = 20; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Termagaunt"; - u.dudes_num[1] = 3300; - u.dudes[2] = "Hormagaunt"; - u.dudes_num[2] = 1600; - u.dudes[3] = "Carnifex"; - u.dudes_num[3] = 10; - u.dudes[4] = "Tyranid Warrior"; - u.dudes_num[4] = 30; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Termagaunt"; - u.dudes_num[1] = 3300; - u.dudes[2] = "Hormagaunt"; - u.dudes_num[2] = 1600; - u.dudes[3] = "Carnifex"; - u.dudes_num[3] = 10; - u.dudes[4] = "Tyranid Warrior"; - u.dudes_num[4] = 30; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Termagaunt"; - u.dudes_num[1] = 3300; - u.dudes[2] = "Hormagaunt"; - u.dudes_num[2] = 1600; - u.dudes[3] = "Carnifex"; - u.dudes_num[3] = 10; - u.dudes[4] = "Tyranid Warrior"; - u.dudes_num[4] = 60; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 40, 240, obj_enunit); - u.dudes[1] = "Carnifex"; - u.dudes_num[1] = 20; - u.dudes[2] = "Zoanthrope"; - u.dudes_num[2] = 10; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Lictor"; - u.dudes_num[1] = 20; - u.flank = 1; - } - // Large Tyranid Army - if (threat = 6) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "45000"; - - u.dudes[1] = "Hive Tyrant"; - u.dudes_num[1] = 4; - u.dudes[2] = "Tyrant Guard"; - u.dudes_num[2] = 64; - u.dudes[3] = "Tyranid Warrior"; - u.dudes_num[3] = 160; - u.dudes[4] = "Zoanthrope"; - u.dudes_num[4] = 40; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Termagaunt"; - u.dudes_num[1] = 10000; - u.dudes[2] = "Hormagaunt"; - u.dudes_num[2] = 4000; - u.dudes[3] = "Carnifex"; - u.dudes_num[3] = 15; - u.dudes[4] = "Tyranid Warrior"; - u.dudes_num[4] = 90; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Termagaunt"; - u.dudes_num[1] = 10000; - u.dudes[2] = "Hormagaunt"; - u.dudes_num[2] = 4000; - u.dudes[3] = "Carnifex"; - u.dudes_num[3] = 15; - u.dudes[4] = "Tyranid Warrior"; - u.dudes_num[4] = 90; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Termagaunt"; - u.dudes_num[1] = 10000; - u.dudes[2] = "Hormagaunt"; - u.dudes_num[2] = 4000; - u.dudes[3] = "Carnifex"; - u.dudes_num[3] = 15; - u.dudes[4] = "Tyranid Warrior"; - u.dudes_num[4] = 90; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 40, 240, obj_enunit); - u.dudes[1] = "Carnifex"; - u.dudes_num[1] = 40; - u.dudes[2] = "Zoanthrope"; - u.dudes_num[2] = 20; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Lictor"; - u.dudes_num[1] = 40; - u.flank = 1; - } -} - -// ** Chaos Forces ** -if (enemy = 10) and(battle_special != "ship_demon") and(battle_special != "fallen1") and(battle_special != "fallen2") and(battle_special != "WL10_reveal") and(battle_special != "WL10_later") and(string_count("cs_meeting_battle", battle_special) = 0) { - // u=instance_create(-10,240,obj_enunit); - // u.dudes[1]="Stormboy";u.dudes_num[1]=2500;u.flank=1;// enemies[1]=u.dudes[1]; - // Small Chaos Cult Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "150"; - - u.dudes[1] = "Arch Heretic"; - u.dudes_num[1] = 1; - enemies[1] = u.dudes[1]; - u.dudes[2] = "Cultist Elite"; - u.dudes_num[2] = 30; - enemies[2] = u.dudes[2]; - u.dudes[3] = "Cultist"; - u.dudes_num[3] = 120; - enemies[3] = u.dudes[3]; - } - // Medium Chaos Cult Group - if (threat = 2) { - u = instance_nearest(xxx + 10, 240, obj_enunit); - enemy_dudes = "nearly 400"; - - u.dudes[1] = "Arch Heretic"; - u.dudes_num[1] = 1; - u.dudes[2] = "Cultist Elite"; - u.dudes_num[2] = 50; - u.dudes[3] = "Cultist"; - u.dudes_num[3] = 300; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 50; - u.dudes[2] = "Technical"; - u.dudes_num[2] = 6; - } - // Large Chaos Cult Group - if (threat = 3) { - u = instance_nearest(xxx + 20, 240, obj_enunit); - enemy_dudes = "1000"; - - u.dudes[1] = "Arch Heretic"; - u.dudes_num[1] = 1; - u.dudes[2] = "Cultist Elite"; - u.dudes_num[2] = 100; - u.dudes[3] = "Mutants"; - u.dudes_num[3] = 200; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Technical"; - u.dudes_num[1] = 9; - u.dudes[2] = "Chaos Leman Russ"; - u.dudes_num[2] = 6; - u.dudes[3] = "Cultist"; - u.dudes_num[3] = 200; - instance_deactivate_object(u); - - u = instance_nearest(xxx, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 200; - u.dudes[2] = "Mutant"; - u.dudes_num[2] = 300; - } - // Small Chaos Cult Army - if (threat = 4) { - u = instance_nearest(xxx + 20, 240, obj_enunit); - enemy_dudes = "4000"; - - u.dudes[1] = "Arch Heretic"; - u.dudes_num[1] = 1; - u.dudes[2] = "Cultist Elite"; - u.dudes_num[2] = 400; - u.dudes[3] = "Chaos Basilisk"; - u.dudes_num[3] = 6; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Mutant"; - u.dudes_num[1] = 1500; - u.dudes[2] = "Chaos Leman Russ"; - u.dudes_num[2] = 21; - u.dudes[3] = "Defiler"; - u.dudes_num[3] = 5; - instance_deactivate_object(u); - - u = instance_nearest(xxx, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 600; - u.dudes[2] = "Mutant"; - u.dudes_num[2] = 1500; - } - // Medium Chaos Cult Army - if (threat = 5) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "8000"; - - u.dudes[1] = "Daemonhost"; - u.dudes_num[1] = 1; - u.dudes[2] = "Chaos Terminator"; - u.dudes_num[2] = 10; - u.dudes[3] = "Cultist Elite"; - u.dudes_num[3] = 400; - u.dudes[4] = "Chaos Basilisk"; - u.dudes_num[4] = 9; - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Chaos Leman Russ"; - u.dudes_num[1] = 40; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 12; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Mutant"; - u.dudes_num[1] = 2000; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 1000; - u.dudes[2] = "Mutant"; - u.dudes_num[2] = 2000; - instance_deactivate_object(u); - - u = instance_nearest(xxx, 40, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 1000; - u.dudes[2] = "Mutant"; - u.dudes_num[2] = 2000; - instance_deactivate_object(u); - } - // Large Chaos Cult Army - if (threat = 6) { - u = instance_nearest(xxx + 40, 240, obj_enunit); - enemy_dudes = "12000"; - - u.dudes[1] = "Greater Daemon of " + string(choose("Slaanesh", "Khorne", "Nurgle", "Tzeentch,", "Tzeentch")); - u.dudes_num[1] = 2; - u.dudes[2] = "Chaos Terminator"; - u.dudes_num[2] = 20; - u.dudes[3] = "Chaos Basilisk"; - u.dudes_num[3] = 18; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Chaos Leman Russ"; - u.dudes_num[1] = 80; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 20; - u.dudes[3] = "Vindicator"; - u.dudes_num[3] = 10; - instance_deactivate_object(u); - - u = instance_nearest(xxx, 240, obj_enunit); - u.dudes[1] = "Mutant"; - u.dudes_num[1] = 8000; - u.dudes[2] = "Cultist Elite"; - u.dudes_num[2] = 4000; - u.dudes[3] = "Havoc"; - u.dudes_num[3] = 50; - u.dudes[4] = "Chaos Space Marine"; - u.dudes_num[4] = 50; - instance_deactivate_object(u); - } - // Chaos Daemons Army - if (threat = 7) { - u = instance_nearest(xxx + 40, 240, obj_enunit); - u.neww = 1; - enemy_dudes = ""; - - u.dudes[1] = "Greater Daemon of Slaanesh"; - u.dudes_num[1] = 1; - u.dudes[2] = "Greater Daemon of Slaanesh"; - u.dudes_num[2] = 1; - // u.dudes[3]="Greater Daemon of Slaanesh";u.dudes_num[3]=1; - u.dudes[4] = "Greater Daemon of Tzeentch"; - u.dudes_num[4] = 1; - u.dudes[5] = "Greater Daemon of Tzeentch"; - u.dudes_num[5] = 1; - // u.dudes[6]="Greater Daemon of Tzeentch";u.dudes_num[6]=1; - u.dudes[7] = "Soul Grinder"; - u.dudes_num[7] = 3; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.neww = 1; - u.dudes[1] = "Greater Daemon of Khorne"; - u.dudes_num[1] = 1; - u.dudes[2] = "Greater Daemon of Khorne"; - u.dudes_num[2] = 1; - // u.dudes[3]="Greater Daemon of Khorne";u.dudes_num[3]=1; - u.dudes[4] = "Greater Daemon of Nurgle"; - u.dudes_num[4] = 1; - u.dudes[5] = "Greater Daemon of Nurgle"; - u.dudes_num[5] = 1; - // u.dudes[6]="Greater Daemon of Nurgle";u.dudes_num[6]=1; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Bloodletter"; - u.dudes_num[1] = 800; - u.dudes[2] = "Daemonette"; - u.dudes_num[2] = 800; - u.dudes[3] = "Plaguebearer"; - u.dudes_num[3] = 800; - u.dudes[4] = "Pink Horror"; - u.dudes_num[4] = 800; - u.dudes[5] = "Maulerfiend"; - u.dudes_num[5] = 3; - instance_deactivate_object(u); - - // u=instance_nearest(xxx+10,240,obj_enunit); - // u.dudes[1]="Mutant";u.dudes_num[1]=6000; - // instance_deactivate_object(u); - } -} - -// ** Chaos Space Marines Forces ** -if (enemy = 11) and(battle_special != "ChaosWarband") and(string_count("cs_meeting_battle", battle_special) = 0) { - // Small CSM Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "5"; - - u.dudes[1] = "Chaos Space Marine"; - u.dudes_num[1] = 5; - enemies[1] = u.dudes[1]; - u.dudes[2] = "Cultist"; - u.dudes_num[2] = 30; - enemies[2] = u.dudes[2]; - } - // Medium CSM Group - if (threat = 2) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "41"; - - u.dudes[1] = "Chaos Chosen"; - u.dudes_num[1] = 1; - u.dudes[2] = "Chaos Space Marine"; - u.dudes_num[2] = 35; - u.dudes[3] = "Havoc"; - u.dudes_num[3] = 5; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 100; - u.dudes[2] = "Rhino"; - u.dudes_num[2] = 2; - u.dudes[3] = "Predator"; - u.dudes_num[3] = 4; - } - // Large CSM Group - if (threat = 3) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "over 100"; - - u.dudes[1] = "Chaos Lord"; - u.dudes_num[1] = 1; - u.dudes[2] = "Chaos Sorcerer"; - u.dudes_num[2] = 1; - u.dudes[3] = "Chaos Chosen"; - u.dudes_num[3] = 10; - u.dudes[4] = "Chaos Space Marine"; - u.dudes_num[4] = 100; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Rhino"; - u.dudes_num[1] = 6; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 2; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 300; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 3; - u.dudes[3] = "Predator"; - u.dudes_num[3] = 6; - u.dudes[4] = "Land Raider"; - u.dudes_num[4] = 2; - } - // Small CSM Army - if (threat = 4) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "over 700"; - - u.dudes[1] = "Chaos Lord"; - u.dudes_num[1] = 1; - u.dudes[2] = "Chaos Sorcerer"; - u.dudes_num[2] = 2; - u.dudes[3] = "Chaos Chosen"; - u.dudes_num[3] = 10; - // u.dudes[4]="Chaos Terminator";u.dudes_num[4]=5; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Chaos Space Marine"; - u.dudes_num[1] = 250; - u.dudes[2] = "Havoc"; - u.dudes_num[2] = 20; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Rhino"; - u.dudes_num[1] = 15; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 4; - u.dudes[3] = "Heldrake"; - u.dudes_num[3] = 1; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 600; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 3; - u.dudes[3] = "Predator"; - u.dudes_num[3] = 6; - u.dudes[4] = "Vindicator"; - u.dudes_num[4] = 3; - u.dudes[5] = "Land Raider"; - u.dudes_num[5] = 2; - } - // Medium CSM Army - if (threat = 5) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "over 1200"; - - u.dudes[1] = "Chaos Lord"; - u.dudes_num[1] = 1; - u.dudes[2] = "Chaos Sorcerer"; - u.dudes_num[2] = 3; - u.dudes[3] = "Chaos Chosen"; - u.dudes_num[3] = 20; - u.dudes[4] = "Obliterator"; - u.dudes_num[4] = 6; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Chaos Space Marine"; - u.dudes_num[1] = 600; - u.dudes[2] = "Havoc"; - u.dudes_num[2] = 40; - u.dudes[3] = "Raptor"; - u.dudes_num[3] = 40; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Rhino"; - u.dudes_num[1] = 25; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 8; - u.dudes[3] = "Heldrake"; - u.dudes_num[3] = 3; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 600; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 5; - u.dudes[3] = "Predator"; - u.dudes_num[3] = 10; - u.dudes[4] = "Vindicator"; - u.dudes_num[4] = 6; - u.dudes[5] = "Land Raider"; - u.dudes_num[5] = 3; - u.dudes[6] = "Possessed"; - u.dudes_num[6] = 30; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Chaos Terminator"; - u.dudes_num[1] = 10; - u.flank = 1; - } - // Large CSM Army - if (threat = 6) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "2000"; - - u.dudes[1] = "Chaos Lord"; - u.dudes_num[1] = 2; - u.dudes[2] = "Chaos Sorcerer"; - u.dudes_num[2] = 10; - u.dudes[3] = "Chaos Chosen"; - u.dudes_num[3] = 40; - u.dudes[4] = "Obliterator"; - u.dudes_num[4] = 12; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Chaos Space Marine"; - u.dudes_num[1] = 800; - u.dudes[2] = "Havoc"; - u.dudes_num[2] = 50; - u.dudes[3] = "Raptor"; - u.dudes_num[3] = 50; - u.dudes[4] = choose("Noise Marine", "Plague Marine", "Khorne Berzerker", "Rubric Marine"); - u.dudes_num[3] = 50; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Rhino"; - u.dudes_num[1] = 30; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 10; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Cultist"; - u.dudes_num[1] = 1200; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 10; - u.dudes[3] = "Predator"; - u.dudes_num[3] = 20; - u.dudes[4] = "Vindicator"; - u.dudes_num[4] = 15; - u.dudes[5] = "Land Raider"; - u.dudes_num[5] = 6; - u.dudes[6] = "Possessed"; - u.dudes_num[6] = 60; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 40, 240, obj_enunit); - u.dudes[1] = "Heldrake"; - u.dudes_num[1] = 6; - u.flank = 1; - u.flyer = 1; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Chaos Terminator"; - u.dudes_num[1] = 20; - u.flank = 1; - } -} - -// ** World Eaters Forces ** -if (enemy = 11) and(battle_special = "ChaosWarband") { - // Small WE Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "20"; - - u.dudes[1] = "Khorne Berzerker"; - u.dudes_num[1] = 15; - enemies[1] = u.dudes[1]; - // Spawn Leader - if (obj_controller.faction_defeated[10] = 0) { - u.dudes[2] = "Leader"; - u.dudes_num[2] = 1; - } - u.dudes[3] = "World Eaters Veteran"; - u.dudes_num[3] = 5; - } - // Medium WE Group - if (threat = 2) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "135"; - - u.dudes[1] = "Chaos Chosen"; - u.dudes_num[1] = 1; - // Spawn Leader - if (obj_controller.faction_defeated[10] = 0) then u.dudes[1] = "Leader"; - u.dudes[2] = "Khorne Berzerker"; - u.dudes_num[2] = 35; - u.dudes[3] = "World Eaters Veteran"; - u.dudes_num[3] = 5; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "World Eater"; - u.dudes_num[1] = 100; - u.dudes[2] = "Rhino"; - u.dudes_num[2] = 2; - u.dudes[3] = "Vindicator"; - u.dudes_num[3] = 4; - } - // Large WE Group - if (threat = 3) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "over 200"; - - u.dudes[1] = "Chaos Chosen"; - u.dudes_num[1] = 1; - // Spawn Leader - if (obj_controller.faction_defeated[10] = 0) then u.dudes[1] = "Leader"; - u.dudes[2] = "Greater Daemon of Khorne"; - u.dudes_num[2] = 1; - u.dudes[3] = "World Eater Terminator"; - u.dudes_num[3] = 10; - u.dudes[4] = "World Eater"; - u.dudes_num[4] = 100; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Rhino"; - u.dudes_num[1] = 6; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 2; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Khorne Berzerker"; - u.dudes_num[1] = 100; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 5; - u.dudes[3] = "Vindicator"; - u.dudes_num[3] = 6; - u.dudes[4] = "Land Raider"; - u.dudes_num[4] = 4; - } - // Small WE Army - if (threat = 4) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "over 300"; - - u.dudes[1] = "Chaos Chosen"; - u.dudes_num[1] = 1; - // Spawn Leader - if (obj_controller.faction_defeated[10] = 0) then u.dudes[1] = "Leader"; - u.dudes[2] = "Greater Daemon of Khorne"; - u.dudes_num[2] = 2; - u.dudes[3] = "World Eater Terminator"; - u.dudes_num[3] = 10; - // u.dudes[4]="Chaos Terminator";u.dudes_num[4]=5; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "World Eaters Veteran"; - u.dudes_num[1] = 250; - u.dudes[2] = "Possessed"; - u.dudes_num[2] = 20; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Vindicator"; - u.dudes_num[1] = 15; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 4; - u.dudes[3] = "Heldrake"; - u.dudes_num[3] = 1; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Khorne Berzerker"; - u.dudes_num[1] = 300; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 3; - u.dudes[3] = "Predator"; - u.dudes_num[3] = 6; - u.dudes[4] = "Vindicator"; - u.dudes_num[4] = 3; - u.dudes[5] = "Land Raider"; - u.dudes_num[5] = 2; - } - // Medium WE Army - if (threat = 5) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "over 900"; - - u.dudes[1] = "Chaos Chosen"; - u.dudes_num[1] = 1; - // Spawn Leader - if (obj_controller.faction_defeated[10] = 0) then u.dudes[1] = "Leader"; - u.dudes[2] = "Greater Daemon of Khorne"; - u.dudes_num[2] = 3; - u.dudes[3] = "World Eater Terminator"; - u.dudes_num[3] = 20; - u.dudes[4] = "Helbrute"; - u.dudes_num[4] = 6; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "World Eaters Veteran"; - u.dudes_num[1] = 600; - u.dudes[2] = "Possessed"; - u.dudes_num[2] = 40; - u.dudes[3] = "Possessed"; - u.dudes_num[3] = 40; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Vindicator"; - u.dudes_num[1] = 15; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 8; - u.dudes[3] = "Heldrake"; - u.dudes_num[3] = 3; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Khorne Berzerker"; - u.dudes_num[1] = 300; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 5; - u.dudes[3] = "Predator"; - u.dudes_num[3] = 10; - u.dudes[4] = "Vindicator"; - u.dudes_num[4] = 6; - u.dudes[5] = "Land Raider"; - u.dudes_num[5] = 3; - u.dudes[6] = "Possessed"; - u.dudes_num[6] = 30; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Chaos Terminator"; - u.dudes_num[1] = 10; - u.flank = 1; - } - // Large WE Army - if (threat >= 6) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "1300"; - - u.dudes[1] = "Chaos Lord"; - u.dudes_num[1] = 2; - // Spawn Leader - if (obj_controller.faction_defeated[10] = 0) { - u.dudes[1] = "Leader"; - u.dudes_num[1] = 1; - } - u.dudes[2] = "Greater Daemon of Khorne"; - u.dudes_num[2] = 5; - u.dudes[3] = "World Eaters Terminator"; - u.dudes_num[3] = 40; - u.dudes[4] = "Helbrute"; - u.dudes_num[4] = 10; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "World Eaters Veteran"; - u.dudes_num[1] = 800; - u.dudes[2] = "Possessed"; - u.dudes_num[2] = 50; - u.dudes[3] = "Possessed"; - u.dudes_num[3] = 50; - u.dudes[4] = "Khorne Berzerker"; - u.dudes_num[3] = 50; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Vindicator"; - u.dudes_num[1] = 20; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 10; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Khorne Berzerker"; - u.dudes_num[1] = 500; - u.dudes[2] = "Helbrute"; - u.dudes_num[2] = 10; - u.dudes[3] = "Predator"; - u.dudes_num[3] = 15; - u.dudes[4] = "Vindicator"; - u.dudes_num[4] = 20; - u.dudes[5] = "Land Raider"; - u.dudes_num[5] = 6; - u.dudes[6] = "Possessed"; - u.dudes_num[6] = 60; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 40, 240, obj_enunit); - u.dudes[1] = "Heldrake"; - u.dudes_num[1] = 6; - u.flank = 1; - u.flyer = 1; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "World Eaters Terminator"; - u.dudes_num[1] = 20; - u.flank = 1; - } -} - -// ** Daemon Forces ** -if (enemy = 12) { - // If we want to have multiple story events regarding specific Chaos Gods, we could name slaa into gods and just check the value? TBD - var slaa = false; - if (battle_special = "ruins_eldar") then slaa = true; - // Small Daemon Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "5"; - - u.dudes[1] = choose("Bloodletter", "Daemonette", "Plaguebearer", "Pink Horror"); - if (slaa) then u.dudes[1] = "Daemonette"; - u.dudes_num[1] = 5; - enemies[1] = u.dudes[1]; - u.dudes[2] = "Cultist Elite"; - u.dudes_num[2] = 30; - enemies[2] = u.dudes[2]; - } - // Medium Daemon Group - if (threat = 2) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "90"; - - u.dudes[1] = choose("Bloodletter", "Daemonette", "Plaguebearer", "Pink Horror"); - if (slaa) then u.dudes[1] = "Daemonette"; - u.dudes_num[1] = 30; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = choose("Bloodletter", "Daemonette", "Plaguebearer", "Pink Horror"); - if (slaa) then u.dudes[1] = "Daemonette"; - u.dudes_num[1] = 30; - u.dudes[2] = "Defiler"; - u.dudes_num[2] = 1; - } - // Large Daemon Group - if (threat = 3) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "240"; - - u.dudes[1] = "Greater Daemon of " + choose("Tzeentch", "Slaanesh", "Nurgle", "Khorne"); - if (slaa) then u.dudes[1] = "Greater Daemon of Slaanesh"; - u.dudes_num[1] = 1; - u.dudes[2] = "Chaos Sorcerer"; - u.dudes_num[2] = 1; - u.dudes[3] = "Pink Horror"; - if (slaa) then u.dudes[3] = "Daemonette"; - u.dudes_num[3] = 60; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Defiler"; - u.dudes_num[1] = 2; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - if (slaa) { - u.dudes[1] = "Daemonette"; - u.dudes_num[1] = 240; - } else { - u.dudes[1] = "Bloodletter"; - u.dudes_num[1] = 60; - u.dudes[2] = "Plaguebearer"; - u.dudes_num[2] = 60; - u.dudes[3] = "Daemonette"; - u.dudes_num[3] = 60; - u.dudes[4] = "Maulerfiend"; - u.dudes_num[4] = 2; - } - } - // Small Daemon Army - if (threat = 4) { - u = instance_nearest(xxx + 40, 240, obj_enunit); - enemy_dudes = "400"; - u.neww = 1; - - u.dudes[1] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch")); - if (slaa) then u.dudes[1] = "Greater Daemon of Slaanesh"; - u.dudes_num[1] = 1; - u.dudes[2] = "Greater Daemon of " + string(choose("Nurgle", "Khorne")); - if (slaa) then u.dudes[2] = "Greater Daemon of Slaanesh"; - u.dudes_num[2] = 1; - // u.dudes[6]="Greater Daemon of Tzeentch";u.dudes_num[6]=1; - u.dudes[3] = "Soul Grinder"; - u.dudes_num[3] = 1; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - if (slaa) { - u.dudes[1] = "Daemonette"; - u.dudes_num[1] = 400; - u.dudes[2] = "Maulerfiend"; - u.dudes_num[2] = 2; - } else { - u.dudes[1] = "Bloodletter"; - u.dudes_num[1] = 100; - u.dudes[2] = "Daemonette"; - u.dudes_num[2] = 100; - u.dudes[3] = "Plaguebearer"; - u.dudes_num[3] = 100; - u.dudes[4] = "Pink Horror"; - u.dudes_num[4] = 100; - u.dudes[5] = "Maulerfiend"; - u.dudes_num[5] = 2; - } - instance_deactivate_object(u); - } - // Medium Daemon Army - if (threat = 5) { - u = instance_nearest(xxx + 40, 240, obj_enunit); - enemy_dudes = "1000"; - u.neww = 1; - - u.dudes[1] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); - if (slaa) then u.dudes[1] = "Greater Daemon of Slaanesh"; - u.dudes_num[1] = 1; - u.dudes[2] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); - if (slaa) then u.dudes[2] = "Greater Daemon of Slaanesh"; - u.dudes_num[2] = 1; - u.dudes[3] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); - if (slaa) then u.dudes[3] = "Greater Daemon of Slaanesh"; - u.dudes_num[3] = 1; - u.dudes[4] = "Soul Grinder"; - u.dudes_num[4] = 2; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - if (slaa) { - u.dudes[1] = "Daemonette"; - u.dudes_num[1] = 1000; - u.dudes[2] = "Maulerfiend"; - u.dudes_num[2] = 2; - } else { - u.dudes[1] = "Bloodletter"; - u.dudes_num[1] = 250; - u.dudes[2] = "Daemonette"; - u.dudes_num[2] = 250; - u.dudes[3] = "Plaguebearer"; - u.dudes_num[3] = 250; - u.dudes[4] = "Pink Horror"; - u.dudes_num[4] = 250; - u.dudes[5] = "Maulerfiend"; - u.dudes_num[5] = 2; - } - instance_deactivate_object(u); - } - // Large Daemon Army - if (threat = 6) { - u = instance_nearest(xxx + 40, 240, obj_enunit); - enemy_dudes = "2000"; - u.neww = 1; - - u.dudes[1] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); - if (slaa) then u.dudes[1] = "Greater Daemon of Slaanesh"; - u.dudes_num[1] = 1; - u.dudes[2] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); - if (slaa) then u.dudes[2] = "Greater Daemon of Slaanesh"; - u.dudes_num[2] = 1; - u.dudes[3] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); - if (slaa) then u.dudes[3] = "Greater Daemon of Slaanesh"; - u.dudes_num[3] = 1; - u.dudes[4] = "Soul Grinder"; - u.dudes_num[4] = 1; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.neww = 1; - u.dudes[1] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); - if (slaa) then u.dudes[1] = "Greater Daemon of Slaanesh"; - u.dudes_num[1] = 1; - u.dudes[2] = "Greater Daemon of " + string(choose("Slaanesh", "Tzeentch", "Khorne", "Nurgle")); - if (slaa) then u.dudes[2] = "Greater Daemon of Slaanesh"; - u.dudes_num[2] = 1; - u.dudes[3] = "Soul Grinder"; - u.dudes_num[3] = 1; - instance_deactivate_object(u); - - u = instance_nearest(xxx + 20, 240, obj_enunit); - if (slaa) { - u.dudes[1] = "Daemonette"; - u.dudes_num[1] = 2000; - u.dudes[2] = "Maulerfiend"; - u.dudes_num[2] = 3; - } else { - u.dudes[1] = "Bloodletter"; - u.dudes_num[1] = 500; - u.dudes[2] = "Daemonette"; - u.dudes_num[2] = 500; - u.dudes[3] = "Plaguebearer"; - u.dudes_num[3] = 500; - u.dudes[4] = "Pink Horror"; - u.dudes_num[4] = 500; - u.dudes[5] = "Maulerfiend"; - u.dudes_num[5] = 3; - } - instance_deactivate_object(u); - } -} - -// ** Necron Forces ** -if (enemy = 13) and((string_count("_attack", battle_special) = 0) or(string_count("wake", battle_special) > 0)) { - // Small Necron Group - if (threat = 1) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "11"; - - u.dudes[1] = "Necron Destroyer"; - u.dudes_num[1] = 1; - enemies[1] = u.dudes[1]; - u.dudes[2] = "Necron Warrior"; - u.dudes_num[2] = 10; - enemies[2] = u.dudes[2]; - } - // Medium Necron Group - if (threat = 2) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "54"; - - u.dudes[1] = "Necron Destroyer"; - u.dudes_num[1] = 1; - u.dudes[2] = "Necron Warrior"; - u.dudes_num[2] = 20; - u.dudes[3] = "Necron Immortal"; - u.dudes_num[3] = 10; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Necron Warrior"; - u.dudes_num[1] = 20; - u.dudes[2] = "Canoptek Spyder"; - u.dudes_num[2] = 3; - } - // Large Necron Group - if (threat = 3) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "110"; - - u.dudes[1] = "Necron Overlord"; - u.dudes_num[1] = 1; - u.dudes[2] = "Necron Destroyer"; - u.dudes_num[2] = 3; - u.dudes[3] = "Lychguard"; - u.dudes_num[3] = 5; - u.dudes[4] = "Necron Warrior"; - u.dudes_num[4] = 100; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Canoptek Spyder"; - u.dudes_num[1] = 6; - u.dudes[2] = "Canoptek Scarab"; - u.dudes_num[2] = 120; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Doomsday Arc"; - u.dudes_num[1] = 2; - u.dudes[2] = "Monolith"; - u.dudes_num[2] = 1; - } - // Small Necron Army - if (threat = 4) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "290"; - - u.dudes[1] = "Necron Overlord"; - u.dudes_num[1] = 1; - u.dudes[2] = "Necron Destroyer"; - u.dudes_num[2] = 6; - u.dudes[3] = "Lychguard"; - u.dudes_num[3] = 10; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Necron Warrior"; - u.dudes_num[1] = 250; - u.dudes[2] = "Necron Immortal"; - u.dudes_num[2] = 20; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Canoptek Spyder"; - u.dudes_num[1] = 6; - u.dudes[2] = "Canoptek Scarab"; - u.dudes_num[2] = 120; - u.dudes[3] = "Tomb Stalker"; - u.dudes_num[3] = 1; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Doomsday Arc"; - u.dudes_num[1] = 2; - u.dudes[2] = "Monolith"; - u.dudes_num[2] = 1; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Necron Wraith"; - u.dudes_num[1] = 6; - u.flank = 1; - } - // Medium Necron Army - if (threat = 5) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "700"; - - u.dudes[1] = "Necron Overlord"; - u.dudes_num[1] = 1; - u.dudes[2] = "Necron Destroyer"; - u.dudes_num[2] = 12; - u.dudes[3] = "Lychguard"; - u.dudes_num[3] = 20; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Necron Warrior"; - u.dudes_num[1] = 600; - u.dudes[2] = "Necron Immortal"; - u.dudes_num[2] = 40; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Canoptek Spyder"; - u.dudes_num[1] = 12; - u.dudes[2] = "Canoptek Scarab"; - u.dudes_num[2] = 240; - u.dudes[3] = "Tomb Stalker"; - u.dudes_num[3] = 2; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Doomsday Arc"; - u.dudes_num[1] = 4; - u.dudes[2] = "Monolith"; - u.dudes_num[2] = 2; - u.dudes[3] = "Necron Destroyer"; - u.dudes_num[3] = 12; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Necron Wraith"; - u.dudes_num[1] = 12; - u.flank = 1; - } - // Large Necron Army - if (threat = 6) { - u = instance_nearest(xxx, 240, obj_enunit); - enemy_dudes = "1000"; - - u.dudes[1] = "Necron Overlord"; - u.dudes_num[1] = 2; - u.dudes[2] = "Necron Destroyer"; - u.dudes_num[2] = 20; - u.dudes[3] = "Lychguard"; - u.dudes_num[3] = 40; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 10, 240, obj_enunit); - u.dudes[1] = "Necron Warrior"; - u.dudes_num[1] = 800; - u.dudes[2] = "Necron Immortal"; - u.dudes_num[2] = 50; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 20, 240, obj_enunit); - u.dudes[1] = "Canoptek Spyder"; - u.dudes_num[1] = 16; - u.dudes[2] = "Canoptek Scarab"; - u.dudes_num[2] = 320; - u.dudes[3] = "Tomb Stalker"; - u.dudes_num[3] = 3; - - instance_deactivate_object(u); - u = instance_nearest(xxx + 30, 240, obj_enunit); - u.dudes[1] = "Doomsday Arc"; - u.dudes_num[1] = 6; - u.dudes[2] = "Monolith"; - u.dudes_num[2] = 2; - u.dudes[3] = "Necron Destroyer"; - u.dudes_num[3] = 20; - - u = instance_create(0, 240, obj_enunit); - u.dudes[1] = "Necron Wraith"; - u.dudes_num[1] = 24; - u.flank = 1; - } -} - -// ** Set up player defenses ** -if (player_defenses + player_silos > 0) { - u = instance_create(-50, 240, obj_pnunit); - u.defenses = 1; - - for (var i = 1; i <= 3; i++) { - u.veh_co[i] = 0; - u.veh_id[i] = 0; - u.veh_type[i] = "Defenses"; - u.veh_hp[i] = 1000; - u.veh_ac[i] = 1000; - u.veh_dead[i] = 0; - u.veh_hp_multiplier[i] = 1; - } - - u.veh_wep1[1] = "Heavy Bolter Emplacement"; - u.veh_wep1[2] = "Missile Launcher Emplacement"; - u.veh_wep1[3] = "Missile Silo"; - u.veh = 3; - u.sprite_index = spr_weapon_blank; -} - -instance_activate_object(obj_enunit); - -}catch (_exception) { - handle_exception(_exception); - instance_destroy(obj_enunit); - instance_destroy(obj_pnunit); - instance_destroy(obj_ncombat); -} \ No newline at end of file diff --git a/objects/obj_ncombat/Alarm_1.gml b/objects/obj_ncombat/Alarm_1.gml index 53186af849..62d194cebb 100644 --- a/objects/obj_ncombat/Alarm_1.gml +++ b/objects/obj_ncombat/Alarm_1.gml @@ -1,31 +1,53 @@ +var a1; +a1 = ""; -var a1;a1=""; - -if (ally>0) and (ally_forces>0){ - if (ally=3){ - if (ally_forces>=1) then a1="Joining your forces are 10 Techpriests and 20 Skitarii. Omnissian Power Axes come to life, crackling and popping with disruptive energy, and Conversion Beam Projectors are levelled to fire. The Tech-Guard are silent as they form a perimeter around their charges, at contrast with their loud litanies and Lingua-technis bursts."; +if ((ally > 0) && (ally_forces > 0)) { + if (ally == 3) { + if (ally_forces >= 1) { + a1 = "Joining your forces are 10 Techpriests and 20 Skitarii. Omnissian Power Axes come to life, crackling and popping with disruptive energy, and Conversion Beam Projectors are levelled to fire. The Tech-Guard are silent as they form a perimeter around their charges, at contrast with their loud litanies and Lingua-technis bursts."; + } } } - - // Player crap here -var p1,p2,p3,p4,p5,p6,p8,temp,temp2,temp3,temp4,temp5,temp6; -p1="";p2="";p3="";p4="";p5="";p6="";p8="";temp=0;temp2=0;temp3=0;temp4=0;temp5=0;temp6=0; -var d1,d2,d3,d4,d5,d6,d7,d8; -d1="";d2="";d3="";d4="";d5="";d6="";d7="";d8=""; - - -temp=scouts+tacticals+veterans+devastators+assaults+librarians; -temp+=techmarines+honors+dreadnoughts+terminators+captains; -temp+=standard_bearers+champions+important_dudes+chaplains+apothecaries; -temp+=sgts+vet_sgts +var p1, p2, p3, p4, p5, p6, p8, temp, temp2, temp3, temp4, temp5, temp6; +p1 = ""; +p2 = ""; +p3 = ""; +p4 = ""; +p5 = ""; +p6 = ""; +p8 = ""; +temp = 0; +temp2 = 0; +temp3 = 0; +temp4 = 0; +temp5 = 0; +temp6 = 0; +var d1, d2, d3, d4, d5, d6, d7, d8; +d1 = ""; +d2 = ""; +d3 = ""; +d4 = ""; +d5 = ""; +d6 = ""; +d7 = ""; +d8 = ""; + +temp = scouts + tacticals + veterans + devastators + assaults + librarians; +temp += techmarines + honors + dreadnoughts + terminators + captains; +temp += standard_bearers + champions + important_dudes + chaplains + apothecaries; +temp += sgts + vet_sgts; var color_descr; -color_descr=""; +color_descr = ""; -if (obj_ini.main_color!=obj_ini.secondary_color) then color_descr=string(obj_controller.col[obj_ini.main_color])+" and "+string(obj_controller.col[obj_ini.secondary_color]); -if (obj_ini.main_color=obj_ini.secondary_color) then color_descr=string(obj_controller.col[obj_ini.main_color]); +if (obj_ini.main_color != obj_ini.secondary_color) { + color_descr = string(obj_controller.col[obj_ini.main_color]) + " and " + string(obj_controller.col[obj_ini.secondary_color]); +} +if (obj_ini.main_color == obj_ini.secondary_color) { + color_descr = string(obj_controller.col[obj_ini.main_color]); +} /*show_message(scouts+tacticals+veterans+devastators+assaults+librarians); show_message(techmarines+honors+dreadnoughts+terminators+captains); @@ -33,45 +55,54 @@ show_message(standard_bearers+important_dudes+chaplains+apothecaries); show_message(temp);*/ // Random variations; dark out, rain pooling down, dawn shining off of the armour, etc. -var variation;variation=""; -variation=choose("","dawn","rain"); - +var variation; +variation = ""; +variation = choose("", "dawn", "rain"); -if (battle_special="ship_demon"){ - p1="As the Artifact is smashed and melted down some foul smoke begins to erupt from it, spilling outward and upward. After a sparse handful of seconds it takes form into a "; - p1+=string(obj_enunit.dudes[1]); - p1+=". Now free, it seems bent upon slaying your marines. Onboard you have "; +if (battle_special == "ship_demon") { + p1 = "As the Artifact is smashed and melted down some foul smoke begins to erupt from it, spilling outward and upward. After a sparse handful of seconds it takes form into a "; + p1 += string(obj_enunit.dudes[1]); + p1 += ". Now free, it seems bent upon slaying your marines. Onboard you have "; } -if (battle_special="ruins") or (battle_special="ruins_eldar"){ - p1="Your marines place themselves into a proper fighting position, defensible and ready to fight whatever may come. Enemies may only come from a few directions, though the ancient corridors and alleyways are massive, and provide little cover."; - p1+=" You have "; +if ((battle_special == "ruins") || (battle_special == "ruins_eldar")) { + p1 = "Your marines place themselves into a proper fighting position, defensible and ready to fight whatever may come. Enemies may only come from a few directions, though the ancient corridors and alleyways are massive, and provide little cover."; + p1 += " You have "; } -if (string_count("mech",battle_special)>0){ - p1="Large, hulking shapes advance upon your men from every direction. The metal corridors and blast chambers prevent escape. Soon 4 Thallax and half a dozen Praetorian Servitors can be seen, with undoubtably more to come."; - p1+=" You have "; +if (string_count("mech", battle_special) > 0) { + p1 = "Large, hulking shapes advance upon your men from every direction. The metal corridors and blast chambers prevent escape. Soon 4 Thallax and half a dozen Praetorian Servitors can be seen, with undoubtably more to come."; + p1 += " You have "; } -if (battle_special="space_hulk"){ - if (hulk_forces>0) then p1="Your marines maneuver through the hull of the Space Hulk, shadows dancing and twisting before their luxcasters. The hallway integrity is non-existent – twisted metal juts out in hazardous ways or opens into bottomless pits. Still, there is loot and knowledge to be gained. It is not long before your men's sensorium pick up hostile blips. Your own forces are made up of "; - if (hulk_forces=0) then p1="Your marines maneuver through the hull of the Space Hulk, shadows dancing and twisting before their luxcasters. The hallway integrity is non-existent – twisted metal juts out in hazardous ways or opens into bottomless pits. Your forces are made up of "; +if (battle_special == "space_hulk") { + if (hulk_forces > 0) { + p1 = "Your marines maneuver through the hull of the Space Hulk, shadows dancing and twisting before their luxcasters. The hallway integrity is non-existent – twisted metal juts out in hazardous ways or opens into bottomless pits. Still, there is loot and knowledge to be gained. It is not long before your men's sensorium pick up hostile blips. Your own forces are made up of "; + } + if (hulk_forces == 0) { + p1 = "Your marines maneuver through the hull of the Space Hulk, shadows dancing and twisting before their luxcasters. The hallway integrity is non-existent – twisted metal juts out in hazardous ways or opens into bottomless pits. Your forces are made up of "; + } } - -if (battle_special=""){ - if (dropping=0){ - if (temp-dreadnoughts>0){ - if (variation=""){p1="Dirt crunches beneath the soles of "+string(temp)+" "+string(global.chapter_name)+" as they form up. Your ranks are made up of ";} - if (variation="rain"){p1="Rain pelts the ground and fogs the air, partly veiling the "+string(temp)+" "+string(global.chapter_name)+". Your ranks are made up of ";} - if (variation="dawn"){p1="The bright light of dawn reflects off the "+string_lower(color_descr)+" ceremite of "+string(temp)+" "+string(global.chapter_name)+". Your ranks are made up of ";} +if (battle_special == "") { + if (dropping == 0) { + if (temp - dreadnoughts > 0) { + if (variation == "") { + p1 = "Dirt crunches beneath the soles of " + string(temp) + " " + string(global.chapter_name) + " as they form up. Your ranks are made up of "; + } + if (variation == "rain") { + p1 = "Rain pelts the ground and fogs the air, partly veiling the " + string(temp) + " " + string(global.chapter_name) + ". Your ranks are made up of "; + } + if (variation == "dawn") { + p1 = "The bright light of dawn reflects off the " + string_lower(color_descr) + " ceremite of " + string(temp) + " " + string(global.chapter_name) + ". Your ranks are made up of "; + } } } - if (dropping=1){ - if (temp-dreadnoughts>0){// lyman - p1="The air rumbles and quakes as "+string(temp)+" "+string(global.chapter_name)+" descend in drop-pods. "; - - + if (dropping == 1) { + if (temp - dreadnoughts > 0) { + // lyman + p1 = "The air rumbles and quakes as " + string(temp) + " " + string(global.chapter_name) + " descend in drop-pods. "; + /*if (variation=""){ if (lyman=0) then p1="The air rumbles and quakes as "+string(temp)+" "+string(global.chapter_name)+" descend in drop-pods. Before the enemy can bring their full ranged power to bear the pods smash down. With practiced speed your marines pour on free. Their ranks are made up of "; if (lyman=1) then p1="The air rumbles and quakes as "+string(temp)+" "+string(global.chapter_name)+" descend in drop-pods. Before the enemy can bring their full ranged power to bear the pods smash down. Your marines exit the vehicles, shaking off their vertigo and nausea with varying degrees of success. Your ranks are made up of "; @@ -80,229 +111,353 @@ if (battle_special=""){ } } } -if (string_count("spyrer",battle_special)>0){ - p1="Your marines search through the alleyways and corridors likely to contain the Spyrer. It does not take long before the lunatic attacks, springing off from a wall to fall among your men. Your ranks are made up of "; +if (string_count("spyrer", battle_special) > 0) { + p1 = "Your marines search through the alleyways and corridors likely to contain the Spyrer. It does not take long before the lunatic attacks, springing off from a wall to fall among your men. Your ranks are made up of "; } -if (string_count("protect_raiders",battle_special)>0){ - p1="Following responses from scans, Your marine squad deploys and lies in wait on the planets surface. Either the eldar were expecting you or the scope of the raids on the planet had been underplayed by the governor perhaps to hide his incompetence in allowing such foul xenos actions to persist unchecked for so long."; +if (string_count("protect_raiders", battle_special) > 0) { + p1 = "Following responses from scans, Your marine squad deploys and lies in wait on the planets surface. Either the eldar were expecting you or the scope of the raids on the planet had been underplayed by the governor perhaps to hide his incompetence in allowing such foul xenos actions to persist unchecked for so long."; } -if (string_count("fallen",battle_special)>0){ - p1="Your marines search through the alleyways and dens likely to contain the Fallen. Several days pass before the search is succesful; the prey is located by Auspex and closed in upon. "; - if (battle_climate="Lava") then p1="Your marines search through the broken craggs and spires of the molten planet. Among the bubbling lava, and cracking earth, they search for the Fallen. After several days of searching Auspex detect the prey. "; - if (battle_climate="Dead") then p1="Your marines search through the cratered surface of the debris field. Among the cracking earth and dust they search for the Fallen. After several days of searching Auspex detect the prey. "; - if (battle_climate="Agri") then p1="Endless fields of wheat and barley are an unlikely harbor for a renegade, but your marines search the agri world all the same. After several days of searching Auspex detect the prey. "; - if (battle_climate="Death") then p1="Deadly carniverous plants and endless canopy blot out the surface of the planet. Among the disheveled hills, and heavy underbrush, your marines search for the Fallen. After several days of searching Auspex detect the prey. "; - if (battle_climate="Ice") then p1="Your marines search through the endless glaciers and peaks of the frozen planet. Among the howling wind, and cracking ice, they search for the Fallen. After several days of searching Auspex detect the prey. "; - if (obj_enunit.dudes_num[1]=1) then p1+="The coward soon realizes he has been located, and reacts like a cornered animal, brandishing weapons."; - if (obj_enunit.dudes_num[1]>1) then p1+="The cowards soon realize they have been located, and react like cornered animals, brandishing weapons."; - p1+=" Your ranks are made up of "; +if (string_count("fallen", battle_special) > 0) { + p1 = "Your marines search through the alleyways and dens likely to contain the Fallen. Several days pass before the search is succesful; the prey is located by Auspex and closed in upon. "; + if (battle_climate == "Lava") { + p1 = "Your marines search through the broken craggs and spires of the molten planet. Among the bubbling lava, and cracking earth, they search for the Fallen. After several days of searching Auspex detect the prey. "; + } + if (battle_climate == "Dead") { + p1 = "Your marines search through the cratered surface of the debris field. Among the cracking earth and dust they search for the Fallen. After several days of searching Auspex detect the prey. "; + } + if (battle_climate == "Agri") { + p1 = "Endless fields of wheat and barley are an unlikely harbor for a renegade, but your marines search the agri world all the same. After several days of searching Auspex detect the prey. "; + } + if (battle_climate == "Death") { + p1 = "Deadly carniverous plants and endless canopy blot out the surface of the planet. Among the disheveled hills, and heavy underbrush, your marines search for the Fallen. After several days of searching Auspex detect the prey. "; + } + if (battle_climate == "Ice") { + p1 = "Your marines search through the endless glaciers and peaks of the frozen planet. Among the howling wind, and cracking ice, they search for the Fallen. After several days of searching Auspex detect the prey. "; + } + if (obj_enunit.dudes_num[1] == 1) { + p1 += "The coward soon realizes he has been located, and reacts like a cornered animal, brandishing weapons."; + } + if (obj_enunit.dudes_num[1] > 1) { + p1 += "The cowards soon realize they have been located, and react like cornered animals, brandishing weapons."; + } + p1 += " Your ranks are made up of "; } +if (string_count("_attack", battle_special) > 0) { + var wh; + wh = choose(1, 2); + if (wh == 1) { + p1 = "Cave dirt crunches beneath the soles of your marines as they continue their descent. There is little warning before "; + } + if (wh == 2) { + p1 = "The shadows stretch and morph as the lights cast by your marines move along. One large shadow begins to move on its own- "; + } + if (string_count("wake", battle_special) > 0) { + p1 = "Cave dirt crunches beneath the soles of your marines as they continue their descent. There is little warning when the ground begins to shake. An old, dusty breeze seems to flow through the tunnel, followed by rumbling sensations and distant mechanical sounds. "; + if (string_count("1", battle_special) > 0) { + p1 += "Within minutes Necrons begin to appear from every direction. There appears to be nearly fourty, cramped in the dark tunnels."; + } + if (string_count("2", battle_special) > 0) { + p1 += "Within minutes Necrons begin to appear from every direction. There appears to be nearly a hundred, cramped in the dark tunnels."; + } + if (string_count("3", battle_special) > 0) { + p1 += "Within minutes Necrons begin to appear from every direction. Their numbers are wihout number."; + } + } - - - - -if (string_count("_attack",battle_special)>0){ - var wh;wh=choose(1,2); - if (wh=1) then p1="Cave dirt crunches beneath the soles of your marines as they continue their descent. There is little warning before "; - if (wh=2) then p1="The shadows stretch and morph as the lights cast by your marines move along. One large shadow begins to move on its own- "; - - if (string_count("wake",battle_special)>0){ - p1="Cave dirt crunches beneath the soles of your marines as they continue their descent. There is little warning when the ground begins to shake. An old, dusty breeze seems to flow through the tunnel, followed by rumbling sensations and distant mechanical sounds. "; - if (string_count("1",battle_special)>0) then p1+="Within minutes Necrons begin to appear from every direction. There appears to be nearly fourty, cramped in the dark tunnels."; - if (string_count("2",battle_special)>0) then p1+="Within minutes Necrons begin to appear from every direction. There appears to be nearly a hundred, cramped in the dark tunnels."; - if (string_count("3",battle_special)>0) then p1+="Within minutes Necrons begin to appear from every direction. Their numbers are wihout number."; + if (string_count("wraith", battle_special) > 0) { + p1 += "two Necron Wraiths appear out of nowhere and begin to attack."; } - - - - - if (string_count("wraith",battle_special)>0) then p1+="two Necron Wraiths appear out of nowhere and begin to attack."; - if (string_count("spyder",battle_special)>0) then p1+="a large Canoptek Spyder launches towards your marines, a small group of scuttling Scarabs quickly following."; - if (string_count("stalker",battle_special)>0) then p1+="the tunnel begins to shake and a massive Tomb Stalker scuttles into your midst."; - newline=p1; + if (string_count("spyder", battle_special) > 0) { + p1 += "a large Canoptek Spyder launches towards your marines, a small group of scuttling Scarabs quickly following."; + } + if (string_count("stalker", battle_special) > 0) { + p1 += "the tunnel begins to shake and a massive Tomb Stalker scuttles into your midst."; + } + newline = p1; scr_newtext(); exit; } - - - - - -if (tacticals>0) and (veterans>0){ - p2=string(tacticals+veterans)+" "+string(obj_ini.role[100][8])+"s, "; +if ((tacticals > 0) && (veterans > 0)) { + p2 = string(tacticals + veterans) + " " + string(obj_ini.role[100][8]) + "s, "; } -if (tacticals>0) and (veterans=0){ - if (tacticals=1) then p2=string(tacticals)+" "+string(obj_ini.role[100][8])+", "; - if (tacticals>1) then p2=string(tacticals)+" "+string(obj_ini.role[100][8])+"s, "; +if ((tacticals > 0) && (veterans == 0)) { + if (tacticals == 1) { + p2 = string(tacticals) + " " + string(obj_ini.role[100][8]) + ", "; + } + if (tacticals > 1) { + p2 = string(tacticals) + " " + string(obj_ini.role[100][8]) + "s, "; + } } -if (tacticals=0) and (veterans>0){ - if (veterans=1) then p2=string(veterans)+" "+string(obj_ini.role[100][3])+", "; - if (veterans>1) then p2=string(veterans)+" "+string(obj_ini.role[100][3])+"s, "; +if ((tacticals == 0) && (veterans > 0)) { + if (veterans == 1) { + p2 = string(veterans) + " " + string(obj_ini.role[100][3]) + ", "; + } + if (veterans > 1) { + p2 = string(veterans) + " " + string(obj_ini.role[100][3]) + "s, "; + } } -if (assaults>0){ - if (assaults=1) then p2+=string(assaults)+" "+string(obj_ini.role[100][10])+", "; - if (assaults>1) then p2+=string(assaults)+" "+string(obj_ini.role[100][10])+"s, "; +if (assaults > 0) { + if (assaults == 1) { + p2 += string(assaults) + " " + string(obj_ini.role[100][10]) + ", "; + } + if (assaults > 1) { + p2 += string(assaults) + " " + string(obj_ini.role[100][10]) + "s, "; + } } -if (devastators>0){ - if (devastators=1) then p2+=string(devastators)+" "+string(obj_ini.role[100][9])+", "; - if (devastators>1) then p2+=string(devastators)+" "+string(obj_ini.role[100][9])+"s, "; +if (devastators > 0) { + if (devastators == 1) { + p2 += string(devastators) + " " + string(obj_ini.role[100][9]) + ", "; + } + if (devastators > 1) { + p2 += string(devastators) + " " + string(obj_ini.role[100][9]) + "s, "; + } } -if (temp<200) and (terminators>0){ - if (terminators=1) then p2+=string(terminators)+" Terminator, "; - if (terminators>1) then p2+=string(terminators)+" Terminators, "; +if ((temp < 200) && (terminators > 0)) { + if (terminators == 1) { + p2 += string(terminators) + " Terminator, "; + } + if (terminators > 1) { + p2 += string(terminators) + " Terminators, "; + } } -if (temp<200) and (chaplains>0){ - if (chaplains=1) then p2+=string(chaplains)+" "+string(obj_ini.role[100][14])+", "; - if (chaplains>1) then p2+=string(chaplains)+" "+string(obj_ini.role[100][14])+", "; +if ((temp < 200) && (chaplains > 0)) { + if (chaplains == 1) { + p2 += string(chaplains) + " " + string(obj_ini.role[100][14]) + ", "; + } + if (chaplains > 1) { + p2 += string(chaplains) + " " + string(obj_ini.role[100][14]) + ", "; + } } -if (temp<200) and (apothecaries>0){ - if (apothecaries=1) then p2+=string(apothecaries)+" "+string(obj_ini.role[100][15])+", "; - if (apothecaries>1) then p2+=string(apothecaries)+" "+string(obj_ini.role[100][15])+", "; +if ((temp < 200) && (apothecaries > 0)) { + if (apothecaries == 1) { + p2 += string(apothecaries) + " " + string(obj_ini.role[100][15]) + ", "; + } + if (apothecaries > 1) { + p2 += string(apothecaries) + " " + string(obj_ini.role[100][15]) + ", "; + } } -if (temp<200) and (librarians>0){ - if (librarians=1) then p2+=string(librarians)+" "+string(obj_ini.role[100,17])+", "; - if (librarians>1) then p2+=string(librarians)+" "+string(obj_ini.role[100,17])+", "; +if ((temp < 200) && (librarians > 0)) { + if (librarians == 1) { + p2 += string(librarians) + " " + string(obj_ini.role[100][17]) + ", "; + } + if (librarians > 1) { + p2 += string(librarians) + " " + string(obj_ini.role[100][17]) + ", "; + } } -if (temp<200) and (techmarines>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][16])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][16])+", "; +if ((temp < 200) && (techmarines > 0)) { + if (techmarines == 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][16]) + ", "; + } + if (techmarines > 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][16]) + ", "; + } } -if (temp<200) and (sgts>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][18])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][18])+", "; +if ((temp < 200) && (sgts > 0)) { + if (techmarines == 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][18]) + ", "; + } + if (techmarines > 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][18]) + ", "; + } } -if (temp<200) and (vet_sgts>0){ - if (techmarines=1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][19])+", "; - if (techmarines>1) then p2+=string(techmarines)+" "+string(obj_ini.role[100][19])+", "; +if ((temp < 200) && (vet_sgts > 0)) { + if (techmarines == 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][19]) + ", "; + } + if (techmarines > 1) { + p2 += string(techmarines) + " " + string(obj_ini.role[100][19]) + ", "; + } } - -if (scouts>0){ - if (scouts=1) then p2+=string(scouts)+" "+string(obj_ini.role[100][12])+", "; - if (scouts>1) then p2+=string(scouts)+" "+string(obj_ini.role[100][12])+"s, "; +if (scouts > 0) { + if (scouts == 1) { + p2 += string(scouts) + " " + string(obj_ini.role[100][12]) + ", "; + } + if (scouts > 1) { + p2 += string(scouts) + " " + string(obj_ini.role[100][12]) + "s, "; + } } - // temp5=string_length(p2);p2=string_delete(p2,temp5-1,2);// p2+="."; -temp6=honors+captains+important_dudes+standard_bearers; -if (temp>=200) then temp6+=terminators; -if (temp>=200) then temp6+=chaplains; -if (temp>=200) then temp6+=apothecaries; -if (temp>=200) then temp6+=techmarines; -if (temp>=200) then temp6+=librarians; -if (temp6>0) then p2+=string(temp6)+" other various Astartes, "; +temp6 = honors + captains + important_dudes + standard_bearers; +if (temp >= 200) { + temp6 += terminators; +} +if (temp >= 200) { + temp6 += chaplains; +} +if (temp >= 200) { + temp6 += apothecaries; +} +if (temp >= 200) { + temp6 += techmarines; +} +if (temp >= 200) { + temp6 += librarians; +} +if (temp6 > 0) { + p2 += string(temp6) + " other various Astartes, "; +} -var woo;woo=string_length(p2); -p2=string_delete(p2,woo-1,2); +var woo; +woo = string_length(p2); +p2 = string_delete(p2, woo - 1, 2); -if (string_count(", ",p2)>1){ - var woo;woo=string_rpos(", ",p2); - p2=string_insert(" and",p2,woo+1); +if (string_count(", ", p2) > 1) { + var woo; + woo = string_rpos(", ", p2); + p2 = string_insert(" and", p2, woo + 1); } -if (string_count(", ",p2)=1){ - var woo;woo=string_rpos(", ",p2); - p2=string_delete(p2,woo-1,2); - p2=string_insert(" and",p2,woo+1); +if (string_count(", ", p2) == 1) { + var woo; + woo = string_rpos(", ", p2); + p2 = string_delete(p2, woo - 1, 2); + p2 = string_insert(" and", p2, woo + 1); } -p2+="."; - +p2 += "."; +if ((standard_bearers > 1) && (dropping == 0)) { + p5 = " Chapter Ancients hold your Chapter heraldry high and proud."; +} +if (dreadnoughts + predators + land_raiders > 3) { + p6 = " Forming up the armoured division is "; + if (dreadnoughts == 1) { + p6 += string(dreadnoughts) + " " + string(obj_ini.role[100][6]) + ", "; + } + if (dreadnoughts > 1) { + p6 += string(dreadnoughts) + " " + string(obj_ini.role[100][6]) + "s, "; + } + if (rhinos == 1) { + p6 += string(rhinos) + " Rhino, "; + } + if (rhinos > 1) { + p6 += string(rhinos) + " Rhinos, "; + } -if (standard_bearers>1) and (dropping=0) then p5=" Chapter Ancients hold your Chapter heraldry high and proud."; + if (predators == 1) { + p6 += string(predators) + " Predator, "; + } + if (predators > 1) { + p6 += string(predators) + " Predators, "; + } + if (land_raiders == 1) { + p6 += string(land_raiders) + " Land Raider, "; + } + if (land_raiders > 1) { + p6 += string(land_raiders) + " Land Raiders, "; + } + if (land_speeders == 1) { + p6 += string(land_speeders) + " Land Speeder, "; + } + if (land_speeders > 1) { + p6 += string(land_speeders) + " Land Speeders, "; + } -if (dreadnoughts+predators+land_raiders>3){ - p6=" Forming up the armoured division is "; - if (dreadnoughts=1) then p6+=string(dreadnoughts)+" "+string(obj_ini.role[100][6])+", "; - if (dreadnoughts>1) then p6+=string(dreadnoughts)+" "+string(obj_ini.role[100][6])+"s, "; - - if (rhinos=1) then p6+=string(rhinos)+" Rhino, "; - if (rhinos>1) then p6+=string(rhinos)+" Rhinos, "; - - if (predators=1) then p6+=string(predators)+" Predator, "; - if (predators>1) then p6+=string(predators)+" Predators, "; - - if (land_raiders=1) then p6+=string(land_raiders)+" Land Raider, "; - if (land_raiders>1) then p6+=string(land_raiders)+" Land Raiders, "; + if (whirlwinds == 1) { + p6 += string(whirlwinds) + " Whirlwind, "; + } + if (whirlwinds > 1) { + p6 += string(whirlwinds) + " Whirlwinds, "; + } - if (land_speeders=1) then p6+=string(land_speeders)+" Land Speeder, "; - if (land_speeders>1) then p6+=string(land_speeders)+" Land Speeders, "; - - - if (whirlwinds=1) then p6+=string(whirlwinds)+" Whirlwind, "; - if (whirlwinds>1) then p6+=string(whirlwinds)+" Whirlwinds, "; - // Other vehicles here? - - var woo;woo=string_length(p6); - p6=string_delete(p6,woo-1,2); - - if (string_count(", ",p6)>1){ - var woo;woo=string_rpos(", ",p6); - p6=string_insert(" and",p6,woo+1); - } - if (string_count(", ",p6)=1){ - var woo;woo=string_rpos(", ",p6); - p6=string_delete(p6,woo-1,2); - p6=string_insert(" and",p6,woo+1); - } - p6+="."; - + + var woo; + woo = string_length(p6); + p6 = string_delete(p6, woo - 1, 2); + + if (string_count(", ", p6) > 1) { + var woo; + woo = string_rpos(", ", p6); + p6 = string_insert(" and", p6, woo + 1); + } + if (string_count(", ", p6) == 1) { + var woo; + woo = string_rpos(", ", p6); + p6 = string_delete(p6, woo - 1, 2); + p6 = string_insert(" and", p6, woo + 1); + } + p6 += "."; } // If less than three spell out the individual vehicles +if (battle_special == "space_hulk") { + newline = p1 + p2; + scr_newtext(); + if (a1 != "") { + newline = a1; + scr_newtext(); + } + if (hulk_forces > 0) { + newline = "There are " + string(hulk_forces) + " or so blips."; + scr_newtext(); + } -if (battle_special="space_hulk"){ - newline=p1+p2;scr_newtext(); - if (a1!=""){newline=a1;scr_newtext();} - if (hulk_forces>0){newline="There are "+string(hulk_forces)+" or so blips.";scr_newtext();} - exit; } -if (dropping=0){ - newline=p1+p2+p3+p4+p5+p6; +if (dropping == 0) { + newline = p1 + p2 + p3 + p4 + p5 + p6; scr_newtext(); - if (a1!=""){newline=a1;scr_newtext();} + if (a1 != "") { + newline = a1; + scr_newtext(); + } } -if (dropping=1) and (battle_special!="space_hulk"){ - d1=p1;d2=p2; - d3=p3;d4=p4; - d5=p5;d6=p6; -} - - -if (battle_special="ruins") or (battle_special="ruins_eldar"){ - newline="The enemy forces are made up of "+string(enemy_dudes); - - if (enemy=6) then newline+=" Craftworld Eldar."; - if (enemy=10) then newline+=" Cultists and Mutants."; - if (enemy=11) then newline+=" Chaos Space Marines."; - if (enemy=12) then newline+=" Daemons."; - - scr_newtext();exit; +if ((dropping == 1) && (battle_special != "space_hulk")) { + d1 = p1; + d2 = p2; + d3 = p3; + d4 = p4; + d5 = p5; + d6 = p6; } +if ((battle_special == "ruins") || (battle_special == "ruins_eldar")) { + newline = "The enemy forces are made up of " + string(enemy_dudes); + if (enemy == 6) { + newline += " Craftworld Eldar."; + } + if (enemy == 10) { + newline += " Cultists and Mutants."; + } + if (enemy == 11) { + newline += " Chaos Space Marines."; + } + if (enemy == 12) { + newline += " Daemons."; + } + scr_newtext(); + exit; +} // Enemy crap here var rand; -p1="";p2="";p3="";p4="";p5="";p6=""; -temp2=0;temp3=0;temp4=0;temp5=0; +p1 = ""; +p2 = ""; +p3 = ""; +p4 = ""; +p5 = ""; +p6 = ""; +temp2 = 0; +temp3 = 0; +temp4 = 0; +temp5 = 0; /*if (terrain=""){rand=choose(1,2,3);// Variations for terrain if (rand<4) then @@ -312,224 +467,425 @@ temp2=0;temp3=0;temp4=0;temp5=0; // p1+=string(enemy_dudes);// The number descriptor*/ - -if (enemy=2){ - p1="Opposing your forces are a total of "+scr_display_number(floor(guard_effective))+" Guardsmen, including Heavy Weapons and Armour."; - p2="";p3=""; +if (enemy == 2) { + p1 = "Opposing your forces are a total of " + scr_display_number(floor(guard_effective)) + " Guardsmen, including Heavy Weapons and Armour."; + p2 = ""; + p3 = ""; } - - -if (enemy=5) and (dropping=0){ - p1="Marching to face your forces "; - if (threat=1) then p2="are a squad of Adepta Sororitas, back up by a dozen priests. Forming up a protective shield around them are a large group of religious followers, gnashing and screaming out litanies to the Emperor."; - if (threat=2) then p2="are several squads of Adepta Sororitas. A large pack of religious followers forms up a protective shield in front, backed up by numerous Acro-Flagellents."; - if (threat=3) then p2="are more than four hundred Adepta Sororitas, thick clouds of incense and smoke heralding their advance. An equally massive pack of religious followers are spread around, screaming and babbling hyms to the Emperor. Many are already bleeding from self-inflicted wounds or flagellation. Several Penitent Engines clank and advance in the forefront."; - if (threat=4) then p2="are more than a thousand Adepta Sororitas, a large portion of an order, thick clouds of incense and smoke heralding their advance. A massive pack of religious followers are spread among the force, screaming and babbling hyms to the Emperor. Many are already bleeding from self-inflicted wounds or flagellation. Their voices are drowned out by the rumble of Penitent Engines and the loud vox-casters of Excorcists, blasting out litanies and organ music even more deafening volumes."; - if (threat>=5) then p2="is the entirety of an Adepta Sororitas order, the ground shaking beneath their combined thousands of footsteps. Forming a shield around them in a massive, massive pack of religious followers, screaming out or babbling hyms to the Emperor. All of the opposing army is a blurring, shifting mass of robes and ceremite, and sound, Ecclesiarchy Priests and Mistresses whipping the masses into more of a blood frenzy. Organ music and litanies blast from the many Exorcists, the sound deafening to those too close. Carried with the wind, and lingering in the air, is the heavy scent of promethium."; +if ((enemy == 5) && (dropping == 0)) { + p1 = "Marching to face your forces "; + if (threat == 1) { + p2 = "are a squad of Adepta Sororitas, back up by a dozen priests. Forming up a protective shield around them are a large group of religious followers, gnashing and screaming out litanies to the Emperor."; + } + if (threat == 2) { + p2 = "are several squads of Adepta Sororitas. A large pack of religious followers forms up a protective shield in front, backed up by numerous Acro-Flagellents."; + } + if (threat == 3) { + p2 = "are more than four hundred Adepta Sororitas, thick clouds of incense and smoke heralding their advance. An equally massive pack of religious followers are spread around, screaming and babbling hyms to the Emperor. Many are already bleeding from self-inflicted wounds or flagellation. Several Penitent Engines clank and advance in the forefront."; + } + if (threat == 4) { + p2 = "are more than a thousand Adepta Sororitas, a large portion of an order, thick clouds of incense and smoke heralding their advance. A massive pack of religious followers are spread among the force, screaming and babbling hyms to the Emperor. Many are already bleeding from self-inflicted wounds or flagellation. Their voices are drowned out by the rumble of Penitent Engines and the loud vox-casters of Excorcists, blasting out litanies and organ music even more deafening volumes."; + } + if (threat >= 5) { + p2 = "is the entirety of an Adepta Sororitas order, the ground shaking beneath their combined thousands of footsteps. Forming a shield around them in a massive, massive pack of religious followers, screaming out or babbling hyms to the Emperor. All of the opposing army is a blurring, shifting mass of robes and ceremite, and sound, Ecclesiarchy Priests and Mistresses whipping the masses into more of a blood frenzy. Organ music and litanies blast from the many Exorcists, the sound deafening to those too close. Carried with the wind, and lingering in the air, is the heavy scent of promethium."; + } } - -if (enemy=6) and (dropping=0){ +if ((enemy == 6) && (dropping == 0)) { // p1+=" Eldar";// Need a few random descriptors here - rand=choose(1,2,3); + rand = choose(1, 2, 3); } -if (enemy=7) and (dropping=0){ +if ((enemy == 7) && (dropping == 0)) { // p1+=" Orks"; - rand=choose(1,2,3); - if (rand<4){ - p1="Howls and grunts ring from the surrounding terrain as the Orks announce their presence. "; - p2=string(enemy_dudes)+", the bloodthirsty horde advances toward your Marines, ecstatic in their anticipation of carnage. "; - p3=p2;p2=string_delete(p2,2,999);p3=string_delete(p3,1,1);p2=string_upper(p2);// Capitalize the ENEMY DUDES first letter + rand = choose(1, 2, 3); + if (rand < 4) { + p1 = "Howls and grunts ring from the surrounding terrain as the Orks announce their presence. "; + p2 = string(enemy_dudes) + ", the bloodthirsty horde advances toward your Marines, ecstatic in their anticipation of carnage. "; + p3 = p2; + p2 = string_delete(p2, 2, 999); + p3 = string_delete(p3, 1, 1); + p2 = string_upper(p2); // Capitalize the ENEMY DUDES first letter } } -if (enemy=7) and (dropping=1){ - p1="The "+string(enemy_dudes)+"-some Orks howl and roar at the oncoming marines. Many of the beasts fire their weapons, more or less spraying rounds aimlessly into the sky."; +if ((enemy == 7) && (dropping == 1)) { + p1 = "The " + string(enemy_dudes) + "-some Orks howl and roar at the oncoming marines. Many of the beasts fire their weapons, more or less spraying rounds aimlessly into the sky."; } -if (enemy=8) and (dropping=0){ +if ((enemy == 8) && (dropping == 0)) { // p1+=" Tau"; - rand=choose(1,2,3); + rand = choose(1, 2, 3); } -if (enemy=9) and (dropping=0){ +if ((enemy == 9) && (dropping == 0)) { // p1+=" Tyranids"; - rand=choose(1,2,3); + rand = choose(1, 2, 3); } -if (enemy=9) and (dropping=1){ - p1="The "+string(enemy_dudes)+"-some Tyranids hiss and chitter as your marines rain down. Blasts of acid and spikes fill the sky, but none seem to quite find their mark."; +if ((enemy == 9) && (dropping == 1)) { + p1 = "The " + string(enemy_dudes) + "-some Tyranids hiss and chitter as your marines rain down. Blasts of acid and spikes fill the sky, but none seem to quite find their mark."; } -if (enemy=10) and (dropping=0){ +if ((enemy == 10) && (dropping == 0)) { // p1+=" heretics"; - rand=choose(1,2,3); + rand = choose(1, 2, 3); } - -if (enemy=10) and (threat=7){ - rand=choose(1,2); - if (rand=1) then p1="Laying before them is a hellish landscape, fitting for nightmares. Twisted, flesh-like spires reach for the sky, each containing a multitude of fanged maws or eyes. Lightning crackles through the red sky. "; - if (rand=2) then p1="Waiting for your marines is a twisted landscape. Mutated, fleshy spires reach for the sky. The ground itself is made up of choking purple ash, kicked up with each footstep, blocking vision. "; - p1+="All that can be seen twists and shifts, as though looking through a massive, distorted lens. "; - p8="The enemy forces are made up of over 3000 lesser Daemons. Their front and rear ranks are made up of Maulerfiends and Soulgrinders, backed up by nearly a dozen Greater Daemons. Each of the four Chaos Gods are represented."; +if ((enemy == 10) && (threat == 7)) { + rand = choose(1, 2); + if (rand == 1) { + p1 = "Laying before them is a hellish landscape, fitting for nightmares. Twisted, flesh-like spires reach for the sky, each containing a multitude of fanged maws or eyes. Lightning crackles through the red sky. "; + } + if (rand == 2) { + p1 = "Waiting for your marines is a twisted landscape. Mutated, fleshy spires reach for the sky. The ground itself is made up of choking purple ash, kicked up with each footstep, blocking vision. "; + } + p1 += "All that can be seen twists and shifts, as though looking through a massive, distorted lens. "; + p8 = "The enemy forces are made up of over 3000 lesser Daemons. Their front and rear ranks are made up of Maulerfiends and Soulgrinders, backed up by nearly a dozen Greater Daemons. Each of the four Chaos Gods are represented."; } -if (enemy=11) and (dropping=0){ +if ((enemy == 11) && (dropping == 0)) { // p1+=" Chaos Space Marines"; - rand=choose(1,2,3); + rand = choose(1, 2, 3); } -if (enemy=12) and (dropping=0){ +if ((enemy == 12) && (dropping == 0)) { // Daemons } -if (enemy=13) and (dropping=0){ - rand=choose(1,2,3); - if (rand<4){ - p1="Dirt crunches beneath the feet of the Necrons as they make their silent advance. "; - p2=string(enemy_dudes)+", the souless xeno advance toward your Marines, silent and pulsing with green energy. "; - p3=p2;p2=string_delete(p2,2,999);p3=string_delete(p3,1,1);p2=string_upper(p2);// Capitalize the ENEMY DUDES first letter +if ((enemy == 13) && (dropping == 0)) { + rand = choose(1, 2, 3); + if (rand < 4) { + p1 = "Dirt crunches beneath the feet of the Necrons as they make their silent advance. "; + p2 = string(enemy_dudes) + ", the souless xeno advance toward your Marines, silent and pulsing with green energy. "; + p3 = p2; + p2 = string_delete(p2, 2, 999); + p3 = string_delete(p3, 1, 1); + p2 = string_upper(p2); // Capitalize the ENEMY DUDES first letter } } - -if (dropping=0){ - newline=p1+p2+p3+p4+p5+p6; +if (dropping == 0) { + newline = p1 + p2 + p3 + p4 + p5 + p6; scr_newtext(); - if (a1!=""){newline=a1;scr_newtext();} - if (p8!=""){newline=p8;scr_newtext();} + if (a1 != "") { + newline = a1; + scr_newtext(); + } + if (p8 != "") { + newline = p8; + scr_newtext(); + } } -if (dropping=1){ - newline=d1+p1;scr_newtext(); - if (lyman=0) then d7="After a brief descent all of the drop-pods smash down, followed quickly by your marines pouring free. Their ranks are made up of "; - if (lyman=1) then d7="After a brief descent all of the drop-pods smash down. Your marines exit the vehicles, shaking off their vertigo and nausea with varying degrees of success. Their ranks are made up of "; - newline=d7+d2+d3+d4+d5+d6;scr_newtext(); - if (a1!=""){newline=a1;scr_newtext();} - if (p8!=""){newline=p8;scr_newtext();} +if (dropping == 1) { + newline = d1 + p1; + scr_newtext(); + if (lyman == 0) { + d7 = "After a brief descent all of the drop-pods smash down, followed quickly by your marines pouring free. Their ranks are made up of "; + } + if (lyman == 1) { + d7 = "After a brief descent all of the drop-pods smash down. Your marines exit the vehicles, shaking off their vertigo and nausea with varying degrees of success. Their ranks are made up of "; + } + newline = d7 + d2 + d3 + d4 + d5 + d6; + scr_newtext(); + if (a1 != "") { + newline = a1; + scr_newtext(); + } + if (p8 != "") { + newline = p8; + scr_newtext(); + } } - - - -if (occulobe=1) and (battle_special!="space_hulk"){ - if (time=5) or (time=6){ - newline="The morning light of dawn is blinding your marines!";newline_color="red";scr_newtext(); +if ((occulobe == 1) && (battle_special != "space_hulk")) { + if ((time == 5) || (time == 6)) { + newline = "The morning light of dawn is blinding your marines!"; + newline_color = "red"; + scr_newtext(); } } +if ((fortified > 1) && (dropping == 0) && (enemy + threat != 17)) { + if (fortified == 2) { + newline = "An Aegis Defense Line protects your forces."; + } + if (fortified == 3) { + newline = "Thick plasteel walls protect your forces."; + } + if (fortified == 4) { + newline = "A series of thick plasteel walls protect your forces."; + } + if (fortified >= 5) { + newline = "A massive plasteel bastion protects your forces."; + } + if ((player_defenses > 0) && (player_silos > 0)) { + newline += " The front of your Monastery also boasts " + string(player_defenses) + " Weapon Emplacements and " + string(player_silos) + " Missile Silos."; + } + if ((player_defenses == 0) && (player_silos > 0)) { + newline += " Your Monastery also boasts " + string(player_silos) + " Missile Silos."; + } + if ((player_defenses > 0) && (player_silos == 0)) { + newline += " The front of your Monastery also boasts " + string(player_defenses) + " Weapon Emplacements."; + } -if (fortified>1) and (dropping=0) and (enemy+threat!=17){ - if (fortified=2) then newline="An Aegis Defense Line protects your forces."; - if (fortified=3) then newline="Thick plasteel walls protect your forces."; - if (fortified=4) then newline="A series of thick plasteel walls protect your forces."; - if (fortified>=5) then newline="A massive plasteel bastion protects your forces."; - - if (player_defenses>0) and (player_silos>0) then newline+=" The front of your Monastery also boasts "+string(player_defenses)+" Weapon Emplacements and "+string(player_silos)+" Missile Silos."; - if (player_defenses=0) and (player_silos>0) then newline+=" Your Monastery also boasts "+string(player_silos)+" Missile Silos."; - if (player_defenses>0) and (player_silos=0) then newline+=" The front of your Monastery also boasts "+string(player_defenses)+" Weapon Emplacements."; - scr_newtext(); } +// Check for battlecry here +// if (temp>=100) and (threat>1) and (big_mofo!=10) and (dropping=0){ +if ((temp >= 100) && (threat > 1) && (big_mofo > 0) && (big_mofo < 10) && (dropping == 0)) { + p1 = ""; + p2 = ""; + p3 = ""; + p4 = ""; + p5 = ""; + p6 = ""; + temp4 = 0; + temp5 = 0; + + if (big_mofo == 1) { + p1 = "You "; + } + if (big_mofo == 2) { + p1 = "The Master of Sanctity "; + } + if (big_mofo == 3) { + p1 = "Chief " + string(obj_ini.role[100][17]) + " "; + } + if (big_mofo == 5) { + p1 = "A Captain "; + } + if (big_mofo == 8) { + p1 = "A Chaplain "; + } + var standard_cry; + standard_cry = 0; + if (global.chapter_name == "Salamanders") { + standard_cry = 1; + var rand; + rand = choose(1, 2, 3, 4, 5); + if ((rand == 1) && (big_mofo != 1)) { + p2 = "breaks the silence, begining the Chapter Battlecry-"; + } + if ((rand == 1) && (big_mofo == 1)) { + p2 = "break the silence, begining the Chapter Battlecry-"; + } + if ((rand == 2) && (big_mofo != 1)) { + p2 = "roars the first half of the Chapter Battlecry-"; + } + if ((rand == 2) && (big_mofo == 1)) { + p2 = "roar the first half of the Chapter Battlecry-"; + } + if ((rand == 3) && (big_mofo != 1)) { + p2 = "shouts the start of the Chapter Battlecry-"; + } + if ((rand == 3) && (big_mofo == 1)) { + p2 = "shout the start of the Chapter Battlecry-"; + } + if ((rand == 4) && (big_mofo != 1)) { + p2 = "calls out to your marines-"; + } + if ((rand == 4) && (big_mofo == 1)) { + p2 = "call out to your marines-"; + } + if ((rand == 5) && (big_mofo != 1)) { + p2 = "roars to your marines-"; + } + if ((rand == 5) && (big_mofo == 1)) { + p2 = "roar to your marines-"; + } + p3 = "''Into the fires of battle!''"; + if ((temp >= 100) && (temp < 200)) { + p4 = "Over a hundred Astartes roar in return, their voice one-"; + } + if ((temp >= 200) && (temp < 400)) { + p4 = "Several hundred Astartes roar in return, their voice one-"; + } + if ((temp >= 500) && (temp < 800)) { + p4 = "Your battle brothers echoe the cry, a massive sound felt more than heard-"; + } + if (temp > 800) { + p4 = "The sound is deafening as the " + string(global.chapter_name) + " shout in unison-"; + } + p5 = "''UNTO THE ANVIL OF WAR!''"; + newline = p1 + p2; + scr_newtext(); + newline = p3; + scr_newtext(); + newline = p4; + scr_newtext(); + newline = p5; + scr_newtext(); + } + if (obj_ini.battle_cry == "...") { + standard_cry = 1; + var rand; + rand = choose(1, 2, 3); + if ((rand == 1) && (big_mofo != 1)) { + p2 = "remains silent as the Chapter forms for battle-"; + } + if ((rand == 1) && (big_mofo == 1)) { + p2 = "remain silent as the Chapter forms for battle-"; + } + if ((rand == 2) && (big_mofo != 1)) { + p2 = "remains silent and issues orders to the Chapter for battle-"; + } + if ((rand == 2) && (big_mofo == 1)) { + p2 = "remain silent and issues orders to the Chapter for battle-"; + } + if ((rand == 3) && (big_mofo != 1)) { + p2 = "issues orders to the Chapter over Vox-"; + } + if ((rand == 3) && (big_mofo == 1)) { + p2 = "whisper to your brothers the plans for initial deployment over vox-"; + } + p3 = "''Sharp gestures and handsigns from officers direct the Marines''"; + if ((temp >= 100) && (temp < 200)) { + p4 = "Over a hundred Astartes nod in acknowledgement and move quickly-"; + } + if ((temp >= 200) && (temp < 400)) { + p4 = "Several hundred Astartes nod in acknowledgement and move swiftly-"; + } + if ((temp >= 500) && (temp < 800)) { + p4 = "Your battle brothers all nod in acknowledgement and move hastily-"; + } + if (temp > 800) { + p4 = "The fluidity is astounding as the " + string(global.chapter_name) + " move seamlessly into position ready for battle-"; + } + p5 = "''They stand ready to engage the enemy''"; + newline = p1 + p2; + scr_newtext(); + newline = p3; + scr_newtext(); + newline = p4; + scr_newtext(); + newline = p5; + scr_newtext(); + } + // show_message(string(global.chapter_name)+"|"+string(global.custom)+"|"+string(standard_cry)); + if ((global.chapter_name == "Iron Warriors") && (global.custom == eCHAPTER_TYPE.PREMADE)) { + standard_cry = 1; + var rand; + rand = choose(1, 2, 3, 4, 5); + if ((rand == 1) && (big_mofo != 1)) { + p2 = "breaks the silence, begining the Chapter Battlecry-"; + } + if ((rand == 1) && (big_mofo == 1)) { + p2 = "break the silence, begining the Chapter Battlecry-"; + } + if ((rand == 2) && (big_mofo != 1)) { + p2 = "roars the first half of the Chapter Battlecry-"; + } + if ((rand == 2) && (big_mofo == 1)) { + p2 = "roar the first half of the Chapter Battlecry-"; + } + if ((rand == 3) && (big_mofo != 1)) { + p2 = "shouts the start of the Chapter Battlecry-"; + } + if ((rand == 3) && (big_mofo == 1)) { + p2 = "shout the start of the Chapter Battlecry-"; + } + if ((rand == 4) && (big_mofo != 1)) { + p2 = "calls out to your marines-"; + } + if ((rand == 4) && (big_mofo == 1)) { + p2 = "call out to your marines-"; + } + if ((rand == 5) && (big_mofo != 1)) { + p2 = "roars to your marines-"; + } + if ((rand == 5) && (big_mofo == 1)) { + p2 = "roar to your marines-"; + } + p3 = "''Iron within!''"; + if ((temp >= 100) && (temp < 200)) { + p4 = "Over a hundred Astartes roar in return, their voice one-"; + } + if ((temp >= 200) && (temp < 400)) { + p4 = "Several hundred Astartes roar in return, their voice one-"; + } + if ((temp >= 500) && (temp < 800)) { + p4 = "Your battle brothers echoe the cry, a massive sound felt more than heard-"; + } + if (temp > 800) { + p4 = "The sound is deafening as the " + string(global.chapter_name) + " shout in unison-"; + } + p5 = "''IRON WITHOUT!''"; + newline = p1 + p2; + scr_newtext(); + newline = p3; + scr_newtext(); + newline = p4; + scr_newtext(); + newline = p5; + scr_newtext(); + } - - - - - - - -// Check for battlecry here -// if (temp>=100) and (threat>1) and (big_mofo!=10) and (dropping=0){ -if (temp>=100) and (threat>1) and (big_mofo>0) and (big_mofo<10) and (dropping=0){ - p1="";p2="";p3="";p4="";p5="";p6=""; - temp4=0;temp5=0; - - if (big_mofo=1) then p1="You "; - if (big_mofo=2) then p1="The Master of Sanctity "; - if (big_mofo=3) then p1="Chief "+string(obj_ini.role[100,17])+" "; - if (big_mofo=5) then p1="A Captain "; - if (big_mofo=8) then p1="A Chaplain "; - - - - var standard_cry;standard_cry=0; - if (global.chapter_name="Salamanders"){standard_cry=1; - var rand;rand=choose(1,2,3,4,5); - if (rand=1) and (big_mofo!=1){p2="breaks the silence, begining the Chapter Battlecry-";}if (rand=1) and (big_mofo=1){p2="break the silence, begining the Chapter Battlecry-";} - if (rand=2) and (big_mofo!=1){p2="roars the first half of the Chapter Battlecry-";}if (rand=2) and (big_mofo=1){p2="roar the first half of the Chapter Battlecry-";} - if (rand=3) and (big_mofo!=1){p2="shouts the start of the Chapter Battlecry-";}if (rand=3) and (big_mofo=1){p2="shout the start of the Chapter Battlecry-";} - if (rand=4) and (big_mofo!=1){p2="calls out to your marines-";}if (rand=4) and (big_mofo=1){p2="call out to your marines-";} - if (rand=5) and (big_mofo!=1){p2="roars to your marines-";}if (rand=5) and (big_mofo=1){p2="roar to your marines-";} - p3="''Into the fires of battle!''"; - if (temp>=100) and (temp<200){p4="Over a hundred Astartes roar in return, their voice one-";} - if (temp>=200) and (temp<400){p4="Several hundred Astartes roar in return, their voice one-";} - if (temp>=500) and (temp<800){p4="Your battle brothers echoe the cry, a massive sound felt more than heard-";} - if (temp>800){p4="The sound is deafening as the "+string(global.chapter_name)+" shout in unison-";} - p5="''UNTO THE ANVIL OF WAR!''"; - newline=p1+p2;scr_newtext(); - newline=p3;scr_newtext(); - newline=p4;scr_newtext(); - newline=p5;scr_newtext(); - } - if (obj_ini.battle_cry == "..."){standard_cry=1; - var rand;rand=choose(1,2,3); - if (rand=1) and (big_mofo!=1){p2="remains silent as the Chapter forms for battle-";}if (rand=1) and (big_mofo=1){p2="remain silent as the Chapter forms for battle-";} - if (rand=2) and (big_mofo!=1){p2="remains silent and issues orders to the Chapter for battle-";}if (rand=2) and (big_mofo=1){p2="remain silent and issues orders to the Chapter for battle-";} - if (rand=3) and (big_mofo!=1){p2="issues orders to the Chapter over Vox-";}if (rand=3) and (big_mofo=1){p2="whisper to your brothers the plans for initial deployment over vox-";} - p3="''Sharp gestures and handsigns from officers direct the Marines''"; - if (temp>=100) and (temp<200){p4="Over a hundred Astartes nod in acknowledgement and move quickly-";} - if (temp>=200) and (temp<400){p4="Several hundred Astartes nod in acknowledgement and move swiftly-";} - if (temp>=500) and (temp<800){p4="Your battle brothers all nod in acknowledgement and move hastily-";} - if (temp>800){p4="The fluidity is astounding as the "+string(global.chapter_name)+" move seamlessly into position ready for battle-";} - p5="''They stand ready to engage the enemy''"; - newline=p1+p2;scr_newtext(); - newline=p3;scr_newtext(); - newline=p4;scr_newtext(); - newline=p5;scr_newtext(); - } - - // show_message(string(global.chapter_name)+"|"+string(global.custom)+"|"+string(standard_cry)); - - if (global.chapter_name="Iron Warriors") and (global.custom==eCHAPTER_TYPE.PREMADE){standard_cry=1; - var rand;rand=choose(1,2,3,4,5); - if (rand=1) and (big_mofo!=1){p2="breaks the silence, begining the Chapter Battlecry-";}if (rand=1) and (big_mofo=1){p2="break the silence, begining the Chapter Battlecry-";} - if (rand=2) and (big_mofo!=1){p2="roars the first half of the Chapter Battlecry-";}if (rand=2) and (big_mofo=1){p2="roar the first half of the Chapter Battlecry-";} - if (rand=3) and (big_mofo!=1){p2="shouts the start of the Chapter Battlecry-";}if (rand=3) and (big_mofo=1){p2="shout the start of the Chapter Battlecry-";} - if (rand=4) and (big_mofo!=1){p2="calls out to your marines-";}if (rand=4) and (big_mofo=1){p2="call out to your marines-";} - if (rand=5) and (big_mofo!=1){p2="roars to your marines-";}if (rand=5) and (big_mofo=1){p2="roar to your marines-";} - p3="''Iron within!''"; - if (temp>=100) and (temp<200){p4="Over a hundred Astartes roar in return, their voice one-";} - if (temp>=200) and (temp<400){p4="Several hundred Astartes roar in return, their voice one-";} - if (temp>=500) and (temp<800){p4="Your battle brothers echoe the cry, a massive sound felt more than heard-";} - if (temp>800){p4="The sound is deafening as the "+string(global.chapter_name)+" shout in unison-";} - p5="''IRON WITHOUT!''"; - newline=p1+p2;scr_newtext(); - newline=p3;scr_newtext(); - newline=p4;scr_newtext(); - newline=p5;scr_newtext(); - } - - - if (standard_cry=0){standard_cry=1; - var rand;rand=choose(1,2,3,4); - if (rand=1){if (big_mofo!=1) then p2="breaks ";if (big_mofo=1) then p2="break ";p2+="the silence, calling out the Chapter Battlecry-";} - if (rand=2){if (big_mofo!=1) then p2="roars ";if (big_mofo=1) then p2="roar ";p2+="the Chapter Battlecry-";} - if (rand=3){if (big_mofo!=1) then p2="shouts ";if (big_mofo=1) then p2="shout ";p2+="the Chapter Battlecry-";} - if (rand=4){if (big_mofo!=1) then p2="roars ";if (big_mofo=1) then p2="roar ";p2+="to your marines-";} - p3="''"+string(obj_ini.battle_cry)+"!''"; - if (temp>=100) and (temp<200){p4="Over a hundred Astartes echoe the cry or let out shouts of their own.";} - if (temp>=200) and (temp<400){p4="Several hundred Astartes roar in return, echoing the cry.";} - if (temp>=500) and (temp<800){p4="Your battle brothers echoe the cry, a massive sound felt more than heard.";} - if (temp>800) and (rand>=3){p4="The sound is deafening as the "+string(global.chapter_name)+" add their voices.";} - if (temp>800) and (rand<=2){p4="The sound is deafening as the "+string(global.chapter_name)+" return the cry and magnify it a thousand times.";} - newline=p1+p2;scr_newtext(); - newline=p3;scr_newtext(); - newline=p4;scr_newtext(); + if (standard_cry == 0) { + standard_cry = 1; + var rand; + rand = choose(1, 2, 3, 4); + if (rand == 1) { + if (big_mofo != 1) { + p2 = "breaks "; + } + if (big_mofo == 1) { + p2 = "break "; + } + p2 += "the silence, calling out the Chapter Battlecry-"; + } + if (rand == 2) { + if (big_mofo != 1) { + p2 = "roars "; + } + if (big_mofo == 1) { + p2 = "roar "; + } + p2 += "the Chapter Battlecry-"; + } + if (rand == 3) { + if (big_mofo != 1) { + p2 = "shouts "; + } + if (big_mofo == 1) { + p2 = "shout "; + } + p2 += "the Chapter Battlecry-"; + } + if (rand == 4) { + if (big_mofo != 1) { + p2 = "roars "; + } + if (big_mofo == 1) { + p2 = "roar "; + } + p2 += "to your marines-"; + } + p3 = "''" + string(obj_ini.battle_cry) + "!''"; + if ((temp >= 100) && (temp < 200)) { + p4 = "Over a hundred Astartes echoe the cry or let out shouts of their own."; + } + if ((temp >= 200) && (temp < 400)) { + p4 = "Several hundred Astartes roar in return, echoing the cry."; + } + if ((temp >= 500) && (temp < 800)) { + p4 = "Your battle brothers echoe the cry, a massive sound felt more than heard."; + } + if ((temp > 800) && (rand >= 3)) { + p4 = "The sound is deafening as the " + string(global.chapter_name) + " add their voices."; + } + if ((temp > 800) && (rand <= 2)) { + p4 = "The sound is deafening as the " + string(global.chapter_name) + " return the cry and magnify it a thousand times."; + } + newline = p1 + p2; + scr_newtext(); + newline = p3; + scr_newtext(); + newline = p4; + scr_newtext(); } } diff --git a/objects/obj_ncombat/Alarm_2.gml b/objects/obj_ncombat/Alarm_2.gml index 7cf595f3ab..c1201cff51 100644 --- a/objects/obj_ncombat/Alarm_2.gml +++ b/objects/obj_ncombat/Alarm_2.gml @@ -1,23 +1,23 @@ - -player_max=player_forces; -enemy_max=enemy_forces; +player_max = player_forces; +enemy_max = enemy_forces; instance_activate_object(obj_enunit); -if (dropping){ +if (dropping) { squeeze_map_forces(); } +if ((ally > 0) && (ally_forces > 0)) { + if (ally == 3) { + if (ally_forces >= 1) { + var thata, ii, good; + thata = instance_nearest(0, 240, obj_pnunit); + ii = 0; + good = 0; -if (ally>0) and (ally_forces>0){ - if (ally=3){ - if (ally_forces>=1){ - var thata,ii,good; - thata=instance_nearest(0,240,obj_pnunit);ii=0;good=0; - //TODO refactor so that unit structs are created for ally forces - - /* + + /* if (instance_exists(thata)){ ii=array_length(marine_type); @@ -62,9 +62,4 @@ if (ally>0) and (ally_forces>0){ } } - - - - - instance_activate_object(obj_enunit); diff --git a/objects/obj_ncombat/Alarm_3.gml b/objects/obj_ncombat/Alarm_3.gml index 960ade494f..e50d0f7ac1 100644 --- a/objects/obj_ncombat/Alarm_3.gml +++ b/objects/obj_ncombat/Alarm_3.gml @@ -1,17 +1,20 @@ - // if (battle_over=1) then exit; -if (defeat_message=1) then exit; +if (defeat_message == 1) { + exit; +} -if (wall_destroyed=1) then wall_destroyed=0; +if (wall_destroyed == 1) { + wall_destroyed = 0; +} -var i,good,changed;i=0;good=0;changed=0; +var i, good, changed; +i = 0; +good = 0; +changed = 0; // if (messages_to_show = 24) and (messages_shown=0) then alarm[6]=75; // if (messages_shown=105) then exit; - - - /*i+=1;if (message[i]!="") then show_message(message[i]); i+=1;if (message[i]!="") then show_message(message[i]); i+=1;if (message[i]!="") then show_message(message[i]); @@ -19,165 +22,244 @@ i+=1;if (message[i]!="") then show_message(message[i]); 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; + repeat (55) { + i += 1; -repeat(100){ - if (good=0){ - changed=0;i=0; - - repeat(55){ - i+=1; - // Collide the messages if needed - if (message[i]="") and (message[i+1]!=""){ - message[i]=message[i+1]; - message_sz[i]=message_sz[i+1]; - message_priority[i]=message_priority[i+1]; - - message[i+1]=""; - message_sz[i+1]=0; - message_priority[i+1]=0; - changed=1; + if ((message[i] == "") && (message[i + 1] != "")) { + message[i] = message[i + 1]; + message_sz[i] = message_sz[i + 1]; + message_priority[i] = message_priority[i + 1]; + + message[i + 1] = ""; + message_sz[i + 1] = 0; + message_priority[i + 1] = 0; + changed = 1; } - + // Move larger messages up - if (message[i]!="") and (message[i+1]!="") and (message_sz[i]0) and (messages_shown<24)) 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; +if (((messages > 0) && (messages_shown < 24)) && (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] != "") && (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("lost",newline)>0) then newline_color="red"; - if (string_count("^",newline)>0){ - newline=string_replace(newline,"^",""); - newline_color="white"; - } - - if (message_priority[that]=134) then newline_color="purple"; - if (message_priority[that]=135) then newline_color="blue"; - if (message_priority[that]=137) then newline_color="red"; - - scr_newtext(); - messages_shown+=1; - largest+=1; - message[that]="";message_sz[that]=0;message_priority[that]=0;messages-=1; - } - - alarm[3]=2; -} - - - - + if ((that != 0) && (that_sz > 0)) { + newline = message[that]; + if (message_priority[that] > 0) { + newline_color = "bright"; + } + if (string_count("lost", newline) > 0) { + newline_color = "red"; + } + if (string_count("^", newline) > 0) { + newline = string_replace(newline, "^", ""); + newline_color = "white"; + } + if (message_priority[that] == 134) { + newline_color = "purple"; + } + if (message_priority[that] == 135) { + newline_color = "blue"; + } + if (message_priority[that] == 137) { + newline_color = "red"; + } + scr_newtext(); + messages_shown += 1; + largest += 1; + message[that] = ""; + message_sz[that] = 0; + message_priority[that] = 0; + messages -= 1; + } + alarm[3] = 2; +} -if (messages=0) or (messages_shown>=24) then messages_shown=999; +if ((messages == 0) || (messages_shown >= 24)) { + messages_shown = 999; +} -if (messages=0) then messages_shown=999; +if (messages == 0) { + messages_shown = 999; +} /*var noloss;noloss=instance_nearest(50,300,obj_pnunit); if (!instance_exists(noloss)) then player_forces=0; if (instance_exists(noloss)){if (point_distance(50,300,noloss.x,noloss.y)>500) then player_forces=0;}*/ - -if (instance_exists(obj_pnunit)){ - var plnear;plnear=instance_nearest(room_width,240,obj_pnunit); - if (plnear.x<-40) then player_forces=0; +if (instance_exists(obj_pnunit)) { + var plnear; + plnear = instance_nearest(room_width, 240, obj_pnunit); + if (plnear.x < -40) { + player_forces = 0; + } +} +if (!instance_exists(obj_pnunit)) { + player_forces = 0; } -if (!instance_exists(obj_pnunit)) then player_forces=0; - -if ((messages_shown=999) or (messages=0)) and (timer_stage=2){ - 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)))+"%"; - if (obj_ncombat.enemy=30) and (instance_exists(obj_enunit)){newline="Enemy has ";var yoo;yoo=instance_nearest(0,0,obj_enunit);newline+=string(round(yoo.dudes_hp[1]))+"HP remaining";} - if (enemy_forces<=0) or (!instance_exists(obj_enunit)) and (defeat_message=0){defeat_message=1;newline="Enemy Forces Defeated";timer_maxspeed=0;timer_speed=0;started=2;instance_activate_object(obj_pnunit);} +if (((messages_shown == 999) || (messages == 0)) && (timer_stage == 2)) { + newline_color = "yellow"; + if (obj_ncombat.enemy != 6) { + if ((enemy_forces > 0) && (obj_ncombat.enemy != 30)) { + newline = "Enemy Forces at " + string(max(1, round((enemy_forces / enemy_max) * 100))) + "%"; + } + if ((obj_ncombat.enemy == 30) && instance_exists(obj_enunit)) { + newline = "Enemy has "; + var yoo; + yoo = instance_nearest(0, 0, obj_enunit); + newline += string(round(yoo.dudes_hp[1])) + "HP remaining"; + } + if ((enemy_forces <= 0) || (!instance_exists(obj_enunit)) && (defeat_message == 0)) { + defeat_message = 1; + newline = "Enemy Forces Defeated"; + timer_maxspeed = 0; + timer_speed = 0; + started = 2; + instance_activate_object(obj_pnunit); + } } - newline_color="yellow"; - if (obj_ncombat.enemy=6){ - var jims;jims=0; - repeat(20){jims+=1; - if (dead_jim[jims]!="") and (dead_jims>0){ - newline=dead_jim[jims];newline_color="red"; - scr_newtext();dead_jim[jims]="";dead_jims-=1; + newline_color = "yellow"; + if (obj_ncombat.enemy == 6) { + var jims; + jims = 0; + repeat (20) { + jims += 1; + if ((dead_jim[jims] != "") && (dead_jims > 0)) { + newline = dead_jim[jims]; + newline_color = "red"; + scr_newtext(); + dead_jim[jims] = ""; + dead_jims -= 1; } } - if (player_forces>0){newline=string(global.chapter_name)+" at "+string(round((player_forces/player_max)*100))+"%";four_show=0;} - var plnear;plnear=instance_nearest(room_width,240,obj_pnunit); - if ((player_forces<=0) or (plnear.x<-40)) and (defeat_message=0){defeat_message=1;newline=string(global.chapter_name)+" Defeated";timer_maxspeed=0;timer_speed=0;started=4;defeat=1;instance_activate_object(obj_pnunit);} + if (player_forces > 0) { + newline = string(global.chapter_name) + " at " + string(round((player_forces / player_max) * 100)) + "%"; + four_show = 0; + } + var plnear; + plnear = instance_nearest(room_width, 240, obj_pnunit); + if (((player_forces <= 0) || (plnear.x < -40)) && (defeat_message == 0)) { + defeat_message = 1; + newline = string(global.chapter_name) + " Defeated"; + timer_maxspeed = 0; + timer_speed = 0; + started = 4; + defeat = 1; + instance_activate_object(obj_pnunit); + } } - messages_shown=105;done=1;scr_newtext();timer_stage=3;exit; + messages_shown = 105; + done = 1; + scr_newtext(); + timer_stage = 3; + exit; } -if ((messages_shown=999) or (messages=0)) and ((timer_stage=4) or (timer_stage=5)) and (four_show=0){ - newline_color="yellow"; - if (obj_ncombat.enemy!=6){ - var jims;jims=0; - repeat(20){jims+=1; - if (dead_jim[jims]!="") and (dead_jims>0){ - newline=dead_jim[jims];newline_color="red"; - scr_newtext();dead_jim[jims]="";dead_jims-=1; +if (((messages_shown == 999) || (messages == 0)) && ((timer_stage == 4) || (timer_stage == 5)) && (four_show == 0)) { + newline_color = "yellow"; + if (obj_ncombat.enemy != 6) { + var jims; + jims = 0; + repeat (20) { + jims += 1; + if ((dead_jim[jims] != "") && (dead_jims > 0)) { + newline = dead_jim[jims]; + newline_color = "red"; + scr_newtext(); + dead_jim[jims] = ""; + dead_jims -= 1; } } - if (player_forces>0){newline=string(global.chapter_name)+" at "+string(round((player_forces/player_max)*100))+"%";four_show=1;} - var plnear;plnear=instance_nearest(room_width,240,obj_pnunit); - if ((player_forces<=0) or (plnear.x<-40)) and (defeat_message=0){defeat_message=1;newline=string(global.chapter_name)+" Defeated";timer_maxspeed=0;timer_speed=0;started=4;defeat=1;instance_activate_object(obj_pnunit);} + if (player_forces > 0) { + newline = string(global.chapter_name) + " at " + string(round((player_forces / player_max) * 100)) + "%"; + four_show = 1; + } + var plnear; + plnear = instance_nearest(room_width, 240, obj_pnunit); + if (((player_forces <= 0) || (plnear.x < -40)) && (defeat_message == 0)) { + defeat_message = 1; + newline = string(global.chapter_name) + " Defeated"; + timer_maxspeed = 0; + timer_speed = 0; + started = 4; + defeat = 1; + instance_activate_object(obj_pnunit); + } } - newline_color="yellow"; - if (obj_ncombat.enemy=6){ - if (enemy_forces>0) then newline="Enemy Forces at "+string(max(1,round((enemy_forces/enemy_max)*100)))+"%"; - if ((enemy_forces<=0) or (!instance_exists(obj_enunit))) and (defeat_message=0){defeat_message=1;newline="Enemy Forces Defeated";timer_maxspeed=0;timer_speed=0;started=2;instance_activate_object(obj_pnunit);} + newline_color = "yellow"; + if (obj_ncombat.enemy == 6) { + if (enemy_forces > 0) { + newline = "Enemy Forces at " + string(max(1, round((enemy_forces / enemy_max) * 100))) + "%"; + } + if (((enemy_forces <= 0) || (!instance_exists(obj_enunit))) && (defeat_message == 0)) { + defeat_message = 1; + newline = "Enemy Forces Defeated"; + timer_maxspeed = 0; + timer_speed = 0; + started = 2; + instance_activate_object(obj_pnunit); + } } - messages_shown=105;done=1;scr_newtext();timer_stage=5;exit; + messages_shown = 105; + done = 1; + scr_newtext(); + timer_stage = 5; + exit; } /* */ diff --git a/objects/obj_ncombat/Alarm_4.gml b/objects/obj_ncombat/Alarm_4.gml index 6bd459b445..cb52e8a14b 100644 --- a/objects/obj_ncombat/Alarm_4.gml +++ b/objects/obj_ncombat/Alarm_4.gml @@ -1,14 +1,17 @@ -var jims;jims=0; -repeat(20){ - jims+=1; - - if (dead_jim[jims]!=""){ - newline=dead_jim[jims];newline_color="red"; +var jims; +jims = 0; +repeat (20) { + jims += 1; + + if (dead_jim[jims] != "") { + newline = dead_jim[jims]; + newline_color = "red"; scr_newtext(); - dead_jim[jims]=""; - dead_jims-=1; - - if (dead_jims>0) then alarm[4]=1; + dead_jim[jims] = ""; + dead_jims -= 1; + + if (dead_jims > 0) { + alarm[4] = 1; + } } } - diff --git a/objects/obj_ncombat/Alarm_5.gml b/objects/obj_ncombat/Alarm_5.gml index b83d13893a..21df132f64 100644 --- a/objects/obj_ncombat/Alarm_5.gml +++ b/objects/obj_ncombat/Alarm_5.gml @@ -1,22 +1,20 @@ - // Final Screen -var part1="",part2="",part3="",part4="",part9=""; -var part5="",part6="",part7="",part8="",part10=""; -battle_over=1; +var part1 = "", part2 = "", part3 = "", part4 = "", part9 = ""; +var part5 = "", part6 = "", part7 = "", part8 = "", part10 = ""; +battle_over = 1; -alarm[8]=999999; +alarm[8] = 999999; var line_break = "------------------------------------------------------------------------------"; // show_message("Final Deaths: "+string(final_marine_deaths)); - -if (turn_count >= 50){ - part1 = "Your forces make a fighting retreat \n" +if (turn_count >= 50) { + part1 = "Your forces make a fighting retreat \n"; } p_data = new PlanetData(battle_id, battle_object); // 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)); +var ground_mission = instance_exists(obj_ground_mission); with (obj_pnunit) { after_battle_part1(); @@ -58,7 +56,7 @@ if (obj_ncombat.defeat == 0) { if (!_unit.gene_seed_mutations[$ "membrane"]) { var survival_mod = _unit.luck * -1; survival_mod += _unit.hp() * -1; - + var survival_test = global.character_tester.standard_test(_unit, "constitution", survival_mod); if (survival_test[0]) { _column_id.marine_dead[_unit_id] = false; @@ -74,11 +72,11 @@ if (obj_ncombat.defeat == 0) { var _column_id = _candidate.column_id; var _vehicle_id = _candidate.id; var _vehicle_type = _column_id.veh_type[_vehicle_id]; - - if (obj_controller.stc_bonus[3] = 4) { + + if (obj_controller.stc_bonus[3] == 4) { var _survival_roll = 70 + _candidate.priority; var _dice_roll = roll_dice_chapter(1, 100, "high"); - if (_dice_roll >= _survival_roll) && (_column_id.veh_dead[_vehicle_id] != 2) { + if ((_dice_roll >= _survival_roll) && (_column_id.veh_dead[_vehicle_id] != 2)) { _column_id.veh_hp[_vehicle_id] = roll_dice_chapter(1, 10, "high"); _column_id.veh_dead[_vehicle_id] = false; vehicles_saved_count++; @@ -91,7 +89,7 @@ if (obj_ncombat.defeat == 0) { continue; } } - + if (vehicle_recovery_score > 0) { _column_id.veh_hp[_vehicle_id] = roll_dice_chapter(1, 10, "high"); _column_id.veh_dead[_vehicle_id] = false; @@ -108,7 +106,6 @@ if (obj_ncombat.defeat == 0) { ds_priority_destroy(vehicles_to_recover); } - with (obj_pnunit) { after_battle_part2(); } @@ -117,7 +114,7 @@ var _total_deaths = final_marine_deaths + final_command_deaths; var _total_injured = _total_deaths + injured + units_saved_count; if (_total_injured > 0) { newline = $"{string_plural_count("unit", _total_injured)} {smart_verb("was", _total_injured)} critically injured."; - scr_newtext(); + scr_newtext(); if (units_saved_count > 0) { var _units_saved_string = ""; @@ -150,21 +147,19 @@ if (_total_injured > 0) { _units_lost_string += smart_delimeter_sign(_unit_roles, i, false); } newline += $"{_total_deaths} units succumbed to their wounds! ({_units_lost_string})"; - newline_color="red"; + newline_color = "red"; scr_newtext(); - } newline = " "; scr_newtext(); } - -if (ground_mission){ - if (apothecaries_alive < 0){ - obj_ground_mission.apothecary_present = apothecaries_alive; - } -}; +if (ground_mission) { + if (apothecaries_alive < 0) { + obj_ground_mission.apothecary_present = apothecaries_alive; + } +} if (seed_lost > 0) { if (obj_ini.doomed) { @@ -187,25 +182,29 @@ if (seed_lost > 0) { scr_newtext(); } -if (red_thirst>2){ - var voodoo=""; +if (red_thirst > 2) { + var voodoo = ""; + + if (red_thirst == 3) { + voodoo = "1 Battle Brother lost to the Red Thirst."; + } + if (red_thirst > 3) { + voodoo = string(red_thirst - 2) + " Battle Brothers lost to the Red Thirst."; + } - if (red_thirst=3) then voodoo="1 Battle Brother lost to the Red Thirst."; - if (red_thirst>3) then voodoo=string(red_thirst-2)+" Battle Brothers lost to the Red Thirst."; - - newline=voodoo;newline_color="red"; + newline = voodoo; + newline_color = "red"; scr_newtext(); - newline=" "; + newline = " "; scr_newtext(); } newline = " "; scr_newtext(); - var _total_damaged_count = vehicle_deaths + vehicles_saved_count; if (_total_damaged_count > 0) { - newline = $"{string_plural_count("vehicle", _total_damaged_count)} {smart_verb("was", _total_damaged_count)} disabled during battle."; + newline = $"{string_plural_count("vehicle", _total_damaged_count)} {smart_verb("was", _total_damaged_count)} disabled during battle."; scr_newtext(); if (vehicles_saved_count > 0) { @@ -235,7 +234,7 @@ if (_total_damaged_count > 0) { } newline += $"{vehicle_deaths} {smart_verb("was", vehicle_deaths)} lost forever. ({_vehicles_lost_string})"; - newline_color="red"; + newline_color = "red"; scr_newtext(); } @@ -243,30 +242,27 @@ if (_total_damaged_count > 0) { scr_newtext(); } +if (post_equipment_lost.item_count()) { + part6 = "Equipment Lost: "; - -if (post_equipment_lost.item_count()){ - part6="Equipment Lost: "; - part7 += post_equipment_lost.item_description_string(); - if (ground_mission){ + if (ground_mission) { part7 += " Some may be recoverable."; } - newline=part6; + newline = part6; scr_newtext(); - newline=part7; + newline = part7; scr_newtext(); - newline=" "; + newline = " "; scr_newtext(); } -if (post_equipment_recovered.item_count()){ +if (post_equipment_recovered.item_count()) { newline = $"Equipment Recovered: {post_equipment_lost.item_description_string()}"; scr_newtext(); } - -if (total_battle_exp_gain>0){ +if (total_battle_exp_gain > 0) { with (obj_pnunit) { assemble_alive_units(); } @@ -282,181 +278,184 @@ if (total_battle_exp_gain>0){ } newline += $"{upgraded_librarians[i].name_role()}"; } - newline += " learned new psychic powers after gaining enough experience." + newline += " learned new psychic powers after gaining enough experience."; scr_newtext(); } - newline=" "; + newline = " "; scr_newtext(); } -if (ground_mission){ - obj_ground_mission.post_equipment_lost = post_equipment_lost; +if (ground_mission) { + obj_ground_mission.post_equipment_lost = post_equipment_lost; } -if (slime>0){ - var slime_string=$"Faulty Mucranoid and other afflictions have caused damage to the equipment. {slime} Forge Points will be allocated for repairs."; - newline=slime_string; - newline_color="red"; +if (slime > 0) { + var slime_string = $"Faulty Mucranoid and other afflictions have caused damage to the equipment. {slime} Forge Points will be allocated for repairs."; + newline = slime_string; + newline_color = "red"; scr_newtext(); - newline=" "; + newline = " "; scr_newtext(); } instance_activate_object(obj_star); +var reduce_fortification = true; +if (battle_special == "tyranid_org") { + reduce_fortification = false; +} +if (string_count("_attack", battle_special) > 0) { + reduce_fortification = false; +} +if (battle_special == "ship_demon") { + reduce_fortification = false; +} +if (enemy + threat == 17) { + reduce_fortification = false; +} +if (battle_special == "ruins") { + reduce_fortification = false; +} +if (battle_special == "ruins_eldar") { + reduce_fortification = false; +} +if (battle_special == "fallen1") { + reduce_fortification = false; +} +if (battle_special == "fallen2") { + reduce_fortification = false; +} +if (battle_special == "study2a") { + reduce_fortification = false; +} +if (battle_special == "study2b") { + reduce_fortification = false; +} -var reduce_fortification=true; -if (battle_special="tyranid_org") then reduce_fortification=false; -if (string_count("_attack",battle_special)>0) then reduce_fortification=false; -if (battle_special="ship_demon") then reduce_fortification=false; -if (enemy+threat=17) then reduce_fortification=false; -if (battle_special="ruins") then reduce_fortification=false; -if (battle_special="ruins_eldar") then reduce_fortification=false; -if (battle_special="fallen1") then reduce_fortification=false; -if (battle_special="fallen2") then reduce_fortification=false; -if (battle_special="study2a") then reduce_fortification=false; -if (battle_special="study2b") then reduce_fortification=false; - -if (fortified>0) and (!instance_exists(obj_nfort)) and (reduce_fortification=true){ - part9=$"Fortification level of {p_data.name()}"; +if ((fortified > 0) && (!instance_exists(obj_nfort)) && (reduce_fortification == true)) { + part9 = $"Fortification level of {p_data.name()}"; - part9+=$" has decreased to {fortified-1} ({fortified}-1)"; + part9 += $" has decreased to {fortified - 1} ({fortified}-1)"; - newline=part9; + newline = part9; scr_newtext(); - battle_object.p_fortified[battle_id]-=1; + battle_object.p_fortified[battle_id] -= 1; } - /*if (enemy=5){ if (obj_controller.faction_status[eFACTION.Ecclesiarchy]!="War"){ } }*/ +if ((!defeat) && (battle_special == "space_hulk")) { + var enemy_power = 0, loot = 0, dicey = roll_dice_chapter(1, 100, "low"); + ex = 0; - - - -if (!defeat) and (battle_special == "space_hulk"){ - var enemy_power=0, - loot=0, - dicey=roll_dice_chapter(1, 100, "low"); - ex=0; - - if (enemy == eFACTION.Ork || enemy == eFACTION.Tyranids || enemy == eFACTION.Heretics){ - enemy_power=p_data.add_forces(enemy,-1); + if (enemy == eFACTION.Ork || enemy == eFACTION.Tyranids || enemy == eFACTION.Heretics) { + enemy_power = p_data.add_forces(enemy, -1); } - part10="Space Hulk Exploration at "; - ex=min(100,100-((enemy_power-1)*20)); - part10+=string(ex)+"%"; - newline=part10; - if (ex=100) then newline_color="red"; + part10 = "Space Hulk Exploration at "; + ex = min(100, 100 - ((enemy_power - 1) * 20)); + part10 += string(ex) + "%"; + newline = part10; + if (ex == 100) { + newline_color = "red"; + } scr_newtext(); // show_message("Roll Under: "+string(enemy_power*10)+", Roll: "+string(dicey)); - if (dicey<=(enemy_power*10)){ - loot=choose(1,2,3,4); - if (enemy!=10) then loot=choose(1,1,2,3); - hulk_treasure=loot; - if (loot>1) then newline="Valuable items recovered."; - if (loot=1) then newline="Resources have been recovered."; - newline_color="yellow"; + if (dicey <= (enemy_power * 10)) { + loot = choose(1, 2, 3, 4); + if (enemy != 10) { + loot = choose(1, 1, 2, 3); + } + hulk_treasure = loot; + if (loot > 1) { + newline = "Valuable items recovered."; + } + if (loot == 1) { + newline = "Resources have been recovered."; + } + newline_color = "yellow"; scr_newtext(); } } - -if (string_count("ruins",battle_special)>0){ - if (defeat == 0) then newline="Ancient Ruins cleared."; - if (defeat == 1) then newline="Failed to clear Ancient Ruins."; - newline_color="yellow"; +if (string_count("ruins", battle_special) > 0) { + if (defeat == 0) { + newline = "Ancient Ruins cleared."; + } + if (defeat == 1) { + newline = "Failed to clear Ancient Ruins."; + } + newline_color = "yellow"; scr_newtext(); } var _reduce_power = true; // Events that should *not* reduce power -var _non_power_reduce_events = [ - "tyranid_org", - "ship_demon", - "space_hulk", - "fallen1", - "fallen2", - "study2a", - "study2b", - "protect_raiders" -]; +var _non_power_reduce_events = ["tyranid_org", "ship_demon", "space_hulk", "fallen1", "fallen2", "study2a", "study2b", "protect_raiders"]; // Disable power reduction for matching events if (array_contains(_non_power_reduce_events, battle_special)) { _reduce_power = false; -} -else if (string_count("_attack", battle_special) > 0) { +} else if (string_count("_attack", battle_special) > 0) { _reduce_power = false; -} -else if (string_count("ruins", battle_special) > 0) { +} else if (string_count("ruins", battle_special) > 0) { _reduce_power = false; } +if (defeat == 0 && _reduce_power) { + var enemy_power = 0, new_power = 0, power_reduction = 0, requisition_reward = 0; -if (defeat == 0 && _reduce_power){ - - var enemy_power=0,new_power=0, power_reduction=0, requisition_reward=0; - - if (enemy=2){ - enemy_power=battle_object.p_guardsmen[battle_id]; - battle_object.p_guardsmen[battle_id]-=threat; + if (enemy == 2) { + enemy_power = battle_object.p_guardsmen[battle_id]; + battle_object.p_guardsmen[battle_id] -= threat; // if (threat=1) or (threat=2) then battle_object.p_guardsmen[battle_id]=0; } - if (enemy=5){ - enemy_power=battle_object.p_sisters[battle_id]; - part10="Ecclesiarchy"; - } - else if (enemy=6){ - enemy_power=battle_object.p_eldar[battle_id]; - part10="Eldar"; - } - else if (enemy=7){ - enemy_power=battle_object.p_orks[battle_id]; - part10="Ork"; - } - else if (enemy=8){ - enemy_power=battle_object.p_tau[battle_id]; - part10="Tau"; - } - else if (enemy=9){ - enemy_power=battle_object.p_tyranids[battle_id]; - part10="Tyranid"; - } - else if (enemy=10){ - enemy_power=battle_object.p_traitors[battle_id]; - part10="Heretic"; - if (threat==7){ - part10="Daemon"; - } - } - else if (enemy=11){ - enemy_power=battle_object.p_chaos[battle_id]; - part10="Chaos Space Marine";} - else if (enemy=13){ - enemy_power=battle_object.p_necrons[battle_id]; - part10="Necrons"; - } - - if (instance_exists(battle_object)) and (enemy_power>2){ - if (awake_tomb_world(battle_object.p_feature[battle_id])!=0){ - scr_gov_disp(battle_object.name,battle_id,floor(enemy_power/2)); - } - } - - - if (enemy!=2){ + if (enemy == 5) { + enemy_power = battle_object.p_sisters[battle_id]; + part10 = "Ecclesiarchy"; + } else if (enemy == 6) { + enemy_power = battle_object.p_eldar[battle_id]; + part10 = "Eldar"; + } else if (enemy == 7) { + enemy_power = battle_object.p_orks[battle_id]; + part10 = "Ork"; + } else if (enemy == 8) { + enemy_power = battle_object.p_tau[battle_id]; + part10 = "Tau"; + } else if (enemy == 9) { + enemy_power = battle_object.p_tyranids[battle_id]; + part10 = "Tyranid"; + } else if (enemy == 10) { + enemy_power = battle_object.p_traitors[battle_id]; + part10 = "Heretic"; + if (threat == 7) { + part10 = "Daemon"; + } + } else if (enemy == 11) { + enemy_power = battle_object.p_chaos[battle_id]; + part10 = "Chaos Space Marine"; + } else if (enemy == 13) { + enemy_power = battle_object.p_necrons[battle_id]; + part10 = "Necrons"; + } + + if (instance_exists(battle_object) && (enemy_power > 2)) { + if (awake_tomb_world(battle_object.p_feature[battle_id]) != 0) { + scr_gov_disp(battle_object.name, battle_id, floor(enemy_power / 2)); + } + } + + if (enemy != 2) { if (dropping == true || defending == true) { power_reduction = 1; } else { @@ -470,126 +469,126 @@ if (defeat == 0 && _reduce_power){ requisition_reward = _quad_factor * sqr(threat); obj_controller.requisition += requisition_reward; - //(¿?) Ramps up threat/enemy presence in case enemy Type == "Daemon" (¿?) - //Does the inverse check/var assignment 10 lines above - if (part10="Daemon") then new_power=7; - if (enemy=9) and (new_power==0){ + //(¿?) Ramps up threat/enemy presence in case enemy Type == "Daemon" (¿?) + //Does the inverse check/var assignment 10 lines above + if (part10 == "Daemon") { + new_power = 7; + } + if ((enemy == 9) && (new_power == 0)) { var battle_planet = battle_id; - with (battle_object){ - var who_cleansed="Tyranids"; - var who_return=""; + with (battle_object) { + var who_cleansed = "Tyranids"; + var who_return = ""; var make_alert = true; var planet_string = $"{name} {scr_roman(battle_planet)}"; - if (planet_feature_bool(p_feature[battle_planet], P_features.Gene_Stealer_Cult)==1){ - who_cleansed="Gene Stealer Cult" - make_alert=true; + if (planet_feature_bool(p_feature[battle_planet], P_features.Gene_Stealer_Cult) == 1) { + who_cleansed = "Gene Stealer Cult"; + make_alert = true; delete_features(p_feature[battle_planet], P_features.Gene_Stealer_Cult); adjust_influence(eFACTION.Tyranids, -25, battle_planet); - } - if (make_alert){ - if (p_first[battle_planet] == 1){ + } + if (make_alert) { + if (p_first[battle_planet] == 1) { who_return = "your"; p_owner[battle_planet] = eFACTION.Player; - } else if (p_first[battle_planet] == 3 || p_type[battle_planet]=="Forge"){ - who_return="mechanicus"; + } else if (p_first[battle_planet] == 3 || p_type[battle_planet] == "Forge") { + who_return = "mechanicus"; obj_controller.disposition[eFACTION.Mechanicus] += 10; - p_owner[battle_planet] = eFACTION.Mechanicus - }else if (p_type[battle_planet]!="Dead"){ - who_return="the governor"; - if (who_cleansed=="tau"){ - who_return="a more suitable governer" + p_owner[battle_planet] = eFACTION.Mechanicus; + } else if (p_type[battle_planet] != "Dead") { + who_return = "the governor"; + if (who_cleansed == "tau") { + who_return = "a more suitable governer"; } - p_owner[battle_planet] = eFACTION.Imperium - } + p_owner[battle_planet] = eFACTION.Imperium; + } dispo[battle_planet] += 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[battle_planet] >= 101) then p_owner[battle_planet] = 1; - } + if (dispo[battle_planet] >= 101) { + p_owner[battle_planet] = 1; + } + } } } - if (enemy=11) and (enemy_power!=floor(enemy_power)) then enemy_power=floor(enemy_power); + if ((enemy == 11) && (enemy_power != floor(enemy_power))) { + enemy_power = floor(enemy_power); + } } + if ((obj_controller.blood_debt == 1) && (defeat == 0) && enemy_power > 0) { + final_pow = min(enemy_power, 6) - 1; + if ((enemy == 6) || (enemy == 9) || (enemy == 11) || (enemy == 13)) { + obj_controller.penitent_turn = 0; + obj_controller.penitent_turnly = 0; + var penitent_crusade_chart = [25, 62, 95, 190, 375, 750]; - if ((obj_controller.blood_debt=1) and (defeat=0) && enemy_power>0){ - final_pow = min(enemy_power, 6)-1; - if (enemy=6) or (enemy=9) or (enemy=11) or (enemy=13){ - obj_controller.penitent_turn=0; - obj_controller.penitent_turnly=0; - var penitent_crusade_chart = [25,62,95,190,375,750]; - - final_pow = min(enemy_power, 6)-1; - obj_controller.penitent_current+=penitent_crusade_chart[final_pow]; - - } - else if (enemy=7) or (enemy=8) or (enemy=10){ - obj_controller.penitent_turn=0; - obj_controller.penitent_turnly=0; - final_pow = min(enemy_power, 7)-1; - var penitent_crusade_chart = [25,50,75,150,300,600, 1500]; - obj_controller.penitent_current+=penitent_crusade_chart[final_pow]; + final_pow = min(enemy_power, 6) - 1; + obj_controller.penitent_current += penitent_crusade_chart[final_pow]; + } else if ((enemy == 7) || (enemy == 8) || (enemy == 10)) { + obj_controller.penitent_turn = 0; + obj_controller.penitent_turnly = 0; + final_pow = min(enemy_power, 7) - 1; + var penitent_crusade_chart = [25, 50, 75, 150, 300, 600, 1500]; + obj_controller.penitent_current += penitent_crusade_chart[final_pow]; } } - if (enemy >= 5){ - p_data.edit_forces(enemy, new_power) + if (enemy >= 5) { + p_data.edit_forces(enemy, new_power); } - if (enemy!=2) and (string_count("cs_meeting_battle",battle_special)=0){ - part10+=$" forces on {p_data.name()}" - if (new_power == 0){ - part10+=$" were completely wiped out. Previous power: { - enemy_power}. Reduction: {power_reduction}."; + if ((enemy != 2) && (string_count("cs_meeting_battle", battle_special) == 0)) { + part10 += $" forces on {p_data.name()}"; + if (new_power == 0) { + part10 += $" were completely wiped out. Previous power: {enemy_power}. Reduction: {power_reduction}."; } else { - part10+=$" were reduced to {new_power} after this battle. Previous power: { - enemy_power}. Reduction: {power_reduction}."; + part10 += $" were reduced to {new_power} after this battle. Previous power: {enemy_power}. Reduction: {power_reduction}."; } - newline=part10; + newline = part10; scr_newtext(); part10 = $"Received {requisition_reward} requisition points as a reward for slaying enemies of the Imperium."; - newline=part10; + newline = part10; scr_newtext(); - - if (new_power<=0) and (enemy_power>0) then battle_object.p_raided[battle_id]=1; + + if ((new_power <= 0) && (enemy_power > 0)) { + battle_object.p_raided[battle_id] = 1; + } } - if (enemy=2){ - part10+=$" Imperial Guard Forces on {p_data.name()}"; - part10+=" were reduced to "+string(battle_object.p_guardsmen[battle_id])+" ("+string(enemy_power)+"-"+string(threat)+")"; - newline=part10; + if (enemy == 2) { + part10 += $" Imperial Guard Forces on {p_data.name()}"; + part10 += " were reduced to " + string(battle_object.p_guardsmen[battle_id]) + " (" + string(enemy_power) + "-" + string(threat) + ")"; + newline = part10; scr_newtext(); } - - - if (enemy=8) and (ethereal>0) and (defeat=0){ - newline="Tau Ethereal Captured"; - newline_color="yellow"; + if ((enemy == 8) && (ethereal > 0) && (defeat == 0)) { + newline = "Tau Ethereal Captured"; + newline_color = "yellow"; scr_newtext(); } - - if (enemy == eFACTION.Necrons && p_data.forces[eFACTION.Necrons]<3 && awake_tomb_world(p_data.features) == 1){ - + + if (enemy == eFACTION.Necrons && p_data.forces[eFACTION.Necrons] < 3 && awake_tomb_world(p_data.features) == 1) { // var bombs;bombs=scr_check_equip("Plasma Bomb",battle_loc,battle_id,0); // var bombs;bombs=scr_check_equip("Plasma Bomb","","",0); // show_message(string(bombs)); - if (plasma_bomb>0){ + if (plasma_bomb > 0) { // scr_check_equip("Plasma Bomb",battle_loc,battle_id,1); // scr_check_equip("Plasma Bomb","","",1); - newline="Plasma Bomb used to seal the Necron Tomb."; - newline_color="yellow"; + newline = "Plasma Bomb used to seal the Necron Tomb."; + newline_color = "yellow"; scr_newtext(); - seal_tomb_world(p_data.features) - } - - else if (plasma_bomb<=0){ - p_data.edit_forces(enemy, 3) - if (dropping!=0){ - newline="Deep Strike Ineffective; Plasma Bomb required"; + seal_tomb_world(p_data.features); + } else if (plasma_bomb <= 0) { + p_data.edit_forces(enemy, 3); + if (dropping != 0) { + newline = "Deep Strike Ineffective; Plasma Bomb required"; + } + if (dropping == 0) { + newline = "Attack Ineffective; Plasma Bomb required"; } - if (dropping=0) then newline="Attack Ineffective; Plasma Bomb required"; scr_newtext(); } @@ -605,16 +604,8 @@ if (defeat == 0 && _reduce_power){ pip.add_option="Advance!"; pip.add_option="Cancel the attack";*/ - - - - } - - - - /*if (enemy=13) and (new_power<=0) and (dropping=0){ var bombs;bombs=scr_check_equip("Plasma Bomb",battle_loc,battle_id,0); if (bombs>0){ @@ -625,192 +616,225 @@ if (defeat == 0 && _reduce_power){ }*/ } -if (defeat == 0) and (enemy==eFACTION.Tyranids) and (battle_special="tyranid_org"){ +if ((defeat == 0) && (enemy == eFACTION.Tyranids) && (battle_special == "tyranid_org")) { // show_message(string(captured_gaunt)); newline = $"{string_plural_count("Gaunt organism", captured_gaunt)} have been captured."; scr_newtext(); - if (captured_gaunt>0){ - var why=0,thatta=0; + if (captured_gaunt > 0) { + var why = 0, thatta = 0; instance_activate_object(obj_star); // with(obj_star){if (name!=obj_ncombat.battle_loc) then instance_deactivate_object(id);} // thatta=obj_star; - with(obj_star){ + with (obj_star) { remove_star_problem("tyranid_org"); } } - scr_event_log("","Inquisition Mission Completed: A Gaunt organism has been captured for the Inquisition."); + scr_event_log("", "Inquisition Mission Completed: A Gaunt organism has been captured for the Inquisition."); - if (captured_gaunt>1){ - if (instance_exists(obj_turn_end)){ - scr_popup("Inquisition Mission Completed","You have captured several Gaunt organisms. The Inquisitor is pleased with your work, though she notes that only one is needed- the rest are to be purged. It will be stored until it may be retrieved. The mission is a success.","inquisition",""); + if (captured_gaunt > 1) { + if (instance_exists(obj_turn_end)) { + scr_popup("Inquisition Mission Completed", "You have captured several Gaunt organisms. The Inquisitor is pleased with your work, though she notes that only one is needed- the rest are to be purged. It will be stored until it may be retrieved. The mission is a success.", "inquisition", ""); } } - if (captured_gaunt=1){ - if (instance_exists(obj_turn_end)){ - scr_popup("Inquisition Mission Completed","You have captured a Gaunt organism- the Inquisitor is pleased with your work. The Tyranid will be stored until it may be retrieved. The mission is a success.","inquisition",""); + if (captured_gaunt == 1) { + if (instance_exists(obj_turn_end)) { + scr_popup("Inquisition Mission Completed", "You have captured a Gaunt organism- the Inquisitor is pleased with your work. The Tyranid will be stored until it may be retrieved. The mission is a success.", "inquisition", ""); } } instance_deactivate_object(obj_star); } - -newline=line_break; +newline = line_break; scr_newtext(); -newline=line_break; +newline = line_break; scr_newtext(); -if (((leader)) or ((battle_special="ChaosWarband") and (!obj_controller.faction_defeated[10]))) and (!defeat){ - var nep=false; - newline="The enemy Leader has been killed!";newline_color="yellow";scr_newtext(); - newline=line_break; +if ((leader || ((battle_special == "ChaosWarband") && (!obj_controller.faction_defeated[10]))) && (!defeat)) { + var nep = false; + newline = "The enemy Leader has been killed!"; + newline_color = "yellow"; scr_newtext(); - newline=line_break; + newline = line_break; + scr_newtext(); + newline = line_break; scr_newtext(); instance_activate_object(obj_event_log); - if (enemy=5) then scr_event_log("","Enemy Leader Assassinated: Ecclesiarchy Prioress"); - if (enemy=6) then scr_event_log("","Enemy Leader Assassinated: Eldar Farseer"); - if (enemy=7){ - scr_event_log("","Enemy Leader Assassinated: Ork Warboss"); - if (Warlord !=0){ - with (Warlord){ + if (enemy == 5) { + scr_event_log("", "Enemy Leader Assassinated: Ecclesiarchy Prioress"); + } + if (enemy == 6) { + scr_event_log("", "Enemy Leader Assassinated: Eldar Farseer"); + } + if (enemy == 7) { + scr_event_log("", "Enemy Leader Assassinated: Ork Warboss"); + if (Warlord != 0) { + with (Warlord) { kill_warboss(); } } - } - if (enemy=8) then scr_event_log("","Enemy Leader Assassinated: Tau Diplomat"); - if (enemy=10) then scr_event_log("","Enemy Leader Assassinated: Chaos Lord"); + } + if (enemy == 8) { + scr_event_log("", "Enemy Leader Assassinated: Tau Diplomat"); + } + if (enemy == 10) { + scr_event_log("", "Enemy Leader Assassinated: Chaos Lord"); + } } -var endline,inq_eated;endline=1; -inq_eated=false; - +var endline, inq_eated; +endline = 1; +inq_eated = false; -if (obj_ini.omophagea){ - var eatme=roll_dice_chapter(1, 100, "high"); - if (enemy=13) or (enemy=9) or (battle_special="ship_demon") then eatme+=100; - if (enemy=10) and (battle_object.p_traitors[battle_id]=7) then eatme+=200; +if (obj_ini.omophagea) { + var eatme = roll_dice_chapter(1, 100, "high"); + if ((enemy == 13) || (enemy == 9) || (battle_special == "ship_demon")) { + eatme += 100; + } + if ((enemy == 10) && (battle_object.p_traitors[battle_id] == 7)) { + eatme += 200; + } - if (red_thirst=3) then thirsty=1;if (red_thirst>3) then thirsty=red_thirst-2; - if (thirsty>0) then eatme-=(thirsty*6);if (really_thirsty>0) then eatme-=(really_thirsty*15); + if (red_thirst == 3) { + thirsty = 1; + } + if (red_thirst > 3) { + thirsty = red_thirst - 2; + } + if (thirsty > 0) { + eatme -= thirsty * 6; + } + if (really_thirsty > 0) { + eatme -= really_thirsty * 15; + } - if (allies>0){ - alter_dispositions([ - [eFACTION.Imperium,-choose(1,0,0)], - [eFACTION.Inquisition, -choose(0,0,1)], - [eFACTION.Ecclesiarchy, -choose(0,0,1)], - ]); + if (allies > 0) { + alter_dispositions([[eFACTION.Imperium, -choose(1, 0, 0)], [eFACTION.Inquisition, -choose(0, 0, 1)], [eFACTION.Ecclesiarchy, -choose(0, 0, 1)]]); } - if (present_inquisitor>0){ - alter_disposition(eFACTION.Inquisition,-4); + if (present_inquisitor > 0) { + alter_disposition(eFACTION.Inquisition, -4); } - if (eatme<=25){ - endline=0; - if (!thirsty && !really_thirsty){ - var ran;ran=choose(1,2); - newline="One of your marines slowly makes his way towards the fallen enemies, as if in a spell. Once close enough the helmet is removed and he begins shoveling parts of their carcasses into his mouth."; - newline="Two marines are sharing a quick discussion, and analysis of the battle, when one of the two suddenly drops down and begins shoveling parts of enemy corpses into his mouth."; - newline+=choose(" Bone snaps and pops."," Strange-colored blood squirts from between his teeth."," Veins and tendons squish wetly."); + if (eatme <= 25) { + endline = 0; + if (!thirsty && !really_thirsty) { + var ran; + ran = choose(1, 2); + newline = "One of your marines slowly makes his way towards the fallen enemies, as if in a spell. Once close enough the helmet is removed and he begins shoveling parts of their carcasses into his mouth."; + newline = "Two marines are sharing a quick discussion, and analysis of the battle, when one of the two suddenly drops down and begins shoveling parts of enemy corpses into his mouth."; + newline += choose(" Bone snaps and pops.", " Strange-colored blood squirts from between his teeth.", " Veins and tendons squish wetly."); } - if (thirsty>0) and (really_thirsty=0){ - var ran=choose(1,2); - newline="One of your Death Company marines slowly makes his way towards the fallen enemies, as if in a spell. Once close enough the helmet is removed and he begins shoveling parts of their carcasses into his mouth."; - newline="A marine is observing and communicating with a Death Company marine, to ensure they are responsive, when that Death Company marine drops down and suddenly begins shoveling parts of enemy corpses into his mouth."; - newline+=choose(" Bone snaps and pops."," Strange-colored blood squirts from between his teeth."," Veins and tendons squish wetly."); + if ((thirsty > 0) && (really_thirsty == 0)) { + var ran = choose(1, 2); + newline = "One of your Death Company marines slowly makes his way towards the fallen enemies, as if in a spell. Once close enough the helmet is removed and he begins shoveling parts of their carcasses into his mouth."; + newline = "A marine is observing and communicating with a Death Company marine, to ensure they are responsive, when that Death Company marine drops down and suddenly begins shoveling parts of enemy corpses into his mouth."; + newline += choose(" Bone snaps and pops.", " Strange-colored blood squirts from between his teeth.", " Veins and tendons squish wetly."); } - if (really_thirsty>0){ - newline=$"One of your Death Company {roles[6]} blitzes to the fallen enemy lines. Massive mechanical hands begin to rend and smash at the fallen corpses, trying to squeeze their flesh and blood through the sarcophogi opening."; + if (really_thirsty > 0) { + newline = $"One of your Death Company {roles[6]} blitzes to the fallen enemy lines. Massive mechanical hands begin to rend and smash at the fallen corpses, trying to squeeze their flesh and blood through the sarcophogi opening."; } - newline+=$" Almost at once most of the present {global.chapter_name} follow suit, joining in and starting a massive feeding frenzy. The sight is gruesome to behold."; + newline += $" Almost at once most of the present {global.chapter_name} follow suit, joining in and starting a massive feeding frenzy. The sight is gruesome to behold."; scr_newtext(); - // check for pdf/guardsmen - eatme=roll_dice_chapter(1, 100, "high"); - if (eatme<=10) and (allies>0){ - obj_controller.disposition[eFACTION.Imperium]-=2; - if (allies=1){ - newline="Local PDF have been eaten!"; - newline_color="red";scr_newtext(); - } - else if (allies=2){ - newline="Local Guardsmen have been eaten!"; - newline_color="red"; + eatme = roll_dice_chapter(1, 100, "high"); + if ((eatme <= 10) && (allies > 0)) { + obj_controller.disposition[eFACTION.Imperium] -= 2; + if (allies == 1) { + newline = "Local PDF have been eaten!"; + newline_color = "red"; + scr_newtext(); + } else if (allies == 2) { + newline = "Local Guardsmen have been eaten!"; + newline_color = "red"; scr_newtext(); } } // check for inquisitor - eatme=roll_dice_chapter(1, 100, "high"); - if (eatme<=40) and (present_inquisitor=1){ - var thatta=0,remove=0,i=0; - obj_controller.disposition[4]-=10; - inq_eated=true; + eatme = roll_dice_chapter(1, 100, "high"); + if ((eatme <= 40) && (present_inquisitor == 1)) { + var thatta = 0, remove = 0, i = 0; + obj_controller.disposition[4] -= 10; + inq_eated = true; instance_activate_object(obj_en_fleet); - if (instance_exists(inquisitor_ship)){ - repeat(2){ - scr_loyalty("Inquisitor Killer","+"); + if (instance_exists(inquisitor_ship)) { + repeat (2) { + scr_loyalty("Inquisitor Killer", "+"); + } + if (obj_controller.loyalty >= 85) { + obj_controller.last_world_inspection -= 44; + } + if ((obj_controller.loyalty >= 70) && (obj_controller.loyalty < 85)) { + obj_controller.last_world_inspection -= 32; + } + if ((obj_controller.loyalty >= 50) && (obj_controller.loyalty < 70)) { + obj_controller.last_world_inspection -= 20; + } + if (obj_controller.loyalty < 50) { + scr_loyalty("Inquisitor Killer", "+"); } - if (obj_controller.loyalty>=85) then obj_controller.last_world_inspection-=44; - if (obj_controller.loyalty>=70) and (obj_controller.loyalty<85) then obj_controller.last_world_inspection-=32; - if (obj_controller.loyalty>=50) and (obj_controller.loyalty<70) then obj_controller.last_world_inspection-=20; - if (obj_controller.loyalty<50) then scr_loyalty("Inquisitor Killer","+"); - var msg="",msg2="",i=0,remove=0; + var msg = "", msg2 = "", i = 0, remove = 0; // if (string_count("Inqis",inquisitor_ship.trade_goods)>0) then show_message("B"); - if (inquisitor_ship.inquisitor>0){ + if (inquisitor_ship.inquisitor > 0) { var inquis_name = obj_controller.inquisitor[inquisitor_ship.inquisitor]; - newline=$"Inquisitor {inquis_name} has been eaten!"; - msg=$"Inquisitor {inquis_name}" - remove=obj_controller.inquisitor[inquisitor_ship.inquisitor]; - scr_event_log("red",$"Your Astartes consume {msg}."); + newline = $"Inquisitor {inquis_name} has been eaten!"; + msg = $"Inquisitor {inquis_name}"; + remove = obj_controller.inquisitor[inquisitor_ship.inquisitor]; + scr_event_log("red", $"Your Astartes consume {msg}."); } - newline_color="red"; + newline_color = "red"; scr_newtext(); - if (obj_controller.inquisitor_type[remove]="Ordo Hereticus") then scr_loyalty("Inquisitor Killer","+"); - - i=remove; - repeat(10-remove){ - if (i<10){ - obj_controller.inquisitor_gender[i]=obj_controller.inquisitor_gender[i+1]; - obj_controller.inquisitor_type[i]=obj_controller.inquisitor_type[i+1]; - obj_controller.inquisitor[i]=obj_controller.inquisitor[i+1]; + if (obj_controller.inquisitor_type[remove] == "Ordo Hereticus") { + scr_loyalty("Inquisitor Killer", "+"); + } + + i = remove; + repeat (10 - remove) { + if (i < 10) { + obj_controller.inquisitor_gender[i] = obj_controller.inquisitor_gender[i + 1]; + obj_controller.inquisitor_type[i] = obj_controller.inquisitor_type[i + 1]; + obj_controller.inquisitor[i] = obj_controller.inquisitor[i + 1]; } - if (i=10){ - obj_controller.inquisitor_gender[i]=choose(0,0,0,1,1,1,1); // 4:3 chance of male Inquisitor - obj_controller.inquisitor_type[i]=choose("Ordo Malleus","Ordo Xenos","Ordo Hereticus","Ordo Hereticus","Ordo Hereticus","Ordo Hereticus","Ordo Hereticus","Ordo Hereticus"); - obj_controller.inquisitor[i]=global.name_generator.generate_imperial_name(obj_controller.inquisitor_gender[i]);// For 'random inquisitor wishes to inspect your fleet + if (i == 10) { + obj_controller.inquisitor_gender[i] = choose(0, 0, 0, 1, 1, 1, 1); // 4:3 chance of male Inquisitor + obj_controller.inquisitor_type[i] = choose("Ordo Malleus", "Ordo Xenos", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus"); + obj_controller.inquisitor[i] = global.name_generator.generate_imperial_name(obj_controller.inquisitor_gender[i]); // For 'random inquisitor wishes to inspect your fleet } - i+=1; + i += 1; } instance_activate_object(obj_turn_end); - if (obj_controller.known[eFACTION.Inquisition]<3){ - scr_event_log("red","EXCOMMUNICATUS TRAITORUS"); - obj_controller.alarm[8]=1; - if ((!instance_exists(obj_turn_end))){ - var pip=instance_create(0,0,obj_popup); - pip.title="Inquisitor Killed"; - pip.text=msg; - pip.image="inquisition"; - pip.cooldown=30; - pip.title="EXCOMMUNICATUS TRAITORUS"; - pip.text=$"The Inquisition has noticed your uncalled CONSUMPTION of {msg} and declared your chapter Excommunicatus Traitorus."; + if (obj_controller.known[eFACTION.Inquisition] < 3) { + scr_event_log("red", "EXCOMMUNICATUS TRAITORUS"); + obj_controller.alarm[8] = 1; + if (!instance_exists(obj_turn_end)) { + var pip = instance_create(0, 0, obj_popup); + pip.title = "Inquisitor Killed"; + pip.text = msg; + pip.image = "inquisition"; + pip.cooldown = 30; + pip.title = "EXCOMMUNICATUS TRAITORUS"; + pip.text = $"The Inquisition has noticed your uncalled CONSUMPTION of {msg} and declared your chapter Excommunicatus Traitorus."; instance_deactivate_object(obj_popup); } else { - scr_popup("Inquisitor Killed",$"The Inquisition has noticed your uncalled CONSUMPTION of {msg} and declared your chapter Excommunicatus Traitorus.","inquisition",""); + scr_popup("Inquisitor Killed", $"The Inquisition has noticed your uncalled CONSUMPTION of {msg} and declared your chapter Excommunicatus Traitorus.", "inquisition", ""); } } instance_deactivate_object(obj_turn_end); - with(inquisitor_ship){instance_destroy();} - with(obj_ground_mission){instance_destroy();} + with (inquisitor_ship) { + instance_destroy(); + } + with (obj_ground_mission) { + instance_destroy(); + } } instance_deactivate_object(obj_star); instance_deactivate_object(obj_en_fleet); @@ -818,17 +842,17 @@ if (obj_ini.omophagea){ } } -if (inq_eated=false) and (obj_ncombat.sorcery_seen>=2){ - scr_loyalty("Use of Sorcery","+"); - newline="Inquisitor "+string(obj_controller.inquisitor[1])+" witnessed your Chapter using sorcery."; - scr_event_log("green",string(newline)); +if ((inq_eated == false) && (obj_ncombat.sorcery_seen >= 2)) { + scr_loyalty("Use of Sorcery", "+"); + newline = "Inquisitor " + string(obj_controller.inquisitor[1]) + " witnessed your Chapter using sorcery."; + scr_event_log("green", string(newline)); scr_newtext(); } -if (exterminatus>0) and (dropping!=0){ - newline="Exterminatus has been succesfully placed."; - newline_color="yellow"; - endline=0; +if ((exterminatus > 0) && (dropping != 0)) { + newline = "Exterminatus has been succesfully placed."; + newline_color = "yellow"; + endline = 0; scr_newtext(); } @@ -836,89 +860,107 @@ instance_activate_object(obj_star); instance_activate_object(obj_turn_end); //If not fleet based and... -if (obj_ini.fleet_type != ePlayerBase.home_world) and (defeat==1) and (dropping==0){ - var monastery_list = search_planet_features(battle_object.p_feature[obj_ncombat.battle_id], P_features.Monastery); - var monastery_count = array_length(monastery_list); - if(monastery_count>0){ - for (var mon = 0;mon < monastery_count;mon++){ - battle_object.p_feature[obj_ncombat.battle_id][monastery_list[mon]].status="destroyed"; - } - - if (obj_controller.und_gene_vaults=0) then newline="Your Fortress Monastery has been raided. "+string(obj_controller.gene_seed)+" Gene-Seed has been destroyed or stolen."; - if (obj_controller.und_gene_vaults>0) then newline="Your Fortress Monastery has been raided. "+string(floor(obj_controller.gene_seed/10))+" Gene-Seed has been destroyed or stolen."; - - scr_event_log("red",newline, battle_object.name); - instance_activate_object(obj_event_log); - newline_color="red";scr_newtext(); - - var lasers_lost,defenses_lost,silos_lost; - lasers_lost=0;defenses_lost=0;silos_lost=0; - - if (player_defenses>0){ - defenses_lost=round(player_defenses*0.75); - } - if (battle_object.p_silo[obj_ncombat.battle_id]>0){ - silos_lost=round(battle_object.p_silo[obj_ncombat.battle_id]*0.75); - } - if (battle_object.p_lasers[obj_ncombat.battle_id]>0){ - lasers_lost=round(battle_object.p_lasers[obj_ncombat.battle_id]*0.75); - } - - if (player_defenses<30) then defenses_lost=player_defenses; - if (battle_object.p_silo[obj_ncombat.battle_id]<30){ - silos_lost=battle_object.p_silo[obj_ncombat.battle_id]; - } - if (battle_object.p_lasers[obj_ncombat.battle_id]<8){ - lasers_lost=battle_object.p_lasers[obj_ncombat.battle_id]; - } - - var percent;percent=0;newline=""; - if (defenses_lost>0){ - percent=round((defenses_lost/player_defenses)*100); - newline=string(defenses_lost)+" Weapon Emplacements have been lost ("+string(percent)+"%)."; - } - if (silos_lost>0){ - percent=round((silos_lost/battle_object.p_silo[obj_ncombat.battle_id])*100); - if (defenses_lost>0) then newline+=" "; - newline+=string(silos_lost)+$" Missile Silos have been lost ({percent}%)."; - } - if (lasers_lost>0){ - percent=round((lasers_lost/battle_object.p_lasers[obj_ncombat.battle_id])*100); - if (silos_lost>0) or (defenses_lost>0) then newline+=" "; - newline+=string(lasers_lost)+" Defense Lasers have been lost ("+string(percent)+"%)."; - } - - battle_object.p_defenses[obj_ncombat.battle_id]-=defenses_lost; - battle_object.p_silo[obj_ncombat.battle_id]-=silos_lost; - battle_object.p_lasers[obj_ncombat.battle_id]-=lasers_lost; - if (defenses_lost+silos_lost+lasers_lost>0){newline_color="red";scr_newtext();} - - endline=0; - - if (obj_controller.und_gene_vaults=0){ +if ((obj_ini.fleet_type != ePlayerBase.home_world) && (defeat == 1) && (dropping == 0)) { + var monastery_list = search_planet_features(battle_object.p_feature[obj_ncombat.battle_id], P_features.Monastery); + var monastery_count = array_length(monastery_list); + if (monastery_count > 0) { + for (var mon = 0; mon < monastery_count; mon++) { + battle_object.p_feature[obj_ncombat.battle_id][monastery_list[mon]].status = "destroyed"; + } + + if (obj_controller.und_gene_vaults == 0) { + newline = "Your Fortress Monastery has been raided. " + string(obj_controller.gene_seed) + " Gene-Seed has been destroyed or stolen."; + } + if (obj_controller.und_gene_vaults > 0) { + newline = "Your Fortress Monastery has been raided. " + string(floor(obj_controller.gene_seed / 10)) + " Gene-Seed has been destroyed or stolen."; + } + + scr_event_log("red", newline, battle_object.name); + instance_activate_object(obj_event_log); + newline_color = "red"; + scr_newtext(); + + var lasers_lost, defenses_lost, silos_lost; + lasers_lost = 0; + defenses_lost = 0; + silos_lost = 0; + + if (player_defenses > 0) { + defenses_lost = round(player_defenses * 0.75); + } + if (battle_object.p_silo[obj_ncombat.battle_id] > 0) { + silos_lost = round(battle_object.p_silo[obj_ncombat.battle_id] * 0.75); + } + if (battle_object.p_lasers[obj_ncombat.battle_id] > 0) { + lasers_lost = round(battle_object.p_lasers[obj_ncombat.battle_id] * 0.75); + } + + if (player_defenses < 30) { + defenses_lost = player_defenses; + } + if (battle_object.p_silo[obj_ncombat.battle_id] < 30) { + silos_lost = battle_object.p_silo[obj_ncombat.battle_id]; + } + if (battle_object.p_lasers[obj_ncombat.battle_id] < 8) { + lasers_lost = battle_object.p_lasers[obj_ncombat.battle_id]; + } + + var percent; + percent = 0; + newline = ""; + if (defenses_lost > 0) { + percent = round((defenses_lost / player_defenses) * 100); + newline = string(defenses_lost) + " Weapon Emplacements have been lost (" + string(percent) + "%)."; + } + if (silos_lost > 0) { + percent = round((silos_lost / battle_object.p_silo[obj_ncombat.battle_id]) * 100); + if (defenses_lost > 0) { + newline += " "; + } + newline += string(silos_lost) + $" Missile Silos have been lost ({percent}%)."; + } + if (lasers_lost > 0) { + percent = round((lasers_lost / battle_object.p_lasers[obj_ncombat.battle_id]) * 100); + if ((silos_lost > 0) || (defenses_lost > 0)) { + newline += " "; + } + newline += string(lasers_lost) + " Defense Lasers have been lost (" + string(percent) + "%)."; + } + + battle_object.p_defenses[obj_ncombat.battle_id] -= defenses_lost; + battle_object.p_silo[obj_ncombat.battle_id] -= silos_lost; + battle_object.p_lasers[obj_ncombat.battle_id] -= lasers_lost; + if (defenses_lost + silos_lost + lasers_lost > 0) { + newline_color = "red"; + scr_newtext(); + } + + endline = 0; + + if (obj_controller.und_gene_vaults == 0) { //all Gene Pod Incubators and gene seed are lost - destroy_all_gene_slaves(false); - } - if (obj_controller.und_gene_vaults>0) then obj_controller.gene_seed-=floor(obj_controller.gene_seed/10); - } + destroy_all_gene_slaves(false); + } + if (obj_controller.und_gene_vaults > 0) { + obj_controller.gene_seed -= floor(obj_controller.gene_seed / 10); + } + } } instance_deactivate_object(obj_star); instance_deactivate_object(obj_turn_end); -if (endline=0){ - newline=line_break; +if (endline == 0) { + newline = line_break; scr_newtext(); - newline=line_break; + newline = line_break; scr_newtext(); } - -if (defeat == 1){ - player_forces=0; - if (ground_mission){ - obj_ground_mission.recoverable_gene_seed = seed_lost; - } - +if (defeat == 1) { + player_forces = 0; + if (ground_mission) { + obj_ground_mission.recoverable_gene_seed = seed_lost; + } } gene_slaves = []; diff --git a/objects/obj_ncombat/Alarm_6.gml b/objects/obj_ncombat/Alarm_6.gml index 95370e80fd..aec8c6c53f 100644 --- a/objects/obj_ncombat/Alarm_6.gml +++ b/objects/obj_ncombat/Alarm_6.gml @@ -1,5 +1,6 @@ - -if (battle_over=1) then exit; +if (battle_over == 1) { + exit; +} /*if (messages_to_show = 24){ if (enemy_forces<=0) or (!instance_exists(obj_enunit)) and (defeat_message=0){defeat_message=1; diff --git a/objects/obj_ncombat/Alarm_7.gml b/objects/obj_ncombat/Alarm_7.gml index 2d689e37c5..e6a7c0b1e3 100644 --- a/objects/obj_ncombat/Alarm_7.gml +++ b/objects/obj_ncombat/Alarm_7.gml @@ -1,533 +1,598 @@ try { // show_debug_message("alarm 7 start"); audio_stop_sound(snd_battle); - audio_play_sound(snd_royal,0,true); + audio_play_sound(snd_royal, 0, true); audio_sound_gain(snd_royal, 0, 0); - var nope=0;if (obj_controller.master_volume=0) or (obj_controller.music_volume=0) then nope=1; - if (nope!=1){ - audio_sound_gain(snd_royal,0.25*obj_controller.master_volume*obj_controller.music_volume,2000); + var nope = 0; + if ((obj_controller.master_volume == 0) || (obj_controller.music_volume == 0)) { + nope = 1; } - + if (nope != 1) { + audio_sound_gain(snd_royal, 0.25 * obj_controller.master_volume * obj_controller.music_volume, 2000); + } + // scr_dead_marines(1); - + // Execute the cleaning scripts // Check for any more battles - - obj_controller.cooldown=10; - - + + obj_controller.cooldown = 10; + log_message($"Ground Combat - {defeat ? "Defeat" : "Victory"}Victory - Enemy:{enemy} ({battle_special})"); - - + // If battling own dudes, then remove the loyalists after the fact - - - if (enemy=1){ - - var j=-1 - var cleann = array_create(11,false) - with(obj_enunit){var q=0; - repeat(700){ - q+=1; - if (dude_id[q]>0){ - var commandy=false; - var nco=dude_co[q]; - var nid=dude_id[q]; - cleann[nco]=true; - + + if (enemy == 1) { + var j = -1; + var cleann = array_create(11, false); + with (obj_enunit) { + var q = 0; + repeat (700) { + q += 1; + if (dude_id[q] > 0) { + var commandy = false; + var nco = dude_co[q]; + var nid = dude_id[q]; + cleann[nco] = true; + // show_message("dude ID:"+string(q)+" ("+string(obj_ini.name[nco,nid])+") is being removed from the array"); - - commandy=is_specialist(obj_ini.role[nco,nid]); - if (commandy=true) then obj_controller.command-=1; - if (commandy=false) then obj_controller.marines-=1; - - obj_ncombat.world_size+=scr_unit_size(obj_ini.armour[nco][nid],obj_ini.role[nco][nid],true, obj_ini.mobi[nco][nid]); - - var recover = !obj_ncombat.defeat - kill_and_recover(nco,nid, recover, recover); + + commandy = is_specialist(obj_ini.role[nco][nid]); + if (commandy == true) { + obj_controller.command -= 1; + } + if (commandy == false) { + obj_controller.marines -= 1; + } + + obj_ncombat.world_size += scr_unit_size(obj_ini.armour[nco][nid], obj_ini.role[nco][nid], true, obj_ini.mobi[nco][nid]); + + var recover = !obj_ncombat.defeat; + kill_and_recover(nco, nid, recover, recover); } } } - - for (j=0;j<=10;j++){ - if (cleann[j]) then with(obj_ini){ - scr_company_order(j); + + for (j = 0; j <= 10; j++) { + if (cleann[j]) { + with (obj_ini) { + scr_company_order(j); + } } } } - if (string_count("cs_meeting",battle_special)>0){ - with(obj_temp_meeting){instance_destroy();} - - with(obj_star){ - if (name=obj_ncombat.battle_loc){ - instance_create(x,y,obj_temp_meeting); - var i=0,ii=0,otm,good=0,master_present=0; - var run=0,s=0,chaos_meeting=0; - + if (string_count("cs_meeting", battle_special) > 0) { + with (obj_temp_meeting) { + instance_destroy(); + } + + with (obj_star) { + if (name == obj_ncombat.battle_loc) { + instance_create(x, y, obj_temp_meeting); + var i = 0, ii = 0, otm, good = 0, master_present = 0; + var run = 0, s = 0, chaos_meeting = 0; + var master_index = array_get_index(obj_ini.role[0], obj_ini.role[100][eROLE.ChapterMaster]); - chaos_meeting=fetch_unit([0,master_index]).planet_location; - + chaos_meeting = fetch_unit([0, master_index]).planet_location; + // show_message("meeting planet:"+string(chaos_meeting)); - for (var co=0;co<=10;co++){ - for (var i=0;i=3) then show_message(string(obj_ini.role[co][i])+": "+string(co)+"."+string(i)); - - if (good>=3){ - obj_temp_meeting.dudes+=1; - otm=obj_temp_meeting.dudes; - obj_temp_meeting.present[otm]=1; - obj_temp_meeting.co[otm]=co; - obj_temp_meeting.ide[otm]=i; - if (obj_ini.role[co][i]==obj_ini.role[100][eROLE.ChapterMaster]) then master_present=1; + + if (good >= 3) { + obj_temp_meeting.dudes += 1; + otm = obj_temp_meeting.dudes; + obj_temp_meeting.present[otm] = 1; + obj_temp_meeting.co[otm] = co; + obj_temp_meeting.ide[otm] = i; + if (obj_ini.role[co][i] == obj_ini.role[100][eROLE.ChapterMaster]) { + master_present = 1; + } } } } // show_message("obj_temp_meeting.dudes:"+string(obj_temp_meeting.dudes)); - } } } - - - - + var _lost_banner = post_equipment_lost.has_item("Company Standard"); - if (_lost_banner!=-1){ - repeat(_lost_banner){ - scr_loyalty("Lost Standard","+"); + if (_lost_banner != -1) { + repeat (_lost_banner) { + scr_loyalty("Lost Standard", "+"); } } - - if (battle_special="ruins" || battle_special="ruins_eldar"){ - obj_ground_mission.defeat=defeat; + + if (battle_special == "ruins" || battle_special == "ruins_eldar") { + obj_ground_mission.defeat = defeat; obj_ground_mission.explore_feature.ruins_combat_end(); - } - - else if (battle_special="WL10_reveal") or (battle_special="WL10_later"){var moar,ox,oy; - with(obj_temp8){instance_destroy();} - - if (chaos_angry>=5){ - if (string_count("|CPF|",obj_controller.useful_info)=0) then obj_controller.useful_info+="|CPF|"; + } else if ((battle_special == "WL10_reveal") || (battle_special == "WL10_later")) { + var moar, ox, oy; + with (obj_temp8) { + instance_destroy(); + } + + if (chaos_angry >= 5) { + if (string_count("|CPF|", obj_controller.useful_info) == 0) { + obj_controller.useful_info += "|CPF|"; + } } - - if (battle_special="WL10_reveal"){ - instance_create(battle_object.x,battle_object.y,obj_temp8); - ox=battle_object.x;oy=battle_object.y;// battle_object.owner = eFACTION.Chaos; - battle_object.p_traitors[battle_id]=6; - battle_object.p_chaos[battle_id]=4; - battle_object.p_pdf[battle_id]=0; - battle_object.p_owner[battle_id]=10; - - var corro;corro=0; - - repeat(100){var ii;ii=0; - if (corro<=5){ - moar=instance_nearest(ox,oy,obj_star); - - if (moar.owner<=3){corro+=1; - repeat(4){ii+=1; - if (moar.p_owner[ii]<=3) moar.p_heresy[ii]=min(100,moar.p_heresy[ii]+floor(random_range(30,50))); + + if (battle_special == "WL10_reveal") { + instance_create(battle_object.x, battle_object.y, obj_temp8); + ox = battle_object.x; + oy = battle_object.y; // battle_object.owner = eFACTION.Chaos; + battle_object.p_traitors[battle_id] = 6; + battle_object.p_chaos[battle_id] = 4; + battle_object.p_pdf[battle_id] = 0; + battle_object.p_owner[battle_id] = 10; + + var corro; + corro = 0; + + repeat (100) { + var ii; + ii = 0; + if (corro <= 5) { + moar = instance_nearest(ox, oy, obj_star); + + if (moar.owner <= 3) { + corro += 1; + repeat (4) { + ii += 1; + if (moar.p_owner[ii] <= 3) { + moar.p_heresy[ii] = min(100, moar.p_heresy[ii] + floor(random_range(30, 50))); + } } } - moar.y-=20000; + moar.y -= 20000; } } - with(obj_star){if (y<-12000) then y+=20000;} - - if (battle_object.present_fleet[2]>0){ - with(obj_en_fleet){ - if (navy=0) and (owner = eFACTION.Imperium) and (point_distance(x,y,obj_temp8.x,obj_temp8.y)<40){ - owner = eFACTION.Chaos;sprite_index=spr_fleet_chaos; - if (image_index<=2){escort_number+=3;frigate_number+=1;} - if (capital_number=0) then capital_number+=1; + with (obj_star) { + if (y < -12000) { + y += 20000; + } + } + + if (battle_object.present_fleet[2] > 0) { + with (obj_en_fleet) { + if ((navy == 0) && (owner == eFACTION.Imperium) && (point_distance(x, y, obj_temp8.x, obj_temp8.y) < 40)) { + owner = eFACTION.Chaos; + sprite_index = spr_fleet_chaos; + if (image_index <= 2) { + escort_number += 3; + frigate_number += 1; + } + if (capital_number == 0) { + capital_number += 1; + } } } - battle_object.present_fleet[2]-=1; - battle_object.present_fleet[10]+=1; + battle_object.present_fleet[2] -= 1; + battle_object.present_fleet[10] += 1; + } + with (obj_temp8) { + instance_destroy(); } - with(obj_temp8){instance_destroy();} } - - if (defeat == 1) and (battle_special="WL10_reveal"){ - obj_controller.audience=10; + + if ((defeat == 1) && (battle_special == "WL10_reveal")) { + obj_controller.audience = 10; scr_toggle_diplomacy(); - obj_controller.diplomacy=10; - obj_controller.known[eFACTION.Chaos]=2; - with(obj_controller){scr_dialogue("intro2");} + obj_controller.diplomacy = 10; + obj_controller.known[eFACTION.Chaos] = 2; + with (obj_controller) { + scr_dialogue("intro2"); + } } - if (defeat == 0){ - obj_controller.known[eFACTION.Chaos]=2; - obj_controller.faction_defeated[10]=1; - - if (instance_exists(obj_turn_end)){ - scr_event_log("","Enemy Leader Assassinated: Chaos Lord"); - scr_alert("","ass","Chaos Lord "+string(obj_controller.faction_leader[eFACTION.Chaos])+" has been killed.",0,0); - scr_popup("Chaos Lord Killed","Chaos Lord "+string(obj_controller.faction_leader[eFACTION.Chaos])+" has been slain in combat. Without his leadership the various forces of Chaos in the sector will crumble apart and disintegrate from infighting. Sector "+string(obj_ini.sector_name)+" is no longer as threatened by the forces of Chaos.","",""); - } - if (!instance_exists(obj_turn_end)){ - scr_event_log("","Enemy Leader Assassinated: Chaos Lord"); - var _pop = instance_create(0,0,obj_popup); + if (defeat == 0) { + obj_controller.known[eFACTION.Chaos] = 2; + obj_controller.faction_defeated[10] = 1; + + if (instance_exists(obj_turn_end)) { + scr_event_log("", "Enemy Leader Assassinated: Chaos Lord"); + scr_alert("", "ass", "Chaos Lord " + string(obj_controller.faction_leader[eFACTION.Chaos]) + " has been killed.", 0, 0); + scr_popup("Chaos Lord Killed", "Chaos Lord " + string(obj_controller.faction_leader[eFACTION.Chaos]) + " has been slain in combat. Without his leadership the various forces of Chaos in the sector will crumble apart and disintegrate from infighting. Sector " + string(obj_ini.sector_name) + " is no longer as threatened by the forces of Chaos.", "", ""); + } + if (!instance_exists(obj_turn_end)) { + scr_event_log("", "Enemy Leader Assassinated: Chaos Lord"); + var _pop = instance_create(0, 0, obj_popup); _pop.image = ""; _pop.title = "Chaos Lord Killed"; - _pop.text = "Chaos Lord "+string(obj_controller.faction_leader[eFACTION.Chaos])+" has been slain in combat. Without his leadership the various forces of Chaos in the sector will crumble apart and disintegrate from infighting. Sector "+string(obj_ini.sector_name)+" is no longer as threatened by the forces of Chaos."; + _pop.text = "Chaos Lord " + string(obj_controller.faction_leader[eFACTION.Chaos]) + " has been slain in combat. Without his leadership the various forces of Chaos in the sector will crumble apart and disintegrate from infighting. Sector " + string(obj_ini.sector_name) + " is no longer as threatened by the forces of Chaos."; } - } } - - - - - if (battle_special="study2a") or (battle_special="study2b"){ - if (defeat == 1){ - var ii=0,good=0; - - if (remove_planet_problem(battle_id, "mech_tomb", battle_object)){ - obj_controller.disposition[eFACTION.Mechanicus]-=10; - - if (battle_special="study2a"){ - scr_popup("Mechanicus Mission Failed","All of your Astartes and the Mechanicus Research party have been killed down to the last man. The research is a bust, and the Adeptus Mechanicus is furious with your chapter for not providing enough security. Relations with them are worse than before.","",""); + + if ((battle_special == "study2a") || (battle_special == "study2b")) { + if (defeat == 1) { + var ii = 0, good = 0; + + if (remove_planet_problem(battle_id, "mech_tomb", battle_object)) { + obj_controller.disposition[eFACTION.Mechanicus] -= 10; + + if (battle_special == "study2a") { + scr_popup("Mechanicus Mission Failed", "All of your Astartes and the Mechanicus Research party have been killed down to the last man. The research is a bust, and the Adeptus Mechanicus is furious with your chapter for not providing enough security. Relations with them are worse than before.", "", ""); } - if (battle_special="study2b"){ - battle_object.p_necrons[battle_id]=5; - awaken_tomb_world( battle_object.p_feature[battle_id]); - alter_dispositions([ - [eFACTION.Mechanicus, -15], - [eFACTION.Inquisition, -5], - ]); - scr_popup("Mechanicus Mission Failed","All of your Astartes and the Mechanicus Research party have been killed down to the last man. The research is a bust. To make matters worse the Necron Tomb has fully awakened- countless numbers of the souless machines are now pouring out of the tomb. The Adeptus Mechanicus are furious with your chapter.","necron_army",""); - scr_alert("","inqi","The Inquisition is displeased with your Chapter for tampering with and awakening a Necron Tomb",0,0); - scr_event_log("","The Inquisition is displeased with your Chapter for tampering with and awakening a Necron Tomb"); + if (battle_special == "study2b") { + battle_object.p_necrons[battle_id] = 5; + awaken_tomb_world(battle_object.p_feature[battle_id]); + alter_dispositions([[eFACTION.Mechanicus, -15], [eFACTION.Inquisition, -5]]); + scr_popup("Mechanicus Mission Failed", "All of your Astartes and the Mechanicus Research party have been killed down to the last man. The research is a bust. To make matters worse the Necron Tomb has fully awakened- countless numbers of the souless machines are now pouring out of the tomb. The Adeptus Mechanicus are furious with your chapter.", "necron_army", ""); + scr_alert("", "inqi", "The Inquisition is displeased with your Chapter for tampering with and awakening a Necron Tomb", 0, 0); + scr_event_log("", "The Inquisition is displeased with your Chapter for tampering with and awakening a Necron Tomb"); } - - scr_event_log("","Mechanicus Mission Failed: Necron Tomb Research Party and present astartes have been killed."); + + scr_event_log("", "Mechanicus Mission Failed: Necron Tomb Research Party and present astartes have been killed."); } } } - - - - - if (enemy=5) and (obj_controller.faction_status[eFACTION.Ecclesiarchy]!="War"){ - obj_controller.loyalty-=50; - obj_controller.loyalty_hidden-=50; + + if ((enemy == 5) && (obj_controller.faction_status[eFACTION.Ecclesiarchy] != "War")) { + obj_controller.loyalty -= 50; + obj_controller.loyalty_hidden -= 50; decare_war_on_imperium_audiences(); } - - - - - if (exterminatus>0) and (dropping!=0) and (string_count("mech",battle_special)=0){ + + if ((exterminatus > 0) && (dropping != 0) && (string_count("mech", battle_special) == 0)) { scr_destroy_planet(1); } - - if (string_count("mech",battle_special)>0) and (defeat=0) then with(obj_ground_mission){ - var comp,plan,i;i=0;comp=0;plan=0; - plan=instance_nearest(x,y,obj_star); - scr_return_ship(obj_ground_mission.loc,obj_ground_mission,obj_ground_mission.num); - with(obj_ground_mission){instance_destroy();} + + if ((string_count("mech", battle_special) > 0) && (defeat == 0)) { + with (obj_ground_mission) { + var comp, plan, i; + i = 0; + comp = 0; + plan = 0; + plan = instance_nearest(x, y, obj_star); + scr_return_ship(obj_ground_mission.loc, obj_ground_mission, obj_ground_mission.num); + with (obj_ground_mission) { + instance_destroy(); + } + } } - - with(obj_ini){ - for (var i=0;i<=10;i++){ + + with (obj_ini) { + for (var i = 0; i <= 10; i++) { scr_company_order(i); scr_vehicle_order(i); } } - - obj_controller.x=view_x; - obj_controller.y=view_y; - obj_controller.combat=0; - obj_controller.marines-=final_marine_deaths; - obj_controller.command-=final_command_deaths; - + + obj_controller.x = view_x; + obj_controller.y = view_y; + obj_controller.combat = 0; + obj_controller.marines -= final_marine_deaths; + obj_controller.command -= final_command_deaths; + instance_activate_all(); - - - if (turn_count < 20){ - if (defeat == 0) and (threat>=4) then scr_recent("battle_victory", $"{battle_loc} {scr_roman(battle_id)}",enemy); - - - - if (defeat == 1) and (final_marine_deaths+final_command_deaths>=10) then scr_recent("battle_defeat", $"{enemy}, {final_marine_deaths+final_command_deaths}"); + + if (turn_count < 20) { + if ((defeat == 0) && (threat >= 4)) { + scr_recent("battle_victory", $"{battle_loc} {scr_roman(battle_id)}", enemy); + } + + if ((defeat == 1) && (final_marine_deaths + final_command_deaths >= 10)) { + scr_recent("battle_defeat", $"{enemy}, {final_marine_deaths + final_command_deaths}"); + } } else { - scr_recent("battle_defeat",$"{enemy}, {final_marine_deaths+final_command_deaths}"); + scr_recent("battle_defeat", $"{enemy}, {final_marine_deaths + final_command_deaths}"); } - - - - if ((dropping=1) or (attacking=1)) and (string_count("_attack",battle_special)=0) and (string_count("mech",battle_special)=0) and (string_count("ruins",battle_special)=0) and (battle_special!="ship_demon"){ - obj_controller.combat=0; - with(obj_drop_select){ - instance_destroy() - }; + + if (((dropping == 1) || (attacking == 1)) && (string_count("_attack", battle_special) == 0) && (string_count("mech", battle_special) == 0) && (string_count("ruins", battle_special) == 0) && (battle_special != "ship_demon")) { + obj_controller.combat = 0; + with (obj_drop_select) { + instance_destroy(); + } } - if ((dropping+attacking=0)) and (string_count("_attack",battle_special)=0) and (string_count("mech",battle_special)=0) and (string_count("ruins",battle_special)=0) and (battle_special!="ship_demon") and (string_count("cs_meeting",battle_special)=0){ - - if (instance_exists(obj_turn_end)){ + if ((dropping + attacking == 0) && (string_count("_attack", battle_special) == 0) && (string_count("mech", battle_special) == 0) && (string_count("ruins", battle_special) == 0) && (battle_special != "ship_demon") && (string_count("cs_meeting", battle_special) == 0)) { + if (instance_exists(obj_turn_end)) { var _battle_index = obj_turn_end.current_battle; - if (_battle_index0) and (defeat=1){ + if ((string_count("ruins", battle_special) > 0) && (defeat == 1)) { //TODO this logic is wrong assumes all player units died in ruins var _combat_star = star_by_name(obj_ncombat.battle_loc); - if (_combat_star!="none"){ - _combat_star.p_player[obj_ncombat.battle_id]-=obj_ncombat.world_size; + if (_combat_star != "none") { + _combat_star.p_player[obj_ncombat.battle_id] -= obj_ncombat.world_size; } } - - if (battle_mission == "necron_tomb_excursion"){ + + if (battle_mission == "necron_tomb_excursion") { necron_tomb_raid_post_battle_sequence(); } - - - if ((string_count("spyrer",battle_special)>0))/* and (string_count("demon",battle_special)>0))*/ and (defeat=0){ + + if ((string_count("spyrer", battle_special) > 0) /* and (string_count("demon",battle_special)>0))*/ && (defeat == 0)) { instance_activate_object(obj_star); // show_message(obj_turn_end.current_battle); // show_message(obj_turn_end.battle_world[obj_turn_end.current_battle]); // title / text / image / speshul var cur_star = obj_turn_end.battle_object[obj_turn_end.current_battle]; - var planet = obj_turn_end.battle_world[obj_turn_end.current_battle] - var _planet_string = scr_roman_numerals()[planet-1]; - - remove_planet_problem(planet ,"spyrer",cur_star) - - var tixt=$"The Spyrer on {cur_star.name} {_planet_string} has been removed. The citizens and craftsman may sleep more soundly, the Inquisition likely pleased." - - scr_popup("Inquisition Mission Completed",tixt,"spyrer",""); - - if (obj_controller.demanding=0) then obj_controller.disposition[4]+=2; - if (obj_controller.demanding=1) then obj_controller.disposition[4]+=choose(0,0,1); - - scr_event_log("","Inquisition Mission Completed: The Spyrer on {cur_star.name} {planet} has been removed.", cur_star.name); - scr_gov_disp(cur_star.name,planet,choose(1,2,3,4)); - + var planet = obj_turn_end.battle_world[obj_turn_end.current_battle]; + var _planet_string = scr_roman_numerals()[planet - 1]; + + remove_planet_problem(planet, "spyrer", cur_star); + + var tixt = $"The Spyrer on {cur_star.name} {_planet_string} has been removed. The citizens and craftsman may sleep more soundly, the Inquisition likely pleased."; + + scr_popup("Inquisition Mission Completed", tixt, "spyrer", ""); + + if (obj_controller.demanding == 0) { + obj_controller.disposition[4] += 2; + } + if (obj_controller.demanding == 1) { + obj_controller.disposition[4] += choose(0, 0, 1); + } + + scr_event_log("", "Inquisition Mission Completed: The Spyrer on {cur_star.name} {planet} has been removed.", cur_star.name); + scr_gov_disp(cur_star.name, planet, choose(1, 2, 3, 4)); + instance_deactivate_object(obj_star); - } else if (battle_special == "protect_raiders"){ - protect_raiders_battle_aftermath() - } - - else if (string_count("fallen",battle_special)>0){ + } else if (battle_special == "protect_raiders") { + protect_raiders_battle_aftermath(); + } else if (string_count("fallen", battle_special) > 0) { hunt_fallen_battle_aftermath(); - } - - else if (defeat == 0) and (enemy=9) and (battle_special="tyranid_org"){ - if (captured_gaunt>1){ - _pop = instance_create(0,0,obj_popup); + } else if ((defeat == 0) && (enemy == 9) && (battle_special == "tyranid_org")) { + if (captured_gaunt > 1) { + _pop = instance_create(0, 0, obj_popup); _pop.image = "inquisition"; _pop.title = "Inquisition Mission Completed"; _pop.text = "You have captured several Gaunt organisms. The Inquisitor is pleased with your work, though she notes that only one is needed- the rest are to be purged. It will be stored until it may be retrieved. The mission is a success."; } - if (captured_gaunt=1){ - _pop = instance_create(0,0,obj_popup); + if (captured_gaunt == 1) { + _pop = instance_create(0, 0, obj_popup); _pop.image = "inquisition"; _pop.title = "Inquisition Mission Completed"; _pop.text = "You have captured a Gaunt organism- the Inquisitor is pleased with your work. The Tyranid will be stored until it may be retrieved. The mission is a success."; } - } - - - - else if (enemy=1) and (on_ship=true) and (defeat=0){ - var diceh=roll_dice_chapter(1, 100, "high"); - - if (diceh<=15){ - var ship,ship_hp,i=-1; - for (var i=0;i0){ + if ((!instance_exists(obj_ground_mission)) || (string_count("CRMOS|", obj_controller.useful_info) > 0)) { // Some kind of popup based on what you were going after - - obj_controller.complex_event=false;obj_controller.diplomacy=0;obj_controller.menu=0; - obj_controller.force_goodbye=0;obj_controller.cooldown=20; - obj_controller.current_eventing="chaos_meeting_end"; - with(obj_temp_meeting){ + + obj_controller.complex_event = false; + obj_controller.diplomacy = 0; + obj_controller.menu = 0; + obj_controller.force_goodbye = 0; + obj_controller.cooldown = 20; + obj_controller.current_eventing = "chaos_meeting_end"; + with (obj_temp_meeting) { instance_destroy(); - }with(obj_popup){ + } + with (obj_popup) { instance_destroy(); } - if (instance_exists(obj_turn_end)){ - obj_turn_end.combating=0;// obj_turn_end.alarm[1]=1; + if (instance_exists(obj_turn_end)) { + obj_turn_end.combating = 0; // obj_turn_end.alarm[1]=1; } - var pip = instance_create(0,0,obj_popup); + var pip = instance_create(0, 0, obj_popup); pip.title = "Chaos Lord Killed"; pip.text = "(Not completed yet- variable reward based on what chosen)"; } - with(obj_ground_mission){instance_destroy();} + with (obj_ground_mission) { + instance_destroy(); + } } } - - - - if (battle_special="ship_demon"){ - if (defeat == 1){ - var ship,ship_hp,i;i=-1; - repeat(51){i+=1; - ship[i]=obj_ini.ship[i];ship_hp[i]=obj_ini.ship_hp[i]; - if (i=battle_id){obj_ini.ship_hp[i]=-50;scr_recent("ship_destroyed",obj_ini.ship[i],i);} - } - var _pop = instance_create(0,0,obj_popup); + + if (battle_special == "ship_demon") { + if (defeat == 1) { + var ship, ship_hp, i; + i = -1; + repeat (51) { + i += 1; + ship[i] = obj_ini.ship[i]; + ship_hp[i] = obj_ini.ship_hp[i]; + if (i == battle_id) { + obj_ini.ship_hp[i] = -50; + scr_recent("ship_destroyed", obj_ini.ship[i], i); + } + } + var _pop = instance_create(0, 0, obj_popup); _pop.image = ""; _pop.title = "Ship Destroyed"; - _pop.text = "The daemon has slayed all of your marines onboard. It works its way to the engine of the vessel, '"+string(obj_ini.ship[battle_id])+"', and then tears into the main reactor. Your ship explodes in a brilliant cloud of fire."; - scr_event_log("red","A daemon unbound from an Artifact wreaks havoc upon and destroys your vessel '"+string(obj_ini.ship[battle_id])+"'."); - + _pop.text = "The daemon has slayed all of your marines onboard. It works its way to the engine of the vessel, '" + string(obj_ini.ship[battle_id]) + "', and then tears into the main reactor. Your ship explodes in a brilliant cloud of fire."; + scr_event_log("red", "A daemon unbound from an Artifact wreaks havoc upon and destroys your vessel '" + string(obj_ini.ship[battle_id]) + "'."); + scr_ini_ship_cleanup(); } } - - if (battle_special="space_hulk"){ + + if (battle_special == "space_hulk") { space_hulk_explore_battle_aftermath(); } - - - - if ((leader=1) or (battle_special="ChaosWarband")) and (obj_controller.faction_defeated[10]=0) and (defeat=0) and (battle_special!="WL10_reveal") and (battle_special!="WL10_later"){ - if (battle_special!="WL10_reveal") and (battle_special!="WL10_later"){ - // prolly schedule a popup congratulating - obj_controller.faction_defeated[enemy]=1; - if (obj_controller.known[enemy]=0) then obj_controller.known[enemy]=1; - - if (battle_special!="ChaosWarband") then with(obj_star){ - if (string_count("WL"+string(obj_ncombat.enemy),p_feature[obj_ncombat.battle_id])>0){ - p_feature[obj_ncombat.battle_id]=string_replace(p_feature[obj_ncombat.battle_id],"WL"+string(obj_ncombat.enemy)+"|",""); + + if (((leader == 1) || (battle_special == "ChaosWarband")) && (obj_controller.faction_defeated[10] == 0) && (defeat == 0) && (battle_special != "WL10_reveal") && (battle_special != "WL10_later")) { + if ((battle_special != "WL10_reveal") && (battle_special != "WL10_later")) { + // prolly schedule a popup congratulating + obj_controller.faction_defeated[enemy] = 1; + if (obj_controller.known[enemy] == 0) { + obj_controller.known[enemy] = 1; } - } - if (battle_special="ChaosWarband"){ - obj_controller.faction_defeated[10]=1;// show_message("WL10 defeated"); - if (instance_exists(obj_turn_end)){ - scr_event_log("","Enemy Leader Assassinated: Chaos Lord"); - scr_alert("","ass","Chaos Lord "+string(obj_controller.faction_leader[eFACTION.Chaos])+" has been killed.",0,0); - scr_popup("Black Crusade Ended","The Chaos Lord "+string(obj_controller.faction_leader[eFACTION.Chaos])+" has been slain in combat. Without his leadership the Black Crusade is destined to crumble apart and disintegrate from infighting. Sector "+string(obj_ini.sector_name)+" is no longer at threat by the forces of Chaos.","",""); - } - if (!instance_exists(obj_turn_end)){ - scr_event_log("","Enemy Leader Assassinated: Chaos Lord"); - var _pop = instance_create(0,0,obj_popup); - _pop.image = ""; - _pop.title = "Black Crusade Ended"; - _pop.text=$"The Chaos Lord {obj_controller.faction_leader[eFACTION.Chaos]} has been slain in combat. Without his leadership the Black Crusade is destined to crumble apart and disintegrate from infighting. Sector "+string(obj_ini.sector_name)+" is no longer at threat by the forces of Chaos."; + + if (battle_special != "ChaosWarband") { + with (obj_star) { + if (string_count("WL" + string(obj_ncombat.enemy), p_feature[obj_ncombat.battle_id]) > 0) { + p_feature[obj_ncombat.battle_id] = string_replace(p_feature[obj_ncombat.battle_id], "WL" + string(obj_ncombat.enemy) + "|", ""); + } + } + } + if (battle_special == "ChaosWarband") { + obj_controller.faction_defeated[10] = 1; // show_message("WL10 defeated"); + if (instance_exists(obj_turn_end)) { + scr_event_log("", "Enemy Leader Assassinated: Chaos Lord"); + scr_alert("", "ass", "Chaos Lord " + string(obj_controller.faction_leader[eFACTION.Chaos]) + " has been killed.", 0, 0); + scr_popup("Black Crusade Ended", "The Chaos Lord " + string(obj_controller.faction_leader[eFACTION.Chaos]) + " has been slain in combat. Without his leadership the Black Crusade is destined to crumble apart and disintegrate from infighting. Sector " + string(obj_ini.sector_name) + " is no longer at threat by the forces of Chaos.", "", ""); + } + if (!instance_exists(obj_turn_end)) { + scr_event_log("", "Enemy Leader Assassinated: Chaos Lord"); + var _pop = instance_create(0, 0, obj_popup); + _pop.image = ""; + _pop.title = "Black Crusade Ended"; + _pop.text = $"The Chaos Lord {obj_controller.faction_leader[eFACTION.Chaos]} has been slain in combat. Without his leadership the Black Crusade is destined to crumble apart and disintegrate from infighting. Sector " + string(obj_ini.sector_name) + " is no longer at threat by the forces of Chaos."; + } } } - }} - - - + } + instance_activate_all(); - with(obj_pnunit){instance_destroy();} - with(obj_enunit){instance_destroy();} - with(obj_nfort){instance_destroy();} - with(obj_centerline){instance_destroy();} - obj_controller.new_buttons_hide=0; - - - if (instance_exists(obj_cursor)){ - obj_cursor.image_index=0; + with (obj_pnunit) { + instance_destroy(); } - + with (obj_enunit) { + instance_destroy(); + } + with (obj_nfort) { + instance_destroy(); + } + with (obj_centerline) { + instance_destroy(); + } + obj_controller.new_buttons_hide = 0; + + if (instance_exists(obj_cursor)) { + obj_cursor.image_index = 0; + } + instance_destroy(); - + /* */ /* */ - -} catch(_exception) { +} catch (_exception) { handle_exception(_exception); -} \ No newline at end of file +} diff --git a/objects/obj_ncombat/Alarm_8.gml b/objects/obj_ncombat/Alarm_8.gml index feded6b1e0..3065c5f81b 100644 --- a/objects/obj_ncombat/Alarm_8.gml +++ b/objects/obj_ncombat/Alarm_8.gml @@ -1,30 +1,45 @@ +if ((enemy_forces != 0) && (player_forces != 0) && (battle_over == 0)) { + if ((enemy == 6) && (timer_stage == 2)) { + timer_stage = 3; -if (enemy_forces!=0) and (player_forces!=0) and (battle_over=0){ - - if ((enemy=6)) and (timer_stage=2){ - timer_stage=3; - - messages=0;messages_to_show = 24;largest=0;random_messages=0;priority=0;messages_shown=0; - } - - if ((enemy!=6)) and (timer_stage=2){ - timer_stage=3; - - messages=0;messages_to_show = 24;largest=0;random_messages=0;priority=0;messages_shown=0; - } - - if ((enemy=6)) and (timer_stage=4){ - timer_stage=5; - - messages=0;messages_to_show = 24;largest=0;random_messages=0;priority=0;messages_shown=0; + messages = 0; + messages_to_show = 24; + largest = 0; + random_messages = 0; + priority = 0; + messages_shown = 0; } - - if ((enemy!=6)) and (timer_stage=4){ - timer_stage=5; - - messages=0;messages_to_show = 24;largest=0;random_messages=0;priority=0;messages_shown=0; + + if ((enemy != 6) && (timer_stage == 2)) { + timer_stage = 3; + + messages = 0; + messages_to_show = 24; + largest = 0; + random_messages = 0; + priority = 0; + messages_shown = 0; } -} + if ((enemy == 6) && (timer_stage == 4)) { + timer_stage = 5; + + messages = 0; + messages_to_show = 24; + largest = 0; + random_messages = 0; + priority = 0; + messages_shown = 0; + } + if ((enemy != 6) && (timer_stage == 4)) { + timer_stage = 5; + messages = 0; + messages_to_show = 24; + 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 cd2e02a435..8b3249d49a 100644 --- a/objects/obj_ncombat/Create_0.gml +++ b/objects/obj_ncombat/Create_0.gml @@ -1,297 +1,417 @@ -if (instance_number(obj_ncombat)>1) then instance_destroy(); +if (instance_number(obj_ncombat) > 1) { + instance_destroy(); +} set_zoom_to_default(); -var co,i;co=-1; -co=0;i=0;hue=0; +var co, i; +co = -1; +co = 0; +i = 0; +hue = 0; turn_count = 0; log_message("Ground Combat Started"); audio_stop_sound(snd_royal); -audio_play_sound(snd_battle,0,true); +audio_play_sound(snd_battle, 0, true); audio_sound_gain(snd_battle, 0, 0); -var nope=0;if (obj_controller.master_volume=0) or (obj_controller.music_volume=0) then nope=1; -if (nope!=1){audio_sound_gain(snd_battle,0.25*obj_controller.master_volume*obj_controller.music_volume,2000);} - +var nope = 0; +if ((obj_controller.master_volume == 0) || (obj_controller.music_volume == 0)) { + nope = 1; +} +if (nope != 1) { + audio_sound_gain(snd_battle, 0.25 * obj_controller.master_volume * obj_controller.music_volume, 2000); +} //limit on the size of the players forces allowed -enter_pressed = 0 +enter_pressed = 0; man_size_limit = 0; man_limit_reached = false; man_size_count = 0; -fack=0; -cd=0; -owner = eFACTION.Player; -click_stall_timer=0; -formation_set=0; -on_ship=false; -alpha_strike=0; +fack = 0; +cd = 0; +owner = eFACTION.Player; +click_stall_timer = 0; +formation_set = 0; +on_ship = false; +alpha_strike = 0; Warlord = 0; -total_battle_exp_gain=0; +total_battle_exp_gain = 0; marines_to_recover = 0; vehicles_to_recover = 0; end_alive_units = []; -average_battle_exp_gain=0; -upgraded_librarians=[]; - -view_x=obj_controller.x;view_y=obj_controller.y; -obj_controller.x=0;obj_controller.y=0; -if (obj_controller.zoomed==1){with(obj_controller){scr_zoom();}} -xxx=200; +average_battle_exp_gain = 0; +upgraded_librarians = []; + +view_x = obj_controller.x; +view_y = obj_controller.y; +obj_controller.x = 0; +obj_controller.y = 0; +if (obj_controller.zoomed == 1) { + with (obj_controller) { + scr_zoom(); + } +} +xxx = 200; instance_activate_object(obj_cursor); instance_activate_object(obj_ini); -instance_activate_object(obj_img) +instance_activate_object(obj_img); -var i,u;i=11; -repeat(10){i-=1;// This creates the objects to then be filled in - u=instance_create(i*10,240,obj_pnunit); +var i, u; +i = 11; +repeat (10) { + i -= 1; // This creates the objects to then be filled in + u = instance_create(i * 10, 240, obj_pnunit); } -instance_create(0,0,obj_centerline); +instance_create(0, 0, obj_centerline); -local_forces=0; -battle_loc=""; -battle_climate=""; -battle_id=0; -battle_object=0; +local_forces = 0; +battle_loc = ""; +battle_climate = ""; +battle_id = 0; +battle_object = 0; battle_mission = ""; -battle_special=""; +battle_special = ""; battle_data = {}; -defeat=0; -defeat_message=0; -red_thirst=0; -fugg=0;fugg2=0; -battle_over=0; -done=0; - -captured_gaunt=0; -ethereal=0; -hulk_treasure=0; -four_show=0; -chaos_angry=0; - -leader=0; -thirsty=0; -really_thirsty=0; -allies=0; -present_inquisitor=0;sorcery_seen=0; -inquisitor_ship=0; -guard_total=0; -guard_effective=0; -player_starting_dudes=0; -chapter_master_psyker=0; -guard_pre_forces=0; -ally=0; -ally_forces=0; -ally_special=0; - -global_perils=0; -exterminatus=0; -plasma_bomb=0; - -display_p1=0;display_p1n=""; -display_p2=0;display_p2n=""; - - -alarm[0]=2; -alarm[1]=3; -obj_pnunit.alarm[3]=1; -alarm[2]=8; - - -started=0; -charged=0; - -fadein=40; -enemy=0; -threat=0; -fortified=0; -enemy_fortified=0; -wall_destroyed=0; -enem="Orks";enem_sing="Ork"; -flank_x=0; - -player_forces=0;player_max=0; -player_defenses=0;player_silos=0; - -enemy_forces=0;enemy_max=0; -hulk_forces=0; - -i=-1;messages=0;messages_to_show=24;messages_shown=0; -largest=0;priority=0;random_messages=0;dead_enemies=0; +defeat = 0; +defeat_message = 0; +red_thirst = 0; +fugg = 0; +fugg2 = 0; +battle_over = 0; +done = 0; + +captured_gaunt = 0; +ethereal = 0; +hulk_treasure = 0; +four_show = 0; +chaos_angry = 0; + +leader = 0; +thirsty = 0; +really_thirsty = 0; +allies = 0; +present_inquisitor = 0; +sorcery_seen = 0; +inquisitor_ship = 0; +guard_total = 0; +guard_effective = 0; +player_starting_dudes = 0; +chapter_master_psyker = 0; +guard_pre_forces = 0; +ally = 0; +ally_forces = 0; +ally_special = 0; + +global_perils = 0; +exterminatus = 0; +plasma_bomb = 0; + +display_p1 = 0; +display_p1n = ""; +display_p2 = 0; +display_p2n = ""; + +alarm[0] = 2; +alarm[1] = 3; +obj_pnunit.alarm[3] = 1; +alarm[2] = 8; + +started = 0; +charged = 0; + +fadein = 40; +enemy = 0; +threat = 0; +fortified = 0; +enemy_fortified = 0; +wall_destroyed = 0; +enem = "Orks"; +enem_sing = "Ork"; +flank_x = 0; + +player_forces = 0; +player_max = 0; +player_defenses = 0; +player_silos = 0; + +enemy_forces = 0; +enemy_max = 0; +hulk_forces = 0; + +i = -1; +messages = 0; +messages_to_show = 24; +messages_shown = 0; +largest = 0; +priority = 0; +random_messages = 0; +dead_enemies = 0; units_lost_counts = {}; vehicles_lost_counts = {}; -repeat(70){i+=1; - lines[i]=""; - lines_color[i]=""; - message[i]=""; - message_sz[i]=0; - message_priority[i]=0; - dead_jim[i]=""; - dead_ene[i]=""; - dead_ene_n[i]=0; - - crunch[i]=0; - - if (i<=10) then mucra[i]=0; +repeat (70) { + i += 1; + lines[i] = ""; + lines_color[i] = ""; + message[i] = ""; + message_sz[i] = 0; + message_priority[i] = 0; + dead_jim[i] = ""; + dead_ene[i] = ""; + dead_ene_n[i] = 0; + + crunch[i] = 0; + + if (i <= 10) { + mucra[i] = 0; + } } post_equipment_lost = new EquipmentTracker(); post_equipment_recovered = new EquipmentTracker(); -slime=0; -unit_recovery_score=0; -apothecaries_alive=0; -techmarines_alive=0; -vehicle_recovery_score=0; -injured=0; -command_injured=0; -seed_saved=0; -seed_lost=0; -seed_harvestable=0; -units_saved_count=0; -units_saved_counts={}; -vehicles_saved_counts={}; -command_saved=0; -vehicles_saved_count=0; -vehicles_saved_counts={}; -final_marine_deaths=0; -final_command_deaths=0; -vehicle_deaths=0; -casualties=0; -dead_jims=0; -newline=""; -newline_color=""; -liness=0; -world_size=0; - -timer=0; -timer_stage=0; -timer_speed=0; -timer_maxspeed=1; -timer_pause=-1; -turns=1; - - -// - -scouts=0; -tacticals=0; -veterans=0; -devastators=0; -assaults=0; -librarians=0; -techmarines=0; -honors=0; -dreadnoughts=0; -terminators=0; -captains=0; -standard_bearers=0; -champions=0; -important_dudes=0; -chaplains=0; -apothecaries=0; -sgts=0; -vet_sgts=0; - -rhinos=0; -predators=0; -land_raiders=0; -land_speeders=0; -whirlwinds=0; - -big_mofo=10; - - - - -en_scouts=0; -en_tacticals=0; -en_sgts=0; -en_vet_sgts=0; -en_veterans=0; -en_devastators=0; -en_assaults=0; -en_librarians=0; -en_techmarines=0; -en_honors=0; -en_dreadnoughts=0; -en_terminators=0; -en_captains=0; -en_standard_bearers=0; -en_important_dudes=0; -en_chaplains=0; -en_apothecaries=0; - -en_big_mofo=10; -en_important_dudes=0; - -// - -defending=true;// 1 is defensive -dropping=0;// 0 is was on ground -attacking=0;// 1 means attacked from space/local -time=floor(random(24))+1; -terrain=""; -weather=""; - -ambushers=0;if (scr_has_adv("Ambushers")) then ambushers=1; -bolter_drilling=0;if (scr_has_adv("Bolter Drilling")) then bolter_drilling=1; -enemy_eldar=0;if (scr_has_adv("Enemy: Eldar")) then enemy_eldar=1; -enemy_fallen=0;if (scr_has_adv("Enemy: Fallen")) then enemy_fallen=1; -enemy_orks=0;if (scr_has_adv("Enemy: Orks")) then enemy_orks=1; -enemy_tau=0;if (scr_has_adv("Enemy: Tau")) then enemy_tau=1; -enemy_tyranids=0;if (scr_has_adv("Enemy: Tyranids")) then enemy_tyranids=1; -enemy_necrons=0;if (scr_has_adv("Enemy: Necrons")) then enemy_necrons=1; -lightning=0;if (scr_has_adv("Lightning Warriors")) then lightning=1; -siege=0;if (scr_has_adv("Siege Masters")) then siege=1; -slow=0;if (scr_has_adv("Devastator Doctrine")) then slow=1; -melee=0;if (scr_has_adv("Assault Doctrine")) then melee=1; -// -black_rage=0;if (scr_has_disadv("Black Rage")){black_rage=1;red_thirst=1;} -shitty_luck=0;if (scr_has_disadv("Shitty Luck")) then shitty_luck=1; -favoured_by_the_warp=0;if (scr_has_adv("Favoured By The Warp")) then favoured_by_the_warp=1; - - -lyman=obj_ini.lyman;// drop pod penalties -omophagea=obj_ini.omophagea;// feast -ossmodula=obj_ini.ossmodula;// small penalty to all -membrane=obj_ini.membrane;// less chance of survival for wounded -betchers=obj_ini.betchers;// slight melee penalty -catalepsean=obj_ini.catalepsean;// minor global attack decrease -occulobe=obj_ini.occulobe;// penalty if morning and susceptible to flash grenades -mucranoid=obj_ini.mucranoid;// chance to short-circuit -// -global_melee=1; -global_bolter=1; -global_attack=1; -global_defense=1; -// -if (ambushers=1) and (ambushers=999) then global_attack=global_attack*1.1; -if (bolter_drilling=1) then global_bolter=global_bolter*1.1; -if (enemy_eldar=1) and (enemy=6){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} -if (enemy_fallen=1) and (enemy=10){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} -if (enemy_orks=1) and (enemy=7){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} -if (enemy_tau=1) and (enemy=8){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} -if (enemy_tyranids=1) and (enemy=9){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} -if (enemy_necrons=1) and (enemy=13){global_attack=global_attack*1.1;global_defense=global_defense*1.1;} - -if (siege=1) and (enemy_fortified>=3) and (defending=false) then global_attack=global_attack*1.2; - - -if (slow=1){global_attack-=0.1;global_defense+=0.2;} -if (lightning=1){global_attack+=0.2;global_defense-=0.1;} -if (melee=1) then global_melee=global_melee*1.15; -// -if (shitty_luck=1) then global_defense=global_defense*0.9; -if (lyman=1) and (dropping=1){global_attack=global_attack*0.85;global_defense=global_defense*0.9;} -if (ossmodula=1){global_attack=global_attack*0.95;global_defense=global_defense*0.95;} -if (betchers=1) then global_melee=global_melee*0.95; -if (catalepsean=1){global_attack=global_attack*0.95;} -if (occulobe=1){if (time=5) or (time=6){global_attack=global_attack*0.7;global_defense=global_defense*0.8;}} - -enemy_dudes=""; -global_defense=2-global_defense; +slime = 0; +unit_recovery_score = 0; +apothecaries_alive = 0; +techmarines_alive = 0; +vehicle_recovery_score = 0; +injured = 0; +command_injured = 0; +seed_saved = 0; +seed_lost = 0; +seed_harvestable = 0; +units_saved_count = 0; +units_saved_counts = {}; +vehicles_saved_counts = {}; +command_saved = 0; +vehicles_saved_count = 0; +vehicles_saved_counts = {}; +final_marine_deaths = 0; +final_command_deaths = 0; +vehicle_deaths = 0; +casualties = 0; +dead_jims = 0; +newline = ""; +newline_color = ""; +liness = 0; +world_size = 0; + +timer = 0; +timer_stage = 0; +timer_speed = 0; +timer_maxspeed = 1; +timer_pause = -1; +turns = 1; + +// + +scouts = 0; +tacticals = 0; +veterans = 0; +devastators = 0; +assaults = 0; +librarians = 0; +techmarines = 0; +honors = 0; +dreadnoughts = 0; +terminators = 0; +captains = 0; +standard_bearers = 0; +champions = 0; +important_dudes = 0; +chaplains = 0; +apothecaries = 0; +sgts = 0; +vet_sgts = 0; + +rhinos = 0; +predators = 0; +land_raiders = 0; +land_speeders = 0; +whirlwinds = 0; + +big_mofo = 10; + +en_scouts = 0; +en_tacticals = 0; +en_sgts = 0; +en_vet_sgts = 0; +en_veterans = 0; +en_devastators = 0; +en_assaults = 0; +en_librarians = 0; +en_techmarines = 0; +en_honors = 0; +en_dreadnoughts = 0; +en_terminators = 0; +en_captains = 0; +en_standard_bearers = 0; +en_important_dudes = 0; +en_chaplains = 0; +en_apothecaries = 0; + +en_big_mofo = 10; +en_important_dudes = 0; + +// + +defending = true; // 1 is defensive +dropping = 0; // 0 is was on ground +attacking = 0; // 1 means attacked from space/local +time = floor(random(24)) + 1; +terrain = ""; +weather = ""; + +ambushers = 0; +if (scr_has_adv("Ambushers")) { + ambushers = 1; +} +bolter_drilling = 0; +if (scr_has_adv("Bolter Drilling")) { + bolter_drilling = 1; +} +enemy_eldar = 0; +if (scr_has_adv("Enemy: Eldar")) { + enemy_eldar = 1; +} +enemy_fallen = 0; +if (scr_has_adv("Enemy: Fallen")) { + enemy_fallen = 1; +} +enemy_orks = 0; +if (scr_has_adv("Enemy: Orks")) { + enemy_orks = 1; +} +enemy_tau = 0; +if (scr_has_adv("Enemy: Tau")) { + enemy_tau = 1; +} +enemy_tyranids = 0; +if (scr_has_adv("Enemy: Tyranids")) { + enemy_tyranids = 1; +} +enemy_necrons = 0; +if (scr_has_adv("Enemy: Necrons")) { + enemy_necrons = 1; +} +lightning = 0; +if (scr_has_adv("Lightning Warriors")) { + lightning = 1; +} +siege = 0; +if (scr_has_adv("Siege Masters")) { + siege = 1; +} +slow = 0; +if (scr_has_adv("Devastator Doctrine")) { + slow = 1; +} +melee = 0; +if (scr_has_adv("Assault Doctrine")) { + melee = 1; +} +// +black_rage = 0; +if (scr_has_disadv("Black Rage")) { + black_rage = 1; + red_thirst = 1; +} +shitty_luck = 0; +if (scr_has_disadv("Shitty Luck")) { + shitty_luck = 1; +} +favoured_by_the_warp = 0; +if (scr_has_adv("Favoured By The Warp")) { + favoured_by_the_warp = 1; +} + +lyman = obj_ini.lyman; // drop pod penalties +omophagea = obj_ini.omophagea; // feast +ossmodula = obj_ini.ossmodula; // small penalty to all +membrane = obj_ini.membrane; // less chance of survival for wounded +betchers = obj_ini.betchers; // slight melee penalty +catalepsean = obj_ini.catalepsean; // minor global attack decrease +occulobe = obj_ini.occulobe; // penalty if morning and susceptible to flash grenades +mucranoid = obj_ini.mucranoid; // chance to short-circuit +// +global_melee = 1; +global_bolter = 1; +global_attack = 1; +global_defense = 1; +// +if ((ambushers == 1) && (ambushers == 999)) { + global_attack = global_attack * 1.1; +} +if (bolter_drilling == 1) { + global_bolter = global_bolter * 1.1; +} +if ((enemy_eldar == 1) && (enemy == 6)) { + global_attack = global_attack * 1.1; + global_defense = global_defense * 1.1; +} +if ((enemy_fallen == 1) && (enemy == 10)) { + global_attack = global_attack * 1.1; + global_defense = global_defense * 1.1; +} +if ((enemy_orks == 1) && (enemy == 7)) { + global_attack = global_attack * 1.1; + global_defense = global_defense * 1.1; +} +if ((enemy_tau == 1) && (enemy == 8)) { + global_attack = global_attack * 1.1; + global_defense = global_defense * 1.1; +} +if ((enemy_tyranids == 1) && (enemy == 9)) { + global_attack = global_attack * 1.1; + global_defense = global_defense * 1.1; +} +if ((enemy_necrons == 1) && (enemy == 13)) { + global_attack = global_attack * 1.1; + global_defense = global_defense * 1.1; +} + +if ((siege == 1) && (enemy_fortified >= 3) && (defending == false)) { + global_attack = global_attack * 1.2; +} + +if (slow == 1) { + global_attack -= 0.1; + global_defense += 0.2; +} +if (lightning == 1) { + global_attack += 0.2; + global_defense -= 0.1; +} +if (melee == 1) { + global_melee = global_melee * 1.15; +} +// +if (shitty_luck == 1) { + global_defense = global_defense * 0.9; +} +if ((lyman == 1) && (dropping == 1)) { + global_attack = global_attack * 0.85; + global_defense = global_defense * 0.9; +} +if (ossmodula == 1) { + global_attack = global_attack * 0.95; + global_defense = global_defense * 0.95; +} +if (betchers == 1) { + global_melee = global_melee * 0.95; +} +if (catalepsean == 1) { + global_attack = global_attack * 0.95; +} +if (occulobe == 1) { + if ((time == 5) || (time == 6)) { + global_attack = global_attack * 0.7; + global_defense = global_defense * 0.8; + } +} +enemy_dudes = ""; +global_defense = 2 - global_defense; diff --git a/objects/obj_ncombat/Draw_0.gml b/objects/obj_ncombat/Draw_0.gml index 65d6a5f0a5..a406fb7925 100644 --- a/objects/obj_ncombat/Draw_0.gml +++ b/objects/obj_ncombat/Draw_0.gml @@ -1,83 +1,107 @@ +draw_sprite(spr_rock_bg, 0, 0, 0); -draw_sprite(spr_rock_bg,0,0,0); - -draw_set_color(c_black);draw_set_alpha(1); -draw_rectangle(0,0,800,900,0); -draw_rectangle(818,235,1578,666,0); +draw_set_color(c_black); +draw_set_alpha(1); +draw_rectangle(0, 0, 800, 900, 0); +draw_rectangle(818, 235, 1578, 666, 0); draw_set_color(CM_GREEN_COLOR); -var l;l=0; -draw_set_alpha(1);draw_rectangle(0+l,0+l,800-l,900-l,1);l+=1; -draw_set_alpha(0.75);draw_rectangle(0+l,0+l,800-l,900-l,1);l+=1; -draw_set_alpha(0.5);draw_rectangle(0+l,0+l,800-l,900-l,1);l+=1; -draw_set_alpha(0.25);draw_rectangle(0+l,0+l,6800-l,900-l,1); - -l=0; -draw_set_alpha(1);draw_rectangle(818+l,235+l,1578-l,666-l,1);l+=1; -draw_set_alpha(0.75);draw_rectangle(818+l,235+l,1578-l,666-l,1);l+=1; -draw_set_alpha(0.5);draw_rectangle(818+l,235+l,1578-l,666-l,1);l+=1; -draw_set_alpha(0.25);draw_rectangle(818+l,235+l,1578-l,666-l,1); - - -l=0;draw_set_alpha(1); +var l; +l = 0; +draw_set_alpha(1); +draw_rectangle(0 + l, 0 + l, 800 - l, 900 - l, 1); +l += 1; +draw_set_alpha(0.75); +draw_rectangle(0 + l, 0 + l, 800 - l, 900 - l, 1); +l += 1; +draw_set_alpha(0.5); +draw_rectangle(0 + l, 0 + l, 800 - l, 900 - l, 1); +l += 1; +draw_set_alpha(0.25); +draw_rectangle(0 + l, 0 + l, 6800 - l, 900 - l, 1); + +l = 0; +draw_set_alpha(1); +draw_rectangle(818 + l, 235 + l, 1578 - l, 666 - l, 1); +l += 1; +draw_set_alpha(0.75); +draw_rectangle(818 + l, 235 + l, 1578 - l, 666 - l, 1); +l += 1; +draw_set_alpha(0.5); +draw_rectangle(818 + l, 235 + l, 1578 - l, 666 - l, 1); +l += 1; +draw_set_alpha(0.25); +draw_rectangle(818 + l, 235 + l, 1578 - l, 666 - l, 1); + +l = 0; +draw_set_alpha(1); draw_set_font(fnt_40k_14); -if (display_p1>0) and (player_forces>0){ - draw_set_color(c_yellow);draw_set_halign(fa_left); - draw_text(64,880,string_hash_to_newline(string(display_p1n)+": "+string(display_p1)+"HP")); +if ((display_p1 > 0) && (player_forces > 0)) { + draw_set_color(c_yellow); + draw_set_halign(fa_left); + draw_text(64, 880, string_hash_to_newline(string(display_p1n) + ": " + string(display_p1) + "HP")); } -if (display_p2>0) and (enemy_forces>0){ - draw_set_color(c_yellow);draw_set_halign(fa_right); - draw_text(800-64,880,string_hash_to_newline(string(display_p2n)+": "+string(display_p2)+"HP")); +if ((display_p2 > 0) && (enemy_forces > 0)) { + draw_set_color(c_yellow); + draw_set_halign(fa_right); + draw_text(800 - 64, 880, string_hash_to_newline(string(display_p2n) + ": " + string(display_p2) + "HP")); } draw_set_halign(fa_left); - - -repeat(45){l+=1; +repeat (45) { + l += 1; // draw_text(x+6,y-10+(l*14),"."+string(lines[31-l])); draw_set_color(CM_GREEN_COLOR); - if (lines_color[l]="red") then draw_set_color(c_red); - if (lines_color[l]="yellow") then draw_set_color(3055825); - if (lines_color[l]="purple") then draw_set_color(16646566); - 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") then draw_set_color(c_aqua); - draw_text(x+6,y-10+(l*18),string_hash_to_newline(string(lines[l]))); + if (lines_color[l] == "red") { + draw_set_color(c_red); + } + if (lines_color[l] == "yellow") { + draw_set_color(3055825); + } + if (lines_color[l] == "purple") { + draw_set_color(16646566); + } + if (lines_color[l] == "bright") { + draw_set_color(65280); + } + if (lines_color[l] == "white") { + draw_set_color(c_silver); + } + if (lines_color[l] == "blue") { + draw_set_color(c_aqua); + } + draw_text(x + 6, y - 10 + (l * 18), string_hash_to_newline(string(lines[l]))); } draw_set_color(CM_GREEN_COLOR); -if (click_stall_timer<=0){ - if (fadein<0) and (fadein>-100) and (started=0){ - draw_set_alpha((fadein*-1)/30); +if (click_stall_timer <= 0) { + if ((fadein < 0) && (fadein > -100) && (started == 0)) { + draw_set_alpha((fadein * -1) / 30); draw_set_halign(fa_center); - draw_text(400,860,string_hash_to_newline("[Press Enter to Begin]")); + draw_text(400, 860, string_hash_to_newline("[Press Enter to Begin]")); } - if (started=2) or ((started=1) and ((timer_stage=3) or (timer_stage=5) or (timer_stage=0))) or (started=4){ + if ((started == 2) || ((started == 1) && ((timer_stage == 3) || (timer_stage == 5) || (timer_stage == 0))) || (started == 4)) { draw_set_halign(fa_center); - draw_text(400,860,string_hash_to_newline("[Press Enter to Continue]")); + draw_text(400, 860, string_hash_to_newline("[Press Enter to Continue]")); } - if (started=3) or (started=5){ + if ((started == 3) || (started == 5)) { draw_set_halign(fa_center); - draw_text(400,860,string_hash_to_newline("[Press Enter to Exit]")); + draw_text(400, 860, string_hash_to_newline("[Press Enter to Exit]")); } } - - -draw_set_halign(fa_left);draw_set_alpha(1); +draw_set_halign(fa_left); +draw_set_alpha(1); // Timer // draw_rectangle(16,464,min(16+(timer*2.026),624),472,0); - // draw_text(320,300,"Turn: "+string(turns)); - draw_set_color(c_black); -draw_set_alpha(fadein/30); -draw_rectangle(0,0,1600,900,0); +draw_set_alpha(fadein / 30); +draw_rectangle(0, 0, 1600, 900, 0); draw_set_alpha(1); - diff --git a/objects/obj_ncombat/KeyPress_13.gml b/objects/obj_ncombat/KeyPress_13.gml index f91f63f383..260059f1e9 100644 --- a/objects/obj_ncombat/KeyPress_13.gml +++ b/objects/obj_ncombat/KeyPress_13.gml @@ -1,173 +1,202 @@ var __b__; __b__ = action_if_number(obj_popup, 0, 0); -if __b__ -{ -__b__ = action_if_variable(cd, 1, 1); -if __b__ -{ -__b__ = action_if_variable(click_stall_timer, 1, 1); -if __b__ -{ - - -// with(ob_ennt){shomesge(string(dudes[1])+"|"+string(dudes_num[1])+"|"+string(men+medi)+"|"+string(dudes_hp[1]));} - -// 135; -// instance_activate_object(obj_cursor); - -if (enemy_forces<=0) { // Combat for whatever reason sometimes bugs out when there are no enemies, so if enter is pressed 6 times at this state it will set started to 2 - enter_pressed++ -} - -if (started>=2) then instance_activate_object(obj_pnunit); - -if (started=3){ - - instance_activate_all(); - instance_activate_object(obj_pnunit); - instance_activate_object(obj_enunit); - instance_destroy(obj_popup); - instance_destroy(obj_star_select); - if (instance_exists(obj_pnunit)){ - obj_pnunit.alarm[6]=1; - } - - alarm[7]=2; - click_stall_timer=15; -} - -// if (done>=1) then exit; - - - -if (turn_count >= 50 || enter_pressed > 5) { - started=2; -} -if ((started=2) or (started=4)){ - instance_activate_object(obj_pnunit); - instance_activate_object(obj_enunit); - // started=3;alarm[5]=3;obj_pnunit.alarm[4]=1;obj_pnunit.alarm[5]=2;obj_enunit.alarm[1]=3; - started=3; - // obj_pnunit.alarm[4]=2;obj_pnunit.alarm[5]=3;obj_enunit.alarm[1]=1; - var _quad_factor = 10; - total_battle_exp_gain = _quad_factor * sqr(threat); - if (instance_exists(obj_enunit)){obj_enunit.alarm[1]=1;} - instance_activate_object(obj_star); - instance_activate_object(obj_event_log); - alarm[5]=6; - click_stall_timer=15; - - fack=1; - - newline="------------------------------------------------------------------------------"; - scr_newtext(); - newline="------------------------------------------------------------------------------"; - scr_newtext(); -} - -if (fadein<0) and (fadein>-100) and (started=0){ - fadein=-500; - started=1; - timer_speed=1; - timer_stage=1; - timer=100; - - if (enemy=30) then timer_stage=3; - if (battle_special="ship_demon") then timer_stage=3; -} - - -if (started>0){// This might be causing problems? - if (instance_exists(obj_pnunit)) then obj_pnunit.alarm[8]=8; - if (instance_exists(obj_enunit)) then obj_enunit.alarm[8]=8; -} - -function reset_combat_message_arrays(){ - for (var i=0;i0) then global_perils-=1; - if (global_perils<0) then global_perils=0; - turns+=1; - - four_show=0;click_stall_timer=15; - // if (battle_over!=1) then alarm[8]=15; - - if (enemy!=6){ - if (instance_exists(obj_enunit)){ - obj_enunit.alarm[1]=1; - } - 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; - } - - else if (enemy==6){ - if (instance_exists(obj_enunit)){ - obj_enunit.alarm[1]=2; - move_enemy_blocks(); - obj_enunit.alarm[0]=3; - } - if (instance_exists(obj_pnunit)){ - obj_pnunit.alarm[1]=1; - turn_count++; +if (__b__) { + __b__ = action_if_variable(cd, 1, 1); + if (__b__) { + __b__ = action_if_variable(click_stall_timer, 1, 1); + if (__b__) { + // with(ob_ennt){shomesge(string(dudes[1])+"|"+string(dudes_num[1])+"|"+string(men+medi)+"|"+string(dudes_hp[1]));} + + // 135; + // instance_activate_object(obj_cursor); + + if (enemy_forces <= 0) { + // Combat for whatever reason sometimes bugs out when there are no enemies, so if enter is pressed 6 times at this state it will set started to 2 + enter_pressed++; + } + + if (started >= 2) { + instance_activate_object(obj_pnunit); + } + + if (started == 3) { + instance_activate_all(); + instance_activate_object(obj_pnunit); + instance_activate_object(obj_enunit); + instance_destroy(obj_popup); + instance_destroy(obj_star_select); + if (instance_exists(obj_pnunit)) { + obj_pnunit.alarm[6] = 1; + } + + alarm[7] = 2; + click_stall_timer = 15; + } + + // if (done>=1) then exit; + + if (turn_count >= 50 || enter_pressed > 5) { + started = 2; + } + if ((started == 2) || (started == 4)) { + instance_activate_object(obj_pnunit); + instance_activate_object(obj_enunit); + // started=3;alarm[5]=3;obj_pnunit.alarm[4]=1;obj_pnunit.alarm[5]=2;obj_enunit.alarm[1]=3; + started = 3; + // obj_pnunit.alarm[4]=2;obj_pnunit.alarm[5]=3;obj_enunit.alarm[1]=1; + var _quad_factor = 10; + total_battle_exp_gain = _quad_factor * sqr(threat); + if (instance_exists(obj_enunit)) { + obj_enunit.alarm[1] = 1; + } + instance_activate_object(obj_star); + instance_activate_object(obj_event_log); + alarm[5] = 6; + click_stall_timer = 15; + + fack = 1; + + newline = "------------------------------------------------------------------------------"; + scr_newtext(); + newline = "------------------------------------------------------------------------------"; + scr_newtext(); + } + + if ((fadein < 0) && (fadein > -100) && (started == 0)) { + fadein = -500; + started = 1; + timer_speed = 1; + timer_stage = 1; + timer = 100; + + if (enemy == 30) { + timer_stage = 3; + } + if (battle_special == "ship_demon") { + timer_stage = 3; + } + } + + if (started > 0) { + // This might be causing problems? + if (instance_exists(obj_pnunit)) { + obj_pnunit.alarm[8] = 8; + } + if (instance_exists(obj_enunit)) { + obj_enunit.alarm[8] = 8; + } + } + + function reset_combat_message_arrays() { + for (var i = 0; i < array_length(message); i++) { + message[i] = ""; + message_sz[i] = 0; + message_priority[i] = 0; + } + } + if ((timer_stage == 1) || (timer_stage == 5)) { + if (global_perils > 0) { + global_perils -= 1; + } + if (global_perils < 0) { + global_perils = 0; + } + turns += 1; + + four_show = 0; + click_stall_timer = 15; + // if (battle_over!=1) then alarm[8]=15; + + if (enemy != 6) { + if (instance_exists(obj_enunit)) { + obj_enunit.alarm[1] = 1; + } + 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; + } else if (enemy == 6) { + if (instance_exists(obj_enunit)) { + obj_enunit.alarm[1] = 2; + move_enemy_blocks(); + obj_enunit.alarm[0] = 3; + } + if (instance_exists(obj_pnunit)) { + obj_pnunit.alarm[1] = 1; + turn_count++; + } + } + messages = 0; + messages_to_show = 24; + largest = 0; + random_messages = 0; + priority = 0; + messages_shown = 0; + reset_combat_message_arrays(); + timer_stage = 2; + timer = 0; + done = 0; + messages_shown = 0; + } else if (timer_stage == 3) { + if (battle_over != 1) { + alarm[8] = 15; + } + click_stall_timer = 15; + + 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; + move_enemy_blocks(); + obj_enunit.alarm[0] = 3; + obj_enunit.alarm[8] = 4; + turns += 1; + } + var messages = 0; + messages_to_show = 24; + largest = 0; + random_messages = 0; + priority = 0; + messages_shown = 0; + reset_combat_message_arrays(); + timer_stage = 4; + timer = 0; + done = 0; + messages_shown = 0; + } + if (enemy == 6) { + if (instance_exists(obj_pnunit)) { + obj_pnunit.alarm[3] = 2; + obj_pnunit.alarm[1] = 3; + turn_count++; + obj_pnunit.alarm[0] = 4; + turns += 1; + } + if (instance_exists(obj_enunit)) { + obj_enunit.alarm[1] = 1; + } + // alarm[9]=5; + var i; + i = 0; + messages = 0; + messages_to_show = 24; + largest = 0; + random_messages = 0; + priority = 0; + messages_shown = 0; + reset_combat_message_arrays(); + timer_stage = 4; + timer = 0; + done = 0; + messages_shown = 0; + } + } } } - messages=0;messages_to_show = 24;largest=0;random_messages=0;priority=0;messages_shown=0; - reset_combat_message_arrays(); - timer_stage=2;timer=0;done=0;messages_shown=0; -} - - - -else if (timer_stage=3){ - if (battle_over!=1) then alarm[8]=15; - click_stall_timer=15; - - 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; - move_enemy_blocks(); - obj_enunit.alarm[0]=3; - obj_enunit.alarm[8]=4; - turns+=1; - } - var messages=0;messages_to_show = 24;largest=0;random_messages=0;priority=0;messages_shown=0; - reset_combat_message_arrays(); - timer_stage=4;timer=0;done=0;messages_shown=0; - } - if (enemy=6){ - if (instance_exists(obj_pnunit)){ - obj_pnunit.alarm[3]=2; - obj_pnunit.alarm[1]=3; - turn_count++; - obj_pnunit.alarm[0]=4; - turns+=1; - } - if (instance_exists(obj_enunit)){ - obj_enunit.alarm[1]=1; - } - // alarm[9]=5; - var i;i=0;messages=0;messages_to_show = 24;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/KeyPress_67.gml b/objects/obj_ncombat/KeyPress_67.gml index c343097b3c..06e4946e08 100644 --- a/objects/obj_ncombat/KeyPress_67.gml +++ b/objects/obj_ncombat/KeyPress_67.gml @@ -1,8 +1,7 @@ -if (global.cheat_debug == 1) -{ - for (var i = 0; i < 30; i++) - { - if (_message[i] != "") - show_message(string(_message[i])) +if (global.cheat_debug == 1) { + for (var i = 0; i < 30; i++) { + if (_message[i] != "") { + show_message(string(_message[i])); + } } } diff --git a/objects/obj_ncombat/Step_0.gml b/objects/obj_ncombat/Step_0.gml index daace578be..ecbd3e136a 100644 --- a/objects/obj_ncombat/Step_0.gml +++ b/objects/obj_ncombat/Step_0.gml @@ -1,114 +1,128 @@ - -if (fadein>-30) then fadein-=1; -if (cd>=0) then cd-=1; -if (click_stall_timer>=0) then click_stall_timer-=1; +if (fadein > -30) { + fadein -= 1; +} +if (cd >= 0) { + cd -= 1; +} +if (click_stall_timer >= 0) { + click_stall_timer -= 1; +} // if (done>=1) then done+=1; - - - -if (!instance_exists(obj_enunit)){ - enemy_forces=0; +if (!instance_exists(obj_enunit)) { + enemy_forces = 0; } -if (!instance_exists(obj_pnunit)){ - player_forces=0; +if (!instance_exists(obj_pnunit)) { + player_forces = 0; } - -if (fack=1) then instance_activate_object(obj_pnunit); +if (fack == 1) { + instance_activate_object(obj_pnunit); +} instance_activate_object(obj_centerline); instance_activate_object(obj_cursor); - -if ((fugg>=60) or (fugg2>=60)) and (messages_shown=0) and (messages_to_show = 24) and (defeat_message=0){ - fugg=0; - fugg2=0; - with (obj_pnunit){ - target_block_is_valid(id,obj_pnunit); +if (((fugg >= 60) || (fugg2 >= 60)) && (messages_shown == 0) && (messages_to_show == 24) && (defeat_message == 0)) { + fugg = 0; + fugg2 = 0; + with (obj_pnunit) { + target_block_is_valid(id, obj_pnunit); } - with (obj_enunit){ - if (x<0){ + with (obj_enunit) { + if (x < 0) { instance_destroy(); } else { - var nearest = instance_nearest(x,y,obj_pnunit); - if (instance_exists(nearest)){ - if (point_distance(x, y, nearest.x, nearest.y) > 100){ + var nearest = instance_nearest(x, y, obj_pnunit); + if (instance_exists(nearest)) { + if (point_distance(x, y, nearest.x, nearest.y) > 100) { instance_destroy(); } } } - } - if ((messages_shown=999) or (messages=0)) and (timer_stage=2){ - newline_color="yellow"; - if (obj_ncombat.enemy!=6){ - if (enemy_forces<=0) or (!instance_exists(obj_enunit)) and (defeat_message=0){ - defeat_message=1; - newline="Enemy Forces Defeated"; - timer_maxspeed=0; - timer_speed=0; - started=2; + if (((messages_shown == 999) || (messages == 0)) && (timer_stage == 2)) { + newline_color = "yellow"; + if (obj_ncombat.enemy != 6) { + if ((enemy_forces <= 0) || (!instance_exists(obj_enunit)) && (defeat_message == 0)) { + defeat_message = 1; + newline = "Enemy Forces Defeated"; + timer_maxspeed = 0; + timer_speed = 0; + started = 2; instance_activate_object(obj_pnunit); } } - newline_color="yellow"; - if (obj_ncombat.enemy=6){ - if ((player_forces<=0) or (!instance_exists(obj_pnunit))) and (defeat_message=0){ - defeat_message=1; - newline=string(global.chapter_name)+" Defeated"; - timer_maxspeed=0; - timer_speed=0; - started=4; - defeat=1; + newline_color = "yellow"; + if (obj_ncombat.enemy == 6) { + if (((player_forces <= 0) || (!instance_exists(obj_pnunit))) && (defeat_message == 0)) { + defeat_message = 1; + newline = string(global.chapter_name) + " Defeated"; + timer_maxspeed = 0; + timer_speed = 0; + started = 4; + defeat = 1; instance_activate_object(obj_pnunit); } } - messages_shown=105; - done=1; + messages_shown = 105; + done = 1; scr_newtext(); - timer_stage=3; + timer_stage = 3; exit; } - + // show_message("Shown: "+string(messages_shown)+"#Messages: "+string(messages)+"#Timer Stage: "+string(timer_stage)); - if ((messages_shown=999) or (messages=0)) and ((timer_stage=4) or (timer_stage=5)) and (four_show=0){ - newline_color="yellow"; - if (obj_ncombat.enemy!=6){ - if ((player_forces<=0) or (!instance_exists(obj_pnunit))) and (defeat_message=0){defeat_message=1;newline=string(global.chapter_name)+" Defeated";timer_maxspeed=0;timer_speed=0;started=4;defeat=1;instance_activate_object(obj_pnunit);} + if (((messages_shown == 999) || (messages == 0)) && ((timer_stage == 4) || (timer_stage == 5)) && (four_show == 0)) { + newline_color = "yellow"; + if (obj_ncombat.enemy != 6) { + if (((player_forces <= 0) || (!instance_exists(obj_pnunit))) && (defeat_message == 0)) { + defeat_message = 1; + newline = string(global.chapter_name) + " Defeated"; + timer_maxspeed = 0; + timer_speed = 0; + started = 4; + defeat = 1; + instance_activate_object(obj_pnunit); + } } - newline_color="yellow"; - if (obj_ncombat.enemy=6){ - if ((enemy_forces<=0) or (!instance_exists(obj_enunit))) and (defeat_message=0){defeat_message=1;newline="Enemy Forces Defeated";timer_maxspeed=0;timer_speed=0;started=2;instance_activate_object(obj_pnunit);} + newline_color = "yellow"; + if (obj_ncombat.enemy == 6) { + if (((enemy_forces <= 0) || (!instance_exists(obj_enunit))) && (defeat_message == 0)) { + defeat_message = 1; + newline = "Enemy Forces Defeated"; + timer_maxspeed = 0; + timer_speed = 0; + started = 2; + instance_activate_object(obj_pnunit); + } } - messages_shown=105; - done=1; + messages_shown = 105; + done = 1; scr_newtext(); - timer_stage=5;exit; + timer_stage = 5; + exit; } exit; } - - - - - - - // if (player_forces>0) and (enemy_forces>0) and (battle_over=0){ - if (timer_stage=2) then fugg+=1; - if (timer_stage=2) and (fugg>60){ - timer_stage=3;// if (!instance_exists(obj_pnunit)) or (!instance_exists(obj_enunit)){alarm[5]=1;started=4;defeat_message=1;} - } - - if (timer_stage!=2) then fugg=0; - if (timer_stage=4) then fugg2+=1; - if (timer_stage=4) and (fugg2>60){ - timer_stage=5;// if (!instance_exists(obj_pnunit)) or (!instance_exists(obj_enunit)){alarm[5]=1;started=4;defeat_message=1;} - } - - if (timer_stage!=4) then fugg2=0; - - - +if (timer_stage == 2) { + fugg += 1; +} +if ((timer_stage == 2) && (fugg > 60)) { + timer_stage = 3; // if (!instance_exists(obj_pnunit)) or (!instance_exists(obj_enunit)){alarm[5]=1;started=4;defeat_message=1;} +} + +if (timer_stage != 2) { + fugg = 0; +} +if (timer_stage == 4) { + fugg2 += 1; +} +if ((timer_stage == 4) && (fugg2 > 60)) { + timer_stage = 5; // if (!instance_exists(obj_pnunit)) or (!instance_exists(obj_enunit)){alarm[5]=1;started=4;defeat_message=1;} +} +if (timer_stage != 4) { + fugg2 = 0; +} diff --git a/objects/obj_popup/Alarm_0.gml b/objects/obj_popup/Alarm_0.gml index e64a7a74af..aafda1e01e 100644 --- a/objects/obj_popup/Alarm_0.gml +++ b/objects/obj_popup/Alarm_0.gml @@ -1,46 +1,48 @@ -if (battle_special=3.1){ +if (battle_special == 3.1) { var that; - - + // show_message(string(obj_popup.loc)+": planet name, "+string(loc)+", "+string(planet)); - - - with(obj_star){if (name!=obj_popup.loc) then instance_deactivate_object(id);} - that=instance_nearest(room_width/2,room_height/2,obj_star); + + with (obj_star) { + if (name != obj_popup.loc) { + instance_deactivate_object(id); + } + } + that = instance_nearest(room_width / 2, room_height / 2, obj_star); instance_activate_all(); - - instance_create(0,0,obj_ncombat); - obj_ncombat.enemy=3; - obj_ncombat.battle_object=that; - obj_ncombat.battle_loc=loc; - obj_ncombat.battle_id=planet; - obj_ncombat.fortified=5; - obj_ncombat.battle_special="mech_stc"; - obj_ncombat.threat=4; - obj_ncombat.formation_set=3; - + + instance_create(0, 0, obj_ncombat); + obj_ncombat.enemy = 3; + obj_ncombat.battle_object = that; + obj_ncombat.battle_loc = loc; + obj_ncombat.battle_id = planet; + obj_ncombat.fortified = 5; + obj_ncombat.battle_special = "mech_stc"; + obj_ncombat.threat = 4; + obj_ncombat.formation_set = 3; + instance_deactivate_all(true); instance_activate_object(obj_ini); instance_activate_object(obj_controller); instance_activate_object(obj_ncombat); - + _roster = new Roster(); - with (_roster){ + with (_roster) { roster_location = obj_ncombat.battle_loc; roster_planet = obj_ncombat.battle_id; determine_full_roster(); only_locals(); update_roster(); - if (array_length(selected_units)){ + if (array_length(selected_units)) { setup_battle_formations(); add_to_battle(); } else { instance_destroy(obj_ncombat); instance_activate_all(); - delete _roster - } + delete _roster; + } } - delete _roster + delete _roster; } -instance_destroy();exit; - +instance_destroy(); +exit; diff --git a/objects/obj_popup/Create_0.gml b/objects/obj_popup/Create_0.gml index a94033deb5..6bb900e7a7 100644 --- a/objects/obj_popup/Create_0.gml +++ b/objects/obj_popup/Create_0.gml @@ -1,246 +1,327 @@ set_zoom_to_default(); -type=0;size=2;y_scale=1; -if (size=1) then sprite_index=spr_popup_small; -if (size=2) then sprite_index=spr_popup_medium; -if (size=3) then sprite_index=spr_popup_large; -image_wid=0;image_hei=0;image=""; - -master_crafted=0;hide=false; -if (instance_exists(obj_controller)){if (obj_controller.popup_master_crafted!=0) then master_crafted=obj_controller.popup_master_crafted;} -type=0; -size=2; -image=""; -title=""; -fancy_title=0; -text_center=0; -text=""; -text2=""; +type = 0; +size = 2; +y_scale = 1; +if (size == 1) { + sprite_index = spr_popup_small; +} +if (size == 2) { + sprite_index = spr_popup_medium; +} +if (size == 3) { + sprite_index = spr_popup_large; +} +image_wid = 0; +image_hei = 0; +image = ""; + +master_crafted = 0; +hide = false; +if (instance_exists(obj_controller)) { + if (obj_controller.popup_master_crafted != 0) { + master_crafted = obj_controller.popup_master_crafted; + } +} +type = 0; +size = 2; +image = ""; +title = ""; +fancy_title = 0; +text_center = 0; +text = ""; +text2 = ""; reset_popup_options(); -pathway=""; -option1enter=false; -option2enter=false; -option3enter=false; -option4enter=false; +pathway = ""; +option1enter = false; +option2enter = false; +option3enter = false; +option4enter = false; pop_data = {}; -amount=0; -save=0; -loc=""; -planet=0; -estimate=0; -mission=""; -old_tags=""; -giveto=0; -inq_hide=0; -ma_co=0; -ma_id=0; -ma_name=""; -manag=0; -fallen=0; -ship_lost=0; -battle_special=0; -owner=0; -tab=1; -woopwoopwoop=0; -press=-1; -reset=0; -demand=0; +amount = 0; +save = 0; +loc = ""; +planet = 0; +estimate = 0; +mission = ""; +old_tags = ""; +giveto = 0; +inq_hide = 0; +ma_co = 0; +ma_id = 0; +ma_name = ""; +manag = 0; +fallen = 0; +ship_lost = 0; +battle_special = 0; +owner = 0; +tab = 1; +woopwoopwoop = 0; +press = -1; +reset = 0; +demand = 0; options = []; -add_option = method(self,add_option); -replace_options = method(self,replace_options); +add_option = method(self, add_option); +replace_options = method(self, replace_options); entered_option = -1; subtype = 0; -company=0; -target_comp=-1; -target_role=0; -unit_role=""; -units=0; -min_exp=0; -cooldown=20; -all_good=0; +company = 0; +target_comp = -1; +target_role = 0; +unit_role = ""; +units = 0; +min_exp = 0; +cooldown = 20; +all_good = 0; prev_selected = 0; -new_target=0; +new_target = 0; -if (instance_exists(obj_controller)){obj_controller.cooldown=8000;} -number=0; +if (instance_exists(obj_controller)) { + obj_controller.cooldown = 8000; +} +number = 0; company_promote_data = [ - {exp : 0}, -//index 0 = draw x, 1 = draw y, 2 = exp requirement for company - {exp :100},//1st company - {exp :65}, - {exp :65}, - {exp :65}, - {exp :65}, - {exp :45}, - {exp :45}, - {exp :35}, - {exp :25}, - {exp :15},//10th company -] - -for (var i=0;i<=10;i++){i+=1;role_name[i]="";role_exp[i]=0;} - + { + exp: 0, + }, + //index 0 = draw x, 1 = draw y, 2 = exp requirement for company + { + exp: 100, + }, //1st company + { + exp: 65, + }, + { + exp: 65, + }, + { + exp: 65, + }, + { + exp: 65, + }, + { + exp: 45, + }, + { + exp: 45, + }, + { + exp: 35, + }, + { + exp: 25, + }, + { + exp: 15, + } //10th company +]; +for (var i = 0; i <= 10; i++) { + i += 1; + role_name[i] = ""; + role_exp[i] = 0; +} // TODO: connect this logic with the other_manage_data() to reduce verboseness; -get_unit_promotion_options = function(){ - var spec=0; - for (var i=0;i<=11;i++){role_name[i]="";role_exp[i]=0;} - i=0; - // this area does the required exp for roles per company - if (unit_role=obj_ini.role[100][16]){ //techmarine - role_name[1]=obj_ini.role[100][16]; - role_exp[1]=5; - spec=1; - }else if (unit_role=obj_ini.role[100][15]){ //apothecary - role_name[1]=obj_ini.role[100][15]; - role_exp[1]=5; - spec=1; - }else if (unit_role=obj_ini.role[100][6]){ //venerable dreadnought - role_name[1]="Venerable "+string(obj_ini.role[100][6]); - role_exp[1]=400; - spec=0; - } else if (unit_role=obj_ini.role[100][14] && global.chapter_name!="Space Wolves" && global.chapter_name!="Iron Hands"){ //chaplain - role_name[1]=obj_ini.role[100][14]; - role_exp[1]=5; - spec=1; - } else if (unit_role="Lexicanum"){ - role_name[1]=obj_ini.role[100,17]; - role_exp[1]=125; - spec=1; - role_name[2]="Codiciery";role_exp[2]=80; - } else if (unit_role == "Codiciery" && target_comp == 0){ - role_name[1]=obj_ini.role[100,17]; - role_exp[1]=125; - spec=1; - } - if (target_comp>0 && target_comp<=10 && spec==0){ - if (units=1){ - if (scr_role_count(obj_ini.role[100][5],"1")==0){ //captain - i+=1; - role_name[i]=obj_ini.role[100][5]; - role_exp[i]=80;//all captains are equalish +get_unit_promotion_options = function() { + var spec = 0; + for (var i = 0; i <= 11; i++) { + role_name[i] = ""; + role_exp[i] = 0; + } + i = 0; + // this area does the required exp for roles per company + if (unit_role == obj_ini.role[100][16]) { + //techmarine + role_name[1] = obj_ini.role[100][16]; + role_exp[1] = 5; + spec = 1; + } else if (unit_role == obj_ini.role[100][15]) { + //apothecary + role_name[1] = obj_ini.role[100][15]; + role_exp[1] = 5; + spec = 1; + } else if (unit_role == obj_ini.role[100][6]) { + //venerable dreadnought + role_name[1] = "Venerable " + string(obj_ini.role[100][6]); + role_exp[1] = 400; + spec = 0; + } else if (unit_role == obj_ini.role[100][14] && global.chapter_name != "Space Wolves" && global.chapter_name != "Iron Hands") { + //chaplain + role_name[1] = obj_ini.role[100][14]; + role_exp[1] = 5; + spec = 1; + } else if (unit_role == "Lexicanum") { + role_name[1] = obj_ini.role[100][17]; + role_exp[1] = 125; + spec = 1; + role_name[2] = "Codiciery"; + role_exp[2] = 80; + } else if (unit_role == "Codiciery" && target_comp == 0) { + role_name[1] = obj_ini.role[100][17]; + role_exp[1] = 125; + spec = 1; + } + if (target_comp > 0 && target_comp <= 10 && spec == 0) { + if (units == 1) { + if (scr_role_count(obj_ini.role[100][5], "1") == 0) { + //captain + i += 1; + role_name[i] = obj_ini.role[100][5]; + role_exp[i] = 80; //all captains are equalish } - if (scr_role_count(obj_ini.role[100][11],"1")==0){ //company ancient - i+=1; - role_name[i]=obj_ini.role[100][11]; - role_exp[i]=company_promote_data[target_comp].exp+10; + if (scr_role_count(obj_ini.role[100][11], "1") == 0) { + //company ancient + i += 1; + role_name[i] = obj_ini.role[100][11]; + role_exp[i] = company_promote_data[target_comp].exp + 10; } - if (scr_role_count(obj_ini.role[100][7],"1")==0){ //company champ - i+=1; - role_name[i]=obj_ini.role[100][7]; - role_exp[i]=company_promote_data[target_comp].exp+10;//may as well have this liniked to weapon skill + if (scr_role_count(obj_ini.role[100][7], "1") == 0) { + //company champ + i += 1; + role_name[i] = obj_ini.role[100][7]; + role_exp[i] = company_promote_data[target_comp].exp + 10; //may as well have this liniked to weapon skill } - i+=1; - role_name[i]=obj_ini.role[100][6]; //dreadnought - role_exp[i]=200; + i += 1; + role_name[i] = obj_ini.role[100][6]; //dreadnought + role_exp[i] = 200; } - - if (obj_controller.command_set[2]==1){ - if (array_contains([2, 3, 4, 5, 6, 7], target_comp)){ - i+=1; - role_name[i]=obj_ini.role[100][8]; //tacts - role_exp[i]=company_promote_data[target_comp].exp; - if (obj_controller.command_set[2]==0){ - role_exp[i]=0; + + if (obj_controller.command_set[2] == 1) { + if (array_contains([2, 3, 4, 5, 6, 7], target_comp)) { + i += 1; + role_name[i] = obj_ini.role[100][8]; //tacts + role_exp[i] = company_promote_data[target_comp].exp; + if (obj_controller.command_set[2] == 0) { + role_exp[i] = 0; } } - - if (array_contains([2, 3, 4, 5, 8], target_comp)){ - i+=1; - role_name[i]=obj_ini.role[100][10]; //assualts - role_exp[i]=company_promote_data[target_comp].exp; - if (obj_controller.command_set[2]==0){ - role_exp[i]=0; + + if (array_contains([2, 3, 4, 5, 8], target_comp)) { + i += 1; + role_name[i] = obj_ini.role[100][10]; //assualts + role_exp[i] = company_promote_data[target_comp].exp; + if (obj_controller.command_set[2] == 0) { + role_exp[i] = 0; } } - - if (array_contains([2, 3, 4, 5, 9], target_comp)){ - i+=1; - role_name[i]=obj_ini.role[100][9]; //devs - role_exp[i]=company_promote_data[target_comp].exp; - if (obj_controller.command_set[2]==0){ - role_exp[i]=0; + + if (array_contains([2, 3, 4, 5, 9], target_comp)) { + i += 1; + role_name[i] = obj_ini.role[100][9]; //devs + role_exp[i] = company_promote_data[target_comp].exp; + if (obj_controller.command_set[2] == 0) { + role_exp[i] = 0; } } - - if (target_comp == 1){ - i+=1; - role_name[i]=obj_ini.role[100][4]; //terminators - role_exp[i]=100; - } - - if (target_comp == 10){ - i+=1; - role_name[i]=obj_ini.role[100][12]; //scouts - role_exp[i]=company_promote_data[target_comp].exp; - if (obj_controller.command_set[2]==0){ - role_exp[i]=0; + + if (target_comp == 1) { + i += 1; + role_name[i] = obj_ini.role[100][4]; //terminators + role_exp[i] = 100; + } + + if (target_comp == 10) { + i += 1; + role_name[i] = obj_ini.role[100][12]; //scouts + role_exp[i] = company_promote_data[target_comp].exp; + if (obj_controller.command_set[2] == 0) { + role_exp[i] = 0; } } - - if (target_comp == 1){ - i+=1; - role_name[i]=obj_ini.role[100][3]; //veterans - role_exp[i]=100; + + if (target_comp == 1) { + i += 1; + role_name[i] = obj_ini.role[100][3]; //veterans + role_exp[i] = 100; } } else { - i+=1; - role_name[i]=obj_ini.role[100][8]; //tacts - role_exp[i]=0; - - i+=1; - role_name[i]=obj_ini.role[100][10]; //assualts - role_exp[i]=0; - - i+=1; - role_name[i]=obj_ini.role[100][9]; //devs - role_exp[i]=0; - - i+=1; - role_name[i]=obj_ini.role[100][4]; //terminators - role_exp[i]=100; - - i+=1; - role_name[i]=obj_ini.role[100][12]; //scouts - role_exp[i]=0; - - i+=1; - role_name[i]=obj_ini.role[100][3]; //veterans - role_exp[i]=0; + i += 1; + role_name[i] = obj_ini.role[100][8]; //tacts + role_exp[i] = 0; + + i += 1; + role_name[i] = obj_ini.role[100][10]; //assualts + role_exp[i] = 0; + + i += 1; + role_name[i] = obj_ini.role[100][9]; //devs + role_exp[i] = 0; + + i += 1; + role_name[i] = obj_ini.role[100][4]; //terminators + role_exp[i] = 100; + + i += 1; + role_name[i] = obj_ini.role[100][12]; //scouts + role_exp[i] = 0; + + i += 1; + role_name[i] = obj_ini.role[100][3]; //veterans + role_exp[i] = 0; } - } - if ((target_comp==0 || target_comp>10)) and (spec==0){ - i+=1; - role_name[i]=obj_ini.role[100][2];//honor guard - role_exp[i]=140; - if (obj_controller.command_set[2]==0) then role_exp[i]=0; - } -} + if ((target_comp == 0 || target_comp > 10) && (spec == 0)) { + i += 1; + role_name[i] = obj_ini.role[100][2]; //honor guard + role_exp[i] = 140; + if (obj_controller.command_set[2] == 0) { + role_exp[i] = 0; + } + } +}; + +req_armour = ""; +req_armour_num = 0; +have_armour_num = 0; +req_gear = ""; +req_gear_num = 0; +have_gear_num = 0; +req_wep1 = ""; +req_wep1_num = 0; +have_wep1_num = 0; +req_wep2 = ""; +req_wep2_num = 0; +have_wep2_num = 0; +req_mobi = ""; +req_mobi_num = 0; +have_mobi_num = 0; -req_armour="";req_armour_num=0;have_armour_num=0; -req_gear="";req_gear_num=0;have_gear_num=0; -req_wep1="";req_wep1_num=0;have_wep1_num=0; -req_wep2="";req_wep2_num=0;have_wep2_num=0; -req_mobi="";req_mobi_num=0;have_mobi_num=0; - -o_wep1="";o_wep2="";o_armour="";o_gear="";o_mobi=""; -n_wep1="";n_wep2="";n_armour="";n_gear="";n_mobi=""; -a_wep1="";a_wep2="";a_armour="";a_gear="";a_mobi=""; -n_good1=1;n_good2=1;n_good3=1;n_good4=1;n_good5=1; -sel1=0;sel2=0;sel3=0;sel4=0;sel5=0; -vehicle_equipment=0;warning=""; +o_wep1 = ""; +o_wep2 = ""; +o_armour = ""; +o_gear = ""; +o_mobi = ""; +n_wep1 = ""; +n_wep2 = ""; +n_armour = ""; +n_gear = ""; +n_mobi = ""; +a_wep1 = ""; +a_wep2 = ""; +a_armour = ""; +a_gear = ""; +a_mobi = ""; +n_good1 = 1; +n_good2 = 1; +n_good3 = 1; +n_good4 = 1; +n_good5 = 1; +sel1 = 0; +sel2 = 0; +sel3 = 0; +sel4 = 0; +sel5 = 0; +vehicle_equipment = 0; +warning = ""; item_name = []; -move_to_next_stage = function(){ - return (scr_hit(0,0, room_width, room_height) || - press_exclusive(vk_enter) || - press_exclusive(vk_space) || - press_exclusive(vk_enter)); -} +move_to_next_stage = function() { + return scr_hit(0, 0, room_width, room_height) || press_exclusive(vk_enter) || press_exclusive(vk_space) || press_exclusive(vk_enter); +}; diff --git a/objects/obj_popup/Destroy_0.gml b/objects/obj_popup/Destroy_0.gml index 3af0fb3804..aa8b2833d6 100644 --- a/objects/obj_popup/Destroy_0.gml +++ b/objects/obj_popup/Destroy_0.gml @@ -1,98 +1,98 @@ - -if (image="chaos_symbol") and (title="Concealed Heresy") and (instance_exists(obj_drop_select)){ - with (obj_drop_select){ - obj_controller.cooldown=30; +if ((image == "chaos_symbol") && (title == "Concealed Heresy") && instance_exists(obj_drop_select)) { + with (obj_drop_select) { + obj_controller.cooldown = 30; // ** Starts the battle ** - is_in_combat=true; + is_in_combat = true; instance_deactivate_all(true); instance_activate_object(obj_controller); instance_activate_object(obj_ini); instance_activate_object(obj_drop_select); - instance_create(0,0,obj_ncombat); - obj_ncombat.battle_object=p_target; - obj_ncombat.battle_loc=p_target.name; - obj_ncombat.battle_id=obj_controller.selecting_planet; - obj_ncombat.dropping=0; - obj_ncombat.attacking=10; - obj_ncombat.enemy=10; - obj_ncombat.formation_set=2; - obj_ncombat.leader=1; - obj_ncombat.threat=5; - obj_ncombat.battle_special="WL10_reveal"; + instance_create(0, 0, obj_ncombat); + obj_ncombat.battle_object = p_target; + obj_ncombat.battle_loc = p_target.name; + obj_ncombat.battle_id = obj_controller.selecting_planet; + obj_ncombat.dropping = 0; + obj_ncombat.attacking = 10; + obj_ncombat.enemy = 10; + obj_ncombat.formation_set = 2; + obj_ncombat.leader = 1; + obj_ncombat.threat = 5; + obj_ncombat.battle_special = "WL10_reveal"; scr_battle_allies(); setup_battle_formations(); - roster.add_to_battle(); + roster.add_to_battle(); } } -if (instance_exists(obj_controller)){ - if (obj_controller.current_eventing="chaos_meeting_1"){ +if (instance_exists(obj_controller)) { + if (obj_controller.current_eventing == "chaos_meeting_1") { scr_toggle_diplomacy(); - obj_controller.diplomacy=10; - obj_controller.cooldown=5000; - with(obj_controller){scr_dialogue("cs_meeting1");} + obj_controller.diplomacy = 10; + obj_controller.cooldown = 5000; + with (obj_controller) { + scr_dialogue("cs_meeting1"); + } } - - if (obj_controller.current_eventing="chaos_trap"){ - instance_create(0,0,obj_ncombat); - obj_ncombat.battle_special="cs_meeting_battle10"; - - var meeting_star ="none"; + + if (obj_controller.current_eventing == "chaos_trap") { + instance_create(0, 0, obj_ncombat); + obj_ncombat.battle_special = "cs_meeting_battle10"; + + var meeting_star = "none"; var meeting_planet; - with(obj_star){ + with (obj_star) { var meeting = has_problem_star("meeting"); var trap = has_problem_star("meeting"); - if (meeting || trap){ - meeting_star=self.id; - if (meeting!=0){ - meeting_planet=meeting; - } else if (trap!=0){ - meeting_planet=meeting; + if (meeting || trap) { + meeting_star = self.id; + if (meeting != 0) { + meeting_planet = meeting; + } else if (trap != 0) { + meeting_planet = meeting; } } } - if (meeting_star=="none"){ + if (meeting_star == "none") { instance_activate_object(obj_star); - with(obj_star){ - if (string_count(name,scr_master_loc())>0){ - meeting_star=self.id; + with (obj_star) { + if (string_count(name, scr_master_loc()) > 0) { + meeting_star = self.id; meeting_planet = obj_ini.TTRPG[0][1].planet_location; } } } - if (meeting_star!="none"){ - obj_ncombat.battle_object=meeting_star; - obj_ncombat.battle_loc=meeting_star.name; - obj_ncombat.battle_id=meeting_planet; + if (meeting_star != "none") { + obj_ncombat.battle_object = meeting_star; + obj_ncombat.battle_loc = meeting_star.name; + obj_ncombat.battle_id = meeting_planet; } - obj_ncombat.dropping=0; - obj_ncombat.attacking=1; - obj_ncombat.local_forces=0; - obj_ncombat.enemy=10; - obj_ncombat.threat=3; - - with(obj_star){ + obj_ncombat.dropping = 0; + obj_ncombat.attacking = 1; + obj_ncombat.local_forces = 0; + obj_ncombat.enemy = 10; + obj_ncombat.threat = 3; + + with (obj_star) { remove_star_problem("meeting"); remove_star_problem("meeting_trap"); } - - obj_controller.useful_info+="CHTRP|"; - - var v=0; - repeat(obj_temp_meeting.dudes){v+=1; - if (obj_temp_meeting.present[v]=1){ - var _unit_array = [obj_temp_meeting.co[v],obj_temp_meeting.ide[v]]; - add_unit_to_battle(_unit_array, meeting_star, true) + obj_controller.useful_info += "CHTRP|"; + + var v = 0; + repeat (obj_temp_meeting.dudes) { + v += 1; + if (obj_temp_meeting.present[v] == 1) { + var _unit_array = [obj_temp_meeting.co[v], obj_temp_meeting.ide[v]]; + add_unit_to_battle(_unit_array, meeting_star, true); } } - - - scr_civil_roster(obj_ncombat.battle_loc,obj_ncombat.battle_id,true); - + + scr_civil_roster(obj_ncombat.battle_loc, obj_ncombat.battle_id, true); + instance_deactivate_all(true); instance_activate_object(obj_controller); instance_activate_object(obj_ini); @@ -101,13 +101,12 @@ if (instance_exists(obj_controller)){ instance_activate_object(obj_centerline); instance_activate_object(obj_pnunit); instance_activate_object(obj_enunit); - + exit; } - - - if (obj_controller.current_eventing="chaos_meeting_end") and (instance_exists(obj_turn_end)){ - obj_turn_end.alarm[1]=1;obj_controller.current_eventing=""; + + if ((obj_controller.current_eventing == "chaos_meeting_end") && instance_exists(obj_turn_end)) { + obj_turn_end.alarm[1] = 1; + obj_controller.current_eventing = ""; } } - diff --git a/objects/obj_popup/Draw_0.gml b/objects/obj_popup/Draw_0.gml index 8b13789179..e69de29bb2 100644 --- a/objects/obj_popup/Draw_0.gml +++ b/objects/obj_popup/Draw_0.gml @@ -1 +0,0 @@ - diff --git a/objects/obj_popup/Draw_64.gml b/objects/obj_popup/Draw_64.gml index abb454c313..2fd7cae928 100644 --- a/objects/obj_popup/Draw_64.gml +++ b/objects/obj_popup/Draw_64.gml @@ -1,141 +1,139 @@ - // ** Promoting ** -try{ - if (type == POPUP_TYPE.PROMOTION) { - draw_popup_promotion(); - } else if (type == 5.1){ - draw_popup_transfer(); - } else if (type == POPUP_TYPE.EQUIP){ - draw_popup_equip(); - }else if (type == POPUP_TYPE.ITEM_GIFT) { - draw_gift_items_popup(); - } else if (type == POPUP_TYPE.ARTIFACT_EQUIP){ - equip_artifact_popup_draw(); - } else if (type == POPUP_TYPE.ADD_TAGS){ - draw_tag_manager(); +// ** Promoting ** +try { + if (type == POPUP_TYPE.PROMOTION) { + draw_popup_promotion(); + } else if (type == 5.1) { + draw_popup_transfer(); + } else if (type == POPUP_TYPE.EQUIP) { + draw_popup_equip(); + } else if (type == POPUP_TYPE.ITEM_GIFT) { + draw_gift_items_popup(); + } else if (type == POPUP_TYPE.ARTIFACT_EQUIP) { + equip_artifact_popup_draw(); + } else if (type == POPUP_TYPE.ADD_TAGS) { + draw_tag_manager(); } else { - if (hide == true) { - exit; - } - if (image == "debug") { - size = 3; - } - - if (instance_exists(obj_fleet)) { - exit; - } - - if (type == POPUP_TYPE.FLEET_MOVE) { - draw_set_font(fnt_large); - draw_set_halign(fa_center); - draw_set_color(CM_GREEN_COLOR); - - if (!obj_controller.zoomed) { - draw_text_transformed(__view_get(e__VW.XView, 0) + 320, __view_get(e__VW.YView, 0) + 60, "SELECT DESTINATION", 0.5, 0.5, 0); - } else { - draw_text_transformed(room_width / 2, 60 * 3, "SELECT DESTINATION", 1.5, 1.5, 0); - } - - draw_set_halign(fa_left); - } else if (type == 10) { - target_comp += 1; - draw_set_color(0); - draw_set_alpha(target_comp / 60); - draw_rectangle(0, 0, room_width, room_height, 0); - draw_set_alpha(1); - exit; - } - - var zoom = 0; - if (instance_exists(obj_controller)) { - zoom = obj_controller.zoomed; - } - if (((zoom == 0) && (type <= 4)) || (type == 98)) { - image_bot = 0; - y_scale_mod = 1; - - popup_window_draw() - - if (image_wid > 0) { - width -= image_wid + 10; - } - - x1 = ((1600 - sprite_width) / 2); - y1 = ((900 - sprite_height * y_scale_mod) / 2); - - draw_set_font(fnt_40k_14b); - draw_set_halign(fa_center); - draw_set_color(CM_GREEN_COLOR); - - if (fancy_title == 1) { - draw_set_font(fnt_fancy); - if (type == 1) { - draw_set_color(255); - } - } - draw_text_transformed(x1 + (sprite_width / 2), y1 + (sprite_height * 0.07), string_hash_to_newline(string(title)), 1.1, 1.1, 0); - // draw_text(xx+320.5,yy+123.5,string(title)); - - draw_set_font(fnt_40k_14); - draw_set_halign(fa_left); - draw_set_color(CM_GREEN_COLOR); - - if (instance_exists(obj_turn_end)) { - if (obj_turn_end.popups > 0) { - draw_text(x1 + 20, y1 + (sprite_height * 0.07), $"{obj_turn_end.current_popup}/{obj_turn_end.popups}" ) - } - } - if (image == "debug") { - draw_text_ext(x1 + 20, y1 + (sprite_height * 0.18), string_hash_to_newline(string(text)), -1, sprite_width - 40); - } else if (image == "") { - if (size == 1) { - draw_text_ext(x1 + 5, y1 + (sprite_height * 0.18), string_hash_to_newline(string(text)), -1, width); - } - if (size != 1) { - draw_text_ext(x1 + 25, y1 + (sprite_height * 0.18), string_hash_to_newline(string(text)), -1, width); - } - str_h = string_height_ext(string_hash_to_newline(string(text)), -1, width) + (sprite_height * 0.18); - } else if (image != "") { - if (size == 1) { - draw_text_ext(x1 + 15 + image_wid, y1 + (sprite_height * 0.18), string_hash_to_newline(string(text)), -1, width); - } - if (size != 1) { - draw_text_ext(x1 + 35 + image_wid, y1 + (sprite_height * 0.18), string_hash_to_newline(string(text)), -1, width); - } - str_h = string_height_ext(string_hash_to_newline(string(text)), -1, width) + (sprite_height * 0.18); - } - - // if (image!="") then draw_text_ext(x1+126+150,y1+152,string(text),-1,384-150); - // if (text2!="") then draw_text_ext(x1+126,y1+309,string(text2),-1,384); - // TODO change this into an array in a function (like romanNumerals does in here) - var img = default_popup_image_index(); - - - if ((img != -1) && (image != "") && (image_wid > 0)) { - var sh = 999; - if (size == 1) { - sh = 24; - scr_image("popup", img, x1 + 5, y1 + sh + 24, image_wid, image_hei); - } - if (size >= 2) { - sh = 24; - scr_image("popup", img, x1 + 25, y1 + sh + 24, image_wid, image_hei); - } - - image_bot = (sprite_height * 0.07) + image_hei + 5; - } - - try{ - draw_popup_options(); - } catch(_exception){ - handle_exception(_exception); - popup_default_close(); - } - } - - if (type == "duel") {} + if (hide == true) { + exit; + } + if (image == "debug") { + size = 3; + } + + if (instance_exists(obj_fleet)) { + exit; + } + + if (type == POPUP_TYPE.FLEET_MOVE) { + draw_set_font(fnt_large); + draw_set_halign(fa_center); + draw_set_color(CM_GREEN_COLOR); + + if (!obj_controller.zoomed) { + draw_text_transformed(__view_get(e__VW.XView, 0) + 320, __view_get(e__VW.YView, 0) + 60, "SELECT DESTINATION", 0.5, 0.5, 0); + } else { + draw_text_transformed(room_width / 2, 60 * 3, "SELECT DESTINATION", 1.5, 1.5, 0); + } + + draw_set_halign(fa_left); + } else if (type == 10) { + target_comp += 1; + draw_set_color(0); + draw_set_alpha(target_comp / 60); + draw_rectangle(0, 0, room_width, room_height, 0); + draw_set_alpha(1); + exit; + } + + var zoom = 0; + if (instance_exists(obj_controller)) { + zoom = obj_controller.zoomed; + } + if (((zoom == 0) && (type <= 4)) || (type == 98)) { + image_bot = 0; + y_scale_mod = 1; + + popup_window_draw(); + + if (image_wid > 0) { + width -= image_wid + 10; + } + + x1 = (1600 - sprite_width) / 2; + y1 = (900 - sprite_height * y_scale_mod) / 2; + + draw_set_font(fnt_40k_14b); + draw_set_halign(fa_center); + draw_set_color(CM_GREEN_COLOR); + + if (fancy_title == 1) { + draw_set_font(fnt_fancy); + if (type == 1) { + draw_set_color(255); + } + } + draw_text_transformed(x1 + (sprite_width / 2), y1 + (sprite_height * 0.07), string_hash_to_newline(string(title)), 1.1, 1.1, 0); + // draw_text(xx+320.5,yy+123.5,string(title)); + + draw_set_font(fnt_40k_14); + draw_set_halign(fa_left); + draw_set_color(CM_GREEN_COLOR); + + if (instance_exists(obj_turn_end)) { + if (obj_turn_end.popups > 0) { + draw_text(x1 + 20, y1 + (sprite_height * 0.07), $"{obj_turn_end.current_popup}/{obj_turn_end.popups}"); + } + } + if (image == "debug") { + draw_text_ext(x1 + 20, y1 + (sprite_height * 0.18), string_hash_to_newline(string(text)), -1, sprite_width - 40); + } else if (image == "") { + if (size == 1) { + draw_text_ext(x1 + 5, y1 + (sprite_height * 0.18), string_hash_to_newline(string(text)), -1, width); + } + if (size != 1) { + draw_text_ext(x1 + 25, y1 + (sprite_height * 0.18), string_hash_to_newline(string(text)), -1, width); + } + str_h = string_height_ext(string_hash_to_newline(string(text)), -1, width) + (sprite_height * 0.18); + } else if (image != "") { + if (size == 1) { + draw_text_ext(x1 + 15 + image_wid, y1 + (sprite_height * 0.18), string_hash_to_newline(string(text)), -1, width); + } + if (size != 1) { + draw_text_ext(x1 + 35 + image_wid, y1 + (sprite_height * 0.18), string_hash_to_newline(string(text)), -1, width); + } + str_h = string_height_ext(string_hash_to_newline(string(text)), -1, width) + (sprite_height * 0.18); + } + + // if (image!="") then draw_text_ext(x1+126+150,y1+152,string(text),-1,384-150); + // if (text2!="") then draw_text_ext(x1+126,y1+309,string(text2),-1,384); + // TODO change this into an array in a function (like romanNumerals does in here) + var img = default_popup_image_index(); + + if ((img != -1) && (image != "") && (image_wid > 0)) { + var sh = 999; + if (size == 1) { + sh = 24; + scr_image("popup", img, x1 + 5, y1 + sh + 24, image_wid, image_hei); + } + if (size >= 2) { + sh = 24; + scr_image("popup", img, x1 + 25, y1 + sh + 24, image_wid, image_hei); + } + + image_bot = (sprite_height * 0.07) + image_hei + 5; + } + + try { + draw_popup_options(); + } catch (_exception) { + handle_exception(_exception); + popup_default_close(); + } + } + + if (type == "duel") {} } -} catch(_exception){ - instance_destroy(); - handle_exception(_exception); +} catch (_exception) { + instance_destroy(); + handle_exception(_exception); } - \ No newline at end of file diff --git a/objects/obj_popup/Keyboard_13.gml b/objects/obj_popup/Keyboard_13.gml index f8c09b1a10..89f7a03717 100644 --- a/objects/obj_popup/Keyboard_13.gml +++ b/objects/obj_popup/Keyboard_13.gml @@ -1,36 +1,37 @@ var __b__; __b__ = action_if_variable(cooldown, 0, 2); -if !__b__ -{ - -if (hide=true) then exit; -if (!instance_exists(obj_controller)) then exit; -if (instance_exists(obj_fleet)) then exit; - +if (!__b__) { + if (hide == true) { + exit; + } + if (!instance_exists(obj_controller)) { + exit; + } + if (instance_exists(obj_fleet)) { + exit; + } -if (battle_special>0){ - alarm[0]=1; - cooldown=10;exit; -} + if (battle_special > 0) { + alarm[0] = 1; + cooldown = 10; + exit; + } -if (array_length(options == 0) && type<5){ - obj_controller.cooldown=10; - if (number!=0) and (obj_controller.complex_event=false){ - if (instance_exists(obj_turn_end)){ - obj_turn_end.alarm[1]=4; + if (array_length(options == 0) && type < 5) { + obj_controller.cooldown = 10; + if ((number != 0) && (obj_controller.complex_event == false)) { + if (instance_exists(obj_turn_end)) { + obj_turn_end.alarm[1] = 4; + } } + instance_destroy(); } - instance_destroy(); -} - -if (type=POPUP_TYPE.BATTLE_OPTIONS){ - obj_controller.cooldown=10; - obj_turn_end.current_battle+=1; - obj_turn_end.alarm[0]=1; - obj_controller.force_scroll=0; - instance_destroy(); -} - - + if (type == POPUP_TYPE.BATTLE_OPTIONS) { + obj_controller.cooldown = 10; + obj_turn_end.current_battle += 1; + obj_turn_end.alarm[0] = 1; + obj_controller.force_scroll = 0; + instance_destroy(); + } } diff --git a/objects/obj_popup/Keyboard_32.gml b/objects/obj_popup/Keyboard_32.gml index 058a40765d..09947752e8 100644 --- a/objects/obj_popup/Keyboard_32.gml +++ b/objects/obj_popup/Keyboard_32.gml @@ -1,30 +1,35 @@ var __b__; __b__ = action_if_variable(cooldown, 0, 2); -if !__b__ -{ +if (!__b__) { + if (hide == true) { + exit; + } + if (!instance_exists(obj_controller)) { + exit; + } + if (instance_exists(obj_fleet)) { + exit; + } -if (hide=true) then exit; -if (!instance_exists(obj_controller)) then exit; -if (instance_exists(obj_fleet)) then exit; + if (battle_special > 0) { + alarm[0] = 1; + cooldown = 10; + exit; + } + if ((array_length(options) == 0) && (type < 5)) { + obj_controller.cooldown = 10; + if ((number != 0) && (obj_controller.complex_event == false)) { + obj_turn_end.alarm[1] = 4; + } + instance_destroy(); + } -if (battle_special>0){ - alarm[0]=1; - cooldown=10;exit; -} - -if (array_length(options) == 0) and (type<5){ - obj_controller.cooldown=10; - if (number!=0) and (obj_controller.complex_event=false) then obj_turn_end.alarm[1]=4; - instance_destroy(); -} - -if (type=POPUP_TYPE.BATTLE_OPTIONS){ - obj_controller.cooldown=10; - obj_turn_end.current_battle+=1; - obj_turn_end.alarm[0]=1; - obj_controller.force_scroll=0; - instance_destroy(); -} - + if (type == POPUP_TYPE.BATTLE_OPTIONS) { + obj_controller.cooldown = 10; + obj_turn_end.current_battle += 1; + obj_turn_end.alarm[0] = 1; + obj_controller.force_scroll = 0; + instance_destroy(); + } } diff --git a/objects/obj_popup/Mouse_51.gml b/objects/obj_popup/Mouse_51.gml index fd69bef782..683b081a4e 100644 --- a/objects/obj_popup/Mouse_51.gml +++ b/objects/obj_popup/Mouse_51.gml @@ -1,12 +1,15 @@ +if (hide == true) { + exit; +} -if (hide=true) then exit; - -if (battle_special>0){ - alarm[0]=1;cooldown=10;exit; +if (battle_special > 0) { + alarm[0] = 1; + cooldown = 10; + exit; } -if (instance_exists(obj_controller)){ - if (obj_controller.force_scroll=1) and (type=99) and (instance_exists(obj_turn_end)){ +if (instance_exists(obj_controller)) { + if ((obj_controller.force_scroll == 1) && (type == 99) && instance_exists(obj_turn_end)) { player_retreat_from_fleet_combat(); } } diff --git a/objects/obj_popup/Mouse_60.gml b/objects/obj_popup/Mouse_60.gml index bf6d1a9851..02cdde1342 100644 --- a/objects/obj_popup/Mouse_60.gml +++ b/objects/obj_popup/Mouse_60.gml @@ -1,8 +1,11 @@ - -if (hide=true) then exit; -if (type=8) and (target_comp>=0) and (obj_controller.man_max>0){ - if (obj_controller.man_current>0) then obj_controller.man_current-=1; - if (obj_controller.man_current>0) then obj_controller.man_current-=1; +if (hide == true) { + exit; +} +if ((type == 8) && (target_comp >= 0) && (obj_controller.man_max > 0)) { + if (obj_controller.man_current > 0) { + obj_controller.man_current -= 1; + } + if (obj_controller.man_current > 0) { + obj_controller.man_current -= 1; + } } - - diff --git a/objects/obj_popup/Mouse_61.gml b/objects/obj_popup/Mouse_61.gml index e82b12a279..670e3c3e0e 100644 --- a/objects/obj_popup/Mouse_61.gml +++ b/objects/obj_popup/Mouse_61.gml @@ -1,7 +1,11 @@ - -if (hide=true) then exit; -if (type=8) and (target_comp>=0) and (obj_controller.man_max>0){ - if ((obj_controller.man_current+9+1)= 0) && (obj_controller.man_max > 0)) { + if ((obj_controller.man_current + 9 + 1) < obj_controller.man_max) { + obj_controller.man_current += 1; + } + if ((obj_controller.man_current + 9 + 1) < obj_controller.man_max) { + obj_controller.man_current += 1; + } } - diff --git a/objects/obj_popup/Step_0.gml b/objects/obj_popup/Step_0.gml index d2e20d8bd9..715f6c5521 100644 --- a/objects/obj_popup/Step_0.gml +++ b/objects/obj_popup/Step_0.gml @@ -1,471 +1,461 @@ try { - if (hide == true) { - exit; - } - if (instance_exists(obj_controller)) { - if (obj_controller.zoomed == 1) { - with (obj_controller) { - scr_zoom(); - } - } - } - - for (var i=0;i 0)) { - if (press == 0) { - var del = obj_saveload.save[save]; - var _save_file = string(PATH_save_files, del); - if (file_exists(_save_file)) { - file_delete(_save_file); - if (file_exists($"save{del}log.ini")) { - file_delete($"save{del}log.ini"); - } - with (obj_saveload) { - instance_destroy(); - } - var news = instance_create(0, 0, obj_saveload); - news.menu = woopwoopwoop; - news.top = owner; - news.alarm[4] = 1; - - instance_destroy(); - } - } - if (press == 1) { - instance_destroy(); - } - exit; - } - - if ((room_get_name(room) == "Main_Menu") && (title == "Tutorial")) { - if (press == 1) { - // 1: yes, 2: no (without disabling) - obj_main_menu_buttons.fading = 1; - obj_main_menu_buttons.crap = 3; - obj_main_menu_buttons.cooldown = 9999; - instance_destroy(); - } - if (press == 2) { - ini_open("saves.ini"); - ini_write_real("Data", "tutorial", 1); - ini_close(); - } - - if (press >= 1) { - obj_main_menu_buttons.fading = 1; - obj_main_menu_buttons.crap = self.press; - obj_main_menu_buttons.cooldown = 9999; - instance_destroy(); - } - exit; - } - if (((title == "Inquisition Mission") || (title == "Inquisition Recon")) && (title != "Artifact Located") && (obj_controller.demanding == 1)) { - demand = 1; - } - - if ((image == "chaos_messenger") && (title == "Chaos Meeting")) { - if ((mission == "meeting_1") || (mission == "meeting_1t")) { - if (array_length(options) == 0) { - add_option([ - "Die, heretic!", - "Very well. Lead the way.", - "I must take care of an urgent matter first. (Exit)" - ]); - exit; - } - if (array_length(options)) { - if (press == 0) { - with (obj_star) { - var i = 0; - repeat (planets) { - remove_planet_problem(i, "meeting"); - remove_planet_problem(i, "meeting_trap"); - } - } - obj_controller.disposition[10] -= 10; - text = "The heretic is killed in a most violent fashion. With a lack of go-between the meeting cannot proceed."; - reset_popup_options(); - mission = ""; // image=""; - if (obj_controller.blood_debt == 1) { - obj_controller.penitent_current += 1; - obj_controller.penitent_turn = 0; - obj_controller.penitent_turnly = 0; - } - with (obj_temp_meeting) { - instance_destroy(); - } - cooldown = 20; - exit; - } else if ((press == 1) && (mission == "meeting_1")) { - obj_controller.complex_event = true; - obj_controller.current_eventing = "chaos_meeting_1"; - text = $"{global.chapter_name} signal your readiness to the heretic. Nearly twenty minutes of following the man passes before {global.chapter_name} all enter an ordinary-looking structure. Down, within the basement, {global.chapter_name} then pass into the entrance of a tunnel. As the trek downward continues more and more heretics appear- cultists, renegades that appear to be from the local garrison, and occasionally even the fallen of your kind. Overall the heretics seem well supplied and equip. This observation is interrupted as your group enters into a larger chamber, revealing a network of tunnels and what appears to be ancient catacombs. Bones of the ancient dead, the forgotten, litter the walls and floor. And the chamber seems to open up wider, and wider, until {global.chapter_name} find yourself within a hall. Within this hall, waiting for {global.chapter_name}, are several dozen Chaos Terminators, a Greater Daemon of Tzeentch and Slaanesh, and Chaos Lord " + string(obj_controller.faction_leader[eFACTION.Chaos]) + "."; - reset_popup_options(); - mission = "cslord1"; - image = ""; - img = 0; - image_wid = 0; - size = 3; - cooldown = 20; - exit; - } else if ((press == 1) && (mission == "meeting_1t")) { - with (obj_star) { - remove_star_problem("meeting"); - remove_star_problem("meeting_trap"); - } - obj_controller.complex_event = true; - obj_controller.current_eventing = "chaos_trap"; - text = $"{global.chapter_name} signal your readiness to the heretic. Nearly twenty minutes of following the man passes before {global.chapter_name} all enter an ordinary-looking structure. Down, within the basement, {global.chapter_name} then pass into the entrance of a tunnel. As the trek downward continues more and more heretics appear- cultists, renegades that appear to be from the local garrison, and occasionally even the fallen of your kind. Overall the heretics seem well supplied and equip. This observation is interrupted as your group enters into a larger chamber, revealing a network of tunnels and what appears to be ancient catacombs. Bones of the ancient dead, the forgotten, litter the walls and floor. And the chamber seems to open up wider, and wider, until {global.chapter_name} find yourself within a hall. Within this hall, waiting for {global.chapter_name}, are several dozen Chaos Terminators, a handful of Helbrute, and many more Chaos Space Marines. The Chaos Lord is nowhere to be seen. It is a trap."; - reset_popup_options(); - mission = "cslord1t"; - image = ""; - img = 0; - image_wid = 0; - size = 3; - cooldown = 20; - exit; - } - if ((press == 2) && instance_exists(obj_turn_end)) { - if (number != 0) { - obj_turn_end.alarm[1] = 4; - } - with (obj_temp_meeting) { - instance_destroy(); - } - instance_destroy(); - } - } - } - } - - if (title == "Scheduled Event") { - if (array_length(options) == 0) { - add_option(["Yes", "No"]); - exit; - } - - if ((press == 0) && (!instance_exists(obj_event))) { - instance_create(0, 0, obj_event); - if (obj_controller.fest_planet == 0) { - obj_controller.fest_attend = scr_event_dudes(1, 0, "", obj_controller.fest_sid); - } - if (obj_controller.fest_planet == 1) { - scr_event_dudes(1, 1, obj_controller.fest_star, obj_controller.fest_wid); - } - hide = true; - cooldown = 6000; - title = "Scheduled Event:2"; - exit; - } - if (press == 1) { - obj_controller.fest_repeats -= 1; - if (obj_controller.fest_repeats <= 0) { - obj_controller.fest_scheduled = 0; - - instance_create(0, 0, obj_event); - if (obj_controller.fest_planet == 0) { - obj_controller.fest_attend = scr_event_dudes(1, 0, "", obj_controller.fest_sid); - } - if (obj_controller.fest_planet == 1) { - scr_event_dudes(1, 1, obj_controller.fest_star, obj_controller.fest_wid); - } - - with (obj_event) { - var ide = 0; - repeat (700) { - ide += 1; - if ((attend_corrupted[ide] == 0) && (attend_id[ide] > 0)) { - if (string_count("chaos", obj_ini.artifact_tags[obj_controller.fest_display]) > 0) { - obj_ini.TTRPG[attend_co[ide], attend_id[ide]].corruption += choose(1, 2, 3, 4); - } - if (string_count("daemonic", obj_ini.artifact_tags[obj_controller.fest_display]) > 0) { - obj_ini.TTRPG[attend_co[ide], attend_id[ide]].corruption += choose(6, 7, 8, 9); - } - attend_corrupted[ide] = 1; - } - } - } - with (obj_event) { - instance_destroy(); - } - - var p1, p2, p3; - p1 = obj_controller.fest_type; - p3 = ""; - p2 = obj_controller.fest_planet; - - if (p2 > 0) { - p3 = string(obj_controller.fest_star) + " " + scr_roman(obj_controller.fest_wid); - } - if (p2 <= 0) { - p3 = +" the vessel '" + string(obj_ini.ship[obj_controller.fest_sid]) + "'"; - } - - scr_alert("green", "event", string(p1) + " on " + string(p3) + " ends.", 0, 0); - scr_event_log("green", string(p1) + " on " + string(p3) + " ends."); - } - obj_controller.cooldown = 10; - if (number != 0 && instance_exists(obj_turn_end)) { - obj_turn_end.alarm[1] = 4; - } - instance_destroy(); - } - } - if (title == "Scheduled Event:2") { - exit; - } - - else if (((title == "Inquisition Mission") || (title == "Inquisition Recon")) && (array_length(options) == 0)) { - add_option(["Accept", "Refuse"], true); - } - - - if ((press == 0) && (array_length(options)) || ((demand == 1) && (mission != "") && (string_count("Inquisition", title) > 0)) || ((demand == 1) && (title == "Inquisition Recon"))) { - - if (title == "Inquisition Recon") { - var mission_star, onceh; - onceh = 0; - obj_controller.temp[200] = string(loc); - var mission_star = star_by_name(obj_controller.temp[200]); - if (add_new_problem(planet, "recon", estimate, mission_star)) { - title = "Inquisition Mission Demand"; - text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. {global.chapter_name} are to land Astartes on {mission_star.name} {scr_roman(planet)} to investigate the planet within {estimate} months."; - with (mission_star) { - new_star_event_marker("green"); - } - scr_event_log("", $"Inquisition Mission Accepted: The Inquisition wish for Astartes to land on and investigate {mission_star.name} {scr_roman(planet)} within {estimate} months.", mission_star.name); - } - } - - if ((mission != "") && (title == "Inquisition Mission")) { - obj_controller.temp[200] = string(loc); - var mission_star, onceh; - mission_star = 0; - onceh = 0; - var mission_star = star_by_name(obj_controller.temp[200]); - var mission_is_go = false; - if (mission_star != "none" && planet > 0) { - var _estimate = estimate; - var _planet = planet; - var _mission = mission; - with (mission_star) { - if (add_new_problem(_planet, _mission, _estimate)) { - new_star_event_marker("green"); - mission_is_go = true; - } - } - - if (mission_is_go) { - if (demand) { - title = "Inquisition Mission Demand"; - } - - - if (mission == "purge") { - scr_event_log("", $"Inquisition Mission Accepted: The nobles of {mission_star.name} {scr_roman(planet)} must be selectively purged within {estimate} months.", mission_star.name); - if (demand) { - text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. {global.chapter_name} are to selectively purge the Nobles on {mission_star.name} {scr_roman(onceh)} within {estimate} months."; - } - } else if (mission == "cleanse") { - scr_event_log("", $"Inquisition Mission Accepted: The mutants beneath {planet_numeral_name(planet, mission_star)} must be cleansed by fire within {estimate} months.", mission_star.name); - if (demand) { - text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. {global.chapter_name} are to cleanse by fire the mutants in Hive {planet_numeral_name(planet, mission_star)} within {estimate} months."; - } - } - if (mission == "spyrer") { - scr_event_log("", $"Inquisition Mission Accepted: The Spyrer on {mission_star.name} {scr_roman(planet)} must be killed within {estimate} months.", mission_star.name); - if (demand) { - text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. An out of control Spyrer on Hive {mission_star.name} {scr_roman(onceh)} must be removed within {estimate} months."; - } - } else if (mission == "tyranid_org") { - image = "webber"; - title = "New Equipment"; - fancy_title = 0; - text_center = 0; - text = $"{global.chapter_name} have been provided with 4x Astartes Webbers in order to complete the mission."; - - if (demand) { - text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. {global.chapter_name} are to capture a Gaunt organism and return it, unharmed- 4x Webbers have been provided for this purpose."; - } - - reset_popup_options(); - scr_add_item("Webber", 4); - obj_controller.cooldown = 10; - scr_event_log("", $"Inquisition Mission Accepted: The Inquisition wishes for the capture of a particular strain Gaunt noticed on {mission_star.name} {scr_roman(planet)} is advisable.", mission_star.name); - obj_controller.useful_info += "Tyr|"; - if (demand) { - demand = 0; - } - exit; - } else if (mission == "ethereal") { - with (obj_star) { - if ((p_tau[1] >= 4) || (p_tau[2] >= 4) || (p_tau[3] >= 4) || (p_tau[4] >= 4)) { - new_star_event_marker("green"); - } - } - scr_quest(0, "ethereal_capture", 4, estimate); - obj_controller.useful_info += "Tau|"; - - if (demand) { - title = "Inquisition Mission Demand"; - text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. {global.chapter_name} are to capture the Tau Ethereal somewhere within the {mission_star.name} system."; - } - if (has_problem_star("recon", mission_star)) { - scr_event_log("", $"Inquisition Mission Accepted: The Inquisition wish for {global.chapter_name} to capture the Tau Ethereal somewhere within {mission_star.name}.", mission_star.name); - } - } else if (mission == "demon_world"){ - scr_event_log("", $"Inquisition Mission Accepted: The demon world of {mission_star.name} {scr_roman(planet)} will be purged by your hand.", mission_star.name); - if (demand) { - text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. An out of control Demon World {mission_star.name} {scr_roman(onceh)} must be cleansed within {estimate} months."; - } - } - } - } - if (!mission_is_go) { - if (mission == "artifact") { - var last_artifact; - scr_quest(0, "artifact_loan", 4, estimate); - if (obj_ini.fleet_type == ePlayerBase.home_world) { - image = "fortress"; - if (obj_ini.home_type == "Hive") { - image = "fortress_hive"; - } - if (obj_ini.home_type == "Death") { - image = "fortress_death"; - } - if (obj_ini.home_type == "Ice") { - image = "fortress_ice"; - } - if (obj_ini.home_type == "Lava") { - image = "fortress_lava"; - } - last_artifact = scr_add_artifact("good", "inquisition", 0, obj_ini.home_name, 2); - } else if (obj_ini.fleet_type != ePlayerBase.home_world) { - image = "artifact_given"; - last_artifact = scr_add_artifact("good", "inquisition", 0, obj_ini.ship[0], 501); - } - - title = "New Artifact"; - fancy_title = 0; - text_center = 0; - text = "The Inquisition has left an Artifact in your care, until it may be retrieved. It has been stored "; - if (obj_ini.fleet_type == ePlayerBase.home_world) { - text += "within your Fortress Monastery."; - } - if (obj_ini.fleet_type != ePlayerBase.home_world) { - text += $"upon your ship '{obj_ini.ship[0]}'."; - } - scr_event_log("", "Inquisition Mission Accepted: The Inquisition has left an Artifact in your care."); - - text += $" It is some form of {obj_ini.artifact[last_artifact]}."; - reset_popup_options(); - obj_controller.cooldown = 10; - exit; - } - } - - if (demand) { - demand = 0; - reset_popup_options(); - exit; - } // Remove multi-choices - } - - if ((image == "inquisition") && (title == "Investigation Completed")) { - obj_temp7.alarm[1] = 1; - instance_destroy(); - } - - if (image == "artifact2") { - ground_forces_collect_artifact(); - obj_controller.cooldown = 10; - instance_destroy(); - } - - obj_controller.cooldown = 10; - if (obj_controller.complex_event == false) { - if (number != 0 && instance_exists(obj_turn_end)) { - obj_turn_end.alarm[1] = 4; - } - instance_destroy(); - } - } - - if ((press == 1) && (option2 != "")) { - - if (mission == "spyrer") { - obj_controller.disposition[4] -= 2; - } - if (title == "Inquisition Recon") { - obj_controller.disposition[4] -= 2; - } - if ((image == "inquisition") && (title == "Investigation Completed")) { - with (obj_temp7) { - instance_destroy(); - } - instance_destroy(); - } - - if (title == "Mercy Plea") { - // If have any marines within the fleet on the ships - - var able, i; - able = 0; - i = 0; - - // Several things can happen when the ship is searched; - // Full of demons, maybe remove a marine, fired upon and explodes - - exit; - } - - if (image == "artifact2") { - scr_return_ship(obj_ground_mission.loc, obj_ground_mission, obj_ground_mission.num); - var man_size, ship_id, comp, plan, i; - i = 0; - ship_id = 0; - man_size = 0; - comp = 0; - plan = 0; - ship_id = array_get_index(obj_ini.ship, obj_ground_mission.loc); - obj_controller.menu = 0; - obj_controller.managing = 0; - obj_controller.cooldown = 10; - with (obj_ground_mission) { - instance_destroy(); - } - instance_destroy(); - exit; - } - - obj_controller.cooldown = 10; - - if (obj_controller.complex_event == false) { - if (number != 0 && instance_exists(obj_turn_end)) { - obj_turn_end.alarm[1] = 4; - } - instance_destroy(); - } - } - - if (pathway == "end_splash") { - if (!array_length(options)){ - add_option(["Continue"]); - } - if (press == 0) { - popup_default_close(); - } - } + if (hide == true) { + exit; + } + if (instance_exists(obj_controller)) { + if (obj_controller.zoomed == 1) { + with (obj_controller) { + scr_zoom(); + } + } + } + + for (var i = 0; i < array_length(options); i++) { + if (keyboard_check_pressed(ord(string(i + 1))) && (cooldown <= 0)) { + press = i; + } + } + + if ((type != 6) && (master_crafted == 1)) { + master_crafted = 0; + } + + if ((image == "fuklaw") && (save > 0)) { + if (press == 0) { + var del = obj_saveload.save[save]; + var _save_file = string(PATH_save_files, del); + if (file_exists(_save_file)) { + file_delete(_save_file); + if (file_exists($"save{del}log.ini")) { + file_delete($"save{del}log.ini"); + } + with (obj_saveload) { + instance_destroy(); + } + var news = instance_create(0, 0, obj_saveload); + news.menu = woopwoopwoop; + news.top = owner; + news.alarm[4] = 1; + + instance_destroy(); + } + } + if (press == 1) { + instance_destroy(); + } + exit; + } + + if ((room_get_name(room) == "Main_Menu") && (title == "Tutorial")) { + if (press == 1) { + // 1: yes, 2: no (without disabling) + obj_main_menu_buttons.fading = 1; + obj_main_menu_buttons.crap = 3; + obj_main_menu_buttons.cooldown = 9999; + instance_destroy(); + } + if (press == 2) { + ini_open("saves.ini"); + ini_write_real("Data", "tutorial", 1); + ini_close(); + } + + if (press >= 1) { + obj_main_menu_buttons.fading = 1; + obj_main_menu_buttons.crap = self.press; + obj_main_menu_buttons.cooldown = 9999; + instance_destroy(); + } + exit; + } + if (((title == "Inquisition Mission") || (title == "Inquisition Recon")) && (title != "Artifact Located") && (obj_controller.demanding == 1)) { + demand = 1; + } + + if ((image == "chaos_messenger") && (title == "Chaos Meeting")) { + if ((mission == "meeting_1") || (mission == "meeting_1t")) { + if (array_length(options) == 0) { + add_option(["Die, heretic!", "Very well. Lead the way.", "I must take care of an urgent matter first. (Exit)"]); + exit; + } + if (array_length(options)) { + if (press == 0) { + with (obj_star) { + var i = 0; + repeat (planets) { + remove_planet_problem(i, "meeting"); + remove_planet_problem(i, "meeting_trap"); + } + } + obj_controller.disposition[10] -= 10; + text = "The heretic is killed in a most violent fashion. With a lack of go-between the meeting cannot proceed."; + reset_popup_options(); + mission = ""; // image=""; + if (obj_controller.blood_debt == 1) { + obj_controller.penitent_current += 1; + obj_controller.penitent_turn = 0; + obj_controller.penitent_turnly = 0; + } + with (obj_temp_meeting) { + instance_destroy(); + } + cooldown = 20; + exit; + } else if ((press == 1) && (mission == "meeting_1")) { + obj_controller.complex_event = true; + obj_controller.current_eventing = "chaos_meeting_1"; + text = $"{global.chapter_name} signal your readiness to the heretic. Nearly twenty minutes of following the man passes before {global.chapter_name} all enter an ordinary-looking structure. Down, within the basement, {global.chapter_name} then pass into the entrance of a tunnel. As the trek downward continues more and more heretics appear- cultists, renegades that appear to be from the local garrison, and occasionally even the fallen of your kind. Overall the heretics seem well supplied and equip. This observation is interrupted as your group enters into a larger chamber, revealing a network of tunnels and what appears to be ancient catacombs. Bones of the ancient dead, the forgotten, litter the walls and floor. And the chamber seems to open up wider, and wider, until {global.chapter_name} find yourself within a hall. Within this hall, waiting for {global.chapter_name}, are several dozen Chaos Terminators, a Greater Daemon of Tzeentch and Slaanesh, and Chaos Lord " + string(obj_controller.faction_leader[eFACTION.Chaos]) + "."; + reset_popup_options(); + mission = "cslord1"; + image = ""; + img = 0; + image_wid = 0; + size = 3; + cooldown = 20; + exit; + } else if ((press == 1) && (mission == "meeting_1t")) { + with (obj_star) { + remove_star_problem("meeting"); + remove_star_problem("meeting_trap"); + } + obj_controller.complex_event = true; + obj_controller.current_eventing = "chaos_trap"; + text = $"{global.chapter_name} signal your readiness to the heretic. Nearly twenty minutes of following the man passes before {global.chapter_name} all enter an ordinary-looking structure. Down, within the basement, {global.chapter_name} then pass into the entrance of a tunnel. As the trek downward continues more and more heretics appear- cultists, renegades that appear to be from the local garrison, and occasionally even the fallen of your kind. Overall the heretics seem well supplied and equip. This observation is interrupted as your group enters into a larger chamber, revealing a network of tunnels and what appears to be ancient catacombs. Bones of the ancient dead, the forgotten, litter the walls and floor. And the chamber seems to open up wider, and wider, until {global.chapter_name} find yourself within a hall. Within this hall, waiting for {global.chapter_name}, are several dozen Chaos Terminators, a handful of Helbrute, and many more Chaos Space Marines. The Chaos Lord is nowhere to be seen. It is a trap."; + reset_popup_options(); + mission = "cslord1t"; + image = ""; + img = 0; + image_wid = 0; + size = 3; + cooldown = 20; + exit; + } + if ((press == 2) && instance_exists(obj_turn_end)) { + if (number != 0) { + obj_turn_end.alarm[1] = 4; + } + with (obj_temp_meeting) { + instance_destroy(); + } + instance_destroy(); + } + } + } + } + + if (title == "Scheduled Event") { + if (array_length(options) == 0) { + add_option(["Yes", "No"]); + exit; + } + + if ((press == 0) && (!instance_exists(obj_event))) { + instance_create(0, 0, obj_event); + if (obj_controller.fest_planet == 0) { + obj_controller.fest_attend = scr_event_dudes(1, 0, "", obj_controller.fest_sid); + } + if (obj_controller.fest_planet == 1) { + scr_event_dudes(1, 1, obj_controller.fest_star, obj_controller.fest_wid); + } + hide = true; + cooldown = 6000; + title = "Scheduled Event:2"; + exit; + } + if (press == 1) { + obj_controller.fest_repeats -= 1; + if (obj_controller.fest_repeats <= 0) { + obj_controller.fest_scheduled = 0; + + instance_create(0, 0, obj_event); + if (obj_controller.fest_planet == 0) { + obj_controller.fest_attend = scr_event_dudes(1, 0, "", obj_controller.fest_sid); + } + if (obj_controller.fest_planet == 1) { + scr_event_dudes(1, 1, obj_controller.fest_star, obj_controller.fest_wid); + } + + with (obj_event) { + var ide = 0; + repeat (700) { + ide += 1; + if ((attend_corrupted[ide] == 0) && (attend_id[ide] > 0)) { + if (string_count("chaos", obj_ini.artifact_tags[obj_controller.fest_display]) > 0) { + obj_ini.TTRPG[attend_co[ide]][attend_id[ide]].corruption += choose(1, 2, 3, 4); + } + if (string_count("daemonic", obj_ini.artifact_tags[obj_controller.fest_display]) > 0) { + obj_ini.TTRPG[attend_co[ide]][attend_id[ide]].corruption += choose(6, 7, 8, 9); + } + attend_corrupted[ide] = 1; + } + } + } + with (obj_event) { + instance_destroy(); + } + + var p1, p2, p3; + p1 = obj_controller.fest_type; + p3 = ""; + p2 = obj_controller.fest_planet; + + if (p2 > 0) { + p3 = string(obj_controller.fest_star) + " " + scr_roman(obj_controller.fest_wid); + } + if (p2 <= 0) { + p3 = +" the vessel '" + string(obj_ini.ship[obj_controller.fest_sid]) + "'"; + } + + scr_alert("green", "event", string(p1) + " on " + string(p3) + " ends.", 0, 0); + scr_event_log("green", string(p1) + " on " + string(p3) + " ends."); + } + obj_controller.cooldown = 10; + if (number != 0 && instance_exists(obj_turn_end)) { + obj_turn_end.alarm[1] = 4; + } + instance_destroy(); + } + } + if (title == "Scheduled Event:2") { + exit; + } else if (((title == "Inquisition Mission") || (title == "Inquisition Recon")) && (array_length(options) == 0)) { + add_option(["Accept", "Refuse"], true); + } + + if ((press == 0) && array_length(options) || ((demand == 1) && (mission != "") && (string_count("Inquisition", title) > 0)) || ((demand == 1) && (title == "Inquisition Recon"))) { + if (title == "Inquisition Recon") { + var mission_star, onceh; + onceh = 0; + obj_controller.temp[200] = string(loc); + var mission_star = star_by_name(obj_controller.temp[200]); + if (add_new_problem(planet, "recon", estimate, mission_star)) { + title = "Inquisition Mission Demand"; + text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. {global.chapter_name} are to land Astartes on {mission_star.name} {scr_roman(planet)} to investigate the planet within {estimate} months."; + with (mission_star) { + new_star_event_marker("green"); + } + scr_event_log("", $"Inquisition Mission Accepted: The Inquisition wish for Astartes to land on and investigate {mission_star.name} {scr_roman(planet)} within {estimate} months.", mission_star.name); + } + } + + if ((mission != "") && (title == "Inquisition Mission")) { + obj_controller.temp[200] = string(loc); + var mission_star, onceh; + mission_star = 0; + onceh = 0; + var mission_star = star_by_name(obj_controller.temp[200]); + var mission_is_go = false; + if (mission_star != "none" && planet > 0) { + var _estimate = estimate; + var _planet = planet; + var _mission = mission; + with (mission_star) { + if (add_new_problem(_planet, _mission, _estimate)) { + new_star_event_marker("green"); + mission_is_go = true; + } + } + + if (mission_is_go) { + if (demand) { + title = "Inquisition Mission Demand"; + } + + if (mission == "purge") { + scr_event_log("", $"Inquisition Mission Accepted: The nobles of {mission_star.name} {scr_roman(planet)} must be selectively purged within {estimate} months.", mission_star.name); + if (demand) { + text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. {global.chapter_name} are to selectively purge the Nobles on {mission_star.name} {scr_roman(onceh)} within {estimate} months."; + } + } else if (mission == "cleanse") { + scr_event_log("", $"Inquisition Mission Accepted: The mutants beneath {planet_numeral_name(planet, mission_star)} must be cleansed by fire within {estimate} months.", mission_star.name); + if (demand) { + text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. {global.chapter_name} are to cleanse by fire the mutants in Hive {planet_numeral_name(planet, mission_star)} within {estimate} months."; + } + } + if (mission == "spyrer") { + scr_event_log("", $"Inquisition Mission Accepted: The Spyrer on {mission_star.name} {scr_roman(planet)} must be killed within {estimate} months.", mission_star.name); + if (demand) { + text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. An out of control Spyrer on Hive {mission_star.name} {scr_roman(onceh)} must be removed within {estimate} months."; + } + } else if (mission == "tyranid_org") { + image = "webber"; + title = "New Equipment"; + fancy_title = 0; + text_center = 0; + text = $"{global.chapter_name} have been provided with 4x Astartes Webbers in order to complete the mission."; + + if (demand) { + text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. {global.chapter_name} are to capture a Gaunt organism and return it, unharmed- 4x Webbers have been provided for this purpose."; + } + + reset_popup_options(); + scr_add_item("Webber", 4); + obj_controller.cooldown = 10; + scr_event_log("", $"Inquisition Mission Accepted: The Inquisition wishes for the capture of a particular strain Gaunt noticed on {mission_star.name} {scr_roman(planet)} is advisable.", mission_star.name); + obj_controller.useful_info += "Tyr|"; + if (demand) { + demand = 0; + } + exit; + } else if (mission == "ethereal") { + with (obj_star) { + if ((p_tau[1] >= 4) || (p_tau[2] >= 4) || (p_tau[3] >= 4) || (p_tau[4] >= 4)) { + new_star_event_marker("green"); + } + } + scr_quest(0, "ethereal_capture", 4, estimate); + obj_controller.useful_info += "Tau|"; + + if (demand) { + title = "Inquisition Mission Demand"; + text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. {global.chapter_name} are to capture the Tau Ethereal somewhere within the {mission_star.name} system."; + } + if (has_problem_star("recon", mission_star)) { + scr_event_log("", $"Inquisition Mission Accepted: The Inquisition wish for {global.chapter_name} to capture the Tau Ethereal somewhere within {mission_star.name}.", mission_star.name); + } + } else if (mission == "demon_world") { + scr_event_log("", $"Inquisition Mission Accepted: The demon world of {mission_star.name} {scr_roman(planet)} will be purged by your hand.", mission_star.name); + if (demand) { + text = $"The Inquisition demands that your Chapter demonstrate its loyalty to the Imperium of Mankind and the Emperor. An out of control Demon World {mission_star.name} {scr_roman(onceh)} must be cleansed within {estimate} months."; + } + } + } + } + if (!mission_is_go) { + if (mission == "artifact") { + var last_artifact; + scr_quest(0, "artifact_loan", 4, estimate); + if (obj_ini.fleet_type == ePlayerBase.home_world) { + image = "fortress"; + if (obj_ini.home_type == "Hive") { + image = "fortress_hive"; + } + if (obj_ini.home_type == "Death") { + image = "fortress_death"; + } + if (obj_ini.home_type == "Ice") { + image = "fortress_ice"; + } + if (obj_ini.home_type == "Lava") { + image = "fortress_lava"; + } + last_artifact = scr_add_artifact("good", "inquisition", 0, obj_ini.home_name, 2); + } else if (obj_ini.fleet_type != ePlayerBase.home_world) { + image = "artifact_given"; + last_artifact = scr_add_artifact("good", "inquisition", 0, obj_ini.ship[0], 501); + } + + title = "New Artifact"; + fancy_title = 0; + text_center = 0; + text = "The Inquisition has left an Artifact in your care, until it may be retrieved. It has been stored "; + if (obj_ini.fleet_type == ePlayerBase.home_world) { + text += "within your Fortress Monastery."; + } + if (obj_ini.fleet_type != ePlayerBase.home_world) { + text += $"upon your ship '{obj_ini.ship[0]}'."; + } + scr_event_log("", "Inquisition Mission Accepted: The Inquisition has left an Artifact in your care."); + + text += $" It is some form of {obj_ini.artifact[last_artifact]}."; + reset_popup_options(); + obj_controller.cooldown = 10; + exit; + } + } + + if (demand) { + demand = 0; + reset_popup_options(); + exit; + } // Remove multi-choices + } + + if ((image == "inquisition") && (title == "Investigation Completed")) { + obj_temp7.alarm[1] = 1; + instance_destroy(); + } + + if (image == "artifact2") { + ground_forces_collect_artifact(); + obj_controller.cooldown = 10; + instance_destroy(); + } + + obj_controller.cooldown = 10; + if (obj_controller.complex_event == false) { + if (number != 0 && instance_exists(obj_turn_end)) { + obj_turn_end.alarm[1] = 4; + } + instance_destroy(); + } + } + + if ((press == 1) && (option2 != "")) { + if (mission == "spyrer") { + obj_controller.disposition[4] -= 2; + } + if (title == "Inquisition Recon") { + obj_controller.disposition[4] -= 2; + } + if ((image == "inquisition") && (title == "Investigation Completed")) { + with (obj_temp7) { + instance_destroy(); + } + instance_destroy(); + } + + if (title == "Mercy Plea") { + // If have any marines within the fleet on the ships + + var able, i; + able = 0; + i = 0; + + // Several things can happen when the ship is searched; + // Full of demons, maybe remove a marine, fired upon and explodes + + exit; + } + + if (image == "artifact2") { + scr_return_ship(obj_ground_mission.loc, obj_ground_mission, obj_ground_mission.num); + var man_size, ship_id, comp, plan, i; + i = 0; + ship_id = 0; + man_size = 0; + comp = 0; + plan = 0; + ship_id = array_get_index(obj_ini.ship, obj_ground_mission.loc); + obj_controller.menu = 0; + obj_controller.managing = 0; + obj_controller.cooldown = 10; + with (obj_ground_mission) { + instance_destroy(); + } + instance_destroy(); + exit; + } + + obj_controller.cooldown = 10; + + if (obj_controller.complex_event == false) { + if (number != 0 && instance_exists(obj_turn_end)) { + obj_turn_end.alarm[1] = 4; + } + instance_destroy(); + } + } + + if (pathway == "end_splash") { + if (!array_length(options)) { + add_option(["Continue"]); + } + if (press == 0) { + popup_default_close(); + } + } } catch (_exception) { - handle_exception(_exception); + handle_exception(_exception); instance_destroy(); } diff --git a/objects/obj_star/Mouse_50.gml b/objects/obj_star/Mouse_50.gml index 4ad82c8009..9f1562d00a 100644 --- a/objects/obj_star/Mouse_50.gml +++ b/objects/obj_star/Mouse_50.gml @@ -12,8 +12,8 @@ if (!global.ui_click_lock) { if (obj_controller.location_viewer.is_entered) { exit; } - // if ((obj_controller.zoomed==0) and (mouse_y <__view_get( e__VW.YView, 0 )+62)) or (obj_controller.menu!=0) then exit; - // if ((obj_controller.zoomed==0) and (mouse_y>__view_get( e__VW.YView, 0 )+830)) or (obj_controller.menu!=0) then exit; + // if ((obj_controller.zoomed==0) and (mouse_y camera_get_view_y(view_camera[0])+830)) or (obj_controller.menu!=0) then exit; if ((p_type[1] == "Craftworld") && (obj_controller.known[eFACTION.Eldar] == 0)) { exit; } diff --git a/scripts/scr_PlanetData/scr_PlanetData.gml b/scripts/scr_PlanetData/scr_PlanetData.gml index 453eb8f5cc..01fc4bae77 100644 --- a/scripts/scr_PlanetData/scr_PlanetData.gml +++ b/scripts/scr_PlanetData/scr_PlanetData.gml @@ -254,13 +254,7 @@ function PlanetData(planet, system) constructor { } else { var _duration = (choose(1, 2) * 6) + choose(-3, -2, -1, 0, 1, 2, 3); } - add_event({ - duration: _duration, - e_id: "governor_assassination", - variant: assaination_type, - system: system.name, - planet: planet, - }); + add_event({duration: _duration, e_id: "governor_assassination", variant: assaination_type, system: system.name, planet: planet}); } return _text; }; @@ -967,16 +961,7 @@ function PlanetData(planet, system) constructor { var pop_string = $"Population: {display_population()}"; var _button_manager = obj_star_select.button_manager; - _button_manager - .update({ - label: pop_string, - tooltip: "population data toggle with 'P'", - keystroke: press_exclusive(ord("P")), - x1: xx + 480, - y1: yy + 217, - w: 200, - h: 22, - }); + _button_manager.update({label: pop_string, tooltip: "population data toggle with 'P'", keystroke: press_exclusive(ord("P")), x1: xx + 480, y1: yy + 217, w: 200, h: 22}); _button_manager.update_loc(); if (_button_manager.draw()) { obj_star_select.population = !obj_star_select.population; diff --git a/scripts/scr_chapter_random/scr_chapter_random.gml b/scripts/scr_chapter_random/scr_chapter_random.gml index 4556b808fc..151aa3759a 100644 --- a/scripts/scr_chapter_random/scr_chapter_random.gml +++ b/scripts/scr_chapter_random/scr_chapter_random.gml @@ -3,1071 +3,1071 @@ /// if "Create Custom" is picked, custom_or_random = 0, if "Create Random" is picked, custom_or_random = 1 /// @param {Real} custom_or_random 0 if Blank Custom, 1 if Random function scr_chapter_random(custom_or_random) { - // custom_or_random = 0 = create custom - // custom_or_random = 1 = create random + // custom_or_random = 0 = create custom + // custom_or_random = 1 = create random - // if custom_or_random=0 then it just gives a name - var i; - i = -1; - world = array_create(21, ""); - world_type = array_create(21, ""); - world_feature = array_create(21, ""); - company_title = array_create(11, ""); - adv = array_create(9, ""); - dis = array_create(9, ""); - adv_num = array_create(9, 0); - dis_num = array_create(9, 0); + // if custom_or_random=0 then it just gives a name + var i; + i = -1; + world = array_create(21, ""); + world_type = array_create(21, ""); + world_feature = array_create(21, ""); + company_title = array_create(11, ""); + adv = array_create(9, ""); + dis = array_create(9, ""); + adv_num = array_create(9, 0); + dis_num = array_create(9, 0); - var ran1, ran2, phrase1, phrase2, main, secondary, lens, weapon, found_secret; - phrase1 = ""; - phrase2 = ""; + var ran1, ran2, phrase1, phrase2, main, secondary, lens, weapon, found_secret; + phrase1 = ""; + phrase2 = ""; - chapter_name = "Unnamed"; - chapter_string = "Unnamed"; - founding = ePROGENITOR.NONE; - found_secret = 0; - points = 0; - maxpoints = 100; - fleet_type = 1; - strength = 5; - cooperation = 5; - purity = 5; - stability = 90; - homeworld = "Temperate"; - homeworld_name = global.name_generator.generate_star_name(); - recruiting = "Death"; - recruiting_name = global.name_generator.generate_star_name(); - flagship_name = global.name_generator.generate_imperial_ship_name(); - recruiting_exists = 1; - homeworld_exists = 1; - homeworld_rule = 1; - aspirant_trial = eTrials.BLOODDUEL; - discipline = "librarius"; - battle_cry = "For the Emperor"; + chapter_name = "Unnamed"; + chapter_string = "Unnamed"; + founding = ePROGENITOR.NONE; + found_secret = 0; + points = 0; + maxpoints = 100; + fleet_type = 1; + strength = 5; + cooperation = 5; + purity = 5; + stability = 90; + homeworld = "Temperate"; + homeworld_name = global.name_generator.generate_star_name(); + recruiting = "Death"; + recruiting_name = global.name_generator.generate_star_name(); + flagship_name = global.name_generator.generate_imperial_ship_name(); + recruiting_exists = 1; + homeworld_exists = 1; + homeworld_rule = 1; + aspirant_trial = eTrials.BLOODDUEL; + discipline = "librarius"; + battle_cry = "For the Emperor"; - main_color = 1; - secondary_color = 1; - main_trim = 1; - left_pauldron = 1; - right_pauldron = 1; // Left/Right pauldron - lens_color = 1; - weapon_color = 1; - col_special = choose(0, 0, 0, 0, 0, 1, 2, 3); + main_color = 1; + secondary_color = 1; + main_trim = 1; + left_pauldron = 1; + right_pauldron = 1; // Left/Right pauldron + lens_color = 1; + weapon_color = 1; + col_special = choose(0, 0, 0, 0, 0, 1, 2, 3); - color_to_main = ""; - color_to_secondary = ""; - color_to_trim = ""; - color_to_pauldron = ""; - color_to_pauldron2 = ""; - color_to_lens = ""; - color_to_weapon = ""; + color_to_main = ""; + color_to_secondary = ""; + color_to_trim = ""; + color_to_pauldron = ""; + color_to_pauldron2 = ""; + color_to_lens = ""; + color_to_weapon = ""; - hapothecary = global.name_generator.generate_space_marine_name(); - hchaplain = global.name_generator.generate_space_marine_name(); - clibrarian = global.name_generator.generate_space_marine_name(); - fmaster = global.name_generator.generate_space_marine_name(); - recruiter = global.name_generator.generate_space_marine_name(); - admiral = global.name_generator.generate_space_marine_name(); + hapothecary = global.name_generator.generate_space_marine_name(); + hchaplain = global.name_generator.generate_space_marine_name(); + clibrarian = global.name_generator.generate_space_marine_name(); + fmaster = global.name_generator.generate_space_marine_name(); + recruiter = global.name_generator.generate_space_marine_name(); + admiral = global.name_generator.generate_space_marine_name(); - equal_specialists = 0; - load_to_ships = [2, 0, 0]; - successors = 0; + equal_specialists = 0; + load_to_ships = [2, 0, 0]; + successors = 0; - mutations = 0; - mutations_selected = 0; - preomnor = 0; - voice = 0; - doomed = 0; - lyman = 0; - omophagea = 0; - ossmodula = 0; - membrane = 0; - zygote = 0; - betchers = 0; - catalepsean = 0; - secretions = 0; - occulobe = 0; - mucranoid = 0; - disposition = array_create(8, 0); - // disposition[0]=0; - // disposition[eFACTION.Player]=0;// Prog - // disposition[eFACTION.Imperium]=0;// Imp - // disposition[eFACTION.Mechanicus]=0;// Mech - // disposition[4]=0;// Inq - // disposition[5]=0;// Ecclesiarchy - // disposition[6]=0;// Astartes - // disposition[7]=0;// Reserved - chapter_master_name = global.name_generator.generate_space_marine_name(); - chapter_master_melee = 1; - chapter_master_ranged = 1; - chapter_master_specialty = choose(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3); + mutations = 0; + mutations_selected = 0; + preomnor = 0; + voice = 0; + doomed = 0; + lyman = 0; + omophagea = 0; + ossmodula = 0; + membrane = 0; + zygote = 0; + betchers = 0; + catalepsean = 0; + secretions = 0; + occulobe = 0; + mucranoid = 0; + disposition = array_create(8, 0); + // disposition[0]=0; + // disposition[eFACTION.Player]=0;// Prog + // disposition[eFACTION.Imperium]=0;// Imp + // disposition[eFACTION.Mechanicus]=0;// Mech + // disposition[4]=0;// Inq + // disposition[5]=0;// Ecclesiarchy + // disposition[6]=0;// Astartes + // disposition[7]=0;// Reserved + chapter_master_name = global.name_generator.generate_space_marine_name(); + chapter_master_melee = 1; + chapter_master_ranged = 1; + chapter_master_specialty = choose(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3); - custom_roles = {}; + custom_roles = {}; - // create random - if (custom_or_random == 1) { - strength = choose(2, 3, 4, 5, 6, 7, 8); - purity = choose(2, 3, 4, 5, 6, 7, 8); - if (strength < 5) { - purity += 2; - } - stability = choose(20, 30, 40, 50, 60, 70, 80); - if (purity < 5) { - stability += 19; - } - cooperation = choose(2, 3, 4, 5, 6, 7, 8); - if (stability < 90) { - cooperation += 2; - } - founding = irandom_range(ePROGENITOR.NONE, ePROGENITOR.RAVEN_GUARD); - found_secret = floor(random(10)) + 1; + // create random + if (custom_or_random == 1) { + strength = choose(2, 3, 4, 5, 6, 7, 8); + purity = choose(2, 3, 4, 5, 6, 7, 8); + if (strength < 5) { + purity += 2; + } + stability = choose(20, 30, 40, 50, 60, 70, 80); + if (purity < 5) { + stability += 19; + } + cooperation = choose(2, 3, 4, 5, 6, 7, 8); + if (stability < 90) { + cooperation += 2; + } + founding = irandom_range(ePROGENITOR.NONE, ePROGENITOR.RAVEN_GUARD); + found_secret = floor(random(10)) + 1; - points = 100; - maxpoints = 100; - battle_cry = "For the Emperor"; + points = 100; + maxpoints = 100; + battle_cry = "For the Emperor"; - discipline = choose("librarius", "librarius", "librarius", "librarius", "biomancy", "pyromancy", "telekinesis"); - } + discipline = choose("librarius", "librarius", "librarius", "librarius", "biomancy", "pyromancy", "telekinesis"); + } - ran1 = floor(random(86)) + 1; - ran2 = floor(random(95)) + 1; - ran3 = floor(random(9)) + 1; + ran1 = floor(random(86)) + 1; + ran2 = floor(random(95)) + 1; + ran3 = floor(random(9)) + 1; - //create random - if (custom_or_random == 1) { - mutations = 0; - mutations_selected = 0; - mutation = ""; - preomnor = 0; - voice = 0; - doomed = 0; - lyman = 0; - omophagea = 0; - ossmodula = 0; - membrane = 0; - zygote = 0; - betchers = 0; - catalepsean = 0; - secretions = 0; - occulobe = 0; - mucranoid = 0; - var mutat; - mutat = 0; + //create random + if (custom_or_random == 1) { + mutations = 0; + mutations_selected = 0; + mutation = ""; + preomnor = 0; + voice = 0; + doomed = 0; + lyman = 0; + omophagea = 0; + ossmodula = 0; + membrane = 0; + zygote = 0; + betchers = 0; + catalepsean = 0; + secretions = 0; + occulobe = 0; + mucranoid = 0; + var mutat; + mutat = 0; - if (found_secret == 1) { - adv[1] = "Enemy: Fallen"; - dis[1] = "Never Forgive"; - } - if (found_secret == 2) { - adv[1] = "Lightning Warriors"; - } - if (found_secret == 3) { - adv[1] = "Assault Doctrine"; - dis[1] = "Suspicious"; - } - if (found_secret == 4) { - adv[1] = "Bolter Drilling"; - betchers = 1; - membrane = 1; - mutations_selected += 2; - mutations += 2; - mutat = 2; - } - if (found_secret == 5) { - adv[1] = "Assault Doctrine"; - dis[1] = "Black Rage"; - } - if (found_secret == 6) { - adv[1] = "Tech-Brothers"; - dis[1] = "Psyker Intolerant"; - } - // if (found_secret=7) then founding="Ultramarines"; - if (found_secret == 8) { - adv[1] = "Crafters"; - dis[1] = "Tolerant"; - secretions = 1; - mutations += 1; - mutations_selected += 1; - mutat += 1; - } - if (found_secret == 9) { - adv[1] = "Ambushers"; - } + if (found_secret == 1) { + adv[1] = "Enemy: Fallen"; + dis[1] = "Never Forgive"; + } + if (found_secret == 2) { + adv[1] = "Lightning Warriors"; + } + if (found_secret == 3) { + adv[1] = "Assault Doctrine"; + dis[1] = "Suspicious"; + } + if (found_secret == 4) { + adv[1] = "Bolter Drilling"; + betchers = 1; + membrane = 1; + mutations_selected += 2; + mutations += 2; + mutat = 2; + } + if (found_secret == 5) { + adv[1] = "Assault Doctrine"; + dis[1] = "Black Rage"; + } + if (found_secret == 6) { + adv[1] = "Tech-Brothers"; + dis[1] = "Psyker Intolerant"; + } + // if (found_secret=7) then founding="Ultramarines"; + if (found_secret == 8) { + adv[1] = "Crafters"; + dis[1] = "Tolerant"; + secretions = 1; + mutations += 1; + mutations_selected += 1; + mutat += 1; + } + if (found_secret == 9) { + adv[1] = "Ambushers"; + } - /* + /* mutations=0;mutations_selected=0;mutation=""; preomnor=0;voice=0;doomed=0;lyman=0;omophagea=0;ossmodula=0;membrane=0; zygote=0;betchers=0;catalepsean=0;secretions=0;occulobe=0;mucranoid=0; */ - mutations += round(4 - (purity / 2.5)); - for (var r = 0; r < 50 && mutat < mutations; ++r) { - if ((preomnor == 0) && (floor(random(12)) + 1 == 2)) { - preomnor = 1; - mutat += 1; - } - if ((voice == 0) && (floor(random(12)) + 1 == 2)) { - voice = 1; - mutat += 1; - } - if ((doomed == 0) && (floor(random(30)) + 1 == 2)) { - doomed = 1; - mutat += 4; - } - if ((lyman == 0) && (floor(random(12)) + 1 == 2)) { - lyman = 1; - mutat += 1; - } - if ((omophagea == 0) && (floor(random(12)) + 1 == 2)) { - omophagea = 1; - mutat += 1; - } - if ((ossmodula == 0) && (floor(random(12)) + 1 == 2)) { - ossmodula = 1; - mutat += 1; - } - if ((membrane == 0) && (floor(random(12)) + 1 == 2)) { - membrane = 1; - mutat += 1; - } - if ((zygote == 0) && (floor(random(12)) + 1 == 2)) { - zygote = 1; - mutat += 2; - } - if ((betchers == 0) && (floor(random(12)) + 1 == 2)) { - betchers = 1; - mutat += 1; - } - if ((catalepsean == 0) && (floor(random(12)) + 1 == 2)) { - catalepsean = 1; - mutat += 1; - } - if ((secretions == 0) && (floor(random(12)) + 1 == 2)) { - secretions = 1; - mutat += 1; - } - if ((occulobe == 0) && (floor(random(12)) + 1 == 2)) { - occulobe = 1; - mutat += 1; - } - if ((mucranoid == 0) && (floor(random(12)) + 1 == 2)) { - mucranoid = 1; - mutat += 1; - } - } + mutations += round(4 - (purity / 2.5)); + for (var r = 0; r < 50 && mutat < mutations; ++r) { + if ((preomnor == 0) && (floor(random(12)) + 1 == 2)) { + preomnor = 1; + mutat += 1; + } + if ((voice == 0) && (floor(random(12)) + 1 == 2)) { + voice = 1; + mutat += 1; + } + if ((doomed == 0) && (floor(random(30)) + 1 == 2)) { + doomed = 1; + mutat += 4; + } + if ((lyman == 0) && (floor(random(12)) + 1 == 2)) { + lyman = 1; + mutat += 1; + } + if ((omophagea == 0) && (floor(random(12)) + 1 == 2)) { + omophagea = 1; + mutat += 1; + } + if ((ossmodula == 0) && (floor(random(12)) + 1 == 2)) { + ossmodula = 1; + mutat += 1; + } + if ((membrane == 0) && (floor(random(12)) + 1 == 2)) { + membrane = 1; + mutat += 1; + } + if ((zygote == 0) && (floor(random(12)) + 1 == 2)) { + zygote = 1; + mutat += 2; + } + if ((betchers == 0) && (floor(random(12)) + 1 == 2)) { + betchers = 1; + mutat += 1; + } + if ((catalepsean == 0) && (floor(random(12)) + 1 == 2)) { + catalepsean = 1; + mutat += 1; + } + if ((secretions == 0) && (floor(random(12)) + 1 == 2)) { + secretions = 1; + mutat += 1; + } + if ((occulobe == 0) && (floor(random(12)) + 1 == 2)) { + occulobe = 1; + mutat += 1; + } + if ((mucranoid == 0) && (floor(random(12)) + 1 == 2)) { + mucranoid = 1; + mutat += 1; + } + } - mutations_selected = mutat; + mutations_selected = mutat; - homeworld = "Temperate"; - recruiting = "Death"; - } + homeworld = "Temperate"; + recruiting = "Death"; + } - var col_main, col_second, col_lens, col_trim, col_weapon; - col_main = ""; - col_second = ""; - col_lens = ""; - col_trim = ""; - col_weapon = ""; + var col_main, col_second, col_lens, col_trim, col_weapon; + col_main = ""; + col_second = ""; + col_lens = ""; + col_trim = ""; + col_weapon = ""; - if (ran1 == 1) { - phrase1 = "Android"; - col_main = "Silver"; - } - if (ran1 == 2) { - phrase1 = "Alpha"; - col_main = "Black"; - } - if (ran1 == 3) { - phrase1 = "Amethyst"; - col_main = "Purple"; - } - if (ran1 == 4) { - phrase1 = "Arctic"; - col_main = "White"; - homeworld = "Ice"; - } - if (ran1 == 5) { - phrase1 = "Astral"; - col_main = "White"; - } - if (ran1 == 6) { - phrase1 = "Atomic"; - col_main = "Blue"; - } - if (ran1 == 7) { - phrase1 = "Azure"; - col_main = "Blue"; - } - if (ran1 == 8) { - phrase1 = "Battle"; - col_main = "Yellow"; - } - if (ran1 == 9) { - phrase1 = "Black"; - col_main = "Black"; - } - if (ran1 == 10) { - phrase1 = "Blood"; - col_main = "Red"; - } - if (ran1 == 11) { - phrase1 = "Blue"; - col_main = "Blue"; - } - if (ran1 == 12) { - phrase1 = "Brawling"; - col_main = "Orange"; - } - if (ran1 == 13) { - phrase1 = "Brazen"; - col_main = "Yellow"; - } - if (ran1 == 14) { - phrase1 = "Crimson"; - col_main = "Dark Red"; - } - if (ran1 == 15) { - phrase1 = "Cryptic"; - col_main = "Black"; - } - if (ran1 == 16) { - phrase1 = "Dancing"; - col_main = "Pink"; - } - if (ran1 == 17) { - phrase1 = "Dark"; - col_main = "Dark Green"; - } - if (ran1 == 18) { - phrase1 = "Death"; - col_main = "Black"; - homeworld = "Lava"; - } - if (ran1 == 19) { - phrase1 = "Delta"; - col_main = "Green"; - } - if (ran1 == 20) { - phrase1 = "Desert"; - col_main = "Dark Gold"; - homeworld = "Desert"; - } - if (ran1 == 21) { - phrase1 = "Desolation"; - col_main = "Black"; - } - if (ran1 == 22) { - phrase1 = "Diamond"; - col_main = "White"; - } - if (ran1 == 23) { - phrase1 = "Doom"; - col_main = "Red"; - } - if (ran1 == 24) { - phrase1 = "Emerald"; - col_main = "Green"; - } - if (ran1 == 25) { - phrase1 = "Fighting"; - col_main = "Yellow"; - } - if (ran1 == 26) { - phrase1 = "Fire"; - col_main = "Orange"; - } - if (ran1 == 27) { - phrase1 = "Flying"; - col_main = "White"; - fleet_type = 1; - } - if (ran1 == 28) { - phrase1 = "Frenzied"; - col_main = "Red"; - } - if (ran1 == 29) { - phrase1 = "Furious"; - col_main = "Dark Red"; - } - if (ran1 == 30) { - phrase1 = "Golden"; - col_main = "Dark Gold"; - } - if (ran1 == 31) { - phrase1 = "Gore"; - col_main = "Red"; - } - if (ran1 == 32) { - phrase1 = "Grail"; - col_main = "Yellow"; - } - if (ran1 == 33) { - phrase1 = "Green"; - col_main = "Green"; - } - if (ran1 == 34) { - phrase1 = "Grey"; - col_main = "Silver"; - } - if (ran1 == 35) { - phrase1 = "Horned"; - col_main = "Dark Green"; - } - if (ran1 == 36) { - phrase1 = "Howling"; - col_main = "Light Blue"; - } - if (ran1 == 37) { - phrase1 = "Ice"; - col_main = "Light Blue"; - homeworld = "Ice"; - } - if (ran1 == 38) { - phrase1 = "Imperial"; - col_main = "Yellow"; - } - if (ran1 == 39) { - phrase1 = "Iron"; - col_main = "Silver"; - } - if (ran1 == 40) { - phrase1 = "Light"; - col_main = "White"; - } - if (ran1 == 41) { - phrase1 = "Maleficent"; - col_main = "Purple"; - } - if (ran1 == 42) { - phrase1 = "Malevolent"; - col_main = "Black"; - } - if (ran1 == 43) { - phrase1 = "Nova"; - col_main = "White"; - } - if (ran1 == 44) { - phrase1 = "Omega"; - col_main = "Dark Gold"; - } - if (ran1 == 45) { - phrase1 = "Orange"; - col_main = "Orange"; - } - if (ran1 == 46) { - phrase1 = "Ozone"; - col_main = "Light Blue"; - } - if (ran1 == 47) { - phrase1 = "Penitent"; - col_main = "Black"; - fleet_type = 3; - } - if (ran1 == 48) { - phrase1 = "Polar"; - col_main = "White"; - homeworld = "Ice"; - } - if (ran1 == 49) { - phrase1 = "Psi"; - col_main = "Blue"; - } - if (ran1 == 50) { - phrase1 = "Purple"; - col_main = "Purple"; - } - if (ran1 == 51) { - phrase1 = "Raging"; - col_main = "Red"; - } - if (ran1 == 52) { - phrase1 = "Regal"; - col_main = "Purple"; - } - if (ran1 == 53) { - phrase1 = "Royal"; - col_main = "Purple"; - } - if (ran1 == 54) { - phrase1 = "Rainbow"; - col_main = "Pink"; - } - if (ran1 == 55) { - phrase1 = "Red"; - col_main = "Red"; - } - if (ran1 == 56) { - phrase1 = "Repentant"; - col_main = "Black"; - } - if (ran1 == 57) { - phrase1 = "Ruby"; - col_main = "Red"; - } - if (ran1 == 58) { - phrase1 = "Sanguine"; - col_main = "Sanguine Red"; - } - if (ran1 == 59) { - phrase1 = "Sapphire"; - col_main = "Blue"; - } - if (ran1 == 60) { - phrase1 = "Savage"; - col_main = "Dark Red"; - } - if (ran1 == 61) { - phrase1 = "Screaming"; - col_main = "White"; - } - if (ran1 == 62) { - phrase1 = "Screeching"; - col_main = "Blue"; - } - if (ran1 == 63) { - phrase1 = "Shrieking"; - col_main = "Black"; - } - if (ran1 == 64) { - phrase1 = "Shadow"; - col_main = "Black"; - } - if (ran1 == 65) { - phrase1 = "Siege"; - col_main = "Silver"; - homeworld = "Hive"; - } - if (ran1 == 66) { - phrase1 = "Silver"; - col_main = "Silver"; - } - if (ran1 == 67) { - phrase1 = "Skulking"; - col_main = "Black"; - fleet_type = 3; - } - if (ran1 == 68) { - phrase1 = "Snapping"; - col_main = "Orange"; - } - if (ran1 == 69) { - phrase1 = "Snarling"; - col_main = "Dark Red"; - } - if (ran1 == 70) { - phrase1 = "Space"; - col_main = "Light Blue"; - } - if (ran1 == 71) { - phrase1 = "Star"; - col_main = "Black"; - } - if (ran1 == 72) { - phrase1 = "Stealth"; - col_main = "Black"; - } - if (ran1 == 73) { - phrase1 = "Storm"; - col_main = "Yellow"; - } - if (ran1 == 74) { - phrase1 = "Striking"; - col_main = "Green"; - } - if (ran1 == 75) { - phrase1 = "Thunder"; - col_main = "Yellow"; - } - if (ran1 == 76) { - phrase1 = "Topaz"; - col_main = "Yellow"; - } - if (ran1 == 77) { - phrase1 = "Tundra"; - col_main = "Green"; - homeworld = "Ice"; - } - if (ran1 == 78) { - phrase1 = "Vermilion"; - col_main = "Orange"; - } - if (ran1 == 79) { - phrase1 = "Vigilant"; - col_main = "White"; - } - if (ran1 == 80) { - phrase1 = "Ultra"; - col_main = "Blue"; - fleet_type = 2; - } - if (ran1 == 81) { - phrase1 = "Umbrageous"; - col_main = "White"; - } - if (ran1 == 82) { - phrase1 = "War"; - col_main = "Red"; - } - if (ran1 == 83) { - phrase1 = "White"; - col_main = "White"; - } - if (ran1 == 84) { - phrase1 = "Wicked"; - col_main = "Dark Green"; - } - if (ran1 == 85) { - phrase1 = "Wild"; - col_main = "Light Blue"; - } - if (ran1 == 86) { - phrase1 = "Zeta"; - col_main = "White"; - } + if (ran1 == 1) { + phrase1 = "Android"; + col_main = "Silver"; + } + if (ran1 == 2) { + phrase1 = "Alpha"; + col_main = "Black"; + } + if (ran1 == 3) { + phrase1 = "Amethyst"; + col_main = "Purple"; + } + if (ran1 == 4) { + phrase1 = "Arctic"; + col_main = "White"; + homeworld = "Ice"; + } + if (ran1 == 5) { + phrase1 = "Astral"; + col_main = "White"; + } + if (ran1 == 6) { + phrase1 = "Atomic"; + col_main = "Blue"; + } + if (ran1 == 7) { + phrase1 = "Azure"; + col_main = "Blue"; + } + if (ran1 == 8) { + phrase1 = "Battle"; + col_main = "Yellow"; + } + if (ran1 == 9) { + phrase1 = "Black"; + col_main = "Black"; + } + if (ran1 == 10) { + phrase1 = "Blood"; + col_main = "Red"; + } + if (ran1 == 11) { + phrase1 = "Blue"; + col_main = "Blue"; + } + if (ran1 == 12) { + phrase1 = "Brawling"; + col_main = "Orange"; + } + if (ran1 == 13) { + phrase1 = "Brazen"; + col_main = "Yellow"; + } + if (ran1 == 14) { + phrase1 = "Crimson"; + col_main = "Dark Red"; + } + if (ran1 == 15) { + phrase1 = "Cryptic"; + col_main = "Black"; + } + if (ran1 == 16) { + phrase1 = "Dancing"; + col_main = "Pink"; + } + if (ran1 == 17) { + phrase1 = "Dark"; + col_main = "Dark Green"; + } + if (ran1 == 18) { + phrase1 = "Death"; + col_main = "Black"; + homeworld = "Lava"; + } + if (ran1 == 19) { + phrase1 = "Delta"; + col_main = "Green"; + } + if (ran1 == 20) { + phrase1 = "Desert"; + col_main = "Dark Gold"; + homeworld = "Desert"; + } + if (ran1 == 21) { + phrase1 = "Desolation"; + col_main = "Black"; + } + if (ran1 == 22) { + phrase1 = "Diamond"; + col_main = "White"; + } + if (ran1 == 23) { + phrase1 = "Doom"; + col_main = "Red"; + } + if (ran1 == 24) { + phrase1 = "Emerald"; + col_main = "Green"; + } + if (ran1 == 25) { + phrase1 = "Fighting"; + col_main = "Yellow"; + } + if (ran1 == 26) { + phrase1 = "Fire"; + col_main = "Orange"; + } + if (ran1 == 27) { + phrase1 = "Flying"; + col_main = "White"; + fleet_type = 1; + } + if (ran1 == 28) { + phrase1 = "Frenzied"; + col_main = "Red"; + } + if (ran1 == 29) { + phrase1 = "Furious"; + col_main = "Dark Red"; + } + if (ran1 == 30) { + phrase1 = "Golden"; + col_main = "Dark Gold"; + } + if (ran1 == 31) { + phrase1 = "Gore"; + col_main = "Red"; + } + if (ran1 == 32) { + phrase1 = "Grail"; + col_main = "Yellow"; + } + if (ran1 == 33) { + phrase1 = "Green"; + col_main = "Green"; + } + if (ran1 == 34) { + phrase1 = "Grey"; + col_main = "Silver"; + } + if (ran1 == 35) { + phrase1 = "Horned"; + col_main = "Dark Green"; + } + if (ran1 == 36) { + phrase1 = "Howling"; + col_main = "Light Blue"; + } + if (ran1 == 37) { + phrase1 = "Ice"; + col_main = "Light Blue"; + homeworld = "Ice"; + } + if (ran1 == 38) { + phrase1 = "Imperial"; + col_main = "Yellow"; + } + if (ran1 == 39) { + phrase1 = "Iron"; + col_main = "Silver"; + } + if (ran1 == 40) { + phrase1 = "Light"; + col_main = "White"; + } + if (ran1 == 41) { + phrase1 = "Maleficent"; + col_main = "Purple"; + } + if (ran1 == 42) { + phrase1 = "Malevolent"; + col_main = "Black"; + } + if (ran1 == 43) { + phrase1 = "Nova"; + col_main = "White"; + } + if (ran1 == 44) { + phrase1 = "Omega"; + col_main = "Dark Gold"; + } + if (ran1 == 45) { + phrase1 = "Orange"; + col_main = "Orange"; + } + if (ran1 == 46) { + phrase1 = "Ozone"; + col_main = "Light Blue"; + } + if (ran1 == 47) { + phrase1 = "Penitent"; + col_main = "Black"; + fleet_type = 3; + } + if (ran1 == 48) { + phrase1 = "Polar"; + col_main = "White"; + homeworld = "Ice"; + } + if (ran1 == 49) { + phrase1 = "Psi"; + col_main = "Blue"; + } + if (ran1 == 50) { + phrase1 = "Purple"; + col_main = "Purple"; + } + if (ran1 == 51) { + phrase1 = "Raging"; + col_main = "Red"; + } + if (ran1 == 52) { + phrase1 = "Regal"; + col_main = "Purple"; + } + if (ran1 == 53) { + phrase1 = "Royal"; + col_main = "Purple"; + } + if (ran1 == 54) { + phrase1 = "Rainbow"; + col_main = "Pink"; + } + if (ran1 == 55) { + phrase1 = "Red"; + col_main = "Red"; + } + if (ran1 == 56) { + phrase1 = "Repentant"; + col_main = "Black"; + } + if (ran1 == 57) { + phrase1 = "Ruby"; + col_main = "Red"; + } + if (ran1 == 58) { + phrase1 = "Sanguine"; + col_main = "Sanguine Red"; + } + if (ran1 == 59) { + phrase1 = "Sapphire"; + col_main = "Blue"; + } + if (ran1 == 60) { + phrase1 = "Savage"; + col_main = "Dark Red"; + } + if (ran1 == 61) { + phrase1 = "Screaming"; + col_main = "White"; + } + if (ran1 == 62) { + phrase1 = "Screeching"; + col_main = "Blue"; + } + if (ran1 == 63) { + phrase1 = "Shrieking"; + col_main = "Black"; + } + if (ran1 == 64) { + phrase1 = "Shadow"; + col_main = "Black"; + } + if (ran1 == 65) { + phrase1 = "Siege"; + col_main = "Silver"; + homeworld = "Hive"; + } + if (ran1 == 66) { + phrase1 = "Silver"; + col_main = "Silver"; + } + if (ran1 == 67) { + phrase1 = "Skulking"; + col_main = "Black"; + fleet_type = 3; + } + if (ran1 == 68) { + phrase1 = "Snapping"; + col_main = "Orange"; + } + if (ran1 == 69) { + phrase1 = "Snarling"; + col_main = "Dark Red"; + } + if (ran1 == 70) { + phrase1 = "Space"; + col_main = "Light Blue"; + } + if (ran1 == 71) { + phrase1 = "Star"; + col_main = "Black"; + } + if (ran1 == 72) { + phrase1 = "Stealth"; + col_main = "Black"; + } + if (ran1 == 73) { + phrase1 = "Storm"; + col_main = "Yellow"; + } + if (ran1 == 74) { + phrase1 = "Striking"; + col_main = "Green"; + } + if (ran1 == 75) { + phrase1 = "Thunder"; + col_main = "Yellow"; + } + if (ran1 == 76) { + phrase1 = "Topaz"; + col_main = "Yellow"; + } + if (ran1 == 77) { + phrase1 = "Tundra"; + col_main = "Green"; + homeworld = "Ice"; + } + if (ran1 == 78) { + phrase1 = "Vermilion"; + col_main = "Orange"; + } + if (ran1 == 79) { + phrase1 = "Vigilant"; + col_main = "White"; + } + if (ran1 == 80) { + phrase1 = "Ultra"; + col_main = "Blue"; + fleet_type = 2; + } + if (ran1 == 81) { + phrase1 = "Umbrageous"; + col_main = "White"; + } + if (ran1 == 82) { + phrase1 = "War"; + col_main = "Red"; + } + if (ran1 == 83) { + phrase1 = "White"; + col_main = "White"; + } + if (ran1 == 84) { + phrase1 = "Wicked"; + col_main = "Dark Green"; + } + if (ran1 == 85) { + phrase1 = "Wild"; + col_main = "Light Blue"; + } + if (ran1 == 86) { + phrase1 = "Zeta"; + col_main = "White"; + } - col_second = ""; - col_lens = "Red"; - col_trim = col_main; - col_weapon = "Black"; - if (ran2 == 1) { - phrase2 = "Acolytes"; - col_second = "Red"; - } - if (ran2 == 2) { - phrase2 = "Adders"; - col_second = "Black"; - } - if (ran2 == 3) { - phrase2 = "Amazons"; - col_second = "Orange"; - } - if (ran2 == 4) { - phrase2 = "Angels"; - col_second = "Silver"; - } - if (ran2 == 5) { - phrase2 = "Archangels"; - col_second = "Silver"; - } - if (ran2 == 6) { - phrase2 = "Avengers"; - col_second = "Black"; - } - if (ran2 == 7) { - phrase2 = "Barracudas"; - } - if (ran2 == 8) { - phrase2 = "Bees"; - col_second = "Black"; - } - if (ran2 == 9) { - phrase2 = "Bringers"; - } - if (ran2 == 10) { - phrase2 = "Brothers"; - } - if (ran2 == 11) { - phrase2 = "Cats"; - } - if (ran2 == 12) { - phrase2 = "Champions"; - } - if (ran2 == 13) { - phrase2 = "Chameleons"; - } - if (ran2 == 14) { - phrase2 = "Claws"; - col_second = "White"; - } - if (ran2 == 15) { - phrase2 = "Cobras"; - } - if (ran2 == 16) { - phrase2 = "Company"; - } - if (ran2 == 17) { - phrase2 = "Consuls"; - } - if (ran2 == 18) { - phrase2 = "Corsairs"; - col_second = "Dark Red"; - } - if (ran2 == 19) { - phrase2 = "Crusaders"; - } - if (ran2 == 20) { - phrase2 = "Destroyers"; - } - if (ran2 == 21) { - phrase2 = "Devils"; - col_second = "Red"; - } - if (ran2 == 22) { - phrase2 = "Dogs"; - } - if (ran2 == 23) { - phrase2 = "Dragons"; - col_second = "Red"; - } - if (ran2 == 24) { - phrase2 = "Eagles"; - col_second = "White"; - } - if (ran2 == 25) { - phrase2 = "Eaters"; - col_second = "Red"; - } - if (ran2 == 26) { - phrase2 = "Enforcers"; - } - if (ran2 == 27) { - phrase2 = "Falcons"; - } - if (ran2 == 28) { - phrase2 = "Fists"; - } - if (ran2 == 29) { - phrase2 = "Foxes"; - } - if (ran2 == 30) { - phrase2 = "Gators"; - col_second = "Green"; - } - if (ran2 == 31) { - phrase2 = "Giants"; - } - if (ran2 == 32) { - phrase2 = "Golems"; - col_second = "Silver"; - } - if (ran2 == 33) { - phrase2 = "Gorillas"; - col_second = "Black"; - } - if (ran2 == 34) { - phrase2 = "Griffons"; - } - if (ran2 == 35) { - phrase2 = "Guard"; - } - if (ran2 == 36) { - phrase2 = "Guardians"; - } - if (ran2 == 37) { - phrase2 = "Hands"; - } - if (ran2 == 38) { - phrase2 = "Hawks"; - col_second = "Blue"; - } - if (ran2 == 39) { - phrase2 = "Hippos"; - } - if (ran2 == 40) { - phrase2 = "Hornets"; - col_second = "Yellow"; - } - if (ran2 == 41) { - phrase2 = "Hounds"; - } - if (ran2 == 42) { - phrase2 = "Hunters"; - } - if (ran2 == 43) { - phrase2 = "Inculpators"; - } - if (ran2 == 44) { - phrase2 = "Jaguars"; - col_second = "Dark Green"; - } - if (ran2 == 45) { - phrase2 = "Justiciars"; - col_second = "Black"; - } - if (ran2 == 46) { - phrase2 = "Knights"; - col_second = "Silver"; - } - if (ran2 == 47) { - phrase2 = "Krakens"; - col_second = "Green"; - fleet_type = 1; - } - if (ran2 == 48) { - phrase2 = "Lamenters"; - col_second = "Yellow"; - fleet_type = 3; - } - if (ran2 == 49) { - phrase2 = "Lions"; - col_second = "Orange"; - } - if (ran2 == 50) { - phrase2 = "Liberators"; - } - if (ran2 == 51) { - phrase2 = "Lords"; - } - if (ran2 == 52) { - phrase2 = "Marauders"; - col_second = "Black"; - } - if (ran2 == 53) { - phrase2 = "Marines"; - } - if (ran2 == 54) { - phrase2 = "Medusas"; - } - if (ran2 == 55) { - phrase2 = "Mentors"; - col_second = "Black"; - } - if (ran2 == 56) { - phrase2 = "Monitors"; - } - if (ran2 == 57) { - phrase2 = "Owls"; - } - if (ran2 == 58) { - phrase2 = "Paladins"; - col_second = "Silver"; - } - if (ran2 == 59) { - phrase2 = "Panthers"; - col_second = "Black"; - } - if (ran2 == 60) { - phrase2 = "Patriarchs"; - } - if (ran2 == 61) { - phrase2 = "Phantoms"; - col_second = "Black"; - } - if (ran2 == 62) { - phrase2 = "Purgators"; - } - if (ran2 == 63) { - phrase2 = "Raiders"; - } - if (ran2 == 64) { - phrase2 = "Rampagers"; - col_second = "Black"; - } - if (ran2 == 65) { - phrase2 = "Raptors"; - } - if (ran2 == 66) { - phrase2 = "Ravens"; - } - if (ran2 == 67) { - phrase2 = "Redeemers"; - } - if (ran2 == 68) { - phrase2 = "Revilers"; - } - if (ran2 == 69) { - phrase2 = "Saints"; - col_second = "White"; - } - if (ran2 == 70) { - phrase2 = "Salamanders"; - col_second = "Green"; - } - if (ran2 == 71) { - phrase2 = "Scars"; - col_second = "White"; - } - if (ran2 == 72) { - phrase2 = "Scions"; - col_second = "Purple"; - } - if (ran2 == 73) { - phrase2 = "Scorpians"; - col_second = "Orange"; - } - if (ran2 == 74) { - phrase2 = "Scythes"; - } - if (ran2 == 75) { - phrase2 = "Shades"; - } - if (ran2 == 76) { - phrase2 = "Sharks"; - col_second = "Light Blue"; - } - if (ran2 == 77) { - phrase2 = "Sisters"; - } - if (ran2 == 78) { - phrase2 = "Skulls"; - col_second = "White"; - } - if (ran2 == 79) { - phrase2 = "Sons"; - } - if (ran2 == 80) { - phrase2 = "Spectres"; - } - if (ran2 == 81) { - phrase2 = "Slayers"; - } - if (ran2 == 82) { - phrase2 = "Stalkers"; - } - if (ran2 == 83) { - phrase2 = "Swords"; - col_second = "Silver"; - } - if (ran2 == 84) { - phrase2 = "Talons"; - } - if (ran2 == 85) { - phrase2 = "Templars"; - col_second = "White"; - } - if (ran2 == 86) { - phrase2 = "Tigers"; - col_second = "Black"; - } - if (ran2 == 87) { - phrase2 = "Turtles"; - col_second = "Dark Green"; - } - if (ran2 == 88) { - phrase2 = "Vindicators"; - } - if (ran2 == 89) { - phrase2 = "Vipers"; - } - if (ran2 == 90) { - phrase2 = "Vultures"; - col_second = "Black"; - } - if (ran2 == 91) { - phrase2 = "Warriors"; - } - if (ran2 == 92) { - phrase2 = "Wasps"; - col_second = "Yellow"; - } - if (ran2 == 93) { - phrase2 = "Wizards"; - col_second = "Purple"; - name[100][eROLE.Librarian] = "Wizard"; - chapter_master_specialty = 3; - } - if (ran2 == 94) { - phrase2 = "Wolves"; - col_second = "White"; - } - if (ran2 == 95) { - phrase2 = "Wyerns"; - } + col_second = ""; + col_lens = "Red"; + col_trim = col_main; + col_weapon = "Black"; + if (ran2 == 1) { + phrase2 = "Acolytes"; + col_second = "Red"; + } + if (ran2 == 2) { + phrase2 = "Adders"; + col_second = "Black"; + } + if (ran2 == 3) { + phrase2 = "Amazons"; + col_second = "Orange"; + } + if (ran2 == 4) { + phrase2 = "Angels"; + col_second = "Silver"; + } + if (ran2 == 5) { + phrase2 = "Archangels"; + col_second = "Silver"; + } + if (ran2 == 6) { + phrase2 = "Avengers"; + col_second = "Black"; + } + if (ran2 == 7) { + phrase2 = "Barracudas"; + } + if (ran2 == 8) { + phrase2 = "Bees"; + col_second = "Black"; + } + if (ran2 == 9) { + phrase2 = "Bringers"; + } + if (ran2 == 10) { + phrase2 = "Brothers"; + } + if (ran2 == 11) { + phrase2 = "Cats"; + } + if (ran2 == 12) { + phrase2 = "Champions"; + } + if (ran2 == 13) { + phrase2 = "Chameleons"; + } + if (ran2 == 14) { + phrase2 = "Claws"; + col_second = "White"; + } + if (ran2 == 15) { + phrase2 = "Cobras"; + } + if (ran2 == 16) { + phrase2 = "Company"; + } + if (ran2 == 17) { + phrase2 = "Consuls"; + } + if (ran2 == 18) { + phrase2 = "Corsairs"; + col_second = "Dark Red"; + } + if (ran2 == 19) { + phrase2 = "Crusaders"; + } + if (ran2 == 20) { + phrase2 = "Destroyers"; + } + if (ran2 == 21) { + phrase2 = "Devils"; + col_second = "Red"; + } + if (ran2 == 22) { + phrase2 = "Dogs"; + } + if (ran2 == 23) { + phrase2 = "Dragons"; + col_second = "Red"; + } + if (ran2 == 24) { + phrase2 = "Eagles"; + col_second = "White"; + } + if (ran2 == 25) { + phrase2 = "Eaters"; + col_second = "Red"; + } + if (ran2 == 26) { + phrase2 = "Enforcers"; + } + if (ran2 == 27) { + phrase2 = "Falcons"; + } + if (ran2 == 28) { + phrase2 = "Fists"; + } + if (ran2 == 29) { + phrase2 = "Foxes"; + } + if (ran2 == 30) { + phrase2 = "Gators"; + col_second = "Green"; + } + if (ran2 == 31) { + phrase2 = "Giants"; + } + if (ran2 == 32) { + phrase2 = "Golems"; + col_second = "Silver"; + } + if (ran2 == 33) { + phrase2 = "Gorillas"; + col_second = "Black"; + } + if (ran2 == 34) { + phrase2 = "Griffons"; + } + if (ran2 == 35) { + phrase2 = "Guard"; + } + if (ran2 == 36) { + phrase2 = "Guardians"; + } + if (ran2 == 37) { + phrase2 = "Hands"; + } + if (ran2 == 38) { + phrase2 = "Hawks"; + col_second = "Blue"; + } + if (ran2 == 39) { + phrase2 = "Hippos"; + } + if (ran2 == 40) { + phrase2 = "Hornets"; + col_second = "Yellow"; + } + if (ran2 == 41) { + phrase2 = "Hounds"; + } + if (ran2 == 42) { + phrase2 = "Hunters"; + } + if (ran2 == 43) { + phrase2 = "Inculpators"; + } + if (ran2 == 44) { + phrase2 = "Jaguars"; + col_second = "Dark Green"; + } + if (ran2 == 45) { + phrase2 = "Justiciars"; + col_second = "Black"; + } + if (ran2 == 46) { + phrase2 = "Knights"; + col_second = "Silver"; + } + if (ran2 == 47) { + phrase2 = "Krakens"; + col_second = "Green"; + fleet_type = 1; + } + if (ran2 == 48) { + phrase2 = "Lamenters"; + col_second = "Yellow"; + fleet_type = 3; + } + if (ran2 == 49) { + phrase2 = "Lions"; + col_second = "Orange"; + } + if (ran2 == 50) { + phrase2 = "Liberators"; + } + if (ran2 == 51) { + phrase2 = "Lords"; + } + if (ran2 == 52) { + phrase2 = "Marauders"; + col_second = "Black"; + } + if (ran2 == 53) { + phrase2 = "Marines"; + } + if (ran2 == 54) { + phrase2 = "Medusas"; + } + if (ran2 == 55) { + phrase2 = "Mentors"; + col_second = "Black"; + } + if (ran2 == 56) { + phrase2 = "Monitors"; + } + if (ran2 == 57) { + phrase2 = "Owls"; + } + if (ran2 == 58) { + phrase2 = "Paladins"; + col_second = "Silver"; + } + if (ran2 == 59) { + phrase2 = "Panthers"; + col_second = "Black"; + } + if (ran2 == 60) { + phrase2 = "Patriarchs"; + } + if (ran2 == 61) { + phrase2 = "Phantoms"; + col_second = "Black"; + } + if (ran2 == 62) { + phrase2 = "Purgators"; + } + if (ran2 == 63) { + phrase2 = "Raiders"; + } + if (ran2 == 64) { + phrase2 = "Rampagers"; + col_second = "Black"; + } + if (ran2 == 65) { + phrase2 = "Raptors"; + } + if (ran2 == 66) { + phrase2 = "Ravens"; + } + if (ran2 == 67) { + phrase2 = "Redeemers"; + } + if (ran2 == 68) { + phrase2 = "Revilers"; + } + if (ran2 == 69) { + phrase2 = "Saints"; + col_second = "White"; + } + if (ran2 == 70) { + phrase2 = "Salamanders"; + col_second = "Green"; + } + if (ran2 == 71) { + phrase2 = "Scars"; + col_second = "White"; + } + if (ran2 == 72) { + phrase2 = "Scions"; + col_second = "Purple"; + } + if (ran2 == 73) { + phrase2 = "Scorpians"; + col_second = "Orange"; + } + if (ran2 == 74) { + phrase2 = "Scythes"; + } + if (ran2 == 75) { + phrase2 = "Shades"; + } + if (ran2 == 76) { + phrase2 = "Sharks"; + col_second = "Light Blue"; + } + if (ran2 == 77) { + phrase2 = "Sisters"; + } + if (ran2 == 78) { + phrase2 = "Skulls"; + col_second = "White"; + } + if (ran2 == 79) { + phrase2 = "Sons"; + } + if (ran2 == 80) { + phrase2 = "Spectres"; + } + if (ran2 == 81) { + phrase2 = "Slayers"; + } + if (ran2 == 82) { + phrase2 = "Stalkers"; + } + if (ran2 == 83) { + phrase2 = "Swords"; + col_second = "Silver"; + } + if (ran2 == 84) { + phrase2 = "Talons"; + } + if (ran2 == 85) { + phrase2 = "Templars"; + col_second = "White"; + } + if (ran2 == 86) { + phrase2 = "Tigers"; + col_second = "Black"; + } + if (ran2 == 87) { + phrase2 = "Turtles"; + col_second = "Dark Green"; + } + if (ran2 == 88) { + phrase2 = "Vindicators"; + } + if (ran2 == 89) { + phrase2 = "Vipers"; + } + if (ran2 == 90) { + phrase2 = "Vultures"; + col_second = "Black"; + } + if (ran2 == 91) { + phrase2 = "Warriors"; + } + if (ran2 == 92) { + phrase2 = "Wasps"; + col_second = "Yellow"; + } + if (ran2 == 93) { + phrase2 = "Wizards"; + col_second = "Purple"; + name[100][eROLE.Librarian] = "Wizard"; + chapter_master_specialty = 3; + } + if (ran2 == 94) { + phrase2 = "Wolves"; + col_second = "White"; + } + if (ran2 == 95) { + phrase2 = "Wyerns"; + } - color_to_main = col_main; - color_to_secondary = col_second; - color_to_trim = col_trim; - color_to_pauldron = col_second; - color_to_pauldron2 = col_second; - color_to_lens = col_lens; - color_to_weapon = col_weapon; - trim = choose(0, 1); + color_to_main = col_main; + color_to_secondary = col_second; + color_to_trim = col_trim; + color_to_pauldron = col_second; + color_to_pauldron2 = col_second; + color_to_lens = col_lens; + color_to_weapon = col_weapon; + trim = choose(0, 1); - if (color_to_main != "") { - main_color = max(array_find_value(col, color_to_main), 0); - color_to_main = ""; - } - if (color_to_secondary != "") { - secondary_color = max(array_find_value(col, color_to_secondary), 0); - color_to_secondary = ""; - } - if (color_to_trim != "") { - main_trim = max(array_find_value(col, color_to_trim), 0); - color_to_trim = ""; - } - if (color_to_pauldron != "") { - right_pauldron = max(array_find_value(col, color_to_pauldron), 0); - color_to_pauldron = ""; - } - if (color_to_pauldron2 != "") { - left_pauldron = max(array_find_value(col, color_to_pauldron2), 0); - color_to_pauldron2 = ""; - } - if (color_to_lens != "") { - lens_color = max(array_find_value(col, color_to_lens), 0); - color_to_lens = ""; - } - if (color_to_weapon != "") { - weapon_color = max(array_find_value(col, color_to_weapon), 0); - color_to_weapon = ""; - } + if (color_to_main != "") { + main_color = max(array_find_value(col, color_to_main), 0); + color_to_main = ""; + } + if (color_to_secondary != "") { + secondary_color = max(array_find_value(col, color_to_secondary), 0); + color_to_secondary = ""; + } + if (color_to_trim != "") { + main_trim = max(array_find_value(col, color_to_trim), 0); + color_to_trim = ""; + } + if (color_to_pauldron != "") { + right_pauldron = max(array_find_value(col, color_to_pauldron), 0); + color_to_pauldron = ""; + } + if (color_to_pauldron2 != "") { + left_pauldron = max(array_find_value(col, color_to_pauldron2), 0); + color_to_pauldron2 = ""; + } + if (color_to_lens != "") { + lens_color = max(array_find_value(col, color_to_lens), 0); + color_to_lens = ""; + } + if (color_to_weapon != "") { + weapon_color = max(array_find_value(col, color_to_weapon), 0); + color_to_weapon = ""; + } - //TODO add some funcky stuff for custom random complex livery - var struct_cols = { - main_color: main_color, - secondary_color: secondary_color, - main_trim: main_trim, - right_pauldron: right_pauldron, - left_pauldron: left_pauldron, - lens_color: lens_color, - weapon_color: weapon_color - }; - obj_creation.livery_picker = new ColourItem(100, 230); + //TODO add some funcky stuff for custom random complex livery + var struct_cols = { + main_color: main_color, + secondary_color: secondary_color, + main_trim: main_trim, + right_pauldron: right_pauldron, + left_pauldron: left_pauldron, + lens_color: lens_color, + weapon_color: weapon_color, + }; + obj_creation.livery_picker = new ColourItem(100, 230); - obj_creation.livery_picker.scr_unit_draw_data(-1); - obj_creation.company_liveries = array_create(11, variable_clone(obj_creation.livery_picker.map_colour)); + obj_creation.livery_picker.scr_unit_draw_data(-1); + obj_creation.company_liveries = array_create(11, variable_clone(obj_creation.livery_picker.map_colour)); - obj_creation.livery_picker.scr_unit_draw_data(); - obj_creation.livery_picker.set_default_armour(struct_cols, col_special); - obj_creation.full_liveries = array_create(21, variable_clone(obj_creation.livery_picker.map_colour)); - obj_creation.full_liveries[eROLE.Librarian] = obj_creation.livery_picker.set_default_librarian(struct_cols); + obj_creation.livery_picker.scr_unit_draw_data(); + obj_creation.livery_picker.set_default_armour(struct_cols, col_special); + obj_creation.full_liveries = array_create(21, variable_clone(obj_creation.livery_picker.map_colour)); + obj_creation.full_liveries[eROLE.Librarian] = obj_creation.livery_picker.set_default_librarian(struct_cols); - obj_creation.full_liveries[eROLE.Chaplain] = obj_creation.livery_picker.set_default_chaplain(struct_cols); + obj_creation.full_liveries[eROLE.Chaplain] = obj_creation.livery_picker.set_default_chaplain(struct_cols); - obj_creation.full_liveries[eROLE.Apothecary] = obj_creation.livery_picker.set_default_apothecary(struct_cols); + obj_creation.full_liveries[eROLE.Apothecary] = obj_creation.livery_picker.set_default_apothecary(struct_cols); - obj_creation.full_liveries[eROLE.Techmarine] = obj_creation.livery_picker.set_default_techmarines(struct_cols); - obj_creation.livery_picker.scr_unit_draw_data(); - obj_creation.livery_picker.set_default_armour(struct_cols, col_special); + obj_creation.full_liveries[eROLE.Techmarine] = obj_creation.livery_picker.set_default_techmarines(struct_cols); + obj_creation.livery_picker.scr_unit_draw_data(); + obj_creation.livery_picker.set_default_armour(struct_cols, col_special); - obj_creation.livery_picker.map_colour = obj_creation.full_liveries[0]; - obj_creation.livery_picker.role_set = 0; - chapter_name = string(phrase1) + " " + string(phrase2); - chapter_string = chapter_name; + obj_creation.livery_picker.map_colour = obj_creation.full_liveries[0]; + obj_creation.livery_picker.role_set = 0; + chapter_name = string(phrase1) + " " + string(phrase2); + chapter_string = chapter_name; - monastery_name = ""; - if (custom_or_random == 1) { - homeworld_rule = choose(1, 1, 1, 2, 2, 3, 3); - chapter_name = string(phrase1) + " " + string(phrase2); - chapter_string = chapter_name; - fleet_type = choose(1, 2, 3); + monastery_name = ""; + if (custom_or_random == 1) { + homeworld_rule = choose(1, 1, 1, 2, 2, 3, 3); + chapter_name = string(phrase1) + " " + string(phrase2); + chapter_string = chapter_name; + fleet_type = choose(1, 2, 3); - // if (fleet_type=2) then monastery_name=string(phrase1)+" Hold"; - if (fleet_type != 2) { - var rando; - rando = choose(1, 2, 3, 4, 5); - if (rando == 1) { - monastery_name = string(phrase2) + "' Ship"; - } - if (rando == 2) { - monastery_name = "Crown " + string_delete(phrase2, string_length(phrase2), 1); - } - if (rando == 3) { - monastery_name = "Head " + string_delete(phrase2, string_length(phrase2), 1); - } - if (rando == 4) { - monastery_name = string(phrase2) + "' Fist"; - } - if (rando == 5) { - monastery_name = string(phrase2) + "' Gaze"; - } - } - } + // if (fleet_type=2) then monastery_name=string(phrase1)+" Hold"; + if (fleet_type != 2) { + var rando; + rando = choose(1, 2, 3, 4, 5); + if (rando == 1) { + monastery_name = string(phrase2) + "' Ship"; + } + if (rando == 2) { + monastery_name = "Crown " + string_delete(phrase2, string_length(phrase2), 1); + } + if (rando == 3) { + monastery_name = "Head " + string_delete(phrase2, string_length(phrase2), 1); + } + if (rando == 4) { + monastery_name = string(phrase2) + "' Fist"; + } + if (rando == 5) { + monastery_name = string(phrase2) + "' Gaze"; + } + } + } - if (custom_or_random == 1) { - other1 = founding; - } - if (custom_or_random == 0) { - fleet_type = choose(1, 2); - } + if (custom_or_random == 1) { + other1 = founding; + } + if (custom_or_random == 0) { + fleet_type = choose(1, 2); + } } diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 4123189fc5..1a3e68e1b8 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -228,13 +228,7 @@ function scr_cheatcode(argument0) { event_fallen(); } else if (cheat_arguments[0] == "surfremove") { var _star_id = scr_random_find(0, true, "", ""); - add_event({ - duration: 2, - e_id: "governor_assassination", - variant: 2, - system: _star_id.name, - planet: irandom_range(1, _star_id.planets), - }); + add_event({duration: 2, e_id: "governor_assassination", variant: 2, system: _star_id.name, planet: irandom_range(1, _star_id.planets)}); } else if (cheat_arguments[0] == "strangebuild") { show_debug_message("strange build"); strange_build_event(); @@ -550,8 +544,8 @@ function draw_planet_debug_forces() { // Handle minus click if (point_and_click([147, _y, 167, _y + 20])) { target[$ key][current_planet] = clamp(target[$ key][current_planet] - 1, 0, 6); - } else // Handle plus click - if (point_and_click([177, _y, 197, _y + 20])) { + } else if (point_and_click([177, _y, 197, _y + 20])) { + // Handle plus click target[$ key][current_planet] = clamp(target[$ key][current_planet] + 1, 0, 6); } } @@ -566,26 +560,7 @@ function new_system_debug_popup() { pop.star = instance_nearest(mouse_x, mouse_y, obj_star); pop.text = $"What would you like to do at {pop.star.name}?"; - pop.add_option( - [ - { - str1: "Enemy invasion", - choice_func: system_debug_enemy_invasion, - }, - { - str1: "Spawn Fleet", - choice_func: system_debug_spawn_fleet, - }, - { - str1: "Delete Fleet", - choice_func: system_debug_remove_fleet, - }, - { - str1: "Cancel", - choice_func: popup_default_close, - } - ] - ); + pop.add_option([{str1: "Enemy invasion", choice_func: system_debug_enemy_invasion}, {str1: "Spawn Fleet", choice_func: system_debug_spawn_fleet}, {str1: "Delete Fleet", choice_func: system_debug_remove_fleet}, {str1: "Cancel", choice_func: popup_default_close}]); } function system_debug_enemy_invasion() { @@ -672,22 +647,7 @@ function system_debug_enemy_invasion_spawn() { function system_debug_spawn_fleet() { text = "Imperium, Heretic, or Xeno?"; - replace_options( - [ - { - str1: "Imperium", - choice_func: debug_spawn_imperium_fleet, - }, - { - str1: "Heretic", - choice_func: debug_spawn_heretic_fleet, - }, - { - str1: "Xeno", - choice_func: debug_add_xenos_fleet_options, - } - ] - ); + replace_options([{str1: "Imperium", choice_func: debug_spawn_imperium_fleet}, {str1: "Heretic", choice_func: debug_spawn_heretic_fleet}, {str1: "Xeno", choice_func: debug_add_xenos_fleet_options}]); } function debug_spawn_imperium_fleet() { @@ -716,22 +676,7 @@ function debug_spawn_heretic_fleet() { function debug_add_xenos_fleet_options() { text = "Select Xeno faction to spawn:"; - replace_options( - [ - { - str1: "Ork", - choice_func: debug_spawn_ork_fleet, - }, - { - str1: "Tau", - choice_func: debug_spawn_tau_fleet, - }, - { - str1: "Cancel", - choice_func: popup_default_close, - } - ] - ); + replace_options([{str1: "Ork", choice_func: debug_spawn_ork_fleet}, {str1: "Tau", choice_func: debug_spawn_tau_fleet}, {str1: "Cancel", choice_func: popup_default_close}]); } function debug_spawn_ork_fleet() { @@ -790,10 +735,7 @@ function system_debug_remove_fleet() { var _opt = new DeleteFleetOption(_fleet); array_push(_opts, _opt); } - array_push(_opts, { - "str1": "exit", - choice_func: popup_default_close, - }); + array_push(_opts, {"str1": "exit", choice_func: popup_default_close}); replace_options(_opts, false, false); diff --git a/scripts/scr_demand/scr_demand.gml b/scripts/scr_demand/scr_demand.gml index 420ad616a2..790feae399 100644 --- a/scripts/scr_demand/scr_demand.gml +++ b/scripts/scr_demand/scr_demand.gml @@ -1,356 +1,474 @@ -function threat_plausibility(){ +function threat_plausibility() { var _threat = 20; var _good_imperium_position = disposition[eFACTION.Imperium] > 50 ? 1 : -1; - var _relative_strength = floor(obj_controller/20); + var _relative_strength = floor(obj_controller / 20); var _nature = ""; } -function clear_inspections(){ - with(obj_en_fleet){ - if (owner = eFACTION.Inquisition) and (string_count("Inqis",trade_goods)>0){ - trade_goods="cancel_inspection"; - target=0; - } - } +function clear_inspections() { + with (obj_en_fleet) { + if ((owner == eFACTION.Inquisition) && (string_count("Inqis", trade_goods) > 0)) { + trade_goods = "cancel_inspection"; + target = 0; + } + } } -function inquis_use_inspection_pass(){ - if (inspection_passes>0){ - inspection_passes-=1; - last_world_inspection=turn+25; - last_fleet_inspection=turn+25; +function inquis_use_inspection_pass() { + if (inspection_passes > 0) { + inspection_passes -= 1; + last_world_inspection = turn + 25; + last_fleet_inspection = turn + 25; //obj_controller.liscensing=5; clear_inspections(); diplo_text = "Very well i shall honour our previous agreements. (24 months leave of inspections)"; } } -function inquis_demand_inspection_pass(){ - var resistance=10; +function inquis_demand_inspection_pass() { + var resistance = 10; var _worked = false; clear_diplo_choices(); - if (inspection_passes==0){ - rull=floor(random(10))+1; - if (rull>resistance){ - _worked=true; - last_world_inspection=turn+24; - last_fleet_inspection=turn+24; + if (inspection_passes == 0) { + rull = floor(random(10)) + 1; + if (rull > resistance) { + _worked = true; + last_world_inspection = turn + 24; + last_fleet_inspection = turn + 24; //obj_controller.liscensing=5; clear_inspections(); diplo_text = "Very well Chapter Master I Your service to the imperium is well known i have no doubt that you would not ask such of me without good reasoon. I shall forgoe my normal duties just this onece. \n do not becomne complacent Chapter Master i may not always be so generous"; } else { - var _diff = resistance - rull; - alter_disposition(eFACTION.Inquisition, -1); - diplo_text = "Consider your request denied. If there is heresy or any wrong doing i shal see that is rooted out and made plain for all to see";; - + var _diff = resistance - rull; + alter_disposition(eFACTION.Inquisition, -1); + diplo_text = "Consider your request denied. If there is heresy or any wrong doing i shal see that is rooted out and made plain for all to see"; } } - } function scr_demand(demand_type) { + // demand_type: button + + var resistance, rull, worked, rela, no_penalty; + resistance = 0; + rull = 0; + worked = false; + rela = "neutral"; + no_penalty = false; + + if (disposition[trading_demand] >= 60) { + rela = "friendly"; + } + if ((disposition[trading_demand] < 60) && (disposition[trading_demand] >= 20)) { + rela = "neutral"; + } + if (disposition[trading_demand] < 20) { + rela = "hostile"; + } + + annoyed[trading_demand] += 2; + + if (trading_demand == 2) { + // Imperium + with (obj_star) { + if (owner == eFACTION.Imperium) { + instance_create(x, y, obj_temp2); + } + } + resistance = min(instance_number(obj_temp2), 8); + with (obj_temp2) { + instance_destroy(); + } + if (obj_controller.disposition[eFACTION.Imperium] < 30) { + resistance += 1; + } + if (obj_controller.disposition[eFACTION.Imperium] < 10) { + resistance += 2; + } + if (obj_controller.disposition[eFACTION.Imperium] <= -60) { + resistance += 100; + } + if ((rela == "hostile") || (faction_status[eFACTION.Imperium] == "Antagonism")) { + resistance += 2; + } + if (faction_status[eFACTION.Imperium] == "War") { + resistance += 3; + } + + if (demand_type == 1) { + // Requisition + rull = floor(random(10)) + 1; + if (rull > resistance) { + requisition += 300; + worked = true; + } else if (rull <= resistance) { + worked = false; + } + } + if (demand_type == 2) { + // Crusade + rull = floor(random(10)) + 1; + if (rull > resistance) { + obj_controller.liscensing = 2; + worked = true; + } + if (rull <= resistance) { + worked = false; + } + } + } + + if ((trading_demand == 3) || (trading_demand == 5)) { + // Mechanicus/Ecclesiarchy + resistance = 8; + + if (obj_controller.disposition[diplomacy] < 30) { + resistance += 1; + } + if (obj_controller.disposition[diplomacy] < 10) { + resistance += 2; + } + if (obj_controller.disposition[diplomacy] <= -60) { + resistance += 100; + } + if (faction_status[diplomacy] == "War") { + resistance += 3; + } + if (rela == "friendly") { + resistance -= 2; + } + + if (demand_type == 1) { + // Requisition + rull = floor(random(10)) + 1; + if (rull > resistance) { + requisition += 300; + worked = true; + } + if (rull <= resistance) { + worked = false; + } + } + } + + if (trading_demand == 4) { + resistance = 10; + + if (demand_type == 1) { + // Requisition + rull = floor(random(10)) + 1; + if (rull > resistance) { + requisition += 300; + worked = true; + } + if (rull <= resistance) { + worked = false; + } + } + } + + if (trading_demand == 6) { + // Elfdar + // 135 ; testing resistance=10; + + resistance = 2; + + if (rela == "neutral") { + resistance -= 1; + } + if (rela == "friendly") { + resistance -= 3; + } + if (demand_type == 2) { + resistance -= 2; + } - // demand_type: button - - - - var resistance, rull, worked, rela,no_penalty; - resistance=0;rull=0;worked=false;rela="neutral";no_penalty=false; - - if (disposition[trading_demand]>=60) then rela="friendly"; - if (disposition[trading_demand]<60) and (disposition[trading_demand]>=20) then rela="neutral"; - if (disposition[trading_demand]<20) then rela="hostile"; - - annoyed[trading_demand]+=2; - - if (trading_demand=2){// Imperium - with(obj_star){ - if (owner = eFACTION.Imperium){ - instance_create(x,y,obj_temp2); - } - } - resistance=min(instance_number(obj_temp2),8); - with(obj_temp2){instance_destroy();} - if (obj_controller.disposition[eFACTION.Imperium]<30) then resistance+=1; - if (obj_controller.disposition[eFACTION.Imperium]<10) then resistance+=2; - if (obj_controller.disposition[eFACTION.Imperium]<=-60) then resistance+=100; - if (rela="hostile") or (faction_status[eFACTION.Imperium]="Antagonism") then resistance+=2; - if (faction_status[eFACTION.Imperium]="War") then resistance+=3; - - if (demand_type=1){// Requisition - rull=floor(random(10))+1; - if (rull>resistance){ - requisition+=300; - worked=true; - } - else if (rull<=resistance){ - worked=false; - } - } - if (demand_type=2){// Crusade - rull=floor(random(10))+1; - if (rull>resistance){ - obj_controller.liscensing=2; - worked=true; - } - if (rull<=resistance){ - worked=false; - } - } - - } - - - if (trading_demand=3) or (trading_demand=5){// Mechanicus/Ecclesiarchy - resistance=8; - - if (obj_controller.disposition[diplomacy]<30) then resistance+=1; - if (obj_controller.disposition[diplomacy]<10) then resistance+=2; - if (obj_controller.disposition[diplomacy]<=-60) then resistance+=100; - if (faction_status[diplomacy]="War") then resistance+=3; - if (rela="friendly") then resistance-=2; - - if (demand_type=1){// Requisition - rull=floor(random(10))+1; - if (rull>resistance){requisition+=300;worked=true;} - if (rull<=resistance){worked=false;} - } - - } - - - if (trading_demand=4){ - resistance=10; - - if (demand_type=1){// Requisition - rull=floor(random(10))+1; - if (rull>resistance){ - requisition+=300; - worked=true; - } - if (rull<=resistance){ - worked=false; - } - } - } - - - - - - - - if (trading_demand=6){// Elfdar - // 135 ; testing resistance=10; - - resistance=2; - - if (rela="neutral") then resistance-=1; - if (rela="friendly") then resistance-=3; - if (demand_type=2) then resistance-=2; - - if (obj_controller.faction_status[eFACTION.Eldar]="War") or (obj_controller.faction_status[eFACTION.Eldar]="Antagonism"){ - with(obj_star){if (owner = eFACTION.Eldar) and (craftworld=1) then instance_create(x,y,obj_temp5);} - with(obj_p_fleet){if (point_distance(x,y,obj_temp5.x,obj_temp5.y)<37) and (action="") then instance_create(x,y,obj_ground_mission);} - with(obj_en_fleet){if (point_distance(x,y,obj_temp5.x,obj_temp5.y)<37) and (action="") and (owner = eFACTION.Eldar) then instance_create(x,y,obj_temp3);} - - with(obj_temp5){instance_destroy();} - if (instance_number(obj_ground_mission)>1) and (instance_number(obj_temp3)=0) then resistance-=5; - with(obj_ground_mission){instance_destroy();} - with(obj_temp3){instance_destroy();} - } - - if (demand_type=1){// Requisition - rull=floor(random(10))+1; - if (rull>resistance){ - requisition+=150; - worked=true; - } - if (rull<=resistance){worked=false;} - } - if (demand_type=2){// useful info - rull=floor(random(10))+1; - if (rull>resistance){worked=true;} - if (rull<=resistance){worked=false;} - } - } - - - - - - - - - - - if (trading_demand=7){// Orks orks orks orks - resistance=10; - - if (rela="neutral") then resistance-=2; - if (rela="friendly") then resistance-=2; - if (demand_type=2) then resistance-=2; - - if (demand_type=1){// Requisition - rull=floor(random(10))+1; - if (rull>resistance){requisition+=200;worked=true;} - if (rull<=resistance){worked=false;} - } - if (demand_type=2){// Crusade - rull=floor(random(10))+1; - if (rull>resistance){ - obj_controller.liscensing=2;worked=true; - if (disposition[7]>=40){ - no_penalty=true; - } - } - if (rull<=resistance){ - worked=false; - } - } - } - - - - - if (trading_demand=8){ - with(obj_star){if (owner = eFACTION.Tau) then instance_create(x,y,obj_temp2);} - resistance=min(instance_number(obj_temp2)*2,8)+4; - with(obj_temp2){instance_destroy();} - if (rela="friendly") then resistance-=3; - if (rela="neutral") then resistance-=1; - if (faction_status[eFACTION.Tau]="War") then resistance+=3; - - // If only one planet, and player is at it, should probably get a bonus - - if (demand_type=1){// Requisition - rull=floor(random(10))+1; - if (rull>resistance){requisition+=300;worked=true;} - if (rull<=resistance){worked=false;} - } - if (demand_type=2){ - rull=floor(random(10))+1; - - - with(obj_en_fleet){if (owner != eFACTION.Tau) then instance_deactivate_object(id);} - if (instance_exists(obj_p_fleet)) then with (obj_p_fleet){ - var ns;ns=instance_nearest(x,y,obj_en_fleet); - if (point_distance(x,y,ns.x,ns.y)<=50) and (action="") and (image_index>3) then instance_create(x,y,obj_temp1); - instance_deactivate_object(id); - } - - with(obj_star){ - if (owner = eFACTION.Tau) and (instance_exists(obj_p_fleet)){ - var mahr;mahr=instance_nearest(x,y,obj_p_fleet); - if (point_distance(x,y,mahr.x,mahr.y)<50) and (mahr.action="") then instance_create(x,y,obj_temp1); - } - } - // show_message("Roll+"+string(instance_number(obj_temp1)*2)+" from player fleet shenanigans"); - rull+=instance_number(obj_temp1)*2; - with(obj_temp1){instance_destroy();} - instance_activate_object(obj_en_fleet); - instance_activate_object(obj_p_fleet); - instance_activate_object(obj_star); - - - if (rull>resistance){ - worked=true; - with(obj_en_fleet){if (owner = eFACTION.Tau) and (instance_nearest(x,y,obj_star).owner = eFACTION.Tau) and (action="") then instance_deactivate_object(id);} - with(obj_star){if (owner != eFACTION.Tau) then instance_deactivate_object(id);} - with(obj_en_fleet){ - if (owner = eFACTION.Tau){ - action_x=instance_nearest(x,y,obj_star).x; - action_y=instance_nearest(x,y,obj_star).y; - alarm[4]=1; - } - } - instance_activate_object(obj_star); - instance_activate_object(obj_en_fleet); - } - if (rull<=resistance){worked=false;} - } - } - - - // show_message("Roll (Need greater): "+string(rull)+"Resistance: "+string(resistance)); - - - - - if (worked=true){ - clear_diplo_choices(); - if (!no_penalty){ - if (rela="friendly") { - disposition[trading_demand]-=8; - turns_ignored[trading_demand]+=3; - if (trading_demand=8){ - disposition[trading_demand]+=6; - } - } - if (rela="neutral") { - disposition[trading_demand]-=10; - turns_ignored[trading_demand]+=6; - if (trading_demand=8){ - disposition[trading_demand]+=6; - } - } - if (rela="hostile") { - disposition[trading_demand]-=15; - turns_ignored[trading_demand]+=9; - if (trading_demand=8){ - disposition[trading_demand]+=9; - } - } - if (disposition[trading_demand]<-100){ - disposition[trading_demand]=-100; - } - } - - - - if (trading_demand=6) and (demand_type=2){ - if (no_penalty=false) then disposition[trading_demand]+=7; - force_goodbye=1;trading_demand=0;scr_dialogue("useful_information"); - exit; - } - - trading_demand=0; - if (liscensing=0) then scr_dialogue("agree"); - if (liscensing>0) then scr_dialogue("agree_lisc"); - force_goodbye=1; - } - if (worked=false){ - var h=0; - clear_diplo_choices(); - if (rela="friendly") and (no_penalty=false){ - disposition[trading_demand]-=2; - turns_ignored[trading_demand]+=1; - } - if (rela="neutral") and (no_penalty=false){ - disposition[trading_demand]-=4; - turns_ignored[trading_demand]+=3; - } - if (rela="hostile") and (no_penalty=false){ - disposition[trading_demand]-=8;turns_ignored[trading_demand]+=6;} - if (disposition[trading_demand]<-100) then disposition[trading_demand]=-100; - trading_demand=0;force_goodbye=1; - - - var war,woo;war=false;woo=floor(random(100))+1; - if (no_penalty=false){ - if (disposition[diplomacy]<=10) and (faction_status[diplomacy]="Antagonism") and (woo<=35) then war=true; - if (diplomacy=8) and (demand_type=2) and (war=true) then war=false; - } - - if (war=false) then scr_dialogue("demand_refused"); - if (war=true){faction_status[diplomacy]="War";scr_dialogue("declare_war");} - } - - - - cooldown=10; - - // show_message(resistance); + if ((obj_controller.faction_status[eFACTION.Eldar] == "War") || (obj_controller.faction_status[eFACTION.Eldar] == "Antagonism")) { + with (obj_star) { + if ((owner == eFACTION.Eldar) && (craftworld == 1)) { + instance_create(x, y, obj_temp5); + } + } + with (obj_p_fleet) { + if ((point_distance(x, y, obj_temp5.x, obj_temp5.y) < 37) && (action == "")) { + instance_create(x, y, obj_ground_mission); + } + } + with (obj_en_fleet) { + if ((point_distance(x, y, obj_temp5.x, obj_temp5.y) < 37) && (action == "") && (owner == eFACTION.Eldar)) { + instance_create(x, y, obj_temp3); + } + } + + with (obj_temp5) { + instance_destroy(); + } + if ((instance_number(obj_ground_mission) > 1) && (instance_number(obj_temp3) == 0)) { + resistance -= 5; + } + with (obj_ground_mission) { + instance_destroy(); + } + with (obj_temp3) { + instance_destroy(); + } + } + + if (demand_type == 1) { + // Requisition + rull = floor(random(10)) + 1; + if (rull > resistance) { + requisition += 150; + worked = true; + } + if (rull <= resistance) { + worked = false; + } + } + if (demand_type == 2) { + // useful info + rull = floor(random(10)) + 1; + if (rull > resistance) { + worked = true; + } + if (rull <= resistance) { + worked = false; + } + } + } + + if (trading_demand == 7) { + // Orks orks orks orks + resistance = 10; + + if (rela == "neutral") { + resistance -= 2; + } + if (rela == "friendly") { + resistance -= 2; + } + if (demand_type == 2) { + resistance -= 2; + } + + if (demand_type == 1) { + // Requisition + rull = floor(random(10)) + 1; + if (rull > resistance) { + requisition += 200; + worked = true; + } + if (rull <= resistance) { + worked = false; + } + } + if (demand_type == 2) { + // Crusade + rull = floor(random(10)) + 1; + if (rull > resistance) { + obj_controller.liscensing = 2; + worked = true; + if (disposition[7] >= 40) { + no_penalty = true; + } + } + if (rull <= resistance) { + worked = false; + } + } + } + + if (trading_demand == 8) { + with (obj_star) { + if (owner == eFACTION.Tau) { + instance_create(x, y, obj_temp2); + } + } + resistance = min(instance_number(obj_temp2) * 2, 8) + 4; + with (obj_temp2) { + instance_destroy(); + } + if (rela == "friendly") { + resistance -= 3; + } + if (rela == "neutral") { + resistance -= 1; + } + if (faction_status[eFACTION.Tau] == "War") { + resistance += 3; + } + + // If only one planet, and player is at it, should probably get a bonus + + if (demand_type == 1) { + // Requisition + rull = floor(random(10)) + 1; + if (rull > resistance) { + requisition += 300; + worked = true; + } + if (rull <= resistance) { + worked = false; + } + } + if (demand_type == 2) { + rull = floor(random(10)) + 1; + + with (obj_en_fleet) { + if (owner != eFACTION.Tau) { + instance_deactivate_object(id); + } + } + if (instance_exists(obj_p_fleet)) { + with (obj_p_fleet) { + var ns; + ns = instance_nearest(x, y, obj_en_fleet); + if ((point_distance(x, y, ns.x, ns.y) <= 50) && (action == "") && (image_index > 3)) { + instance_create(x, y, obj_temp1); + } + instance_deactivate_object(id); + } + } + + with (obj_star) { + if ((owner == eFACTION.Tau) && instance_exists(obj_p_fleet)) { + var mahr; + mahr = instance_nearest(x, y, obj_p_fleet); + if ((point_distance(x, y, mahr.x, mahr.y) < 50) && (mahr.action == "")) { + instance_create(x, y, obj_temp1); + } + } + } + // show_message("Roll+"+string(instance_number(obj_temp1)*2)+" from player fleet shenanigans"); + rull += instance_number(obj_temp1) * 2; + with (obj_temp1) { + instance_destroy(); + } + instance_activate_object(obj_en_fleet); + instance_activate_object(obj_p_fleet); + instance_activate_object(obj_star); + + if (rull > resistance) { + worked = true; + with (obj_en_fleet) { + if ((owner == eFACTION.Tau) && (instance_nearest(x, y, obj_star).owner == eFACTION.Tau) && (action == "")) { + instance_deactivate_object(id); + } + } + with (obj_star) { + if (owner != eFACTION.Tau) { + instance_deactivate_object(id); + } + } + with (obj_en_fleet) { + if (owner == eFACTION.Tau) { + action_x = instance_nearest(x, y, obj_star).x; + action_y = instance_nearest(x, y, obj_star).y; + alarm[4] = 1; + } + } + instance_activate_object(obj_star); + instance_activate_object(obj_en_fleet); + } + if (rull <= resistance) { + worked = false; + } + } + } + + // show_message("Roll (Need greater): "+string(rull)+"Resistance: "+string(resistance)); + + if (worked == true) { + clear_diplo_choices(); + if (!no_penalty) { + if (rela == "friendly") { + disposition[trading_demand] -= 8; + turns_ignored[trading_demand] += 3; + if (trading_demand == 8) { + disposition[trading_demand] += 6; + } + } + if (rela == "neutral") { + disposition[trading_demand] -= 10; + turns_ignored[trading_demand] += 6; + if (trading_demand == 8) { + disposition[trading_demand] += 6; + } + } + if (rela == "hostile") { + disposition[trading_demand] -= 15; + turns_ignored[trading_demand] += 9; + if (trading_demand == 8) { + disposition[trading_demand] += 9; + } + } + if (disposition[trading_demand] < -100) { + disposition[trading_demand] = -100; + } + } + + if ((trading_demand == 6) && (demand_type == 2)) { + if (no_penalty == false) { + disposition[trading_demand] += 7; + } + force_goodbye = 1; + trading_demand = 0; + scr_dialogue("useful_information"); + exit; + } + + trading_demand = 0; + if (liscensing == 0) { + scr_dialogue("agree"); + } + if (liscensing > 0) { + scr_dialogue("agree_lisc"); + } + force_goodbye = 1; + } + if (worked == false) { + var h = 0; + clear_diplo_choices(); + if ((rela == "friendly") && (no_penalty == false)) { + disposition[trading_demand] -= 2; + turns_ignored[trading_demand] += 1; + } + if ((rela == "neutral") && (no_penalty == false)) { + disposition[trading_demand] -= 4; + turns_ignored[trading_demand] += 3; + } + if ((rela == "hostile") && (no_penalty == false)) { + disposition[trading_demand] -= 8; + turns_ignored[trading_demand] += 6; + } + if (disposition[trading_demand] < -100) { + disposition[trading_demand] = -100; + } + trading_demand = 0; + force_goodbye = 1; + + var war, woo; + war = false; + woo = floor(random(100)) + 1; + if (no_penalty == false) { + if ((disposition[diplomacy] <= 10) && (faction_status[diplomacy] == "Antagonism") && (woo <= 35)) { + war = true; + } + if ((diplomacy == 8) && (demand_type == 2) && (war == true)) { + war = false; + } + } + + if (war == false) { + scr_dialogue("demand_refused"); + } + if (war == true) { + faction_status[diplomacy] = "War"; + scr_dialogue("declare_war"); + } + } + cooldown = 10; + // show_message(resistance); } diff --git a/scripts/scr_dialogue/scr_dialogue.gml b/scripts/scr_dialogue/scr_dialogue.gml index 4b54e987fd..de75a7f691 100644 --- a/scripts/scr_dialogue/scr_dialogue.gml +++ b/scripts/scr_dialogue/scr_dialogue.gml @@ -69,10 +69,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { if (_unit.role == "Forge Master") { if (diplo_keyphrase == "intro") { diplo_text = "Chapter Master. What may "; - iplomacy_option({ - option_text: "The Imperium and Inquisition's ignorance and hypocrisy will be the death of my Chapter.", - goto: _goto, - }); + iplomacy_option({option_text: "The Imperium and Inquisition's ignorance and hypocrisy will be the death of my Chapter.", goto: _goto}); } } } @@ -122,10 +119,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { if (diplo_keyphrase == "cs_meeting1") { diplomacy = 10; diplo_text = $"So you have brought yourself before me {obj_ini.master_name}. This pleases me. You are not the first among the Astartes to come to me. Do not look so shocked. Many have gazed upon the decay and decrepitude of the Imperium with open eyes, and heard the empty slogans of the Corpse Emperor with fresh ears and come to the realization I had so many long millennia ago. There is only one truth in the universe, one path worthy of an Astartes to walk. The path of true power. The path of true insight into the nature of reality and what lies beyond. The path of Chaos. Only when free of the pointless bondage of the Imperium can we ascend to our rightful place in the universe."; - add_diplomacy_option({ - option_text: "[Continue]", - goto: "cs_meeting2", - }); + add_diplomacy_option({option_text: "[Continue]", goto: "cs_meeting2"}); disposition[10] += 10; } // First branch of choices @@ -155,24 +149,15 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if ((mos == true) && (diplo_keyphrase != "cs_meeting20")) { - add_diplomacy_option({ - option_text: "[Continue]", - goto: "cs_meeting_m1", - }); + add_diplomacy_option({option_text: "[Continue]", goto: "cs_meeting_m1"}); } if ((mos == false) || (diplo_keyphrase == "cs_meeting20")) { - add_diplomacy_option({ - option_text: "The Imperium has bound us and kept us from our true potential. We seek strength.", - goto: "cs_meeting30", - }); + add_diplomacy_option({option_text: "The Imperium has bound us and kept us from our true potential. We seek strength.", goto: "cs_meeting30"}); // if over 30 Not convinced due to high inquisition dispositioin var _goto = obj_controller.disposition[4] > 30 ? "cs_meeting45" : "cs_meeting40"; - add_diplomacy_option({ - option_text: "The Imperium and Inquisition's ignorance and hypocrisy will be the death of my Chapter.", - goto: _goto, - }); + add_diplomacy_option({option_text: "The Imperium and Inquisition's ignorance and hypocrisy will be the death of my Chapter.", goto: _goto}); var testy = true; if (obj_controller.faction_status[eFACTION.Imperium] == "War" || obj_controller.marines <= 600) { @@ -185,15 +170,9 @@ function scr_dialogue(diplo_keyphrase, data = {}) { _goto = "cs_meeting55"; } // Not convinced - add_diplomacy_option({ - option_text: "Our enemies are many and our strength is diminished. We need allies to join with us while we rebuild our forces.", - goto: _goto, - }); + add_diplomacy_option({option_text: "Our enemies are many and our strength is diminished. We need allies to join with us while we rebuild our forces.", goto: _goto}); - add_diplomacy_option({ - option_text: "I sought you out to slay you with my own hands.", - goto: "cs_meeting60", - }); + add_diplomacy_option({option_text: "I sought you out to slay you with my own hands.", goto: "cs_meeting60"}); } } if (diplo_keyphrase == "cs_meeting21") { @@ -202,10 +181,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { // scr_alert("purple","lol",string(tix),0,0); diplo_text = $"As the echoes fade, it becomes clear that the Master of Sanctity of {global.chapter_name} has fallen."; - add_diplomacy_option({ - option_text: "[Continue]", - goto: "cs_meeting135", - }); + add_diplomacy_option({option_text: "[Continue]", goto: "cs_meeting135"}); } // MoS cuts in if (diplo_keyphrase == "cs_meeting_m1") { @@ -214,18 +190,9 @@ function scr_dialogue(diplo_keyphrase, data = {}) { diplo_text += "My lord! What are we doing here, treating with this monster of the Traitor Legions? The very existence of the Archenemy is a threat to everything the Chapter stands for, and we endanger our immortal souls just being here. You know this! I demand to know your intentions! And I warn you, I will not hesitate to do what I must, for the good of the Chapter and the Imperium."; var _goto = "cs_meeting_m2"; - add_diplomacy_option({ - option_text: "Times change and the Chapter must change with them or be ground into the dust of history. (Chaos)", - goto: _goto, - }); - add_diplomacy_option({ - option_text: "We will not serve the Imperium’s crooked ends any longer. Our Chapter will control its own destiny. (Renegade)", - goto: _goto, - }); - add_diplomacy_option({ - option_text: "I haven’t turned traitor and my faith is strong. The Beast has foolishly opened its lair to us. Be ready for my signal.", - goto: _goto, - }); + add_diplomacy_option({option_text: "Times change and the Chapter must change with them or be ground into the dust of history. (Chaos)", goto: _goto}); + add_diplomacy_option({option_text: "We will not serve the Imperium’s crooked ends any longer. Our Chapter will control its own destiny. (Renegade)", goto: _goto}); + add_diplomacy_option({option_text: "I haven’t turned traitor and my faith is strong. The Beast has foolishly opened its lair to us. Be ready for my signal.", goto: _goto}); // Option4 here if all the right conditions are met var born = false; @@ -236,27 +203,18 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if ((obj_ini.TTRPG[0][3].corruption >= 50) && (born == true)) { - add_diplomacy_option({ - option_text: "Right now I need my Master of Sanctity at my side, trusting that his Chapter Master is doing what is best, what is necessary for the Chapter, during this dangerous moment. All will be made clear in time, I promise you brother. This is the right path.", - goto: "cs_meeting_m3", - }); + add_diplomacy_option({option_text: "Right now I need my Master of Sanctity at my side, trusting that his Chapter Master is doing what is best, what is necessary for the Chapter, during this dangerous moment. All will be made clear in time, I promise you brother. This is the right path.", goto: "cs_meeting_m3"}); } } if (diplo_keyphrase == "cs_meeting_m2") { event_log = $"The {global.chapter_name} Master of Sanctity takes a stand against you."; scr_event_log("purple", event_log); // scr_alert("purple","lol",string(tix),0,0); diplo_text = "You have besmirched the honor of our chapter this day, and I will not forget it /my lord Chapter Master/.\n[[" + string(obj_ini.name[0][3]) + " strides forward and his shout erupts from his external vox speakers with a boom that shatters the silence in the room.]]\nWe will not stand idly by and bandy words with heretic scum! To me my brothers! Slay these traitors in the name of our Emperor!"; - add_diplomacy_option({ - option_text: "[Continue]", - goto: "cs_meeting9", - }); + add_diplomacy_option({option_text: "[Continue]", goto: "cs_meeting9"}); } if (diplo_keyphrase == "cs_meeting_m3") { diplo_text = "[[" + string(obj_ini.name[0][3]) + " is silent for a moment, before giving you an imperceptible nod.]]\nI stand with you, Lord " + string(obj_ini.master_name) + ". Let us face this together."; - add_diplomacy_option({ - option_text: "[Continue]", - goto: "cs_meeting20", - }); + add_diplomacy_option({option_text: "[Continue]", goto: "cs_meeting20"}); obj_controller.useful_info += "CRMOS|"; } if (diplo_keyphrase == "cs_meeting_m5") { @@ -264,14 +222,8 @@ function scr_dialogue(diplo_keyphrase, data = {}) { instance_activate_all(); diplo_text = "By the sacred oath I have sworn, I bear witness to your darkest secrets. Know this: I am compelled to report your heresy to the Inquisition. Redemption or retribution, their verdict shall decide. May the Emperor's mercy guide your path."; - add_diplomacy_option({ - option_text: "Very well. I did what must be done for my brothers, and now accept the price. [Game Over]", - goto: "cs_meeting_m6", - }); - add_diplomacy_option({ - option_text: $"Never! [Battle Loyalist {global.chapter_name}]", - goto: "cs_meeting_battle7", - }); + add_diplomacy_option({option_text: "Very well. I did what must be done for my brothers, and now accept the price. [Game Over]", goto: "cs_meeting_m6"}); + add_diplomacy_option({option_text: $"Never! [Battle Loyalist {global.chapter_name}]", goto: "cs_meeting_battle7"}); } if (diplo_keyphrase == "cs_meeting_m6") { global.defeat = 3; @@ -285,104 +237,61 @@ function scr_dialogue(diplo_keyphrase, data = {}) { var _master_of_sanct = fetch_unit([0, 3]); var _string = $"Stand with me my brothers! Fight for the future of your Chapter, and slay {_master_of_sanct.name()}! [Battle loyalist {global.chapter_name}"; - add_diplomacy_option({ - option_text: _string, - goto: "cs_meeting_battle1", - goto: "cs_meeting_battle1", - }); + add_diplomacy_option({option_text: _string, goto: "cs_meeting_battle1", goto: "cs_meeting_battle1"}); var _string = $"{global.chapter_name}, I order you to hold your fire! {_master_of_sanct.name()}, if you doubt my leadership then let it be decided by single combat! [Duel your Master of Sanctity]"; - add_diplomacy_option({ - option_text: _string, - goto: "cs_meeting_battle2", - }); + add_diplomacy_option({option_text: _string, goto: "cs_meeting_battle2"}); var _string = $"I deny you {obj_controller.faction_leader[eFACTION.Chaos]}. And now I shall destroy you. For the Emperor! [Attack Chaos forces]"; - add_diplomacy_option({ - option_text: _string, - goto: "cs_meeting_battle5", - }); + add_diplomacy_option({option_text: _string, goto: "cs_meeting_battle5"}); } // First explanation for chaos if (diplo_keyphrase == "cs_meeting30") { diplo_text = "Then you have awakened to the truth the Imperium so hypocritically denies, that there is only one real power in the universe, and it goes to those with the will to seize it."; - add_diplomacy_option({ - option_text: "[Continue]", - goto: "cs_meeting135", - }); + add_diplomacy_option({option_text: "[Continue]", goto: "cs_meeting135"}); disposition[10] += 30; } // Fucking inquisition if (diplo_keyphrase == "cs_meeting40") { diplo_text = "Yes...you do not fit the precious mold the Codex Astartes carves out for you, do you? And the Imperium destroys that which it cannot understand."; - add_diplomacy_option({ - option_text: "[Continue]", - goto: "cs_meeting135", - }); + add_diplomacy_option({option_text: "[Continue]", goto: "cs_meeting135"}); disposition[10] += 30; } // Nah dawg if (diplo_keyphrase == "cs_meeting45") { diplo_text = $"Do you take me as a fool, {obj_ini.master_name}? Even in the Eye there are whispers of your running to and fro at the Inquisition’s beck and call, like a dog playing fetch. You’re a well-trained, and maybe even a clever, dog. I’ve killed so many clever dogs in my time. How do I know this isn’t just a hopelessly doomed plot to try and kill me, hatched by your Inquisition masters still holding your leash?"; - add_diplomacy_option({ - option_text: "There are advantages to staying on the Inquisition’s good side, and I’m not one to ignore an advantage.", - goto: choose("cs_meeting46", "cs_meeting47"), - }); - add_diplomacy_option({ - option_text: "Appeasing the Inquisition is no hard choice when your options are obey, or eventually be branded a heretic and be destroyed.", - goto: choose("cs_meeting46", "cs_meeting47"), - }); - add_diplomacy_option({ - option_text: "Given enough time, everyone becomes a heretic in the eyes of the Inquisition. I will not wait for them to make their move against us.", - goto: choose("cs_meeting46", "cs_meeting47"), - }); + add_diplomacy_option({option_text: "There are advantages to staying on the Inquisition’s good side, and I’m not one to ignore an advantage.", goto: choose("cs_meeting46", "cs_meeting47")}); + add_diplomacy_option({option_text: "Appeasing the Inquisition is no hard choice when your options are obey, or eventually be branded a heretic and be destroyed.", goto: choose("cs_meeting46", "cs_meeting47")}); + add_diplomacy_option({option_text: "Given enough time, everyone becomes a heretic in the eyes of the Inquisition. I will not wait for them to make their move against us.", goto: choose("cs_meeting46", "cs_meeting47")}); var _string = "You have one thing right, {obj_controller.faction_leader[eFACTION.Chaos]}. I am here to kill you. Open fire brothers, NOW! [Battle Chaos forces]"; - add_diplomacy_option({ - option_text: _string, - goto: "cs_meeting_battle5", - goto: "cs_meeting_battle5", - }); + add_diplomacy_option({option_text: _string, goto: "cs_meeting_battle5", goto: "cs_meeting_battle5"}); } // Sorry brah, you're not their homie if (diplo_keyphrase == "cs_meeting46") { diplo_text = "I am not convinced. A shame. I was hoping you might actually be of use- but now it is apparent that your use will only be as a bloody, broken offering to the Dark Gods."; - add_diplomacy_option({ - option_text: "[Battle Chaos AND any loyalist forces]", - }); - add_diplomacy_option({ - option_text: "cs_meeting_battle6", - }); + add_diplomacy_option({option_text: "[Battle Chaos AND any loyalist forces]"}); + add_diplomacy_option({option_text: "cs_meeting_battle6"}); } // you might be their homie, fine if (diplo_keyphrase == "cs_meeting47") { diplo_text = "You may yet be of use to me. Very well, we will assist you. It will be no trouble at all to exterminate you, should you displease me at a future time."; - add_diplomacy_option({ - option_text: "[Continue]", - goto: "cs_meeting135", - }); + add_diplomacy_option({option_text: "[Continue]", goto: "cs_meeting135"}); disposition[10] += 30; } // mah numbers if (diplo_keyphrase == "cs_meeting50") { diplo_text = "Yes we have seen you struggle alone, scurrying from shadow to shadow like a hunted rat. I won’t lie to you though, I’ve seen the potential in you and your….brothers. Alright, we will assist you. It will be no trouble at all to exterminate you, should you displease me."; - add_diplomacy_option({ - option_text: "[Continue]", - goto: "cs_meeting135", - }); + add_diplomacy_option({option_text: "[Continue]", goto: "cs_meeting135"}); disposition[10] += 30; } // such numbers, wow if (diplo_keyphrase == "cs_meeting55") { diplo_text = "I could overrun this sector with half the warriors you have now. Is your “Chapter” so pathetic you need to throw scores more men into the meatgrinder to succeed? You have not convinced me. I'd have enjoyed making use of your Chapter, but this was clearly not meant to be. Make your peace."; - add_diplomacy_option({ - option_text: "[Battle Chaos AND any loyalist forces]", - }); - add_diplomacy_option({ - option_text: "cs_meeting_battle6", - }); + add_diplomacy_option({option_text: "[Battle Chaos AND any loyalist forces]"}); + add_diplomacy_option({option_text: "cs_meeting_battle6"}); } // Actually here to kill you if (diplo_keyphrase == "cs_meeting60") { @@ -390,56 +299,32 @@ function scr_dialogue(diplo_keyphrase, data = {}) { disposition[10] += 10; diplo_text = $"[[{chaos_leader} is silent for a moment, then a slow chuckle rises from deep within his ancient power armour. The chuckle erupts into hideous laughter that chills your blood with its otherworldly tenor.]]\nI thank you, I have not truly laughed in three hundred years. I shall take your skull as a memento of this day and your fine jest. But before I do, indulge my curiosity. Let us say you did kill me, /then/ what would you do? Claim the price on my head? Go crawling back on your belly to your Imperial masters like a whipped cur, dragging your kill behind you? Become master of this sector yourself now that you’ve bested your greatest foe? Or perhaps you’d offer up my soul to the Dark Gods, ignorantly fumbling about in the darkness for their favor? Tell me."; - add_diplomacy_option({ - option_text: "The reward for one such as you will be great, and I /will/ claim it.", - goto: "cs_meeting61", - }); + add_diplomacy_option({option_text: "The reward for one such as you will be great, and I /will/ claim it.", goto: "cs_meeting61"}); - add_diplomacy_option({ - option_text: "The atrocities you’ve visited on this sector are reason enough.", - goto: "cs_meeting63", - }); - add_diplomacy_option({ - option_text: $"You think me ignorant of the ways of Chaos, {chaos_leader}, but I know one truth. There is power in blood. Your blood. My power. They will hear me.", - goto: "cs_meeting65", - }); - add_diplomacy_option({ - option_text: $"I’m just tired of listening to you talk, {chaos_leader}.", - goto: "cs_meeting67", - }); + add_diplomacy_option({option_text: "The atrocities you’ve visited on this sector are reason enough.", goto: "cs_meeting63"}); + add_diplomacy_option({option_text: $"You think me ignorant of the ways of Chaos, {chaos_leader}, but I know one truth. There is power in blood. Your blood. My power. They will hear me.", goto: "cs_meeting65"}); + add_diplomacy_option({option_text: $"I’m just tired of listening to you talk, {chaos_leader}.", goto: "cs_meeting67"}); } // Reward if (diplo_keyphrase == "cs_meeting61") { diplo_text = "It is this blind overconfidence that makes killing a Space Marine so satisfying."; - add_diplomacy_option({ - option_text: "[Battle Chaos forces]", - goto: "cs_meeting_battle5", - }); + add_diplomacy_option({option_text: "[Battle Chaos forces]", goto: "cs_meeting_battle5"}); } // Atrocities if (diplo_keyphrase == "cs_meeting63") { diplo_text = "Oh, but I have one more atrocity to commit you simply shouldn’t miss..."; - add_diplomacy_option({ - option_text: "[Battle Chaos forces]", - goto: "cs_meeting_battle5", - }); + add_diplomacy_option({option_text: "[Battle Chaos forces]", goto: "cs_meeting_battle5"}); } // BLOOD BLOOD BLOOD if (diplo_keyphrase == "cs_meeting65") { diplo_text = "You know, I think I would actually enjoy watching you attempt it. But I’ll spare you having your soul torn to shreds by daemons, and just give you an agonizing death instead."; - add_diplomacy_option({ - option_text: "[Battle Chaos AND any loyalist forces]", - goto: "cs_meeting_battle6", - }); + add_diplomacy_option({option_text: "[Battle Chaos AND any loyalist forces]", goto: "cs_meeting_battle6"}); } // stahp talking if (diplo_keyphrase == "cs_meeting67") { disposition[10] += 10; diplo_text = "And I thought we were becoming such fast friends, you and I. Very well, don’t bore me."; - add_diplomacy_option({ - option_text: "[Battle Chaos forces]", - goto: "cs_meeting_battle5", - }); + add_diplomacy_option({option_text: "[Battle Chaos forces]", goto: "cs_meeting_battle5"}); } // Finish the conversation @@ -451,20 +336,14 @@ function scr_dialogue(diplo_keyphrase, data = {}) { disposition[10] = max(disposition[10] + 10, 10); diplo_text = $"[[{obj_controller.faction_leader[eFACTION.Chaos]}’s power armour grinds as he leans forward, his posture predatory.]]\nThen we have an accord. We will assist you as you take your first steps on the path toward Chaos. And my payment for all this?\n[[He chuckles.]]\nEnlisting an entire chapter in the service of the Dark Gods is all the reward I require."; diplo_text += "\nBut you cannot simply paint the eight-pointed star on your wargear and begin slaughtering in the name of the Dark Gods. No, some within your chapter will resist the choice you’ve made, either out of loyalty to the Corpse Emperor or out of fear of Chaos. Just think, it will be like your own little heresy. The ''" + string(obj_ini.master_name) + " Heresy!''"; - add_diplomacy_option({ - option_text: "[Continue]", - goto: "cs_meeting136", - }); + add_diplomacy_option({option_text: "[Continue]", goto: "cs_meeting136"}); } if (diplo_keyphrase == "cs_meeting136") { event_log = string(obj_controller.faction_leader[eFACTION.Chaos]) + " gives you an Artifact, meant to help corrupt your marines to the path of Chaos."; scr_event_log("purple", event_log); // scr_alert("purple","lol",string(tix),0,0); diplo_text = "[The tones of his humorless laughter are filled with the bitterness of ancient, poisoned memories. He continues.]\nYou must emerge victorious from this... \\Civil War\\, and not decimate your ranks in the process, if you are to be of any use to the Gods or to me. "; diplo_text += $"And to that end, I give you this.\n[[{obj_controller.faction_leader[eFACTION.Chaos]} gestures to one of his Terminators, who presents you with an Artifact. In your mind, something sinister seems to cling to the lines of its form.]]\nThe more of your warriors that come to accept Chaos, the fewer holdouts there will be to overcome when the time comes. This object will speed their introduction to its ways. You must also encourage your warriors to...broaden their horizons wherever possible, so they come to their own understanding of the Primordial Truth. But you must tread carefully at the same time, lest you alert the Inquisition. They must not have even a hint of what’s taking place in your Chapter, or they will obliterate you."; - add_diplomacy_option({ - option_text: "[Continue]", - goto: "cs_meeting137", - }); + add_diplomacy_option({option_text: "[Continue]", goto: "cs_meeting137"}); } if (diplo_keyphrase == "cs_meeting137") { @@ -598,75 +477,41 @@ function scr_dialogue(diplo_keyphrase, data = {}) { diplo_text = "[[The Emmissary to Chaos is writhing snake like creature, a vile creature even by the standards of it's foul bretheren it has no specific master instead preffering to work undividely. It's savage toungue flicks from between it's teeth with glazed aged ayes staring into your soul]]"; diplo_text += "\n#"; diplo_text += "Greetings Chapter Master, The gods have been watching you oh so very closely, they see you struggles, they hear your pain, they breathe your despair. The warp is the key too all things all you need do is ask and they will provide......For a cost of course even in the warp nothing comes without cost"; - add_diplomacy_option({ - option_text: "I seek a favour from the Gods", - }); - add_diplomacy_option({ - option_text: "Begone Filth i serve the true god FOR THE EMPROR", - }); - add_diplomacy_option({ - option_text: "The gods may have respect when they earn it i'll be back cretin", - }); + add_diplomacy_option({option_text: "I seek a favour from the Gods"}); + add_diplomacy_option({option_text: "Begone Filth i serve the true god FOR THE EMPROR"}); + add_diplomacy_option({option_text: "The gods may have respect when they earn it i'll be back cretin"}); break; case "gift": diplo_text = "Of course Chapter master (giggle) and what may they do for you"; - add_diplomacy_option({ - option_text: "I need strength and power to crush my enemies", - }); - add_diplomacy_option({ - option_text: "I seek to protect thoes under my command from this hellish existance", - }); - add_diplomacy_option({ - option_text: "I seek wisdom and knowlage to better guide me", - }); - add_diplomacy_option({ - option_text: "I seek wealth and a better life for my men", - }); + add_diplomacy_option({option_text: "I need strength and power to crush my enemies"}); + add_diplomacy_option({option_text: "I seek to protect thoes under my command from this hellish existance"}); + add_diplomacy_option({option_text: "I seek wisdom and knowlage to better guide me"}); + add_diplomacy_option({option_text: "I seek wealth and a better life for my men"}); break; case "Khorne_path": diplo_text = "AAAAH the path of the warrior perhaps it was a little hopefull of me to expect anymore, from the right angle i suppose you could almost pass form one of those stunted little red bretheren of mine. The lord of skulls is always eager to help in an endevour that might spill even a moreseful more, but pray what will you offer to the lord of skulls for such favour; he loathes those who emply sorcery but then, but he's known to value the martial mans skull most, i suppose it dosen't matter too much from where the blood flows so long as it flows."; - add_diplomacy_option({ - option_text: "Sacrifice Librarian", - }); - add_diplomacy_option({ - option_text: "Sacrifice Champion", - }); - add_diplomacy_option({ - option_text: "Sacrifice squad", - }); - add_diplomacy_option({ - option_text: "FLEE", - }); + add_diplomacy_option({option_text: "Sacrifice Librarian"}); + add_diplomacy_option({option_text: "Sacrifice Champion"}); + add_diplomacy_option({option_text: "Sacrifice squad"}); + add_diplomacy_option({option_text: "FLEE"}); break; case "daemon_scorn": diplo_text = "return when you find yourself more enligtened Chapter Master my Lords hunger for you"; break; case "Nurgle_path": diplo_text = "No one understands decay, rot and eventual death like the loving father of the warp. Only he can end your suffering and and that of your men. To be embraced is all the benevolent Father asks do you accept thse tuerms Chapter Master"; - add_diplomacy_option({ - option_text: "I accept, we surrender our will to the father", - }); - add_diplomacy_option({ - option_text: "Never you foul daemon all i hear are foul tricks", - }); + add_diplomacy_option({option_text: "I accept, we surrender our will to the father"}); + add_diplomacy_option({option_text: "Never you foul daemon all i hear are foul tricks"}); break; case "Slaanesh_path": diplo_text = "Riches. Joy. Pleasure.ha you remind me of that fool Midas. Who's Midas? Oh never you mind. She who thirsts has a fondness for little play things. Seek out a relic of importnace to her and you'll find yourself rewarded."; - add_diplomacy_option({ - option_text: "Where is this relic?", - }); - add_diplomacy_option({ - option_text: "As i thought the gods would rather have me chase my own tail than give me what i want", - }); + add_diplomacy_option({option_text: "Where is this relic?"}); + add_diplomacy_option({option_text: "As i thought the gods would rather have me chase my own tail than give me what i want"}); break; case "Tzeentch_path": diplo_text = "Yes I supose for a creature of your occupation your fate must be a pressing concern. it's dreary really wandering which rancid little backwater you'll die on fighting a pointless cause for a corpse on a throne, or maybe you only ask because you harbour greater ambitions? The changer of ways knows all things if you'll play a part in his games for him. ohh he does love his games yes he does."; - add_diplomacy_option({ - option_text: "What little game?", - }); - add_diplomacy_option({ - option_text: "A game? not only heretics but fools then begone Daemon", - }); + add_diplomacy_option({option_text: "What little game?"}); + add_diplomacy_option({option_text: "A game? not only heretics but fools then begone Daemon"}); break; case "sacrifice_lib": diplo_text = "one less spell caster how pleasing for the lord. Enjoy your gift."; @@ -689,31 +534,16 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "gift") { diplo_text = "Of course Chapter master (giggle) and what may they do for you"; - add_diplomacy_option({ - option_text: "I need strength and power to crush my enemies", - }); - add_diplomacy_option({ - option_text: "I seek to protect thoes under my command from this hellish existance", - }); - add_diplomacy_option({ - option_text: "I seek wisdom and knowlage to better guide me", - }); - add_diplomacy_option({ - option_text: "I seek wealth and a better life for my men", - }); + add_diplomacy_option({option_text: "I need strength and power to crush my enemies"}); + add_diplomacy_option({option_text: "I seek to protect thoes under my command from this hellish existance"}); + add_diplomacy_option({option_text: "I seek wisdom and knowlage to better guide me"}); + add_diplomacy_option({option_text: "I seek wealth and a better life for my men"}); } } if (diplo_keyphrase == "Demand Method") { - add_diplomacy_option({ - option_text: "Threaten", - tooltip: "The plausibility will of your threat", - }); - add_diplomacy_option({ - option_text: "Bribe", - }); - add_diplomacy_option({ - option_text: "Plausible Excuse", - }); + add_diplomacy_option({option_text: "Threaten", tooltip: "The plausibility will of your threat"}); + add_diplomacy_option({option_text: "Bribe"}); + add_diplomacy_option({option_text: "Plausible Excuse"}); } // ** Chaos ** if (diplomacy == eFACTION.Chaos) { @@ -794,14 +624,8 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (obj_controller.chaos_rating >= 1) { - add_diplomacy_option({ - option_text: "My Chapter is prepared to join Chaos. [Begin]", - goto: "civilwar_begin", - }); - add_diplomacy_option({ - option_text: "I require more time to corrupt my brethren.", - goto: "civilwar_soon", - }); + add_diplomacy_option({option_text: "My Chapter is prepared to join Chaos. [Begin]", goto: "civilwar_begin"}); + add_diplomacy_option({option_text: "I require more time to corrupt my brethren.", goto: "civilwar_soon"}); } } if ((disposition[eFACTION.Chaos] > -80) && (chaos_rating == 0)) { @@ -1137,16 +961,9 @@ function scr_dialogue(diplo_keyphrase, data = {}) { diplo_text += "Speak but do not be offended if I seem not to be paying attention; I'm probably not."; } } - add_diplomacy_option({ - option_text: "Demand Requisition", - }); - add_diplomacy_option({ - option_text: "Demand Military Assistance", - }); - add_diplomacy_option({ - option_text: "Cancel", - goto: "disagree", - }); + add_diplomacy_option({option_text: "Demand Requisition"}); + add_diplomacy_option({option_text: "Demand Military Assistance"}); + add_diplomacy_option({option_text: "Cancel", goto: "disagree"}); } if ((diplo_keyphrase == "propose_alliance") && (obj_controller.faction_gender[eFACTION.Chaos] == 1)) { var _found = false; @@ -1536,16 +1353,9 @@ function scr_dialogue(diplo_keyphrase, data = {}) { if (rela == "hostile") { diplo_text = "Consider your next words carefully."; } - add_diplomacy_option({ - option_text: "Demand Requisition", - }); - add_diplomacy_option({ - option_text: "Demand Military Assistance", - }); - add_diplomacy_option({ - option_text: "Cancel", - goto: "disagree", - }); + add_diplomacy_option({option_text: "Demand Requisition"}); + add_diplomacy_option({option_text: "Demand Military Assistance"}); + add_diplomacy_option({option_text: "Cancel", goto: "disagree"}); } if (diplo_keyphrase == "assassination_angryish") { var _event = audience_data; @@ -1810,13 +1620,8 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "artifact") { if (rela != "hostile") { - add_diplomacy_option({ - option_text: "Propose a trade for the Artifact.", - }); - add_diplomacy_option({ - option_text: "Leave it be; Exit.", - is_exit: true, - }); + add_diplomacy_option({option_text: "Propose a trade for the Artifact."}); + add_diplomacy_option({option_text: "Leave it be; Exit.", is_exit: true}); diplo_text = "The Adeptus Mechanicus is aware of the Artifact. Do not concern yourself with that which is rightly within our territory."; } if (rela == "hostile") { @@ -1913,13 +1718,8 @@ function scr_dialogue(diplo_keyphrase, data = {}) { diplo_text = "Certain queries may have to be answered by action."; } } - add_diplomacy_option({ - option_text: "Demand Requisition", - }); - add_diplomacy_option({ - option_text: "Cancel", - goto: "disagree", - }); + add_diplomacy_option({option_text: "Demand Requisition"}); + add_diplomacy_option({option_text: "Cancel", goto: "disagree"}); } } // ** Inquisition ** @@ -2217,12 +2017,8 @@ function scr_dialogue(diplo_keyphrase, data = {}) { diplo_text = "Make me an offer and I shall consider it, both for its value and its potential heresy."; } if (diplo_keyphrase == "artifact") { - add_diplomacy_option({ - option_text: "Propose a trade for the Artifact.", - }); - add_diplomacy_option({ - option_text: "Leave it be; Exit.", - }); + add_diplomacy_option({option_text: "Propose a trade for the Artifact."}); + add_diplomacy_option({option_text: "Leave it be; Exit."}); diplo_text = "The Inquisition is, of course, aware of the artifact in question. What, precisely, are you offering for it?"; } if (diplo_keyphrase == "artifact_thanks") { @@ -2354,25 +2150,14 @@ function scr_dialogue(diplo_keyphrase, data = {}) { if (rela == "hostile") { diplo_text = "Speak your next words very carefully, Astartes, for they may be your last."; } - add_diplomacy_option({ - option_text: "Demand Requisition", - }); + add_diplomacy_option({option_text: "Demand Requisition"}); - add_diplomacy_option({ - option_text: "Skip Inspection", - choice_func: inquis_demand_inspection_pass, - }); + add_diplomacy_option({option_text: "Skip Inspection", choice_func: inquis_demand_inspection_pass}); if (inspection_passes > 0) { - add_diplomacy_option({ - option_text: "Skip Inspection (Use pass)", - choice_func: inquis_use_inspection_pass, - }); + add_diplomacy_option({option_text: "Skip Inspection (Use pass)", choice_func: inquis_use_inspection_pass}); } - add_diplomacy_option({ - option_text: "Cancel", - goto: "disagree", - }); + add_diplomacy_option({option_text: "Cancel", goto: "disagree"}); } if (diplo_keyphrase == "penitent_end") { rando = choose(1, 2); @@ -2417,11 +2202,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { }); if (obj_controller.disposition[eFACTION.Inquisition] >= 70) { - add_diplomacy_option({ - option_text: "Perhaps We can come to an arrangement", - tooltip: "This action will trigger a Charisma test", - choice_func: function() {}, - }); + add_diplomacy_option({option_text: "Perhaps We can come to an arrangement", tooltip: "This action will trigger a Charisma test", choice_func: function() {}}); } add_diplomacy_option({ option_text: $"You will not. {_star_name} is MINE!", @@ -2456,10 +2237,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } } var ev = 0; - add_event({ - e_id: "game_over_man", - duration: 1, - }); + add_event({e_id: "game_over_man", duration: 1}); } rando = choose(1, 2, 3); if (diplo_keyphrase == "chaos_audience1") { @@ -2520,18 +2298,9 @@ function scr_dialogue(diplo_keyphrase, data = {}) { diplo_text = "Your arrogant, blatant disregard for proper Imperial conduct can no longer go unanswered, Astartes. Time and time again you have ignored the Imperium's call to arms, refusing to strike out at the enemies of man when it was most needed, and callously ignored the Inquisition's wants. It has become clear that you are not in line with the High Lords of Terra and His will. This heresy must be cut from your Chapter like the festering blight it is. You may either atone for your Chapter's crimes, in penitence, or see it ground to dust around you."; // Speak your next words carefully, Chapter Master, for they may damn all the souls of your men to oblivion. - add_diplomacy_option({ - option_text: "You are right in that we must account for our sins. Let our Penitence begin.", - goto: "loyalty_penitence", - }); - add_diplomacy_option({ - option_text: "I answer only to the Emperor himself, not to the likes of you.", - goto: "die_heretic", - }); - add_diplomacy_option({ - option_text: "Threaten my Chapter at your own peril.", - goto: "die_heretic", - }); + add_diplomacy_option({option_text: "You are right in that we must account for our sins. Let our Penitence begin.", goto: "loyalty_penitence"}); + add_diplomacy_option({option_text: "I answer only to the Emperor himself, not to the likes of you.", goto: "die_heretic"}); + add_diplomacy_option({option_text: "Threaten my Chapter at your own peril.", goto: "die_heretic"}); } if (diplo_keyphrase == "loyalty_penitence") { diplo_text = "Brothers, hear my words! It is time to embark on a sacred journey of redemption, a penitence crusade to cleanse our souls. Our past wrongdoings have led us astray form the Emperor, but through unwavering determination and righteous deeds, we shall forge a path to absolution. With every battle fought, every sacrifice made, we shall restore honor to our name and rekindle the flame of righteousness within. "; @@ -2621,12 +2390,8 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "artifact") { - add_diplomacy_option({ - option_text: create_dialogue_string(_diag_set, "propose_arti_trade", _diag_data), - }); - add_diplomacy_option({ - option_text: create_dialogue_string(_diag_set, "leave_it", _diag_data), - }); + add_diplomacy_option({option_text: create_dialogue_string(_diag_set, "propose_arti_trade", _diag_data)}); + add_diplomacy_option({option_text: create_dialogue_string(_diag_set, "leave_it", _diag_data)}); } if (diplo_keyphrase == "artifact_daemon") { @@ -2643,13 +2408,8 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "trading_demand") { - add_diplomacy_option({ - option_text: "Demand Requisition", - }); - add_diplomacy_option({ - option_text: "Cancel", - goto: "disagree", - }); + add_diplomacy_option({option_text: "Demand Requisition"}); + add_diplomacy_option({option_text: "Cancel", goto: "disagree"}); } } // ** Eldar ** @@ -3050,16 +2810,9 @@ function scr_dialogue(diplo_keyphrase, data = {}) { diplo_text = "Were I a lesser being, such as yourself, spitting in your face might prove tempting."; } } - add_diplomacy_option({ - option_text: "Demand Requisition", - }); - add_diplomacy_option({ - option_text: "Demand Useful Information", - }); - add_diplomacy_option({ - option_text: "Cancel", - goto: "disagree", - }); + add_diplomacy_option({option_text: "Demand Requisition"}); + add_diplomacy_option({option_text: "Demand Useful Information"}); + add_diplomacy_option({option_text: "Cancel", goto: "disagree"}); } if (diplo_keyphrase == "mission1") { diplo_text = "The good that might come from simple acts of benevolence are oft underestimated. A token goodwill gesture can go far, "; @@ -3080,10 +2833,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) { requisition -= 500; }, }); - add_diplomacy_option({ - option_text: "Maybe", - goto: "quest_maybe", - }); + add_diplomacy_option({option_text: "Maybe", goto: "quest_maybe"}); add_diplomacy_option({ option_text: "Refuse", goto: "mission1_refused", @@ -3850,16 +3600,9 @@ function scr_dialogue(diplo_keyphrase, data = {}) { } if (diplo_keyphrase == "trading_demand") { diplo_text = "Yeah? Wut?"; - add_diplomacy_option({ - option_text: "Demand Requisition", - }); - add_diplomacy_option({ - option_text: "Demand Military Assistance", - }); - add_diplomacy_option({ - option_text: "Cancel", - goto: "disagree", - }); + add_diplomacy_option({option_text: "Demand Requisition"}); + add_diplomacy_option({option_text: "Demand Military Assistance"}); + add_diplomacy_option({option_text: "Cancel", goto: "disagree"}); } } // ** Tau ** diff --git a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml index 060c36b674..fdb1eff7e6 100644 --- a/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml +++ b/scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml @@ -1,882 +1,1295 @@ - function scr_enemy_ai_a() { - system_garrison = []; - system_sabatours = []; - system_datas = [0]; - - for (var i=1;i<=planets;i++){ - array_push(system_datas,new PlanetData(i, self)); - } - // guardsmen hop from planet to planet - //not sure we really need this as it's handled with tht navy fleet functions but fuck it updated it and leaving it fot the sec - if (system_guard_total()>0 && present_fleet[eFACTION.Imperium]){ - show_debug_message($"system_has_guard {p_guardsmen}"); - var cur_planet=0,most_enemies_found=0,current_guard_planet=0,most_enemies_planet=0; - - var _guard_planets = guard_find_planet_with_most_enemy_forces(self); - - if (_guard_planets[0] > 0 && _guard_planets[1] > 0){ - var _next = _guard_planets[0]; - var _current = _guard_planets[1]; - p_guardsmen[_next] = p_guardsmen[_current]; - p_guardsmen[_current] = 0; - - } - show_debug_message($"system_has_guard {p_guardsmen}"); - } - - if (obj_controller.faction_defeated[10]>0) and (obj_controller.faction_gender[10]=2){ - var cur_planet=0; - repeat(planets){ - cur_planet+=1; - if (array_length(p_feature[cur_planet])!=0){ - if (planet_feature_bool(p_feature[cur_planet], P_features.ChaosWarband)==1) and (p_chaos[cur_planet]<=0){ - delete_features(p_feature[cur_planet],P_features.ChaosWarband); - } - } - } - } - - // checking for inquisition dead world inspections here - if (present_fleet[eFACTION.Player]>=0 && !present_fleet[eFACTION.Inquisition]){ - inquisitor_inspect_base(); - } - - var stop; - var rand=0; - var garrison_force=false, total_garrison=0; + system_garrison = []; + system_sabatours = []; + system_datas = [0]; + + for (var i = 1; i <= planets; i++) { + array_push(system_datas, new PlanetData(i, self)); + } + // guardsmen hop from planet to planet + //not sure we really need this as it's handled with tht navy fleet functions but fuck it updated it and leaving it fot the sec + if (system_guard_total() > 0 && present_fleet[eFACTION.Imperium]) { + show_debug_message($"system_has_guard {p_guardsmen}"); + var cur_planet = 0, most_enemies_found = 0, current_guard_planet = 0, most_enemies_planet = 0; + + var _guard_planets = guard_find_planet_with_most_enemy_forces(self); + + if (_guard_planets[0] > 0 && _guard_planets[1] > 0) { + var _next = _guard_planets[0]; + var _current = _guard_planets[1]; + p_guardsmen[_next] = p_guardsmen[_current]; + p_guardsmen[_current] = 0; + } + show_debug_message($"system_has_guard {p_guardsmen}"); + } + + if ((obj_controller.faction_defeated[10] > 0) && (obj_controller.faction_gender[10] == 2)) { + var cur_planet = 0; + repeat (planets) { + cur_planet += 1; + if (array_length(p_feature[cur_planet]) != 0) { + if ((planet_feature_bool(p_feature[cur_planet], P_features.ChaosWarband) == 1) && (p_chaos[cur_planet] <= 0)) { + delete_features(p_feature[cur_planet], P_features.ChaosWarband); + } + } + } + } + + // checking for inquisition dead world inspections here + if (present_fleet[eFACTION.Player] >= 0 && !present_fleet[eFACTION.Inquisition]) { + inquisitor_inspect_base(); + } + + var stop; + var rand = 0; + var garrison_force = false, total_garrison = 0; var _planet_data; - for (var _run =1;_run<=planets;_run++){ - _planet_data = system_datas[_run]; - garrison_force=false; - var garrison = new GarrisonForce(p_operatives[_run], true); - var sabatours = new GarrisonForce(p_operatives[_run], true, "sabotage"); - _planet_data.garrison = garrison; - _planet_data.sabatours = sabatours; - - garrison_force = garrison.garrison_force; - array_push(system_garrison, garrison); - array_push(system_sabatours, sabatours); - - stop=0; - ensure_no_planet_negatives(_run); - - planet_forces = _planet_data.planet_forces; - - var present_forces = []; - for (var i=0;i0){ - array_push(present_forces, i); - } - } - - if (array_length(present_forces) == 1 && !p_pdf[_run]){// if there is only one faction with present forces the planet belongs ot that faction - p_owner[_run] = present_forces[0]; - stop=1; - continue; - } else if (planet_forces[eFACTION.Player]<=0) and (planet_forces[eFACTION.Ork]>0){//orks prevail over other factions - if (p_owner[_run]==2 or p_owner[_run]==6){ - p_owner[_run]=eFACTION.Ork; - } - } - if (!stop){ - stop = _planet_data.continue_to_planet_battle(stop); - if (stop){ - continue; - } - } - var large=0; - var guard_score=0; - var pdf_score=0; - var eldar_score=0; - - - var guard_attack="",pdf_attack="",ork_attack="",tau_attack="",traitors_attack="",csm_attack=""; - var eldar_attack="",tyranids_attack="",necrons_attack="",sisters_attack=""; - - var traitors_score=p_traitors[_run]; - var csm_score=p_chaos[_run]; - var tyranids_score=p_tyranids[_run]; - var necrons_score=p_necrons[_run]; - var sisters_score=p_sisters[_run]; - // if (p_eldar[_run]>0) then eldar_score=p_eldar[_run]+1; - - if (p_tyranids[_run]>0) and (stop!=1) and (p_owner[_run]!=9){// This might have been causing the problem - /*if (p_tyranids[_run]<5) and (p_guardsmen[_run]>0){ + for (var _run = 1; _run <= planets; _run++) { + _planet_data = system_datas[_run]; + garrison_force = false; + var garrison = new GarrisonForce(p_operatives[_run], true); + var sabatours = new GarrisonForce(p_operatives[_run], true, "sabotage"); + _planet_data.garrison = garrison; + _planet_data.sabatours = sabatours; + + garrison_force = garrison.garrison_force; + array_push(system_garrison, garrison); + array_push(system_sabatours, sabatours); + + stop = 0; + ensure_no_planet_negatives(_run); + + planet_forces = _planet_data.planet_forces; + + var present_forces = []; + for (var i = 0; i < array_length(planet_forces); i++) { + if (planet_forces[i] > 0) { + array_push(present_forces, i); + } + } + + if (array_length(present_forces) == 1 && !p_pdf[_run]) { + // if there is only one faction with present forces the planet belongs ot that faction + p_owner[_run] = present_forces[0]; + stop = 1; + continue; + } else if ((planet_forces[eFACTION.Player] <= 0) && (planet_forces[eFACTION.Ork] > 0)) { + //orks prevail over other factions + if (p_owner[_run] == 2 || p_owner[_run] == 6) { + p_owner[_run] = eFACTION.Ork; + } + } + if (!stop) { + stop = _planet_data.continue_to_planet_battle(stop); + if (stop) { + continue; + } + } + var large = 0; + var guard_score = 0; + var pdf_score = 0; + var eldar_score = 0; + + var guard_attack = "", pdf_attack = "", ork_attack = "", tau_attack = "", traitors_attack = "", csm_attack = ""; + var eldar_attack = "", tyranids_attack = "", necrons_attack = "", sisters_attack = ""; + + var traitors_score = p_traitors[_run]; + var csm_score = p_chaos[_run]; + var tyranids_score = p_tyranids[_run]; + var necrons_score = p_necrons[_run]; + var sisters_score = p_sisters[_run]; + // if (p_eldar[_run]>0) then eldar_score=p_eldar[_run]+1; + + if ((p_tyranids[_run] > 0) && (stop != 1) && (p_owner[_run] != 9)) { + // This might have been causing the problem + /*if (p_tyranids[_run]<5) and (p_guardsmen[_run]>0){ if (p_tyranids[_run]=4) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-100000); if (p_tyranids[_run]=3) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-20000); if (p_tyranids[_run]=2) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-5000); if (p_tyranids[_run]=1) then p_guardsmen[_run]=max(0,p_guardsmen[_run]-500); }*/ - if (p_tyranids[_run]>=5) then tyranids_score=7; - } - var pdf_with_player=_planet_data.pdf_will_support_player(); - var pdf_loss_reduction=_planet_data.pdf_loss_reduction_calc();//redues man loss from battle loss if higher defences - - if (!stop){ - guard_score = _planet_data.guard_score_calc(); - } - if (p_guardsmen[_run]>0) and (stop!=1){ - guard_score = _planet_data.guard_score_calc(); - guard_attack = _planet_data.guard_attack_matrix(); - - if (guard_attack="tyranids") then tyranids_score=p_tyranids[_run]; - // Tend to prioritize traitors > Orks > Tau - // Eldar don't get into pitched battles so nyuck nyuck nyuck - } - if (_planet_data.pdf>0 && !stop){ - var pdf_mod; - var defence_mult = _planet_data.fortification_level*0.1; - - try { - if (pdf_with_player && garrison_force){//if player supports give garrison bonus - pdf_score=determine_pdf_defence(_planet_data.pdf,garrison,_planet_data.fortification_level)[0]; - } else{ - pdf_score=determine_pdf_defence(_planet_data.pdf,,_planet_data.fortification_level)[0]; - } - }catch(_exception) { - handle_exception(_exception,"Pdf defence error",,$"{_run}"); - } - // - // if (p_eldar[_run]>0) and (p_owner[_run]!=6) then pdf_attack="eldar"; - pdf_attack = _planet_data.pdf_attack_matrix(); - } - - if (p_sisters[_run]>0) and (stop!=1){// THEY MARCH FOR THE ECCLESIARCHY - if (p_player[_run]>0) and (obj_controller.faction_status[5]=="War"){ - sisters_attack="player"; - } else { - if (p_tau[_run]>0) then sisters_attack="tau"; - if (p_orks[_run]>0) then sisters_attack="ork"; - if (p_necrons[_run]>0) then sisters_attack="necrons"; - if (p_pdf[_run]>0) and (p_owner[_run]=8) then sisters_attack="pdf"; - if (p_pdf[_run]>0) and (p_owner[_run]=1) and (obj_controller.faction_status[5]="War") then sisters_attack="pdf"; - if (p_traitors[_run]>0) then sisters_attack="traitors"; - if (p_chaos[_run]>0) then sisters_attack="csm"; - if (p_player[_run]>0) and (obj_controller.faction_status[5]="War") then sisters_attack="player"; - // Always goes after traitors first - if (sisters_attack="tyranids") then tyranids_score=p_tyranids[_run]; - } - } - - if (p_orks[_run]>0) and (stop!=1){ - if (p_traitors[_run]=0) and (p_tau[_run]=0) and (p_eldar[_run]=0) then ork_attack="imp"; - rand=choose(1,2,3,4,5); - // if (rand=1) and (ork_attack="imp") then ork_attack="imp"; - if (ork_attack="imp") && (p_guardsmen[_run]>0) then ork_attack="guard"; - - if (rand=2) and (p_tau[_run]>0) then ork_attack="tau"; - if (rand=3) and (p_traitors[_run]>0) then ork_attack="traitors"; - if (rand=4) and (p_chaos[_run]>0) then ork_attack="csm"; - if (rand=5) and (p_sisters[_run]>0) then ork_attack="sisters"; - // if (rand=5) and (p_necrons[_run]>0) then ork_attack="necrons"; - - if (ork_attack="") and (p_player[_run]>0) then ork_attack="player"; - } - - if (p_traitors[_run]>0) and (stop!=1){ - if (planet_forces[eFACTION.Ork]=0) and (planet_forces[eFACTION.Tau]=0) then traitors_attack="imp"; - if (planet_forces[eFACTION.Ork]>planet_forces[eFACTION.Tau]) and (planet_forces[eFACTION.Ork]>guard_score) and (planet_forces[eFACTION.Ork]>pdf_score) then traitors_attack="orks"; - if (sisters_score>planet_forces[eFACTION.Tau]) and (sisters_score>planet_forces[eFACTION.Ork]) and (sisters_score>pdf_score) then traitors_attack="sisters"; - if (guard_score>planet_forces[eFACTION.Tau]) and (guard_score>planet_forces[eFACTION.Ork]) then traitors_attack="imp"; - if (traitors_attack="") and (p_player[_run]>0) then traitors_attack="player"; - } - if (p_chaos[_run]>0) and (stop!=1){ - if (planet_forces[eFACTION.Ork]=0) and (planet_forces[eFACTION.Tau]=0) then csm_attack="imp"; - if (planet_forces[eFACTION.Ork]>planet_forces[eFACTION.Tau]) and (planet_forces[eFACTION.Ork]>guard_score) and (planet_forces[eFACTION.Ork]>pdf_score) then csm_attack="orks"; - if (sisters_score>planet_forces[eFACTION.Tau]) and (sisters_score>planet_forces[eFACTION.Ork]) and (sisters_score>pdf_score) then csm_attack="sisters"; - if (guard_score>planet_forces[eFACTION.Tau]) and (guard_score>planet_forces[eFACTION.Ork]) then csm_attack="imp"; - if (csm_attack="") and (p_player[_run]>0) then csm_attack="player"; - } - - - if (p_tau[_run]>0) and (stop!=1) and (p_owner[_run]!=8){// They don't own the planet, go ham - // if (eldar_score>0) then tau_attack="eldar"; - if (guard_score>0) then tau_attack="imp"; - if (traitors_score>0) then tau_attack="traitors"; - if (csm_score>0) then tau_attack="csm"; - if (planet_forces[eFACTION.Ork]>0) then tau_attack="ork"; - if (traitors_score>=3) and (planet_forces[eFACTION.Ork]<=2) then tau_attack="traitors"; - if (traitors_score>=4) then tau_attack="traitors"; - if (csm_score>=3) and (planet_forces[eFACTION.Ork]<=2) then tau_attack="csm"; - if (csm_score>=4) then tau_attack="csm"; - if (planet_forces[eFACTION.Ork]>=4) then tau_attack="ork"; - if (tau_attack="") and (p_sisters[_run]>0) then tau_attack="sisters"; - if (tau_attack="") and (obj_controller.faction_status[8]="War") and (p_player[_run]>0) then tau_attack="player"; - } - if (p_tau[_run]>0) and (stop!=1) and (p_owner[_run]=8){// They own the planet - // if (eldar_score>0) then tau_attack="eldar"; - if (traitors_score>0) then tau_attack="traitors"; - if (planet_forces[eFACTION.Ork]>0) then tau_attack="ork"; - if (guard_score>0) then tau_attack="imp"; - if (traitors_score>=4) then tau_attack="traitors"; - if (csm_score>=4) then tau_attack="csm"; - if (planet_forces[eFACTION.Ork]>=4) then tau_attack="ork"; - if (tau_attack="") and (p_sisters[_run]>0) then tau_attack="sisters"; - if (tau_attack="") and (obj_controller.faction_status[8]="War") and (p_player[_run]>0) then tau_attack="player"; - } - - if ((p_tyranids[_run]>=4) or (guard_attack="tyranids")) and (stop!=1){ - if (p_traitors[_run]=0) and (p_tau[_run]=0) and (p_eldar[_run]=0) and (p_orks[_run]=0) then tyranids_attack="imp"; - - rand=choose(1,2,3,4,5,6); - if (rand=1) and (tyranids_attack="imp") then tyranids_attack="imp"; - if (rand=2) and (p_tau[_run]>0) then tyranids_attack="tau"; - if (rand=3) and (p_traitors[_run]>0) then tyranids_attack="traitors"; - if (rand=4) and (p_orks[_run]>0) then tyranids_attack="orks"; - if (rand=5) and (p_chaos[_run]>0) then tyranids_attack="csm"; - if (rand=6) and (p_sisters[_run]>0) then tyranids_attack="sisters"; - - if (tyranids_attack="") and (p_player[_run]>0) then tyranids_attack="player"; - } - - if (p_necrons[_run]>0) and (stop!=1){ - if (p_traitors[_run]=0) and (p_tau[_run]=0) and (p_eldar[_run]=0) and (p_orks[_run]=0) and (p_chaos[_run]=0) then necrons_attack="imp"; - - rand=choose(1,2,3,4,5,6); - if (rand=1) and (necrons_attack="imp") then necrons_attack="imp"; - if (rand=2) and (p_tau[_run]>0) then necrons_attack="tau"; - if (rand=3) and (p_traitors[_run]>0) then necrons_attack="traitors"; - if (rand=4) and (p_orks[_run]>0) then necrons_attack="orks"; - if (rand=5) and (p_chaos[_run]>0) then necrons_attack="csm"; - if (rand=6) and (p_sisters[_run]>0) then necrons_attack="sisters"; - - if (necrons_attack="") and (p_player[_run]>0) then necrons_attack="player"; - } - - - - - - if (!stop){// Start stop - - default_imperium_attack = guard_score>0 && !((guard_score<=0.5) && (pdf_score>0)) ?"guard":"pdf"; - - if (ork_attack=="imp") then ork_attack = default_imperium_attack; - - if (traitors_attack=="imp") then traitors_attack = default_imperium_attack; - - if (csm_attack=="imp") then csm_attack = default_imperium_attack; - - if (necrons_attack=="imp") then necrons_attack = default_imperium_attack; - - - if (tau_attack=="imp") then tau_attack=default_imperium_attack// if (tau_attack="imp") and (guard_score<=0) then tau_attack="pdf"; - - if (sisters_attack=="imp") and (pdf_score>0) then sisters_attack="pdf"; - - // if (eldar_attack="imp") and (guard_score>0) then eldar_attack="guard";if (eldar_attack="imp") and (guard_score<=0) then eldar_attack="pdf"; - - - // if (eldar_attack="guard") and ((guard_score<=0.5) and (pdf_score>1)) then eldar_attack="pdf"; - - // if ((traitors_attack="guard") or (traitors_attack="pdf")) and (traitors_score>=3){obj_controller.x=self.x;obj_controller.y=self.y;} - - var after_combat_guard=guard_score; - var after_combat_guard_count=p_guardsmen[_run]; - var after_combat_pdf=pdf_score; - var after_combat_ork_force=planet_forces[eFACTION.Ork]; - var after_combat_tau=planet_forces[eFACTION.Tau]; - var after_combat_traitor=traitors_score; - var after_combat_csm=csm_score; - if (csm_score=6.1) then csm_score=8; - var after_combat_necrons=necrons_score; - var after_combat_tyranids=tyranids_score; - var after_combat_sisters=sisters_score; - var tempor=0,rand1=0,rand2=0; - - var _active_garrison = pdf_with_player && garrison.viable_garrison>0; - // Guard attack - if (guard_score>0) and (guard_attack!="") and (guard_score>0.5){ - show_debug_message($"{name}:{guard_attack}") - if (guard_attack="ork") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork]; - if (guard_attack="tau") then tempor=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Tau]; - if (guard_attack="traitors") then tempor=choose(1,2,3,4,5,6)*traitors_score; - if (guard_attack="csm") then tempor=choose(2,3,4,5,6,7)*csm_score; - if (guard_attack="tyranids") then tempor=choose(2,3,4,5,6,7)*tyranids_score; - - rand1=choose(1,2,3,4,5)*guard_score; - - if (guard_attack="ork") and (planet_forces[eFACTION.Ork]>guard_score) then rand1=0; - if (guard_attack="tau") and (planet_forces[eFACTION.Tau]>guard_score) then rand1=0; - if (guard_attack="traitors") and (traitors_score>guard_score) then rand1=0; - if (guard_attack="csm") and (csm_score>guard_score) then rand1=0; - if (guard_attack="tyranids") and (tyranids_score>guard_score) then rand1=0; - - if (guard_attack="pdf"){ - if (pdf_with_player){ - pdf_mod=irandom_range(1,6+garrison.total_garrison*0.1); - }else{ - pdf_mod=irandom(5)+1; - } - rand1=(choose(3,4,5,6)*guard_score)*choose(1,1.25,1.25); - rand2=(pdf_mod*pdf_score)*choose(1,1.25); - show_debug_message($"{name} guard attack guard_Win:{rand1>rand2}"); - if (rand1>rand2){ - var _pdf_before = p_pdf[_run]; - if (guard_score<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.7+pdf_loss_reduction))); - if (guard_score>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.55+pdf_loss_reduction))); - if (guard_score>=4) and (p_pdf[_run]<30000) then p_pdf[_run]*=(min(0.95, 1+pdf_loss_reduction)); - if (guard_score>=3) and (p_pdf[_run]<10000) then p_pdf[_run]*=(min(0.95, 0+pdf_loss_reduction)); - if (guard_score>=2) and (p_pdf[_run]<2000) then p_pdf[_run]=0; - if (guard_score>=1) and (p_pdf[_run]<200) then p_pdf[_run]=0; - if (_planet_data.population_influences[eFACTION.Tyranids] > 50 && _planet_data.has_feature(P_features.Gene_Stealer_Cult)){ - var _cur_influ = p_influence[_run][eFACTION.Tyranids]; - var _influence_reduction = _cur_influ * (p_pdf[_run]/_pdf_before); - adjust_influence(eFACTION.Tyranids,-min(_influence_reduction,_cur_influ-3) , _run); - if (p_influence[_run][eFACTION.Tyranids] < 20){ - _planet_data.delete_feature(P_features.Gene_Stealer_Cult); - } - } - } - if (p_pdf[_run]=0) and (pdf_with_player){ - if (!_planet_data.has_feature(P_features.Monastery)) and (p_player[_run]<=0){ - p_owner[_run]=2; - dispo[_run]=-50; - } - } - } - if (guard_attack!="pdf") and (rand1>tempor){ - if (guard_attack="ork") then after_combat_ork_force-=1; - if (guard_attack="tau") then after_combat_tau-=1; - if (guard_attack="traitors") then after_combat_traitor-=1; - if (guard_attack="csm") then after_combat_csm-=1; - if (guard_attack="tyranids"){ - after_combat_tyranids-=1; - } - } - } - - // PDF attack - if ((pdf_score>0) and (pdf_attack!="")) or ((pdf_score>1) and (guard_score<0.5)){ - if (pdf_attack="ork") then tempor=planet_forces[eFACTION.Ork]; - if (pdf_attack="tau") then tempor=planet_forces[eFACTION.Tau]; - if (pdf_attack="traitors") then tempor=traitors_score; - if (pdf_attack="csm") then tempor=csm_score; - if (pdf_attack="guard") then tempor=guard_score; - if (pdf_attack="tyranids") then tempor=tyranids_score; - if (pdf_attack="sisters") then tempor=sisters_score; - - rand1=floor(random(pdf_score+tempor+2)) - - rand2=choose(1,1,2); - if (pdf_attack=="ork") and (planet_forces[eFACTION.Ork]>=3) and (pdf_score<=2) then rand2=1; - if (pdf_attack=="traitors") and (traitors_score>=6) then rand2=1; - if (pdf_attack=="csm") and (csm_score>=3) then rand2=1; - if (pdf_attack=="tyranids") and (tyranids_score>=pdf_score) then rand2=1; - if (pdf_attack=="sisters") and (traitors_score>=5) then rand2=1; - - if (rand1<=pdf_score) and (rand2=2) then tempor-=1; - if (tempor=1) and (pdf_score>=6) and (rand2=2) then tempor=0; - - if (pdf_attack=="ork") then after_combat_ork_force=tempor; - if (pdf_attack=="tau") then after_combat_tau=tempor; - if (pdf_attack=="traitors") then after_combat_traitor=tempor; - if (pdf_attack=="csm") then after_combat_csm=tempor; - if (pdf_attack=="tyranids") and (tyranids_score>=4) then after_combat_tyranids=tempor; - if (pdf_attack=="sisters") then after_combat_sisters=tempor; - - if (pdf_attack=="guard"){ - - rand2=(choose(1,2,3,4,5,6)*guard_score)*choose(1,1.25,2); - show_debug_message($"{name} : pdf attack ,pdf win {rand1>rand2}"); - if (rand1>rand2){ - if (pdf_score<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.7); - if (pdf_score>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); - if (pdf_score>=4) and (p_guardsmen[_run]<15000) then p_guardsmen[_run]=0; - if (pdf_score>=3) and (p_guardsmen[_run]<5000) then p_guardsmen[_run]=0; - } - } - } - - // sisters attack - if (sisters_score>0) and (sisters_attack!="") and (sisters_attack!="player"){ - rand1=choose(2,3,4,5,6)*sisters_score; - - if (sisters_attack="tau"){ - rand2=(choose(2,3,4,5)*planet_forces[eFACTION.Tau])*choose(1,1.25); - if (rand1>rand2) then after_combat_tau-=1; - }else if(sisters_attack="ork"){ - rand2=(choose(2,3,4,5)*planet_forces[eFACTION.Ork])*choose(1,1.25); - if (rand1>rand2) then after_combat_ork_force-=1; - }else if(sisters_attack="traitors"){ - rand2=(choose(1,2,3,4,5)*traitors_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_traitor-=1; - }else if(sisters_attack="csm"){ - rand2=(choose(2,3,4,5,6)*csm_score)*choose(1,1.25); - if (csm_score=6.1) then rand2=999; - if (rand1>rand2) then after_combat_csm-=1; - }else if(sisters_attack="necrons"){ - rand2=(choose(4,5,6,7)*necrons_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_necrons-=1; - }else if(sisters_attack="tyranids"){ - rand2=(choose(3,4,5,6,7)*tyranids_score)*choose(1,1.25); - if (rand1>rand2) and (tyranids_score>=4) then after_combat_tyranids-=1; - }else if(sisters_attack="pdf"){ - rand2=(choose(1,2,3,4,5)*pdf_score)*choose(1,1.25); - if (rand1>rand2){ - if (csm_score>=6) then p_pdf[_run]=0; - if (csm_score<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.75+pdf_loss_reduction))); - if (csm_score>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.65+pdf_loss_reduction))); - if (csm_score>=4) and (p_pdf[_run]<60000) then p_pdf[_run]=0; - if (csm_score>=3) and (p_pdf[_run]<20000) then p_pdf[_run]=0; - if (csm_score>=2) and (p_pdf[_run]<3000) then p_pdf[_run]=0; - if (csm_score>=1) and (p_pdf[_run]<1000) then p_pdf[_run]=0; - } - } - - } - - // Tau attack - if (planet_forces[eFACTION.Tau]>0) and (tau_attack!="") and (tau_attack!="player"){ - rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Tau]; - - if (tau_attack="ork"){ - rand2=(choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork])*choose(1,1.25); - if (rand1>rand2) then after_combat_ork_force-=1; - }else if (tau_attack="traitors"){ - rand2=(choose(1,2,3,4,5,6)*traitors_score)*choose(1,1.25); - if (rand1>rand2) and (traitors_score!=7) then after_combat_traitor-=1; - }else if (tau_attack="csm"){ - rand2=(choose(1,2,3,4,5,6)*csm_score)*choose(1,1.25); - if (csm_score=6.1) then rand2=999; - if (rand1>rand2) then after_combat_csm-=1; - }else if (tau_attack="guard"){ - rand2=(choose(1,2,3,4,5,6)*guard_score)*choose(1,1.25); - if (rand1>rand2){ - if (planet_forces[eFACTION.Tau]<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.7); - if (planet_forces[eFACTION.Tau]>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); - } - }else if (tau_attack="pdf"){ - rand2=(choose(1,2,3,4,5,6)*pdf_score)*choose(1,1.25); - if (rand1>rand2){ - if (planet_forces[eFACTION.Tau]<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.7+pdf_loss_reduction))); - if (planet_forces[eFACTION.Tau]>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.55+pdf_loss_reduction))); - } - }else if (tau_attack="sisters"){ - rand2=(choose(1,2,3,4,5,6)*sisters_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_sisters-=1; - } - } - - // ork attack - if (planet_forces[eFACTION.Ork]>0) and (ork_attack!="") and (ork_attack!="player"){ - rand1=choose(1,2,3,4,5,6)*planet_forces[eFACTION.Ork]; - - if (ork_attack="tau"){ - rand2=(choose(1,2,3,4,5,6)*planet_forces[eFACTION.Tau])*choose(1,1.25); - if (rand1>rand2) then after_combat_tau-=1; - }else if (ork_attack="traitors"){ - rand2=(choose(1,2,3,4,5,6,7)*traitors_score)*choose(1,1.25); - if (rand1>rand2) and (traitors_score<6) then after_combat_traitor-=1; - }else if (ork_attack="csm"){ - rand2=(choose(1,2,3,4,5,6)*csm_score)*choose(1,1.25); - if (rand1>rand2) and (csm_score!=6) then after_combat_csm-=1; - }else if (ork_attack="guard"){var onc=0; - rand2=(choose(1,2,3,4,5,6)*guard_score)*choose(1,1.25); - if (rand1>rand2){ - if (planet_forces[eFACTION.Ork]<=3) and (onc=0){ - p_guardsmen[_run]=floor(p_guardsmen[_run]*(min(0.95, 0.7+pdf_loss_reduction)));onc=1; - } - if (planet_forces[eFACTION.Ork]>=4) and (onc=0){ - p_guardsmen[_run]=floor(p_guardsmen[_run]*(min(0.95, 0.55+pdf_loss_reduction))); - onc=1; - } - if (planet_forces[eFACTION.Ork]>=4) and (p_guardsmen[_run]<15000) and (onc=0){ - p_guardsmen[_run]=0;onc=1; - } - if (planet_forces[eFACTION.Ork]>=3) and (p_guardsmen[_run]<5000) and (onc=0){ - p_guardsmen[_run]=0;onc=1; - } - } - }else if (ork_attack="pdf"){ - var pdf_random = choose(1,2,3,4,5,6); - rand2=(pdf_random*pdf_score); - if (rand1>rand2){ - _planet_data.pdf_defence_loss_to_orks(); - - if (_active_garrison){ - var tixt = $"Chapter Forces led by {garrison.garrison_leader.name_role()} on {name} {scr_roman_numerals()[_run-1]} were unable to secure PDF victory chapter support requested"; - if (garrison.garrison_sustain_damages("loose")>0){ - tixt += $". {garrison.garrison_sustain_damages("loose")} Marines Lost"; - } - scr_alert("red","owner",tixt,x,y); - //garrison.determine_battle(false,rand2-rand1, eFACTION.Ork); - } - } else { - if (_active_garrison){ - var tixt = $"Chapter Forces led by {garrison.garrison_leader.name_role()} on {name} {scr_roman_numerals()[_run-1]} secure PDF victory"; - if (garrison.garrison_sustain_damages("win")>0){ - tixt += $". {garrison.garrison_sustain_damages("win")} Marines Lost"; - } - scr_alert("green","owner",tixt,x,y); - } - } - if (p_pdf[_run]=0) and (p_player[_run]<=0){ - var badd=1; - - if (array_sum(p_pdf)==0) and (p_guardsmen[1]+p_guardsmen[2]+p_guardsmen[3]+p_guardsmen[4]=0){ - badd=2; - } - - if (owner <= 5) { - if (badd = 1) and(p_tyranids[_run] = 0) and(p_necrons[_run] = 0) and(p_sisters[_run] = 0) { - scr_alert("red", "owner", string(name) + " " + string(_run) + " has been overwhelmed by Orks!", x, y); - if (visited == 1) { //visited variable check whether the star has been visisted or not 1 for true 0 for false - if (p_type[_run] == "Forge") { - dispo[_run] -= 5; // 10 Disposition decrease for the planet govrnor if it's overrun by orks - obj_controller.disposition[3] -= 5; // obj_controller.disposition[3] refer to the disposition of the toaster jocks. - } else if (planet_feature_bool(p_feature[_run], P_features.Sororitas_Cathedral) or(p_type[_run] == "Shrine")) { - dispo[_run] -= 10; // diso[_run] is the disposition of the planet. where _run refer to the planet that is currently running the code. - obj_controller.disposition[5] -= 3; // obj_controller.disposition[eFACTION.Imperium] refer to the disposition of the sororitas while 3 refer to mechanicus - } else dispo[_run] -= 5; - } - } // diso[_run] is the disposition of the planet. where _run refer to the planet that is currently running the code. - if (badd = 2) and(p_tyranids[_run] = 0) and(p_necrons[_run] = 0) and(p_sisters[_run] = 0) { - scr_popup("System Lost", "The " + string(name) + " system has been ovewhelmed by Orks!", "orks", ""); - scr_event_log("red", "System " + string(name) + " has been overwhelmed by Orkz.", name); - // owner=7;p_owner[1]=7;p_owner[2]=7;p_owner[3]=7;p_owner[4]=7; - } - } - } - } - if (ork_attack="sisters"){ - rand2=(choose(1,2,3,4,5,6)*sisters_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_sisters-=1; - } - } - - // traitors attack - if (traitors_score>0) and (traitors_attack!="") and (traitors_attack!="player"){ - rand1=choose(1,2,3,4,5,6,7)*traitors_score; - if (traitors_score=6){ rand1=choose(30,36);} - else if (traitors_score=7){ rand1=999;} - - if (traitors_attack="tau"){ - rand2=(choose(1,2,3,4,5)*planet_forces[eFACTION.Tau])*choose(1,1.25); - if (rand1>rand2) then after_combat_tau-=1; - }else if (traitors_attack="ork"){ - rand2=(choose(1,2,3,4,5)*planet_forces[eFACTION.Ork])*choose(1,1.25); - if (rand1>rand2) then after_combat_ork_force-=1; - } - /*if (traitors_attack="eldar"){ + if (p_tyranids[_run] >= 5) { + tyranids_score = 7; + } + } + var pdf_with_player = _planet_data.pdf_will_support_player(); + var pdf_loss_reduction = _planet_data.pdf_loss_reduction_calc(); //redues man loss from battle loss if higher defences + + if (!stop) { + guard_score = _planet_data.guard_score_calc(); + } + if ((p_guardsmen[_run] > 0) && (stop != 1)) { + guard_score = _planet_data.guard_score_calc(); + guard_attack = _planet_data.guard_attack_matrix(); + + if (guard_attack == "tyranids") { + tyranids_score = p_tyranids[_run]; + } + // Tend to prioritize traitors > Orks > Tau + // Eldar don't get into pitched battles so nyuck nyuck nyuck + } + if (_planet_data.pdf > 0 && !stop) { + var pdf_mod; + var defence_mult = _planet_data.fortification_level * 0.1; + + try { + if (pdf_with_player && garrison_force) { + //if player supports give garrison bonus + pdf_score = determine_pdf_defence(_planet_data.pdf, garrison, _planet_data.fortification_level)[0]; + } else { + pdf_score = determine_pdf_defence(_planet_data.pdf,, _planet_data.fortification_level)[0]; + } + } catch (_exception) { + handle_exception(_exception, "Pdf defence error",, $"{_run}"); + } + // + // if (p_eldar[_run]>0) and (p_owner[_run]!=6) then pdf_attack="eldar"; + pdf_attack = _planet_data.pdf_attack_matrix(); + } + + if ((p_sisters[_run] > 0) && (stop != 1)) { + // THEY MARCH FOR THE ECCLESIARCHY + if ((p_player[_run] > 0) && (obj_controller.faction_status[5] == "War")) { + sisters_attack = "player"; + } else { + if (p_tau[_run] > 0) { + sisters_attack = "tau"; + } + if (p_orks[_run] > 0) { + sisters_attack = "ork"; + } + if (p_necrons[_run] > 0) { + sisters_attack = "necrons"; + } + if ((p_pdf[_run] > 0) && (p_owner[_run] == 8)) { + sisters_attack = "pdf"; + } + if ((p_pdf[_run] > 0) && (p_owner[_run] == 1) && (obj_controller.faction_status[5] == "War")) { + sisters_attack = "pdf"; + } + if (p_traitors[_run] > 0) { + sisters_attack = "traitors"; + } + if (p_chaos[_run] > 0) { + sisters_attack = "csm"; + } + if ((p_player[_run] > 0) && (obj_controller.faction_status[5] == "War")) { + sisters_attack = "player"; + } + // Always goes after traitors first + if (sisters_attack == "tyranids") { + tyranids_score = p_tyranids[_run]; + } + } + } + + if ((p_orks[_run] > 0) && (stop != 1)) { + if ((p_traitors[_run] == 0) && (p_tau[_run] == 0) && (p_eldar[_run] == 0)) { + ork_attack = "imp"; + } + rand = choose(1, 2, 3, 4, 5); + // if (rand=1) and (ork_attack="imp") then ork_attack="imp"; + if ((ork_attack == "imp") && (p_guardsmen[_run] > 0)) { + ork_attack = "guard"; + } + + if ((rand == 2) && (p_tau[_run] > 0)) { + ork_attack = "tau"; + } + if ((rand == 3) && (p_traitors[_run] > 0)) { + ork_attack = "traitors"; + } + if ((rand == 4) && (p_chaos[_run] > 0)) { + ork_attack = "csm"; + } + if ((rand == 5) && (p_sisters[_run] > 0)) { + ork_attack = "sisters"; + } + // if (rand=5) and (p_necrons[_run]>0) then ork_attack="necrons"; + + if ((ork_attack == "") && (p_player[_run] > 0)) { + ork_attack = "player"; + } + } + + if ((p_traitors[_run] > 0) && (stop != 1)) { + if ((planet_forces[eFACTION.Ork] == 0) && (planet_forces[eFACTION.Tau] == 0)) { + traitors_attack = "imp"; + } + if ((planet_forces[eFACTION.Ork] > planet_forces[eFACTION.Tau]) && (planet_forces[eFACTION.Ork] > guard_score) && (planet_forces[eFACTION.Ork] > pdf_score)) { + traitors_attack = "orks"; + } + if ((sisters_score > planet_forces[eFACTION.Tau]) && (sisters_score > planet_forces[eFACTION.Ork]) && (sisters_score > pdf_score)) { + traitors_attack = "sisters"; + } + if ((guard_score > planet_forces[eFACTION.Tau]) && (guard_score > planet_forces[eFACTION.Ork])) { + traitors_attack = "imp"; + } + if ((traitors_attack == "") && (p_player[_run] > 0)) { + traitors_attack = "player"; + } + } + if ((p_chaos[_run] > 0) && (stop != 1)) { + if ((planet_forces[eFACTION.Ork] == 0) && (planet_forces[eFACTION.Tau] == 0)) { + csm_attack = "imp"; + } + if ((planet_forces[eFACTION.Ork] > planet_forces[eFACTION.Tau]) && (planet_forces[eFACTION.Ork] > guard_score) && (planet_forces[eFACTION.Ork] > pdf_score)) { + csm_attack = "orks"; + } + if ((sisters_score > planet_forces[eFACTION.Tau]) && (sisters_score > planet_forces[eFACTION.Ork]) && (sisters_score > pdf_score)) { + csm_attack = "sisters"; + } + if ((guard_score > planet_forces[eFACTION.Tau]) && (guard_score > planet_forces[eFACTION.Ork])) { + csm_attack = "imp"; + } + if ((csm_attack == "") && (p_player[_run] > 0)) { + csm_attack = "player"; + } + } + + if ((p_tau[_run] > 0) && (stop != 1) && (p_owner[_run] != 8)) { + // They don't own the planet, go ham + // if (eldar_score>0) then tau_attack="eldar"; + if (guard_score > 0) { + tau_attack = "imp"; + } + if (traitors_score > 0) { + tau_attack = "traitors"; + } + if (csm_score > 0) { + tau_attack = "csm"; + } + if (planet_forces[eFACTION.Ork] > 0) { + tau_attack = "ork"; + } + if ((traitors_score >= 3) && (planet_forces[eFACTION.Ork] <= 2)) { + tau_attack = "traitors"; + } + if (traitors_score >= 4) { + tau_attack = "traitors"; + } + if ((csm_score >= 3) && (planet_forces[eFACTION.Ork] <= 2)) { + tau_attack = "csm"; + } + if (csm_score >= 4) { + tau_attack = "csm"; + } + if (planet_forces[eFACTION.Ork] >= 4) { + tau_attack = "ork"; + } + if ((tau_attack == "") && (p_sisters[_run] > 0)) { + tau_attack = "sisters"; + } + if ((tau_attack == "") && (obj_controller.faction_status[8] == "War") && (p_player[_run] > 0)) { + tau_attack = "player"; + } + } + if ((p_tau[_run] > 0) && (stop != 1) && (p_owner[_run] == 8)) { + // They own the planet + // if (eldar_score>0) then tau_attack="eldar"; + if (traitors_score > 0) { + tau_attack = "traitors"; + } + if (planet_forces[eFACTION.Ork] > 0) { + tau_attack = "ork"; + } + if (guard_score > 0) { + tau_attack = "imp"; + } + if (traitors_score >= 4) { + tau_attack = "traitors"; + } + if (csm_score >= 4) { + tau_attack = "csm"; + } + if (planet_forces[eFACTION.Ork] >= 4) { + tau_attack = "ork"; + } + if ((tau_attack == "") && (p_sisters[_run] > 0)) { + tau_attack = "sisters"; + } + if ((tau_attack == "") && (obj_controller.faction_status[8] == "War") && (p_player[_run] > 0)) { + tau_attack = "player"; + } + } + + if (((p_tyranids[_run] >= 4) || (guard_attack == "tyranids")) && (stop != 1)) { + if ((p_traitors[_run] == 0) && (p_tau[_run] == 0) && (p_eldar[_run] == 0) && (p_orks[_run] == 0)) { + tyranids_attack = "imp"; + } + + rand = choose(1, 2, 3, 4, 5, 6); + if ((rand == 1) && (tyranids_attack == "imp")) { + tyranids_attack = "imp"; + } + if ((rand == 2) && (p_tau[_run] > 0)) { + tyranids_attack = "tau"; + } + if ((rand == 3) && (p_traitors[_run] > 0)) { + tyranids_attack = "traitors"; + } + if ((rand == 4) && (p_orks[_run] > 0)) { + tyranids_attack = "orks"; + } + if ((rand == 5) && (p_chaos[_run] > 0)) { + tyranids_attack = "csm"; + } + if ((rand == 6) && (p_sisters[_run] > 0)) { + tyranids_attack = "sisters"; + } + + if ((tyranids_attack == "") && (p_player[_run] > 0)) { + tyranids_attack = "player"; + } + } + + if ((p_necrons[_run] > 0) && (stop != 1)) { + if ((p_traitors[_run] == 0) && (p_tau[_run] == 0) && (p_eldar[_run] == 0) && (p_orks[_run] == 0) && (p_chaos[_run] == 0)) { + necrons_attack = "imp"; + } + + rand = choose(1, 2, 3, 4, 5, 6); + if ((rand == 1) && (necrons_attack == "imp")) { + necrons_attack = "imp"; + } + if ((rand == 2) && (p_tau[_run] > 0)) { + necrons_attack = "tau"; + } + if ((rand == 3) && (p_traitors[_run] > 0)) { + necrons_attack = "traitors"; + } + if ((rand == 4) && (p_orks[_run] > 0)) { + necrons_attack = "orks"; + } + if ((rand == 5) && (p_chaos[_run] > 0)) { + necrons_attack = "csm"; + } + if ((rand == 6) && (p_sisters[_run] > 0)) { + necrons_attack = "sisters"; + } + + if ((necrons_attack == "") && (p_player[_run] > 0)) { + necrons_attack = "player"; + } + } + + if (!stop) { + // Start stop + + default_imperium_attack = guard_score > 0 && !((guard_score <= 0.5) && (pdf_score > 0)) ? "guard" : "pdf"; + + if (ork_attack == "imp") { + ork_attack = default_imperium_attack; + } + + if (traitors_attack == "imp") { + traitors_attack = default_imperium_attack; + } + + if (csm_attack == "imp") { + csm_attack = default_imperium_attack; + } + + if (necrons_attack == "imp") { + necrons_attack = default_imperium_attack; + } + + if (tau_attack == "imp") { + tau_attack = default_imperium_attack; + } // if (tau_attack="imp") and (guard_score<=0) then tau_attack="pdf"; + + if ((sisters_attack == "imp") && (pdf_score > 0)) { + sisters_attack = "pdf"; + } + + // if (eldar_attack="imp") and (guard_score>0) then eldar_attack="guard";if (eldar_attack="imp") and (guard_score<=0) then eldar_attack="pdf"; + + // if (eldar_attack="guard") and ((guard_score<=0.5) and (pdf_score>1)) then eldar_attack="pdf"; + + // if ((traitors_attack="guard") or (traitors_attack="pdf")) and (traitors_score>=3){obj_controller.x=self.x;obj_controller.y=self.y;} + + var after_combat_guard = guard_score; + var after_combat_guard_count = p_guardsmen[_run]; + var after_combat_pdf = pdf_score; + var after_combat_ork_force = planet_forces[eFACTION.Ork]; + var after_combat_tau = planet_forces[eFACTION.Tau]; + var after_combat_traitor = traitors_score; + var after_combat_csm = csm_score; + if (csm_score == 6.1) { + csm_score = 8; + } + var after_combat_necrons = necrons_score; + var after_combat_tyranids = tyranids_score; + var after_combat_sisters = sisters_score; + var tempor = 0, rand1 = 0, rand2 = 0; + + var _active_garrison = pdf_with_player && garrison.viable_garrison > 0; + // Guard attack + if ((guard_score > 0) && (guard_attack != "") && (guard_score > 0.5)) { + show_debug_message($"{name}:{guard_attack}"); + if (guard_attack == "ork") { + tempor = choose(1, 2, 3, 4, 5, 6) * planet_forces[eFACTION.Ork]; + } + if (guard_attack == "tau") { + tempor = choose(1, 2, 3, 4, 5, 6) * planet_forces[eFACTION.Tau]; + } + if (guard_attack == "traitors") { + tempor = choose(1, 2, 3, 4, 5, 6) * traitors_score; + } + if (guard_attack == "csm") { + tempor = choose(2, 3, 4, 5, 6, 7) * csm_score; + } + if (guard_attack == "tyranids") { + tempor = choose(2, 3, 4, 5, 6, 7) * tyranids_score; + } + + rand1 = choose(1, 2, 3, 4, 5) * guard_score; + + if ((guard_attack == "ork") && (planet_forces[eFACTION.Ork] > guard_score)) { + rand1 = 0; + } + if ((guard_attack == "tau") && (planet_forces[eFACTION.Tau] > guard_score)) { + rand1 = 0; + } + if ((guard_attack == "traitors") && (traitors_score > guard_score)) { + rand1 = 0; + } + if ((guard_attack == "csm") && (csm_score > guard_score)) { + rand1 = 0; + } + if ((guard_attack == "tyranids") && (tyranids_score > guard_score)) { + rand1 = 0; + } + + if (guard_attack == "pdf") { + if (pdf_with_player) { + pdf_mod = irandom_range(1, 6 + garrison.total_garrison * 0.1); + } else { + pdf_mod = irandom(5) + 1; + } + rand1 = (choose(3, 4, 5, 6) * guard_score) * choose(1, 1.25, 1.25); + rand2 = (pdf_mod * pdf_score) * choose(1, 1.25); + show_debug_message($"{name} guard attack guard_Win:{rand1 > rand2}"); + if (rand1 > rand2) { + var _pdf_before = p_pdf[_run]; + if (guard_score <= 3) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.7 + pdf_loss_reduction)); + } + if (guard_score >= 4) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.55 + pdf_loss_reduction)); + } + if ((guard_score >= 4) && (p_pdf[_run] < 30000)) { + p_pdf[_run] *= min(0.95, 1 + pdf_loss_reduction); + } + if ((guard_score >= 3) && (p_pdf[_run] < 10000)) { + p_pdf[_run] *= min(0.95, 0 + pdf_loss_reduction); + } + if ((guard_score >= 2) && (p_pdf[_run] < 2000)) { + p_pdf[_run] = 0; + } + if ((guard_score >= 1) && (p_pdf[_run] < 200)) { + p_pdf[_run] = 0; + } + if (_planet_data.population_influences[eFACTION.Tyranids] > 50 && _planet_data.has_feature(P_features.Gene_Stealer_Cult)) { + var _cur_influ = p_influence[_run][eFACTION.Tyranids]; + var _influence_reduction = _cur_influ * (p_pdf[_run] / _pdf_before); + adjust_influence(eFACTION.Tyranids, -min(_influence_reduction, _cur_influ - 3), _run); + if (p_influence[_run][eFACTION.Tyranids] < 20) { + _planet_data.delete_feature(P_features.Gene_Stealer_Cult); + } + } + } + if ((p_pdf[_run] == 0) && pdf_with_player) { + if ((!_planet_data.has_feature(P_features.Monastery)) && (p_player[_run] <= 0)) { + p_owner[_run] = 2; + dispo[_run] = -50; + } + } + } + if ((guard_attack != "pdf") && (rand1 > tempor)) { + if (guard_attack == "ork") { + after_combat_ork_force -= 1; + } + if (guard_attack == "tau") { + after_combat_tau -= 1; + } + if (guard_attack == "traitors") { + after_combat_traitor -= 1; + } + if (guard_attack == "csm") { + after_combat_csm -= 1; + } + if (guard_attack == "tyranids") { + after_combat_tyranids -= 1; + } + } + } + + // PDF attack + if (((pdf_score > 0) && (pdf_attack != "")) || ((pdf_score > 1) && (guard_score < 0.5))) { + if (pdf_attack == "ork") { + tempor = planet_forces[eFACTION.Ork]; + } + if (pdf_attack == "tau") { + tempor = planet_forces[eFACTION.Tau]; + } + if (pdf_attack == "traitors") { + tempor = traitors_score; + } + if (pdf_attack == "csm") { + tempor = csm_score; + } + if (pdf_attack == "guard") { + tempor = guard_score; + } + if (pdf_attack == "tyranids") { + tempor = tyranids_score; + } + if (pdf_attack == "sisters") { + tempor = sisters_score; + } + + rand1 = floor(random(pdf_score + tempor + 2)); + + rand2 = choose(1, 1, 2); + if ((pdf_attack == "ork") && (planet_forces[eFACTION.Ork] >= 3) && (pdf_score <= 2)) { + rand2 = 1; + } + if ((pdf_attack == "traitors") && (traitors_score >= 6)) { + rand2 = 1; + } + if ((pdf_attack == "csm") && (csm_score >= 3)) { + rand2 = 1; + } + if ((pdf_attack == "tyranids") && (tyranids_score >= pdf_score)) { + rand2 = 1; + } + if ((pdf_attack == "sisters") && (traitors_score >= 5)) { + rand2 = 1; + } + + if ((rand1 <= pdf_score) && (rand2 == 2)) { + tempor -= 1; + } + if ((tempor == 1) && (pdf_score >= 6) && (rand2 == 2)) { + tempor = 0; + } + + if (pdf_attack == "ork") { + after_combat_ork_force = tempor; + } + if (pdf_attack == "tau") { + after_combat_tau = tempor; + } + if (pdf_attack == "traitors") { + after_combat_traitor = tempor; + } + if (pdf_attack == "csm") { + after_combat_csm = tempor; + } + if ((pdf_attack == "tyranids") && (tyranids_score >= 4)) { + after_combat_tyranids = tempor; + } + if (pdf_attack == "sisters") { + after_combat_sisters = tempor; + } + + if (pdf_attack == "guard") { + rand2 = (choose(1, 2, 3, 4, 5, 6) * guard_score) * choose(1, 1.25, 2); + show_debug_message($"{name} : pdf attack ,pdf win {rand1 > rand2}"); + if (rand1 > rand2) { + if (pdf_score <= 3) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.7); + } + if (pdf_score >= 4) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.6); + } + if ((pdf_score >= 4) && (p_guardsmen[_run] < 15000)) { + p_guardsmen[_run] = 0; + } + if ((pdf_score >= 3) && (p_guardsmen[_run] < 5000)) { + p_guardsmen[_run] = 0; + } + } + } + } + + // sisters attack + if ((sisters_score > 0) && (sisters_attack != "") && (sisters_attack != "player")) { + rand1 = choose(2, 3, 4, 5, 6) * sisters_score; + + if (sisters_attack == "tau") { + rand2 = (choose(2, 3, 4, 5) * planet_forces[eFACTION.Tau]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_tau -= 1; + } + } else if (sisters_attack == "ork") { + rand2 = (choose(2, 3, 4, 5) * planet_forces[eFACTION.Ork]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_ork_force -= 1; + } + } else if (sisters_attack == "traitors") { + rand2 = (choose(1, 2, 3, 4, 5) * traitors_score) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_traitor -= 1; + } + } else if (sisters_attack == "csm") { + rand2 = (choose(2, 3, 4, 5, 6) * csm_score) * choose(1, 1.25); + if (csm_score == 6.1) { + rand2 = 999; + } + if (rand1 > rand2) { + after_combat_csm -= 1; + } + } else if (sisters_attack == "necrons") { + rand2 = (choose(4, 5, 6, 7) * necrons_score) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_necrons -= 1; + } + } else if (sisters_attack == "tyranids") { + rand2 = (choose(3, 4, 5, 6, 7) * tyranids_score) * choose(1, 1.25); + if ((rand1 > rand2) && (tyranids_score >= 4)) { + after_combat_tyranids -= 1; + } + } else if (sisters_attack == "pdf") { + rand2 = (choose(1, 2, 3, 4, 5) * pdf_score) * choose(1, 1.25); + if (rand1 > rand2) { + if (csm_score >= 6) { + p_pdf[_run] = 0; + } + if (csm_score <= 3) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.75 + pdf_loss_reduction)); + } + if (csm_score >= 4) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.65 + pdf_loss_reduction)); + } + if ((csm_score >= 4) && (p_pdf[_run] < 60000)) { + p_pdf[_run] = 0; + } + if ((csm_score >= 3) && (p_pdf[_run] < 20000)) { + p_pdf[_run] = 0; + } + if ((csm_score >= 2) && (p_pdf[_run] < 3000)) { + p_pdf[_run] = 0; + } + if ((csm_score >= 1) && (p_pdf[_run] < 1000)) { + p_pdf[_run] = 0; + } + } + } + } + + // Tau attack + if ((planet_forces[eFACTION.Tau] > 0) && (tau_attack != "") && (tau_attack != "player")) { + rand1 = choose(1, 2, 3, 4, 5, 6) * planet_forces[eFACTION.Tau]; + + if (tau_attack == "ork") { + rand2 = (choose(1, 2, 3, 4, 5, 6) * planet_forces[eFACTION.Ork]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_ork_force -= 1; + } + } else if (tau_attack == "traitors") { + rand2 = (choose(1, 2, 3, 4, 5, 6) * traitors_score) * choose(1, 1.25); + if ((rand1 > rand2) && (traitors_score != 7)) { + after_combat_traitor -= 1; + } + } else if (tau_attack == "csm") { + rand2 = (choose(1, 2, 3, 4, 5, 6) * csm_score) * choose(1, 1.25); + if (csm_score == 6.1) { + rand2 = 999; + } + if (rand1 > rand2) { + after_combat_csm -= 1; + } + } else if (tau_attack == "guard") { + rand2 = (choose(1, 2, 3, 4, 5, 6) * guard_score) * choose(1, 1.25); + if (rand1 > rand2) { + if (planet_forces[eFACTION.Tau] <= 3) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.7); + } + if (planet_forces[eFACTION.Tau] >= 4) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.6); + } + } + } else if (tau_attack == "pdf") { + rand2 = (choose(1, 2, 3, 4, 5, 6) * pdf_score) * choose(1, 1.25); + if (rand1 > rand2) { + if (planet_forces[eFACTION.Tau] <= 3) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.7 + pdf_loss_reduction)); + } + if (planet_forces[eFACTION.Tau] >= 4) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.55 + pdf_loss_reduction)); + } + } + } else if (tau_attack == "sisters") { + rand2 = (choose(1, 2, 3, 4, 5, 6) * sisters_score) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_sisters -= 1; + } + } + } + + // ork attack + if ((planet_forces[eFACTION.Ork] > 0) && (ork_attack != "") && (ork_attack != "player")) { + rand1 = choose(1, 2, 3, 4, 5, 6) * planet_forces[eFACTION.Ork]; + + if (ork_attack == "tau") { + rand2 = (choose(1, 2, 3, 4, 5, 6) * planet_forces[eFACTION.Tau]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_tau -= 1; + } + } else if (ork_attack == "traitors") { + rand2 = (choose(1, 2, 3, 4, 5, 6, 7) * traitors_score) * choose(1, 1.25); + if ((rand1 > rand2) && (traitors_score < 6)) { + after_combat_traitor -= 1; + } + } else if (ork_attack == "csm") { + rand2 = (choose(1, 2, 3, 4, 5, 6) * csm_score) * choose(1, 1.25); + if ((rand1 > rand2) && (csm_score != 6)) { + after_combat_csm -= 1; + } + } else if (ork_attack == "guard") { + var onc = 0; + rand2 = (choose(1, 2, 3, 4, 5, 6) * guard_score) * choose(1, 1.25); + if (rand1 > rand2) { + if ((planet_forces[eFACTION.Ork] <= 3) && (onc == 0)) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * min(0.95, 0.7 + pdf_loss_reduction)); + onc = 1; + } + if ((planet_forces[eFACTION.Ork] >= 4) && (onc == 0)) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * min(0.95, 0.55 + pdf_loss_reduction)); + onc = 1; + } + if ((planet_forces[eFACTION.Ork] >= 4) && (p_guardsmen[_run] < 15000) && (onc == 0)) { + p_guardsmen[_run] = 0; + onc = 1; + } + if ((planet_forces[eFACTION.Ork] >= 3) && (p_guardsmen[_run] < 5000) && (onc == 0)) { + p_guardsmen[_run] = 0; + onc = 1; + } + } + } else if (ork_attack == "pdf") { + var pdf_random = choose(1, 2, 3, 4, 5, 6); + rand2 = pdf_random * pdf_score; + if (rand1 > rand2) { + _planet_data.pdf_defence_loss_to_orks(); + + if (_active_garrison) { + var tixt = $"Chapter Forces led by {garrison.garrison_leader.name_role()} on {name} {scr_roman_numerals()[_run - 1]} were unable to secure PDF victory chapter support requested"; + if (garrison.garrison_sustain_damages("loose") > 0) { + tixt += $". {garrison.garrison_sustain_damages("loose")} Marines Lost"; + } + scr_alert("red", "owner", tixt, x, y); + //garrison.determine_battle(false,rand2-rand1, eFACTION.Ork); + } + } else { + if (_active_garrison) { + var tixt = $"Chapter Forces led by {garrison.garrison_leader.name_role()} on {name} {scr_roman_numerals()[_run - 1]} secure PDF victory"; + if (garrison.garrison_sustain_damages("win") > 0) { + tixt += $". {garrison.garrison_sustain_damages("win")} Marines Lost"; + } + scr_alert("green", "owner", tixt, x, y); + } + } + if ((p_pdf[_run] == 0) && (p_player[_run] <= 0)) { + var badd = 1; + + if ((array_sum(p_pdf) == 0) && (p_guardsmen[1] + p_guardsmen[2] + p_guardsmen[3] + p_guardsmen[4] == 0)) { + badd = 2; + } + + if (owner <= 5) { + if ((badd == 1) && (p_tyranids[_run] == 0) && (p_necrons[_run] == 0) && (p_sisters[_run] == 0)) { + scr_alert("red", "owner", string(name) + " " + string(_run) + " has been overwhelmed by Orks!", x, y); + if (visited == 1) { + //visited variable check whether the star has been visisted or not 1 for true 0 for false + if (p_type[_run] == "Forge") { + dispo[_run] -= 5; // 10 Disposition decrease for the planet govrnor if it's overrun by orks + obj_controller.disposition[3] -= 5; // obj_controller.disposition[3] refer to the disposition of the toaster jocks. + } else if (planet_feature_bool(p_feature[_run], P_features.Sororitas_Cathedral) || (p_type[_run] == "Shrine")) { + dispo[_run] -= 10; // diso[_run] is the disposition of the planet. where _run refer to the planet that is currently running the code. + obj_controller.disposition[5] -= 3; // obj_controller.disposition[eFACTION.Imperium] refer to the disposition of the sororitas while 3 refer to mechanicus + } else { + dispo[_run] -= 5; + } + } + } // diso[_run] is the disposition of the planet. where _run refer to the planet that is currently running the code. + if ((badd == 2) && (p_tyranids[_run] == 0) && (p_necrons[_run] == 0) && (p_sisters[_run] == 0)) { + scr_popup("System Lost", "The " + string(name) + " system has been ovewhelmed by Orks!", "orks", ""); + scr_event_log("red", "System " + string(name) + " has been overwhelmed by Orkz.", name); + // owner=7;p_owner[1]=7;p_owner[2]=7;p_owner[3]=7;p_owner[4]=7; + } + } + } + } + if (ork_attack == "sisters") { + rand2 = (choose(1, 2, 3, 4, 5, 6) * sisters_score) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_sisters -= 1; + } + } + } + + // traitors attack + if ((traitors_score > 0) && (traitors_attack != "") && (traitors_attack != "player")) { + rand1 = choose(1, 2, 3, 4, 5, 6, 7) * traitors_score; + if (traitors_score == 6) { + rand1 = choose(30, 36); + } else if (traitors_score == 7) { + rand1 = 999; + } + + if (traitors_attack == "tau") { + rand2 = (choose(1, 2, 3, 4, 5) * planet_forces[eFACTION.Tau]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_tau -= 1; + } + } else if (traitors_attack == "ork") { + rand2 = (choose(1, 2, 3, 4, 5) * planet_forces[eFACTION.Ork]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_ork_force -= 1; + } + } else /*if (traitors_attack="eldar"){ rand2=(choose(1,2,3,4,5)*eldar_score)*choose(1,1.25); if (rand1>rand2) then after_combat_csm-=1; }*/ - - else if (traitors_attack="guard"){ - rand2=(choose(1,2,3,4,5)*guard_score)*choose(1,1.25); - if (rand1>rand2){ - if (traitors_score<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.7); - if (traitors_score>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); - if (traitors_score>=6) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.3); - if (traitors_score>=4) and (p_guardsmen[_run]<15000) then p_guardsmen[_run]=0; - if (traitors_score>=3) and (p_guardsmen[_run]<5000) then p_guardsmen[_run]=0; - if (traitors_score>=2) and (p_guardsmen[_run]<1000) then p_guardsmen[_run]=0; - if (traitors_score>=1) and (p_guardsmen[_run]<500) then p_guardsmen[_run]=0; - } - }else if (traitors_attack="pdf"){ - rand2=(choose(1,2,3,4,5)*pdf_score)*choose(1,1.25); - if (rand1>rand2){ - if (traitors_score>=6) then p_pdf[_run]=0; - if (traitors_score<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.75+pdf_loss_reduction))); - if (traitors_score>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.55+pdf_loss_reduction))); - if (traitors_score>=4) and (p_pdf[_run]<60000) then p_pdf[_run]=0; - if (traitors_score>=3) and (p_pdf[_run]<20000) then p_pdf[_run]=0; - if (traitors_score>=2) and (p_pdf[_run]<3000) then p_pdf[_run]=0; - if (traitors_score>=1) and (p_pdf[_run]<1000) then p_pdf[_run]=0; - } - }else if (traitors_attack="sisters"){ - rand2=(choose(1,2,3,4,5,6,7)*sisters_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_sisters-=1; - } - } - - - // CSM attack - if (csm_score>0) and (csm_attack!="") and (csm_attack!="player"){ - rand1=choose(2,3,4,5,6,7)*csm_score; - if (csm_score>=5) then rand1=choose(30,36); - - if (csm_attack="tau"){ - rand2=(choose(1,2,3,4,5)*planet_forces[eFACTION.Tau])*choose(1,1.25); - if (rand1>rand2) then after_combat_tau-=1; - }else if (csm_attack="ork"){ - rand2=(choose(1,2,3,4,5)*planet_forces[eFACTION.Ork])*choose(1,1.25); - if (rand1>rand2) then after_combat_ork_force-=1; - }else if (csm_attack="guard"){ - rand2=(choose(1,2,3,4,5)*guard_score)*choose(1,1.25); - if (rand1>rand2){ - if (csm_score<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.7); - if (csm_score>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); - if (csm_score>=6) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.3); - if (csm_score>=4) and (p_guardsmen[_run]<15000) then p_guardsmen[_run]=0; - if (csm_score>=3) and (p_guardsmen[_run]<5000) then p_guardsmen[_run]=0; - if (csm_score>=2) and (p_guardsmen[_run]<1000) then p_guardsmen[_run]=0; - if (csm_score>=1) and (p_guardsmen[_run]<500) then p_guardsmen[_run]=0; - } - }else if (csm_attack="pdf"){ - rand2=(choose(1,2,3,4,5)*pdf_score)*choose(1,1.25); - if (rand1>rand2){ - if (csm_score>=6) then p_pdf[_run]=0; - if (csm_score<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.75+pdf_loss_reduction))); - if (csm_score>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.55+pdf_loss_reduction))); - if (csm_score>=4) and (p_pdf[_run]<60000) then p_pdf[_run]=0; - if (csm_score>=3) and (p_pdf[_run]<20000) then p_pdf[_run]=0; - if (csm_score>=2) and (p_pdf[_run]<3000) then p_pdf[_run]=0; - if (csm_score>=1) and (p_pdf[_run]<1000) then p_pdf[_run]=0; - } - }else if (csm_attack="sisters"){ - rand2=(choose(2,3,4,5,6)*sisters_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_sisters-=1; - } - } - - - // Tyranids attack - if ((tyranids_score>4) or (guard_attack="tyranids")) and (tyranids_attack!="") and (tyranids_attack!="player"){ - // if (tyranids_score>4) and (tyranids_attack!="") and (tyranids_attack!="player"){ - rand1=choose(3,4,5,6,7)*tyranids_score; - if (tyranids_score>=6) then rand1=choose(30,36); - - if (tyranids_attack="tau"){ - rand2=(choose(1,2,3,4,5)*planet_forces[eFACTION.Tau])*choose(1,1.25); - if (rand1>rand2) then after_combat_tau-=1; - }else if (tyranids_attack="ork"){ - rand2=(choose(1,2,3,4,5)*planet_forces[eFACTION.Ork])*choose(1,1.25); - if (rand1>rand2) then after_combat_ork_force-=1; - }else if (tyranids_attack="csm"){ - rand2=(choose(1,2,3,4,5)*csm_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_csm-=1; - }else if (tyranids_attack="traitors"){ - rand2=(choose(1,2,3,4,5)*traitors_score)*choose(1,1.25); - if (rand1>rand2) and (traitors_score!=7) then after_combat_traitor-=1; - }else if (tyranids_attack="imp"){ - if (p_pdf[_run]>0) then tyranids_attack="pdf"; - if (p_guardsmen[_run]>0) then tyranids_attack="guard"; - }else if (tyranids_attack="guard"){ - rand1=(choose(1,2,3,4,5,6,7)*tyranids_score)*choose(1,1.25); - rand2=(choose(1,2,3,4,5)*guard_score)*choose(1,1.25); - if (rand1>rand2){ - /*if (tyranids_score<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); + + if (traitors_attack == "guard") { + rand2 = (choose(1, 2, 3, 4, 5) * guard_score) * choose(1, 1.25); + if (rand1 > rand2) { + if (traitors_score <= 3) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.7); + } + if (traitors_score >= 4) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.6); + } + if (traitors_score >= 6) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.3); + } + if ((traitors_score >= 4) && (p_guardsmen[_run] < 15000)) { + p_guardsmen[_run] = 0; + } + if ((traitors_score >= 3) && (p_guardsmen[_run] < 5000)) { + p_guardsmen[_run] = 0; + } + if ((traitors_score >= 2) && (p_guardsmen[_run] < 1000)) { + p_guardsmen[_run] = 0; + } + if ((traitors_score >= 1) && (p_guardsmen[_run] < 500)) { + p_guardsmen[_run] = 0; + } + } + } else if (traitors_attack == "pdf") { + rand2 = (choose(1, 2, 3, 4, 5) * pdf_score) * choose(1, 1.25); + if (rand1 > rand2) { + if (traitors_score >= 6) { + p_pdf[_run] = 0; + } + if (traitors_score <= 3) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.75 + pdf_loss_reduction)); + } + if (traitors_score >= 4) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.55 + pdf_loss_reduction)); + } + if ((traitors_score >= 4) && (p_pdf[_run] < 60000)) { + p_pdf[_run] = 0; + } + if ((traitors_score >= 3) && (p_pdf[_run] < 20000)) { + p_pdf[_run] = 0; + } + if ((traitors_score >= 2) && (p_pdf[_run] < 3000)) { + p_pdf[_run] = 0; + } + if ((traitors_score >= 1) && (p_pdf[_run] < 1000)) { + p_pdf[_run] = 0; + } + } + } else if (traitors_attack == "sisters") { + rand2 = (choose(1, 2, 3, 4, 5, 6, 7) * sisters_score) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_sisters -= 1; + } + } + } + + // CSM attack + if ((csm_score > 0) && (csm_attack != "") && (csm_attack != "player")) { + rand1 = choose(2, 3, 4, 5, 6, 7) * csm_score; + if (csm_score >= 5) { + rand1 = choose(30, 36); + } + + if (csm_attack == "tau") { + rand2 = (choose(1, 2, 3, 4, 5) * planet_forces[eFACTION.Tau]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_tau -= 1; + } + } else if (csm_attack == "ork") { + rand2 = (choose(1, 2, 3, 4, 5) * planet_forces[eFACTION.Ork]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_ork_force -= 1; + } + } else if (csm_attack == "guard") { + rand2 = (choose(1, 2, 3, 4, 5) * guard_score) * choose(1, 1.25); + if (rand1 > rand2) { + if (csm_score <= 3) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.7); + } + if (csm_score >= 4) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.6); + } + if (csm_score >= 6) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.3); + } + if ((csm_score >= 4) && (p_guardsmen[_run] < 15000)) { + p_guardsmen[_run] = 0; + } + if ((csm_score >= 3) && (p_guardsmen[_run] < 5000)) { + p_guardsmen[_run] = 0; + } + if ((csm_score >= 2) && (p_guardsmen[_run] < 1000)) { + p_guardsmen[_run] = 0; + } + if ((csm_score >= 1) && (p_guardsmen[_run] < 500)) { + p_guardsmen[_run] = 0; + } + } + } else if (csm_attack == "pdf") { + rand2 = (choose(1, 2, 3, 4, 5) * pdf_score) * choose(1, 1.25); + if (rand1 > rand2) { + if (csm_score >= 6) { + p_pdf[_run] = 0; + } + if (csm_score <= 3) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.75 + pdf_loss_reduction)); + } + if (csm_score >= 4) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.55 + pdf_loss_reduction)); + } + if ((csm_score >= 4) && (p_pdf[_run] < 60000)) { + p_pdf[_run] = 0; + } + if ((csm_score >= 3) && (p_pdf[_run] < 20000)) { + p_pdf[_run] = 0; + } + if ((csm_score >= 2) && (p_pdf[_run] < 3000)) { + p_pdf[_run] = 0; + } + if ((csm_score >= 1) && (p_pdf[_run] < 1000)) { + p_pdf[_run] = 0; + } + } + } else if (csm_attack == "sisters") { + rand2 = (choose(2, 3, 4, 5, 6) * sisters_score) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_sisters -= 1; + } + } + } + + // Tyranids attack + if (((tyranids_score > 4) || (guard_attack == "tyranids")) && (tyranids_attack != "") && (tyranids_attack != "player")) { + // if (tyranids_score>4) and (tyranids_attack!="") and (tyranids_attack!="player"){ + rand1 = choose(3, 4, 5, 6, 7) * tyranids_score; + if (tyranids_score >= 6) { + rand1 = choose(30, 36); + } + + if (tyranids_attack == "tau") { + rand2 = (choose(1, 2, 3, 4, 5) * planet_forces[eFACTION.Tau]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_tau -= 1; + } + } else if (tyranids_attack == "ork") { + rand2 = (choose(1, 2, 3, 4, 5) * planet_forces[eFACTION.Ork]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_ork_force -= 1; + } + } else if (tyranids_attack == "csm") { + rand2 = (choose(1, 2, 3, 4, 5) * csm_score) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_csm -= 1; + } + } else if (tyranids_attack == "traitors") { + rand2 = (choose(1, 2, 3, 4, 5) * traitors_score) * choose(1, 1.25); + if ((rand1 > rand2) && (traitors_score != 7)) { + after_combat_traitor -= 1; + } + } else if (tyranids_attack == "imp") { + if (p_pdf[_run] > 0) { + tyranids_attack = "pdf"; + } + if (p_guardsmen[_run] > 0) { + tyranids_attack = "guard"; + } + } else if (tyranids_attack == "guard") { + rand1 = (choose(1, 2, 3, 4, 5, 6, 7) * tyranids_score) * choose(1, 1.25); + rand2 = (choose(1, 2, 3, 4, 5) * guard_score) * choose(1, 1.25); + if (rand1 > rand2) { + /*if (tyranids_score<=3) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); if (tyranids_score>=4) then p_guardsmen[_run]=floor(p_guardsmen[_run]*0.5);*/ - var onh=0; - if (tyranids_score=1) and (onh=0){p_guardsmen[_run]-=2000;onh=1;} - if (tyranids_score=2) and (onh=0){p_guardsmen[_run]-=30000;onh=1;} - if (tyranids_score=3) and (onh=0){p_guardsmen[_run]-=100000;onh=1;} - if (tyranids_score=4) and (onh=0){p_guardsmen[_run]-=500000;onh=1;} - if (tyranids_score>=4) and (onh=0) and (p_guardsmen[_run]<=15000){p_guardsmen[_run]=0;onh=1;} - if (tyranids_score>=5) and (onh=0){p_guardsmen[_run]-=max(floor(p_guardsmen[_run]*0.2),2000000);onh=1;} - // if (tyranids_score>=6) and (onh=0){p_guardsmen[_run]=floor(p_guardsmen[_run]*0.2);onh=1;} - - if (p_guardsmen[_run]<0) then p_guardsmen[_run]=0; - } - }else if (tyranids_attack="pdf"){ - rand2=(choose(1,2,3,4,5)*pdf_score)*choose(1,1.25); - if (rand1>rand2){ - if (tyranids_score>=6) then p_pdf[_run]=0; - if (tyranids_score<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.4+pdf_loss_reduction))); - if (tyranids_score>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.2+pdf_loss_reduction))); - if (tyranids_score>=4) and (p_pdf[_run]<60000) then p_pdf[_run]=0; - } - }else if (tyranids_attack="sisters"){ - rand2=(choose(1,2,3,4,5)*sisters_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_sisters-=1; - } - } - - - - // Necrons attack - if (necrons_score>0) and (necrons_attack!="") and (necrons_attack!="player"){ - rand1=choose(3,4,5,6,7)*necrons_score; - if (necrons_score>=6) then rand1=choose(30,36); - - if (necrons_attack="tau"){ - rand2=(choose(1,2,3,4,5)*planet_forces[eFACTION.Tau])*choose(1,1.25); - if (rand1>rand2) then after_combat_tau-=1; - }else if (necrons_attack="ork"){ - rand2=(choose(1,2,3,4,5)*planet_forces[eFACTION.Ork])*choose(1,1.25); - if (rand1>rand2) then after_combat_ork_force-=1; - }else if (necrons_attack="csm"){ - rand2=(choose(1,2,3,4,5)*csm_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_csm-=1; - }else if (necrons_attack="traitors"){ - rand2=(choose(1,2,3,4,5)*traitors_score)*choose(1,1.25); - if (rand1>rand2) and (traitors_score!=7) then after_combat_csm-=1; - }else if (necrons_attack="imp"){ - if (p_pdf[_run]>0) then necrons_attack="pdf"; - if (p_guardsmen[_run]>0) then necrons_attack="guard"; - }else if (necrons_attack="guard"){ - rand2=(choose(1,2,3,4,5)*guard_score)*choose(1,1.25); - if (rand1>rand2){ - if (necrons_score<=3){ - p_guardsmen[_run]=floor(p_guardsmen[_run]*0.6); - } - else if (necrons_score>=6){ - p_guardsmen[_run]=floor(p_guardsmen[_run]*0.2); - } - else if (necrons_score>=4){ - if (p_guardsmen[_run]<15000){ - p_guardsmen[_run]=0; - } else { - p_guardsmen[_run]=floor(p_guardsmen[_run]*0.5); - } - } - } - }else if (necrons_attack="pdf"){ - rand2=(choose(1,2,3,4,5)*pdf_score)*choose(1,1.25); - if (rand1>rand2){ - if (necrons_score>=6) then p_pdf[_run]=0; - if (necrons_score<=3) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.4+pdf_loss_reduction))); - if (necrons_score>=4) then p_pdf[_run]=floor(p_pdf[_run]*(min(0.95, 0.2+pdf_loss_reduction))); - if (necrons_score>=4) and (p_pdf[_run]<60000) then p_pdf[_run]=0; - } - - - if (p_pdf[_run]=0) and (p_player[_run]<=0) and (p_necrons[_run]>0){ - var _system_overrun=false; - - if (!array_sum(p_pdf,0, 1, planets) && !array_sum(p_guardsmen,0, 1, planets)){ - _system_overrun=true; - } - - if (!_system_overrun) and(p_tyranids[_run] < 5) and(p_orks[_run] = 0) and(p_traitors[_run] = 0) { - scr_alert("red", "owner", $"{_planet_data.name()} has been overwhelmed by Necrons!", x, y); - if (visited == 1) { - if (p_type[_run] == "Forge") { //visited variable check whether the star has been visisted or not 1 for true 0 for false - dispo[_run] -= 10; // 10 Disposition decrease for the planet govrnor if it's overrun by necrons - obj_controller.disposition[3] -= 10; // 10 dis decrease for the faction mechanicus - } else if (planet_feature_bool(p_feature[_run], P_features.Sororitas_Cathedral) or(p_type[_run] == "Shrine")) { - dispo[_run] -= 10; // 10 Disposition decrease for the planet govrnor if it's overrun by necrons - obj_controller.disposition[5] -= 5; // 5 dis decrease for the Nurses - } else dispo[_run] -= 10; - } - } - - if (_system_overrun && p_tyranids[_run]<5 && p_orks[_run]=0 && p_traitors[_run]=0){ - scr_popup("System Lost",$"The {name} system has been ovewhelmed by Necrons!","necron_army",""); - scr_event_log("red",$"System {name} has been overwhelmed by Necrons.", name); - } - } - - } - if (necrons_attack="sisters"){ - rand2=(choose(1,2,3,4,5)*sisters_score)*choose(1,1.25); - if (rand1>rand2) then after_combat_sisters-=1; - } - } - - - - p_orks[_run]=after_combat_ork_force; - p_tau[_run]=after_combat_tau; - p_traitors[_run]=after_combat_traitor; - p_chaos[_run]=after_combat_csm; - p_necrons[_run]=after_combat_necrons; - if (p_tyranids[_run] != after_combat_tyranids){ - p_tyranids[_run] = after_combat_tyranids; - if (_planet_data.has_feature(P_features.Gene_Stealer_Cult)){ - adjust_influence(eFACTION.Tyranids,-min(p_influence[_run][eFACTION.Tyranids]-4, 5),_run); - var _cult = _planet_data.get_features(P_features.Gene_Stealer_Cult)[0]; - if (p_influence[_run][eFACTION.Tyranids]<5){ - _cult.hiding = true; - } - } - } - - p_sisters[_run]=after_combat_sisters; - - - // End stop - } - - - - // 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 + var onh = 0; + if ((tyranids_score == 1) && (onh == 0)) { + p_guardsmen[_run] -= 2000; + onh = 1; + } + if ((tyranids_score == 2) && (onh == 0)) { + p_guardsmen[_run] -= 30000; + onh = 1; + } + if ((tyranids_score == 3) && (onh == 0)) { + p_guardsmen[_run] -= 100000; + onh = 1; + } + if ((tyranids_score == 4) && (onh == 0)) { + p_guardsmen[_run] -= 500000; + onh = 1; + } + if ((tyranids_score >= 4) && (onh == 0) && (p_guardsmen[_run] <= 15000)) { + p_guardsmen[_run] = 0; + onh = 1; + } + if ((tyranids_score >= 5) && (onh == 0)) { + p_guardsmen[_run] -= max(floor(p_guardsmen[_run] * 0.2), 2000000); + onh = 1; + } + // if (tyranids_score>=6) and (onh=0){p_guardsmen[_run]=floor(p_guardsmen[_run]*0.2);onh=1;} + if (p_guardsmen[_run] < 0) { + p_guardsmen[_run] = 0; + } + } + } else if (tyranids_attack == "pdf") { + rand2 = (choose(1, 2, 3, 4, 5) * pdf_score) * choose(1, 1.25); + if (rand1 > rand2) { + if (tyranids_score >= 6) { + p_pdf[_run] = 0; + } + if (tyranids_score <= 3) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.4 + pdf_loss_reduction)); + } + if (tyranids_score >= 4) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.2 + pdf_loss_reduction)); + } + if ((tyranids_score >= 4) && (p_pdf[_run] < 60000)) { + p_pdf[_run] = 0; + } + } + } else if (tyranids_attack == "sisters") { + rand2 = (choose(1, 2, 3, 4, 5) * sisters_score) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_sisters -= 1; + } + } + } - // quene player battles here + // Necrons attack + if ((necrons_score > 0) && (necrons_attack != "") && (necrons_attack != "player")) { + rand1 = choose(3, 4, 5, 6, 7) * necrons_score; + if (necrons_score >= 6) { + rand1 = choose(30, 36); + } + if (necrons_attack == "tau") { + rand2 = (choose(1, 2, 3, 4, 5) * planet_forces[eFACTION.Tau]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_tau -= 1; + } + } else if (necrons_attack == "ork") { + rand2 = (choose(1, 2, 3, 4, 5) * planet_forces[eFACTION.Ork]) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_ork_force -= 1; + } + } else if (necrons_attack == "csm") { + rand2 = (choose(1, 2, 3, 4, 5) * csm_score) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_csm -= 1; + } + } else if (necrons_attack == "traitors") { + rand2 = (choose(1, 2, 3, 4, 5) * traitors_score) * choose(1, 1.25); + if ((rand1 > rand2) && (traitors_score != 7)) { + after_combat_csm -= 1; + } + } else if (necrons_attack == "imp") { + if (p_pdf[_run] > 0) { + necrons_attack = "pdf"; + } + if (p_guardsmen[_run] > 0) { + necrons_attack = "guard"; + } + } else if (necrons_attack == "guard") { + rand2 = (choose(1, 2, 3, 4, 5) * guard_score) * choose(1, 1.25); + if (rand1 > rand2) { + if (necrons_score <= 3) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.6); + } else if (necrons_score >= 6) { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.2); + } else if (necrons_score >= 4) { + if (p_guardsmen[_run] < 15000) { + p_guardsmen[_run] = 0; + } else { + p_guardsmen[_run] = floor(p_guardsmen[_run] * 0.5); + } + } + } + } else if (necrons_attack == "pdf") { + rand2 = (choose(1, 2, 3, 4, 5) * pdf_score) * choose(1, 1.25); + if (rand1 > rand2) { + if (necrons_score >= 6) { + p_pdf[_run] = 0; + } + if (necrons_score <= 3) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.4 + pdf_loss_reduction)); + } + if (necrons_score >= 4) { + p_pdf[_run] = floor(p_pdf[_run] * min(0.95, 0.2 + pdf_loss_reduction)); + } + if ((necrons_score >= 4) && (p_pdf[_run] < 60000)) { + p_pdf[_run] = 0; + } + } - // End quene player battles + if ((p_pdf[_run] == 0) && (p_player[_run] <= 0) && (p_necrons[_run] > 0)) { + var _system_overrun = false; + if (!array_sum(p_pdf, 0, 1, planets) && !array_sum(p_guardsmen, 0, 1, planets)) { + _system_overrun = true; + } + if ((!_system_overrun) && (p_tyranids[_run] < 5) && (p_orks[_run] == 0) && (p_traitors[_run] == 0)) { + scr_alert("red", "owner", $"{_planet_data.name()} has been overwhelmed by Necrons!", x, y); + if (visited == 1) { + if (p_type[_run] == "Forge") { + //visited variable check whether the star has been visisted or not 1 for true 0 for false + dispo[_run] -= 10; // 10 Disposition decrease for the planet govrnor if it's overrun by necrons + obj_controller.disposition[3] -= 10; // 10 dis decrease for the faction mechanicus + } else if (planet_feature_bool(p_feature[_run], P_features.Sororitas_Cathedral) || (p_type[_run] == "Shrine")) { + dispo[_run] -= 10; // 10 Disposition decrease for the planet govrnor if it's overrun by necrons + obj_controller.disposition[5] -= 5; // 5 dis decrease for the Nurses + } else { + dispo[_run] -= 10; + } + } + } - scr_star_ownership(true); + if (_system_overrun && p_tyranids[_run] < 5 && p_orks[_run] == 0 && p_traitors[_run] == 0) { + scr_popup("System Lost", $"The {name} system has been ovewhelmed by Necrons!", "necron_army", ""); + scr_event_log("red", $"System {name} has been overwhelmed by Necrons.", name); + } + } + } + if (necrons_attack == "sisters") { + rand2 = (choose(1, 2, 3, 4, 5) * sisters_score) * choose(1, 1.25); + if (rand1 > rand2) { + after_combat_sisters -= 1; + } + } + } + + p_orks[_run] = after_combat_ork_force; + p_tau[_run] = after_combat_tau; + p_traitors[_run] = after_combat_traitor; + p_chaos[_run] = after_combat_csm; + p_necrons[_run] = after_combat_necrons; + if (p_tyranids[_run] != after_combat_tyranids) { + p_tyranids[_run] = after_combat_tyranids; + if (_planet_data.has_feature(P_features.Gene_Stealer_Cult)) { + adjust_influence(eFACTION.Tyranids, -min(p_influence[_run][eFACTION.Tyranids] - 4, 5), _run); + var _cult = _planet_data.get_features(P_features.Gene_Stealer_Cult)[0]; + if (p_influence[_run][eFACTION.Tyranids] < 5) { + _cult.hiding = true; + } + } + } + p_sisters[_run] = after_combat_sisters; + + // End stop + } + // 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) { + p_owner[_run] = 1; + } + } + } + + if (p_raided[_run] > 0) { + p_raided[_run] = 0; + } + delete _planet_data; + } // end repeat here + + // quene player battles here + + // End quene player battles + + scr_star_ownership(true); // Restock PDF and military var i; i = 0; - repeat(planets) { + repeat (planets) { i += 1; if (p_type[i] == "Daemon") { p_heresy[i] = 200; p_owner[i] = 10; } - if (p_population[i] <= 0) and(p_large[i] = 0) and(p_chaos[i] = 0) and(p_traitors[i] = 0) and(p_tau[i] = 0) and(p_type[i] != "Daemon") then p_heresy[i] = 0; - if (p_population[i] < 1) and(p_large[i] = 1) { + if ((p_population[i] <= 0) && (p_large[i] == 0) && (p_chaos[i] == 0) && (p_traitors[i] == 0) && (p_tau[i] == 0) && (p_type[i] != "Daemon")) { + p_heresy[i] = 0; + } + if ((p_population[i] < 1) && (p_large[i] == 1)) { p_population[i] = p_population[i] * 100000000; p_large[i] = 0; } - if (p_owner[i] = 2) and(p_type[i] != "Dead") and(planets >= i) and(p_tyranids[i] = 0) and(p_chaos[i] = 0) and(p_traitors[i] = 0) and(p_eldar[i] = 0) and(p_tau[i] = 0) { + if ((p_owner[i] == 2) && (p_type[i] != "Dead") && (planets >= i) && (p_tyranids[i] == 0) && (p_chaos[i] == 0) && (p_traitors[i] == 0) && (p_eldar[i] == 0) && (p_tau[i] == 0)) { var military, pdf, rando, contin; military = 0; pdf = 0; @@ -884,28 +1297,28 @@ function scr_enemy_ai_a() { rando = floor(random(100)) + 1; if (p_population[i] >= 10000000) { - military = (p_population[i] / 470); + military = p_population[i] / 470; pdf = floor(military * 0.75); military = floor(military * 0.25); } - if (p_population[i] >= 5000000) and(p_population[i] < 10000000) { + if ((p_population[i] >= 5000000) && (p_population[i] < 10000000)) { military = p_population[i] / 200; pdf = floor(military * 0.75); military = floor(military * 0.25); } - if (p_population[i] >= 100000) and(p_population[i] < 5000000) { + if ((p_population[i] >= 100000) && (p_population[i] < 5000000)) { military = p_population[i] / 50; pdf = floor(military * 0.75); military = floor(military * 0.25); } - if (p_large[i] = 1) { + if (p_large[i] == 1) { military = military * 1000000000; pdf = pdf * 1000000000; } - if (p_large[i] = 0) and(rando < 50) and(military != 0) and(pdf != 0) { + if ((p_large[i] == 0) && (rando < 50) && (military != 0) && (pdf != 0)) { // if (p_guardsmen[i] 5) and(p_large[i] = 0) { + if ((p_population[i] < 100000) && (p_population[i] > 5) && (p_large[i] == 0)) { pdf = floor(p_population[i] / 25); military = 0; } - if (p_population[i] < 2000) and(p_population[i] > 5) and(p_large[i] = 0) { + if ((p_population[i] < 2000) && (p_population[i] > 5) && (p_large[i] == 0)) { pdf = floor(p_population[i] / 10); military = 0; } - if (p_large[i] = 0) and(rando < 3) { + if ((p_large[i] == 0) && (rando < 3)) { // if (p_guardsmen[i] 0) && (p_necrons[i] < 6)) { + p_necrons[i] += 1; + } - for (var i=1;i<=planets;i++){ + var wob = 0; + var fallen = find_problem_planet(i, "fallen"); + if (fallen > -1 && storm - 1 > 0) { + p_timer[i][fallen]++; + } - //this will skip for given planet if no problems associated wiht planet - var numeral_name = planet_numeral_name(i); - if (p_necrons[i]>0) and (p_necrons[i]<6) then p_necrons[i]+=1; - - var wob=0; - var fallen = find_problem_planet(i, "fallen"); - if (fallen>-1 and storm-1>0){ - p_timer[i][fallen]++; - } - - - // Requesting help here - if ((p_halp[i]=1) or (p_halp[i]=1.1)) and (p_population[i]>0) and (p_owner[i]<6){ - if (p_orks[i]+p_tau[i]+p_traitors[i]+p_chaos[i]+p_necrons[i]=0) and (p_tyranids[i]<4) then p_halp[i]=0; - } - if (p_halp[i]=0) and (p_population[i]>0) and (p_owner[i]<6) and (p_owner[i]!=1) and (present_fleet[1]<=0) and (p_player[i]<=0){ - - var enemy1="",enemies=0,minimum=5,tx=""; - - if (p_guardsmen[i]+p_pdf[i]<=1000000) { minimum=4;} - else if (p_guardsmen[i]+p_pdf[i]<=500000) { minimum=3;} - else if (p_guardsmen[i]+p_pdf[i]<=200000) { minimum=2;} - else if (p_guardsmen[i]+p_pdf[i]<=1000) { minimum=1;} - - if (p_orks[i]>=minimum){enemy1="Ork";enemies+=1;} - if (p_tau[i]>=minimum){enemy1="Tau";enemies+=1;} - if (p_traitors[i]>=minimum){enemy1="Heretic";enemies+=1;} - if (p_chaos[i]>=minimum){enemy1="Chaos Space Marine";enemies+=1;} - if (p_necrons[i]>=minimum){enemy1="Necron";enemies+=1;} - if (p_tyranids[i]>=minimum) and (vision>0) and (p_tyranids[i]>3){enemy1="Tyranid";enemies+=1;} - - if (enemies=1){ - p_halp[i]=1; - tx=$"The Planetary Governor of {planet_numeral_name(i)} requests help against {enemy1} forces!"; - scr_alert("green","halp",string(tx),x,y); - scr_event_log("",string(tx), name); - } - if (enemies>1){p_halp[i]=1;tx="The Planetary Governor of "+string(name)+" "+scr_roman(i)+" requests help against numerous enemy forces!"; - scr_alert("green","halp",string(tx),x,y); - scr_event_log("",string(tx), name); - } - } + // Requesting help here + if (((p_halp[i] == 1) || (p_halp[i] == 1.1)) && (p_population[i] > 0) && (p_owner[i] < 6)) { + if ((p_orks[i] + p_tau[i] + p_traitors[i] + p_chaos[i] + p_necrons[i] == 0) && (p_tyranids[i] < 4)) { + p_halp[i] = 0; + } + } + if ((p_halp[i] == 0) && (p_population[i] > 0) && (p_owner[i] < 6) && (p_owner[i] != 1) && (present_fleet[1] <= 0) && (p_player[i] <= 0)) { + var enemy1 = "", enemies = 0, minimum = 5, tx = ""; + + if (p_guardsmen[i] + p_pdf[i] <= 1000000) { + minimum = 4; + } else if (p_guardsmen[i] + p_pdf[i] <= 500000) { + minimum = 3; + } else if (p_guardsmen[i] + p_pdf[i] <= 200000) { + minimum = 2; + } else if (p_guardsmen[i] + p_pdf[i] <= 1000) { + minimum = 1; + } + + if (p_orks[i] >= minimum) { + enemy1 = "Ork"; + enemies += 1; + } + if (p_tau[i] >= minimum) { + enemy1 = "Tau"; + enemies += 1; + } + if (p_traitors[i] >= minimum) { + enemy1 = "Heretic"; + enemies += 1; + } + if (p_chaos[i] >= minimum) { + enemy1 = "Chaos Space Marine"; + enemies += 1; + } + if (p_necrons[i] >= minimum) { + enemy1 = "Necron"; + enemies += 1; + } + if ((p_tyranids[i] >= minimum) && (vision > 0) && (p_tyranids[i] > 3)) { + enemy1 = "Tyranid"; + enemies += 1; + } + + if (enemies == 1) { + p_halp[i] = 1; + tx = $"The Planetary Governor of {planet_numeral_name(i)} requests help against {enemy1} forces!"; + scr_alert("green", "halp", string(tx), x, y); + scr_event_log("", string(tx), name); + } + if (enemies > 1) { + p_halp[i] = 1; + tx = "The Planetary Governor of " + string(name) + " " + scr_roman(i) + " requests help against numerous enemy forces!"; + scr_alert("green", "halp", string(tx), x, y); + scr_event_log("", string(tx), name); + } + } } - for (var i=1;i<=planets;i++){ + for (var i = 1; i <= planets; i++) { problem_count_down(i); - if (planet_problemless(i)) then continue; + if (planet_problemless(i)) { + continue; + } numeral_name = planet_numeral_name(i); - if (has_problem_planet_and_time(i, "succession", 0)){ - var result,alert_text; - var dice1=roll_dice(1, 100); - var dice2=roll_dice(1, 100); - - result=""; - alert_text=""; - if (dice1<=(p_heresy[i]*2)) then result="chaos"; - if (dice2<=(p_influence[i][eFACTION.Tau]*2)) and (result="") then result="tau"; - if (result="") then result="imperial"; - - alert_text=$"War of Succession on {planet_numeral_name(1)} has ended"; - - if (p_owner[i]=2) and (result="chaos"){ - alert_text+=" with Chaos in control."; - dispo[i]=0; - p_owner[i]=10; - p_pdf[i]+=p_guardsmen[i]; - p_guardsmen[i]=0; - scr_alert("red","succession",alert_text,x,y); - } - else if (p_owner[i]=2) and (result="tau"){ - alert_text+=" with a Tau sympathizer in control."; - dispo[i]=10+choose(1,2,3,4,5,6); - p_owner[i]=8; - p_pdf[i]+=p_guardsmen[i]; - p_guardsmen[i]=0; - p_tau[i]=2; - scr_alert("red","succession",alert_text,x,y); - - } else if (result="imperial"){ - alert_text+=" The resultant governor is the most staunch pillar of the imperium."; - }else { - alert_text+=" Word is the new Governor has Heretical leanings and sympathises with xenos."; - } - if (result="imperial"){alert_text+="."; - scr_alert("green","succession",alert_text,x,y); + if (has_problem_planet_and_time(i, "succession", 0)) { + var result, alert_text; + var dice1 = roll_dice(1, 100); + var dice2 = roll_dice(1, 100); + + result = ""; + alert_text = ""; + if (dice1 <= (p_heresy[i] * 2)) { + result = "chaos"; + } + if ((dice2 <= (p_influence[i][eFACTION.Tau] * 2)) && (result == "")) { + result = "tau"; + } + if (result == "") { + result = "imperial"; + } + + alert_text = $"War of Succession on {planet_numeral_name(1)} has ended"; + + if ((p_owner[i] == 2) && (result == "chaos")) { + alert_text += " with Chaos in control."; + dispo[i] = 0; + p_owner[i] = 10; + p_pdf[i] += p_guardsmen[i]; + p_guardsmen[i] = 0; + scr_alert("red", "succession", alert_text, x, y); + } else if ((p_owner[i] == 2) && (result == "tau")) { + alert_text += " with a Tau sympathizer in control."; + dispo[i] = 10 + choose(1, 2, 3, 4, 5, 6); + p_owner[i] = 8; + p_pdf[i] += p_guardsmen[i]; + p_guardsmen[i] = 0; + p_tau[i] = 2; + scr_alert("red", "succession", alert_text, x, y); + } else if (result == "imperial") { + alert_text += " The resultant governor is the most staunch pillar of the imperium."; + } else { + alert_text += " Word is the new Governor has Heretical leanings and sympathises with xenos."; + } + if (result == "imperial") { + alert_text += "."; + scr_alert("green", "succession", alert_text, x, y); } delete_features(p_feature[i], P_features.Succession_War); - if (result="chaos") then scr_event_log("purple",alert_text); - if (result="tau") then scr_event_log("red",alert_text); - if (result="imperial") then scr_event_log("",alert_text); + if (result == "chaos") { + scr_event_log("purple", alert_text); + } + if (result == "tau") { + scr_event_log("red", alert_text); + } + if (result == "imperial") { + scr_event_log("", alert_text); + } remove_planet_problem(i, "succession"); - } - if (has_problem_planet_and_time(i, "recon", 0)>-1){ - var alert_text="Inquisition Mission Failed: Investigate "; - alert_text+=string(name)+" "+scr_roman(i)+"."; - scr_alert("red","mission_failed",alert_text,0,0); - scr_event_log("red",alert_text); - obj_controller.disposition[4]-=5; + } + if (has_problem_planet_and_time(i, "recon", 0) > -1) { + var alert_text = "Inquisition Mission Failed: Investigate "; + alert_text += string(name) + " " + scr_roman(i) + "."; + scr_alert("red", "mission_failed", alert_text, 0, 0); + scr_event_log("red", alert_text); + obj_controller.disposition[4] -= 5; remove_planet_problem(i, "recon"); } - if (has_problem_planet_and_time(i, "great_crusade", 0)>-1){ + if (has_problem_planet_and_time(i, "great_crusade", 0) > -1) { var dir; - var join_crusade=false; - var _player_fleet = instance_nearest(x,y,obj_p_fleet); - - if (_player_fleet.action=""){ - if (point_distance(x, y, _player_fleet.x, _player_fleet.y)<10 ){ - join_crusade=true; + var join_crusade = false; + var _player_fleet = instance_nearest(x, y, obj_p_fleet); + + if (_player_fleet.action == "") { + if (point_distance(x, y, _player_fleet.x, _player_fleet.y) < 10) { + join_crusade = true; } } - - if (join_crusade){ - dir=point_direction(room_width/2,room_height/2,x,y); - with (_player_fleet){ - action_x=x+lengthdir_x(1200,dir); - action_y=y+lengthdir_y(1200,dir); + + if (join_crusade) { + dir = point_direction(room_width / 2, room_height / 2, x, y); + with (_player_fleet) { + action_x = x + lengthdir_x(1200, dir); + action_y = y + lengthdir_y(1200, dir); set_fleet_movement(false, "crusade1"); } - scr_alert("green","crusade","Fleet embarks upon Crusade.",x,y); - scr_event_log("","Fleet embarks upon Crusade."); - }else { + scr_alert("green", "crusade", "Fleet embarks upon Crusade.", x, y); + scr_event_log("", "Fleet embarks upon Crusade."); + } else { // hit loyalty here - obj_controller.disposition[eFACTION.Imperium]-=5; - obj_controller.disposition[4]-=10; - scr_alert("red","crusade","No ships designated for Crusade.",x,y); - scr_loyalty("Refusing to Crusade","+"); - scr_event_log("red","No ships designated for Crusade."); - if (obj_controller.penitent=1) then obj_controller.penitent_current=0; - } - remove_planet_problem(i, "great_crusade"); + obj_controller.disposition[eFACTION.Imperium] -= 5; + obj_controller.disposition[4] -= 10; + scr_alert("red", "crusade", "No ships designated for Crusade.", x, y); + scr_loyalty("Refusing to Crusade", "+"); + scr_event_log("red", "No ships designated for Crusade."); + if (obj_controller.penitent == 1) { + obj_controller.penitent_current = 0; + } + } + remove_planet_problem(i, "great_crusade"); } mechanicus_missions_end_turn(i); - if (has_problem_planet_and_time(i,"bomb", 0)>-1){ + if (has_problem_planet_and_time(i, "bomb", 0) > -1) { + var alert_text = "The Necron Tomb of planet "; - var alert_text="The Necron Tomb of planet "; + alert_text += $"{numeral_name} has not been deactivated in time. It has awakened, rank upon rank of Necrons pouring out to the planet's surface. The Inquisition is not pleased with your failure."; + scr_popup("Inquisition Mission Failed", alert_text, "necron_army", ""); + scr_event_log("red", $"Inquisition Mission Failed: Bombing run failed; the Necron Tomb on {planet_numeral_name(i)} has become active."); - alert_text+=$"{numeral_name} has not been deactivated in time. It has awakened, rank upon rank of Necrons pouring out to the planet's surface. The Inquisition is not pleased with your failure."; - scr_popup("Inquisition Mission Failed",alert_text,"necron_army",""); - scr_event_log("red",$"Inquisition Mission Failed: Bombing run failed; the Necron Tomb on {planet_numeral_name(i)} has become active."); - - p_necrons[i]=4; - if (awake_tomb_world(p_feature[i])==0) then awaken_tomb_world(p_feature[i]); - remove_planet_problem(i,"necron"); + p_necrons[i] = 4; + if (awake_tomb_world(p_feature[i]) == 0) { + awaken_tomb_world(p_feature[i]); + } + remove_planet_problem(i, "necron"); // scr_alert("red","mission_failed",alert_text,0,0); - obj_controller.disposition[4]-=8; + obj_controller.disposition[4] -= 8; } - if (has_problem_planet_and_time(i,"inquisitor1", 6)>-1|| has_problem_planet_and_time(i,"inquisitor2", 6)>-1){ - var flit, x7,y7,drr; - drr=random(floor(360))+1; - x7=x+lengthdir_x(384,drr); - y7=y+lengthdir_y(384,drr); - - if (x7<0) or (x7>room_width) or (y7>room_height) or (y7<0){ - drr=point_direction(x,y,room_width/2,room_height/2); - x7=x+lengthdir_x(384,drr);y7=y+lengthdir_y(384,drr); - } - + if (has_problem_planet_and_time(i, "inquisitor1", 6) > -1 || has_problem_planet_and_time(i, "inquisitor2", 6) > -1) { + var flit, x7, y7, drr; + drr = random(floor(360)) + 1; + x7 = x + lengthdir_x(384, drr); + y7 = y + lengthdir_y(384, drr); + + if ((x7 < 0) || (x7 > room_width) || (y7 > room_height) || (y7 < 0)) { + drr = point_direction(x, y, room_width / 2, room_height / 2); + x7 = x + lengthdir_x(384, drr); + y7 = y + lengthdir_y(384, drr); + } + // show_message("x1:"+string(x)+", y1:"+string(y)+"#x2:"+string(x7)+", y2:"+string(y7)); - - flit=instance_create(x7,y7,obj_en_fleet); - if (has_problem_planet_and_time(i,"inquisitor1", 6)) then flit.trade_goods="male_her"; - if (has_problem_planet_and_time(i,"inquisitor2", 6)) then flit.trade_goods="female_her"; - flit.action_x=x; - flit.action_y=y; - with (flit){ - owner = eFACTION.Inquisition; - sprite_index=spr_fleet_inquisition; - image_index=0; - action_spd=128; - escort_number=1; - set_fleet_movement() - } - remove_planet_problem(i,"inquisitor1"); - remove_planet_problem(i,"inquisitor2"); + + flit = instance_create(x7, y7, obj_en_fleet); + if (has_problem_planet_and_time(i, "inquisitor1", 6)) { + flit.trade_goods = "male_her"; + } + if (has_problem_planet_and_time(i, "inquisitor2", 6)) { + flit.trade_goods = "female_her"; + } + flit.action_x = x; + flit.action_y = y; + with (flit) { + owner = eFACTION.Inquisition; + sprite_index = spr_fleet_inquisition; + image_index = 0; + action_spd = 128; + escort_number = 1; + set_fleet_movement(); + } + remove_planet_problem(i, "inquisitor1"); + remove_planet_problem(i, "inquisitor2"); } - if (has_problem_planet_and_time(i,"spyrer", 0)>-1){ - var alert_text,text; + if (has_problem_planet_and_time(i, "spyrer", 0) > -1) { + var alert_text, text; var planet_name = planet_numeral_name(i, self); - alert_text=$"The Spyrer on {planet_name} has been left unchecked. In the ensuing carnage some high-ranking officials have been killed, along with several Nobles. Panic is running amock in several parts of the hives and the Inquisition is less than pleased."; - text="Inquisition Mission Failed: The Spyrer on {planet_name} was not removed."; - scr_popup("Inquisition Mission Failed",alert_text,"spyrer",""); - obj_controller.disposition[eFACTION.Inquisition]-=3; - scr_event_log("red",text); - remove_planet_problem(i,"spyrer"); - } - if (has_problem_planet_and_time(i,"fallen", 0)>-1){ + alert_text = $"The Spyrer on {planet_name} has been left unchecked. In the ensuing carnage some high-ranking officials have been killed, along with several Nobles. Panic is running amock in several parts of the hives and the Inquisition is less than pleased."; + text = "Inquisition Mission Failed: The Spyrer on {planet_name} was not removed."; + scr_popup("Inquisition Mission Failed", alert_text, "spyrer", ""); + obj_controller.disposition[eFACTION.Inquisition] -= 3; + scr_event_log("red", text); + remove_planet_problem(i, "spyrer"); + } + if (has_problem_planet_and_time(i, "fallen", 0) > -1) { //TODO marker point for cohesion mechanics - var alert_text=""; + var alert_text = ""; var unit; - if (irandom(100)>33){// Give all marines +3d6 corruption and reduce loyalty by 20*/ - var me=0; - for (var co=0;co<=obj_ini.companies;co++){ - me=0; - for (me=0;me 33) { + // Give all marines +3d6 corruption and reduce loyalty by 20*/ + var me = 0; + for (var co = 0; co <= obj_ini.companies; co++) { + me = 0; + for (me = 0; me < array_length(obj_ini.role[co]); me++) { + if ((obj_ini.race[co][me] == 1) && (obj_ini.role[co][me] != "")) { + unit = fetch_unit([co, me]); unit.edit_corruption(irandom_range(3, 6)); unit.alter_loyalty(10); } } } } - alert_text=$"Any Fallen that may have been on {planet_numeral_name(i)} "; - alert_text+="have been given sufficient time to escape. Morale within your chapter has plummeted; some of your battle brothers have become restless and speak among eachother in hushed tones."; - scr_popup("Hunt the Fallen Failed",alert_text + "\n\n(Chapter wide loyalty: -10)\nChaplains note marked changes in behaviour of some brothers" ,"fallen",""); - obj_controller.loyalty-=10; - obj_controller.loyalty_hidden-=10; - remove_planet_problem(i,"fallen"); - scr_event_log("red",$"Mission Failed: Any Fallen within the {name} system have been given time to escape."); + alert_text = $"Any Fallen that may have been on {planet_numeral_name(i)} "; + alert_text += "have been given sufficient time to escape. Morale within your chapter has plummeted; some of your battle brothers have become restless and speak among eachother in hushed tones."; + scr_popup("Hunt the Fallen Failed", alert_text + "\n\n(Chapter wide loyalty: -10)\nChaplains note marked changes in behaviour of some brothers", "fallen", ""); + obj_controller.loyalty -= 10; + obj_controller.loyalty_hidden -= 10; + remove_planet_problem(i, "fallen"); + scr_event_log("red", $"Mission Failed: Any Fallen within the {name} system have been given time to escape."); } - var garrison_mission = has_problem_planet_and_time(i,"provide_garrison", 0); - if (garrison_mission>-1){ - try_and_report_loop("complete garrison mission", complete_garrison_mission,true, [i,garrison_mission]); + var garrison_mission = has_problem_planet_and_time(i, "provide_garrison", 0); + if (garrison_mission > -1) { + try_and_report_loop("complete garrison mission", complete_garrison_mission, true, [i, garrison_mission]); } - var _beast_hunt = has_problem_planet_and_time(i,"hunt_beast", 0); - if (_beast_hunt>-1){ - try{ - complete_beast_hunt_mission(i,_beast_hunt); - } catch (_exception){ + var _beast_hunt = has_problem_planet_and_time(i, "hunt_beast", 0); + if (_beast_hunt > -1) { + try { + complete_beast_hunt_mission(i, _beast_hunt); + } catch (_exception) { handle_exception(_exception); } } - var train_forces = has_problem_planet_and_time(i,"train_forces", 0); - if (train_forces>-1){ - try{ - complete_train_forces_mission(i,train_forces); - } catch (_exception){ + var train_forces = has_problem_planet_and_time(i, "train_forces", 0); + if (train_forces > -1) { + try { + complete_train_forces_mission(i, train_forces); + } catch (_exception) { handle_exception(_exception); } - } - - if ((p_tyranids[i]=3) or (p_tyranids[i]=4)) and (p_population[i]>0){ - if (!(has_problem_planet(i, "Hive Fleet"))){ - var roll=irandom_range(100,300); - var cont=0; - - - if (p_tyranids[i]=3) and (roll<=5) then cont=1; - if (p_tyranids[i]=4) and (roll<=8) then cont=1; - - var firstest=open_problem_slot(i); - if (cont=1 && firstest>-1){ - - p_problem[i][firstest]="Hive Fleet"; - p_timer[i][firstest]=irandom_range(60,120)+1; - p_timer[i][firstest]+=irandom_range(80,120)+1; - // p_timer[i][firstest]=floor(random_range(3,6))+1; - // show_message("Hive Fleet Destination: "+string(name)+"#ETA: "+string(p_timer[i][firstest])); - - - var fleet, xx, yy; - xx=random_range(room_width*1.25,room_width*2); - xx=choose(xx*-1,xx); - xx=x+xx; - yy=random_range(room_height*1.25,room_height*2); - yy=choose(yy*-1,yy); - yy=y+yy; - fleet=instance_create(xx,yy,obj_en_fleet); - fleet.owner = eFACTION.Tyranids; - fleet.sprite_index=spr_fleet_tyranid; - fleet.image_speed=0; - - fleet.capital_number=choose(7,8,9); - fleet.frigate_number=round(random_range(6,12)); - fleet.escort_number=round(random_range(12,27)); - - /*fleet.capital_number=choose(5,6); + } + + if (((p_tyranids[i] == 3) || (p_tyranids[i] == 4)) && (p_population[i] > 0)) { + if (!has_problem_planet(i, "Hive Fleet")) { + var roll = irandom_range(100, 300); + var cont = 0; + + if ((p_tyranids[i] == 3) && (roll <= 5)) { + cont = 1; + } + if ((p_tyranids[i] == 4) && (roll <= 8)) { + cont = 1; + } + + var firstest = open_problem_slot(i); + if (cont == 1 && firstest > -1) { + p_problem[i][firstest] = "Hive Fleet"; + p_timer[i][firstest] = irandom_range(60, 120) + 1; + p_timer[i][firstest] += irandom_range(80, 120) + 1; + // p_timer[i][firstest]=floor(random_range(3,6))+1; + // show_message("Hive Fleet Destination: "+string(name)+"#ETA: "+string(p_timer[i][firstest])); + + var fleet, xx, yy; + xx = random_range(room_width * 1.25, room_width * 2); + xx = choose(xx * -1, xx); + xx = x + xx; + yy = random_range(room_height * 1.25, room_height * 2); + yy = choose(yy * -1, yy); + yy = y + yy; + fleet = instance_create(xx, yy, obj_en_fleet); + fleet.owner = eFACTION.Tyranids; + fleet.sprite_index = spr_fleet_tyranid; + fleet.image_speed = 0; + + fleet.capital_number = choose(7, 8, 9); + fleet.frigate_number = round(random_range(6, 12)); + fleet.escort_number = round(random_range(12, 27)); + + /*fleet.capital_number=choose(5,6); fleet.frigate_number=round(random_range(4,8)); fleet.escort_number=round(random_range(8,18));*/ - - fleet.image_index=floor((fleet.capital_number)+(fleet.frigate_number/2)+(fleet.escort_number/4)); - fleet.image_alpha=0; - - fleet.action_x=x; - fleet.action_y=y; - - fleet.action_eta=p_timer[i][firstest]; - fleet.action="move"; - } - - - } - - } - - if (has_problem_planet_and_time(i,"Hive Fleet", 3)>-1){ - var woop=scr_role_count("Chief "+string(obj_ini.role[100,17]),""); - - var o,yep,yep2;o=0;yep=true;yep2=false; - if (scr_has_disadv("Psyker Intolerant")) then yep=false; - - if (obj_controller.known[eFACTION.Tyranids]=0) and (woop!=0) and (yep!=false){ - scr_popup("Shadow in the Warp",$"Chief {obj_ini.role[100,17]} "+string(obj_ini.name[0,5])+" reports a disturbance in the warp. He claims it is like a shadow.","shadow",""); - scr_event_log("red",$"Chief {obj_ini.role[100,17]} reports a disturbance in the warp. He claims it is like a shadow."); - } - if (obj_controller.known[eFACTION.Tyranids]=0) and (woop=0) and (yep!=false){ - var q=0,q2=0; - repeat(90){ - if (q2=0){q+=1; - if (obj_ini.role[0,q]==obj_ini.role[100][eROLE.ChapterMaster]){q2=q; - if (string_count("0",obj_ini.spe[0,q2])>0) then yep2=true; + + fleet.image_index = floor(fleet.capital_number + (fleet.frigate_number / 2) + (fleet.escort_number / 4)); + fleet.image_alpha = 0; + + fleet.action_x = x; + fleet.action_y = y; + + fleet.action_eta = p_timer[i][firstest]; + fleet.action = "move"; + } + } + } + + if (has_problem_planet_and_time(i, "Hive Fleet", 3) > -1) { + var woop = scr_role_count("Chief " + string(obj_ini.role[100][17]), ""); + + var o, yep, yep2; + o = 0; + yep = true; + yep2 = false; + if (scr_has_disadv("Psyker Intolerant")) { + yep = false; + } + + if ((obj_controller.known[eFACTION.Tyranids] == 0) && (woop != 0) && (yep != false)) { + scr_popup("Shadow in the Warp", $"Chief {obj_ini.role[100][17]} " + string(obj_ini.name[0][5]) + " reports a disturbance in the warp. He claims it is like a shadow.", "shadow", ""); + scr_event_log("red", $"Chief {obj_ini.role[100][17]} reports a disturbance in the warp. He claims it is like a shadow."); + } + if ((obj_controller.known[eFACTION.Tyranids] == 0) && (woop == 0) && (yep != false)) { + var q = 0, q2 = 0; + repeat (90) { + if (q2 == 0) { + q += 1; + if (obj_ini.role[0][q] == obj_ini.role[100][eROLE.ChapterMaster]) { + q2 = q; + if (string_count("0", obj_ini.spe[0][q2]) > 0) { + yep2 = true; + } } } } - if (yep2=true){ - scr_popup("Shadow in the Warp","You are distracted and bothered by a nagging sensation in the warp. It feels as though a shadow descends upon your sector.","shadow",""); - scr_event_log("red","You sense a disturbance in the warp. It feels something like a massive shadow."); + if (yep2 == true) { + scr_popup("Shadow in the Warp", "You are distracted and bothered by a nagging sensation in the warp. It feels as though a shadow descends upon your sector.", "shadow", ""); + scr_event_log("red", "You sense a disturbance in the warp. It feels something like a massive shadow."); } } - - - - g=50; - i=50; - obj_controller.known[eFACTION.Tyranids]=1; + + g = 50; + i = 50; + obj_controller.known[eFACTION.Tyranids] = 1; + } + } + + if (storm > 0) { + storm -= 1; + if (storm == 0) { + var tr = "Warp Storms over " + string(name) + " dissipate."; + scr_alert("green", "Warp", tr, x, y); + scr_event_log("green", tr); + } + } + if (trader > 0) { + trader -= 1; + if (trader == 0) { + var tr = "Rogue Trader fleet departs from " + string(name) + "."; + scr_alert("green", "Warp", tr, x, y); + scr_event_log("green", tr); + } + } + + // Colonists Colonize + + with (obj_star) { + if (x < -10000) { + x += 20000; + y += 20000; + } + } + with (obj_star) { + if (x < -10000) { + x += 20000; + y += 20000; } - } - - - if (storm>0){ - storm-=1; - if (storm=0){ - var tr="Warp Storms over "+string(name)+" dissipate."; - scr_alert("green","Warp",tr,x,y);scr_event_log("green",tr); - } - } - if (trader>0){ - trader-=1; - if (trader=0){ - var tr="Rogue Trader fleet departs from "+string(name)+"."; - scr_alert("green","Warp",tr,x,y);scr_event_log("green",tr); - } - } - - - // Colonists Colonize - - with(obj_star){if (x<-10000){x+=20000;y+=20000;}} - with(obj_star){if (x<-10000){x+=20000;y+=20000;}} + } var already_enroute = false; var cur_star = id; - with(obj_en_fleet){ - if (owner = eFACTION.Imperium) and (fleet_has_cargo("colonize")){ - already_enroute = (action_x == cur_star.x && action_y == cur_star.y); - } - }; + with (obj_en_fleet) { + if ((owner == eFACTION.Imperium) && fleet_has_cargo("colonize")) { + already_enroute = action_x == cur_star.x && action_y == cur_star.y; + } + } - if (!already_enroute){ + if (!already_enroute) { var pop_doner_options = []; //this stops needless repeats of searches - if (!struct_exists(obj_controller.end_turn_insights, "population_doners")){ + if (!struct_exists(obj_controller.end_turn_insights, "population_doners")) { pop_doner_options = find_population_doners(); } obj_controller.end_turn_insights.population_doners = pop_doner_options; pop_doner_options = obj_controller.end_turn_insights.population_doners; - - var deletion=-1; - for (var i=0;i -1){ + if (deletion > -1) { array_delete(pop_doner_options, deletion, 1); } - + var priority_requests = []; var non_priority_requests = []; - - var r=0,yep=0; - for (r=1;r<=planets;r++){// temp5: new hive, temp4: new planet - if (!scr_planet_owned_by_group(r,fetch_faction_group())) then continue; - if ((p_population[r]>0) || (p_type[r]=="")) then continue; - if (!space_hulk) and (!craftworld) and (p_type[r]!="Dead"){ - - var priority_imperium = ["Hive", "Temperate","Shrine"]; - if (p_owner[r]=eFACTION.Imperium) && (array_contains(priority_imperium, p_type[r]) ) { + + var r = 0, yep = 0; + for (r = 1; r <= planets; r++) { + // temp5: new hive, temp4: new planet + if (!scr_planet_owned_by_group(r, fetch_faction_group())) { + continue; + } + if ((p_population[r] > 0) || (p_type[r] == "")) { + continue; + } + if ((!space_hulk) && (!craftworld) && (p_type[r] != "Dead")) { + var priority_imperium = ["Hive", "Temperate", "Shrine"]; + if ((p_owner[r] == eFACTION.Imperium) && array_contains(priority_imperium, p_type[r])) { array_push(priority_requests, r); break; } - - if (p_owner[r]==eFACTION.Mechanicus) && (p_type[r]=="Forge"){ + + if ((p_owner[r] == eFACTION.Mechanicus) && (p_type[r] == "Forge")) { array_push(priority_requests, r); break; } // Count player planets as HIVE PLANETS so that they are prioritized - if (p_owner[r]=eFACTION.Player) { + if (p_owner[r] == eFACTION.Player) { array_push(priority_requests, r); break; } - - if ((p_owner[r]==eFACTION.Imperium) or (p_owner[r]==eFACTION.Ecclesiarchy)){ + + if ((p_owner[r] == eFACTION.Imperium) || (p_owner[r] == eFACTION.Ecclesiarchy)) { array_push(non_priority_requests, r); } } } - - if (array_length(pop_doner_options)>0 && (array_length(non_priority_requests) || array_length(priority_requests))){ - var onceh=0; - var random_chance=floor(random(100))+1; + + if (array_length(pop_doner_options) > 0 && (array_length(non_priority_requests) || array_length(priority_requests))) { + var onceh = 0; + var random_chance = floor(random(100)) + 1; var doner_index = 0; - // TODO check possible fixes for this logic - // currently this only calculates for priority requests for pops - for(var i=1;i=36){p+=1;gossip[p]="past_battles";} - if (string_count("&",obj_ini.armour[attend_co[argument0],attend_id[argument0]])>0){p+=1;gossip[p]="artifact_armour";} - if (string_count("&",obj_ini.wep1[attend_co[argument0],attend_id[argument0]])>0){p+=1;gossip[p]="artifact_wep";} - if (string_count("&",obj_ini.wep2[attend_co[argument0],attend_id[argument0]])>0){p+=1;gossip[p]="artifact_wep";} - // if (string_count("&",obj_ini.gear[attend_co[argument0],attend_id[argument0]])>0){p+=1;gossip[p]="artifact_gear";} - if (obj_ini.mobi[attend_co[argument0],attend_id[argument0]]="Bike"){p+=1;gossip[p]="mah_bike";} - if (obj_ini.mobi[attend_co[argument0],attend_id[argument0]]="Jump Pack"){p+=1;gossip[p]="mah_jump";} - - with(obj_ground_mission){instance_destroy();} - with(obj_star){if (owner = eFACTION.Ork) then instance_create(x,y,obj_ground_mission);} - if (instance_number(obj_ground_mission)>4) and (obj_controller.known[eFACTION.Ork]>0) and (obj_controller.faction_defeated[7]=0){ - p+=1; - gossip[p]="ork_waaagh"; - } - with(obj_ground_mission){instance_destroy();} - - if (obj_controller.marines<=400){p+=1;gossip[p]="small_chapter";} - p+=1;gossip[p]="eager"; - - - with(obj_ground_mission){instance_destroy();}with(obj_star){if (owner = eFACTION.Ork) then instance_create(x,y,obj_ground_mission);} - if (instance_number(obj_ground_mission)>=8){p+=1;gossip[p]="ork_numbers";}with(obj_ground_mission){instance_destroy();} - - with(obj_ground_mission){instance_destroy();}with(obj_star){if (owner = eFACTION.Tau) then instance_create(x,y,obj_ground_mission);} - if (instance_number(obj_ground_mission)>=8){p+=1;gossip[p]="tau_numbers";}with(obj_ground_mission){instance_destroy();} - - with(obj_ground_mission){instance_destroy();}with(obj_star){if (owner = eFACTION.Chaos) then instance_create(x,y,obj_ground_mission);} - if (instance_number(obj_ground_mission)>=8){p+=1;gossip[p]="chaos_numbers";}with(obj_ground_mission){instance_destroy();} - - if (obj_controller.faction_status[eFACTION.Inquisition]!="War") and (obj_controller.disposition[eFACTION.Inquisition]<=25){p+=1;gossip[p]="low_dispo_inqi";} - if (obj_controller.faction_status[eFACTION.Imperium]!="War") and (obj_controller.disposition[eFACTION.Imperium]<=25){p+=1;gossip[p]="low_dispo_impe";} - if (obj_controller.faction_status[eFACTION.Mechanicus]!="War") and (obj_controller.disposition[eFACTION.Mechanicus]<=25){p+=1;gossip[p]="low_dispo_mech";} - - if (obj_controller.known[eFACTION.Eldar]>0) and (obj_controller.faction_defeated[eFACTION.Eldar]=0) and (obj_controller.faction_status[eFACTION.Eldar]!="Allied"){p+=1;gossip[p]="smack_talk_eldar";} - if (obj_controller.known[eFACTION.Ork]>0) and (obj_controller.faction_defeated[eFACTION.Ork]=0) and (obj_controller.faction_status[eFACTION.Ork]!="Allied"){p+=1;gossip[p]="smack_talk_orks";} - if (obj_controller.known[eFACTION.Tau]>0) and (obj_controller.faction_defeated[eFACTION.Tau]=0) and (obj_controller.faction_status[eFACTION.Tau]!="Allied"){p+=1;gossip[p]="smack_talk_tau";} - if (obj_controller.known[eFACTION.Tyranids]>0) and (obj_controller.faction_defeated[eFACTION.Tyranids]=0) and (obj_controller.faction_status[eFACTION.Tyranids]!="Allied"){p+=1;gossip[p]="smack_talk_tyranids";} - if (obj_controller.known[eFACTION.Chaos]>0) and (obj_controller.faction_defeated[eFACTION.Chaos]=0) and (obj_controller.faction_status[eFACTION.Chaos]!="Allied"){p+=1;gossip[p]="smack_talk_chaos";} - - // All of the custom ones above - // Recent events below - - var t;t=0; - repeat(obj_controller.recent_happenings){t+=1; - if (obj_controller.recent_type[t]!="") and (obj_controller.recent_turn[t]+12>=obj_controller.turn){ - p+=1;gossip[p]="recent";gossip_recent[p]=p; - } - } - - possible_gossips=p; - - - that=floor(random(possible_gossips))+1; - that_type=string(gossip[that]); - - var na,ra; - na=obj_ini.name[attend_co[argument0],attend_id[argument0]]; - ra=obj_ini.role[attend_co[argument0],attend_id[argument0]]; - - - // Getting there - words=string(ra)+" "+string(na)+" "; - - if (that_type="future_battles"){ - words+=choose("recounts","retells","tells","speaks of")+" future glorious battles that the Chapter will partake of, in glory of "+choose("our honor","The Emperor","The Imperium","Primarch")+"."; - } - if (that_type="past_battles"){ - words+=choose("recounts","retells","tells","speaks of")+" past glorious battles that the Chapter partook of, in glory of "+choose("our honor","The Emperor","The Imperium","Primarch")+"."; - } - if (that_type="artifact_armour"){rando=choose(1,2); - if (rando=1) then words+="speaks fondly of his Artifact Armour. Several adjacent Astartes recall the mighty item with envy."; - if (rando=2) then words+="speaks of his Artifact Armour in a reverent tone. May it protect him in many more battles to come."; - } - if (that_type="artifact_wep"){rando=choose(1,2); - if (rando=1) then words+="speaks fondly of his Artifact weapon. Several adjacent Astartes recall the mighty item with envy."; - if (rando=2) then words+="speaks of his Artifact weapon in a reverent tone. May he kill hundreds more "+choose("xeno scum","heretics")+" with it."; - } - if (that_type="mah_bike"){rando=choose(1,2,3); - words+="speaks of his Bike with fondness. How glorious it is to "; - if (rando=1) then words+="crush foes of the Imperium beneath its wheels."; - if (rando=2) then words+="rush across battlefields at frightening speeds."; - if (rando=3) then words+="unload the foreward-mounted dual bolters on foul heretics."; - } - if (that_type="mah_jump"){rando=choose(1,2); - words+="speaks of his Jump Pack fondly. How glorious it is to "; - if (rando=1) then words+="crash upon foes from high above and rout them."; - if (rando=2) then words+="launch across the battlefield in mighty, burning leaps."; - } - if (that_type="ork_waaagh"){ - words+="expresses concern about the current Ork WAAAGH!. How many more systems will be overrun before the warboss is purged?"; - } - if (that_type="small_chapter"){ - words+="is concerned about the current size of the "+string(global.chapter_name)+". Only "+string(obj_controller.marines)+" battle brothers remain."; - } - if (that_type="eager"){rando=choose(1,2,3); - if (rando=1) then words+="is eager to enter the field of battle once more."; - if (rando=2) then words+="is eager to purge more xenos scum."; - if (rando=3) then words+="is eager to kill more heretics, for Primarch and Emperor."; - } - if (that_type="ork_numbers"){ - words+="curses the Ork menace and their numbers- the greenskins must be met with Bolter and Flamer, sooner than later."; - } - if (that_type="tau_numbers"){ - words+="curses the Tau for their unwant corruption of the Imperium's citizens. The xenos must be purged, down to the last one."; - } - if (that_type="chaos_numbers"){ - words+="curses the foul traitors for their heresy and corruption of the sector. Something must be done to end them for good."; - } - if (that_type="low_dispo_inqi"){ - if (him_chaos<50) then words+="is concerned about the Inquisition's view of the "+string(global.chapter_name)+", and the trouble that may entail."; - if (him_chaos>=50) then words+="curses the Inquisition for their meddling with the "+string(global.chapter_name)+". Something has to change."; - } - if (that_type="low_disp_impe"){ - // Couple variants for amount of chaos? - if (him_chaos<=30) then words+="is concerned about the Imperium's view of the "+string(global.chapter_name)+". They should view the chapter with respect and fear, not scorn."; - if (him_chaos<=66) and (him_chaos>30) then words+="is displeased with the Imperium's view of the "+string(global.chapter_name)+". After all the chapter has done for them they are ungrateful."; - if (him_chaos<=200) and (him_chaos>66) then words+="curses the Imperium for their view of the "+string(global.chapter_name)+". The weak, and petty must be corrected by force if needed, before they forget their place in the universe."; - } - if (that_type="low_disp_mech"){ - words+="is concerned with the Mechanicus' low opinion of the "+string(global.chapter_name)+" and the trouble that may entail."; - } - if (that_type="smack_talk_eldar"){rando=choose(1,2,3); - if (rando=1) then words+="curses the arrogant Eldar and their meddling. They will be a lot less haughty with a chainsword through the gut."; - if (rando=2) then words+="looks forward to when he may purge more Eldar scum."; - if (rando=3) then words+="wishes to purge some Eldar. The arrogant xenos scum must learn their place."; - } - if (that_type="smack_talk_orks"){rando=choose(1,2); - if (rando=1) then words+="curses the damned greenskins for their wanton destruction of Imperial worlds."; - if (rando=2) then words+="wishes to purge some Orks, sooner than later. Much like weeds, their numbers must be cut down."; - } - if (that_type="smack_talk_tau"){rando=choose(1,2,3); - if (rando=1) then words+="curses the Tau for their subversive methods and mockery of technology. Purging some Tau would be cathartic."; - if (rando=2) then words+="wishes to purge some Tau, sooner than later. Watching their armour and vehicles explode in blue flames is enjoyable."; - if (rando=3) then words+="boasts he will kill a Tau Ethereal one day."; - } - if (that_type="smack_talk_tyranids"){rando=choose(1,2,3); - if (rando=1) then words+="curses the Tyranids for the threat they pose to the sector. They will be defeated, each time, but at what cost?"; - if (rando=2) then words+="ponders how a Tyranid head would look on one of his pauldrons. He asks some adjacent battle brothers for their input on the matter."; - } - if (that_type="smack_talk_chaos"){rando=choose(1,2); - if (rando=1) then words+="seethes and curses the damned traitors for their ongoing heresy. Their current leader must be purged, with extreme prejudice."; - if (rando=2) then words+="wishes to purge more heretics. Cleaning the homes of the damned with flamer is cathartic for him."; - } - - - - - - - - - if (that_type="recent"){ - var r_num,cn,blah; - r_num=gossip_recent[that]; - cn=obj_controller; - blah=string(cn.recent_type[gossip_recent[that]]); - - if (blah="eldar_mission") and (cn.recent_keyword[gossip_recent[that]]="completed") and (cn.recent_number[gossip_recent[that]]=1){ - words+="is concerned about the Chapter Master's decision to help the Eldar. Is it not a Space Marine's duty to cleanse and purge xenos, rather than collaborate with them?" - } - if (blah="artifact_recovered"){ - words+="wonders what secrets the newly discovered Artifact may hold."; - } - if (blah="stc_recovered"){ - words+="wonders what secrets the newly discovered STC Fragment may hold."; - } - if (blah="fleet_defeat"){ - var nba;nba=cn.recent_number[gossip_recent[that]]; - if (nba<=3) then words+="deplores the loss of the scouting fleet at "+string(cn.recent_keyword[gossip_recent[that]])+"."; - if (nba>3) and (nba<=7) then words+="laments the loss of the fleet at "+string(cn.recent_keyword[gossip_recent[that]])+"."; - if (nba>7) and (nba<=11) then words+="laments the destruction of the fleet at "+string(cn.recent_keyword[gossip_recent[that]])+"."; - if (nba>12) then words+="laments the destruction of the Chapter fleet at "+string(cn.recent_keyword[gossip_recent[that]])+". Such a massive loss of ships will be felt for decades to come, if the chapter ever recovers."; - } - if (blah="ship_destroyed"){rando=choose(1,2); - words+="laments the destruction of '"+string(cn.recent_keyword[gossip_recent[that]])+"'. "; - if (rando=1) then words+="It was a fine vessel, worthy of any chapter."; - if (rando=2) then words+="Many xenos and heretics did it obliterate."; - } - if (blah="battle_victory"){rando=choose(1,2,3); - words+="boasts of the victory at "+string(cn.recent_keyword[gossip_recent[that]])+", where the "; - if (cn.recent_number[gossip_recent[that]]=2) then words+="Imperium"; - if (cn.recent_number[gossip_recent[that]]=3) then words+="Mechancius"; - if (cn.recent_number[gossip_recent[that]]=5) then words+="Sisters of Battle"; - if (cn.recent_number[gossip_recent[that]]=6) then words+="Eldar"; - if (cn.recent_number[gossip_recent[that]]=7) then words+="Orks"; - if (cn.recent_number[gossip_recent[that]]=8) then words+="Tau"; - if (cn.recent_number[gossip_recent[that]]=9) then words+="Tyranids"; - if (cn.recent_number[gossip_recent[that]]=10) then words+="Heretics"; - if (cn.recent_number[gossip_recent[that]]=11) then words+="Traitor Legions"; - if (cn.recent_number[gossip_recent[that]]=12) then words+="foul Daemons"; - if (cn.recent_number[gossip_recent[that]]=13) then words+="Necrons"; - - if (rando=1) then words+=" were crushed by the might of the chapter."; - if (rando=2) then words+=" were obliterated and torn asunder."; - if (rando=3) then words+=" were purged, down to the last fighter."; - } - if (blah="battle_defeat"){ - var nba,enemu; - nba=cn.recent_number[gossip_recent[that]]; - if (cn.recent_keyword[gossip_recent[that]]="2") then enemu="Imperium"; - if (cn.recent_keyword[gossip_recent[that]]="3") then enemu="Mechanicus"; - if (cn.recent_keyword[gossip_recent[that]]="5") then enemu="Sisters of Battle"; - if (cn.recent_keyword[gossip_recent[that]]="6") then enemu="Eldar"; - if (cn.recent_keyword[gossip_recent[that]]="7") then enemu="Orks"; - if (cn.recent_keyword[gossip_recent[that]]="8") then enemu="Tau"; - if (cn.recent_keyword[gossip_recent[that]]="9") then enemu="Tyranids"; - if (cn.recent_keyword[gossip_recent[that]]="10") then enemu="Heretics"; - if (cn.recent_keyword[gossip_recent[that]]="11") then enemu="Traitor Legions"; - if (cn.recent_keyword[gossip_recent[that]]="12") then enemu="foul Daemons"; - if (cn.recent_keyword[gossip_recent[that]]="13") then enemu="Necrons"; - - if (nba<=20) then words+="deplores the two squads, and lives lost recently, against the "+string(enemu)+"."; - if (nba>20) and (nba<=70) then words+="deplores the lives lost recently fighting the "+string(enemu)+"."; - if (nba>70) and (nba<=150) then words+="mourns the loss of a company against the "+string(enemu)+". Such a loss is impossible to ignore."; - if (nba>150) and (nba<300) then words+="mourns the loss of chapter companies fighting the "+string(enemu)+". Such a massive loss of battle brothers will be felt for decades to come, if the chapter ever recovers."; - if (nba>=300) then words+="laments the huge amount of casualties fighting the "+string(enemu)+". There are no words to describe such loss."; - } - if (string_count("death_",blah)>0){rando=choose(1,2,3); - if (cn.recent_number[gossip_recent[that]]=attend_co[argument0]){ - words+="mourns the loss of "; - words+=string_replace(blah,"death_",""); - words+=" "+string(cn.recent_keyword[gossip_recent[that]])+"."; - - if (rando=1) then words+=" His contributions to the chapter will never be forgotten."; - if (rando=2) then words+=" He fought well for the Emperor, and deserve His peace."; - if (rando=3) then words+=" He fought valiantly in life- his soul will find its way to The Emperor."; - } - } - if (blah="artifact_destroyed"){// Need a special chaos if the weapon was chaos or daemonic - words+="wonders if destroying that Artifact, recently, was worth it."; - } - if (blah="artifact_gifted"){// Need a special chaos if the weapon was chaos or daemonic - if (cn.recent_number[gossip_recent[that]]<=5) then words+="wonders if giving away an Artifact was worth it."; - if (cn.recent_number[gossip_recent[that]]>5) then words+="has concerns about gibing that Artifact away to the enemies of man. Would it not be better to have given it to the Inquisition?"; - } - - if (blah="captain_promote") and (cn.recent_number[gossip_recent[that]]=attend_co[argument0]){rando=choose(1,2); - words+="gives a cheer to "+string(cn.recent_keyword[gossip_recent[that]])+", for his promotion to "+string(obj_ini.role[100][5])+"."; - if (rando=1) then words+=" May he lead the company to glory!"; - if (rando=2) then words+=" May the company benefit from his wisdom!"; - } - if (blah="terminator_promote") and (cn.recent_number[gossip_recent[that]]=attend_co[argument0]){rando=choose(1,2); - words+="gives a cheer to "+string(cn.recent_keyword[gossip_recent[that]])+", for his promotion to "+string(obj_ini.role[100][4])+"."; - if (rando=1) then words+=" Let the enemies of man die at his feet!"; - if (rando=2) then words+=" He will be a bulwark against the foes of man!"; - } - if (blah="honor_promote") and (cn.recent_number[gossip_recent[that]]=attend_co[argument0]){rando=choose(1,2); - words+="gives a cheer to "+string(cn.recent_keyword[gossip_recent[that]])+", for his promotion to "+string(obj_ini.role[100][2])+"."; - if (rando>=1) then words+=" Let the enemies of man die at his feet!"; - } - } - - - - if (words=string(ra)+" "+string(na)+" "){ - // show_message("type:"+string(that_type)+" is blank"); - // if (that_type="recent"){show_message("type:recent, event:"+string(blah));} - } - - - - // Fin - - return(string(words)); - - + // argument0: attendant 'ide' + + var possible_gossips, gossip, that, that_type, p, words, him_chaos; + possible_gossips = 0; + that = 0; + that_type = ""; + words = ""; + him_chaos = obj_ini.TTRPG[attend_co[argument0]][attend_id[argument0]].corruption; + + p = -1; + repeat (101) { + p += 1; + gossip[p] = ""; + gossip_recent[p] = 0; + } + p = 0; + + if (obj_controller.turn < 36) { + p += 1; + gossip[p] = "future_battles"; + } + if (obj_controller.turn >= 36) { + p += 1; + gossip[p] = "past_battles"; + } + if (string_count("&", obj_ini.armour[attend_co[argument0]][attend_id[argument0]]) > 0) { + p += 1; + gossip[p] = "artifact_armour"; + } + if (string_count("&", obj_ini.wep1[attend_co[argument0]][attend_id[argument0]]) > 0) { + p += 1; + gossip[p] = "artifact_wep"; + } + if (string_count("&", obj_ini.wep2[attend_co[argument0]][attend_id[argument0]]) > 0) { + p += 1; + gossip[p] = "artifact_wep"; + } + // if (string_count("&",obj_ini.gear[attend_co[argument0],attend_id[argument0]])>0){p+=1;gossip[p]="artifact_gear";} + if (obj_ini.mobi[attend_co[argument0]][attend_id[argument0]] == "Bike") { + p += 1; + gossip[p] = "mah_bike"; + } + if (obj_ini.mobi[attend_co[argument0]][attend_id[argument0]] == "Jump Pack") { + p += 1; + gossip[p] = "mah_jump"; + } + + with (obj_ground_mission) { + instance_destroy(); + } + with (obj_star) { + if (owner == eFACTION.Ork) { + instance_create(x, y, obj_ground_mission); + } + } + if ((instance_number(obj_ground_mission) > 4) && (obj_controller.known[eFACTION.Ork] > 0) && (obj_controller.faction_defeated[7] == 0)) { + p += 1; + gossip[p] = "ork_waaagh"; + } + with (obj_ground_mission) { + instance_destroy(); + } + + if (obj_controller.marines <= 400) { + p += 1; + gossip[p] = "small_chapter"; + } + p += 1; + gossip[p] = "eager"; + + with (obj_ground_mission) { + instance_destroy(); + } + with (obj_star) { + if (owner == eFACTION.Ork) { + instance_create(x, y, obj_ground_mission); + } + } + if (instance_number(obj_ground_mission) >= 8) { + p += 1; + gossip[p] = "ork_numbers"; + } + with (obj_ground_mission) { + instance_destroy(); + } + + with (obj_ground_mission) { + instance_destroy(); + } + with (obj_star) { + if (owner == eFACTION.Tau) { + instance_create(x, y, obj_ground_mission); + } + } + if (instance_number(obj_ground_mission) >= 8) { + p += 1; + gossip[p] = "tau_numbers"; + } + with (obj_ground_mission) { + instance_destroy(); + } + + with (obj_ground_mission) { + instance_destroy(); + } + with (obj_star) { + if (owner == eFACTION.Chaos) { + instance_create(x, y, obj_ground_mission); + } + } + if (instance_number(obj_ground_mission) >= 8) { + p += 1; + gossip[p] = "chaos_numbers"; + } + with (obj_ground_mission) { + instance_destroy(); + } + + if ((obj_controller.faction_status[eFACTION.Inquisition] != "War") && (obj_controller.disposition[eFACTION.Inquisition] <= 25)) { + p += 1; + gossip[p] = "low_dispo_inqi"; + } + if ((obj_controller.faction_status[eFACTION.Imperium] != "War") && (obj_controller.disposition[eFACTION.Imperium] <= 25)) { + p += 1; + gossip[p] = "low_dispo_impe"; + } + if ((obj_controller.faction_status[eFACTION.Mechanicus] != "War") && (obj_controller.disposition[eFACTION.Mechanicus] <= 25)) { + p += 1; + gossip[p] = "low_dispo_mech"; + } + + if ((obj_controller.known[eFACTION.Eldar] > 0) && (obj_controller.faction_defeated[eFACTION.Eldar] == 0) && (obj_controller.faction_status[eFACTION.Eldar] != "Allied")) { + p += 1; + gossip[p] = "smack_talk_eldar"; + } + if ((obj_controller.known[eFACTION.Ork] > 0) && (obj_controller.faction_defeated[eFACTION.Ork] == 0) && (obj_controller.faction_status[eFACTION.Ork] != "Allied")) { + p += 1; + gossip[p] = "smack_talk_orks"; + } + if ((obj_controller.known[eFACTION.Tau] > 0) && (obj_controller.faction_defeated[eFACTION.Tau] == 0) && (obj_controller.faction_status[eFACTION.Tau] != "Allied")) { + p += 1; + gossip[p] = "smack_talk_tau"; + } + if ((obj_controller.known[eFACTION.Tyranids] > 0) && (obj_controller.faction_defeated[eFACTION.Tyranids] == 0) && (obj_controller.faction_status[eFACTION.Tyranids] != "Allied")) { + p += 1; + gossip[p] = "smack_talk_tyranids"; + } + if ((obj_controller.known[eFACTION.Chaos] > 0) && (obj_controller.faction_defeated[eFACTION.Chaos] == 0) && (obj_controller.faction_status[eFACTION.Chaos] != "Allied")) { + p += 1; + gossip[p] = "smack_talk_chaos"; + } + + // All of the custom ones above + // Recent events below + + var t; + t = 0; + repeat (obj_controller.recent_happenings) { + t += 1; + if ((obj_controller.recent_type[t] != "") && (obj_controller.recent_turn[t] + 12 >= obj_controller.turn)) { + p += 1; + gossip[p] = "recent"; + gossip_recent[p] = p; + } + } + + possible_gossips = p; + + that = floor(random(possible_gossips)) + 1; + that_type = string(gossip[that]); + + var na, ra; + na = obj_ini.name[attend_co[argument0]][attend_id[argument0]]; + ra = obj_ini.role[attend_co[argument0]][attend_id[argument0]]; + + // Getting there + words = string(ra) + " " + string(na) + " "; + + if (that_type == "future_battles") { + words += choose("recounts", "retells", "tells", "speaks of") + " future glorious battles that the Chapter will partake of, in glory of " + choose("our honor", "The Emperor", "The Imperium", "Primarch") + "."; + } + if (that_type == "past_battles") { + words += choose("recounts", "retells", "tells", "speaks of") + " past glorious battles that the Chapter partook of, in glory of " + choose("our honor", "The Emperor", "The Imperium", "Primarch") + "."; + } + if (that_type == "artifact_armour") { + rando = choose(1, 2); + if (rando == 1) { + words += "speaks fondly of his Artifact Armour. Several adjacent Astartes recall the mighty item with envy."; + } + if (rando == 2) { + words += "speaks of his Artifact Armour in a reverent tone. May it protect him in many more battles to come."; + } + } + if (that_type == "artifact_wep") { + rando = choose(1, 2); + if (rando == 1) { + words += "speaks fondly of his Artifact weapon. Several adjacent Astartes recall the mighty item with envy."; + } + if (rando == 2) { + words += "speaks of his Artifact weapon in a reverent tone. May he kill hundreds more " + choose("xeno scum", "heretics") + " with it."; + } + } + if (that_type == "mah_bike") { + rando = choose(1, 2, 3); + words += "speaks of his Bike with fondness. How glorious it is to "; + if (rando == 1) { + words += "crush foes of the Imperium beneath its wheels."; + } + if (rando == 2) { + words += "rush across battlefields at frightening speeds."; + } + if (rando == 3) { + words += "unload the foreward-mounted dual bolters on foul heretics."; + } + } + if (that_type == "mah_jump") { + rando = choose(1, 2); + words += "speaks of his Jump Pack fondly. How glorious it is to "; + if (rando == 1) { + words += "crash upon foes from high above and rout them."; + } + if (rando == 2) { + words += "launch across the battlefield in mighty, burning leaps."; + } + } + if (that_type == "ork_waaagh") { + words += "expresses concern about the current Ork WAAAGH!. How many more systems will be overrun before the warboss is purged?"; + } + if (that_type == "small_chapter") { + words += "is concerned about the current size of the " + string(global.chapter_name) + ". Only " + string(obj_controller.marines) + " battle brothers remain."; + } + if (that_type == "eager") { + rando = choose(1, 2, 3); + if (rando == 1) { + words += "is eager to enter the field of battle once more."; + } + if (rando == 2) { + words += "is eager to purge more xenos scum."; + } + if (rando == 3) { + words += "is eager to kill more heretics, for Primarch and Emperor."; + } + } + if (that_type == "ork_numbers") { + words += "curses the Ork menace and their numbers- the greenskins must be met with Bolter and Flamer, sooner than later."; + } + if (that_type == "tau_numbers") { + words += "curses the Tau for their unwant corruption of the Imperium's citizens. The xenos must be purged, down to the last one."; + } + if (that_type == "chaos_numbers") { + words += "curses the foul traitors for their heresy and corruption of the sector. Something must be done to end them for good."; + } + if (that_type == "low_dispo_inqi") { + if (him_chaos < 50) { + words += "is concerned about the Inquisition's view of the " + string(global.chapter_name) + ", and the trouble that may entail."; + } + if (him_chaos >= 50) { + words += "curses the Inquisition for their meddling with the " + string(global.chapter_name) + ". Something has to change."; + } + } + if (that_type == "low_disp_impe") { + // Couple variants for amount of chaos? + if (him_chaos <= 30) { + words += "is concerned about the Imperium's view of the " + string(global.chapter_name) + ". They should view the chapter with respect and fear, not scorn."; + } + if ((him_chaos <= 66) && (him_chaos > 30)) { + words += "is displeased with the Imperium's view of the " + string(global.chapter_name) + ". After all the chapter has done for them they are ungrateful."; + } + if ((him_chaos <= 200) && (him_chaos > 66)) { + words += "curses the Imperium for their view of the " + string(global.chapter_name) + ". The weak, and petty must be corrected by force if needed, before they forget their place in the universe."; + } + } + if (that_type == "low_disp_mech") { + words += "is concerned with the Mechanicus' low opinion of the " + string(global.chapter_name) + " and the trouble that may entail."; + } + if (that_type == "smack_talk_eldar") { + rando = choose(1, 2, 3); + if (rando == 1) { + words += "curses the arrogant Eldar and their meddling. They will be a lot less haughty with a chainsword through the gut."; + } + if (rando == 2) { + words += "looks forward to when he may purge more Eldar scum."; + } + if (rando == 3) { + words += "wishes to purge some Eldar. The arrogant xenos scum must learn their place."; + } + } + if (that_type == "smack_talk_orks") { + rando = choose(1, 2); + if (rando == 1) { + words += "curses the damned greenskins for their wanton destruction of Imperial worlds."; + } + if (rando == 2) { + words += "wishes to purge some Orks, sooner than later. Much like weeds, their numbers must be cut down."; + } + } + if (that_type == "smack_talk_tau") { + rando = choose(1, 2, 3); + if (rando == 1) { + words += "curses the Tau for their subversive methods and mockery of technology. Purging some Tau would be cathartic."; + } + if (rando == 2) { + words += "wishes to purge some Tau, sooner than later. Watching their armour and vehicles explode in blue flames is enjoyable."; + } + if (rando == 3) { + words += "boasts he will kill a Tau Ethereal one day."; + } + } + if (that_type == "smack_talk_tyranids") { + rando = choose(1, 2, 3); + if (rando == 1) { + words += "curses the Tyranids for the threat they pose to the sector. They will be defeated, each time, but at what cost?"; + } + if (rando == 2) { + words += "ponders how a Tyranid head would look on one of his pauldrons. He asks some adjacent battle brothers for their input on the matter."; + } + } + if (that_type == "smack_talk_chaos") { + rando = choose(1, 2); + if (rando == 1) { + words += "seethes and curses the damned traitors for their ongoing heresy. Their current leader must be purged, with extreme prejudice."; + } + if (rando == 2) { + words += "wishes to purge more heretics. Cleaning the homes of the damned with flamer is cathartic for him."; + } + } + + if (that_type == "recent") { + var r_num, cn, blah; + r_num = gossip_recent[that]; + cn = obj_controller; + blah = string(cn.recent_type[gossip_recent[that]]); + + if ((blah == "eldar_mission") && (cn.recent_keyword[gossip_recent[that]] == "completed") && (cn.recent_number[gossip_recent[that]] == 1)) { + words += "is concerned about the Chapter Master's decision to help the Eldar. Is it not a Space Marine's duty to cleanse and purge xenos, rather than collaborate with them?"; + } + if (blah == "artifact_recovered") { + words += "wonders what secrets the newly discovered Artifact may hold."; + } + if (blah == "stc_recovered") { + words += "wonders what secrets the newly discovered STC Fragment may hold."; + } + if (blah == "fleet_defeat") { + var nba; + nba = cn.recent_number[gossip_recent[that]]; + if (nba <= 3) { + words += "deplores the loss of the scouting fleet at " + string(cn.recent_keyword[gossip_recent[that]]) + "."; + } + if ((nba > 3) && (nba <= 7)) { + words += "laments the loss of the fleet at " + string(cn.recent_keyword[gossip_recent[that]]) + "."; + } + if ((nba > 7) && (nba <= 11)) { + words += "laments the destruction of the fleet at " + string(cn.recent_keyword[gossip_recent[that]]) + "."; + } + if (nba > 12) { + words += "laments the destruction of the Chapter fleet at " + string(cn.recent_keyword[gossip_recent[that]]) + ". Such a massive loss of ships will be felt for decades to come, if the chapter ever recovers."; + } + } + if (blah == "ship_destroyed") { + rando = choose(1, 2); + words += "laments the destruction of '" + string(cn.recent_keyword[gossip_recent[that]]) + "'. "; + if (rando == 1) { + words += "It was a fine vessel, worthy of any chapter."; + } + if (rando == 2) { + words += "Many xenos and heretics did it obliterate."; + } + } + if (blah == "battle_victory") { + rando = choose(1, 2, 3); + words += "boasts of the victory at " + string(cn.recent_keyword[gossip_recent[that]]) + ", where the "; + if (cn.recent_number[gossip_recent[that]] == 2) { + words += "Imperium"; + } + if (cn.recent_number[gossip_recent[that]] == 3) { + words += "Mechancius"; + } + if (cn.recent_number[gossip_recent[that]] == 5) { + words += "Sisters of Battle"; + } + if (cn.recent_number[gossip_recent[that]] == 6) { + words += "Eldar"; + } + if (cn.recent_number[gossip_recent[that]] == 7) { + words += "Orks"; + } + if (cn.recent_number[gossip_recent[that]] == 8) { + words += "Tau"; + } + if (cn.recent_number[gossip_recent[that]] == 9) { + words += "Tyranids"; + } + if (cn.recent_number[gossip_recent[that]] == 10) { + words += "Heretics"; + } + if (cn.recent_number[gossip_recent[that]] == 11) { + words += "Traitor Legions"; + } + if (cn.recent_number[gossip_recent[that]] == 12) { + words += "foul Daemons"; + } + if (cn.recent_number[gossip_recent[that]] == 13) { + words += "Necrons"; + } + + if (rando == 1) { + words += " were crushed by the might of the chapter."; + } + if (rando == 2) { + words += " were obliterated and torn asunder."; + } + if (rando == 3) { + words += " were purged, down to the last fighter."; + } + } + if (blah == "battle_defeat") { + var nba, enemu; + nba = cn.recent_number[gossip_recent[that]]; + if (cn.recent_keyword[gossip_recent[that]] == "2") { + enemu = "Imperium"; + } + if (cn.recent_keyword[gossip_recent[that]] == "3") { + enemu = "Mechanicus"; + } + if (cn.recent_keyword[gossip_recent[that]] == "5") { + enemu = "Sisters of Battle"; + } + if (cn.recent_keyword[gossip_recent[that]] == "6") { + enemu = "Eldar"; + } + if (cn.recent_keyword[gossip_recent[that]] == "7") { + enemu = "Orks"; + } + if (cn.recent_keyword[gossip_recent[that]] == "8") { + enemu = "Tau"; + } + if (cn.recent_keyword[gossip_recent[that]] == "9") { + enemu = "Tyranids"; + } + if (cn.recent_keyword[gossip_recent[that]] == "10") { + enemu = "Heretics"; + } + if (cn.recent_keyword[gossip_recent[that]] == "11") { + enemu = "Traitor Legions"; + } + if (cn.recent_keyword[gossip_recent[that]] == "12") { + enemu = "foul Daemons"; + } + if (cn.recent_keyword[gossip_recent[that]] == "13") { + enemu = "Necrons"; + } + + if (nba <= 20) { + words += "deplores the two squads, and lives lost recently, against the " + string(enemu) + "."; + } + if ((nba > 20) && (nba <= 70)) { + words += "deplores the lives lost recently fighting the " + string(enemu) + "."; + } + if ((nba > 70) && (nba <= 150)) { + words += "mourns the loss of a company against the " + string(enemu) + ". Such a loss is impossible to ignore."; + } + if ((nba > 150) && (nba < 300)) { + words += "mourns the loss of chapter companies fighting the " + string(enemu) + ". Such a massive loss of battle brothers will be felt for decades to come, if the chapter ever recovers."; + } + if (nba >= 300) { + words += "laments the huge amount of casualties fighting the " + string(enemu) + ". There are no words to describe such loss."; + } + } + if (string_count("death_", blah) > 0) { + rando = choose(1, 2, 3); + if (cn.recent_number[gossip_recent[that]] == attend_co[argument0]) { + words += "mourns the loss of "; + words += string_replace(blah, "death_", ""); + words += " " + string(cn.recent_keyword[gossip_recent[that]]) + "."; + + if (rando == 1) { + words += " His contributions to the chapter will never be forgotten."; + } + if (rando == 2) { + words += " He fought well for the Emperor, and deserve His peace."; + } + if (rando == 3) { + words += " He fought valiantly in life- his soul will find its way to The Emperor."; + } + } + } + if (blah == "artifact_destroyed") { + // Need a special chaos if the weapon was chaos or daemonic + words += "wonders if destroying that Artifact, recently, was worth it."; + } + if (blah == "artifact_gifted") { + // Need a special chaos if the weapon was chaos or daemonic + if (cn.recent_number[gossip_recent[that]] <= 5) { + words += "wonders if giving away an Artifact was worth it."; + } + if (cn.recent_number[gossip_recent[that]] > 5) { + words += "has concerns about gibing that Artifact away to the enemies of man. Would it not be better to have given it to the Inquisition?"; + } + } + + if ((blah == "captain_promote") && (cn.recent_number[gossip_recent[that]] == attend_co[argument0])) { + rando = choose(1, 2); + words += "gives a cheer to " + string(cn.recent_keyword[gossip_recent[that]]) + ", for his promotion to " + string(obj_ini.role[100][5]) + "."; + if (rando == 1) { + words += " May he lead the company to glory!"; + } + if (rando == 2) { + words += " May the company benefit from his wisdom!"; + } + } + if ((blah == "terminator_promote") && (cn.recent_number[gossip_recent[that]] == attend_co[argument0])) { + rando = choose(1, 2); + words += "gives a cheer to " + string(cn.recent_keyword[gossip_recent[that]]) + ", for his promotion to " + string(obj_ini.role[100][4]) + "."; + if (rando == 1) { + words += " Let the enemies of man die at his feet!"; + } + if (rando == 2) { + words += " He will be a bulwark against the foes of man!"; + } + } + if ((blah == "honor_promote") && (cn.recent_number[gossip_recent[that]] == attend_co[argument0])) { + rando = choose(1, 2); + words += "gives a cheer to " + string(cn.recent_keyword[gossip_recent[that]]) + ", for his promotion to " + string(obj_ini.role[100][2]) + "."; + if (rando >= 1) { + words += " Let the enemies of man die at his feet!"; + } + } + } + + if (words == string(ra) + " " + string(na) + " ") { + // show_message("type:"+string(that_type)+" is blank"); + // if (that_type="recent"){show_message("type:recent, event:"+string(blah));} + } + + // Fin + + return string(words); } diff --git a/scripts/scr_imperial_manage_fleet_functions/scr_imperial_manage_fleet_functions.gml b/scripts/scr_imperial_manage_fleet_functions/scr_imperial_manage_fleet_functions.gml index 320f4a7812..f0b22fbbcf 100644 --- a/scripts/scr_imperial_manage_fleet_functions/scr_imperial_manage_fleet_functions.gml +++ b/scripts/scr_imperial_manage_fleet_functions/scr_imperial_manage_fleet_functions.gml @@ -1,129 +1,125 @@ -function new_colony_fleet (doner_star, doner_planet, target, target_planet, mission="new_colony"){ - var new_colonise_fleet=instance_create(doner_star.x,doner_star.y,obj_en_fleet); +function new_colony_fleet(doner_star, doner_planet, target, target_planet, mission = "new_colony") { + var new_colonise_fleet = instance_create(doner_star.x, doner_star.y, obj_en_fleet); new_colonise_fleet.owner = eFACTION.Imperium; - new_colonise_fleet.sprite_index=spr_fleet_civilian; - new_colonise_fleet.image_index=3; - new_colonise_fleet.warp_able=false; + new_colonise_fleet.sprite_index = spr_fleet_civilian; + new_colonise_fleet.image_index = 3; + new_colonise_fleet.warp_able = false; show_debug_message($"{doner_star.name}, {doner_planet}, {target.name}, {target_planet}"); var doner_volume = 0; if (doner_star.p_large[doner_planet]) { - doner_volume = (doner_star.p_population[doner_planet]*0.01)*power(10,8); - doner_star.p_population[doner_planet]*=0.99; + doner_volume = (doner_star.p_population[doner_planet] * 0.01) * power(10, 8); + doner_star.p_population[doner_planet] *= 0.99; } else { - doner_volume = doner_star.p_population[doner_planet]*0.1; - doner_star.p_population[doner_planet]*=0.90; + doner_volume = doner_star.p_population[doner_planet] * 0.1; + doner_star.p_population[doner_planet] *= 0.90; } var new_cargo = { - colonists : doner_volume, - mission : mission, - target_planet : target_planet, - colonist_influence : doner_star.p_influence[doner_planet] - } + colonists: doner_volume, + mission: mission, + target_planet: target_planet, + colonist_influence: doner_star.p_influence[doner_planet], + }; - new_colonise_fleet.trade_goods="colonize"; + new_colonise_fleet.trade_goods = "colonize"; //TODO flesh out colonisation efforts - if (doner_star.p_population[target_planet] && doner_star.p_type[doner_planet] == "Hive"){ - new_colonise_fleet.image_index=3; + if (doner_star.p_population[target_planet] && doner_star.p_type[doner_planet] == "Hive") { + new_colonise_fleet.image_index = 3; } else { - new_colonise_fleet.image_index=choose(1,2); + new_colonise_fleet.image_index = choose(1, 2); } - new_colonise_fleet.cargo_data.colonize = new_cargo; + new_colonise_fleet.cargo_data.colonize = new_cargo; new_colonise_fleet.action_x = target.x; new_colonise_fleet.action_y = target.y; new_colonise_fleet.target = target; - with (new_colonise_fleet){ + with (new_colonise_fleet) { set_fleet_movement(); } - scr_event_log("green",$"New colony fleet departs from {doner_star.name}. for the {target.name} system",doner_star.name); - + scr_event_log("green", $"New colony fleet departs from {doner_star.name}. for the {target.name} system", doner_star.name); } -function fleet_has_cargo(desired_cargo, fleet="none"){ - if (fleet == "none"){ +function fleet_has_cargo(desired_cargo, fleet = "none") { + if (fleet == "none") { return struct_exists(cargo_data, desired_cargo); } else { var has_cargo = false; - with (fleet){ - has_cargo = fleet_has_cargo(desired_cargo); + with (fleet) { + has_cargo = fleet_has_cargo(desired_cargo); } return has_cargo; } } - -function fleet_add_cargo(new_cargo,data,overwrite = false,fleet = "none"){ - if (fleet == "none"){ +function fleet_add_cargo(new_cargo, data, overwrite = false, fleet = "none") { + if (fleet == "none") { var _add = true; - if (fleet_has_cargo(new_cargo) && !overwrite){ + if (fleet_has_cargo(new_cargo) && !overwrite) { _add = false; } - if (_add){ + if (_add) { cargo_data[$ new_cargo] = data; } } else { - with (fleet){ - fleet_add_cargo(new_cargo,data,overwrite); + with (fleet) { + fleet_add_cargo(new_cargo, data, overwrite); } } } - - //TODO integrate this into PlanetData constructor -function deploy_colonisers(star){ - var lag=1; +function deploy_colonisers(star) { + var lag = 1; var data = cargo_data.colonize; - if (data.target_planet>0){ + if (data.target_planet > 0) { var targ_planet = data.target_planet; - if (!star.p_large[targ_planet]){ + if (!star.p_large[targ_planet]) { star.p_population[targ_planet] += data.colonists; } else { - star.p_population[targ_planet] += data.colonists/power(10,8); + star.p_population[targ_planet] += data.colonists / power(10, 8); } var start_influ = star.p_influence[targ_planet][eFACTION.Tyranids]; - with (star){ - merge_influences(data.colonist_influence,targ_planet); + with (star) { + merge_influences(data.colonist_influence, targ_planet); } - var colony_purpose = data.mission=="new_colony"? "recolonise" : "bolster population" ; + var colony_purpose = data.mission == "new_colony" ? "recolonise" : "bolster population"; var alert_string = $"Imperial citizens {colony_purpose} {planet_numeral_name(targ_planet, star)} I."; - var player_vision = star.p_player[targ_planet]>0 || star.p_owner[targ_planet] == eFACTION.Player; - if (star.p_influence[targ_planet][eFACTION.Tyranids]>start_influ && (player_vision)){ + var player_vision = star.p_player[targ_planet] > 0 || star.p_owner[targ_planet] == eFACTION.Player; + if (star.p_influence[targ_planet][eFACTION.Tyranids] > start_influ && player_vision) { alert_string += " They bring with them traces of a Genestelar Cult"; } - scr_alert("green","duhuhuhu",alert_string,star.x,star.y); + scr_alert("green", "duhuhuhu", alert_string, star.x, star.y); } else { - for (var r=1;r<=star.planets;r++){ - if (data.mission == "new_colony" && star.p_population[r]<=0){ + for (var r = 1; r <= star.planets; r++) { + if (data.mission == "new_colony" && star.p_population[r] <= 0) { continue; } //TODO sort out some of the issues of this regarding difference with large and small planet populations - if (star.p_type[r]!="") and (star.p_type[r]!="Dead") { - if (lag == 1){ + if ((star.p_type[r] != "") && (star.p_type[r] != "Dead")) { + if (lag == 1) { star.p_population[r] += data.colonists; - star.p_large[r]=0; - guardsmen=0; - } - else if (lag=2){ + star.p_large[r] = 0; + guardsmen = 0; + } else if (lag == 2) { star.p_population[r] += data.colonists; - star.p_large[r]=1; - guardsmen=0; + star.p_large[r] = 1; + guardsmen = 0; } - scr_alert("green","duhuhuhu",$"Imperial citizens recolonize {planet_numeral_name(r, star)} I.",star.x,star.y); - - star.dispo[r]=min(obj_ini.imperium_disposition,obj_controller.disposition[eFACTION.Imperium])+irandom_range(-4,4); - if (star.name=obj_ini.home_name) and (star.p_type[r]=obj_ini.home_type) and (obj_controller.homeworld_rule!=1) then star.dispo[r]=-5000; + scr_alert("green", "duhuhuhu", $"Imperial citizens recolonize {planet_numeral_name(r, star)} I.", star.x, star.y); + + star.dispo[r] = min(obj_ini.imperium_disposition, obj_controller.disposition[eFACTION.Imperium]) + irandom_range(-4, 4); + if ((star.name == obj_ini.home_name) && (star.p_type[r] == obj_ini.home_type) && (obj_controller.homeworld_rule != 1)) { + star.dispo[r] = -5000; + } } - } + } } - if (struct_exists(cargo_data, "colonize")){ + if (struct_exists(cargo_data, "colonize")) { struct_remove(cargo_data, "colonize"); } } - diff --git a/scripts/scr_initialize_custom/scr_initialize_custom.gml b/scripts/scr_initialize_custom/scr_initialize_custom.gml index b51ee44109..50d56577fe 100644 --- a/scripts/scr_initialize_custom/scr_initialize_custom.gml +++ b/scripts/scr_initialize_custom/scr_initialize_custom.gml @@ -1,28 +1,28 @@ enum eROLE { - None = 0, - ChapterMaster = 1, - HonourGuard = 2, - Veteran = 3, - Terminator = 4, - Captain = 5, - Dreadnought = 6, - Champion = 7, - Tactical = 8, - Devastator = 9, - Assault = 10, - Ancient = 11, - Scout = 12, - Chaplain = 14, - Apothecary = 15, - Techmarine = 16, - Librarian = 17, - Sergeant = 18, - VeteranSergeant = 19, - LandRaider = 50, + None = 0, + ChapterMaster = 1, + HonourGuard = 2, + Veteran = 3, + Terminator = 4, + Captain = 5, + Dreadnought = 6, + Champion = 7, + Tactical = 8, + Devastator = 9, + Assault = 10, + Ancient = 11, + Scout = 12, + Chaplain = 14, + Apothecary = 15, + Techmarine = 16, + Librarian = 17, + Sergeant = 18, + VeteranSergeant = 19, + LandRaider = 50, Rhino = 51, Predator = 52, LandSpeeder = 53, - Whirlwind = 54 + Whirlwind = 54, } enum ePROGENITOR { @@ -41,26 +41,15 @@ enum ePROGENITOR { enum eCHAPTER_TYPE { PREMADE, - RANDOM, + RANDOM, CUSTOM, } -function progenitor_map(){ - var founding_chapters = [ - "", - "Dark Angels", - "White Scars", - "Space Wolves", - "Imperial Fists", - "Blood Angels", - "Iron Hands", - "Ultramarines", - "Salamanders", - "Raven Guard", - ] - - for (var i=1; i<10; i++){ - if (global.chapter_name == founding_chapters[i] || obj_ini.progenitor==i){ +function progenitor_map() { + var founding_chapters = ["", "Dark Angels", "White Scars", "Space Wolves", "Imperial Fists", "Blood Angels", "Iron Hands", "Ultramarines", "Salamanders", "Raven Guard"]; + + for (var i = 1; i < 10; i++) { + if (global.chapter_name == founding_chapters[i] || obj_ini.progenitor == i) { return i; } } @@ -69,36 +58,7 @@ function progenitor_map(){ } function complex_livery_default() { - return { - sgt : { - helm_pattern:3, - helm_primary : 0, - helm_secondary : 0, - helm_detail : 0, - helm_lens : 0, - }, - vet_sgt : { - helm_pattern:3, - helm_primary : 0, - helm_secondary : 0, - helm_detail : 0, - helm_lens : 0, - }, - captain : { - helm_pattern:3, - helm_primary : 0, - helm_secondary : 0, - helm_detail : 0, - helm_lens : 0, - }, - veteran : { - helm_pattern:3, - helm_primary : 0, - helm_secondary : 0, - helm_detail : 0, - helm_lens : 0, - } - }; + return {sgt: {helm_pattern: 3, helm_primary: 0, helm_secondary: 0, helm_detail: 0, helm_lens: 0}, vet_sgt: {helm_pattern: 3, helm_primary: 0, helm_secondary: 0, helm_detail: 0, helm_lens: 0}, captain: {helm_pattern: 3, helm_primary: 0, helm_secondary: 0, helm_detail: 0, helm_lens: 0}, veteran: {helm_pattern: 3, helm_primary: 0, helm_secondary: 0, helm_detail: 0, helm_lens: 0}}; } function select_livery_data(livery_data, specific) { @@ -113,9 +73,9 @@ function select_livery_data(livery_data, specific) { function helmet_livery(progenitor, specific = "none") { var livery_data; - if ((obj_creation.custom == eCHAPTER_TYPE.PREMADE) && (global.chapter_creation_object.origin == 1)) { - progenitor = progenitor_map(); - } + if ((obj_creation.custom == eCHAPTER_TYPE.PREMADE) && (global.chapter_creation_object.origin == 1)) { + progenitor = progenitor_map(); + } var name_selected = true; switch (global.chapter_name) { @@ -184,70 +144,70 @@ function helmet_livery(progenitor, specific = "none") { }, }; break; - case "Lamenters": - livery_data = { - sgt : { - helm_pattern:1, - helm_primary : obj_creation.main_color, - helm_secondary : Colors.Black, - helm_detail : obj_creation.main_trim, - helm_lens : obj_creation.lens_color, - }, - vet_sgt : { - helm_pattern:1, - helm_primary : obj_creation.main_color, - helm_secondary : Colors.Black, - helm_detail : obj_creation.main_trim, - helm_lens : obj_creation.lens_color, - }, - captain : { - helm_pattern:0, - helm_primary : Colors.White, - helm_secondary : Colors.White, - helm_detail : obj_creation.main_trim, - helm_lens : obj_creation.lens_color, - }, - veteran : { - helm_pattern:2, - helm_primary : obj_creation.main_color, - helm_secondary : Colors.Black, - helm_detail : obj_creation.main_trim, - helm_lens : obj_creation.lens_color, - } - } - break; - case "Tome Keepers": - livery_data = { - sgt : { - helm_pattern:0, - helm_primary : Colors.Sanguine_Red, - helm_secondary : obj_creation.secondary_color, - helm_detail : obj_creation.main_trim, - helm_lens : Colors.Lime, - }, - vet_sgt : { - helm_pattern:2, - helm_primary : Colors.Sanguine_Red, - helm_secondary : Colors.Lighter_Black, - helm_detail : obj_creation.main_trim, - helm_lens : Colors.Lime, - }, - captain : { - helm_pattern:0, - helm_primary : obj_creation.main_color, - helm_secondary : obj_creation.secondary_color, - helm_detail : obj_creation.main_trim, - helm_lens : obj_creation.lens_color, - }, - veteran : { - helm_pattern:2, - helm_primary : obj_creation.main_color, - helm_secondary : Colors.Lighter_Black, - helm_detail : obj_creation.main_trim, - helm_lens : obj_creation.lens_color, - } - } - break; + case "Lamenters": + livery_data = { + sgt: { + helm_pattern: 1, + helm_primary: obj_creation.main_color, + helm_secondary: Colors.Black, + helm_detail: obj_creation.main_trim, + helm_lens: obj_creation.lens_color, + }, + vet_sgt: { + helm_pattern: 1, + helm_primary: obj_creation.main_color, + helm_secondary: Colors.Black, + helm_detail: obj_creation.main_trim, + helm_lens: obj_creation.lens_color, + }, + captain: { + helm_pattern: 0, + helm_primary: Colors.White, + helm_secondary: Colors.White, + helm_detail: obj_creation.main_trim, + helm_lens: obj_creation.lens_color, + }, + veteran: { + helm_pattern: 2, + helm_primary: obj_creation.main_color, + helm_secondary: Colors.Black, + helm_detail: obj_creation.main_trim, + helm_lens: obj_creation.lens_color, + }, + }; + break; + case "Tome Keepers": + livery_data = { + sgt: { + helm_pattern: 0, + helm_primary: Colors.Sanguine_Red, + helm_secondary: obj_creation.secondary_color, + helm_detail: obj_creation.main_trim, + helm_lens: Colors.Lime, + }, + vet_sgt: { + helm_pattern: 2, + helm_primary: Colors.Sanguine_Red, + helm_secondary: Colors.Lighter_Black, + helm_detail: obj_creation.main_trim, + helm_lens: Colors.Lime, + }, + captain: { + helm_pattern: 0, + helm_primary: obj_creation.main_color, + helm_secondary: obj_creation.secondary_color, + helm_detail: obj_creation.main_trim, + helm_lens: obj_creation.lens_color, + }, + veteran: { + helm_pattern: 2, + helm_primary: obj_creation.main_color, + helm_secondary: Colors.Lighter_Black, + helm_detail: obj_creation.main_trim, + helm_lens: obj_creation.lens_color, + }, + }; + break; default: name_selected = false; break; @@ -525,32 +485,32 @@ function helmet_livery(progenitor, specific = "none") { case ePROGENITOR.BLOOD_ANGELS: livery_data = { sgt: { - helm_pattern: 0, - helm_primary: obj_creation.main_color, - helm_secondary: obj_creation.secondary_color, - helm_detail: Colors.Gold, - helm_lens: obj_creation.lens_color, + helm_pattern: 0, + helm_primary: obj_creation.main_color, + helm_secondary: obj_creation.secondary_color, + helm_detail: Colors.Gold, + helm_lens: obj_creation.lens_color, }, vet_sgt: { - helm_pattern: 0, - helm_primary: Colors.Gold, - helm_secondary: obj_creation.secondary_color, - helm_detail: obj_creation.main_trim, - helm_lens: obj_creation.lens_color, + helm_pattern: 0, + helm_primary: Colors.Gold, + helm_secondary: obj_creation.secondary_color, + helm_detail: obj_creation.main_trim, + helm_lens: obj_creation.lens_color, }, captain: { - helm_pattern: 0, - helm_primary: obj_creation.main_color, - helm_secondary: obj_creation.secondary_color, - helm_detail: Colors.Gold, - helm_lens: obj_creation.lens_color, + helm_pattern: 0, + helm_primary: obj_creation.main_color, + helm_secondary: obj_creation.secondary_color, + helm_detail: Colors.Gold, + helm_lens: obj_creation.lens_color, }, veteran: { - helm_pattern: 0, - helm_primary: Colors.Gold, - helm_secondary: obj_creation.secondary_color, - helm_detail: obj_creation.main_trim, - helm_lens: obj_creation.lens_color, + helm_pattern: 0, + helm_primary: Colors.Gold, + helm_secondary: obj_creation.secondary_color, + helm_detail: obj_creation.main_trim, + helm_lens: obj_creation.lens_color, }, }; break; @@ -593,39 +553,38 @@ function helmet_livery(progenitor, specific = "none") { return select_livery_data(livery_data, specific); } -function trial_map(trial_name){ - if(is_real(trial_name)){ - return trial_name; - } - switch(trial_name){ - case "BLOOD_DUEL": - case "BLOODDUEL": - return eTrials.BLOODDUEL; - case "SURVIVAL": - return eTrials.SURVIVAL; - case "APPRENTICESHIP": - return eTrials.APPRENTICESHIP; - case "CHALLENGE": - return eTrials.CHALLENGE; - case "EXPOSURE": - return eTrials.EXPOSURE; - case "HUNTING": - return eTrials.HUNTING; - case "KNOWLEDGE": - return eTrials.KNOWLEDGE; - default: - return eTrials.BLOODDUEL; - } +function trial_map(trial_name) { + if (is_real(trial_name)) { + return trial_name; + } + switch (trial_name) { + case "BLOOD_DUEL": + case "BLOODDUEL": + return eTrials.BLOODDUEL; + case "SURVIVAL": + return eTrials.SURVIVAL; + case "APPRENTICESHIP": + return eTrials.APPRENTICESHIP; + case "CHALLENGE": + return eTrials.CHALLENGE; + case "EXPOSURE": + return eTrials.EXPOSURE; + case "HUNTING": + return eTrials.HUNTING; + case "KNOWLEDGE": + return eTrials.KNOWLEDGE; + default: + return eTrials.BLOODDUEL; + } } /// @mixin obj_ini function scr_initialize_custom() { + // show_debug_message("Executing scr_initialize_custom"); - // show_debug_message("Executing scr_initialize_custom"); - - progenitor = obj_creation.founding; - successors = obj_creation.successors; - homeworld_rule = obj_creation.homeworld_rule; + progenitor = obj_creation.founding; + successors = obj_creation.successors; + homeworld_rule = obj_creation.homeworld_rule; homeworld_relative_loc = obj_creation.buttons.home_spawn_loc_options.current_selection; home_warp_position = obj_creation.buttons.home_warp.current_selection; @@ -633,687 +592,656 @@ function scr_initialize_custom() { recruit_relative_loc = obj_creation.buttons.recruit_home_relationship.current_selection; culture_styles = obj_creation.buttons.culture_styles.selections(); + if (struct_exists(obj_creation, "custom_advisors")) { + obj_ini.custom_advisors = obj_creation.custom_advisors; + } - if(struct_exists(obj_creation, "custom_advisors")){ - obj_ini.custom_advisors = obj_creation.custom_advisors; - } - - - // Initializes all of the marine/vehicle/ship variables for the chapter. - - techmarines = 8; - apothecary = 8; - epistolary = 2; - codiciery = 2; - lexicanum = 4; - terminator = 40; - veteran = 70; - second = 100; - third = 100; - fourth = 100; - fifth = 100; - sixth = 100; - seventh = 100; - eighth = 100; - ninth = 100; - tenth = 100; - assault = 20; - devastator = 20; - siege = 0; - - recruit_trial = obj_creation.aspirant_trial; - purity = obj_creation.purity; - stability = obj_creation.stability; - - // show_message(instance_number(obj_controller)); - - global.chapter_name = obj_creation.chapter_name; - global.founding = obj_creation.founding; - global.founding_secret = ""; - global.game_seed = floor(random(99999999)) + string_to_integer(global.chapter_name) + string_to_integer(obj_creation.chapter_master_name); - + // Initializes all of the marine/vehicle/ship variables for the chapter. + + techmarines = 8; + apothecary = 8; + epistolary = 2; + codiciery = 2; + lexicanum = 4; + terminator = 40; + veteran = 70; + second = 100; + third = 100; + fourth = 100; + fifth = 100; + sixth = 100; + seventh = 100; + eighth = 100; + ninth = 100; + tenth = 100; + assault = 20; + devastator = 20; + siege = 0; + + recruit_trial = obj_creation.aspirant_trial; + purity = obj_creation.purity; + stability = obj_creation.stability; + + // show_message(instance_number(obj_controller)); + + global.chapter_name = obj_creation.chapter_name; + global.founding = obj_creation.founding; + global.founding_secret = ""; + global.game_seed = floor(random(99999999)) + string_to_integer(global.chapter_name) + string_to_integer(obj_creation.chapter_master_name); if (progenitor == ePROGENITOR.RANDOM) { - global.founding_secret = array_random_element([ - "Dark Angels", - "Emperor's Children", - "Iron Warriors", - "White Scars", - "Space Wolves", - "Imperial Fists", - "Night Lords", - "Blood Angels", - "Iron Hands", - "World Eaters", - "Ultramarines", - "Death Guard", - "Thousand Sons", - "Black Legion", - "Word Bearers", - "Salamanders", - "Raven Guard", - "Alpha Legion" - ]); - } - - - company_title = [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - ] - if(struct_exists(obj_creation, "company_title")){ - for(var ct = 0; ct < array_length(obj_creation.company_title); ct++){ - company_title[ct] = obj_creation.company_title[ct]; - } - } - - - - - home_name = obj_creation.homeworld_name; - obj_creation.restart_home_name = home_name; - chapter_name = obj_creation.chapter_name; - // fortress_name=""; - flagship_name = obj_creation.flagship_name; - obj_creation.restart_flagship_name = flagship_name; - sector_name = global.name_generator.generate_sector_name(); - man_size = 0; - psy_powers = obj_creation.discipline; - - progenitor_disposition = obj_creation.disposition[eFACTION.Player]; - astartes_disposition = obj_creation.disposition[6]; - imperium_disposition = obj_creation.disposition[eFACTION.Imperium]; - guard_disposition = obj_creation.disposition[eFACTION.Imperium]; - inquisition_disposition = obj_creation.disposition[4]; - ecclesiarchy_disposition = obj_creation.disposition[5]; - mechanicus_disposition = obj_creation.disposition[3]; - other1_disposition = 0; - other1 = ""; - - preomnor = obj_creation.preomnor; - voice = obj_creation.voice; - doomed = obj_creation.doomed; - lyman = obj_creation.lyman; - omophagea = obj_creation.omophagea; - ossmodula = obj_creation.ossmodula; - membrane = obj_creation.membrane; - zygote = obj_creation.zygote; - betchers = obj_creation.betchers; - catalepsean = obj_creation.catalepsean; - secretions = obj_creation.secretions; - occulobe = obj_creation.occulobe; - mucranoid = obj_creation.mucranoid; - - - - adv = obj_creation.adv; - dis = obj_creation.dis; - - - - recruiting_type = obj_creation.recruiting; - recruit_trial = obj_creation.aspirant_trial; - recruiting_name = obj_creation.recruiting_name; - home_type = obj_creation.homeworld; - home_name = obj_creation.homeworld_name; - fleet_type = obj_creation.fleet_type; - - - #region Ship Setup - battle_barges = 0; - strike_cruisers = 0; - gladius = 0; - hunters = 0; - - if (obj_creation.fleet_type == ePlayerBase.home_world) { - strike_cruisers = 8; - gladius = 7; - hunters = 3; - } else { - battle_barges = 1; - strike_cruisers = 6; - gladius = 7; - hunters = 3; - } - - /** + global.founding_secret = array_random_element(["Dark Angels", "Emperor's Children", "Iron Warriors", "White Scars", "Space Wolves", "Imperial Fists", "Night Lords", "Blood Angels", "Iron Hands", "World Eaters", "Ultramarines", "Death Guard", "Thousand Sons", "Black Legion", "Word Bearers", "Salamanders", "Raven Guard", "Alpha Legion"]); + } + + company_title = ["", "", "", "", "", "", "", "", "", "", ""]; + if (struct_exists(obj_creation, "company_title")) { + for (var ct = 0; ct < array_length(obj_creation.company_title); ct++) { + company_title[ct] = obj_creation.company_title[ct]; + } + } + + home_name = obj_creation.homeworld_name; + obj_creation.restart_home_name = home_name; + chapter_name = obj_creation.chapter_name; + // fortress_name=""; + flagship_name = obj_creation.flagship_name; + obj_creation.restart_flagship_name = flagship_name; + sector_name = global.name_generator.generate_sector_name(); + man_size = 0; + psy_powers = obj_creation.discipline; + + progenitor_disposition = obj_creation.disposition[eFACTION.Player]; + astartes_disposition = obj_creation.disposition[6]; + imperium_disposition = obj_creation.disposition[eFACTION.Imperium]; + guard_disposition = obj_creation.disposition[eFACTION.Imperium]; + inquisition_disposition = obj_creation.disposition[4]; + ecclesiarchy_disposition = obj_creation.disposition[5]; + mechanicus_disposition = obj_creation.disposition[3]; + other1_disposition = 0; + other1 = ""; + + preomnor = obj_creation.preomnor; + voice = obj_creation.voice; + doomed = obj_creation.doomed; + lyman = obj_creation.lyman; + omophagea = obj_creation.omophagea; + ossmodula = obj_creation.ossmodula; + membrane = obj_creation.membrane; + zygote = obj_creation.zygote; + betchers = obj_creation.betchers; + catalepsean = obj_creation.catalepsean; + secretions = obj_creation.secretions; + occulobe = obj_creation.occulobe; + mucranoid = obj_creation.mucranoid; + + adv = obj_creation.adv; + dis = obj_creation.dis; + + recruiting_type = obj_creation.recruiting; + recruit_trial = obj_creation.aspirant_trial; + recruiting_name = obj_creation.recruiting_name; + home_type = obj_creation.homeworld; + home_name = obj_creation.homeworld_name; + fleet_type = obj_creation.fleet_type; + + #region Ship Setup + battle_barges = 0; + strike_cruisers = 0; + gladius = 0; + hunters = 0; + + if (obj_creation.fleet_type == ePlayerBase.home_world) { + strike_cruisers = 8; + gladius = 7; + hunters = 3; + } else { + battle_barges = 1; + strike_cruisers = 6; + gladius = 7; + hunters = 3; + } + + /** * * Default fleet composition * * Homeworld * - 2 Battle Barges, 8 Strike cruisers, 7 Gladius, 3 Hunters * * Fleet based and Penitent * - 4 Battle Barges, 3 Strike Cruisers, 7 Gladius, 3 Hunters */ - if (obj_creation.custom == eCHAPTER_TYPE.PREMADE) { - flagship_name = obj_creation.flagship_name; - if (obj_creation.fleet_type == ePlayerBase.home_world) { - battle_barges = 2; - strike_cruisers = 8; - gladius = 7; - hunters = 3; - } else { - battle_barges = 4; - strike_cruisers = 3; - gladius = 7; - hunters = 3; - } - } - - if (scr_has_disadv("Obliterated")){ if (obj_creation.fleet_type == ePlayerBase.home_world) { - battle_barges = 0; - strike_cruisers = 2; - gladius = 1; - hunters = 0; - } else { - battle_barges = 1; - strike_cruisers = 0; - gladius = 2; - hunters = 0; - } - } - if (scr_has_adv ("Kings of Space")) {battle_barges += 1;} - if (scr_has_adv("Boarders")){ strike_cruisers += 2;} - if(struct_exists(obj_creation, "extra_ships")){ - battle_barges = battle_barges + obj_creation.extra_ships.battle_barges; - strike_cruisers = strike_cruisers + obj_creation.extra_ships.strike_cruisers; - gladius = gladius + obj_creation.extra_ships.gladius; - hunters = hunters + obj_creation.extra_ships.hunters; - } - - var ship_summary_str = $"Ships: bb: {battle_barges} sc: {strike_cruisers} g: {gladius} h: {hunters}" - // log_message(ship_summary_str); - // show_debug_message(ship_summary_str); - - if (battle_barges>=1){ - for (v=0;v= 1) { + for (v = 0; v < battle_barges; v++) { + var new_ship = new_player_ship("Battle Barge", "home"); + if ((flagship_name != "") && (v == 0)) { + ship[new_ship] = flagship_name; + } + } + } + + for (var i = 0; i < strike_cruisers; i++) { + new_player_ship("Strike Cruiser"); + } + + for (var i = 0; i < gladius; i++) { + new_player_ship("Gladius"); + } + + for (var i = 0; i < hunters; i++) { + new_player_ship("Hunter"); + } + + #endregion + + // :D :D :D + master_tau = 0; + master_battlesuits = 0; + master_kroot = 0; + master_tau_vehicles = 0; + master_ork_boyz = 0; + master_ork_nobz = 0; + master_ork_warboss = 0; + master_ork_vehicles = 0; + master_heretics = 0; + master_chaos_marines = 0; + master_lesser_demons = 0; + master_greater_demons = 0; + master_chaos_vehicles = 0; + master_gaunts = 0; + master_warriors = 0; + master_carnifex = 0; + master_synapse = 0; + master_tyrant = 0; + master_gene = 0; + master_avatar = 0; + master_farseer = 0; + master_autarch = 0; + master_eldar = 0; + master_aspect = 0; + master_eldar_vehicles = 0; + master_necron_overlord = 0; + master_destroyer = 0; + master_necron = 0; + master_wraith = 0; + master_necron_vehicles = 0; + master_monolith = 0; + master_special_killed = ""; + + check_number = 5; + year_fraction = 0; // 84 per turn + if (obj_creation.chapter_year == 0) { + year = 735; + } + if (obj_creation.chapter_year != 0) { + year = obj_creation.chapter_year; + } + millenium = 41; + + #region Determine Total Number of Marines per Company and Role + var company = 0; + var second = 100, third = 100, fourth = 100, fifth = 100, sixth = 100, seventh = 100, eighth = 100, ninth = 100, tenth = 100; + var siege = 0, temp1 = 0, intolerant = 0; + var k, v; + k = 0; + v = 0; + + /* Default Specialists */ + var chaplains = 8, chaplains_per_company = 1, techmarines = 8, techmarines_per_company = 1, apothecary = 8, apothecary_per_company = 1, epistolary = 2, epistolary_per_company = 1, codiciery = 2, lexicanum = 4, terminator = 20, veteran = 85, assault = 20, devastator = 20, dreadnought = 1, rhino = 8, whirlwind = 4, landspeeder = 2, predator = 2, landraider = 6; + + /* Used for summing total count */ + specials = 0; + firsts = 0; + seconds = 0; + thirds = 0; + fourths = 0; + fifths = 0; + sixths = 0; + sevenths = 0; + eighths = 0; + ninths = 0; + tenths = 0; + + /*techs=20;epistolary=5;apothecary=6;codiciery=6;lexicanum=10;terminator=30;veteran=30; second=9;third=9;fourth=9;fifth=9;sixth=9;seventh=9;ei; ninth=9;tenth=10; assault=2;siege=0;devastator=2;*/ - var chapter_option, o; - if scr_has_adv("Lightning Warriors") { - rhino -= 2; - landspeeder += 2; - } - if scr_has_adv("Tech-Brothers") { - techmarines += 5; - tenth -= 5; - predator += 2; - } - if scr_has_adv("Assault Doctrine") { - assault += 10; - devastator -= 10; - } - if scr_has_adv("Devastator Doctrine") { - assault -= 10; - devastator += 10; - } - if scr_has_adv("Siege Masters") { - siege = 1; - } - if scr_has_adv("Crafters") { - techmarines += 2; - terminator += 5; - tenth -= 5; - } - if scr_has_adv("Warp Touched") { - tenth -= 5; - epistolary += 1; - codiciery += 2; - lexicanum += 2; - } - if scr_has_disadv("Psyker Intolerant") { - epistolary = 0; - codiciery = 0; - lexicanum = 0; - epistolary_per_company = 0; - veteran += 10; - tenth += 10; - intolerant = 1; - } - if scr_has_disadv("Fresh Blood") { - epistolary -= 1; - codiciery -= 1; - lexicanum -= 2; - tenth += 4; - } - if scr_has_disadv("Sieged") { - techmarines -= 4; - epistolary -= 1; - codiciery -= 1; - lexicanum -= 2; - apothecary -= 4; - chaplains -= 4; - terminator -= 10; - veteran -= 50; - second -= 30; - third -= 30; - fourth -= 30; - fifth -= 60; - sixth -= 60; - seventh -= 60; - eighth -= 70; - ninth -= 70; - tenth -= 70; // 370 - assault = 10; - siege = 0; - devastator = 10; - dreadnought += 1; - } - if scr_has_adv("Venerable Ancients") { - veteran -= 10; - second -= 10; - third -= 10; - fourth -= 10; - fifth -= 10; - sixth -= 10; - seventh -= 10; - eighth -= 10; - ninth -= 10; - tenth -= 10; - dreadnought += 1; - } - if (obj_creation.equal_specialists < 2) and scr_has_disadv("Obliterated") { - techmarines -= 7; - epistolary -= 2; - codiciery -= 1; - lexicanum -= 4; - apothecary -= 7; - chaplains -= 7; - terminator = 0; - veteran = 0; - second = 0; - third = 0; - fourth = 0; - fifth = 0; - sixth = 0; - seventh = 0; - eighth = 0; - ninth = 0; - tenth = 10; - assault = 0; - devastator = 0; - landraider = 0; - landspeeder = 0; - rhino = 0; - whirlwind = 0; - dreadnought = 0; - - } - if scr_has_disadv("Enduring Angels") { - fifth = 0; - sixth = 0; - seventh = 0; - eighth = 0; - ninth = 0; - } - if scr_has_disadv("Serpents Delight") { - techmarines -= 5; - epistolary -= 1; - lexicanum -= 3; - apothecary -= 5; - chaplains -= 5; - terminator = 0; - veteran = 0; - second = 0; - third = 0; - fourth = 0; - tenth = 0; - } - if scr_has_disadv ("Tech-Heresy") { - techmarines -= 5; - tenth += 5; - } - if scr_has_disadv ("Small Apothecarion") { - apothecary -= 5; - tenth += 5; - } - if scr_has_disadv ("Small Librarius") { - epistolary -= 1; - codiciery -= 1; - lexicanum -= 2; - tenth += 5; - } - if scr_has_disadv ("Small Reclusiam") { - chaplains = max(1, chaplains - 5); - tenth += 5; - } - if scr_has_adv ("Reverent Guardians") { - chaplains += 5; - tenth -= 5; - } - if scr_has_adv("Medicae Primacy") { - apothecary_per_company += 1; - apothecary += 5; - } - - if(global.chapter_name == "Lamenters"){ - predator = 0; - } - if(global.chapter_name == "Iron Hands"){ - predator += 1; - } - - if (obj_creation.strength <= 4) then ninth = 0; - if (obj_creation.strength <= 3) then eighth = 0; - if (obj_creation.strength <= 2) then seventh = 0; - if (obj_creation.strength <= 1) then sixth = 0; - - var bonus_marines = 0; - if (obj_creation.strength > 5) then bonus_marines = (obj_creation.strength - 5) * 50; - if scr_has_disadv("Obliterated") then bonus_marines = (obj_creation.strength - 1) * 10; - var i = 0; - while (bonus_marines >= 5) { - switch (i % 10) { - case 0: - if (veteran > 0) { - bonus_marines -= 5; - veteran += 5; - } - break; - case 1: - if (second > 0) { - bonus_marines -= 5; - second += 5; - } - break; - case 2: - if (third > 0) { - bonus_marines -= 5; - third += 5; - } - break; - case 3: - if (fourth > 0) { - bonus_marines -= 5; - fourth += 5; - } - break; - case 4: - if (fifth > 0) { - bonus_marines -= 5; - fifth += 5; - } - break; - case 5: - if (sixth > 0) { - bonus_marines -= 5; - sixth += 5; - } - break; - case 6: - if (seventh > 0) { - bonus_marines -= 5; - seventh += 5; - } - break; - case 7: - if (eighth > 0) { - bonus_marines -= 5; - eighth += 5; - } - break; - case 8: - if (ninth > 0) { - bonus_marines -= 5; - ninth += 5; - } - break; - case 9: - if (tenth > 0) { - bonus_marines -= 5; - tenth += 5; - } - break; - } - i++; - } - - if (struct_exists(obj_creation, "extra_specialists")) { - var c_specialists = obj_creation.extra_specialists; - var c_specialist_names = struct_get_names(c_specialists); - for (var s = 0; s < array_length(c_specialist_names); s++) { - var s_name = c_specialist_names[s]; - var s_val = struct_get(c_specialists, s_name); - // show_debug_message($"updating specialist {s_name} with {s_val})"); - switch (s_name) { - case "chaplains": - chaplains = chaplains + real(s_val); - break; - case "chaplains_per_company": - chaplains_per_company = chaplains_per_company + real(s_val); - break; - case "techmarines": - techmarines = techmarines + real(s_val); - break; - case "techmarines_per_company": - techmarines_per_company = techmarines_per_company + real(s_val); - break; - case "apothecary": - apothecary = apothecary + real(s_val); - break; - case "apothecary_per_company": - apothecary_per_company = apothecary_per_company + real(s_val); - break; - case "epistolary": - epistolary = epistolary + real(s_val); - break; - case "epistolary_per_company": - epistolary_per_company = epistolary_per_company + real(s_val); - break; - case "codiciery": - codiciery = codiciery + real(s_val); - break; - case "lexicanum": - lexicanum = lexicanum + real(s_val); - break; - case "terminator": - terminator = terminator + real(s_val); - break; - case "assault": - assault = assault + real(s_val); - break; - case "veteran": - veteran = veteran + real(s_val); - break; - case "devastator": - devastator = devastator + real(s_val); - break; - case "dreadnought": - case "Contemptor Dreadnought": - dreadnought = dreadnought + real(s_val); - break; - } - } - } - - if(struct_exists(obj_creation, "extra_marines")){ - var c_marines = obj_creation.extra_marines; - var c_marines_names = struct_get_names(c_marines); - for(var s = 0; s < array_length(c_marines_names); s++){ - var s_name = c_marines_names[s]; - var s_val = struct_get(c_marines, s_name); - switch(s_name){ - case "second": second = second + real(s_val); break; - case "third": third = third + real(s_val); break; - case "fourth": fourth = fourth + real(s_val); break; - case "fifth": fifth = fifth + real(s_val); break; - case "sixth": sixth = sixth + real(s_val); break; - case "seventh": seventh = seventh + real(s_val); break; - case "eighth": eighth = eighth + real(s_val); break; - case "ninth": ninth = ninth + real(s_val); break; - case "tenth": tenth = tenth + real(s_val); break; - } - } - } - if(chaplains <= 0) {chaplains_per_company = 0}; - if(apothecary <= 0) {apothecary_per_company = 0}; - if(techmarines <= 0) {techmarines_per_company = 0}; - if(epistolary <= 0) {epistolary_per_company = 0}; - - - if (obj_creation.custom == eCHAPTER_TYPE.PREMADE) { - if (veteran >= 20) and(global.founding = ePROGENITOR.NONE) { - veteran -= 20; - terminator += 20; - } - if (veteran >= 10) and(global.founding != ePROGENITOR.NONE) and(global.chapter_name != "Lamenters") { - veteran -= 10; - terminator += 10; - } - } - - #endregion - - - - battle_cry = obj_creation.battle_cry; - home_name = obj_creation.homeworld_name; - - // This needs to be updated - main_color = obj_creation.main_color; - secondary_color = obj_creation.secondary_color; - main_trim = obj_creation.main_trim; - left_pauldron = obj_creation.left_pauldron; - right_pauldron = obj_creation.right_pauldron; - lens_color = obj_creation.lens_color; - weapon_color = obj_creation.weapon_color; - col_special = obj_creation.col_special; - trim = obj_creation.trim; - skin_color = obj_creation.skin_color; - full_liveries = obj_creation.full_liveries; + var chapter_option, o; + if (scr_has_adv("Lightning Warriors")) { + rhino -= 2; + landspeeder += 2; + } + if (scr_has_adv("Tech-Brothers")) { + techmarines += 5; + tenth -= 5; + predator += 2; + } + if (scr_has_adv("Assault Doctrine")) { + assault += 10; + devastator -= 10; + } + if (scr_has_adv("Devastator Doctrine")) { + assault -= 10; + devastator += 10; + } + if (scr_has_adv("Siege Masters")) { + siege = 1; + } + if (scr_has_adv("Crafters")) { + techmarines += 2; + terminator += 5; + tenth -= 5; + } + if (scr_has_adv("Warp Touched")) { + tenth -= 5; + epistolary += 1; + codiciery += 2; + lexicanum += 2; + } + if (scr_has_disadv("Psyker Intolerant")) { + epistolary = 0; + codiciery = 0; + lexicanum = 0; + epistolary_per_company = 0; + veteran += 10; + tenth += 10; + intolerant = 1; + } + if (scr_has_disadv("Fresh Blood")) { + epistolary -= 1; + codiciery -= 1; + lexicanum -= 2; + tenth += 4; + } + if (scr_has_disadv("Sieged")) { + techmarines -= 4; + epistolary -= 1; + codiciery -= 1; + lexicanum -= 2; + apothecary -= 4; + chaplains -= 4; + terminator -= 10; + veteran -= 50; + second -= 30; + third -= 30; + fourth -= 30; + fifth -= 60; + sixth -= 60; + seventh -= 60; + eighth -= 70; + ninth -= 70; + tenth -= 70; // 370 + assault = 10; + siege = 0; + devastator = 10; + dreadnought += 1; + } + if (scr_has_adv("Venerable Ancients")) { + veteran -= 10; + second -= 10; + third -= 10; + fourth -= 10; + fifth -= 10; + sixth -= 10; + seventh -= 10; + eighth -= 10; + ninth -= 10; + tenth -= 10; + dreadnought += 1; + } + if ((obj_creation.equal_specialists < 2) && scr_has_disadv("Obliterated")) { + techmarines -= 7; + epistolary -= 2; + codiciery -= 1; + lexicanum -= 4; + apothecary -= 7; + chaplains -= 7; + terminator = 0; + veteran = 0; + second = 0; + third = 0; + fourth = 0; + fifth = 0; + sixth = 0; + seventh = 0; + eighth = 0; + ninth = 0; + tenth = 10; + assault = 0; + devastator = 0; + landraider = 0; + landspeeder = 0; + rhino = 0; + whirlwind = 0; + dreadnought = 0; + } + if (scr_has_disadv("Enduring Angels")) { + fifth = 0; + sixth = 0; + seventh = 0; + eighth = 0; + ninth = 0; + } + if (scr_has_disadv("Serpents Delight")) { + techmarines -= 5; + epistolary -= 1; + lexicanum -= 3; + apothecary -= 5; + chaplains -= 5; + terminator = 0; + veteran = 0; + second = 0; + third = 0; + fourth = 0; + tenth = 0; + } + if (scr_has_disadv("Tech-Heresy")) { + techmarines -= 5; + tenth += 5; + } + if (scr_has_disadv("Small Apothecarion")) { + apothecary -= 5; + tenth += 5; + } + if (scr_has_disadv("Small Librarius")) { + epistolary -= 1; + codiciery -= 1; + lexicanum -= 2; + tenth += 5; + } + if (scr_has_disadv("Small Reclusiam")) { + chaplains = max(1, chaplains - 5); + tenth += 5; + } + if (scr_has_adv("Reverent Guardians")) { + chaplains += 5; + tenth -= 5; + } + if (scr_has_adv("Medicae Primacy")) { + apothecary_per_company += 1; + apothecary += 5; + } + + if (global.chapter_name == "Lamenters") { + predator = 0; + } + if (global.chapter_name == "Iron Hands") { + predator += 1; + } + + if (obj_creation.strength <= 4) { + ninth = 0; + } + if (obj_creation.strength <= 3) { + eighth = 0; + } + if (obj_creation.strength <= 2) { + seventh = 0; + } + if (obj_creation.strength <= 1) { + sixth = 0; + } + + var bonus_marines = 0; + if (obj_creation.strength > 5) { + bonus_marines = (obj_creation.strength - 5) * 50; + } + if (scr_has_disadv("Obliterated")) { + bonus_marines = (obj_creation.strength - 1) * 10; + } + var i = 0; + while (bonus_marines >= 5) { + switch (i % 10) { + case 0: + if (veteran > 0) { + bonus_marines -= 5; + veteran += 5; + } + break; + case 1: + if (second > 0) { + bonus_marines -= 5; + second += 5; + } + break; + case 2: + if (third > 0) { + bonus_marines -= 5; + third += 5; + } + break; + case 3: + if (fourth > 0) { + bonus_marines -= 5; + fourth += 5; + } + break; + case 4: + if (fifth > 0) { + bonus_marines -= 5; + fifth += 5; + } + break; + case 5: + if (sixth > 0) { + bonus_marines -= 5; + sixth += 5; + } + break; + case 6: + if (seventh > 0) { + bonus_marines -= 5; + seventh += 5; + } + break; + case 7: + if (eighth > 0) { + bonus_marines -= 5; + eighth += 5; + } + break; + case 8: + if (ninth > 0) { + bonus_marines -= 5; + ninth += 5; + } + break; + case 9: + if (tenth > 0) { + bonus_marines -= 5; + tenth += 5; + } + break; + } + i++; + } + + if (struct_exists(obj_creation, "extra_specialists")) { + var c_specialists = obj_creation.extra_specialists; + var c_specialist_names = struct_get_names(c_specialists); + for (var s = 0; s < array_length(c_specialist_names); s++) { + var s_name = c_specialist_names[s]; + var s_val = struct_get(c_specialists, s_name); + // show_debug_message($"updating specialist {s_name} with {s_val})"); + switch (s_name) { + case "chaplains": + chaplains = chaplains + real(s_val); + break; + case "chaplains_per_company": + chaplains_per_company = chaplains_per_company + real(s_val); + break; + case "techmarines": + techmarines = techmarines + real(s_val); + break; + case "techmarines_per_company": + techmarines_per_company = techmarines_per_company + real(s_val); + break; + case "apothecary": + apothecary = apothecary + real(s_val); + break; + case "apothecary_per_company": + apothecary_per_company = apothecary_per_company + real(s_val); + break; + case "epistolary": + epistolary = epistolary + real(s_val); + break; + case "epistolary_per_company": + epistolary_per_company = epistolary_per_company + real(s_val); + break; + case "codiciery": + codiciery = codiciery + real(s_val); + break; + case "lexicanum": + lexicanum = lexicanum + real(s_val); + break; + case "terminator": + terminator = terminator + real(s_val); + break; + case "assault": + assault = assault + real(s_val); + break; + case "veteran": + veteran = veteran + real(s_val); + break; + case "devastator": + devastator = devastator + real(s_val); + break; + case "dreadnought": + case "Contemptor Dreadnought": + dreadnought = dreadnought + real(s_val); + break; + } + } + } + + if (struct_exists(obj_creation, "extra_marines")) { + var c_marines = obj_creation.extra_marines; + var c_marines_names = struct_get_names(c_marines); + for (var s = 0; s < array_length(c_marines_names); s++) { + var s_name = c_marines_names[s]; + var s_val = struct_get(c_marines, s_name); + switch (s_name) { + case "second": + second = second + real(s_val); + break; + case "third": + third = third + real(s_val); + break; + case "fourth": + fourth = fourth + real(s_val); + break; + case "fifth": + fifth = fifth + real(s_val); + break; + case "sixth": + sixth = sixth + real(s_val); + break; + case "seventh": + seventh = seventh + real(s_val); + break; + case "eighth": + eighth = eighth + real(s_val); + break; + case "ninth": + ninth = ninth + real(s_val); + break; + case "tenth": + tenth = tenth + real(s_val); + break; + } + } + } + if (chaplains <= 0) { + chaplains_per_company = 0; + } + if (apothecary <= 0) { + apothecary_per_company = 0; + } + if (techmarines <= 0) { + techmarines_per_company = 0; + } + if (epistolary <= 0) { + epistolary_per_company = 0; + } + + if (obj_creation.custom == eCHAPTER_TYPE.PREMADE) { + if ((veteran >= 20) && (global.founding == ePROGENITOR.NONE)) { + veteran -= 20; + terminator += 20; + } + if ((veteran >= 10) && (global.founding != ePROGENITOR.NONE) && (global.chapter_name != "Lamenters")) { + veteran -= 10; + terminator += 10; + } + } + + #endregion + + battle_cry = obj_creation.battle_cry; + home_name = obj_creation.homeworld_name; + + // This needs to be updated + main_color = obj_creation.main_color; + secondary_color = obj_creation.secondary_color; + main_trim = obj_creation.main_trim; + left_pauldron = obj_creation.left_pauldron; + right_pauldron = obj_creation.right_pauldron; + lens_color = obj_creation.lens_color; + weapon_color = obj_creation.weapon_color; + col_special = obj_creation.col_special; + trim = obj_creation.trim; + skin_color = obj_creation.skin_color; + full_liveries = obj_creation.full_liveries; company_liveries = obj_creation.company_liveries; - for (var i=1;i>} - TTRPG[0, i] = new TTRPG_stats("chapter", 0, i, "blank"); - } + master_name = obj_creation.chapter_master_name; + chief_librarian_name = obj_creation.clibrarian; + high_chaplain_name = obj_creation.hchaplain; + high_apothecary_name = obj_creation.hapothecary; + forge_master_name = obj_creation.fmaster; + honor_captain_name = obj_creation.honorcapt; //1st + watch_master_name = obj_creation.watchmaster; //2nd + arsenal_master_name = obj_creation.arsenalmaster; //3rd + lord_admiral_name = obj_creation.admiral; //4th + march_master_name = obj_creation.marchmaster; //5th + rites_master_name = obj_creation.ritesmaster; //6th + chief_victualler_name = obj_creation.victualler; //7th + lord_executioner_name = obj_creation.lordexec; //8th + relic_master_name = obj_creation.relmaster; //9th + recruiter_name = obj_creation.recruiter; //10th + + master_melee = obj_creation.chapter_master_melee; + master_ranged = obj_creation.chapter_master_ranged; + + #region Initialize Loadouts and 2d array garbage + company = 0; + // Initialize default marines for loadouts + for (var i = 0; i <= 100; i++) { + race[100][i] = 1; + name[100][i] = ""; + role[100][i] = ""; + wep1[100][i] = ""; + spe[100][i] = ""; + wep2[100][i] = ""; + armour[100][i] = ""; + gear[100][i] = ""; + mobi[100][i] = ""; + age[100][i] = ((millenium * 1000) + year) - 10; + god[100][i] = 0; + } + initialized = 500; + // Initialize special marines + for (var i = 0; i <= 500; i++) { + race[0][i] = 1; + name[0][i] = ""; + role[0][i] = ""; + wep1[0][i] = ""; + spe[0][i] = ""; + wep2[0][i] = ""; + armour[0][i] = ""; + gear[0][i] = ""; + mobi[0][i] = ""; + age[0][i] = ((millenium * 1000) + year) - 10; + god[0][i] = 0; + /// @type {Array>} + TTRPG[0][i] = new TTRPG_stats("chapter", 0, i, "blank"); + } for (var i = 0; i <= 100; i++) { - role[100, i] = ""; - wep1[100, i] = ""; - wep2[100, i] = ""; - armour[100, i] = ""; - gear[100, i] = ""; - mobi[100, i] = ""; //hirelings?? - role[102, i] = ""; - wep1[102, i] = ""; - wep2[102, i] = ""; - armour[102, i] = ""; - gear[102, i] = ""; - mobi[102, i] = ""; //hirelings?? - } - - defaults_slot = 100; - - function load_default_gear(_role_id, _role_name, _wep1, _wep2, _armour, _mobi, _gear){ - role[defaults_slot, _role_id] = _role_name; - wep1[defaults_slot, _role_id] = _wep1; - wep2[defaults_slot, _role_id] = _wep2; - armour[defaults_slot, _role_id] = _armour; - mobi[defaults_slot, _role_id] = _mobi; - gear[defaults_slot, _role_id] = _gear; - race[defaults_slot, _role_id] = 1; - } - var _hi_qual_armour = "Artificer Armour"; - if(scr_has_disadv("Poor Equipment")){ - _hi_qual_armour = STR_ANY_POWER_ARMOUR; - } - - load_default_gear(eROLE.ChapterMaster, "Chapter Master", "Power Sword", "Bolt Pistol", _hi_qual_armour, "","Iron Halo"); - load_default_gear(eROLE.HonourGuard, "Honour Guard", "Power Sword", "Bolter", _hi_qual_armour, "", ""); - load_default_gear(eROLE.Veteran, "Veteran", "Combiflamer", "Combat Knife",STR_ANY_POWER_ARMOUR, "", ""); - load_default_gear(eROLE.Terminator, "Terminator", "Power Fist", "Storm Bolter", "Terminator Armour", "", ""); - load_default_gear(eROLE.Captain, "Captain", "Power Sword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Iron Halo"); - load_default_gear(eROLE.Dreadnought, "Dreadnought", "Close Combat Weapon", "Lascannon", "Dreadnought", "", ""); - load_default_gear(eROLE.Champion, "Champion", "Power Sword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Combat Shield"); - load_default_gear(eROLE.Tactical, "Tactical", "Bolter", "Combat Knife", STR_ANY_POWER_ARMOUR, "", ""); - load_default_gear(eROLE.Devastator, "Devastator", "", "Combat Knife", STR_ANY_POWER_ARMOUR, "", ""); - load_default_gear(eROLE.Assault, "Assault", "Chainsword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "Jump Pack", ""); - load_default_gear(eROLE.Ancient, "Ancient", "Company Standard", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", ""); - load_default_gear(eROLE.Scout, "Scout", "Bolter", "Combat Knife", "Scout Armour", "", ""); - load_default_gear(eROLE.Chaplain, "Chaplain", "Crozius Arcanum", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Rosarius"); - load_default_gear(eROLE.Apothecary, "Apothecary", "Chainsword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Narthecium"); - load_default_gear(eROLE.Techmarine, "Techmarine", "Power Axe", "Bolt Pistol", _hi_qual_armour, "Servo-arm", ""); - load_default_gear(eROLE.Librarian, "Librarian", "Force Staff", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Psychic Hood"); - load_default_gear(eROLE.Sergeant, "Sergeant", "Chainsword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", ""); - load_default_gear(eROLE.VeteranSergeant, "Veteran Sergeant", "Chainsword", "Plasma Pistol", STR_ANY_POWER_ARMOUR, "", ""); - - - if(struct_exists(obj_creation, "custom_roles")){ - var c_roles = obj_creation.custom_roles; - var possible_custom_roles = [ - ["chapter_master", eROLE.ChapterMaster], - ["honour_guard",eROLE.HonourGuard], - ["veteran",eROLE.Veteran], - ["terminator",eROLE.Terminator], - ["captain",eROLE.Captain], - ["dreadnought",eROLE.Dreadnought], - ["champion",eROLE.Champion], - ["tactical",eROLE.Tactical], - ["devastator",eROLE.Devastator], - ["assault",eROLE.Assault], - ["ancient",eROLE.Ancient], - ["scout",eROLE.Scout], - ["chaplain",eROLE.Chaplain], - ["apothecary",eROLE.Apothecary], - ["techmarine",eROLE.Techmarine], - ["librarian",eROLE.Librarian], - ["sergeant",eROLE.Sergeant], - ["veteran_sergeant",eROLE.VeteranSergeant], - ]; - var possible_custom_attributes = [ - "name", "wep1", "wep2", "mobi","gear","armour" - ] - /** + role[100][i] = ""; + wep1[100][i] = ""; + wep2[100][i] = ""; + armour[100][i] = ""; + gear[100][i] = ""; + mobi[100][i] = ""; //hirelings?? + role[102][i] = ""; + wep1[102][i] = ""; + wep2[102][i] = ""; + armour[102][i] = ""; + gear[102][i] = ""; + mobi[102][i] = ""; //hirelings?? + } + + defaults_slot = 100; + + function load_default_gear(_role_id, _role_name, _wep1, _wep2, _armour, _mobi, _gear) { + role[defaults_slot][_role_id] = _role_name; + wep1[defaults_slot][_role_id] = _wep1; + wep2[defaults_slot][_role_id] = _wep2; + armour[defaults_slot][_role_id] = _armour; + mobi[defaults_slot][_role_id] = _mobi; + gear[defaults_slot][_role_id] = _gear; + race[defaults_slot][_role_id] = 1; + } + var _hi_qual_armour = "Artificer Armour"; + if (scr_has_disadv("Poor Equipment")) { + _hi_qual_armour = STR_ANY_POWER_ARMOUR; + } + + load_default_gear(eROLE.ChapterMaster, "Chapter Master", "Power Sword", "Bolt Pistol", _hi_qual_armour, "", "Iron Halo"); + load_default_gear(eROLE.HonourGuard, "Honour Guard", "Power Sword", "Bolter", _hi_qual_armour, "", ""); + load_default_gear(eROLE.Veteran, "Veteran", "Combiflamer", "Combat Knife", STR_ANY_POWER_ARMOUR, "", ""); + load_default_gear(eROLE.Terminator, "Terminator", "Power Fist", "Storm Bolter", "Terminator Armour", "", ""); + load_default_gear(eROLE.Captain, "Captain", "Power Sword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Iron Halo"); + load_default_gear(eROLE.Dreadnought, "Dreadnought", "Close Combat Weapon", "Lascannon", "Dreadnought", "", ""); + load_default_gear(eROLE.Champion, "Champion", "Power Sword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Combat Shield"); + load_default_gear(eROLE.Tactical, "Tactical", "Bolter", "Combat Knife", STR_ANY_POWER_ARMOUR, "", ""); + load_default_gear(eROLE.Devastator, "Devastator", "", "Combat Knife", STR_ANY_POWER_ARMOUR, "", ""); + load_default_gear(eROLE.Assault, "Assault", "Chainsword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "Jump Pack", ""); + load_default_gear(eROLE.Ancient, "Ancient", "Company Standard", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", ""); + load_default_gear(eROLE.Scout, "Scout", "Bolter", "Combat Knife", "Scout Armour", "", ""); + load_default_gear(eROLE.Chaplain, "Chaplain", "Crozius Arcanum", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Rosarius"); + load_default_gear(eROLE.Apothecary, "Apothecary", "Chainsword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Narthecium"); + load_default_gear(eROLE.Techmarine, "Techmarine", "Power Axe", "Bolt Pistol", _hi_qual_armour, "Servo-arm", ""); + load_default_gear(eROLE.Librarian, "Librarian", "Force Staff", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Psychic Hood"); + load_default_gear(eROLE.Sergeant, "Sergeant", "Chainsword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", ""); + load_default_gear(eROLE.VeteranSergeant, "Veteran Sergeant", "Chainsword", "Plasma Pistol", STR_ANY_POWER_ARMOUR, "", ""); + + if (struct_exists(obj_creation, "custom_roles")) { + var c_roles = obj_creation.custom_roles; + var possible_custom_roles = [["chapter_master", eROLE.ChapterMaster], ["honour_guard", eROLE.HonourGuard], ["veteran", eROLE.Veteran], ["terminator", eROLE.Terminator], ["captain", eROLE.Captain], ["dreadnought", eROLE.Dreadnought], ["champion", eROLE.Champion], ["tactical", eROLE.Tactical], ["devastator", eROLE.Devastator], ["assault", eROLE.Assault], ["ancient", eROLE.Ancient], ["scout", eROLE.Scout], ["chaplain", eROLE.Chaplain], ["apothecary", eROLE.Apothecary], ["techmarine", eROLE.Techmarine], ["librarian", eROLE.Librarian], ["sergeant", eROLE.Sergeant], ["veteran_sergeant", eROLE.VeteranSergeant]]; + var possible_custom_attributes = ["name", "wep1", "wep2", "mobi", "gear", "armour"]; + /** * check whether the json structure exists to populate custom role names and * attributes then set them using the map above * role[100] is the 'default role name' storage spot, or something */ - for(var c = 0; c < array_length(possible_custom_roles); c++){ - if(struct_exists(c_roles, possible_custom_roles[c][0])){ - var c_rolename = possible_custom_roles[c][0]; - var c_roleid = possible_custom_roles[c][1]; - for(var a = 0; a < array_length(possible_custom_attributes); a++){ - var attribute = possible_custom_attributes[a]; - if(struct_exists(c_roles[$ c_rolename], attribute)){ - var value = c_roles[$ c_rolename][$ attribute]; - // var dbg_m = $"role {c_roleid} {c_rolename} updated {attribute} to {typeof(value)} {value}"; - // log_message(dbg_m); - // show_debug_message(dbg_m); - switch (attribute){ - case "name": role[defaults_slot][c_roleid] = value; break; - case "wep1": wep1[defaults_slot][c_roleid] = value; break; - case "wep2": wep2[defaults_slot][c_roleid] = value; break; - case "armour": armour[defaults_slot][c_roleid] = value; break; - case "gear": gear[defaults_slot][c_roleid] = value; break; - case "mobi": mobi[defaults_slot][c_roleid] = value; break; - } - // array_set_value(obj_ini[attribute][100][c_roleid], value); - // [$attribute][100][c_roleid] = value; - } - } - } - } - } - - var roles = { - chapter_master: role[defaults_slot][eROLE.ChapterMaster], - honour_guard: role[defaults_slot][eROLE.HonourGuard], - veteran: role[defaults_slot][eROLE.Veteran], - terminator: role[defaults_slot][eROLE.Terminator], - captain: role[defaults_slot][eROLE.Captain], - dreadnought: role[defaults_slot][eROLE.Dreadnought], - champion: role[defaults_slot][eROLE.Champion], - tactical: role[defaults_slot][eROLE.Tactical], - devastator: role[defaults_slot][eROLE.Devastator], - assault: role[defaults_slot][eROLE.Assault], - ancient: role[defaults_slot][eROLE.Ancient], - scout: role[defaults_slot][eROLE.Scout], - chaplain: role[defaults_slot][eROLE.Chaplain], - apothecary: role[defaults_slot][eROLE.Apothecary], - techmarine: role[defaults_slot][eROLE.Techmarine], - librarian: role[defaults_slot][eROLE.Librarian], - sergeant: role[defaults_slot][eROLE.Sergeant], - veteran_sergeant: role[defaults_slot][eROLE.VeteranSergeant], - } - // log_message($"roles: {json_stringify(roles, true)}") - - var weapon_lists = { - heavy_weapons: ["Heavy Bolter", "Heavy Bolter", "Heavy Bolter", "Heavy Bolter", "Missile Launcher", "Missile Launcher", "Multi-Melta", "Lascannon"], - special_weapons: ["Flamer", "Flamer", "Flamer", "Meltagun", "Meltagun", "Plasma Gun"], - melee_weapons: ["Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Power Sword", "Power Sword", "Power Sword", "Lightning Claw", "Lightning Claw", "Lightning Claw", "Power Fist", "Power Fist"], - ranged_weapons: ["Bolter", "Bolter", "Bolter", "Bolter", "Bolter", "Bolter", "Storm Bolter", "Storm Bolter", "Storm Bolter", "Combiflamer", "Combiflamer", "Plasma Pistol"], - pistols: ["Bolt Pistol", "Bolt Pistol", "Bolt Pistol", "Bolt Pistol", "Plasma Pistol"], - one_hand_melee: ["Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Power Sword", "Power Sword", "Power Sword", "Lightning Claw", "Lightning Claw", "Lightning Claw", "Power Fist", "Power Fist", "Thunder Hammer"], - } - - var weapon_weighted_lists = { - heavy_weapons: [["Heavy Bolter", 4], ["Missile Launcher", 3], ["Multi-Melta", 2], ["Lascannon", 1]], - special_weapons: [["Flamer", 3], ["Meltagun", 2], ["Plasma Gun", 1]], - melee_weapons: [["Chainsword", 5], ["Power Sword", 4], ["Lightning Claw", 3], ["Power Fist", 2], ["Thunder Hammer", 1]], - ranged_weapons: [["Bolter", 10], ["Storm Bolter", 3], ["Combiflamer", 2], ["Plasma Pistol", 1]], - pistols: [["Bolt Pistol", 5], ["Plasma Pistol", 1]], - } - #endregion - - #region Squad Loadouts - /* + for (var c = 0; c < array_length(possible_custom_roles); c++) { + if (struct_exists(c_roles, possible_custom_roles[c][0])) { + var c_rolename = possible_custom_roles[c][0]; + var c_roleid = possible_custom_roles[c][1]; + for (var a = 0; a < array_length(possible_custom_attributes); a++) { + var attribute = possible_custom_attributes[a]; + if (struct_exists(c_roles[$ c_rolename], attribute)) { + var value = c_roles[$ c_rolename][$ attribute]; + // var dbg_m = $"role {c_roleid} {c_rolename} updated {attribute} to {typeof(value)} {value}"; + // log_message(dbg_m); + // show_debug_message(dbg_m); + switch (attribute) { + case "name": + role[defaults_slot][c_roleid] = value; + break; + case "wep1": + wep1[defaults_slot][c_roleid] = value; + break; + case "wep2": + wep2[defaults_slot][c_roleid] = value; + break; + case "armour": + armour[defaults_slot][c_roleid] = value; + break; + case "gear": + gear[defaults_slot][c_roleid] = value; + break; + case "mobi": + mobi[defaults_slot][c_roleid] = value; + break; + } + // array_set_value(obj_ini[attribute][100][c_roleid], value); + // [$attribute][100][c_roleid] = value; + } + } + } + } + } + + var roles = { + chapter_master: role[defaults_slot][eROLE.ChapterMaster], + honour_guard: role[defaults_slot][eROLE.HonourGuard], + veteran: role[defaults_slot][eROLE.Veteran], + terminator: role[defaults_slot][eROLE.Terminator], + captain: role[defaults_slot][eROLE.Captain], + dreadnought: role[defaults_slot][eROLE.Dreadnought], + champion: role[defaults_slot][eROLE.Champion], + tactical: role[defaults_slot][eROLE.Tactical], + devastator: role[defaults_slot][eROLE.Devastator], + assault: role[defaults_slot][eROLE.Assault], + ancient: role[defaults_slot][eROLE.Ancient], + scout: role[defaults_slot][eROLE.Scout], + chaplain: role[defaults_slot][eROLE.Chaplain], + apothecary: role[defaults_slot][eROLE.Apothecary], + techmarine: role[defaults_slot][eROLE.Techmarine], + librarian: role[defaults_slot][eROLE.Librarian], + sergeant: role[defaults_slot][eROLE.Sergeant], + veteran_sergeant: role[defaults_slot][eROLE.VeteranSergeant], + }; + // log_message($"roles: {json_stringify(roles, true)}") + + var weapon_lists = { + heavy_weapons: ["Heavy Bolter", "Heavy Bolter", "Heavy Bolter", "Heavy Bolter", "Missile Launcher", "Missile Launcher", "Multi-Melta", "Lascannon"], + special_weapons: ["Flamer", "Flamer", "Flamer", "Meltagun", "Meltagun", "Plasma Gun"], + melee_weapons: ["Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Power Sword", "Power Sword", "Power Sword", "Lightning Claw", "Lightning Claw", "Lightning Claw", "Power Fist", "Power Fist"], + ranged_weapons: ["Bolter", "Bolter", "Bolter", "Bolter", "Bolter", "Bolter", "Storm Bolter", "Storm Bolter", "Storm Bolter", "Combiflamer", "Combiflamer", "Plasma Pistol"], + pistols: ["Bolt Pistol", "Bolt Pistol", "Bolt Pistol", "Bolt Pistol", "Plasma Pistol"], + one_hand_melee: ["Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Chainsword", "Power Sword", "Power Sword", "Power Sword", "Lightning Claw", "Lightning Claw", "Lightning Claw", "Power Fist", "Power Fist", "Thunder Hammer"], + }; + + var weapon_weighted_lists = { + heavy_weapons: [["Heavy Bolter", 4], ["Missile Launcher", 3], ["Multi-Melta", 2], ["Lascannon", 1]], + special_weapons: [["Flamer", 3], ["Meltagun", 2], ["Plasma Gun", 1]], + melee_weapons: [["Chainsword", 5], ["Power Sword", 4], ["Lightning Claw", 3], ["Power Fist", 2], ["Thunder Hammer", 1]], + ranged_weapons: [["Bolter", 10], ["Storm Bolter", 3], ["Combiflamer", 2], ["Plasma Pistol", 1]], + pistols: [["Bolt Pistol", 5], ["Plasma Pistol", 1]], + }; + #endregion + + #region Squad Loadouts + /* squad guidance define a role that can exist in a squad by defining [, { @@ -1551,729 +1467,662 @@ function scr_initialize_custom() { of all required loadout options */ - var squad_name = "Squad"; - if(obj_creation.custom != eCHAPTER_TYPE.PREMADE){ - if (obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { - squad_name = "Pack"; - } - if (obj_ini.progenitor == ePROGENITOR.IRON_HANDS) { - squad_name = "Clave"; - } - } - if(struct_exists(obj_creation, "squad_name")) {squad_name = obj_creation.squad_name; - } - squad_types = {}; - var st = { - "command_squad": [ - [roles.captain, { - "max": 1, - "min": 1, - }], - [roles.champion, { - "max": 1, - "min": 0, - "role": $"Company {roles.champion}" - }], - [roles.apothecary, { - "max": 1, - "min": 0, - "role": $"Company {roles.apothecary}" - }], - [roles.chaplain, { - "max": 1, - "min": 0, - "role": $"Company {roles.chaplain}" - }], - [roles.ancient, { - "max": 1, - "min": 1, - "role": $"Company {roles.ancient}", - }], - [roles.veteran, { - "max": 5, - "min": 0, - "loadout": { - "required": { - "wep1": [wep1[defaults_slot][eROLE.Veteran], 5], - "wep2": [wep2[defaults_slot][eROLE.Veteran], 5], - } - }, - "role": $"Company {roles.veteran}" - }], - [roles.techmarine, { - "max": 2, - "min": 0, - "role": $"Company {roles.techmarine}" - }], - [roles.librarian, { - "max": 1, - "min": 0, - "role": $"Company {roles.librarian}" - }], - ["type_data", { - "display_data": $"Command {squad_name}", - "formation_options": ["command", "terminator", "veteran", "assault", "devastator", "scout", "tactical"], - }] - ], - - "terminator_squad": [ - // Terminator Sergeant - [roles.veteran_sergeant, { - "max": 1, - "min": 1, - "role": $"{roles.terminator} {roles.sergeant}", - "loadout": { - "required": { - "wep1": [wep1[defaults_slot][eROLE.Terminator], 1], - "wep2": [wep2[defaults_slot][eROLE.Terminator], 1], - }, - } - }], - // Terminator - [roles.terminator, { - "max": 4, - "min": 2, - "loadout": { - "required": { - "wep1": ["", 0], - "wep2": [wep2[100, 4], 3], - }, - "option": { - "wep1": [ - [ - ["Power Fist", "Chainfist"], 4 - ], - ], - "wep2": [ - [ - ["Assault Cannon", "Heavy Flamer"], 1 - ], - ], - } - } - }], - ["type_data", { - "display_data": $"{roles.terminator} {squad_name}", - "formation_options": ["terminator", "veteran", "assault", "devastator", "scout", "tactical"], - }] - ], - - "terminator_assault_squad": [ - // Assault Terminator Sergeant - [roles.veteran_sergeant, { - "max": 1, - "min": 1, - "role": $"Assault {roles.terminator} {roles.sergeant}", - "loadout": { - "required": { - "wep1": ["Thunder Hammer", 1], - "wep2": ["Storm Shield", 1], - }, - }, - }], - // Assault Terminator - [roles.terminator, { - "max": 4, - "min": 2, - "role": $"Assault {roles.terminator}", - "loadout": { - "required": { - "wep1": ["Thunder Hammer", 1], - "wep2": ["Storm Shield", 1], - }, - "option": { - "wep1": [ - [ - ["Lightning Claw"], 3, { - "wep2":"Lightning Claw", - } - ], - ], - } - }, - }, ], - ["type_data", { - "display_data": $"{roles.terminator} Assault {squad_name}", - "formation_options": ["terminator", "veteran", "assault", "devastator", "scout", "tactical"], - }] - ], - - "sternguard_veteran_squad": [ - // Sternguard Veteran - [roles.veteran, { - "max": 9, - "min": 4, - "role": $"Sternguard {roles.veteran}", - "loadout": { - "required": { - "wep1": ["", 0], - "wep2": ["Combat Knife", max], - }, - "option": { - "wep1": [ - [ - ["Bolter", "Stalker Pattern Bolter", "Storm Bolter"], 5 - ], - [ - ["Combiflamer"], 2 - ], - [ - weapon_lists.special_weapons, 1 - ], - [ - weapon_lists.heavy_weapons, 1, { - "wep2":"Combat Knife", - "mobi":"Heavy Weapons Pack", - } - ], - ] - } - } - }], - // Sternguard Veteran Sergeant - [roles.veteran_sergeant, { - "max": 1, - "min": 1, - "role": $"Sternguard {roles.veteran_sergeant}", - "loadout": { - "required": { - "wep1": ["Stalker Pattern Bolter", 1], - "wep2": [wep2[100][eROLE.Veteran], 1], - }, - } - }], - ["type_data", { - "display_data": $"Sternguard {roles.veteran} {squad_name}", - "formation_options": ["veteran", "assault", "devastator", "scout", "tactical"], - }] - ], - - "vanguard_veteran_squad": [ - // Vanguard Veterans - [roles.veteran, { - "max": 9, - "min": 4, - "role": $"Vanguard {roles.veteran}", - "loadout": { - "required": { - "wep1": ["", 0], - "wep2": ["Bolt Pistol", 4], - "mobi": ["Jump Pack", 9] - }, - "option": { - "wep1": [ - [ - ["Chainsword", "Power Sword", "Power Axe", "Lightning Claw"], 6 - ], - [ - ["Power Fist"], 2 - ], - [ - ["Thunder Hammer"], 1 - ], - ], - "wep2": [ - [ - ["Storm Shield"], 2, - ], - [ - ["Plasma Pistol"], 3 - ], - ] - } - } - }], - // Vanguard Veteran Sergeant - [roles.veteran_sergeant, { - "max": 1, - "min": 1, - "role": $"Vanguard {roles.veteran_sergeant}", - "loadout": { - "required": { - "wep1": ["Thunder Hammer", 1], - "wep2": ["Storm Shield", 1], - "mobi": ["Jump Pack", 1] - }, - } - }], - ["type_data", { - "display_data": $"Vanguard {roles.veteran} {squad_name}", - "formation_options": ["veteran", "assault", "devastator", "scout", "tactical"], - }] - ], - - "devastator_squad": [ - [roles.devastator, - { - "max": 9, - "min": 4, - "loadout": { - "required": { - "wep1": ["Bolter", 5], - "wep2": ["Combat Knife", 9], - "mobi": ["", 5], - }, - "option": { - "wep1": [ - [ - weapon_lists.heavy_weapons, 4, { - "mobi":"Heavy Weapons Pack", - } - ], - ], - } - } - } - ], - [roles.sergeant, { - "max": 1, - "min": 1, - "role": $"{roles.devastator} {roles.sergeant}", - "loadout": { - "required": { - "mobi": ["", 1], - }, - "option": { - "wep1": [ - [ - weapon_lists.pistols, 1 - ], - ], - "wep2": [ - [ - weapon_lists.melee_weapons, 1 - ], - ], - } - } - }], - ["type_data", { - "display_data": $"{roles.devastator} {squad_name}", - "formation_options": ["devastator", "tactical", "assault", "scout"], - }] - ], - - "tactical_squad": [ - [roles.tactical, { - "max": 9, - "min": 4, - "loadout": { - "required": { - "wep1": [wep1[100, 8], 7], - "wep2": [wep2[100, 8], 7] - }, - "option": { - "wep1": [ - [ - weapon_lists.special_weapons, 1 - ], - [ - weapon_lists.heavy_weapons, 1, { - "wep2":"Combat Knife", - "mobi":"Heavy Weapons Pack", - } - ] - ], - } - } - }], - [roles.sergeant, { - "max": 1, - "min": 1, - "role": $"{roles.tactical} {roles.sergeant}", - "loadout": { - "required": { - "wep1": ["", 0], - "wep2": ["Chainsword", 1] - }, - "option": { - "wep1": [ - [ - weapon_lists.pistols, 1 - ], - ], - "wep2": [ - [ - weapon_lists.melee_weapons, 1 - ], - ], - } - } - }], - ["type_data", { - "display_data": $"{roles.tactical} {squad_name}", - "formation_options": ["tactical", "assault", "devastator", "scout"], - "class":["troop"] - }], - - - ], - - "assault_squad": [ - [roles.assault, { - "max": 9, - "min": 4, - "loadout": { - "required": { - "wep1": [wep1[100, 10], 5], - "wep2": [wep2[100, 10], 5], - }, - "option": { - "wep1": [ - [ - ["Eviscerator"], 2, { - "wep2":"", - } - ], - ], - "wep2": [ - [ - ["Plasma Pistol", "Flamer"], 2 - ] - ] - } - } - }], - [roles.sergeant, { - "max": 1, - "min": 1, - "role": $"{roles.assault} {roles.sergeant}", - "loadout": { - "required": { - "wep1": ["", 0], - "wep2": ["", 0], - "gear": ["Combat Shield", 1] - }, - "option": { - "wep1": [ - [ - weapon_lists.pistols, 1 - ], - ], - "wep2": [ - [ - weapon_lists.melee_weapons, 1 - ], - ], - } - } - }], - ["type_data", { - "display_data": $"{roles.assault} {squad_name}", - "formation_options": ["assault", "tactical", "devastator", "scout"], - }] - ], - - "scout_squad": [ - [roles.scout, { - "max": 9, - "min": 4, - "loadout": { - "required": { - "wep1": [wep1[100][12], 6], - "wep2": [wep2[100][12], 9] - }, - "option": { - "wep1": [ - [ - ["Bolter", "Stalker Pattern Bolter"], 2 - ], - [ - ["Missile Launcher", "Heavy Bolter"], 1 - ] - ], - } - } - }], - [roles.sergeant, { - "max": 1, - "min": 1, - "loadout": { - "option": { - "wep1": [ - [ - ["Bolt Pistol", "Bolt Pistol", "Plasma Pistol", "Bolter", "Bolter", "Stalker Pattern Bolter"], 1 - ] - ], - "wep2": [ - [ - ["Power Sword", "Chainsword", "Power Axe"], 1 - ] - ] - } - }, - "role": $"{roles.scout} {roles.sergeant}", - }], - ["type_data", { - "display_data": $"{roles.scout} {squad_name}", - "class": ["scout"], - "formation_options": ["scout", "tactical", "assault", "devastator"], - }], - ], - - "scout_sniper_squad": [ - [roles.scout, - { - "max": 9, - "min": 4, - "loadout": { - "required": { - "wep1": ["Sniper Rifle", 8], - "wep2": ["Combat Knife", 9] - }, - "option": { - "wep1": [ - [ - ["Missile Launcher"], 1 - ] - ], - } - }, - "role": $"{roles.scout} Sniper", - }], - [roles.sergeant, { - "max": 1, - "min": 1, - "loadout": { - "required": { - "wep1": ["Sniper Rifle", 1], - "wep2": ["Combat Knife", 1] - }, - }, - "role": $"Sniper {roles.sergeant}", - } - ], - ["type_data", { - "display_data": $"{roles.scout} Sniper {squad_name}", - "class": ["scout"], - "formation_options": ["scout"], - }], - ] - }; - - // show_debug_message($"squads object for chapter {chapter_name}"); - // show_debug_message($"{st}"); - - - if(struct_exists(obj_creation, "custom_squads")){ - var custom_squads = obj_creation.custom_squads; - // show_debug_message($"custom roles {custom_squads}"); - if(array_length(struct_get_names(custom_squads)) != 0){ - var names = struct_get_names(st); - // show_debug_message($"names {names}"); - for(var n = 0; n < array_length(names); n++){ - var squad_name = names[n]; - // show_debug_message($"matched squad name name {squad_name}"); - - if(struct_exists(custom_squads, squad_name)){ - var custom_squad = struct_get(custom_squads, squad_name); - // show_debug_message($"overwriting squad layout for {squad_name}"); - // show_debug_message($"{custom_squad}") - variable_struct_set(st, squad_name, custom_squad); - } - } - } - } - - // show_debug_message($"roles object for chapter {chapter_name} after setting from obj"); - // show_debug_message($"{st}"); - - if (scr_has_adv("Crafters")) { //salamanders squads - variable_struct_set(st, "assault_squad", [ - [roles.assault, { - "max": 9, - "min": 4, - "loadout": { //assault_marine - "required": { - "wep1": [wep1[100, 10], 4], - "wep2": [wep2[100, 10], 4], - "gear": ["Combat Shield", 4] - }, - "option": { - "wep1": [ - [ - ["Power Sword", "Power Axe", "Eviscerator"], 2 - ], - ], - "wep2": [ - [ - ["Flamer", "Meltagun", "Plasma Pistol", "Bolt Pistol"], 2 - ], - - ], - } - } - }], - [roles.sergeant, { - "max": 1, - "min": 1, //sergeant - "loadout": { - "required": { - "wep1": ["Bolt Pistol", 0], - "wep2": ["Chainsword", 0], - }, - "option": { - "wep1": [ - [ - ["Power Sword", "Thunder Hammer", "Power Fist", "Chainsword"], 1 - ] - ], - "wep2": [ - [ - ["Plasma Pistol", "Combiflamer", "Meltagun"], 1 - ] - ] - } - }, - "role": $"{roles.sergeant} {roles.assault}" - }], - ["type_data", { - "display_data": $"{roles.assault} {squad_name}" - }] - ]) - } - if (scr_has_adv("Lightning Warriors")) { - variable_struct_set(st, "bikers", [ - [roles.assault, { - "max": 9, - "min": 4, - "loadout": { //tactical marine - "required": { - "wep1": ["", max], - "wep2": ["Chainsword", max], - "mobi": ["Bike", max] - } - }, - "role": $"Biker" - }], - [roles.sergeant, { - "max": 1, - "min": 1, - "loadout": { //sergeant - "required": { - "wep1": ["", max], - "wep2": ["Chainsword", max], - "mobi": ["Bike", 1] - } - }, - "role": $"Biker {roles.sergeant}" - }, ], - ["type_data", { - "display_data": $"Bike {squad_name}", - "class":["bike"], - "formation_options": ["assault", "tactical"], - }] - ]) - } - if (scr_has_adv("Boarders")) { - variable_struct_set(st, "breachers", [ - [roles.tactical, { - "max": 9, - "min": 4, - "loadout": { //tactical breacher marine - "required": { - "wep1":[wep1[100, 8], 7], - "wep2":["Boarding Shield", max], - "armour":["MK3 Iron Armour", max], - "gear":["Plasma Bomb", max], - "mobi":["", max] - }, - "option": { - "wep1": [ - [ - ["Flamer", "Grav-Gun", "Meltagun", "Lascutter"], 2, - ], - ] - } - }, - "role": $"Breacher" - }], - [roles.sergeant, { - "max": 1, - "min": 1, - "loadout": { //sergeant - "required": { - "wep2":["Boarding Shield", max], - "armour":["MK3 Iron Armour", max], - "mobi": ["", max], - "gear": ["Plasma Bomb", max] - }, - "option": { - "wep1": [ - [ - ["Bolter", "Bolter", "Bolter", "Combiflamer"], 1 - ] - ], - } - }, - "role": $"Breacher {roles.sergeant}" - }, ], - ["type_data", { - "display_data": $"Breacher {squad_name}", - "formation_options": ["tactical", "assault", "devastator", "scout" ], - }] - ]) - variable_struct_set(st,"assault_squad", [ - [roles.assault, { - "max": 9, - "min": 4, - "loadout": { - "required": { - "wep1": [wep1[100, 10], 7], - "wep2": [wep2[100, 10], 7], - }, - "option": { - "wep1": [ - [ - weapon_lists.melee_weapons, 2 - ], - ], - "wep2": [ - [ - ["Plasma Pistol", "Flamer"], 2 - ] - ] - } - } - }], - [roles.sergeant, { - "max": 1, - "min": 1, - "role": $"{roles.assault} {roles.sergeant}", - "loadout": { - "required": { - "wep1": ["", 0], - "wep2": ["", 0], - "gear": ["Combat Shield", 1] - }, - "option": { - "wep1": [ - [ - weapon_lists.pistols, 1 - ], - ], - "wep2": [ - [ - weapon_lists.melee_weapons, 1 - ], - ], - } - } - }], - ["type_data", { - "display_data": $"{roles.assault} {squad_name}", - "formation_options": ["assault"], - }] - ]) - } + var squad_name = "Squad"; + if (obj_creation.custom != eCHAPTER_TYPE.PREMADE) { + if (obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { + squad_name = "Pack"; + } + if (obj_ini.progenitor == ePROGENITOR.IRON_HANDS) { + squad_name = "Clave"; + } + } + if (struct_exists(obj_creation, "squad_name")) { + squad_name = obj_creation.squad_name; + } + squad_types = {}; + var st = { + "command_squad": [ + [ + roles.captain, + { + "max": 1, + "min": 1, + } + ], + [ + roles.champion, + { + "max": 1, + "min": 0, + "role": $"Company {roles.champion}", + } + ], + [ + roles.apothecary, + { + "max": 1, + "min": 0, + "role": $"Company {roles.apothecary}", + } + ], + [ + roles.chaplain, + { + "max": 1, + "min": 0, + "role": $"Company {roles.chaplain}", + } + ], + [ + roles.ancient, + { + "max": 1, + "min": 1, + "role": $"Company {roles.ancient}", + } + ], + [ + roles.veteran, + { + "max": 5, + "min": 0, + "loadout": { + "required": { + "wep1": [wep1[defaults_slot][eROLE.Veteran], 5], + "wep2": [wep2[defaults_slot][eROLE.Veteran], 5], + }, + }, + "role": $"Company {roles.veteran}", + } + ], + [ + roles.techmarine, + { + "max": 2, + "min": 0, + "role": $"Company {roles.techmarine}", + } + ], + [ + roles.librarian, + { + "max": 1, + "min": 0, + "role": $"Company {roles.librarian}", + } + ], + [ + "type_data", + { + "display_data": $"Command {squad_name}", + "formation_options": ["command", "terminator", "veteran", "assault", "devastator", "scout", "tactical"], + } + ] + ], + "terminator_squad": [ + // Terminator Sergeant + [ + roles.veteran_sergeant, + { + "max": 1, + "min": 1, + "role": $"{roles.terminator} {roles.sergeant}", + "loadout": { + "required": { + "wep1": [wep1[defaults_slot][eROLE.Terminator], 1], + "wep2": [wep2[defaults_slot][eROLE.Terminator], 1], + }, + }, + } + ], + // Terminator + [ + roles.terminator, + { + "max": 4, + "min": 2, + "loadout": { + "required": { + "wep1": ["", 0], + "wep2": [wep2[100][4], 3], + }, + "option": { + "wep1": [[["Power Fist", "Chainfist"], 4]], + "wep2": [[["Assault Cannon", "Heavy Flamer"], 1]], + }, + }, + } + ], + [ + "type_data", + { + "display_data": $"{roles.terminator} {squad_name}", + "formation_options": ["terminator", "veteran", "assault", "devastator", "scout", "tactical"], + } + ] + ], + "terminator_assault_squad": [ + // Assault Terminator Sergeant + [ + roles.veteran_sergeant, + { + "max": 1, + "min": 1, + "role": $"Assault {roles.terminator} {roles.sergeant}", + "loadout": { + "required": { + "wep1": ["Thunder Hammer", 1], + "wep2": ["Storm Shield", 1], + }, + }, + } + ], + // Assault Terminator + [ + roles.terminator, + { + "max": 4, + "min": 2, + "role": $"Assault {roles.terminator}", + "loadout": { + "required": { + "wep1": ["Thunder Hammer", 1], + "wep2": ["Storm Shield", 1], + }, + "option": { + "wep1": [ + [ + ["Lightning Claw"], + 3, + { + "wep2": "Lightning Claw", + } + ] + ], + }, + }, + } + ], + [ + "type_data", + { + "display_data": $"{roles.terminator} Assault {squad_name}", + "formation_options": ["terminator", "veteran", "assault", "devastator", "scout", "tactical"], + } + ] + ], + "sternguard_veteran_squad": [ + // Sternguard Veteran + [ + roles.veteran, + { + "max": 9, + "min": 4, + "role": $"Sternguard {roles.veteran}", + "loadout": { + "required": { + "wep1": ["", 0], + "wep2": ["Combat Knife", max], + }, + "option": { + "wep1": [ + [["Bolter", "Stalker Pattern Bolter", "Storm Bolter"], 5], + [["Combiflamer"], 2], + [weapon_lists.special_weapons, 1], + [ + weapon_lists.heavy_weapons, + 1, + { + "wep2": "Combat Knife", + "mobi": "Heavy Weapons Pack", + } + ] + ], + }, + }, + } + ], + // Sternguard Veteran Sergeant + [ + roles.veteran_sergeant, + { + "max": 1, + "min": 1, + "role": $"Sternguard {roles.veteran_sergeant}", + "loadout": { + "required": { + "wep1": ["Stalker Pattern Bolter", 1], + "wep2": [wep2[100][eROLE.Veteran], 1], + }, + }, + } + ], + [ + "type_data", + { + "display_data": $"Sternguard {roles.veteran} {squad_name}", + "formation_options": ["veteran", "assault", "devastator", "scout", "tactical"], + } + ] + ], + "vanguard_veteran_squad": [ + // Vanguard Veterans + [ + roles.veteran, + { + "max": 9, + "min": 4, + "role": $"Vanguard {roles.veteran}", + "loadout": { + "required": { + "wep1": ["", 0], + "wep2": ["Bolt Pistol", 4], + "mobi": ["Jump Pack", 9], + }, + "option": { + "wep1": [[["Chainsword", "Power Sword", "Power Axe", "Lightning Claw"], 6], [["Power Fist"], 2], [["Thunder Hammer"], 1]], + "wep2": [[["Storm Shield"], 2], [["Plasma Pistol"], 3]], + }, + }, + } + ], + // Vanguard Veteran Sergeant + [ + roles.veteran_sergeant, + { + "max": 1, + "min": 1, + "role": $"Vanguard {roles.veteran_sergeant}", + "loadout": { + "required": { + "wep1": ["Thunder Hammer", 1], + "wep2": ["Storm Shield", 1], + "mobi": ["Jump Pack", 1], + }, + }, + } + ], + [ + "type_data", + { + "display_data": $"Vanguard {roles.veteran} {squad_name}", + "formation_options": ["veteran", "assault", "devastator", "scout", "tactical"], + } + ] + ], + "devastator_squad": [ + [ + roles.devastator, + { + "max": 9, + "min": 4, + "loadout": { + "required": { + "wep1": ["Bolter", 5], + "wep2": ["Combat Knife", 9], + "mobi": ["", 5], + }, + "option": { + "wep1": [ + [ + weapon_lists.heavy_weapons, + 4, + { + "mobi": "Heavy Weapons Pack", + } + ] + ], + }, + }, + } + ], + [ + roles.sergeant, + { + "max": 1, + "min": 1, + "role": $"{roles.devastator} {roles.sergeant}", + "loadout": { + "required": { + "mobi": ["", 1], + }, + "option": { + "wep1": [[weapon_lists.pistols, 1]], + "wep2": [[weapon_lists.melee_weapons, 1]], + }, + }, + } + ], + [ + "type_data", + { + "display_data": $"{roles.devastator} {squad_name}", + "formation_options": ["devastator", "tactical", "assault", "scout"], + } + ] + ], + "tactical_squad": [ + [ + roles.tactical, + { + "max": 9, + "min": 4, + "loadout": { + "required": { + "wep1": [wep1[100][8], 7], + "wep2": [wep2[100][8], 7], + }, + "option": { + "wep1": [ + [weapon_lists.special_weapons, 1], + [ + weapon_lists.heavy_weapons, + 1, + { + "wep2": "Combat Knife", + "mobi": "Heavy Weapons Pack", + } + ] + ], + }, + }, + } + ], + [ + roles.sergeant, + { + "max": 1, + "min": 1, + "role": $"{roles.tactical} {roles.sergeant}", + "loadout": { + "required": { + "wep1": ["", 0], + "wep2": ["Chainsword", 1], + }, + "option": { + "wep1": [[weapon_lists.pistols, 1]], + "wep2": [[weapon_lists.melee_weapons, 1]], + }, + }, + } + ], + [ + "type_data", + { + "display_data": $"{roles.tactical} {squad_name}", + "formation_options": ["tactical", "assault", "devastator", "scout"], + "class": ["troop"], + } + ] + ], + "assault_squad": [ + [ + roles.assault, + { + "max": 9, + "min": 4, + "loadout": { + "required": { + "wep1": [wep1[100][10], 5], + "wep2": [wep2[100][10], 5], + }, + "option": { + "wep1": [ + [ + ["Eviscerator"], + 2, + { + "wep2": "", + } + ] + ], + "wep2": [[["Plasma Pistol", "Flamer"], 2]], + }, + }, + } + ], + [ + roles.sergeant, + { + "max": 1, + "min": 1, + "role": $"{roles.assault} {roles.sergeant}", + "loadout": { + "required": { + "wep1": ["", 0], + "wep2": ["", 0], + "gear": ["Combat Shield", 1], + }, + "option": { + "wep1": [[weapon_lists.pistols, 1]], + "wep2": [[weapon_lists.melee_weapons, 1]], + }, + }, + } + ], + [ + "type_data", + { + "display_data": $"{roles.assault} {squad_name}", + "formation_options": ["assault", "tactical", "devastator", "scout"], + } + ] + ], + "scout_squad": [ + [ + roles.scout, + { + "max": 9, + "min": 4, + "loadout": { + "required": { + "wep1": [wep1[100][12], 6], + "wep2": [wep2[100][12], 9], + }, + "option": { + "wep1": [[["Bolter", "Stalker Pattern Bolter"], 2], [["Missile Launcher", "Heavy Bolter"], 1]], + }, + }, + } + ], + [ + roles.sergeant, + { + "max": 1, + "min": 1, + "loadout": { + "option": { + "wep1": [[["Bolt Pistol", "Bolt Pistol", "Plasma Pistol", "Bolter", "Bolter", "Stalker Pattern Bolter"], 1]], + "wep2": [[["Power Sword", "Chainsword", "Power Axe"], 1]], + }, + }, + "role": $"{roles.scout} {roles.sergeant}", + } + ], + [ + "type_data", + { + "display_data": $"{roles.scout} {squad_name}", + "class": ["scout"], + "formation_options": ["scout", "tactical", "assault", "devastator"], + } + ] + ], + "scout_sniper_squad": [ + [ + roles.scout, + { + "max": 9, + "min": 4, + "loadout": { + "required": { + "wep1": ["Sniper Rifle", 8], + "wep2": ["Combat Knife", 9], + }, + "option": { + "wep1": [[["Missile Launcher"], 1]], + }, + }, + "role": $"{roles.scout} Sniper", + } + ], + [ + roles.sergeant, + { + "max": 1, + "min": 1, + "loadout": { + "required": { + "wep1": ["Sniper Rifle", 1], + "wep2": ["Combat Knife", 1], + }, + }, + "role": $"Sniper {roles.sergeant}", + } + ], + [ + "type_data", + { + "display_data": $"{roles.scout} Sniper {squad_name}", + "class": ["scout"], + "formation_options": ["scout"], + } + ] + ], + }; + + // show_debug_message($"squads object for chapter {chapter_name}"); + // show_debug_message($"{st}"); + + if (struct_exists(obj_creation, "custom_squads")) { + var custom_squads = obj_creation.custom_squads; + // show_debug_message($"custom roles {custom_squads}"); + if (array_length(struct_get_names(custom_squads)) != 0) { + var names = struct_get_names(st); + // show_debug_message($"names {names}"); + for (var n = 0; n < array_length(names); n++) { + var squad_name = names[n]; + // show_debug_message($"matched squad name name {squad_name}"); + + if (struct_exists(custom_squads, squad_name)) { + var custom_squad = struct_get(custom_squads, squad_name); + // show_debug_message($"overwriting squad layout for {squad_name}"); + // show_debug_message($"{custom_squad}") + variable_struct_set(st, squad_name, custom_squad); + } + } + } + } + // show_debug_message($"roles object for chapter {chapter_name} after setting from obj"); + // show_debug_message($"{st}"); + + if (scr_has_adv("Crafters")) { + //salamanders squads + variable_struct_set( + st, + "assault_squad", + [ + [ + roles.assault, + { + "max": 9, + "min": 4, + "loadout": { + //assault_marine + "required": {"wep1": [wep1[100][10], 4], "wep2": [wep2[100][10], 4], "gear": ["Combat Shield", 4]}, + "option": {"wep1": [[["Power Sword", "Power Axe", "Eviscerator"], 2]], "wep2": [[["Flamer", "Meltagun", "Plasma Pistol", "Bolt Pistol"], 2]]}, + }, + } + ], + [ + roles.sergeant, + { + "max": 1, + "min": 1, //sergeant + "loadout": {"required": {"wep1": ["Bolt Pistol", 0], "wep2": ["Chainsword", 0]}, "option": {"wep1": [[["Power Sword", "Thunder Hammer", "Power Fist", "Chainsword"], 1]], "wep2": [[["Plasma Pistol", "Combiflamer", "Meltagun"], 1]]}}, + "role": $"{roles.sergeant} {roles.assault}", + } + ], + ["type_data", {"display_data": $"{roles.assault} {squad_name}"}] + ] + ); + } + if (scr_has_adv("Lightning Warriors")) { + variable_struct_set( + st, + "bikers", + [ + [ + roles.assault, + { + "max": 9, + "min": 4, + "loadout": { + //tactical marine + "required": {"wep1": ["", max], "wep2": ["Chainsword", max], "mobi": ["Bike", max]}, + }, + "role": $"Biker", + } + ], + [ + roles.sergeant, + { + "max": 1, + "min": 1, + "loadout": { + //sergeant + "required": {"wep1": ["", max], "wep2": ["Chainsword", max], "mobi": ["Bike", 1]}, + }, + "role": $"Biker {roles.sergeant}", + } + ], + ["type_data", {"display_data": $"Bike {squad_name}", "class": ["bike"], "formation_options": ["assault", "tactical"]}] + ] + ); + } + if (scr_has_adv("Boarders")) { + variable_struct_set( + st, + "breachers", + [ + [ + roles.tactical, + { + "max": 9, + "min": 4, + "loadout": { + //tactical breacher marine + "required": {"wep1": [wep1[100][8], 7], "wep2": ["Boarding Shield", max], "armour": ["MK3 Iron Armour", max], "gear": ["Plasma Bomb", max], "mobi": ["", max]}, + "option": {"wep1": [[["Flamer", "Grav-Gun", "Meltagun", "Lascutter"], 2]]}, + }, + "role": $"Breacher", + } + ], + [ + roles.sergeant, + { + "max": 1, + "min": 1, + "loadout": { + //sergeant + "required": {"wep2": ["Boarding Shield", max], "armour": ["MK3 Iron Armour", max], "mobi": ["", max], "gear": ["Plasma Bomb", max]}, + "option": {"wep1": [[["Bolter", "Bolter", "Bolter", "Combiflamer"], 1]]}, + }, + "role": $"Breacher {roles.sergeant}", + } + ], + ["type_data", {"display_data": $"Breacher {squad_name}", "formation_options": ["tactical", "assault", "devastator", "scout"]}] + ] + ); + variable_struct_set(st, "assault_squad", [[roles.assault, {"max": 9, "min": 4, "loadout": {"required": {"wep1": [wep1[100][10], 7], "wep2": [wep2[100][10], 7]}, "option": {"wep1": [[weapon_lists.melee_weapons, 2]], "wep2": [[["Plasma Pistol", "Flamer"], 2]]}}}], [roles.sergeant, {"max": 1, "min": 1, "role": $"{roles.assault} {roles.sergeant}", "loadout": {"required": {"wep1": ["", 0], "wep2": ["", 0], "gear": ["Combat Shield", 1]}, "option": {"wep1": [[weapon_lists.pistols, 1]], "wep2": [[weapon_lists.melee_weapons, 1]]}}}], ["type_data", {"display_data": $"{roles.assault} {squad_name}", "formation_options": ["assault"]}]]); + } - var _squad_names = struct_get_names(st); - // show_debug_message($" {squad_names}"); - // show_debug_message($"^^^ Squad names"); - + var _squad_names = struct_get_names(st); + // show_debug_message($" {squad_names}"); + // show_debug_message($"^^^ Squad names"); - for (var st_iter = 0; st_iter < array_length(_squad_names); st_iter++) { + for (var st_iter = 0; st_iter < array_length(_squad_names); st_iter++) { var _squad_name = _squad_names[st_iter]; var _squad_data = st[$ _squad_name]; squad_types[$ _squad_name] = {}; @@ -2294,1231 +2143,1251 @@ function scr_initialize_custom() { } _new_squad_data[$ _data_name] = _entry[1]; } - } - - if(scr_has_adv("Ambushers")){ - var _class_data = squad_types.tactical_squad.type_data.class; - array_push(_class_data, "scout") - } - // show_debug_message("Squad types"); - // show_debug_message(squad_types); - #endregion - - for (i = 0; i <= 20; i++) { - if (role[defaults_slot, i] != "") { - scr_start_allow(i, "wep1", wep1[defaults_slot, i]); - } - if (role[defaults_slot, i] != "") { - scr_start_allow(i, "wep2", wep2[defaults_slot, i]); - } - if (role[defaults_slot, i] != "") { - scr_start_allow(i, "mobi", mobi[defaults_slot, i]); - } - if (role[defaults_slot, i] != "") { - scr_start_allow(i, "gear", gear[defaults_slot, i]); - } - // check for allowable starting equipment here - } - - initialized = 500; // How many array variables have been prepared - v = 0; - company = 0; - - // TODO: When modding support is implemented, uncomment this init. Otherwise traits are initialized at compile. + } + + if (scr_has_adv("Ambushers")) { + var _class_data = squad_types.tactical_squad.type_data.class; + array_push(_class_data, "scout"); + } + // show_debug_message("Squad types"); + // show_debug_message(squad_types); + #endregion + + for (i = 0; i <= 20; i++) { + if (role[defaults_slot][i] != "") { + scr_start_allow(i, "wep1", wep1[defaults_slot][i]); + } + if (role[defaults_slot][i] != "") { + scr_start_allow(i, "wep2", wep2[defaults_slot][i]); + } + if (role[defaults_slot][i] != "") { + scr_start_allow(i, "mobi", mobi[defaults_slot][i]); + } + if (role[defaults_slot][i] != "") { + scr_start_allow(i, "gear", gear[defaults_slot][i]); + } + // check for allowable starting equipment here + } + + initialized = 500; // How many array variables have been prepared + v = 0; + company = 0; + + // TODO: When modding support is implemented, uncomment this init. Otherwise traits are initialized at compile. //loads up marine traits potential modding potential; // initialize_marine_traits(); - #region Chapter HQ - for (var c = 0; c <11; c++){ - for (var i = 0; i < 501; i++) { - race[c, i] = 1; - name[c, i] = ""; - role[c, i] = ""; - wep1[c, i] = ""; - spe[c, i] = ""; - wep2[c, i] = ""; - armour[c, i] = ""; - chaos[c, i] = 0; - gear[c, i] = ""; - mobi[c, i] = ""; - age[c, i] = ((millenium * 1000) + year) - 10; - god[c, i] = 0; - TTRPG[c, i] = new TTRPG_stats("chapter", c, i, "blank"); - } - } - - // Chapter Master - // This needs work - name[company, 0] = obj_creation.chapter_master_name; - var cm_equip = load_chapter_master_equipment(); - - var chapter_master = add_unit_to_company("chapter_master", 0, 0 , roles.chapter_master, eROLE.ChapterMaster, cm_equip.wep1, cm_equip.wep2, cm_equip.gear, cm_equip.mobi, cm_equip.armour); - repeat(cm_equip.bionics){ - chapter_master.add_bionics("none", "standard", false); - } - - spe[company, 0] = ""; - chapter_master.add_trait("lead_example"); - - //builds in which of the three chapter master types your CM is - // all of this can now be handled in teh struct and no longer neades complex methods - switch (obj_creation.chapter_master_specialty) { - case 1: - chapter_master.add_exp(550); - spe[company, 0] += "$"; - break; - case 2: - chapter_master.add_exp(650); - spe[company, 0] += "@"; - chapter_master.add_trait("champion"); - break; - case 3: - //TODO phychic powers need a redo but after weapon refactor - chapter_master.add_exp(550); - cm_equip.gear = "Psychic Hood"; - chapter_master.add_trait("favoured_by_the_warp"); - chapter_master.psionic = choose(13, 14); - chapter_master.update_powers(); - } - chapter_master.alter_equipment(cm_equip, false, false, "master_crafted") - if(scr_has_adv("Paragon")){ - chapter_master.add_trait("paragon"); - } - chapter_master.marine_assembling(); - - var _hq_armour = "Artificer Armour"; - if(scr_has_disadv("Poor Equipment")){ - _hq_armour = "MK6 Corvus"; - } - - k+=1; - commands = 1; - - // Forge Master - name[company, 1] = obj_creation.fmaster; - var _forge_master = add_unit_to_company("marine", company, 1, "Forge Master", eROLE.Techmarine, "Infernus Pistol", "Power Axe", "default", "Servo-harness", _hq_armour); - if (_forge_master.technology < 40) { - _forge_master.technology = 40; - } - _forge_master.add_trait("mars_trained"); - _forge_master.add_bionics("right_arm", "standard", false); - _forge_master.marine_assembling(); - if (global.chapter_name = "Iron Hands") { - repeat(9) { - _forge_master.add_bionics("none", "standard", false); - } - } else { - repeat(irandom(5) + 3) { - _forge_master.add_bionics("none", "standard", false) - }; - } - k+=1; - commands +=1; - - // Master of Sanctity (Chaplain) - if (chaplains > 0){ - name[company, 2] = high_chaplain_name; - var _hchap = add_unit_to_company("marine", company, 2, "Master of Sanctity", eROLE.Chaplain, "default", "Plasma Pistol", "default", "default", _hq_armour); - _hchap.edit_corruption(-100); - if (_hchap.piety < 45) { - _hchap.piety = 45; - } - _hchap.add_trait("zealous_faith"); - k+=1; - commands +=1; - } - - // Maser of the Apothecarion (Apothecary) - name[company, 3] = obj_creation.hapothecary; - var _hapoth = add_unit_to_company("marine", company, 3, "Master of the Apothecarion", eROLE.Apothecary, "default", "Plasma Pistol", "default", "default", _hq_armour); - _hapoth.edit_corruption(0); - k+=1; - commands +=1; - - // Chief Librarian - if(!scr_has_disadv("Psyker Intolerant")){ - name[company, 4] = obj_creation.clibrarian; - var _clibrarian = add_unit_to_company("marine", company, 4, string("Chief {0}", roles.librarian), eROLE.Librarian, "default", "Plasma Pistol", "default", "default", _hq_armour); - _clibrarian.edit_corruption(0); - _clibrarian.psionic = choose(11, 12); - _clibrarian.update_powers(); - _clibrarian.add_trait("favoured_by_the_warp"); - k+=1; - commands +=1; - } - man_size = k; - - // Techmarines in the armoury - repeat(techmarines) { - k += 1; - commands += 1; - man_size += 1; - add_unit_to_company("marine", company, k, roles.techmarine, eROLE.Techmarine, "default", choose_weighted(weapon_weighted_lists.pistols)); - } - - // Librarians in the librarium - repeat(epistolary) { - k += 1; - commands += 1; - man_size += 1; - var _epi = add_unit_to_company("marine", company, k, roles.librarian, eROLE.Librarian, "default", choose_weighted(weapon_weighted_lists.pistols)); - } - // Codiciery - repeat(codiciery) { - k += 1; - commands += 1; - man_size += 1; - var _codi = add_unit_to_company("marine", company, k, "Codiciery", eROLE.Librarian, "default", choose_weighted(weapon_weighted_lists.pistols)); - } - - // Lexicanum - repeat(lexicanum) { - k += 1; - commands += 1; - man_size += 1; - var _lexi = add_unit_to_company("marine", company, k, "Lexicanum", eROLE.Librarian, "default", choose_weighted(weapon_weighted_lists.pistols)); - } - - // Apothecaries in Apothecarion - repeat(apothecary) { - k += 1; - commands += 1; - man_size += 1; - add_unit_to_company("marine", company, k, roles.apothecary, eROLE.Apothecary,"Chainsword", choose_weighted(weapon_weighted_lists.pistols)); - } - - // Chaplains in Reclusium - repeat(chaplains) { - k += 1; - commands += 1; - man_size += 1; - add_unit_to_company("marine", company, k, roles.chaplain, eROLE.Chaplain,"default", choose_weighted(weapon_weighted_lists.pistols)); - } - - // Honour Guard - var _honour_guard_count = 0, unit; - if (scr_has_adv("Retinue of Renown")){ - _honour_guard_count += 10; - } - if (progenitor == ePROGENITOR.DARK_ANGELS && obj_creation.custom == eCHAPTER_TYPE.PREMADE) { - _honour_guard_count += 6; - } - if (_honour_guard_count == 0) { - _honour_guard_count = 3 - } - for (var i = 0; i < min(_honour_guard_count, 10); i++) { - k += 1; - commands += 1; - man_size += 1; - add_unit_to_company("marine", company, k, roles.honour_guard, eROLE.HonourGuard); - } - - specials = k; - #endregion - - #region New Totals Per Company Adjusted - var companies = { - first: { - coy: 1, - total: veteran + terminator, - veterans: veteran, - terminators: terminator, - tacticals: 0, - assaults: 0, - devastators: 0, - dreadnoughts: dreadnought == 0 ? 0 : dreadnought+1, //handle obliterated - predators: predator, - landraiders: landraider - }, - second: { - coy: 2, - total: second, - rhinos: rhino, - landspeeders: landspeeder, - dreadnoughts: dreadnought, - landraiders: landraider, - whirlwinds: whirlwind, - }, - third: { - coy: 3, - total: third, - rhinos: rhino, - landspeeders: landspeeder, - dreadnoughts: dreadnought, - whirlwinds: whirlwind, - - }, - fourth: { - coy: 4, - total: fourth, - rhinos: rhino, - landspeeders: landspeeder, - dreadnoughts: dreadnought, - whirlwinds: whirlwind, - - }, - fifth: { - coy: 5, - total: fifth, - rhinos: rhino, - landspeeders: landspeeder, - dreadnoughts: dreadnought, - whirlwinds: whirlwind, - }, - sixth: { - coy: 6, - total: sixth, - rhinos: rhino, - landspeeders: landspeeder-2, - dreadnoughts: dreadnought, - whirlwinds: whirlwind, - - }, - seventh: { - coy: 7, - total: seventh, - dreadnoughts: dreadnought, - rhinos: rhino, - landspeeders: landspeeder+6, - whirlwinds: whirlwind-4 - }, - eighth: { - coy: 8, - total: eighth, - dreadnoughts: dreadnought, - rhinos: rhino-6, - whirlwinds: whirlwind-4, - landspeeders: landspeeder, - - }, - ninth: { - coy: 9, - total: ninth, - dreadnoughts: dreadnought, - - rhinos: rhino-6, - whirlwinds: whirlwind-4, - landspeeders: landspeeder-2, - predators: predator, - - }, - tenth: { - coy: 10, - total: tenth, - dreadnoughts: 0, - rhinos: rhino, - whirlwinds: whirlwind-4, - landspeeders: landspeeder-2, - scouts: tenth -10, //should work out to 90 - predators:0, - landraiders:0, - } - } - - log_message($"Pre balancing company totals: {json_stringify(companies,true)}") - // Extra vehicles loaded from json files all get dumped into the 10th company for the player to sort out - - var vehicle_keys = ["rhino", "whirlwind", "predator", "land_raider", "land_speeder"]; - if(struct_exists(obj_creation, "extra_vehicles")){ - for (var v = 0; v < array_length(vehicle_keys); v++){ - var key = vehicle_keys[v]; - if(struct_exists(obj_creation.extra_vehicles, key) && real(obj_creation.extra_vehicles[$key]) > 0){ - var coy_key = ""; - switch(key){ - case "rhino": coy_key = "rhinos";break; - case "whirlwind": coy_key = "whirlwinds";break; - case "predator": coy_key = "predators";break; - case "land_raider": coy_key = "landraiders"; break; - case "land_speeder": coy_key = "landspeeders"; break; - } - companies.tenth[$coy_key] += obj_creation.extra_vehicles[$key]; - } - } - } - - - var equal_specialists = obj_creation.equal_specialists; - var scout_company_behaviour = 0; - if(struct_exists(obj_creation, "scout_company_behaviour")){ - var scout_company_behaviour = obj_creation.scout_company_behaviour; - } - if(scout_company_behaviour == 1){ - load_default_gear(eROLE.Scout, "Neophyte", "Bolter", "", "Scout Armour", "",""); - } - - var equal_scouts = 0; - if(struct_exists(obj_creation, "equal_scouts")){ - var equal_scouts = obj_creation.equal_scouts; - } - obj_ini.equal_scouts = equal_scouts; // for use in squad creation later - - var _moved_scouts = 0; - - var _coys = struct_get_names(companies); - function _is_terminator (_armour) { - return array_contains(["Terminator Armour", "Tartaros"], _armour); - }; - for(var _c = 0, _clen = array_length(_coys); _c < _clen; _c++ ){ - var k = 0, v = 0;//k = marine slot, v = vehicle slot - - var _name = _coys[_c]; - var _coy = companies[$_name]; - if(_coy.total <= 0){ - continue; - } - _coy.captains = 1; - _coy.champions = 1; - _coy.ancients = 1; - _coy.tacticals = 0;// see equal specialists section - _coy.assaults = 0; - _coy.devastators = 0; - _coy.chaplains = chaplains_per_company; - _coy.apothecaries = apothecary_per_company; - _coy.techmarines = techmarines_per_company; - _coy.librarians = epistolary_per_company; - - - - ///* Equal specialist behaviour: - /// if set to true, instead of having 8th and 9th be reserve companies of assaults and devastators, - /// those marines are instead evenly distributed between 2nd and 9th companies - /// the tacticals that they replace are distributed between 8th and 9th - /// meaning the total number of each shouldn't change. - /// on a fresh standard chapter with normal scouts, rates should be: - /// equal spec: - /// comp 2 - 9: tac: 60, ass: 20, dev: 20 - /// non-equal spec: - /// comp 2 - 5: tac 60, ass 20, dev: 20 - /// comp 6 - 7: tac 100 - /// comp 8: ass 100 - /// comp 9: dev 100 - - /// equal spec with equal scout - /// comp 2 - 9: tac 50: scout 10, ass 20, dev 20 - /// non-equal with equal scout - /// comp 2 - 5: tac 40: scout 20, ass 20, dev 20, - /// comp 8: ass 100 - /// comp 9: dev 100 - /// comp 10: tac 40: scout 50; - if(equal_specialists){ - // log_message("balancing for equal specialists") - // log_message($"equal_scouts? {equal_scouts}") - - if (_coy.coy >= 2 && _coy.coy <= 9){ - if(equal_scouts){ - if(companies.tenth.scouts > 10){ - //theoretically this keeps track of moving scouts from the bank of them in 10th - _coy.scouts = 10; - _coy.tacticals = max(0, (_coy.total - (assault + devastator + _coy.scouts))); - _moved_scouts += _coy.scouts; - companies.tenth.scouts -= _coy.scouts; - } else { - // if 10th is run out somehow, revert to normal behaviour - _coy.tacticals = max(0, (_coy.total - (assault + devastator))); - } - } else { - _coy.tacticals = max(0, (_coy.total - (assault + devastator))); - } - _coy.assaults = assault; - _coy.devastators = devastator; - } - if(equal_scouts && _coy.coy == 10){ - // theoretically this swaps moved scouts with tacticals - _coy.tacticals = _moved_scouts; - } - } else { - // log_message("balancing for non-equal specialists") - /// Default specialist behaviour, battle companies 2-7 have 90 tacticals each - /// and the assaults go into the 8th and devastators into the 9th - if (_coy.coy >= 2 && _coy.coy <= 5){ - if(equal_scouts){ - if(companies.tenth.scouts > 10){ - _coy.scouts = 10; - _moved_scouts += _coy.scouts; - _coy.tacticals = max(0, (_coy.total - (assault + devastator + _coy.scouts))) - companies.tenth.scouts -= _moved_scouts; - } else { - // if 10th is run out somehow, revert to normal behaviour - _coy.tacticals = max(0, (_coy.total - (assault + devastator))); - } - } else { - _coy.tacticals = max(0, (_coy.total - (assault + devastator))); - } - _coy.assaults = assault; - _coy.devastators = devastator; - } - - if (real(_coy.coy) >= 6 && real(_coy.coy) <= 7){ - if(equal_scouts){ - if(companies.tenth.scouts > 10){ - _coy.scouts = 10; - _moved_scouts += _coy.scouts; - _coy.tacticals = _coy.total - _coy.scouts; - companies.tenth.scouts -= _coy.scouts; - } else { - // if 10th is run out somehow, revert to normal behaviour - _coy.tacticals = _coy.total; - } - } else { - _coy.tacticals = _coy.total; - } - _coy.assaults = 0; - _coy.devastators = 0; - - } - if(real(_coy.coy) == 8){ - _coy.tacticals = 0; - _coy.assaults = _coy.total; - _coy.devastators = 0; - } - if(real(_coy.coy) == 9){ - _coy.tacticals = 0; - _coy.assaults = 0; - _coy.devastators = _coy.total; - } - if(real(_coy.coy) == 10 && equal_scouts){ - _coy.tacticals = _moved_scouts; - _coy.scouts = _coy.scouts - _coy.tacticals; - } - } - - log_message($"New Company Totals: eq specialists: {equal_specialists}: scout coy {scout_company_behaviour} equal_scouts: {equal_scouts}"); - log_message($"Company {_coy.coy}: {json_stringify(_coy,true)}"); - - - var attrs = struct_get_names(_coy); - - - - // log_message($"attrs {attrs}"); - - for(var _a = 0, _alen = array_length(attrs); _a < _alen; _a++ ){ - var _is_vehicle=false; - var _rolename; - var _erole; - var _wep1="default"; - var _wep2="default" - var _gear="default" - var _mobi="default"; - var _armour="default"; - var _wep3=""; - var _upgrade=""; - var _accessory=""; - var _unit_type = "marine"; - var _role = attrs[_a]; - var _count = _coy[$_role]; - - if(_role == "total" || _role == "coy") { - continue; - } - - // log_message($"processing: coy {_coy.coy} role {_role} count {_count}"); - switch (_role) { - // MAINLINE - case "tacticals": - if(scr_has_adv("Elite Guard")){ - _rolename = roles.veteran; - _erole = eROLE.Veteran; - } else { - _rolename = roles.tactical; - _erole = eROLE.Tactical; - } - break; - case "assaults": - _rolename = roles.assault; - _erole = eROLE.Assault; - _mobi = "Jump Pack"; - break; - case "devastators": - _rolename = roles.devastator; - _erole = eROLE.Devastator; - if (wep1[defaults_slot, eROLE.Devastator] == "Heavy Ranged") { - _wep1 = choose("Multi-Melta", "Lascannon", "Missile Launcher", "Heavy Bolter"); - } - break; - case "scouts": - _unit_type = "scout"; - _rolename = roles.scout; - _erole = eROLE.Scout; - break; - case "dreadnoughts": - _rolename = roles.dreadnought; - _unit_type = "dreadnought"; - if (scr_has_adv("Venerable Ancients")) { - _rolename = "Venerable " + roles.dreadnought; - } - _erole = eROLE.Dreadnought; - - if (_coy.coy == 9) { - _wep1 = "Missile Launcher"; - } - if (_coy.coy == 1) { - _rolename = "Venerable " + roles.dreadnought; - _wep2 = "Plasma Cannon"; - } - break; - - // VETERANS - case "veterans": - _rolename = roles.veteran; - _erole = eROLE.Veteran; - break; - - case "terminators": - _rolename = roles.terminator; - _erole = eROLE.Terminator; - break; - - // SPECIALISTS - case "captains": - switch (_coy.coy) { - case 1: - name[_coy.coy][k] = honor_captain_name != "" ? honor_captain_name : global.name_generator.generate_space_marine_name(); - break; - case 2: - name[_coy.coy][k] = watch_master_name != "" ? watch_master_name : global.name_generator.generate_space_marine_name(); - break; - case 3: - name[_coy.coy][k] = arsenal_master_name != "" ? arsenal_master_name : global.name_generator.generate_space_marine_name(); - break; - case 4: - name[_coy.coy][k] = lord_admiral_name != "" ? lord_admiral_name : global.name_generator.generate_space_marine_name(); - break; - case 5: - name[_coy.coy][k] = march_master_name != "" ? march_master_name : global.name_generator.generate_space_marine_name(); - break; - case 6: - name[_coy.coy][k] = rites_master_name != "" ? rites_master_name : global.name_generator.generate_space_marine_name(); - break; - case 7: - name[_coy.coy][k] = chief_victualler_name != "" ? chief_victualler_name : global.name_generator.generate_space_marine_name(); - break; - case 8: - name[_coy.coy][k] = lord_executioner_name != "" ? lord_executioner_name : global.name_generator.generate_space_marine_name(); - break; - case 9: - name[_coy.coy][k] = relic_master_name != "" ? relic_master_name : global.name_generator.generate_space_marine_name(); - break; - case 10: - name[_coy.coy][k] = recruiter_name != "" ? recruiter_name : global.name_generator.generate_space_marine_name(); - break; - } - commands++; - _rolename = roles.captain; - _erole = eROLE.Captain; - _wep2 = choose_weighted(weapon_weighted_lists.pistols); - if (equal_specialists == false && _coy.coy == 8) { - _mobi = "Jump Pack"; - } - if (_coy.coy == 1 && _coy.terminators > 0) { - _wep1 = "Relic Blade"; - _wep2 = choose("Storm Shield", "Storm Bolter"); - _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; - } - break; - case "chaplains": - commands++; - _rolename = roles.chaplain; - _erole = eROLE.Chaplain; - _wep2 = choose_weighted(weapon_weighted_lists.pistols); - if (equal_specialists == false && _coy.coy == 8) { - _mobi = "Jump Pack"; - } - if(_coy.coy == 1 && _coy.terminators > 0){ - _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; - _wep2 = wep2[defaults_slot][eROLE.Terminator]; - } - break; - case "apothecaries": - commands++; - _rolename = roles.apothecary; - _erole = eROLE.Apothecary; - if (equal_specialists == false && _coy.coy == 8) { - _mobi = "Jump Pack"; - } - if(_coy.coy == 1 && _coy.terminators > 0){ - _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; - _wep1 = wep1[defaults_slot][eROLE.Terminator]; - _wep2 = wep2[defaults_slot][eROLE.Terminator]; - } - break; - case "techmarines": - commands++; - _rolename = roles.techmarine; - _erole = eROLE.Techmarine; - if (_coy.coy == 1) { - if(_coy.terminators > 0){ - _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; - _wep2 = wep2[defaults_slot][eROLE.Terminator]; - } - if (!_is_terminator(_armour)) { - if (scr_has_disadv("Poor Equipment")) { - _armour = "MK6 Corvus"; - } else { - _armour = "Artificer Armour"; - } - } - } - break; - case "librarians": - commands++; - _rolename = roles.librarian; - _erole = eROLE.Librarian; - if (equal_specialists == false && _coy.coy == 8) { - _mobi = "Jump Pack"; - } - if(_coy.coy == 1 && _coy.terminators > 0){ - _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; - _wep2 = wep2[defaults_slot][eROLE.Terminator]; - } - break; - case "champions": - _rolename = roles.champion; - _erole = eROLE.Champion; - if(_coy.coy == 1 && _coy.terminators > 0){ - _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; - _wep1 = "Thunder Hammer"; - _wep2 = wep2[defaults_slot][eROLE.Terminator]; - if (global.chapter_name == "Dark Angels") { - _wep1 = "Heavy Thunder Hammer"; - _wep2 = ""; - } - } - break; - case "ancients": - _rolename = roles.ancient; - _erole = eROLE.Ancient; - if(_coy.coy == 1 && _coy.terminators > 0){ - _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; - _wep2 = wep2[defaults_slot][eROLE.Terminator]; - } - break; - - - // VEHICLES - case "rhinos": - _is_vehicle = true; - _rolename = "Rhino"; - _erole = eROLE.Rhino; - _wep1 = "Storm Bolter"; - _wep2 = "HK Missile"; - _accessory = "Dozer Blades"; - if (_coy.coy == 1) { - _upgrade = "Artificer Hull"; - } - break; - case "landspeeders": - _is_vehicle = true; - _rolename = "Land Speeder"; - _erole = eROLE.LandSpeeder; - _wep1 = "Heavy Bolter"; - break; - case "whirlwinds": - _is_vehicle = true; - _rolename = "Whirlwind"; - _erole = eROLE.Whirlwind; - _wep1 = "Whirlwind Missiles"; - _wep2 = "HK Missile"; - break; - case "landraiders": - _is_vehicle = true; - _rolename = "Land Raider"; - _erole = eROLE.LandRaider; - _upgrade = "Heavy Armour"; - var variant = choose(1, 1, 2, 3); - // 50% - if (variant == 1) { - _wep1 = "Twin Linked Heavy Bolter Mount"; - _wep2 = "Twin Linked Lascannon Sponsons"; - _wep3 = "HK Missile"; - _accessory = "Searchlight"; - } - // 25% - if (variant == 2) { - _wep1 = "Twin Linked Assault Cannon Mount"; - _wep2 = "Hurricane Bolter Sponsons"; - _wep3 = "Storm Bolter"; - _accessory = "Frag Assault Launchers"; - } - //25% - if (variant == 3) { - _wep1 = "Twin Linked Assault Cannon Mount"; - _wep2 = "Flamestorm Cannon Sponsons"; - _wep3 = "Storm Bolter"; - _accessory = "Frag Assault Launchers"; - } - break; - case "predators": - _is_vehicle = true; - _rolename = "Predator"; - _erole = eROLE.Predator; - var variant = choose(1, 1, 2, 3); - // 1st company relic predators - if (_coy.coy == 1) { - _upgrade = "Artificer Hull"; - var predtype = choose(1, 2, 3, 4); - switch (predtype) { - case 1: - _wep1 = "Plasma Destroyer Turret"; - _wep2 = "Lascannon Sponsons"; - _wep3 = "HK Missile"; - _accessory = "Searchlight"; - break; - case 2: - _wep1 = "Heavy Conversion Beamer Turret"; - _wep2 = "Lascannon Sponsons"; - _wep3 = "HK Missile"; - _accessory = "Searchlight"; - break; - case 3: - _wep1 = "Flamestorm Cannon Turret"; - _wep2 = "Heavy Flamer Sponsons"; - _wep3 = "Storm Bolter"; - _accessory = "Dozer Blades"; - break; - case 4: - _wep1 = "Magna-Melta Turret"; - _wep2 = "Heavy Flamer Sponsons"; - _wep3 = "Storm Bolter"; - _accessory = "Dozer Blades"; - break; - } - } else { - //9th company and extras - var _variant = choose(1, 2); - if (_variant == 1) { - _wep1 = "Twin Linked Lascannon Turret"; - _wep2 = "Lascannon Sponsons"; - _wep3 = "HK Missile"; - _accessory = "Searchlight"; - } - if (_variant == 2) { - _wep1 = "Autocannon Turret"; - _wep2 = "Heavy Bolter Sponsons"; - _wep3 = "Storm Bolter"; - _accessory = "Dozer Blades"; - } - } - break; - } - repeat(_count){ - if(_is_vehicle){ - add_veh_to_company(_rolename, _coy.coy, v, _wep1, _wep2, _wep3, _upgrade, _accessory); - v++; - man_size += 10; - } else { - add_unit_to_company(_unit_type, _coy.coy, k, _rolename, _erole, _wep1,_wep2, _gear,_mobi,_armour); - k++; - man_size++; - if(_is_terminator(_armour)){ - man_size++; - } - } - } - switch(_coy.coy){ - case 1: firsts = k; break; - case 2: seconds = k; break; - case 3: thirds = k; break; - case 4: fourths = k; break; - case 5: fifths = k; break; - case 6: sixths = k; break; - case 7: sevenths = k; break; - case 8: eighths = k; break; - case 9: ninths = k; break; - case 10: tenths = k; break; - } - } - } - - #endregion - - - var c; - c = 0; - k = 0; - company = 0; - repeat(200) { - c += 1; - if (k = 0) { - if (role[0, c] != "") and(role[0, c + 1] = "") then k = c; - } - } - - - // obj_controller.marines-=commands; - - - scr_add_item("Bolter", 20); - scr_add_item("Chainsword", 20); - scr_add_item("Bolt Pistol", 5); - scr_add_item("Heavy Weapons Pack", 10); - scr_add_item(wep1[defaults_slot, eROLE.Scout ], 20); - scr_add_item(wep2[defaults_slot, eROLE.Scout ], 20); - - scr_add_item("Scout Armour", 20); - scr_add_item("MK8 Errant", 1); - scr_add_item("MK7 Aquila", 10); - - scr_add_item("Jump Pack", 10); - - scr_add_item("Lascannon", 5); - scr_add_item("Heavy Bolter", 5); - - scr_add_item("Bike", 40); - - if(struct_exists(obj_creation, "extra_equipment") ){ - for(var e = 0; e < array_length(obj_creation.extra_equipment); e++){ - var e_name = obj_creation.extra_equipment[e][0]; - var e_qty = obj_creation.extra_equipment[e][1]; - scr_add_item(e_name, e_qty); - } - } - - if(scr_has_disadv("Sieged")){ - scr_add_item("Narthecium", 4); - scr_add_item(wep1[defaults_slot, eROLE.Apothecary], 4); - scr_add_item(wep2[defaults_slot, eROLE.Apothecary], 4); - scr_add_item("Psychic Hood", 4); - scr_add_item("Crozius Arcanum", 4); - scr_add_item("Servo-arm", 4); - scr_add_item("Force Staff", 4); - scr_add_item("Plasma Pistol", 4); - scr_add_item("Company Standard", 4); - - if(scr_has_adv("Crafters")){ - scr_add_item("Tartaros", 10); - } else { - scr_add_item("Terminator Armour", 10); - } - - scr_add_item("MK7 Aquila", 200); - scr_add_item("Bolter", 200); - scr_add_item("Chainsword", 200); - scr_add_item("Jump Pack", 80); - scr_add_item("Bolt Pistol", 80); - scr_add_item("Heavy Bolter", 40); - scr_add_item("Lascannon", 40); - scr_add_item("Power Sword", 12); - scr_add_item("Rosarius", 4); - } - if (!scr_has_disadv("Sieged")) { - scr_add_item("Dreadnought", 6); - scr_add_item("Close Combat Weapon", 6); - } - if (scr_has_adv("Venerable Ancients")) { - scr_add_item("Dreadnought", 4); - scr_add_item("Close Combat Weapon", 4); - } - - // man_size+=80;// bikes - - - if (scr_has_adv("Crafters")) && (scr_has_adv("Melee Enthusiasts")) { + #region Chapter HQ + for (var c = 0; c < 11; c++) { + for (var i = 0; i < 501; i++) { + race[c][i] = 1; + name[c][i] = ""; + role[c][i] = ""; + wep1[c][i] = ""; + spe[c][i] = ""; + wep2[c][i] = ""; + armour[c][i] = ""; + chaos[c][i] = 0; + gear[c][i] = ""; + mobi[c][i] = ""; + age[c][i] = ((millenium * 1000) + year) - 10; + god[c][i] = 0; + TTRPG[c][i] = new TTRPG_stats("chapter", c, i, "blank"); + } + } + + // Chapter Master + // This needs work + name[company][0] = obj_creation.chapter_master_name; + var cm_equip = load_chapter_master_equipment(); + + var chapter_master = add_unit_to_company("chapter_master", 0, 0, roles.chapter_master, eROLE.ChapterMaster, cm_equip.wep1, cm_equip.wep2, cm_equip.gear, cm_equip.mobi, cm_equip.armour); + repeat (cm_equip.bionics) { + chapter_master.add_bionics("none", "standard", false); + } + + spe[company][0] = ""; + chapter_master.add_trait("lead_example"); + + //builds in which of the three chapter master types your CM is + // all of this can now be handled in teh struct and no longer neades complex methods + switch (obj_creation.chapter_master_specialty) { + case 1: + chapter_master.add_exp(550); + spe[company][0] += "$"; + break; + case 2: + chapter_master.add_exp(650); + spe[company][0] += "@"; + chapter_master.add_trait("champion"); + break; + case 3: + //TODO phychic powers need a redo but after weapon refactor + chapter_master.add_exp(550); + cm_equip.gear = "Psychic Hood"; + chapter_master.add_trait("favoured_by_the_warp"); + chapter_master.psionic = choose(13, 14); + chapter_master.update_powers(); + } + chapter_master.alter_equipment(cm_equip, false, false, "master_crafted"); + if (scr_has_adv("Paragon")) { + chapter_master.add_trait("paragon"); + } + chapter_master.marine_assembling(); + + var _hq_armour = "Artificer Armour"; + if (scr_has_disadv("Poor Equipment")) { + _hq_armour = "MK6 Corvus"; + } + + k += 1; + commands = 1; + + // Forge Master + name[company][1] = obj_creation.fmaster; + var _forge_master = add_unit_to_company("marine", company, 1, "Forge Master", eROLE.Techmarine, "Infernus Pistol", "Power Axe", "default", "Servo-harness", _hq_armour); + if (_forge_master.technology < 40) { + _forge_master.technology = 40; + } + _forge_master.add_trait("mars_trained"); + _forge_master.add_bionics("right_arm", "standard", false); + _forge_master.marine_assembling(); + if (global.chapter_name == "Iron Hands") { + repeat (9) { + _forge_master.add_bionics("none", "standard", false); + } + } else { + repeat (irandom(5) + 3) { + _forge_master.add_bionics("none", "standard", false); + } + } + k += 1; + commands += 1; + + // Master of Sanctity (Chaplain) + if (chaplains > 0) { + name[company][2] = high_chaplain_name; + var _hchap = add_unit_to_company("marine", company, 2, "Master of Sanctity", eROLE.Chaplain, "default", "Plasma Pistol", "default", "default", _hq_armour); + _hchap.edit_corruption(-100); + if (_hchap.piety < 45) { + _hchap.piety = 45; + } + _hchap.add_trait("zealous_faith"); + k += 1; + commands += 1; + } + + // Maser of the Apothecarion (Apothecary) + name[company][3] = obj_creation.hapothecary; + var _hapoth = add_unit_to_company("marine", company, 3, "Master of the Apothecarion", eROLE.Apothecary, "default", "Plasma Pistol", "default", "default", _hq_armour); + _hapoth.edit_corruption(0); + k += 1; + commands += 1; + + // Chief Librarian + if (!scr_has_disadv("Psyker Intolerant")) { + name[company][4] = obj_creation.clibrarian; + var _clibrarian = add_unit_to_company("marine", company, 4, string("Chief {0}", roles.librarian), eROLE.Librarian, "default", "Plasma Pistol", "default", "default", _hq_armour); + _clibrarian.edit_corruption(0); + _clibrarian.psionic = choose(11, 12); + _clibrarian.update_powers(); + _clibrarian.add_trait("favoured_by_the_warp"); + k += 1; + commands += 1; + } + man_size = k; + + // Techmarines in the armoury + repeat (techmarines) { + k += 1; + commands += 1; + man_size += 1; + add_unit_to_company("marine", company, k, roles.techmarine, eROLE.Techmarine, "default", choose_weighted(weapon_weighted_lists.pistols)); + } + + // Librarians in the librarium + repeat (epistolary) { + k += 1; + commands += 1; + man_size += 1; + var _epi = add_unit_to_company("marine", company, k, roles.librarian, eROLE.Librarian, "default", choose_weighted(weapon_weighted_lists.pistols)); + } + // Codiciery + repeat (codiciery) { + k += 1; + commands += 1; + man_size += 1; + var _codi = add_unit_to_company("marine", company, k, "Codiciery", eROLE.Librarian, "default", choose_weighted(weapon_weighted_lists.pistols)); + } + + // Lexicanum + repeat (lexicanum) { + k += 1; + commands += 1; + man_size += 1; + var _lexi = add_unit_to_company("marine", company, k, "Lexicanum", eROLE.Librarian, "default", choose_weighted(weapon_weighted_lists.pistols)); + } + + // Apothecaries in Apothecarion + repeat (apothecary) { + k += 1; + commands += 1; + man_size += 1; + add_unit_to_company("marine", company, k, roles.apothecary, eROLE.Apothecary, "Chainsword", choose_weighted(weapon_weighted_lists.pistols)); + } + + // Chaplains in Reclusium + repeat (chaplains) { + k += 1; + commands += 1; + man_size += 1; + add_unit_to_company("marine", company, k, roles.chaplain, eROLE.Chaplain, "default", choose_weighted(weapon_weighted_lists.pistols)); + } + + // Honour Guard + var _honour_guard_count = 0, unit; + if (scr_has_adv("Retinue of Renown")) { + _honour_guard_count += 10; + } + if (progenitor == ePROGENITOR.DARK_ANGELS && obj_creation.custom == eCHAPTER_TYPE.PREMADE) { + _honour_guard_count += 6; + } + if (_honour_guard_count == 0) { + _honour_guard_count = 3; + } + for (var i = 0; i < min(_honour_guard_count, 10); i++) { + k += 1; + commands += 1; + man_size += 1; + add_unit_to_company("marine", company, k, roles.honour_guard, eROLE.HonourGuard); + } + + specials = k; + #endregion + + #region New Totals Per Company Adjusted + var companies = { + first: { + coy: 1, + total: veteran + terminator, + veterans: veteran, + terminators: terminator, + tacticals: 0, + assaults: 0, + devastators: 0, + dreadnoughts: dreadnought == 0 ? 0 : dreadnought + 1, //handle obliterated + predators: predator, + landraiders: landraider, + }, + second: { + coy: 2, + total: second, + rhinos: rhino, + landspeeders: landspeeder, + dreadnoughts: dreadnought, + landraiders: landraider, + whirlwinds: whirlwind, + }, + third: { + coy: 3, + total: third, + rhinos: rhino, + landspeeders: landspeeder, + dreadnoughts: dreadnought, + whirlwinds: whirlwind, + }, + fourth: { + coy: 4, + total: fourth, + rhinos: rhino, + landspeeders: landspeeder, + dreadnoughts: dreadnought, + whirlwinds: whirlwind, + }, + fifth: { + coy: 5, + total: fifth, + rhinos: rhino, + landspeeders: landspeeder, + dreadnoughts: dreadnought, + whirlwinds: whirlwind, + }, + sixth: { + coy: 6, + total: sixth, + rhinos: rhino, + landspeeders: landspeeder - 2, + dreadnoughts: dreadnought, + whirlwinds: whirlwind, + }, + seventh: { + coy: 7, + total: seventh, + dreadnoughts: dreadnought, + rhinos: rhino, + landspeeders: landspeeder + 6, + whirlwinds: whirlwind - 4, + }, + eighth: { + coy: 8, + total: eighth, + dreadnoughts: dreadnought, + rhinos: rhino - 6, + whirlwinds: whirlwind - 4, + landspeeders: landspeeder, + }, + ninth: { + coy: 9, + total: ninth, + dreadnoughts: dreadnought, + rhinos: rhino - 6, + whirlwinds: whirlwind - 4, + landspeeders: landspeeder - 2, + predators: predator, + }, + tenth: { + coy: 10, + total: tenth, + dreadnoughts: 0, + rhinos: rhino, + whirlwinds: whirlwind - 4, + landspeeders: landspeeder - 2, + scouts: tenth - 10, //should work out to 90 + predators: 0, + landraiders: 0, + }, + }; + + log_message($"Pre balancing company totals: {json_stringify(companies, true)}"); + // Extra vehicles loaded from json files all get dumped into the 10th company for the player to sort out + + var vehicle_keys = ["rhino", "whirlwind", "predator", "land_raider", "land_speeder"]; + if (struct_exists(obj_creation, "extra_vehicles")) { + for (var v = 0; v < array_length(vehicle_keys); v++) { + var key = vehicle_keys[v]; + if (struct_exists(obj_creation.extra_vehicles, key) && real(obj_creation.extra_vehicles[$ key]) > 0) { + var coy_key = ""; + switch (key) { + case "rhino": + coy_key = "rhinos"; + break; + case "whirlwind": + coy_key = "whirlwinds"; + break; + case "predator": + coy_key = "predators"; + break; + case "land_raider": + coy_key = "landraiders"; + break; + case "land_speeder": + coy_key = "landspeeders"; + break; + } + companies.tenth[$ coy_key] += obj_creation.extra_vehicles[$ key]; + } + } + } + + var equal_specialists = obj_creation.equal_specialists; + var scout_company_behaviour = 0; + if (struct_exists(obj_creation, "scout_company_behaviour")) { + var scout_company_behaviour = obj_creation.scout_company_behaviour; + } + if (scout_company_behaviour == 1) { + load_default_gear(eROLE.Scout, "Neophyte", "Bolter", "", "Scout Armour", "", ""); + } + + var equal_scouts = 0; + if (struct_exists(obj_creation, "equal_scouts")) { + var equal_scouts = obj_creation.equal_scouts; + } + obj_ini.equal_scouts = equal_scouts; // for use in squad creation later + + var _moved_scouts = 0; + + var _coys = struct_get_names(companies); + function _is_terminator(_armour) { + return array_contains(["Terminator Armour", "Tartaros"], _armour); + } + for (var _c = 0, _clen = array_length(_coys); _c < _clen; _c++) { + var k = 0, v = 0; //k = marine slot, v = vehicle slot + + var _name = _coys[_c]; + var _coy = companies[$ _name]; + if (_coy.total <= 0) { + continue; + } + _coy.captains = 1; + _coy.champions = 1; + _coy.ancients = 1; + _coy.tacticals = 0; // see equal specialists section + _coy.assaults = 0; + _coy.devastators = 0; + _coy.chaplains = chaplains_per_company; + _coy.apothecaries = apothecary_per_company; + _coy.techmarines = techmarines_per_company; + _coy.librarians = epistolary_per_company; + + ///* Equal specialist behaviour: + /// if set to true, instead of having 8th and 9th be reserve companies of assaults and devastators, + /// those marines are instead evenly distributed between 2nd and 9th companies + /// the tacticals that they replace are distributed between 8th and 9th + /// meaning the total number of each shouldn't change. + /// on a fresh standard chapter with normal scouts, rates should be: + /// equal spec: + /// comp 2 - 9: tac: 60, ass: 20, dev: 20 + /// non-equal spec: + /// comp 2 - 5: tac 60, ass 20, dev: 20 + /// comp 6 - 7: tac 100 + /// comp 8: ass 100 + /// comp 9: dev 100 + + /// equal spec with equal scout + /// comp 2 - 9: tac 50: scout 10, ass 20, dev 20 + /// non-equal with equal scout + /// comp 2 - 5: tac 40: scout 20, ass 20, dev 20, + /// comp 8: ass 100 + /// comp 9: dev 100 + /// comp 10: tac 40: scout 50; + if (equal_specialists) { + // log_message("balancing for equal specialists") + // log_message($"equal_scouts? {equal_scouts}") + + if (_coy.coy >= 2 && _coy.coy <= 9) { + if (equal_scouts) { + if (companies.tenth.scouts > 10) { + //theoretically this keeps track of moving scouts from the bank of them in 10th + _coy.scouts = 10; + _coy.tacticals = max(0, (_coy.total - (assault + devastator + _coy.scouts))); + _moved_scouts += _coy.scouts; + companies.tenth.scouts -= _coy.scouts; + } else { + // if 10th is run out somehow, revert to normal behaviour + _coy.tacticals = max(0, (_coy.total - (assault + devastator))); + } + } else { + _coy.tacticals = max(0, (_coy.total - (assault + devastator))); + } + _coy.assaults = assault; + _coy.devastators = devastator; + } + if (equal_scouts && _coy.coy == 10) { + // theoretically this swaps moved scouts with tacticals + _coy.tacticals = _moved_scouts; + } + } else { + // log_message("balancing for non-equal specialists") + /// Default specialist behaviour, battle companies 2-7 have 90 tacticals each + /// and the assaults go into the 8th and devastators into the 9th + if (_coy.coy >= 2 && _coy.coy <= 5) { + if (equal_scouts) { + if (companies.tenth.scouts > 10) { + _coy.scouts = 10; + _moved_scouts += _coy.scouts; + _coy.tacticals = max(0, (_coy.total - (assault + devastator + _coy.scouts))); + companies.tenth.scouts -= _moved_scouts; + } else { + // if 10th is run out somehow, revert to normal behaviour + _coy.tacticals = max(0, (_coy.total - (assault + devastator))); + } + } else { + _coy.tacticals = max(0, (_coy.total - (assault + devastator))); + } + _coy.assaults = assault; + _coy.devastators = devastator; + } + + if (real(_coy.coy) >= 6 && real(_coy.coy) <= 7) { + if (equal_scouts) { + if (companies.tenth.scouts > 10) { + _coy.scouts = 10; + _moved_scouts += _coy.scouts; + _coy.tacticals = _coy.total - _coy.scouts; + companies.tenth.scouts -= _coy.scouts; + } else { + // if 10th is run out somehow, revert to normal behaviour + _coy.tacticals = _coy.total; + } + } else { + _coy.tacticals = _coy.total; + } + _coy.assaults = 0; + _coy.devastators = 0; + } + if (real(_coy.coy) == 8) { + _coy.tacticals = 0; + _coy.assaults = _coy.total; + _coy.devastators = 0; + } + if (real(_coy.coy) == 9) { + _coy.tacticals = 0; + _coy.assaults = 0; + _coy.devastators = _coy.total; + } + if (real(_coy.coy) == 10 && equal_scouts) { + _coy.tacticals = _moved_scouts; + _coy.scouts = _coy.scouts - _coy.tacticals; + } + } + + log_message($"New Company Totals: eq specialists: {equal_specialists}: scout coy {scout_company_behaviour} equal_scouts: {equal_scouts}"); + log_message($"Company {_coy.coy}: {json_stringify(_coy, true)}"); + + var attrs = struct_get_names(_coy); + + // log_message($"attrs {attrs}"); + + for (var _a = 0, _alen = array_length(attrs); _a < _alen; _a++) { + var _is_vehicle = false; + var _rolename; + var _erole; + var _wep1 = "default"; + var _wep2 = "default"; + var _gear = "default"; + var _mobi = "default"; + var _armour = "default"; + var _wep3 = ""; + var _upgrade = ""; + var _accessory = ""; + var _unit_type = "marine"; + var _role = attrs[_a]; + var _count = _coy[$ _role]; + + if (_role == "total" || _role == "coy") { + continue; + } + + // log_message($"processing: coy {_coy.coy} role {_role} count {_count}"); + switch (_role) { + // MAINLINE + case "tacticals": + if (scr_has_adv("Elite Guard")) { + _rolename = roles.veteran; + _erole = eROLE.Veteran; + } else { + _rolename = roles.tactical; + _erole = eROLE.Tactical; + } + break; + case "assaults": + _rolename = roles.assault; + _erole = eROLE.Assault; + _mobi = "Jump Pack"; + break; + case "devastators": + _rolename = roles.devastator; + _erole = eROLE.Devastator; + if (wep1[defaults_slot][eROLE.Devastator] == "Heavy Ranged") { + _wep1 = choose("Multi-Melta", "Lascannon", "Missile Launcher", "Heavy Bolter"); + } + break; + case "scouts": + _unit_type = "scout"; + _rolename = roles.scout; + _erole = eROLE.Scout; + break; + case "dreadnoughts": + _rolename = roles.dreadnought; + _unit_type = "dreadnought"; + if (scr_has_adv("Venerable Ancients")) { + _rolename = "Venerable " + roles.dreadnought; + } + _erole = eROLE.Dreadnought; + + if (_coy.coy == 9) { + _wep1 = "Missile Launcher"; + } + if (_coy.coy == 1) { + _rolename = "Venerable " + roles.dreadnought; + _wep2 = "Plasma Cannon"; + } + break; + + // VETERANS + case "veterans": + _rolename = roles.veteran; + _erole = eROLE.Veteran; + break; + + case "terminators": + _rolename = roles.terminator; + _erole = eROLE.Terminator; + break; + + // SPECIALISTS + case "captains": + switch (_coy.coy) { + case 1: + name[_coy.coy][k] = honor_captain_name != "" ? honor_captain_name : global.name_generator.generate_space_marine_name(); + break; + case 2: + name[_coy.coy][k] = watch_master_name != "" ? watch_master_name : global.name_generator.generate_space_marine_name(); + break; + case 3: + name[_coy.coy][k] = arsenal_master_name != "" ? arsenal_master_name : global.name_generator.generate_space_marine_name(); + break; + case 4: + name[_coy.coy][k] = lord_admiral_name != "" ? lord_admiral_name : global.name_generator.generate_space_marine_name(); + break; + case 5: + name[_coy.coy][k] = march_master_name != "" ? march_master_name : global.name_generator.generate_space_marine_name(); + break; + case 6: + name[_coy.coy][k] = rites_master_name != "" ? rites_master_name : global.name_generator.generate_space_marine_name(); + break; + case 7: + name[_coy.coy][k] = chief_victualler_name != "" ? chief_victualler_name : global.name_generator.generate_space_marine_name(); + break; + case 8: + name[_coy.coy][k] = lord_executioner_name != "" ? lord_executioner_name : global.name_generator.generate_space_marine_name(); + break; + case 9: + name[_coy.coy][k] = relic_master_name != "" ? relic_master_name : global.name_generator.generate_space_marine_name(); + break; + case 10: + name[_coy.coy][k] = recruiter_name != "" ? recruiter_name : global.name_generator.generate_space_marine_name(); + break; + } + commands++; + _rolename = roles.captain; + _erole = eROLE.Captain; + _wep2 = choose_weighted(weapon_weighted_lists.pistols); + if (equal_specialists == false && _coy.coy == 8) { + _mobi = "Jump Pack"; + } + if (_coy.coy == 1 && _coy.terminators > 0) { + _wep1 = "Relic Blade"; + _wep2 = choose("Storm Shield", "Storm Bolter"); + _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; + } + break; + case "chaplains": + commands++; + _rolename = roles.chaplain; + _erole = eROLE.Chaplain; + _wep2 = choose_weighted(weapon_weighted_lists.pistols); + if (equal_specialists == false && _coy.coy == 8) { + _mobi = "Jump Pack"; + } + if (_coy.coy == 1 && _coy.terminators > 0) { + _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; + _wep2 = wep2[defaults_slot][eROLE.Terminator]; + } + break; + case "apothecaries": + commands++; + _rolename = roles.apothecary; + _erole = eROLE.Apothecary; + if (equal_specialists == false && _coy.coy == 8) { + _mobi = "Jump Pack"; + } + if (_coy.coy == 1 && _coy.terminators > 0) { + _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; + _wep1 = wep1[defaults_slot][eROLE.Terminator]; + _wep2 = wep2[defaults_slot][eROLE.Terminator]; + } + break; + case "techmarines": + commands++; + _rolename = roles.techmarine; + _erole = eROLE.Techmarine; + if (_coy.coy == 1) { + if (_coy.terminators > 0) { + _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; + _wep2 = wep2[defaults_slot][eROLE.Terminator]; + } + if (!_is_terminator(_armour)) { + if (scr_has_disadv("Poor Equipment")) { + _armour = "MK6 Corvus"; + } else { + _armour = "Artificer Armour"; + } + } + } + break; + case "librarians": + commands++; + _rolename = roles.librarian; + _erole = eROLE.Librarian; + if (equal_specialists == false && _coy.coy == 8) { + _mobi = "Jump Pack"; + } + if (_coy.coy == 1 && _coy.terminators > 0) { + _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; + _wep2 = wep2[defaults_slot][eROLE.Terminator]; + } + break; + case "champions": + _rolename = roles.champion; + _erole = eROLE.Champion; + if (_coy.coy == 1 && _coy.terminators > 0) { + _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; + _wep1 = "Thunder Hammer"; + _wep2 = wep2[defaults_slot][eROLE.Terminator]; + if (global.chapter_name == "Dark Angels") { + _wep1 = "Heavy Thunder Hammer"; + _wep2 = ""; + } + } + break; + case "ancients": + _rolename = roles.ancient; + _erole = eROLE.Ancient; + if (_coy.coy == 1 && _coy.terminators > 0) { + _armour = scr_has_adv("Crafters") ? "Tartaros" : "Terminator Armour"; + _wep2 = wep2[defaults_slot][eROLE.Terminator]; + } + break; + + // VEHICLES + case "rhinos": + _is_vehicle = true; + _rolename = "Rhino"; + _erole = eROLE.Rhino; + _wep1 = "Storm Bolter"; + _wep2 = "HK Missile"; + _accessory = "Dozer Blades"; + if (_coy.coy == 1) { + _upgrade = "Artificer Hull"; + } + break; + case "landspeeders": + _is_vehicle = true; + _rolename = "Land Speeder"; + _erole = eROLE.LandSpeeder; + _wep1 = "Heavy Bolter"; + break; + case "whirlwinds": + _is_vehicle = true; + _rolename = "Whirlwind"; + _erole = eROLE.Whirlwind; + _wep1 = "Whirlwind Missiles"; + _wep2 = "HK Missile"; + break; + case "landraiders": + _is_vehicle = true; + _rolename = "Land Raider"; + _erole = eROLE.LandRaider; + _upgrade = "Heavy Armour"; + var variant = choose(1, 1, 2, 3); + // 50% + if (variant == 1) { + _wep1 = "Twin Linked Heavy Bolter Mount"; + _wep2 = "Twin Linked Lascannon Sponsons"; + _wep3 = "HK Missile"; + _accessory = "Searchlight"; + } + // 25% + if (variant == 2) { + _wep1 = "Twin Linked Assault Cannon Mount"; + _wep2 = "Hurricane Bolter Sponsons"; + _wep3 = "Storm Bolter"; + _accessory = "Frag Assault Launchers"; + } + //25% + if (variant == 3) { + _wep1 = "Twin Linked Assault Cannon Mount"; + _wep2 = "Flamestorm Cannon Sponsons"; + _wep3 = "Storm Bolter"; + _accessory = "Frag Assault Launchers"; + } + break; + case "predators": + _is_vehicle = true; + _rolename = "Predator"; + _erole = eROLE.Predator; + var variant = choose(1, 1, 2, 3); + // 1st company relic predators + if (_coy.coy == 1) { + _upgrade = "Artificer Hull"; + var predtype = choose(1, 2, 3, 4); + switch (predtype) { + case 1: + _wep1 = "Plasma Destroyer Turret"; + _wep2 = "Lascannon Sponsons"; + _wep3 = "HK Missile"; + _accessory = "Searchlight"; + break; + case 2: + _wep1 = "Heavy Conversion Beamer Turret"; + _wep2 = "Lascannon Sponsons"; + _wep3 = "HK Missile"; + _accessory = "Searchlight"; + break; + case 3: + _wep1 = "Flamestorm Cannon Turret"; + _wep2 = "Heavy Flamer Sponsons"; + _wep3 = "Storm Bolter"; + _accessory = "Dozer Blades"; + break; + case 4: + _wep1 = "Magna-Melta Turret"; + _wep2 = "Heavy Flamer Sponsons"; + _wep3 = "Storm Bolter"; + _accessory = "Dozer Blades"; + break; + } + } else { + //9th company and extras + var _variant = choose(1, 2); + if (_variant == 1) { + _wep1 = "Twin Linked Lascannon Turret"; + _wep2 = "Lascannon Sponsons"; + _wep3 = "HK Missile"; + _accessory = "Searchlight"; + } + if (_variant == 2) { + _wep1 = "Autocannon Turret"; + _wep2 = "Heavy Bolter Sponsons"; + _wep3 = "Storm Bolter"; + _accessory = "Dozer Blades"; + } + } + break; + } + repeat (_count) { + if (_is_vehicle) { + add_veh_to_company(_rolename, _coy.coy, v, _wep1, _wep2, _wep3, _upgrade, _accessory); + v++; + man_size += 10; + } else { + add_unit_to_company(_unit_type, _coy.coy, k, _rolename, _erole, _wep1, _wep2, _gear, _mobi, _armour); + k++; + man_size++; + if (_is_terminator(_armour)) { + man_size++; + } + } + } + switch (_coy.coy) { + case 1: + firsts = k; + break; + case 2: + seconds = k; + break; + case 3: + thirds = k; + break; + case 4: + fourths = k; + break; + case 5: + fifths = k; + break; + case 6: + sixths = k; + break; + case 7: + sevenths = k; + break; + case 8: + eighths = k; + break; + case 9: + ninths = k; + break; + case 10: + tenths = k; + break; + } + } + } + + #endregion + + var c; + c = 0; + k = 0; + company = 0; + repeat (200) { + c += 1; + if (k == 0) { + if ((role[0][c] != "") && (role[0][c + 1] == "")) { + k = c; + } + } + } + + // obj_controller.marines-=commands; + + scr_add_item("Bolter", 20); + scr_add_item("Chainsword", 20); + scr_add_item("Bolt Pistol", 5); + scr_add_item("Heavy Weapons Pack", 10); + scr_add_item(wep1[defaults_slot][eROLE.Scout], 20); + scr_add_item(wep2[defaults_slot][eROLE.Scout], 20); + + scr_add_item("Scout Armour", 20); + scr_add_item("MK8 Errant", 1); + scr_add_item("MK7 Aquila", 10); + + scr_add_item("Jump Pack", 10); + + scr_add_item("Lascannon", 5); + scr_add_item("Heavy Bolter", 5); + + scr_add_item("Bike", 40); + + if (struct_exists(obj_creation, "extra_equipment")) { + for (var e = 0; e < array_length(obj_creation.extra_equipment); e++) { + var e_name = obj_creation.extra_equipment[e][0]; + var e_qty = obj_creation.extra_equipment[e][1]; + scr_add_item(e_name, e_qty); + } + } + + if (scr_has_disadv("Sieged")) { + scr_add_item("Narthecium", 4); + scr_add_item(wep1[defaults_slot][eROLE.Apothecary], 4); + scr_add_item(wep2[defaults_slot][eROLE.Apothecary], 4); + scr_add_item("Psychic Hood", 4); + scr_add_item("Crozius Arcanum", 4); + scr_add_item("Servo-arm", 4); + scr_add_item("Force Staff", 4); + scr_add_item("Plasma Pistol", 4); + scr_add_item("Company Standard", 4); + + if (scr_has_adv("Crafters")) { + scr_add_item("Tartaros", 10); + } else { + scr_add_item("Terminator Armour", 10); + } + + scr_add_item("MK7 Aquila", 200); + scr_add_item("Bolter", 200); + scr_add_item("Chainsword", 200); + scr_add_item("Jump Pack", 80); + scr_add_item("Bolt Pistol", 80); + scr_add_item("Heavy Bolter", 40); + scr_add_item("Lascannon", 40); + scr_add_item("Power Sword", 12); + scr_add_item("Rosarius", 4); + } + if (!scr_has_disadv("Sieged")) { + scr_add_item("Dreadnought", 6); + scr_add_item("Close Combat Weapon", 6); + } + if (scr_has_adv("Venerable Ancients")) { + scr_add_item("Dreadnought", 4); + scr_add_item("Close Combat Weapon", 4); + } + + // man_size+=80;// bikes + + if (scr_has_adv("Crafters") && scr_has_adv("Melee Enthusiasts")) { scr_add_item("MK3 Iron Armour", irandom_range(2, 12)); - } + } - if (scr_has_adv("Crafters")) && (!scr_has_adv("Melee Enthusiasts")) { + if (scr_has_adv("Crafters") && (!scr_has_adv("Melee Enthusiasts"))) { scr_add_item("MK4 Maximus", irandom_range(3, 18)); - } - - //Fixed Loot tagble -if(scr_has_adv("Ancient Armoury")){ -//armour -var armm5=""; - armm5=choose("Tartaros","Cataphractii"); - scr_add_item("MK3 Iron Armour",irandom_range(2,5)); - scr_add_item("MK4 Maximus",irandom_range(5,10)); - scr_add_item("MK5 Heresy",irandom_range(5,10)); - scr_add_item("MK6 Corvus",irandom_range(5,10));//Lowered to balance other buffs - scr_add_item("MK7 Aquila", -10); - scr_add_item("MK8 Errant", -1); -//weapons (I'm not sure about replacing all 40k weapons with 30k) - var armm1="",armk1=0,armm2="",armk2=0,armm3="",armk3=0,armm4="",armk4=0; - scr_add_item("Bolter", -15); - scr_add_item("Bolt Pistol", -5); - scr_add_item("Lascannon",-5); - scr_add_item("Heavy Bolter",-5) - scr_add_item("Phobos Bolter",10); - scr_add_item("Phobos Bolt Pistol",3); - scr_add_item("Mars Heavy Bolter",5); - scr_add_item("Serpha Jump Pack",5); - scr_add_item("Jump Pack",-5); - armm1=choose("Volkite Culverin","Volkite Caliver","Mars Plasma Cannon","Ryza Lascannon","Grav-Cannon","Proteus Multi-Melta","Cthon Autocannon"); - armk1=irandom_range(2,5); - armm2=choose("Primus Melta Gun","Ryza Plasma Gun","Volkite Charger","Grav-Gun"); - armk2=irandom_range(2,5) - armm3=choose("Ryza Plasma Pistol","Volkite Serpenta") - armk3=irandom_range(1,3) - armk4=choose("Power Sword","Power Fist", "Lightining Claw","Power Axe","Power Scythe") - armk4=irandom_range(1,3) - scr_add_item(armm1,armk1); - scr_add_item(armm2,armk2); - scr_add_item(armm3,armk3); - scr_add_item(armm4,armk4); - scr_add_item(armm5,1); - - } + } + //Fixed Loot tagble + if (scr_has_adv("Ancient Armoury")) { + //armour + var armm5 = ""; + armm5 = choose("Tartaros", "Cataphractii"); + scr_add_item("MK3 Iron Armour", irandom_range(2, 5)); + scr_add_item("MK4 Maximus", irandom_range(5, 10)); + scr_add_item("MK5 Heresy", irandom_range(5, 10)); + scr_add_item("MK6 Corvus", irandom_range(5, 10)); //Lowered to balance other buffs + scr_add_item("MK7 Aquila", -10); + scr_add_item("MK8 Errant", -1); + //weapons (I'm not sure about replacing all 40k weapons with 30k) + var armm1 = "", armk1 = 0, armm2 = "", armk2 = 0, armm3 = "", armk3 = 0, armm4 = "", armk4 = 0; + scr_add_item("Bolter", -15); + scr_add_item("Bolt Pistol", -5); + scr_add_item("Lascannon", -5); + scr_add_item("Heavy Bolter", -5); + scr_add_item("Phobos Bolter", 10); + scr_add_item("Phobos Bolt Pistol", 3); + scr_add_item("Mars Heavy Bolter", 5); + scr_add_item("Serpha Jump Pack", 5); + scr_add_item("Jump Pack", -5); + armm1 = choose("Volkite Culverin", "Volkite Caliver", "Mars Plasma Cannon", "Ryza Lascannon", "Grav-Cannon", "Proteus Multi-Melta", "Cthon Autocannon"); + armk1 = irandom_range(2, 5); + armm2 = choose("Primus Melta Gun", "Ryza Plasma Gun", "Volkite Charger", "Grav-Gun"); + armk2 = irandom_range(2, 5); + armm3 = choose("Ryza Plasma Pistol", "Volkite Serpenta"); + armk3 = irandom_range(1, 3); + armk4 = choose("Power Sword", "Power Fist", "Lightining Claw", "Power Axe", "Power Scythe"); + armk4 = irandom_range(1, 3); + scr_add_item(armm1, armk1); + scr_add_item(armm2, armk2); + scr_add_item(armm3, armk3); + scr_add_item(armm4, armk4); + scr_add_item(armm5, 1); + } gene_slaves = []; - - var bloo = 0, - o = 0; - if (scr_has_disadv("Blood Debt")) { - bloo = 1; - if (instance_exists(obj_controller)) { - obj_controller.blood_debt = 1; - penitent = 1; - penitent_max = (obj_creation.strength * 1000) + 300; - penitent_current = 300; - penitent_end = obj_creation.strength * 48; - } - } else { - if (fleet_type == ePlayerBase.penitent) { - penitent = 1; - penitent_max = (obj_creation.strength * 60); - penitent_current = 1; - penitent_end = obj_creation.strength * 5; - - if (obj_creation.chapter_name = "Lamenters") { - penitent_max = 600; - penitent_end = 600; - // obj_controller.loyalty=50;obj_controller.loyalty_hidden=50; - } - } - } + + var bloo = 0, o = 0; + if (scr_has_disadv("Blood Debt")) { + bloo = 1; + if (instance_exists(obj_controller)) { + obj_controller.blood_debt = 1; + penitent = 1; + penitent_max = (obj_creation.strength * 1000) + 300; + penitent_current = 300; + penitent_end = obj_creation.strength * 48; + } + } else { + if (fleet_type == ePlayerBase.penitent) { + penitent = 1; + penitent_max = obj_creation.strength * 60; + penitent_current = 1; + penitent_end = obj_creation.strength * 5; + + if (obj_creation.chapter_name == "Lamenters") { + penitent_max = 600; + penitent_end = 600; + // obj_controller.loyalty=50;obj_controller.loyalty_hidden=50; + } + } + } } /// @description helper function to streamline code inside of scr_initialize_custom, should only be used as part of /// game setup and not during normal gameplay function add_veh_to_company(name, company, slot, wep1, wep2, wep3, upgrade, accessory) { - // log_message($"adding vehicle name {name} company {company} slot {slot} ") - obj_ini.veh_race[company, slot] = 1; - obj_ini.veh_loc[company, slot] = obj_ini.home_name; - obj_ini.veh_role[company, slot] = name; - obj_ini.veh_wep1[company, slot] = wep1; - obj_ini.veh_wep2[company, slot] = wep2; - obj_ini.veh_wep3[company, slot] = wep3; - obj_ini.veh_upgrade[company, slot] = upgrade; - obj_ini.veh_acc[company, slot] = accessory; - obj_ini.veh_hp[company, slot] = 100; - obj_ini.veh_chaos[company, slot] = 0; - obj_ini.veh_pilots[company, slot] = 0; - obj_ini.veh_lid[company, slot] = -1; - obj_ini.veh_wid[company, slot] = 2; + // log_message($"adding vehicle name {name} company {company} slot {slot} ") + obj_ini.veh_race[company][slot] = 1; + obj_ini.veh_loc[company][slot] = obj_ini.home_name; + obj_ini.veh_role[company][slot] = name; + obj_ini.veh_wep1[company][slot] = wep1; + obj_ini.veh_wep2[company][slot] = wep2; + obj_ini.veh_wep3[company][slot] = wep3; + obj_ini.veh_upgrade[company][slot] = upgrade; + obj_ini.veh_acc[company][slot] = accessory; + obj_ini.veh_hp[company][slot] = 100; + obj_ini.veh_chaos[company][slot] = 0; + obj_ini.veh_pilots[company][slot] = 0; + obj_ini.veh_lid[company][slot] = -1; + obj_ini.veh_wid[company][slot] = 2; } /// @description helper function to streamline code inside of scr_initialize_custom, should only be used as part of /// game setup and not during normal gameplay. -/// each item slot can be "" or "default" or a named item. "" will assign items from the available item pool. +/// each item slot can be "" or "default" or a named item. "" will assign items from the available item pool. /// Use "" if you want to set weapons and gear via squad layouts. /// "default" will set it to the value in the default slot for the given role, see `load_default_gear` -function add_unit_to_company(ttrpg_name, company, slot, role_name, role_id, wep1="default", wep2="default", gear="default", mobi="default", armour="default"){ - // log_message($"adding unit to company ttrpg_name {ttrpg_name}, company {company}, slot {slot}, role_name {role_name}, role_id {role_id}") - obj_ini.TTRPG[company][slot] = new TTRPG_stats("chapter", company, slot, ttrpg_name); - var spawn_unit = fetch_unit([company,slot]); - obj_ini.race[company][slot] = 1; - spawn_unit.location_string = obj_ini.home_name; - obj_ini.role[company][slot] = role_name; - - if(obj_ini.name[company][slot] == ""){ - obj_ini.name[company][slot] = global.name_generator.generate_space_marine_name(); - } - - - if(wep1 != ""){ - if(wep1 == "default"){ - spawn_unit.update_weapon_one(obj_ini.wep1[obj_ini.defaults_slot][role_id], false, false); - } else { - spawn_unit.update_weapon_one(wep1, false, false); - } - } - if(wep2 != ""){ - if(wep2 == "default"){ - spawn_unit.update_weapon_two(obj_ini.wep2[obj_ini.defaults_slot][role_id], false, false); - } else { - spawn_unit.update_weapon_two(wep2, false, false); - } - } - if(armour != ""){ - if(armour == "default"){ - spawn_unit.update_armour(obj_ini.armour[obj_ini.defaults_slot][role_id], false, false); - } else { - spawn_unit.update_armour(armour, false, false); - } - - // show_debug_message($"updating coy {company}:{slot} {role_name} armour to {armour}: {_msg} : {spawn_unit.armour()} : {obj_ini.armour[company][slot]}"); - } - if(gear != ""){ - if(gear == "default"){ - spawn_unit.update_gear(obj_ini.gear[obj_ini.defaults_slot][role_id], false, false); - } else { - spawn_unit.update_gear(gear, false, false); - } - } - if(mobi != ""){ - if(mobi == "default"){ - spawn_unit.update_mobility_item(obj_ini.mobi[obj_ini.defaults_slot][role_id], false, false); - } else { - spawn_unit.update_mobility_item(mobi, false, false); - } - } - if(ttrpg_name == "marine" || ttrpg_name == "scout"){ +function add_unit_to_company(ttrpg_name, company, slot, role_name, role_id, wep1 = "default", wep2 = "default", gear = "default", mobi = "default", armour = "default") { + // log_message($"adding unit to company ttrpg_name {ttrpg_name}, company {company}, slot {slot}, role_name {role_name}, role_id {role_id}") + obj_ini.TTRPG[company][slot] = new TTRPG_stats("chapter", company, slot, ttrpg_name); + var spawn_unit = fetch_unit([company, slot]); + obj_ini.race[company][slot] = 1; + spawn_unit.location_string = obj_ini.home_name; + obj_ini.role[company][slot] = role_name; + + if (obj_ini.name[company][slot] == "") { + obj_ini.name[company][slot] = global.name_generator.generate_space_marine_name(); + } + + if (wep1 != "") { + if (wep1 == "default") { + spawn_unit.update_weapon_one(obj_ini.wep1[obj_ini.defaults_slot][role_id], false, false); + } else { + spawn_unit.update_weapon_one(wep1, false, false); + } + } + if (wep2 != "") { + if (wep2 == "default") { + spawn_unit.update_weapon_two(obj_ini.wep2[obj_ini.defaults_slot][role_id], false, false); + } else { + spawn_unit.update_weapon_two(wep2, false, false); + } + } + if (armour != "") { + if (armour == "default") { + spawn_unit.update_armour(obj_ini.armour[obj_ini.defaults_slot][role_id], false, false); + } else { + spawn_unit.update_armour(armour, false, false); + } + + // show_debug_message($"updating coy {company}:{slot} {role_name} armour to {armour}: {_msg} : {spawn_unit.armour()} : {obj_ini.armour[company][slot]}"); + } + if (gear != "") { + if (gear == "default") { + spawn_unit.update_gear(obj_ini.gear[obj_ini.defaults_slot][role_id], false, false); + } else { + spawn_unit.update_gear(gear, false, false); + } + } + if (mobi != "") { + if (mobi == "default") { + spawn_unit.update_mobility_item(obj_ini.mobi[obj_ini.defaults_slot][role_id], false, false); + } else { + spawn_unit.update_mobility_item(mobi, false, false); + } + } + if (ttrpg_name == "marine" || ttrpg_name == "scout") { spawn_unit.marine_assembling(); } else { spawn_unit.roll_age(); spawn_unit.roll_experience(); - } - if(role_id == eROLE.HonourGuard){ - spawn_unit.add_trait(choose("guardian", "champion", "observant", "perfectionist","natural_leader")); - } - if(role_id == eROLE.Champion){ - spawn_unit.add_trait("champion"); - } - if(role_id == eROLE.Apothecary){ - spawn_unit.add_trait("soft_target"); - } - if(role_id == eROLE.Librarian){ - if (scr_has_adv("Favoured By The Warp") && (roll_dice_unit(1, 6, "high", spawn_unit) >= 4)) { - spawn_unit.add_trait("favoured_by_the_warp"); - } else if (roll_dice_unit(1, 10, "high", spawn_unit) == 10) { - spawn_unit.add_trait("favoured_by_the_warp"); - } - - if (role_name == obj_ini.role[100][eROLE.Librarian]) { - spawn_unit.psionic = irandom_range(8, 10); - } else if (role_name == "Codiciery") { - spawn_unit.psionic = irandom_range(5, 7); - if (roll_dice_unit(1, 6, "high", spawn_unit) < 4) { - spawn_unit.update_gear(obj_ini.gear[obj_ini.defaults_slot][eROLE.Tactical], false, false); - } - if (roll_dice_unit(1, 6, "high", spawn_unit) < 4) { - spawn_unit.update_weapon_one(choose("Force Axe", "Force Sword"), false, false); - } - } else if (role_name == "Lexicanum") { - spawn_unit.psionic = irandom_range(2, 4); - spawn_unit.update_weapon_one(choose("Force Axe", "Force Sword"), false, false); - spawn_unit.update_gear(obj_ini.gear[obj_ini.defaults_slot][eROLE.Tactical], false, false); - } - spawn_unit.update_powers(); - } - - return spawn_unit; + } + if (role_id == eROLE.HonourGuard) { + spawn_unit.add_trait(choose("guardian", "champion", "observant", "perfectionist", "natural_leader")); + } + if (role_id == eROLE.Champion) { + spawn_unit.add_trait("champion"); + } + if (role_id == eROLE.Apothecary) { + spawn_unit.add_trait("soft_target"); + } + if (role_id == eROLE.Librarian) { + if (scr_has_adv("Favoured By The Warp") && (roll_dice_unit(1, 6, "high", spawn_unit) >= 4)) { + spawn_unit.add_trait("favoured_by_the_warp"); + } else if (roll_dice_unit(1, 10, "high", spawn_unit) == 10) { + spawn_unit.add_trait("favoured_by_the_warp"); + } + + if (role_name == obj_ini.role[100][eROLE.Librarian]) { + spawn_unit.psionic = irandom_range(8, 10); + } else if (role_name == "Codiciery") { + spawn_unit.psionic = irandom_range(5, 7); + if (roll_dice_unit(1, 6, "high", spawn_unit) < 4) { + spawn_unit.update_gear(obj_ini.gear[obj_ini.defaults_slot][eROLE.Tactical], false, false); + } + if (roll_dice_unit(1, 6, "high", spawn_unit) < 4) { + spawn_unit.update_weapon_one(choose("Force Axe", "Force Sword"), false, false); + } + } else if (role_name == "Lexicanum") { + spawn_unit.psionic = irandom_range(2, 4); + spawn_unit.update_weapon_one(choose("Force Axe", "Force Sword"), false, false); + spawn_unit.update_gear(obj_ini.gear[obj_ini.defaults_slot][eROLE.Tactical], false, false); + } + spawn_unit.update_powers(); + } + + return spawn_unit; } ///@mixin obj_ini -function load_chapter_master_equipment(){ - var chapter_master_equip = {}; - switch (obj_ini.master_melee) { - case 1: - chapter_master_equip.wep1 = "Power Fist"; - chapter_master_equip.wep2 = "Power Fist"; - break; - case 2: - chapter_master_equip.wep1 = "Lightning Claw"; - chapter_master_equip.wep2 = "Lightning Claw"; - break; - case 3: - chapter_master_equip.wep1 = "Relic Blade"; - //wep1[0,1]="Relic Blade&MNR|"; - break; - case 4: - chapter_master_equip.wep1 = "Thunder Hammer"; - break; - case 5: - chapter_master_equip.wep1 = "Power Sword"; - break; - case 6: - chapter_master_equip.wep1 = "Power Axe"; - break; - case 7: - chapter_master_equip.wep1 = "Eviscerator"; - chapter_master_equip.wep2 = ""; - break; - case 8: - chapter_master_equip.wep1 = "Force Staff"; - break; - } - - if (!array_contains([1,2,7], master_melee)){ - switch (master_ranged) { - case 1: - chapter_master_equip.wep2 = "Boltstorm Gauntlet"; - break; - case 2: - chapter_master_equip.wep2 = "Infernus Pistol"; - break; - case 3: - chapter_master_equip.wep2 = "Plasma Pistol"; - break; - case 4: - chapter_master_equip.wep2 = "Plasma Gun"; - break; - case 5: - chapter_master_equip.wep2 = "Heavy Bolter"; - break; - case 6: - chapter_master_equip.wep2 = "Meltagun"; - break; - case 7: - chapter_master_equip.wep2 = "Storm Shield"; - break; - } - } - - chapter_master_equip.armour = "Artificer Armour"; - chapter_master_equip.gear = "Iron Halo"; - chapter_master_equip.mobi = ""; - chapter_master_equip.bionics = 0; - - last_artifact = find_open_artifact_slot(); - var arti; - - // From json - if(struct_exists(obj_creation, "artifact") ){ - if(is_struct(obj_creation.artifact) && struct_exists(obj_creation.artifact, "name")){ - arti = obj_ini.artifact_struct[last_artifact]; - arti.name = obj_creation.artifact.name; - arti.custom_description = obj_creation.artifact.description; - obj_ini.artifact[last_artifact] = obj_creation.artifact.base_weapon_type; - arti.bearer = [0,1]; - obj_ini.artifact_identified[last_artifact] = 0; - chapter_master_equip.wep1 = last_artifact; - } else if(is_array(obj_creation.artifact) && array_length(obj_creation.artifact) > 0){ - for(var a = 0; a < array_length(obj_creation.artifact); a++){ - arti = obj_ini.artifact_struct[last_artifact]; - arti.name = obj_creation.artifact[a].name; - arti.custom_description = obj_creation.artifact[a].description; - obj_ini.artifact[last_artifact] = obj_creation.artifact[a].base_weapon_type; - arti.bearer = [0,1]; - obj_ini.artifact_identified[last_artifact] = 0; - switch (obj_creation.artifact[a].slot){ - case "wep1": chapter_master_equip.wep1 = last_artifact; break; - case "wep2": chapter_master_equip.wep2 = last_artifact; break; - case "armour": chapter_master_equip.armour = last_artifact; break; - case "gear": chapter_master_equip.gear = last_artifact; break; - case "mobi": chapter_master_equip.mobi = last_artifact; break; - } - last_artifact++; - } - } - } - - if(struct_exists(obj_creation, "chapter_master")){ - if(struct_exists(obj_creation.chapter_master, "gear") && obj_creation.chapter_master.gear != ""){ - chapter_master_equip.gear = obj_creation.chapter_master.gear; - } - if(struct_exists(obj_creation.chapter_master, "mobi") && obj_creation.chapter_master.mobi != ""){ - chapter_master_equip.mobi = obj_creation.chapter_master.mobi; - } - if(struct_exists(obj_creation.chapter_master, "armour") && obj_creation.chapter_master.armour != ""){ - chapter_master_equip.armour = obj_creation.chapter_master.armour; - } - if(struct_exists(obj_creation.chapter_master, "bionics") && obj_creation.chapter_master.bionics != ""){ - for (var i = 0; i < real(obj_creation.chapter_master.bionics); i++) { - chapter_master_equip.bionics += 1; - } - } - } - - return chapter_master_equip; -} \ No newline at end of file +function load_chapter_master_equipment() { + var chapter_master_equip = {}; + switch (obj_ini.master_melee) { + case 1: + chapter_master_equip.wep1 = "Power Fist"; + chapter_master_equip.wep2 = "Power Fist"; + break; + case 2: + chapter_master_equip.wep1 = "Lightning Claw"; + chapter_master_equip.wep2 = "Lightning Claw"; + break; + case 3: + chapter_master_equip.wep1 = "Relic Blade"; + //wep1[0,1]="Relic Blade&MNR|"; + break; + case 4: + chapter_master_equip.wep1 = "Thunder Hammer"; + break; + case 5: + chapter_master_equip.wep1 = "Power Sword"; + break; + case 6: + chapter_master_equip.wep1 = "Power Axe"; + break; + case 7: + chapter_master_equip.wep1 = "Eviscerator"; + chapter_master_equip.wep2 = ""; + break; + case 8: + chapter_master_equip.wep1 = "Force Staff"; + break; + } + + if (!array_contains([1, 2, 7], master_melee)) { + switch (master_ranged) { + case 1: + chapter_master_equip.wep2 = "Boltstorm Gauntlet"; + break; + case 2: + chapter_master_equip.wep2 = "Infernus Pistol"; + break; + case 3: + chapter_master_equip.wep2 = "Plasma Pistol"; + break; + case 4: + chapter_master_equip.wep2 = "Plasma Gun"; + break; + case 5: + chapter_master_equip.wep2 = "Heavy Bolter"; + break; + case 6: + chapter_master_equip.wep2 = "Meltagun"; + break; + case 7: + chapter_master_equip.wep2 = "Storm Shield"; + break; + } + } + + chapter_master_equip.armour = "Artificer Armour"; + chapter_master_equip.gear = "Iron Halo"; + chapter_master_equip.mobi = ""; + chapter_master_equip.bionics = 0; + + last_artifact = find_open_artifact_slot(); + var arti; + + // From json + if (struct_exists(obj_creation, "artifact")) { + if (is_struct(obj_creation.artifact) && struct_exists(obj_creation.artifact, "name")) { + arti = obj_ini.artifact_struct[last_artifact]; + arti.name = obj_creation.artifact.name; + arti.custom_description = obj_creation.artifact.description; + obj_ini.artifact[last_artifact] = obj_creation.artifact.base_weapon_type; + arti.bearer = [0, 1]; + obj_ini.artifact_identified[last_artifact] = 0; + chapter_master_equip.wep1 = last_artifact; + } else if (is_array(obj_creation.artifact) && array_length(obj_creation.artifact) > 0) { + for (var a = 0; a < array_length(obj_creation.artifact); a++) { + arti = obj_ini.artifact_struct[last_artifact]; + arti.name = obj_creation.artifact[a].name; + arti.custom_description = obj_creation.artifact[a].description; + obj_ini.artifact[last_artifact] = obj_creation.artifact[a].base_weapon_type; + arti.bearer = [0, 1]; + obj_ini.artifact_identified[last_artifact] = 0; + switch (obj_creation.artifact[a].slot) { + case "wep1": + chapter_master_equip.wep1 = last_artifact; + break; + case "wep2": + chapter_master_equip.wep2 = last_artifact; + break; + case "armour": + chapter_master_equip.armour = last_artifact; + break; + case "gear": + chapter_master_equip.gear = last_artifact; + break; + case "mobi": + chapter_master_equip.mobi = last_artifact; + break; + } + last_artifact++; + } + } + } + + if (struct_exists(obj_creation, "chapter_master")) { + if (struct_exists(obj_creation.chapter_master, "gear") && obj_creation.chapter_master.gear != "") { + chapter_master_equip.gear = obj_creation.chapter_master.gear; + } + if (struct_exists(obj_creation.chapter_master, "mobi") && obj_creation.chapter_master.mobi != "") { + chapter_master_equip.mobi = obj_creation.chapter_master.mobi; + } + if (struct_exists(obj_creation.chapter_master, "armour") && obj_creation.chapter_master.armour != "") { + chapter_master_equip.armour = obj_creation.chapter_master.armour; + } + if (struct_exists(obj_creation.chapter_master, "bionics") && obj_creation.chapter_master.bionics != "") { + for (var i = 0; i < real(obj_creation.chapter_master.bionics); i++) { + chapter_master_equip.bionics += 1; + } + } + } + + return chapter_master_equip; +} diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index a3c7922d80..b02c6c98ff 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -434,15 +434,7 @@ function discover_artifact_popup(feature) { choice_func: ground_forces_collect_artifact, }; if ((current_owner >= eFACTION.Tyranids) || ((current_owner == eFACTION.Ork) && (pdf <= 0))) { - pop.add_option( - [ - { - str1: "Let it be", - choice_func: ground_mission_leave_it_function, - }, - _take_arti - ] - ); + pop.add_option([{str1: "Let it be", choice_func: ground_mission_leave_it_function}, _take_arti]); } else { var _opt1 = "Request audience with the "; switch (current_owner) { @@ -459,17 +451,11 @@ function discover_artifact_popup(feature) { break; case eFACTION.Mechanicus: _opt1 += "Mechanicus"; - pop.add_option({ - str1: "Let it be. The Mechanicus' wrath is not lightly provoked.", - choice_func: ground_mission_leave_it_function, - }); + pop.add_option({str1: "Let it be. The Mechanicus' wrath is not lightly provoked.", choice_func: ground_mission_leave_it_function}); break; case eFACTION.Inquisition: _opt1 += "Inquisition"; - pop.add_option({ - choice_func: ground_mission_leave_it_function, - str1: "Let it be. The Inquisition's wrath is not lightly provoked.", - }); + pop.add_option({choice_func: ground_mission_leave_it_function, str1: "Let it be. The Inquisition's wrath is not lightly provoked."}); break; case eFACTION.Ecclesiarchy: _opt1 += "Ecclesiarchy"; @@ -503,15 +489,7 @@ function discover_artifact_popup(feature) { break; } _opt1 += " regarding the Artifact."; - pop.add_option( - [ - { - str1: _opt1, - choice_func: governor_negotiate_artifact, - }, - _take_arti - ] - ); + pop.add_option([{str1: _opt1, choice_func: governor_negotiate_artifact}, _take_arti]); } } @@ -609,20 +587,14 @@ function discover_stc_fragment_popup(techies, mechanicus_reps) { pop.text = $"{_text}. The present Tech Priests stress they will not condone a mission to steal the STC Fragment."; } else if (techies > 0) { pop.text = $"{_text}. Taking it may be seen as an act of war. What is thy will?"; - pop.add_option({ - str1: "Attempt to steal the STC Fragment.", - choice_func: remove_stc_from_planet, - }); // TODO: Fix this option, as it crashes the game when the battle starts); + pop.add_option({str1: "Attempt to steal the STC Fragment.", choice_func: remove_stc_from_planet}); // TODO: Fix this option, as it crashes the game when the battle starts); } else { pop.text = $"{_text}. Taking it may be seen as an act of war. The ground team has no Techmarines, so you have no choice but to leave it be."; } } else { var _text = $"An STC Fragment appears to be located upon {name()}"; if (techies > 0) { - array_push(options, { - str1: "Swiftly take the STC Fragment.", - choice_func: remove_stc_from_planet, - }); + array_push(options, {str1: "Swiftly take the STC Fragment.", choice_func: remove_stc_from_planet}); if (mechanicus_reps == 0) { pop.text = $"{_text}; what it might contain is unknown. Your {obj_ini.role[100][16]}s wish to reclaim, identify, and put it to use immediately. What is thy will?"; } else { @@ -634,15 +606,9 @@ function discover_stc_fragment_popup(techies, mechanicus_reps) { pop.text = $"{_text}; what it might contain is unknown. The ground team has no {obj_ini.role[100][16]}s or Tech Priests, so you have no choice but to leave it be or notify the Mechanicus about its location."; } - array_push(options, { - str1: "Send it to the Adeptus Mechanicuss.", - choice_func: send_stc_to_adeptus_mech, - }); + array_push(options, {str1: "Send it to the Adeptus Mechanicuss.", choice_func: send_stc_to_adeptus_mech}); } - array_push(options, { - str1: "Leave it.", - choice_func: ground_mission_leave_it_function, - }); + array_push(options, {str1: "Leave it.", choice_func: ground_mission_leave_it_function}); pop.add_option(options); } diff --git a/scripts/scr_popup_functions/scr_popup_functions.gml b/scripts/scr_popup_functions/scr_popup_functions.gml index 4766ba13ef..8ca9547d5f 100644 --- a/scripts/scr_popup_functions/scr_popup_functions.gml +++ b/scripts/scr_popup_functions/scr_popup_functions.gml @@ -1,346 +1,340 @@ - /// @function reset_popup_options() /// @description Resets all popup option variables to empty strings enum POPUP_TYPE { - PROMOTION = 5, - EQUIP = 6, - ARTIFACT_EQUIP = 8, - ITEM_GIFT = 9, - ADD_TAGS = 12, - SYSTEM_DEBUG = 13, - BATTLE_OPTIONS = 98, - FLEET_MOVE = 99, + PROMOTION = 5, + EQUIP = 6, + ARTIFACT_EQUIP = 8, + ITEM_GIFT = 9, + ADD_TAGS = 12, + SYSTEM_DEBUG = 13, + BATTLE_OPTIONS = 98, + FLEET_MOVE = 99, } -function reset_popup_options(){ - with (obj_popup){ - options = []; - } +function reset_popup_options() { + with (obj_popup) { + options = []; + } } -function popup_defualt_click_action(){ - if (hide){ +function popup_defualt_click_action() { + if (hide) { exit; } - if (instances_exist_any([obj_fleet])){ + if (instances_exist_any([obj_fleet])) { exit; } - if (!instance_exists(obj_controller)){ + if (!instance_exists(obj_controller)) { exit; } - if (obj_controller.scrollbar_engaged){ + if (obj_controller.scrollbar_engaged) { exit; } - if (battle_special>0){ - alarm[0]=1; - cooldown=10; + if (battle_special > 0) { + alarm[0] = 1; + cooldown = 10; exit; } - if (type=POPUP_TYPE.BATTLE_OPTIONS){ - obj_controller.cooldown=10; - if (instance_exists(obj_turn_end)){ - obj_turn_end.current_battle+=1; - obj_turn_end.alarm[0]=1; + if (type == POPUP_TYPE.BATTLE_OPTIONS) { + obj_controller.cooldown = 10; + if (instance_exists(obj_turn_end)) { + obj_turn_end.current_battle += 1; + obj_turn_end.alarm[0] = 1; } - obj_controller.force_scroll=0; + obj_controller.force_scroll = 0; instance_destroy(); exit; } - if (!array_length(options) && type<5){ + if (!array_length(options) && type < 5) { popup_default_close(); } } -function popup_default_close(){ - obj_controller.cooldown=10; - if (instance_exists(obj_turn_end) && obj_controller.complex_event==false){ - if (number!=0){ - obj_turn_end.alarm[1]=4; +function popup_default_close() { + obj_controller.cooldown = 10; + if (instance_exists(obj_turn_end) && obj_controller.complex_event == false) { + if (number != 0) { + obj_turn_end.alarm[1] = 4; } } - if (struct_exists(pop_data,"marine_display_image")){ - pop_data.marine_display_image.destroy_image(); + if (struct_exists(pop_data, "marine_display_image")) { + pop_data.marine_display_image.destroy_image(); } instance_destroy(); exit; } -function popup_window_draw(){ - if ((size == 0) || (size == 2)) { - sprite_index = spr_popup_medium; - image_alpha = 0; - width = sprite_width - 50; - draw_sprite_ext(spr_popup_medium, type, ((1600 - sprite_width) / 2), ((900 - sprite_height) / 2), 1, y_scale, 0, c_white, 1); - if (image != "") { - image_wid = 100; - image_hei = 100; - } - } else if (size == 1) { - sprite_index = spr_popup_small; - image_alpha = 0; - width = sprite_width - 10; - draw_sprite_ext(spr_popup_small, type, ((1600 - sprite_width) / 2), ((900 - sprite_height) / 2), 1, y_scale, 0, c_white, 1); - if (image != "") { - image_wid = 150; - image_hei = 150; - } - } else if (size == 3) { - var draw_y_scale = y_scale; - sprite_index = spr_popup_large; - image_alpha = 0; - width = sprite_width - 50; - if (image == "debug") { - y_scale_mod = 1.5; - draw_y_scale = y_scale * y_scale_mod; - } - draw_sprite_ext(spr_popup_large, type, ((1600 - sprite_width) / 2), ((900 - sprite_height * y_scale_mod) / 2), 1, draw_y_scale, 0, c_white, 1); - if (image != "") { - image_wid = 200; - image_hei = 200; - } - } +function popup_window_draw() { + if ((size == 0) || (size == 2)) { + sprite_index = spr_popup_medium; + image_alpha = 0; + width = sprite_width - 50; + draw_sprite_ext(spr_popup_medium, type, ((1600 - sprite_width) / 2), ((900 - sprite_height) / 2), 1, y_scale, 0, c_white, 1); + if (image != "") { + image_wid = 100; + image_hei = 100; + } + } else if (size == 1) { + sprite_index = spr_popup_small; + image_alpha = 0; + width = sprite_width - 10; + draw_sprite_ext(spr_popup_small, type, ((1600 - sprite_width) / 2), ((900 - sprite_height) / 2), 1, y_scale, 0, c_white, 1); + if (image != "") { + image_wid = 150; + image_hei = 150; + } + } else if (size == 3) { + var draw_y_scale = y_scale; + sprite_index = spr_popup_large; + image_alpha = 0; + width = sprite_width - 50; + if (image == "debug") { + y_scale_mod = 1.5; + draw_y_scale = y_scale * y_scale_mod; + } + draw_sprite_ext(spr_popup_large, type, ((1600 - sprite_width) / 2), ((900 - sprite_height * y_scale_mod) / 2), 1, draw_y_scale, 0, c_white, 1); + if (image != "") { + image_wid = 200; + image_hei = 200; + } + } } function PopupOption(data) constructor { - move_data_to_current_scope(data); - if !(struct_exists(self,"choice_func")){ - choice_func = popup_default_close; - } + move_data_to_current_scope(data); + if (!struct_exists(self, "choice_func")) { + choice_func = popup_default_close; + } } -function add_option(option, if_empty = false,use_default_option = true){ - if (if_empty){ - if (array_length(options)){ +function add_option(option, if_empty = false, use_default_option = true) { + if (if_empty) { + if (array_length(options)) { return; } } - if (is_string(option)){ - option = {str1:option} + if (is_string(option)) { + option = { + str1: option, + }; } - if (is_array(option)){ - for (var i=0;i (oy + sprite_height)) { - y_scale = t8 / (oy + sprite_height); - } - } else { - if (scr_click_left()){ - popup_defualt_click_action(); - } - } - if (press > -1 && press < array_length(options)){ - if (!is_struct(options[press]) && options[press] == ""){ - press = -1; - } - } + sz += _string_height; + } + if (struct_exists(pop_data, "marine_display_triggered") && pop_data.marine_display_triggered) { + pop_data.marine_display_image.draw(1208, 210, true); + pop_data.marine_stat_display.stat_display(); + } + t8 = (y1 + 20 + sz) + 5; + if (t8 < (oy + sprite_height)) { + y_scale = t8 / (oy + sprite_height); + } + if (t8 > (oy + sprite_height)) { + y_scale = t8 / (oy + sprite_height); + } + } else { + if (scr_click_left()) { + popup_defualt_click_action(); + } + } + if (press > -1 && press < array_length(options)) { + if (!is_struct(options[press]) && options[press] == "") { + press = -1; + } + } } -function calculate_equipment_needs(){ - var i=0,rall="",all_good=0; - - req_armour=""; - req_armour_num=0; - have_armour_num=0; - req_gear=""; - req_gear_num=0; - have_gear_num=0; - req_mobi=""; - req_mobi_num=0; - have_mobi_num=0; - req_wep1=""; - req_wep1_num=0; - have_wep1_num=0; - req_wep2=""; - req_wep2_num=0; - have_wep2_num=0; - - rall=role_name[target_role]; +function calculate_equipment_needs() { + var i = 0, rall = "", all_good = 0; + + req_armour = ""; + req_armour_num = 0; + have_armour_num = 0; + req_gear = ""; + req_gear_num = 0; + have_gear_num = 0; + req_mobi = ""; + req_mobi_num = 0; + have_mobi_num = 0; + req_wep1 = ""; + req_wep1_num = 0; + have_wep1_num = 0; + req_wep2 = ""; + req_wep2_num = 0; + have_wep2_num = 0; + + rall = role_name[target_role]; /*if (rall=obj_ini.role[100][14]) and (global.chapter_name!="Space Wolves") and (global.chapter_name!="Iron Hands"){ req_armour="";req_armour_num=0;req_wep1="";req_wep1_num=0;req_wep2="";req_wep2_num=0;req_mobi="";req_mobi_num=0; }*/ - if (rall="Codiciery"){ - req_armour=""; - req_armour_num=0; - req_wep1=""; - req_wep1_num=0; - req_wep2=""; - req_wep2_num=0; - req_mobi=""; - req_mobi_num=0; - req_gear=obj_ini.gear[100,17]; - req_gear_num=units; - } else if (rall="Lexicanum"){ - req_armour=""; - req_armour_num=0; - req_wep1=""; - req_wep1_num=0; - req_wep2=""; - req_wep2_num=0; - req_mobi=""; - req_mobi_num=0; - } else if (rall=obj_ini.role[100][11]){ - req_armour=STR_ANY_POWER_ARMOUR; - req_armour_num=units; - req_wep2="Company Standard"; - req_wep2_num=units; + if (rall == "Codiciery") { + req_armour = ""; + req_armour_num = 0; + req_wep1 = ""; + req_wep1_num = 0; + req_wep2 = ""; + req_wep2_num = 0; + req_mobi = ""; + req_mobi_num = 0; + req_gear = obj_ini.gear[100][17]; + req_gear_num = units; + } else if (rall == "Lexicanum") { + req_armour = ""; + req_armour_num = 0; + req_wep1 = ""; + req_wep1_num = 0; + req_wep2 = ""; + req_wep2_num = 0; + req_mobi = ""; + req_mobi_num = 0; + } else if (rall == obj_ini.role[100][11]) { + req_armour = STR_ANY_POWER_ARMOUR; + req_armour_num = units; + req_wep2 = "Company Standard"; + req_wep2_num = units; } else { - for (var i=2;i<20;i++){ - if (obj_ini.role[100][i]==rall){ - req_armour=obj_ini.armour[100][i]; - req_armour_num=units;req_wep1=obj_ini.wep1[100][i]; - req_wep1_num=units; - req_wep2=obj_ini.wep2[100][i]; - req_wep2_num=units; - req_mobi=obj_ini.mobi[100][i]; - req_mobi_num=units; - req_gear=obj_ini.gear[100][i]; - req_gear_num=units; + for (var i = 2; i < 20; i++) { + if (obj_ini.role[100][i] == rall) { + req_armour = obj_ini.armour[100][i]; + req_armour_num = units; + req_wep1 = obj_ini.wep1[100][i]; + req_wep1_num = units; + req_wep2 = obj_ini.wep2[100][i]; + req_wep2_num = units; + req_mobi = obj_ini.mobi[100][i]; + req_mobi_num = units; + req_gear = obj_ini.gear[100][i]; + req_gear_num = units; break; } } } - if (rall=obj_ini.role[100][6]){ - req_armour="Dreadnought"; - req_armour_num=units; - req_wep1=obj_ini.wep1[100,6]; - req_wep1_num=units; - req_wep2=obj_ini.wep2[100,6]; - req_wep2_num=units; + if (rall == obj_ini.role[100][6]) { + req_armour = "Dreadnought"; + req_armour_num = units; + req_wep1 = obj_ini.wep1[100][6]; + req_wep1_num = units; + req_wep2 = obj_ini.wep2[100][6]; + req_wep2_num = units; } - if (rall=$"Venerable {obj_ini.role[100][6]}"){ - req_armour=""; - req_armour_num=0; - req_wep1=""; - req_wep1_num=0; - req_wep2=""; - req_wep2_num=0; + if (rall == $"Venerable {obj_ini.role[100][6]}") { + req_armour = ""; + req_armour_num = 0; + req_wep1 = ""; + req_wep1_num = 0; + req_wep2 = ""; + req_wep2_num = 0; } - var unit_armour; var unit_wep_one; - for (var i=0; i=min_exp){ + if ((obj_controller.man[i] != "") && obj_controller.man_sel[i] && obj_controller.ma_promote[i] && (obj_controller.ma_exp[i] >= min_exp)) { if (is_struct(unit_armour)) { if (req_armour == STR_ANY_POWER_ARMOUR) { if (array_contains(LIST_BASIC_POWER_ARMOUR, unit_armour.name)) { @@ -353,307 +347,258 @@ function calculate_equipment_needs(){ } } } - - if (obj_controller.ma_wep1[i]=req_wep1) or (obj_controller.ma_wep2[i]=req_wep1) then have_wep1_num+=1; - if (obj_controller.ma_wep2[i]=req_wep2) or (obj_controller.ma_wep1[i]=req_wep2) then have_wep2_num+=1; + if ((obj_controller.ma_wep1[i] == req_wep1) || (obj_controller.ma_wep2[i] == req_wep1)) { + have_wep1_num += 1; + } + if ((obj_controller.ma_wep2[i] == req_wep2) || (obj_controller.ma_wep1[i] == req_wep2)) { + have_wep2_num += 1; + } - if (obj_controller.ma_gear[i]=req_gear) then have_gear_num+=1; - if (obj_controller.ma_mobi[i]=req_mobi) then have_mobi_num+=1; + if (obj_controller.ma_gear[i] == req_gear) { + have_gear_num += 1; + } + if (obj_controller.ma_mobi[i] == req_mobi) { + have_mobi_num += 1; + } - if (req_wep1=="Heavy Ranged" && is_struct(unit_wep_one)){ - if (unit_wep_one.has_tag("heavy_ranged")) then have_wep1_num+=1; + if (req_wep1 == "Heavy Ranged" && is_struct(unit_wep_one)) { + if (unit_wep_one.has_tag("heavy_ranged")) { + have_wep1_num += 1; + } } } // if (n_wep1=n_wep2) and ((o_wep1!=n_wep1) or (o_wep2!=n_wep2)){have_wep1_num-=1;have_wep2_num-=1;} - - }// End Repeat + } // End Repeat // This checks to see if there is any more in the armoury - if (req_armour==STR_ANY_POWER_ARMOUR){ + if (req_armour == STR_ANY_POWER_ARMOUR) { var _armour_list = LIST_BASIC_POWER_ARMOUR; - for (i=0;i=req_armour_num) or (req_armour="")) and ((have_wep1_num>=req_wep1_num) or (req_wep1="")) and ((have_wep2_num>=req_wep2_num) or (req_wep2="")) then all_good=0.4; - if (req_gear="") or (req_gear_num<=have_gear_num) then all_good+=0.3; - if (req_mobi="") or (req_mobi_num<=have_mobi_num) then all_good+=0.3; + if (((have_armour_num >= req_armour_num) || (req_armour == "")) && ((have_wep1_num >= req_wep1_num) || (req_wep1 == "")) && ((have_wep2_num >= req_wep2_num) || (req_wep2 == ""))) { + all_good = 0.4; + } + if ((req_gear == "") || (req_gear_num <= have_gear_num)) { + all_good += 0.3; + } + if ((req_mobi == "") || (req_mobi_num <= have_mobi_num)) { + all_good += 0.3; + } return floor(all_good); - } +function default_popup_image_index() { + var _img = -1; + if (image == "") { + _img = -1; + } else if (image == "orks") { + _img = 0; + } else if (image == "tau") { + _img = 1; + } else if (image == "chaos") { + _img = 2; + } else if (image == "shadow") { + _img = 3; + } else if (image == "distinguished") { + _img = 4; + } else if (image == "tech_build") { + _img = 5; + } else if (image == "sororitas") { + _img = 6; + } else if (image == "angry") { + _img = 7; + } else if (image == "gene_bad") { + _img = 8; + } else if (image == "lost_warp") { + _img = 10; + } else if (image == "Warp") { + _img = 11; + } else if (image == "crusade") { + _img = 12; + } else if (image == "fuklaw") { + _img = 13; + } + if ((image == "artifact") || (image == "artifact2")) { + _img = 14; + } else if (image == "artifact_recovered") { + _img = 15; + } else if (image == "artifact_given") { + _img = 15; + } else if (image == "waaagh") { + _img = 16; + } else if (image == "shipyard") { + _img = 17; + } else if (image == "inquisition") { + _img = 18; + } else if (image == "succession") { + _img = 19; + } else if (image == "rogue_trader") { + _img = 20; + } else if (image == "necron_tomb") { + _img = 21; + } else if (image == "webber") { + _img = 22; + } else if (image == "spyrer") { + _img = 23; + } else if (image == "fortress") { + _img = 24; + } else if (image == "fortress_hive") { + _img = 25; + } else if (image == "fortress_death") { + _img = 26; + } else if (image == "fortress_ice") { + _img = 27; + } else if (image == "fortress_lava") { + _img = 28; + } else if (image == "fortress_dorf") { + _img = 29; + } else if (image == "exploding_ship") { + _img = 30; + } else if (image == "necron_cave") { + _img = 31; + } else if (image == "exterminatus_new") { + _img = 32; + } else if (image == "necron_tunnels_1") { + _img = 33; + } else if (image == "necron_tunnels_2") { + _img = 34; + } else if (image == "necron_tunnels_3") { + _img = 35; + } else if (image == "necron_army") { + _img = 36; + } else if (image == "harlequin") { + _img = 37; + } else if (image == "black_rage") { + _img = 39; + } else if (image == "exterminatus") { + _img = 40; + } else if (image == "stc") { + _img = 41; + } else if (image == "thallax") { + _img = 42; + } else if (image == "space_hulk_done") { + _img = 44; + } else if (image == "ancient_ruins") { + _img = 45; + } else if (image == "geneseed_lab") { + _img = 47; + } else if (image == "ruins_bunker") { + _img = 48; + } else if (image == "ruins_fort") { + _img = 49; + } else if (image == "ruins_ship") { + _img = 50; + } else if (image == "fallen") { + _img = 51; + } else if (image == "debug_banshee") { + _img = 52; + } else if (image == "mechanicus") { + _img = 53; + } else if (image == "chaos_cultist") { + _img = 54; + } else if (image == "chaos_symbol") { + _img = 55; + } else if (image == "chaos_messenger") { + _img = 56; + } else if (image == "event_feast") { + _img = 57; + } else if (image == "event_tournament") { + _img = 58; + } else if (image == "event_deathmatch") { + _img = 59; + } else if (image == "event_mass") { + _img = 60; + } else if (image == "event_ccult") { + _img = 61; + } else if (image == "event_crelic") { + _img = 62; + } else if (image == "event_march") { + _img = 63; + } - -function default_popup_image_index(){ - var _img = -1; - if (image == "") { - _img = -1; - } - else if (image == "orks") { - _img = 0; - } - else if (image == "tau") { - _img = 1; - } - else if (image == "chaos") { - _img = 2; - } - else if (image == "shadow") { - _img = 3; - } - else if (image == "distinguished") { - _img = 4; - } - else if (image == "tech_build") { - _img = 5; - } - else if (image == "sororitas") { - _img = 6; - } - else if (image == "angry") { - _img = 7; - } - else if (image == "gene_bad") { - _img = 8; - } - else if (image == "lost_warp") { - _img = 10; - } - else if (image == "Warp") { - _img = 11; - } - else if (image == "crusade") { - _img = 12; - } - else if (image == "fuklaw") { - _img = 13; - } - if ((image == "artifact") || (image == "artifact2")) { - _img = 14; - } - else if (image == "artifact_recovered") { - _img = 15; - } - else if (image == "artifact_given") { - _img = 15; - } - else if (image == "waaagh") { - _img = 16; - } - else if (image == "shipyard") { - _img = 17; - } - else if (image == "inquisition") { - _img = 18; - } - else if (image == "succession") { - _img = 19; - } - else if (image == "rogue_trader") { - _img = 20; - } - else if (image == "necron_tomb") { - _img = 21; - } - else if (image == "webber") { - _img = 22; - } - else if (image == "spyrer") { - _img = 23; - } - else if (image == "fortress") { - _img = 24; - } - else if (image == "fortress_hive") { - _img = 25; - } - else if (image == "fortress_death") { - _img = 26; - } - else if (image == "fortress_ice") { - _img = 27; - } - else if (image == "fortress_lava") { - _img = 28; - } - else if (image == "fortress_dorf") { - _img = 29; - } - else if (image == "exploding_ship") { - _img = 30; - } - else if (image == "necron_cave") { - _img = 31; - } - else if (image == "exterminatus_new") { - _img = 32; - } - else if (image == "necron_tunnels_1") { - _img = 33; - } - else if (image == "necron_tunnels_2") { - _img = 34; - } - else if (image == "necron_tunnels_3") { - _img = 35; - } - else if (image == "necron_army") { - _img = 36; - } - else if (image == "harlequin") { - _img = 37; - } - else if (image == "black_rage") { - _img = 39; - } - else if (image == "exterminatus") { - _img = 40; - } - else if (image == "stc") { - _img = 41; - } - else if (image == "thallax") { - _img = 42; - } - else if (image == "space_hulk_done") { - _img = 44; - } - else if (image == "ancient_ruins") { - _img = 45; - } - else if (image == "geneseed_lab") { - _img = 47; - } - else if (image == "ruins_bunker") { - _img = 48; - } - else if (image == "ruins_fort") { - _img = 49; - } - else if (image == "ruins_ship") { - _img = 50; - } - else if (image == "fallen") { - _img = 51; - } - else if (image == "debug_banshee") { - _img = 52; - } - else if (image == "mechanicus") { - _img = 53; - } - else if (image == "chaos_cultist") { - _img = 54; - } - else if (image == "chaos_symbol") { - _img = 55; - } - else if (image == "chaos_messenger") { - _img = 56; - } - else if (image == "event_feast") { - _img = 57; - } - else if (image == "event_tournament") { - _img = 58; - } - else if (image == "event_deathmatch") { - _img = 59; - } - else if (image == "event_mass") { - _img = 60; - } - else if (image == "event_ccult") { - _img = 61; - } - else if (image == "event_crelic") { - _img = 62; - } - else if (image == "event_march") { - _img = 63; - } - - return _img; + return _img; } +function allow_governor_successor() { + var randa = roll_dice_chapter(1, 100, "high"); + var randa2 = roll_dice(1, 100); + p_data.set_player_disposition(obj_controller.disposition[eFACTION.Imperium] + choose(-1, -2, -3, -4, 0, 1, 2, 3, 4)); -function allow_governor_successor(){ - var randa = roll_dice_chapter(1, 100, "high"); - var randa2 = roll_dice(1, 100); - p_data.set_player_disposition(obj_controller.disposition[eFACTION.Imperium] + choose(-1, -2, -3, -4, 0, 1, 2, 3, 4)); - - var _text_last = ""; - if (randa <= 3) { - var _newdisp = min(p_data.player_disposition, choose(1, 2, 3, 4, 5, 6) * 3); - p_data.set_player_disposition(_newdisp); - _text_last = "Regrettably he has a dim view of your chapter"; - } - if (randa >= 95) { - _newdisp = max(p_data.player_disposition, 60 + choose(1, 2, 3, 4, 5, 6) * 3); - p_data.set_player_disposition(_newdisp); - _text_last = "Fortunately you already have good relations with the new governor"; - } - - scr_event_log("", "Planetary Governor of {p_data.name()} assassinated. The next in line takes over.", new_target.name); - text = $"The next in line for rule of {p_data.name()} has taken over their rightful position of Planetary Governor. {_text_last}"; - reset_popup_options(); - with (obj_ground_mission) { - instance_destroy(); - } - exit; -} + var _text_last = ""; + if (randa <= 3) { + var _newdisp = min(p_data.player_disposition, choose(1, 2, 3, 4, 5, 6) * 3); + p_data.set_player_disposition(_newdisp); + _text_last = "Regrettably he has a dim view of your chapter"; + } + if (randa >= 95) { + _newdisp = max(p_data.player_disposition, 60 + choose(1, 2, 3, 4, 5, 6) * 3); + p_data.set_player_disposition(_newdisp); + _text_last = "Fortunately you already have good relations with the new governor"; + } + scr_event_log("", "Planetary Governor of {p_data.name()} assassinated. The next in line takes over.", new_target.name); + text = $"The next in line for rule of {p_data.name()} has taken over their rightful position of Planetary Governor. {_text_last}"; + reset_popup_options(); + with (obj_ground_mission) { + instance_destroy(); + } + exit; +} -function install_sympathetic_successor(){ - text = p_data.assasinate_governor(1, estimate); +function install_sympathetic_successor() { + text = p_data.assasinate_governor(1, estimate); - reset_popup_options(); - with (obj_ground_mission) { - instance_destroy(); - } - exit; + reset_popup_options(); + with (obj_ground_mission) { + instance_destroy(); + } + exit; } -function install_chapter_surf(){ - text = p_data.assasinate_governor(2, estimate); - reset_popup_options(); - with (obj_ground_mission) { - instance_destroy(); - } - exit; +function install_chapter_surf() { + text = p_data.assasinate_governor(2, estimate); + reset_popup_options(); + with (obj_ground_mission) { + instance_destroy(); + } + exit; } - - diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index 2d6b6cbd1c..04e5502f9c 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -690,10 +690,7 @@ function scr_random_event(execute_now) { } else if (chosen_event == eEVENT.chaos_invasion) { log_message("RE: Chaos Invasion"); - add_event({ - e_id: "chaos_invasion", - duration: 1, - }); + add_event({e_id: "chaos_invasion", duration: 1}); var psyker_intolerant = scr_has_disadv("Psyker Intolerant"); var has_chief_psyker = scr_role_count("Chief " + string(obj_ini.role[100][17]), "") >= 1; diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index 22544ecfdd..1aedb54e32 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -1,472 +1,465 @@ // Script assets have changed for v2.3.0 see // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information +function stars_with_help_requests() { + var _stars = []; -function stars_with_help_requests(){ - var _stars = []; - - with (obj_star){ - if (array_sum(p_halp)){ - array_push(_stars,id); - } - } + with (obj_star) { + if (array_sum(p_halp)) { + array_push(_stars, id); + } + } - return _stars; + return _stars; } -function scr_get_planet_with_feature(star, feature){ - for(var i = 1; i <= star.planets; i++){ - if (planet_feature_bool(star.p_feature[i], feature)){ - return i; - } - } - return -1; + +function scr_get_planet_with_feature(star, feature) { + for (var i = 1; i <= star.planets; i++) { + if (planet_feature_bool(star.p_feature[i], feature)) { + return i; + } + } + return -1; } /// takes details on on two planet populations if population 1 is bigger than population 2 returns true else returns false /// needs both the literal pop number and the boolean for if it is a large population or not -function population_larger(large_pop1,pop1,large_pop2,pop2){ - var _is_larger=false; +function population_larger(large_pop1, pop1, large_pop2, pop2) { + var _is_larger = false; - if (!large_pop2 && large_pop1 && floor(pop2/LARGE_PLANET_MOD)} stars -function scr_get_stars(shuffled=false, ownership=[], types = []) { - var stars = []; - var _owner_sort = array_length(ownership); - var _types_sort = array_length(types); - with(obj_star){ - if (!_owner_sort && !_types_sort){ - var _add = true; - } else { - var _add = true - if (_owner_sort && !array_contains(ownership,owner)){ - _add = false - } - if (_add && _types_sort){ - for (var i=1;i<=planets;i++){ - types = array_delete_value(types, p_type[i]); - if (!array_length(types)){ - break; - } - } - if (array_length(types)){ - _add = false; - } - } - } - if (_add){ - array_push(stars,id); - } - } - if (shuffled){ - stars = array_shuffle(stars); - } - return stars; -} - -function planet_imperium_ground_total(planet_check){ - return p_guardsmen[planet_check]+p_pdf[planet_check]+p_sisters[planet_check]+p_player[planet_check]; +function scr_get_stars(shuffled = false, ownership = [], types = []) { + var stars = []; + var _owner_sort = array_length(ownership); + var _types_sort = array_length(types); + with (obj_star) { + if (!_owner_sort && !_types_sort) { + var _add = true; + } else { + var _add = true; + if (_owner_sort && !array_contains(ownership, owner)) { + _add = false; + } + if (_add && _types_sort) { + for (var i = 1; i <= planets; i++) { + types = array_delete_value(types, p_type[i]); + if (!array_length(types)) { + break; + } + } + if (array_length(types)) { + _add = false; + } + } + } + if (_add) { + array_push(stars, id); + } + } + if (shuffled) { + stars = array_shuffle(stars); + } + return stars; +} + +function planet_imperium_ground_total(planet_check) { + return p_guardsmen[planet_check] + p_pdf[planet_check] + p_sisters[planet_check] + p_player[planet_check]; } /// @function star_by_name(search_name) -/// @description +/// @description /// Searches all `obj_star` instances and returns the one with a matching name. /// -/// @param {String} search_name +/// @param {String} search_name /// The name of the star to find. /// /// @returns {Instance | String} -/// Returns the `obj_star` instance that matches `search_name`, +/// Returns the `obj_star` instance that matches `search_name`, /// or the string `"none"` if no matching star is found. -function star_by_name(search_name){ - with(obj_star){ - if (name == search_name){ - return self; - } - } - return "none"; +function star_by_name(search_name) { + with (obj_star) { + if (name == search_name) { + return self; + } + } + return "none"; } //use this to quickly make a loop through a stars planets in an unordered way /// @function shuffled_planet_array() -/// @description +/// @description /// Returns an array of all planet indices in a random (unordered) order. /// -/// @returns {Array} +/// @returns {Array} /// A shuffled array containing all planet indices from 1 to `planets`. -function shuffled_planet_array(){ - var _planets = []; - for (var i=1;i<=planets;i++){ - array_push(_planets, i); - } - _planets = array_shuffle(_planets); - return _planets; - +function shuffled_planet_array() { + var _planets = []; + for (var i = 1; i <= planets; i++) { + array_push(_planets, i); + } + _planets = array_shuffle(_planets); + return _planets; } /// @function distance_removed_star(origional_x, origional_y, [star_offset=choose(2,3)], [disclude_hulk=true], [disclude_elder=true], [disclude_deads=true], [warp_concious=true]) -/// @description +/// @description /// Finds a star that is a certain distance away from the given coordinates, skipping over certain disallowed star types. /// -/// @param {Real} origional_x +/// @param {Real} origional_x /// The x-coordinate to start searching from. /// -/// @param {Real} origional_y +/// @param {Real} origional_y /// The y-coordinate to start searching from. /// -/// @param {Real} [star_offset=choose(2,3)] +/// @param {Real} [star_offset=choose(2,3)] /// The number of nearest stars to skip before returning a result. /// -/// @param {Boolean} [disclude_hulk=true] +/// @param {Boolean} [disclude_hulk=true] /// Placeholder flag to potentially exclude hulk-type stars (not yet used). /// -/// @param {Boolean} [disclude_elder=true] +/// @param {Boolean} [disclude_elder=true] /// If `true`, excludes stars owned by the `eFACTION.Eldar` faction. /// -/// @param {Boolean} [disclude_deads=true] +/// @param {Boolean} [disclude_deads=true] /// If `true`, excludes any stars detected as dead via `is_dead_star()`. /// -/// @param {Boolean} [warp_concious=true] +/// @param {Boolean} [warp_concious=true] /// Placeholder flag for future warp-lane aware selection logic (currently unused). /// -/// @returns {Instance} -/// Returns the `obj_star` instance found after skipping the specified number of nearby stars, +/// @returns {Instance} +/// Returns the `obj_star` instance found after skipping the specified number of nearby stars, /// ignoring any that are disqualified by the exclusion conditions. -function distance_removed_star(origional_x,origional_y, star_offset = choose(2,3), disclude_hulk=true, disclude_elder=true, disclude_deads=true, warp_concious=true){ - var from = instance_nearest(origional_x,origional_y,obj_star); - var _deactivated = []; - for(var i=0; i0) and (p_large[r])){ + with (obj_star) { + if (obj_star.id == doner_to) { + continue; + } + for (var r = 1; r <= planets; r++) { + if ((p_owner[r] == eFACTION.Imperium) && (p_type[r] == "Hive") && (p_population[r] > 0) && p_large[r]) { array_push(pop_doner_options, [id, r]); - }; - } - } - return pop_doner_options -} - -function planet_numeral_name(planet, star="none"){ - if (star=="none"){ - //show_debug_message($"{planet}, numeral name") - return $"{name} {int_to_roman(planet)}"; - } else { - with (star){ - //show_debug_message($"{planet}, numeral name") - return $"{name} {int_to_roman(planet)}"; - } - } -} - -function new_star_event_marker(colour){ - var bob=instance_create(x+16,y-24,obj_star_event); - bob.image_alpha=1; - bob.image_speed=1; - bob.color=colour; -} - -function nearest_from_array(xx,yy,list){ - var _nearest = 0; - var nearest_dist = point_distance(xx, yy ,list[_nearest].x, list[_nearest].y) - for (var i=1;i-30) and (dispo[i]<0){ - dispo[i]=min(obj_ini.imperium_disposition,obj_controller.disposition[eFACTION.Imperium])+irandom(8)-4; - } +function scr_faction_string_name(faction) { + name = ""; + switch (faction) { + case eFACTION.Imperium: + name = "Imperium"; + break; + case eFACTION.Mechanicus: + name = "Mechanicus"; + break; + case eFACTION.Inquisition: + name = "Inquisition"; + break; + case eFACTION.Ecclesiarchy: + name = "Ecclesiarchy"; + break; + case eFACTION.Eldar: + name = "Eldar"; + break; + case eFACTION.Tau: + name = "Tau"; + break; + } + return name; +} +function meet_system_governors(system) { + with (system) { + for (var i = 1; i <= planets; i++) { + if ((p_first[i] <= 5) && (dispo[i] > -30) && (dispo[i] < 0)) { + dispo[i] = min(obj_ini.imperium_disposition, obj_controller.disposition[eFACTION.Imperium]) + irandom(8) - 4; + } } - } + } } -function scr_planet_image_numbers(p_type){ - var image =0; - image_map = ["","Lava","Lava", "Desert","Forge","Hive","Death","Agri","Feudal","Temperate","Ice","Dead","Daemon","Craftworld","","Space Hulk", "", "Shrine"]; - for (var i=0;i= minimum_strength; - break; - case eFACTION.Tyranids: - found = star.p_tyranids[planet_id] >= minimum_strength; - break; - case eFACTION.Ork: - found = star.p_orks[planet_id] >= minimum_strength; - break; - case eFACTION.Chaos: - found = star.p_chaos[planet_id] >= minimum_strength; - break; - case eFACTION.Eldar: - found = star.p_eldar[planet_id] >= minimum_strength; - break; - case eFACTION.Genestealer: - found = star.p_tyranids[planet_id] >= minimum_strength; - break; - case eFACTION.Heretics: - found = star.p_traitors[planet_id] >= minimum_strength; - break; - case eFACTION.Necrons: - found = star.p_necrons[planet_id] >= minimum_strength; - break; - case "Demons": //special case for demon world mission - found = star.p_demons[planet_id] >= minimum_strength; - break; - } - return found; -} \ No newline at end of file +/// @param {Real} minimum_strength +function planet_has_forces(star, planet_id, faction, minimum_strength = 1) { + var found = false; + switch (faction) { + case eFACTION.Tau: + found = star.p_tau[planet_id] >= minimum_strength; + break; + case eFACTION.Tyranids: + found = star.p_tyranids[planet_id] >= minimum_strength; + break; + case eFACTION.Ork: + found = star.p_orks[planet_id] >= minimum_strength; + break; + case eFACTION.Chaos: + found = star.p_chaos[planet_id] >= minimum_strength; + break; + case eFACTION.Eldar: + found = star.p_eldar[planet_id] >= minimum_strength; + break; + case eFACTION.Genestealer: + found = star.p_tyranids[planet_id] >= minimum_strength; + break; + case eFACTION.Heretics: + found = star.p_traitors[planet_id] >= minimum_strength; + break; + case eFACTION.Necrons: + found = star.p_necrons[planet_id] >= minimum_strength; + break; + case "Demons": //special case for demon world mission + found = star.p_demons[planet_id] >= minimum_strength; + break; + } + return found; +} diff --git a/scripts/scr_trade/scr_trade.gml b/scripts/scr_trade/scr_trade.gml index ee505a5629..0a56721b1b 100644 --- a/scripts/scr_trade/scr_trade.gml +++ b/scripts/scr_trade/scr_trade.gml @@ -51,11 +51,7 @@ function TradeAttempt(diplomacy) constructor { } }; - clear_button = new UnitButtonObject({ - x1: 510, - y1: 649, - label: "Clear", - }); + clear_button = new UnitButtonObject({x1: 510, y1: 649, label: "Clear"}); clear_button.bind_method = clear_options; clear_button.bind_scope = self; @@ -270,9 +266,7 @@ function TradeAttempt(diplomacy) constructor { show_debug_message("trade_success"); if (_success) { successful_trade_attempt(); - scr_dialogue("agree", { - prepend: "[[Trade Accepted. Shipment initialized.]]", - }); + scr_dialogue("agree", {prepend: "[[Trade Accepted. Shipment initialized.]]"}); //force_goodbye=1; obj_controller.trading = 0; if ((diplomacy_faction == 6) || (diplomacy_faction == 7) || (diplomacy_faction == 8)) { @@ -291,9 +285,7 @@ function TradeAttempt(diplomacy) constructor { diplo_text = ""; } annoyed[_dip] += 1; - scr_dialogue("disagree", { - prepend: "[[Trade Refused]]", - }); + scr_dialogue("disagree", {prepend: "[[Trade Refused]]"}); rando = choose(1, 2, 3); if (_rela == "hostile") { force_goodbye = 1; @@ -331,11 +323,7 @@ function TradeAttempt(diplomacy) constructor { } }; - offer_button = new UnitButtonObject({ - x1: 630, - y1: 649, - label: "Offer", - }); + offer_button = new UnitButtonObject({x1: 630, y1: 649, label: "Offer"}); offer_button.bind_method = function() { if (obj_controller.diplo_last != " offer") { attempt_trade(); @@ -343,11 +331,7 @@ function TradeAttempt(diplomacy) constructor { }; offer_button.bind_scope = self; - exit_button = new UnitButtonObject({ - x1: 818, - y1: 796, - label: "Exit", - }); + exit_button = new UnitButtonObject({x1: 818, y1: 796, label: "Exit"}); exit_button.bind_method = function() { with (obj_controller) { @@ -368,15 +352,7 @@ function TradeAttempt(diplomacy) constructor { exit_button.bind_scope = self; static new_demand_buttons = function(trade_disp, name, trade_type, max_take = 100000) { - var _option = new UnitButtonObject({ - label: name, - number: 0, - disp: trade_disp, - trade_type: trade_type, - max_take: max_take, - number_last: 0, - diplomacy_faction, - }); + var _option = new UnitButtonObject({label: name, number: 0, disp: trade_disp, trade_type: trade_type, max_take: max_take, number_last: 0, diplomacy_faction}); with (_option) { bind_method = function() { if (max_take == 1) { @@ -443,15 +419,7 @@ function TradeAttempt(diplomacy) constructor { } static new_offer_option = function(trade_disp = -100, name, trade_type, max_count = 1) { - var _option = new UnitButtonObject({ - label: name, - number: 0, - max_number: max_count, - disp: trade_disp, - trade_type: trade_type, - number_last: 0, - diplomacy_faction, - }); + var _option = new UnitButtonObject({label: name, number: 0, max_number: max_count, disp: trade_disp, trade_type: trade_type, number_last: 0, diplomacy_faction}); with (_option) { bind_method = function() { if (max_number == 1) { diff --git a/scripts/scr_void_click/scr_void_click.gml b/scripts/scr_void_click/scr_void_click.gml index 95998950f3..f163c8b265 100644 --- a/scripts/scr_void_click/scr_void_click.gml +++ b/scripts/scr_void_click/scr_void_click.gml @@ -1,54 +1,83 @@ function scr_void_click() { + var good = true; - var good=true; + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0; - var xx=__view_get( e__VW.XView, 0 )+0; - var yy=__view_get( e__VW.YView, 0 )+0; - - var scale = obj_controller.scale_mod; - if (obj_controller.cooldown>0) return false; - if (obj_controller.menu!=0) return false; - if (!obj_controller.zoomed){ - if (mouse_y<__view_get( e__VW.YView, 0 )+(62*scale)) return false; - if (mouse_y>__view_get( e__VW.YView, 0 )+(830*scale)) return false; - } - - - - if (instance_exists(obj_fleet_select)){ - if (obj_fleet_select.currently_entered) then good=false; + var scale = obj_controller.scale_mod; + if (obj_controller.cooldown > 0) { + return false; + } + if (obj_controller.menu != 0) { + return false; + } + if (!obj_controller.zoomed) { + if (mouse_y < camera_get_view_y(view_camera[0]) + (62 * scale)) { + return false; + } + if (mouse_y > camera_get_view_y(view_camera[0]) + (830 * scale)) { + return false; + } } + if (instance_exists(obj_fleet_select)) { + if (obj_fleet_select.currently_entered) { + good = false; + } + } else if (instance_exists(obj_star_select)) { + if (obj_controller.selecting_planet > 0) { + // This prevents clicking onto a new star by pressing the buttons or planet panel + if (scr_hit(xx + (27 * scale), yy + (166 * scale), xx + (727 * scale), yy + (458 * scale))) { + if (obj_star_select.button1 != "") { + good = false; + } + } + if (scr_hit(xx + (348 * scale), yy + (461 * scale), xx + (348 * scale) + (246 * scale), yy + (461 * scale) + (26 * scale))) { + if (obj_star_select.button1 != "") { + good = false; + } + } + if (scr_hit(xx + (348 * scale), yy + (489 * scale), xx + (348 * scale) + (246 * scale), yy + (489 * scale) + (26 * scale))) { + if (obj_star_select.button2 != "") { + good = false; + } + } + if (scr_hit(xx + (348 * scale), yy + (517 * scale), xx + (348 * scale) + (246 * scale), yy + (517 * scale) + (26 * scale))) { + if (obj_star_select.button3 != "") { + good = false; + } + } + if (scr_hit(xx + (348 * scale), yy + (545 * scale), xx + (348 * scale) + (246 * scale), yy + (545 * scale) + (26 * scale))) { + if (obj_star_select.button4 != "") { + good = false; + } + } + } + } else { + if (obj_controller.helpful_places != false) { + if (!instances_exist_any([obj_turn_end, obj_ncombat, obj_fleet, obj_fleet_select, obj_popup, obj_star_select])) { + if (obj_controller.helpful_places.entered()) { + good = false; + } + } + } + } - else if (instance_exists(obj_star_select)){ - if (obj_controller.selecting_planet>0){// This prevents clicking onto a new star by pressing the buttons or planet panel - if (scr_hit(xx+(27*scale),yy+(166*scale),xx+(727*scale),yy+(458*scale))){if (obj_star_select.button1!="") then good=false;} - if (scr_hit(xx+(348*scale),yy+(461*scale),xx+(348*scale)+(246*scale),yy+(461*scale)+(26*scale))){if (obj_star_select.button1!="") then good=false;} - if (scr_hit(xx+(348*scale),yy+(489*scale),xx+(348*scale)+(246*scale),yy+(489*scale)+(26*scale))){if (obj_star_select.button2!="") then good=false;} - if (scr_hit(xx+(348*scale),yy+(517*scale),xx+(348*scale)+(246*scale),yy+(517*scale)+(26*scale))){if (obj_star_select.button3!="") then good=false;} - if (scr_hit(xx+(348*scale),yy+(545*scale),xx+(348*scale)+(246*scale),yy+(545*scale)+(26*scale))){if (obj_star_select.button4!="") then good=false;} - } - } else { - if (obj_controller.helpful_places!=false){ - if (!instances_exist_any([obj_turn_end,obj_ncombat,obj_fleet,obj_fleet_select,obj_popup,obj_star_select])){ - if (obj_controller.helpful_places.entered()){ - good=false; - } - } - } - } - - if (obj_controller.popup=3){// Prevent hitting through the planet select - if (scr_hit(xx+(27*scale),yy+(165*scale),xx+(347*scale),yy+(459*scale))=true) then good=false; - if (obj_controller.selecting_planet>0){ - if (scr_hit(xx+(27*scale),yy+(165*scale),xx+(728*scale),yy+(459*scale))=true) then good=false;// The area with the planetary info - } - } - - if (obj_controller.menu=60) and (scr_hit(xx+(27*scale),yy+(165*scale),xx+(651*scale),yy+(597*scale))) then good=false;// Build menu - - - return(good); + if (obj_controller.popup == 3) { + // Prevent hitting through the planet select + if (scr_hit(xx + (27 * scale), yy + (165 * scale), xx + (347 * scale), yy + (459 * scale)) == true) { + good = false; + } + if (obj_controller.selecting_planet > 0) { + if (scr_hit(xx + (27 * scale), yy + (165 * scale), xx + (728 * scale), yy + (459 * scale)) == true) { + good = false; + } // The area with the planetary info + } + } + if ((obj_controller.menu == 60) && scr_hit(xx + (27 * scale), yy + (165 * scale), xx + (651 * scale), yy + (597 * scale))) { + good = false; + } // Build menu + return good; } From 5e1acac29be91e55cf17df12397f39811adbfda7 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sun, 28 Dec 2025 11:31:53 -0500 Subject: [PATCH 39/45] And the Alpha lint. I'm slowly going through the compatibility functions inherited from gamemaker 1.0 and replacing them with engine calls instead of the accursed custom ones whatever converter was used way back in the DAOT. May the omnissiah bless this holy rite of cleansing. --- ChapterMaster.yyp | 1 - ...compatibility_report_040421_2234143414.txt | 841 ---------- objects/obj_bomb_select/Alarm_1.gml | 131 +- objects/obj_bomb_select/Alarm_4.gml | 68 +- objects/obj_bomb_select/Create_0.gml | 92 +- objects/obj_bomb_select/Draw_0.gml | 134 +- objects/obj_bomb_select/Mouse_56.gml | 26 +- objects/obj_controller/Create_0.gml | 4 +- objects/obj_controller/Mouse_50.gml | 8 +- objects/obj_controller/Step_0.gml | 4 +- objects/obj_drop_select/Alarm_1.gml | 1 - objects/obj_drop_select/Alarm_2.gml | 91 +- objects/obj_drop_select/Alarm_3.gml | 125 +- objects/obj_drop_select/Alarm_4.gml | 103 +- objects/obj_drop_select/Create_0.gml | 364 +++-- objects/obj_drop_select/Draw_64.gml | 222 +-- objects/obj_drop_select/Mouse_56.gml | 309 ++-- objects/obj_en_fleet/Draw_0.gml | 6 +- objects/obj_event/Alarm_0.gml | 130 +- objects/obj_event/Create_0.gml | 116 +- objects/obj_event/Draw_0.gml | 126 +- objects/obj_event/Step_0.gml | 730 +++++---- objects/obj_event_log/Draw_0.gml | 8 +- objects/obj_fleet/Mouse_56.gml | 2 +- objects/obj_fleet_controller/Draw_0.gml | 31 +- objects/obj_fleet_select/Create_0.gml | 384 ++--- objects/obj_fleet_select/Draw_0.gml | 302 ++-- objects/obj_fleet_select/Draw_64.gml | 104 +- objects/obj_fleet_select/Step_0.gml | 19 +- objects/obj_formation_bar/Create_0.gml | 38 +- objects/obj_formation_bar/Destroy_0.gml | 6 +- objects/obj_formation_bar/Draw_0.gml | 49 +- objects/obj_formation_bar/Mouse_0.gml | 21 +- objects/obj_formation_bar/Mouse_56.gml | 165 +- objects/obj_formation_bar/Step_0.gml | 32 +- objects/obj_img/Draw_0.gml | 2 +- objects/obj_ingame_menu/CleanUp_0.gml | 2 +- objects/obj_ingame_menu/Create_0.gml | 46 +- objects/obj_ingame_menu/Draw_0.gml | 270 ++-- objects/obj_ingame_menu/KeyPress_27.gml | 8 +- objects/obj_ingame_menu/Step_0.gml | 184 ++- objects/obj_mass_equip/Draw_0.gml | 25 +- objects/obj_mass_equip/Step_0.gml | 18 +- objects/obj_new_button/Create_0.gml | 22 +- objects/obj_new_button/Draw_0.gml | 89 +- objects/obj_new_button/Step_0.gml | 43 +- objects/obj_p_fleet/Alarm_1.gml | 236 +-- objects/obj_p_fleet/Alarm_11.gml | 9 +- objects/obj_p_fleet/Alarm_2.gml | 7 +- objects/obj_p_fleet/Alarm_3.gml | 82 +- objects/obj_p_fleet/Alarm_4.gml | 15 +- objects/obj_p_fleet/Alarm_5.gml | 69 +- objects/obj_p_fleet/Alarm_6.gml | 10 +- objects/obj_p_fleet/Alarm_7.gml | 39 +- objects/obj_p_fleet/Collision_obj_p_fleet.gml | 11 +- objects/obj_p_fleet/Create_0.gml | 102 +- objects/obj_p_fleet/Destroy_0.gml | 10 +- objects/obj_p_fleet/Draw_0.gml | 166 +- objects/obj_p_fleet/Mouse_50.gml | 56 +- objects/obj_p_fleet/Step_0.gml | 32 +- objects/obj_p_ship/Alarm_0.gml | 433 +++--- objects/obj_p_ship/Alarm_3.gml | 27 +- objects/obj_p_ship/Create_0.gml | 106 +- objects/obj_p_ship/Draw_0.gml | 125 +- objects/obj_p_ship/KeyPress_66.gml | 31 +- objects/obj_p_ship/Mouse_51.gml | 36 +- objects/obj_p_ship/Step_0.gml | 632 ++++---- objects/obj_popup/Draw_64.gml | 2 +- objects/obj_popup_dialogue/CleanUp_0.gml | 2 +- objects/obj_popup_dialogue/Create_0.gml | 29 +- objects/obj_popup_dialogue/Destroy_0.gml | 2 +- objects/obj_popup_dialogue/Draw_64.gml | 38 +- objects/obj_popup_dialogue/Step_0.gml | 15 +- objects/obj_saveload/Alarm_0.gml | 181 +-- objects/obj_saveload/Alarm_1.gml | 19 +- objects/obj_saveload/Alarm_2.gml | 2 +- objects/obj_saveload/Alarm_3.gml | 6 +- objects/obj_saveload/Create_0.gml | 93 +- objects/obj_saveload/Destroy_0.gml | 20 +- objects/obj_saveload/Draw_0.gml | 508 ++++--- objects/obj_saveload/KeyPress_1.gml | 5 +- objects/obj_saveload/Mouse_60.gml | 13 +- objects/obj_saveload/Mouse_61.gml | 13 +- objects/obj_saveload/Step_0.gml | 29 +- objects/obj_shop/Create_0.gml | 1276 +++++++++------- objects/obj_shop/Draw_0.gml | 322 ++-- objects/obj_shop/Mouse_50.gml | 51 +- objects/obj_shop/Step_0.gml | 27 +- objects/obj_star_select/Alarm_0.gml | 31 +- objects/obj_star_select/Alarm_1.gml | 77 +- objects/obj_star_select/Create_0.gml | 172 +-- objects/obj_star_select/Draw_64.gml | 586 ++++--- objects/obj_star_select/Mouse_50.gml | 422 +++--- objects/obj_star_select/Step_0.gml | 13 +- objects/obj_star_select/Step_2.gml | 10 +- objects/obj_turn_end/Draw_0.gml | 6 +- objects/obj_turn_end/Mouse_56.gml | 4 +- scripts/__view_get/__view_get.gml | 33 - scripts/__view_get/__view_get.yy | 13 - .../scr_company_struct/scr_company_struct.gml | 1060 ++++++------- scripts/scr_company_view/scr_company_view.gml | 542 ++++--- .../scr_controller_helpers.gml | 38 +- .../scr_diplomacy_helpers.gml | 35 +- .../scr_draw_armentarium.gml | 438 +++--- .../scr_draw_unit_image.gml | 106 +- .../scr_draw_unit_stat_data.gml | 15 +- .../scr_fleet_advisor/scr_fleet_advisor.gml | 110 +- scripts/scr_librarium/scr_librarium.gml | 210 +-- .../scr_map_and_warp_functions.gml | 607 ++++---- .../scr_planetary_feature.gml | 4 +- scripts/scr_recruit_data/scr_recruit_data.gml | 1154 +++++++------- scripts/scr_scrollbar/scr_scrollbar.gml | 362 ++--- scripts/scr_tooltip_draw/scr_tooltip_draw.gml | 42 +- scripts/scr_ui_advisors/scr_ui_advisors.gml | 12 +- scripts/scr_ui_diplomacy/scr_ui_diplomacy.gml | 89 +- .../scr_ui_formation_bars.gml | 65 +- scripts/scr_ui_manage/scr_ui_manage.gml | 238 +-- scripts/scr_ui_popup/scr_ui_popup.gml | 1350 ++++++++++------- scripts/scr_ui_settings/scr_ui_settings.gml | 84 +- 119 files changed, 9173 insertions(+), 9144 deletions(-) delete mode 100644 scripts/__view_get/__view_get.gml delete mode 100644 scripts/__view_get/__view_get.yy diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index 9ecdfbc284..dec939f27a 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -710,7 +710,6 @@ {"id":{"name":"__init_external","path":"scripts/__init_external/__init_external.yy",},}, {"id":{"name":"__init_global","path":"scripts/__init_global/__init_global.yy",},}, {"id":{"name":"__init_view","path":"scripts/__init_view/__init_view.yy",},}, - {"id":{"name":"__view_get","path":"scripts/__view_get/__view_get.yy",},}, {"id":{"name":"action_another_room","path":"scripts/action_another_room/action_another_room.yy",},}, {"id":{"name":"action_color","path":"scripts/action_color/action_color.yy",},}, {"id":{"name":"action_draw_ellipse","path":"scripts/action_draw_ellipse/action_draw_ellipse.yy",},}, diff --git a/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt b/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt index 3e85e746fc..e4a9a84b0a 100644 --- a/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt +++ b/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt @@ -51,20 +51,6 @@ Converted string - line 370: "\images\ui\defeat" -> "\\images\\ui\\defeat" Converted string - line 376: "\images\creation\slate" -> "\\images\\creation\\slate" Converted string - line 377: "\images\creation\slate" -> "\\images\\creation\\slate" -Converting GML script: ${project_dir}\scripts\scr_void_click\scr_void_click.gml -Converted builtin - line 3: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 12: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 13: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 15: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 16: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 3: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 6: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 7: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 12: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 13: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 15: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 16: view_yview[0] -> __view_get( e__VW.YView, 0 ) - Converting GML script: ${project_dir}\scripts\scr_display_number\scr_display_number.gml Converted string - line 3: '' -> "" Converted string - line 6: ',' -> "," @@ -147,20 +133,6 @@ Error: variable 'message' has same name as a built-in (function, constant or var Converting GML script: ${project_dir}\scripts\scr_powers\scr_powers.gml Error: variable 'message' has same name as a built-in (function, constant or variable), it must be renamed to function correctly -Converting GML script: ${project_dir}\scripts\scr_scrollbar\scr_scrollbar.gml -Converted builtin - line 28: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 29: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\scripts\scr_ui_manage\scr_ui_manage.gml -Converted builtin - line 9: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 925: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 1205: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 1285: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 10: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 925: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 1206: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 1285: view_yview[0] -> __view_get( e__VW.YView, 0 ) - Converting GML script: ${project_dir}\scripts\scr_company_view\scr_company_view.gml ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\scripts\scr_company_view\scr_company_view.gml - 115: unexpected syntax error ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\scripts\scr_company_view\scr_company_view.gml - 115: unexpected terminal operator new @@ -333,130 +305,6 @@ Too many errors - GML not processed : ${project_dir}\scripts\scr_special_view\sc Converting GML script: ${project_dir}\scripts\scr_ui_advisors\scr_ui_advisors.gml Error: variable 'method' has same name as a built-in (function, constant or variable), it must be renamed to function correctly -Converted builtin - line 3: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 4: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\scripts\scr_ui_diplomacy\scr_ui_diplomacy.gml -Converted builtin - line 2: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 414: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 527: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 3: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 414: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 527: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 631: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\scripts\scr_ui_popup\scr_ui_popup.gml -Converted builtin - line 7: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 330: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 330: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 331: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 331: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 334: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 334: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 335: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 335: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 358: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 359: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 360: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 367: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 367: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 371: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 371: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 379: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 380: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 384: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 390: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 390: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 394: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 394: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 402: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 403: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 407: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 413: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 413: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 417: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 417: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 425: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 426: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 430: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 441: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 445: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 445: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 451: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 452: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 455: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 455: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 457: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 458: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 461: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 461: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 491: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 634: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 634: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 650: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 650: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 652: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 652: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 655: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 656: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 7: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 330: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 330: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 331: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 331: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 334: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 334: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 335: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 335: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 358: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 359: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 360: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 367: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 367: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 371: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 371: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 379: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 380: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 384: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 390: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 390: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 394: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 394: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 402: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 403: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 407: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 413: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 413: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 417: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 417: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 425: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 426: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 430: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 441: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 445: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 445: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 451: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 452: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 455: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 455: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 457: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 458: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 461: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 461: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 492: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 634: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 634: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 650: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 650: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 652: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 652: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 655: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 656: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\scripts\scr_ui_formation_bars\scr_ui_formation_bars.gml -Converted builtin - line 5: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 5: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 155: view_yview[0] -> __view_get( e__VW.YView, 0 ) Converting GML script: ${project_dir}\scripts\scr_ui_settings\scr_ui_settings.gml ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\scripts\scr_ui_settings\scr_ui_settings.gml - 448: unexpected syntax error @@ -543,100 +391,6 @@ GameMaker Studio 1 font texture has been backed up at ${project_dir}\fonts\fnt_s Font fnt_legal has been converted to font family Courier New (Regular) GameMaker Studio 1 font texture has been backed up at ${project_dir}\fonts\fnt_legal\fnt_legal.gms1.png Converting GML script: ${project_dir}\objects\obj_fleet\Mouse_56.gml -Converted builtin - line 27: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 27: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 27: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 27: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_fleet\Draw_0.gml -Converted builtin - line 16: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 16: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 18: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 18: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 19: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 32: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 40: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 40: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 42: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 42: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 52: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 53: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 54: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 119: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 119: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 127: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 128: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 130: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 133: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 134: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 136: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 139: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 140: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 141: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 145: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 146: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 147: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 155: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 156: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 157: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 159: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 160: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 162: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 165: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 16: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 16: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 18: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 18: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 19: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 32: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 40: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 40: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 42: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 42: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 52: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 53: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 54: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 119: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 119: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 127: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 128: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 130: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 133: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 134: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 136: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 139: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 140: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 141: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 145: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 146: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 147: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 155: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 156: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 157: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 159: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 160: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 162: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 165: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_fleet_controller\Draw_0.gml -Converted builtin - line 12: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 13: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 15: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 16: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 18: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 19: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 12: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 13: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 15: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 16: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 18: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 19: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_p_ship\Mouse_51.gml -Converted builtin - line 6: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 6: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 6: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 6: view_yview[0] -> __view_get( e__VW.YView, 0 ) Converting GML script: ${project_dir}\objects\obj_ncombat\Create_0.gml Error: variable 'message' has same name as a built-in (function, constant or variable), it must be renamed to function correctly @@ -659,54 +413,6 @@ Too many errors - GML not processed : ${project_dir}\objects\obj_temp_build\Crea Converting GML script: ${project_dir}\objects\obj_credits\Draw_0.gml Converted string - line 63: '_blank' -> "_blank" -Converting GML script: ${project_dir}\objects\obj_new_button\Step_0.gml -Converted builtin - line 8: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 18: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 40: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 40: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 41: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 42: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 52: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 52: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 53: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 54: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 64: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 64: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 65: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 66: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 8: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 19: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 39: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 39: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 43: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 51: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 51: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 55: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 63: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 63: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 67: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_new_button\Draw_0.gml -Converted builtin - line 6: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 6: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_managment_panel\Mouse_50.gml -Converted builtin - line 4: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 5: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_managment_panel\Draw_0.gml -Converted builtin - line 3: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 4: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_formation_bar\Step_0.gml -Converted builtin - line 32: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_formation_bar\Mouse_56.gml -Converted builtin - line 20: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 20: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 56: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 56: view_yview[0] -> __view_get( e__VW.YView, 0 ) - Converting GML script: ${project_dir}\objects\obj_cuicons\Destroy_0.gml Converted string - line 7: "\icons\custom" -> "\\icons\\custom" @@ -724,352 +430,9 @@ Converted string - line 33: "\icons\custom" -> "\\icons\\custom" Converting GML script: ${project_dir}\objects\obj_cuicons\Alarm_0.gml Converted string - line 6: "\icons\custom" -> "\\icons\\custom" -Converting GML script: ${project_dir}\objects\obj_img\Draw_0.gml -Converted builtin - line 3: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 3: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_ingame_menu\Create_0.gml -Converted builtin - line 22: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 22: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_ingame_menu\Step_0.gml -Converted builtin - line 6: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 7: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_ingame_menu\Draw_0.gml -Converted builtin - line 6: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 144: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 7: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 145: view_yview[0] -> __view_get( e__VW.YView, 0 ) - Converting GML script: ${project_dir}\objects\obj_controller\Alarm_1.gml Converted builtin - line 268: instance_id -> instance_id_get( 0 ) -Converting GML script: ${project_dir}\objects\obj_controller\Step_0.gml -Converted builtin - line 144: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 145: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 215: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 215: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 216: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 217: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 225: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 225: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 226: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 227: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 237: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 237: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 238: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 239: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 247: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 247: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 248: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 249: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 258: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 258: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 259: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 260: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 268: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 268: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 269: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 270: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 278: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 278: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 279: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 280: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 290: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 290: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 291: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 292: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 300: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 300: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 301: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 302: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 310: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 310: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 311: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 312: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 320: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 320: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 321: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 322: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 330: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 330: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 331: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 332: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 340: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 340: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 341: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 342: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 410: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 146: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 147: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 214: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 214: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 218: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 224: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 224: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 228: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 236: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 236: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 240: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 246: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 246: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 250: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 257: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 257: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 261: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 267: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 267: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 271: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 277: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 277: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 281: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 289: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 289: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 293: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 299: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 299: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 303: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 309: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 309: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 313: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 319: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 319: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 323: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 329: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 329: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 333: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 339: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 339: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 343: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 411: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_controller\Mouse_50.gml -Converted builtin - line 3: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 944: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 981: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 982: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 1312: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 4: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 526: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 542: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 931: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 944: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 981: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 982: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 1312: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 1335: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 1411: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 1515: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_controller\Draw_0.gml -Converted builtin - line 26: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 29: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 30: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 32: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 33: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 35: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 36: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 37: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 38: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 39: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 40: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 42: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 43: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 44: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 49: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 50: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 52: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 53: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 54: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 55: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 56: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 58: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 59: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 60: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 61: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 62: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 63: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 78: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 79: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 83: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 85: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 86: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 87: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 88: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 89: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 90: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 91: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 92: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 93: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 94: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 100: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 100: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 103: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 103: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 107: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 107: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 110: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 110: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 114: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 114: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 117: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 117: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 120: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 120: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 123: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 123: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 126: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 126: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 129: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 129: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 133: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 133: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 136: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 136: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 139: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 139: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 143: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 144: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 150: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 164: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 167: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 175: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 176: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 182: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 183: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 189: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 190: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 197: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 198: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 204: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 205: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 210: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 217: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 218: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 219: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 221: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 222: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 223: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 225: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 226: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 227: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 229: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 230: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 231: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 248: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 26: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 29: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 30: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 32: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 33: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 35: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 36: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 37: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 38: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 39: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 40: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 42: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 43: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 44: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 49: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 50: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 52: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 53: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 54: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 55: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 56: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 58: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 59: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 60: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 61: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 62: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 63: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 78: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 79: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 83: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 85: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 86: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 87: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 88: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 89: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 90: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 91: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 92: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 93: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 94: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 100: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 100: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 103: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 103: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 107: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 107: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 110: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 110: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 114: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 114: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 117: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 117: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 120: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 120: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 123: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 123: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 126: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 126: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 129: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 129: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 133: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 133: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 136: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 136: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 139: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 139: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 143: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 144: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 150: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 164: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 167: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 175: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 176: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 182: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 183: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 189: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 190: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 197: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 198: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 204: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 205: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 210: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 217: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 218: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 219: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 221: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 222: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 223: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 225: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 226: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 227: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 229: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 230: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 231: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 248: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_mass_equip\Draw_0.gml -Converted builtin - line 3: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 4: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_turn_end\Mouse_56.gml -Converted builtin - line 20: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 21: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_turn_end\Draw_0.gml -Converted builtin - line 13: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 19: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 312: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 13: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 20: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 312: view_yview[0] -> __view_get( e__VW.YView, 0 ) - Converting GML script: ${project_dir}\objects\obj_saveload\Create_0.gml Converted string - line 99: "\screen" -> "\\screen" Converted string - line 99: "\screen" -> "\\screen" @@ -1110,30 +473,6 @@ Converted string - line 11: "\screen" -> "\\screen" Converted string - line 12: "\screen" -> "\\screen" Converted string - line 12: "\screen" -> "\\screen" -Converting GML script: ${project_dir}\objects\obj_saveload\Draw_0.gml -Converted builtin - line 7: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 89: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 7: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 89: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_p_fleet\Mouse_50.gml -Converted builtin - line 21: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 22: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_p_fleet\Draw_0.gml -Converted builtin - line 20: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 20: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 23: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 23: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 26: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 26: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 20: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 20: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 23: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 23: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 26: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 26: view_yview[0] -> __view_get( e__VW.YView, 0 ) - Converting GML script: ${project_dir}\objects\obj_en_fleet\Alarm_4.gml Removing instance reference from builtin - line 7 : self. Converted builtin - line 7: instance_id -> instance_id_get( 0 ) @@ -1209,191 +548,14 @@ ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\Chap ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\objects\obj_en_fleet\Alarm_1.gml - 2231: unexpected syntax error Too many errors - GML not processed : ${project_dir}\objects\obj_en_fleet\Alarm_1.gml -Converting GML script: ${project_dir}\objects\obj_en_fleet\Draw_0.gml -Converted builtin - line 38: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 38: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 41: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 41: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 44: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 44: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 38: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 38: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 41: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 41: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 44: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 44: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_fleet_select\Mouse_51.gml -Converted builtin - line 16: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 17: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 19: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 20: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 16: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 17: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 19: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 20: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_fleet_select\Draw_0.gml -Converted builtin - line 41: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 42: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 44: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 45: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 41: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 42: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 44: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 45: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_star_select\Step_0.gml -Converted builtin - line 107: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 108: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_star_select\Mouse_50.gml -Converted builtin - line 19: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 31: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 32: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 34: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 35: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 174: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 174: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 180: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 180: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 186: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 186: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 192: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 192: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 20: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 31: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 32: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 34: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 35: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 174: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 174: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 180: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 180: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 186: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 186: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 192: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 192: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_star_select\Draw_0.gml -Converted builtin - line 21: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 379: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 386: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 21: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 380: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 387: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_drop_select\Mouse_56.gml -Converted builtin - line 10: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 11: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_drop_select\Draw_0.gml -Converted builtin - line 14: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 535: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 628: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 15: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 536: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 628: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_bomb_select\Mouse_56.gml -Converted builtin - line 6: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 7: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_bomb_select\Draw_0.gml -Converted builtin - line 3: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 4: view_yview[0] -> __view_get( e__VW.YView, 0 ) - Converting GML script: ${project_dir}\objects\obj_popup\Step_0.gml Converted string - line 8: '1' -> "1" Converted string - line 9: '2' -> "2" Converted string - line 10: '3' -> "3" -Converting GML script: ${project_dir}\objects\obj_popup\Mouse_50.gml -Converted builtin - line 40: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 52: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 77: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 383: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 520: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 1439: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 1585: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 1624: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 40: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 52: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 77: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 384: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 521: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 1439: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 1585: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 1624: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_popup\Draw_0.gml -Converted builtin - line 5: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 16: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 318: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 364: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 457: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 505: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 6: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 16: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 318: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 364: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 458: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 506: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_popup_dialogue\Step_0.gml -Converted builtin - line 12: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 13: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_popup_dialogue\Draw_0.gml -Converted builtin - line 3: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 4: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_event\Draw_0.gml -Converted builtin - line 3: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 25: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 75: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 78: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 78: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 78: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 79: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 79: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 80: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 4: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 25: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 75: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 78: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 78: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 78: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 79: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 79: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 80: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_event_log\Draw_0.gml -Converted builtin - line 15: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 67: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 16: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 68: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_shop\Step_0.gml -Converted builtin - line 7: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 8: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_shop\Mouse_50.gml -Converted builtin - line 4: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 5: view_yview[0] -> __view_get( e__VW.YView, 0 ) - -Converting GML script: ${project_dir}\objects\obj_shop\Draw_0.gml -Converted builtin - line 3: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 36: view_xview[0] -> __view_get( e__VW.XView, 0 ) -Converted builtin - line 4: view_yview[0] -> __view_get( e__VW.YView, 0 ) - Converting GML script: ${project_dir}\objects\obj_star\Alarm_4.gml Converted builtin - line 33: instance_id -> instance_id_get( 0 ) -Converting GML script: ${project_dir}\objects\obj_star\Mouse_50.gml -Converted builtin - line 17: view_yview[0] -> __view_get( e__VW.YView, 0 ) -Converted builtin - line 18: view_yview[0] -> __view_get( e__VW.YView, 0 ) - Windows NSIS Installer Script has been set to default due to changes in GameMaker Studio 2 Missing audiogroup for sound: 'snd_blood' - setting to default audio group Missing audiogroup for sound: 'snd_diboz' - setting to default audio group @@ -1426,9 +588,6 @@ Added compatibility script 'd3d/d3d_set_fog.gml' Added compatibility script 'draw/draw_set_blend_mode.gml' Added compatibility script 'instance/instance_create.gml' Added compatibility script 'object/object_get_depth.gml' -Added compatibility script 'view/__view_get.gml' -Added compatibility script 'view/__view_set.gml' -Added compatibility script 'view/__view_set_internal.gml' Added compatibility script 'action/__init_action.gml' Added compatibility script 'd3d/__init_d3d.gml' Added compatibility script 'view/__init_view.gml' diff --git a/objects/obj_bomb_select/Alarm_1.gml b/objects/obj_bomb_select/Alarm_1.gml index b3d421e8ce..9e092cb908 100644 --- a/objects/obj_bomb_select/Alarm_1.gml +++ b/objects/obj_bomb_select/Alarm_1.gml @@ -1,9 +1,9 @@ // Sets which target is in planet and its strenght -ship=[]; -ship_all=[]; -ship_use=[]; -ship_max=[]; -ship_ide=[]; +ship = []; +ship_all = []; +ship_use = []; +ship_max = []; +ship_ide = []; var _ships = fleet_full_ship_array(sh_target); max_ships = array_length(_ships); @@ -12,8 +12,8 @@ var _total_fleet_loaded = calculate_fleet_content_size(_ships); bomb_b = _total_fleet_loaded; bomb_c = _total_fleet_loaded; -for (var i=0;i 0){ +for (var i = 0; i < array_length(_ships); i++) { + if (ship_bombard_score(_ships[i]) > 0) { array_push(ship_ide, _ships[i]); array_push(ship_max, obj_ini.ship_carrying[_ships[i]]); array_push(ship, obj_ini.ship[_ships[i]]); @@ -23,20 +23,20 @@ for (var i=0;i0){ - imp=p_data.guard_score_calc(); +var onceh = 0; +if (p_data.guardsmen > 0) { + imp = p_data.guard_score_calc(); } -var _pdf_count=p_data.pdf; +var _pdf_count = p_data.pdf; if (_pdf_count >= 50000000) { pdf = 6; } else if (_pdf_count >= 15000000) { @@ -49,12 +49,11 @@ if (_pdf_count >= 50000000) { pdf = 2; } else if (_pdf_count >= 2000) { pdf = 1; -} - +} -onceh=0; -pdf=p_target.p_pdf[obj_controller.selecting_planet]; -if (onceh = 0) { +onceh = 0; +pdf = p_target.p_pdf[obj_controller.selecting_planet]; +if (onceh == 0) { if (pdf >= 50000000) { pdf = 6; } else if (pdf >= 15000000) { @@ -71,21 +70,39 @@ if (onceh = 0) { onceh = 1; } -sisters=p_target.p_sisters[obj_controller.selecting_planet]; -mechanicus=0; +sisters = p_target.p_sisters[obj_controller.selecting_planet]; +mechanicus = 0; -targets=0; -if (ork>0) then targets+=1; -if (tau>0) then targets+=1; -if (chaos>0) then targets+=1; -if (tyranids>0) then targets+=1; -if (traitors>0) then targets+=1; -if (necrons>0) then targets+=1; -if (imp>0) then targets+=1; -if (pdf>0) then targets+=1; -if (sisters>0) then targets+=1; +targets = 0; +if (ork > 0) { + targets += 1; +} +if (tau > 0) { + targets += 1; +} +if (chaos > 0) { + targets += 1; +} +if (tyranids > 0) { + targets += 1; +} +if (traitors > 0) { + targets += 1; +} +if (necrons > 0) { + targets += 1; +} +if (imp > 0) { + targets += 1; +} +if (pdf > 0) { + targets += 1; +} +if (sisters > 0) { + targets += 1; +} -// Defines which target will appear based on the strenght of the forces there +// Defines which target will appear based on the strenght of the forces there // TODO in the future we could have multiple forces on a planet after we refactor into each planet using a hex grid system /* TODO could we place all forces in a list(or dictionary) e.g [elder,chaos, traitors, ork, tau, tyranids] or @@ -94,15 +111,33 @@ if (sisters>0) then targets+=1; and use a sort loop to find the largest otherwise and choose target? Optional but makes more sense IMO */ -target=2; -if (eldar>chaos) and (eldar>traitors) and (eldar>ork) and (eldar>tau) and (eldar>tyranids) and (eldar>necrons) then target=6; -if (ork>chaos) and (ork>traitors) and (ork>eldar) and (ork>tau) and (ork>tyranids) and (ork>necrons) then target=7; -if (tau>chaos) and (tau>traitors) and (tau>eldar) and (tau>ork) and (tau>tyranids) and (tau>necrons) then target=8; -if (tyranids>chaos) and (tyranids>traitors) and (tyranids>ork) and (tyranids>tau) and (tyranids>eldar) and (tyranids>necrons) then target=9; -if (chaos>ork) and (chaos>=traitors) and (chaos>eldar) and (chaos>tau) and (chaos>tyranids) and (chaos>necrons) then target=10; -if (traitors>ork) and (traitors>=chaos) and (traitors>eldar) and (traitors>tau) and (traitors>tyranids) and (traitors>necrons) then target=10; -if (necrons>ork) and (necrons>=chaos) and (necrons>eldar) and (necrons>tau) and (necrons>tyranids) and (necrons>traitors) then target=13; -if (p_target.p_owner[obj_controller.selecting_planet]=8){ - if (pdf>chaos) and (pdf>traitors) and (pdf>eldar) and (pdf>ork) and (pdf>tyranids) and (pdf>tau) and (pdf>necrons) then target=2.5; -} -if (p_target.craftworld=1) then target=6; +target = 2; +if ((eldar > chaos) && (eldar > traitors) && (eldar > ork) && (eldar > tau) && (eldar > tyranids) && (eldar > necrons)) { + target = 6; +} +if ((ork > chaos) && (ork > traitors) && (ork > eldar) && (ork > tau) && (ork > tyranids) && (ork > necrons)) { + target = 7; +} +if ((tau > chaos) && (tau > traitors) && (tau > eldar) && (tau > ork) && (tau > tyranids) && (tau > necrons)) { + target = 8; +} +if ((tyranids > chaos) && (tyranids > traitors) && (tyranids > ork) && (tyranids > tau) && (tyranids > eldar) && (tyranids > necrons)) { + target = 9; +} +if ((chaos > ork) && (chaos >= traitors) && (chaos > eldar) && (chaos > tau) && (chaos > tyranids) && (chaos > necrons)) { + target = 10; +} +if ((traitors > ork) && (traitors >= chaos) && (traitors > eldar) && (traitors > tau) && (traitors > tyranids) && (traitors > necrons)) { + target = 10; +} +if ((necrons > ork) && (necrons >= chaos) && (necrons > eldar) && (necrons > tau) && (necrons > tyranids) && (necrons > traitors)) { + target = 13; +} +if (p_target.p_owner[obj_controller.selecting_planet] == 8) { + if ((pdf > chaos) && (pdf > traitors) && (pdf > eldar) && (pdf > ork) && (pdf > tyranids) && (pdf > tau) && (pdf > necrons)) { + target = 2.5; + } +} +if (p_target.craftworld == 1) { + target = 6; +} diff --git a/objects/obj_bomb_select/Alarm_4.gml b/objects/obj_bomb_select/Alarm_4.gml index a047d8f63d..d46a814523 100644 --- a/objects/obj_bomb_select/Alarm_4.gml +++ b/objects/obj_bomb_select/Alarm_4.gml @@ -1,42 +1,44 @@ // Sets the targets for the ships, handles bombardment -for(var i=0; i<31; i++){ - ship[i]=""; - ship_all[i]=0; - ship_use[i]=0; - ship_max[i]=0; - ship_ide[i]=-1; +for (var i = 0; i < 31; i++) { + ship[i] = ""; + ship_all[i] = 0; + ship_use[i] = 0; + ship_max[i] = 0; + ship_ide[i] = -1; } -max_ships=sh_target.capital_number+sh_target.frigate_number+sh_target.escort_number; +max_ships = sh_target.capital_number + sh_target.frigate_number + sh_target.escort_number; -var tump=0; +var tump = 0; -var i=-1; -for(var b=0; b20) then instance_deactivate_object(id); +with (obj_fleet) { + if (point_distance(x, y, _select_x, _select_y) > 20) { + instance_deactivate_object(id); + } } -var bib=instance_nearest(_select_x,_select_y,obj_en_fleet); -if (instance_exists(bib)){ - if (point_distance(_select_x,_select_y,bib.x,bib.y)<=35){ - - scr_popup("Cannot Bombard","Enemy fleets are preventing bombardment!","",""); - +var bib = instance_nearest(_select_x, _select_y, obj_en_fleet); +if (instance_exists(bib)) { + if (point_distance(_select_x, _select_y, bib.x, bib.y) <= 35) { + scr_popup("Cannot Bombard", "Enemy fleets are preventing bombardment!", "", ""); + instance_activate_object(obj_en_fleet); instance_destroy(); exit; @@ -60,7 +62,7 @@ if (instance_exists(bib)){ } instance_activate_object(obj_en_fleet); -alarm[1]=1; +alarm[1] = 1; bomb_window = {}; -ship_buttons = []; \ No newline at end of file +ship_buttons = []; diff --git a/objects/obj_bomb_select/Draw_0.gml b/objects/obj_bomb_select/Draw_0.gml index 5c96a594ef..5c12682326 100644 --- a/objects/obj_bomb_select/Draw_0.gml +++ b/objects/obj_bomb_select/Draw_0.gml @@ -1,8 +1,7 @@ -xx = __view_get( e__VW.XView, 0 ); -yy = __view_get( e__VW.YView, 0 ); -ww = __view_get( e__VW.WView, 0 ); -hh = __view_get( e__VW.HView, 0 ); - +xx = camera_get_view_x(view_camera[0]); +yy = camera_get_view_y(view_camera[0]); +ww = camera_get_view_width(view_camera[0]); +hh = camera_get_view_height(view_camera[0]); // Sets the bombard target, its forces and draws the ships wich will bombard said target bomb_window = { @@ -14,45 +13,42 @@ bomb_window = { y2: 0, x3: 0, y3: 0, -} -bomb_window.x1 = xx + (ww/2) - bomb_window.w/2; -bomb_window.y1 = yy + (hh/2) - bomb_window.h/2; +}; +bomb_window.x1 = xx + (ww / 2) - bomb_window.w / 2; +bomb_window.y1 = yy + (hh / 2) - bomb_window.h / 2; bomb_window.x2 = bomb_window.x1 + bomb_window.w; bomb_window.y2 = bomb_window.y1 + bomb_window.h; bomb_window.x3 = bomb_window.x1 + (bomb_window.w / 2); bomb_window.y3 = bomb_window.y1 + (bomb_window.h / 2); - // Bombardment window -if (max_ships>0)and (instance_exists(obj_star_select)){ +if ((max_ships > 0) && instance_exists(obj_star_select)) { // Draw the background draw_set_color(c_white); - draw_sprite_stretched(spr_data_slate, 1, bomb_window.x1-20, bomb_window.y1-20, bomb_window.w+40, bomb_window.h+46) + draw_sprite_stretched(spr_data_slate, 1, bomb_window.x1 - 20, bomb_window.y1 - 20, bomb_window.w + 40, bomb_window.h + 46); draw_set_color(#34bc75); // draw_rectangle(bomb_window.x1+1, bomb_window.y1+1, bomb_window.x2-1, bomb_window.y2-1, 1); // draw_rectangle(bomb_window.x1+2, bomb_window.y1+2, bomb_window.x2-2, bomb_window.y2-2, 1); - // Header draw_set_halign(fa_left); draw_set_valign(fa_middle); draw_set_font(fnt_40k_30b); - draw_text_transformed(bomb_window.x1+18, bomb_window.y1+30,("Initializing Bombardment..."),0.8,0.8,0); - + draw_text_transformed(bomb_window.x1 + 18, bomb_window.y1 + 30, "Initializing Bombardment...", 0.8, 0.8, 0); // Target info var _total_hers, _influ; draw_set_font(fnt_info); - draw_text_bold(bomb_window.x1+20, bomb_window.y1+70, ($"Target planet: {p_data.name()}")); + draw_text_bold(bomb_window.x1 + 20, bomb_window.y1 + 70, $"Target planet: {p_data.name()}"); - _total_hers=p_data.corruption+p_data.secret_corruption; + _total_hers = p_data.corruption + p_data.secret_corruption; - _influ=p_data.population_influences; + _influ = p_data.population_influences; var population_string = $"Population: {p_data.display_population()} people"; - draw_text_bold(bomb_window.x1+20, bomb_window.y1+90, population_string); + draw_text_bold(bomb_window.x1 + 20, bomb_window.y1 + 90, population_string); - if (p_target.sprite_index!=spr_star_hulk){ + if (p_target.sprite_index != spr_star_hulk) { // TODO a centralised point to be able to fetch display names from factions identifying number var t_name = ""; switch (target) { @@ -95,55 +91,53 @@ if (max_ships>0)and (instance_exists(obj_star_select)){ break; } - var str=0,str_string=""; + var str = 0, str_string = ""; // TODO a centralised point to be able to fetch display names from factions identifying number str = floor(p_data.planet_forces[target]); - if (target == 2.5){ - str = determine_pdf_defence(p_data.pdf,,p_data.fortification_level)[0]; + if (target == 2.5) { + str = determine_pdf_defence(p_data.pdf,, p_data.fortification_level)[0]; } - var _s_strings = ARR_strength_descriptions - if (str0){ + for (var i = 2; i < array_length(p_data.planet_forces); i++) { + if (p_data.planet_forces[i] > 0) { array_push(_possible_targets, i); } } - if (p_data.pdf > 0){ + if (p_data.pdf > 0) { array_push(_possible_targets, 2.5); - } + } // Switch target to the next in the array if (array_length(_possible_targets) > 0) { var _current_index = array_get_index(_possible_targets, target); - _current_index = _current_index<(array_length(_possible_targets)-1) ? _current_index+1: 0 ; + _current_index = _current_index < (array_length(_possible_targets) - 1) ? _current_index + 1 : 0; target = _possible_targets[_current_index]; } - } var strength_string = $"Strength: {str}"; - draw_text_bold(bomb_window.x1+20, bomb_window.y1+130,strength_string); + draw_text_bold(bomb_window.x1 + 20, bomb_window.y1 + 130, strength_string); } - // The select all button draw_set_font(fnt_menu); var ship_index = 0; var sel_all_label = ""; - if (all_sel==0){ + if (all_sel == 0) { sel_all_label = " "; - }else if (all_sel==1){ + } else if (all_sel == 1) { sel_all_label = "x"; } var sel_all_button = draw_unit_buttons([bomb_window.x2 - 55, bomb_window.y1 + 150, bomb_window.x2 - 40, bomb_window.y1 + 165], sel_all_label, [1, 1], #34bc75, fa_center, fnt_40k_14b); if (point_and_click(sel_all_button)) { - for (var i = 0; i < array_length(ship); i++) { // Limit to the first 5 ships with buttons + for (var i = 0; i < array_length(ship); i++) { + // Limit to the first 5 ships with buttons if (ship[ship_index] != "" && ship_all[i] == all_sel) { ship_all[i] = !all_sel; ships_selected += all_sel ? -1 : 1; @@ -153,22 +147,21 @@ if (max_ships>0)and (instance_exists(obj_star_select)){ all_sel = !all_sel; } - // Total selection number draw_set_halign(fa_left); draw_set_font(fnt_info); - var sel=""; - sel=(ships_selected); - var curr_sel_string = $"Current Selection: {sel} ships" - draw_text_bold(bomb_window.x1+20, bomb_window.y2-28,curr_sel_string); + var sel = ""; + sel = ships_selected; + var curr_sel_string = $"Current Selection: {sel} ships"; + draw_text_bold(bomb_window.x1 + 20, bomb_window.y2 - 28, curr_sel_string); - draw_text_bold(bomb_window.x1+20, bomb_window.y1+160, ("Select ships:")); + draw_text_bold(bomb_window.x1 + 20, bomb_window.y1 + 160, "Select ships:"); // Individual ship buttons ship_index = 0; var buttonSpacingX = 106; // adjust as needed var buttonSpacingY = 21; // adjust as needed - + // Iterate over the 6 rows for (var row = 0; row < 6; row++) { // Iterate over the 4 columns in each row @@ -177,7 +170,7 @@ if (max_ships>0)and (instance_exists(obj_star_select)){ while (ship_index < array_length(ship) && ship[ship_index] == "") { ship_index++; } - + // Check if ship_index is still within range if (ship_index < array_length(ship) && ship[ship_index] != "") { // Delete the string from the 20th character onwards @@ -185,16 +178,12 @@ if (max_ships>0)and (instance_exists(obj_star_select)){ // Calculate button position based on row and column var buttonX = bomb_window.x1 + 24 + col * buttonSpacingX; var buttonY = bomb_window.y1 + 172 + row * buttonSpacingY; - + // Draw the unit buttons and handle selection - if (point_and_click(draw_unit_buttons([buttonX, buttonY, buttonX + 105, buttonY + 20], - string_truncate(num, 200), [1, 1], - ship_all[ship_index] ? #34bc75 : #bf4040, - fa_center, fnt_40k_10, ship_all[ship_index] ? 1 : 0.5))) { - + if (point_and_click(draw_unit_buttons([buttonX, buttonY, buttonX + 105, buttonY + 20], string_truncate(num, 200), [1, 1], ship_all[ship_index] ? #34bc75 : #bf4040, fa_center, fnt_40k_10, ship_all[ship_index] ? 1 : 0.5))) { ship_all[ship_index] = !ship_all[ship_index]; ships_selected += ship_all[ship_index] ? 1 : -1; - + // Ensure ships_selected does not go negative ships_selected = max(ships_selected, 0); } @@ -203,30 +192,37 @@ if (max_ships>0)and (instance_exists(obj_star_select)){ } } - // Confirm and Cancel buttons var button_alpha = 1; - if (!ships_selected) then button_alpha = 0.4; - bombard_button = draw_unit_buttons([bomb_window.x2-96, bomb_window.y2-40],"Confirm",[1,1],#bf4040,fa_center,fnt_40k_14b, button_alpha); - if (point_and_click(bombard_button)){ - if (ships_selected>0) { + if (!ships_selected) { + button_alpha = 0.4; + } + bombard_button = draw_unit_buttons([bomb_window.x2 - 96, bomb_window.y2 - 40], "Confirm", [1, 1], #bf4040, fa_center, fnt_40k_14b, button_alpha); + if (point_and_click(bombard_button)) { + if (ships_selected > 0) { bomb_score = 0; - for(var i=0; i 0) && (force_goodbye != 0)) { trading = 0; @@ -244,8 +244,8 @@ scr_menu_clear_up(function() { if ((menu == eMENU.Manage) && (managing > 0) || (managing < 0) && (!view_squad || !company_report)) { var unit; var eventing = false, bb = ""; - xx = __view_get(e__VW.XView, 0) + 0; - yy = __view_get(e__VW.YView, 0) + 0; + xx = camera_get_view_x(view_camera[0]) + 0; + yy = camera_get_view_y(view_camera[0]) + 0; var top = man_current, sel, temp1 = "", temp2 = "", temp3 = "", temp4 = "", temp5 = "", squad_sel = 0; var stop = 0; diff --git a/objects/obj_controller/Step_0.gml b/objects/obj_controller/Step_0.gml index 12730e3665..f0e5fedd42 100644 --- a/objects/obj_controller/Step_0.gml +++ b/objects/obj_controller/Step_0.gml @@ -424,8 +424,8 @@ try { if (!view_squad) { var c = 0, fx = ""; var xx, yy, bb = ""; - xx = __view_get(e__VW.XView, 0) + 0; - yy = __view_get(e__VW.YView, 0) + 0; + xx = camera_get_view_x(view_camera[0]) + 0; + yy = camera_get_view_y(view_camera[0]) + 0; if (managing <= 10) { c = managing; diff --git a/objects/obj_drop_select/Alarm_1.gml b/objects/obj_drop_select/Alarm_1.gml index 8b13789179..e69de29bb2 100644 --- a/objects/obj_drop_select/Alarm_1.gml +++ b/objects/obj_drop_select/Alarm_1.gml @@ -1 +0,0 @@ - diff --git a/objects/obj_drop_select/Alarm_2.gml b/objects/obj_drop_select/Alarm_2.gml index f58e7404dc..fefcbb61e4 100644 --- a/objects/obj_drop_select/Alarm_2.gml +++ b/objects/obj_drop_select/Alarm_2.gml @@ -1,62 +1,63 @@ - -var i;i=-1; -repeat(31){ - i+=1; - ship[i]=""; - ship_all[i]=0; - ship_use[i]=0; - ship_max[i]=0; - ship_ide[i]=-1; +var i; +i = -1; +repeat (31) { + i += 1; + ship[i] = ""; + ship_all[i] = 0; + ship_use[i] = 0; + ship_max[i] = 0; + ship_ide[i] = -1; } -max_ships=0; -if (sh_target!=-50){ - max_ships=sh_target.capital_number+sh_target.frigate_number+sh_target.escort_number; +max_ships = 0; +if (sh_target != -50) { + max_ships = sh_target.capital_number + sh_target.frigate_number + sh_target.escort_number; } +if (ship_max[500] != 0) { + max_ships += 1; +} -if (ship_max[500]!=0) then max_ships+=1; - -ship_all[500]=0; -ship_use[500]=0; -if (l_size>0) then l_size=l_size*-1; - - +ship_all[500] = 0; +ship_use[500] = 0; +if (l_size > 0) { + l_size = l_size * -1; +} -if (sh_target!=-50){ +if (sh_target != -50) { var tump = 0; var i = 0; - for (var q = 0; q < sh_target.capital_number; q++){ - if (sh_target.capital[q]!="") and (obj_ini.ship_carrying[sh_target.capital_num[q]]>0){ - ship[i]=sh_target.capital[i]; - ship_use[i]=0; - tump=sh_target.capital_num[i]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=3; - i+=1; + for (var q = 0; q < sh_target.capital_number; q++) { + if ((sh_target.capital[q] != "") && (obj_ini.ship_carrying[sh_target.capital_num[q]] > 0)) { + ship[i] = sh_target.capital[i]; + ship_use[i] = 0; + tump = sh_target.capital_num[i]; + ship_max[i] = obj_ini.ship_carrying[tump]; + ship_ide[i] = tump; + ship_size[i] = 3; + i += 1; } } for (var q = 0; q < sh_target.frigate_number; q++) { - if (sh_target.frigate[q]!="") and (obj_ini.ship_carrying[sh_target.frigate_num[q]]>0){ - ship[i]=sh_target.frigate[q]; - ship_use[i]=0; - tump=sh_target.frigate_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=2; - i+=1; + if ((sh_target.frigate[q] != "") && (obj_ini.ship_carrying[sh_target.frigate_num[q]] > 0)) { + ship[i] = sh_target.frigate[q]; + ship_use[i] = 0; + tump = sh_target.frigate_num[q]; + ship_max[i] = obj_ini.ship_carrying[tump]; + ship_ide[i] = tump; + ship_size[i] = 2; + i += 1; } } for (var q = 0; q < sh_target.escort_number; q++) { - if (sh_target.escort[q]!="") and (obj_ini.ship_carrying[sh_target.escort_num[q]]>0){ - ship[i]=sh_target.escort[q]; - ship_use[i]=0; - tump=sh_target.escort_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=1; - i+=1; + if ((sh_target.escort[q] != "") && (obj_ini.ship_carrying[sh_target.escort_num[q]] > 0)) { + ship[i] = sh_target.escort[q]; + ship_use[i] = 0; + tump = sh_target.escort_num[q]; + ship_max[i] = obj_ini.ship_carrying[tump]; + ship_ide[i] = tump; + ship_size[i] = 1; + i += 1; } } } diff --git a/objects/obj_drop_select/Alarm_3.gml b/objects/obj_drop_select/Alarm_3.gml index 7b04af3c23..95134e0c6f 100644 --- a/objects/obj_drop_select/Alarm_3.gml +++ b/objects/obj_drop_select/Alarm_3.gml @@ -1,71 +1,76 @@ -var i;i=-1; -repeat(61){ - i+=1; - ship[i]=""; - ship_all[i]=0; - ship_use[i]=0; - ship_max[i]=0; - ship_ide[i]=-1; +var i; +i = -1; +repeat (61) { + i += 1; + ship[i] = ""; + ship_all[i] = 0; + ship_use[i] = 0; + ship_max[i] = 0; + ship_ide[i] = -1; } -max_ships=0; +max_ships = 0; +if (sh_target != -50) { + max_ships = sh_target.capital_number + sh_target.frigate_number + sh_target.escort_number; -if (sh_target!=-50){ - max_ships=sh_target.capital_number+sh_target.frigate_number+sh_target.escort_number; - - - var tump;tump=0; - - var i, q, b;i=0;q=0;b=0; - repeat(sh_target.capital_number){ - b+=1; - if (sh_target.capital[b]!=""){ - i+=1; - ship[i]=sh_target.capital[i]; - - ship_use[i]=0; - tump=sh_target.capital_num[i]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=3; - - purge_a+=3; - purge_b+=ship_max[i];purge_c+=ship_max[i]; + var tump; + tump = 0; + + var i, q, b; + i = 0; + q = 0; + b = 0; + repeat (sh_target.capital_number) { + b += 1; + if (sh_target.capital[b] != "") { + i += 1; + ship[i] = sh_target.capital[i]; + + ship_use[i] = 0; + tump = sh_target.capital_num[i]; + ship_max[i] = obj_ini.ship_carrying[tump]; + ship_ide[i] = tump; + ship_size[i] = 3; + + purge_a += 3; + purge_b += ship_max[i]; + purge_c += ship_max[i]; } } - q=0; - repeat(sh_target.frigate_number){ - q+=1; - if (sh_target.frigate[q]!=""){ - i+=1; - ship[i]=sh_target.frigate[q]; - - ship_use[i]=0; - tump=sh_target.frigate_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=2; - - purge_a+=1; - purge_b+=ship_max[i];purge_c+=ship_max[i]; + q = 0; + repeat (sh_target.frigate_number) { + q += 1; + if (sh_target.frigate[q] != "") { + i += 1; + ship[i] = sh_target.frigate[q]; + + ship_use[i] = 0; + tump = sh_target.frigate_num[q]; + ship_max[i] = obj_ini.ship_carrying[tump]; + ship_ide[i] = tump; + ship_size[i] = 2; + + purge_a += 1; + purge_b += ship_max[i]; + purge_c += ship_max[i]; } } - q=0; - repeat(sh_target.escort_number){ - q+=1; - if (sh_target.escort[q]!="") and (obj_ini.ship_carrying[sh_target.escort_num[q]]>0){ - i+=1; - ship[i]=sh_target.escort[q]; - - ship_use[i]=0; - tump=sh_target.escort_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=1; - - purge_b+=ship_max[i];purge_c+=ship_max[i]; + q = 0; + repeat (sh_target.escort_number) { + q += 1; + if ((sh_target.escort[q] != "") && (obj_ini.ship_carrying[sh_target.escort_num[q]] > 0)) { + i += 1; + ship[i] = sh_target.escort[q]; + + ship_use[i] = 0; + tump = sh_target.escort_num[q]; + ship_max[i] = obj_ini.ship_carrying[tump]; + ship_ide[i] = tump; + ship_size[i] = 1; + + purge_b += ship_max[i]; + purge_c += ship_max[i]; } } } - diff --git a/objects/obj_drop_select/Alarm_4.gml b/objects/obj_drop_select/Alarm_4.gml index 9236122bdd..da2daf698f 100644 --- a/objects/obj_drop_select/Alarm_4.gml +++ b/objects/obj_drop_select/Alarm_4.gml @@ -1,60 +1,61 @@ - - // This confirms the number of ships available for bombarding -var i;i=-1; -repeat(61){ - i+=1; - ship[i]=""; - ship_all[i]=0; - ship_use[i]=0; - ship_max[i]=0; - ship_ide[i]=-1; +var i; +i = -1; +repeat (61) { + i += 1; + ship[i] = ""; + ship_all[i] = 0; + ship_use[i] = 0; + ship_max[i] = 0; + ship_ide[i] = -1; } -max_ships=0; - - -if (sh_target!=-50){ - max_ships=sh_target.capital_number+sh_target.frigate_number+sh_target.escort_number; - - - var tump;tump=0; - - var i, q, b;i=0;q=0;b=0; - repeat(sh_target.capital_number){ - b+=1; - if (sh_target.capital[b]!=""){ - i+=1; - ship[i]=sh_target.capital[i]; - - ship_use[i]=0; - tump=sh_target.capital_num[i]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=3; - - purge_a+=3; - purge_b+=ship_max[i]; - purge_c+=ship_max[i]; +max_ships = 0; + +if (sh_target != -50) { + max_ships = sh_target.capital_number + sh_target.frigate_number + sh_target.escort_number; + + var tump; + tump = 0; + + var i, q, b; + i = 0; + q = 0; + b = 0; + repeat (sh_target.capital_number) { + b += 1; + if (sh_target.capital[b] != "") { + i += 1; + ship[i] = sh_target.capital[i]; + + ship_use[i] = 0; + tump = sh_target.capital_num[i]; + ship_max[i] = obj_ini.ship_carrying[tump]; + ship_ide[i] = tump; + ship_size[i] = 3; + + purge_a += 3; + purge_b += ship_max[i]; + purge_c += ship_max[i]; } } - q=0; - repeat(sh_target.frigate_number){ - q+=1; - if (sh_target.frigate[q]!=""){ - i+=1; - ship[i]=sh_target.frigate[q]; - - ship_use[i]=0; - tump=sh_target.frigate_num[q]; - ship_max[i]=obj_ini.ship_carrying[tump]; - ship_ide[i]=tump; - ship_size[i]=2; - - purge_a+=1; - purge_b+=ship_max[i];purge_c+=ship_max[i]; + q = 0; + repeat (sh_target.frigate_number) { + q += 1; + if (sh_target.frigate[q] != "") { + i += 1; + ship[i] = sh_target.frigate[q]; + + ship_use[i] = 0; + tump = sh_target.frigate_num[q]; + ship_max[i] = obj_ini.ship_carrying[tump]; + ship_ide[i] = tump; + ship_size[i] = 2; + + purge_a += 1; + purge_b += ship_max[i]; + purge_c += ship_max[i]; } } } - diff --git a/objects/obj_drop_select/Create_0.gml b/objects/obj_drop_select/Create_0.gml index 4668c55940..2e4ee5ffc8 100644 --- a/objects/obj_drop_select/Create_0.gml +++ b/objects/obj_drop_select/Create_0.gml @@ -1,91 +1,85 @@ -if !(variable_instance_exists(self, "attack")){ +if (!variable_instance_exists(self, "attack")) { attack = 0; } -set_zoom_to_default(); //bandaid the purge screen flying off screen if zoomed out +set_zoom_to_default(); //bandaid the purge screen flying off screen if zoomed out -once_only=0; +once_only = 0; -raid_tact=1; -raid_vet=1; -raid_assa=1; -raid_deva=1; -raid_scou=1; -raid_term=1; -raid_spec=1; -raid_wounded=obj_controller.select_wounded; -refresh_raid=0; -remove_local=1; +raid_tact = 1; +raid_vet = 1; +raid_assa = 1; +raid_deva = 1; +raid_scou = 1; +raid_term = 1; +raid_spec = 1; +raid_wounded = obj_controller.select_wounded; +refresh_raid = 0; +remove_local = 1; -// +// main_slate = new DataSlate(); draw = drop_select_draw; main_slate.inside_method = draw; roster_slate = new DataSlate(); local_content_slate = new DataSlate(); -var i=-1; -formation_current=-1; -via = array_create(100, 0); +var i = -1; +formation_current = -1; +via = array_create(100, 0); formation_possible = []; force_present = array_create(51, 0); -r_master=0; -r_honor=0; -r_capts=0; -r_mahreens=0; -r_veterans=0; -r_terminators=0; -r_dreads=0; -r_chaplains=0; -r_champions=0; -r_psykers=0; -r_apothecaries=0; -r_techmarines=0; +r_master = 0; +r_honor = 0; +r_capts = 0; +r_mahreens = 0; +r_veterans = 0; +r_terminators = 0; +r_dreads = 0; +r_chaplains = 0; +r_champions = 0; +r_psykers = 0; +r_apothecaries = 0; +r_techmarines = 0; // Attack -r_bikes=0; - - -if (action_if_number(obj_saveload, 0, 0)){ - - ship_names=""; - max_ships=0; - ships_selected=0; - - purge_method=0; - purge_score=0; - purge_a=0; - purge_b=0; - purge_c=0; - purge_d=0; - tooltip=""; - tooltip2=""; - all_sel=0; - - - var i=-1; +r_bikes = 0; + +if (action_if_number(obj_saveload, 0, 0)) { + ship_names = ""; + max_ships = 0; + ships_selected = 0; + + purge_method = 0; + purge_score = 0; + purge_a = 0; + purge_b = 0; + purge_c = 0; + purge_d = 0; + tooltip = ""; + tooltip2 = ""; + all_sel = 0; + + var i = -1; var _ship_index = array_length(obj_ini.ship); - ship=array_create(_ship_index, ""); - ship_size=array_create(_ship_index, 0); - ship_all=array_create(_ship_index, 0); - ship_use=array_create(_ship_index, 0); - ship_max=array_create(_ship_index, 0); - ship_ide=array_create(_ship_index, -1); - - i=500; - ship[i]="Local"; - ship_size[i]=0; - ship_all[i]=0; - ship_use[i]=0; - ship_max[i]=0; - ship_ide[i]=-42; - - - menu=0; - - + ship = array_create(_ship_index, ""); + ship_size = array_create(_ship_index, 0); + ship_all = array_create(_ship_index, 0); + ship_use = array_create(_ship_index, 0); + ship_max = array_create(_ship_index, 0); + ship_ide = array_create(_ship_index, -1); + + i = 500; + ship[i] = "Local"; + ship_size[i] = 0; + ship_all[i] = 0; + ship_use[i] = 0; + ship_max[i] = 0; + ship_ide[i] = -42; + + menu = 0; roster = new Roster(); - if (instance_exists(p_target)){ + if (instance_exists(p_target)) { roster.roster_location = p_target.name; } @@ -93,55 +87,52 @@ if (action_if_number(obj_saveload, 0, 0)){ roster.attack_type = attack; roster.determine_full_roster(); - // These should be set to a negative value; that is, effectively, how much when it is selected (i.e. *-1) - attacking=0; - sisters=0; - eldar=0; - ork=0; - tau=0; - traitors=0; - tyranids=0; - csm=0; - necrons=0; - demons=0; + attacking = 0; + sisters = 0; + eldar = 0; + ork = 0; + tau = 0; + traitors = 0; + tyranids = 0; + csm = 0; + necrons = 0; + demons = 0; // Formation check - var i=0,is=0,arright=false; + var i = 0, is = 0, arright = false; var _formations = obj_controller.bat_formation; var _formation_types = obj_controller.bat_formation_type; - for (var i=0;i0) then max_ships+=1; - - var bes=0,bes_score=0; - if (sisters>0) and (obj_controller.faction_status[eFACTION.Ecclesiarchy]="War"){bes=5;bes_score=sisters;} - if (eldar>bes_score){bes=6;bes_score=eldar;} - if (ork>bes_score){bes=7;bes_score=ork;} - if (tau>bes_score){bes=8;bes_score=tau;} - if (tyranids>bes_score){bes=9;bes_score=tyranids;} - if (traitors>bes_score){bes=10;bes_score=traitors;} - if (csm>bes_score){bes=11;bes_score=csm;} - if (necrons>bes_score){bes=13;bes_score=necrons;} - if (demons>0){bes=12;bes_score=demons;} - if (bes_score>0) then attacking=bes; - - var spesh=false; - if (planet_feature_bool(p_target.p_feature[planet_number],P_features.Warlord10)==1) and (obj_controller.faction_defeated[10]=0) and (obj_controller.faction_gender[10]=1) and (obj_controller.known[eFACTION.Chaos]>0) and (obj_controller.turn>=obj_controller.chaos_turn) then spesh=true; - - - if (has_problem_planet(planet_number, "tyranid_org", p_target)){ - tyranids=2; - attacking=9; - } - - var forces,t_attack;forces=0;t_attack=0; - if (sisters>0){forces+=1;force_present[forces]=5;} - if (eldar>0){forces+=1;force_present[forces]=6;} - if (ork>0){forces+=1;force_present[forces]=7;} - if (tau>0){forces+=1;force_present[forces]=8;} - if (tyranids>0){ - forces+=1; - force_present[forces]=9; - } - if (traitors>0) or ((traitors=0) and (spesh=true)){ - forces+=1; - force_present[forces]=10; - } - if (csm>0){ - forces+=1; - force_present[forces]=11; - } - if (demons>0){ - forces+=1; - force_present[forces]=12; - } - if (necrons>0){ - forces+=1; - force_present[forces]=13; - } +if (purge == 0) { + sisters = p_target.p_sisters[planet_number]; + eldar = p_target.p_eldar[planet_number]; + ork = p_target.p_orks[planet_number]; + tau = p_target.p_tau[planet_number]; + tyranids = p_target.p_tyranids[planet_number]; + csm = p_target.p_chaos[planet_number]; + traitors = p_target.p_traitors[planet_number]; + necrons = p_target.p_necrons[planet_number]; + demons = p_target.p_demons[planet_number]; + + if (p_target.p_player[planet_number] > 0) { + max_ships += 1; + } + + var bes = 0, bes_score = 0; + if ((sisters > 0) && (obj_controller.faction_status[eFACTION.Ecclesiarchy] == "War")) { + bes = 5; + bes_score = sisters; + } + if (eldar > bes_score) { + bes = 6; + bes_score = eldar; + } + if (ork > bes_score) { + bes = 7; + bes_score = ork; + } + if (tau > bes_score) { + bes = 8; + bes_score = tau; + } + if (tyranids > bes_score) { + bes = 9; + bes_score = tyranids; + } + if (traitors > bes_score) { + bes = 10; + bes_score = traitors; + } + if (csm > bes_score) { + bes = 11; + bes_score = csm; + } + if (necrons > bes_score) { + bes = 13; + bes_score = necrons; + } + if (demons > 0) { + bes = 12; + bes_score = demons; + } + if (bes_score > 0) { + attacking = bes; + } + + var spesh = false; + if ((planet_feature_bool(p_target.p_feature[planet_number], P_features.Warlord10) == 1) && (obj_controller.faction_defeated[10] == 0) && (obj_controller.faction_gender[10] == 1) && (obj_controller.known[eFACTION.Chaos] > 0) && (obj_controller.turn >= obj_controller.chaos_turn)) { + spesh = true; + } + + if (has_problem_planet(planet_number, "tyranid_org", p_target)) { + tyranids = 2; + attacking = 9; + } + + var forces, t_attack; + forces = 0; + t_attack = 0; + if (sisters > 0) { + forces += 1; + force_present[forces] = 5; + } + if (eldar > 0) { + forces += 1; + force_present[forces] = 6; + } + if (ork > 0) { + forces += 1; + force_present[forces] = 7; + } + if (tau > 0) { + forces += 1; + force_present[forces] = 8; + } + if (tyranids > 0) { + forces += 1; + force_present[forces] = 9; + } + if ((traitors > 0) || ((traitors == 0) && (spesh == true))) { + forces += 1; + force_present[forces] = 10; + } + if (csm > 0) { + forces += 1; + force_present[forces] = 11; + } + if (demons > 0) { + forces += 1; + force_present[forces] = 12; + } + if (necrons > 0) { + forces += 1; + force_present[forces] = 13; + } } else { var _viable_ground_forces = roster.marines_total(); - bombard_purge = new PurgeButton(4, 631,231,DropType.PurgeBombard); - bombard_purge.active = roster.purge_bombard_score() ? 1:0; + bombard_purge = new PurgeButton(4, 631, 231, DropType.PurgeBombard); + bombard_purge.active = roster.purge_bombard_score() ? 1 : 0; bombard_purge.description = "The final sanction for worlds where there is no other economic means for rooting out heresy corruption or the xenos, Your chapters reputation amoung the planets populace may will be damaged, any residing governor (providing they are fit to rule and survive) will be displeased, collaterals will be huge but it's effects will surely be great"; - fire_purge = new PurgeButton(5,631,304,DropType.PurgeFire); + fire_purge = new PurgeButton(5, 631, 304, DropType.PurgeFire); fire_purge.active = _viable_ground_forces; fire_purge.description = "Large swathes of the worst affected areas will be put to the torch the heretics and xenos will be found, the planets populace will not thanks you but most governors will be content to allow the work they were to weak to do to be done"; - selective_purge = new PurgeButton(6,631,377,DropType.PurgeSelective); + selective_purge = new PurgeButton(6, 631, 377, DropType.PurgeSelective); selective_purge.active = _viable_ground_forces; selective_purge.description = "The nodes of corruption will be saught out and killed, often in such cases the rot resides in the higher reaches of society such methids are perfect for these instances, cut the head off the snake and the rest will wither, the populations of the oppressed planets are generaly pleased even if the nobles and governors chaffe at the censorship or if neccassary execution"; - assasinate_purge = new PurgeButton(7,631,450,DropType.PurgeAssassinate); + assasinate_purge = new PurgeButton(7, 631, 450, DropType.PurgeAssassinate); assasinate_purge.active = _viable_ground_forces; assasinate_purge.description = "Often the simplest solution is a single bolt shell or the swift knife the heart. Kill the Leader."; purge_options = [bombard_purge, fire_purge, selective_purge, assasinate_purge]; } - diff --git a/objects/obj_drop_select/Draw_64.gml b/objects/obj_drop_select/Draw_64.gml index 1e946516b6..ebd52e914c 100644 --- a/objects/obj_drop_select/Draw_64.gml +++ b/objects/obj_drop_select/Draw_64.gml @@ -1,124 +1,124 @@ try { - if (instance_number(obj_ncombat) || instance_number(obj_popup)) { - exit; - } + if (instance_number(obj_ncombat) || instance_number(obj_popup)) { + exit; + } - w = 660; - h = 520; - // Center of the screen - //setup - var _x_center = (display_get_gui_width() / 2) - (w / 2); - var _y_center = (display_get_gui_height() / 2) - (h / 2); - //draw main_slate - if (purge != DropType.PurgeSelect && (local_content_slate.XX <= _x_center - local_content_slate.width)) { - main_slate.inside_method = drop_select_draw; - main_slate.draw(_x_center, _y_center, (660 / 860), (520 / 850)); - } + w = 660; + h = 520; + // Center of the screen + //setup + var _x_center = (display_get_gui_width() / 2) - (w / 2); + var _y_center = (display_get_gui_height() / 2) - (h / 2); + //draw main_slate + if (purge != DropType.PurgeSelect && (local_content_slate.XX <= _x_center - local_content_slate.width)) { + main_slate.inside_method = drop_select_draw; + main_slate.draw(_x_center, _y_center, (660 / 860), (520 / 850)); + } - //left hand slate - local_content_slate.inside_method = function() { - var _xx = local_content_slate.XX; - var _yy = local_content_slate.YY + 40; - var _width = local_content_slate.width; - var _heigth = local_content_slate.height; - if (purge == 0) { - draw_set_halign(fa_left); - draw_text_ext(_xx + 15, _yy, roster.roster_local_string, -1, local_content_slate.width - 30); - draw_text_ext(_xx + 15.1, _yy + 0.1, roster.roster_local_string, -1, local_content_slate.width - 30); - } - if (purge != DropType.RaidAttack) { - if (purge == DropType.PurgeSelect) { - draw_set_halign(fa_center); - draw_set_font(fnt_40k_30b); + //left hand slate + local_content_slate.inside_method = function() { + var _xx = local_content_slate.XX; + var _yy = local_content_slate.YY + 40; + var _width = local_content_slate.width; + var _heigth = local_content_slate.height; + if (purge == 0) { + draw_set_halign(fa_left); + draw_text_ext(_xx + 15, _yy, roster.roster_local_string, -1, local_content_slate.width - 30); + draw_text_ext(_xx + 15.1, _yy + 0.1, roster.roster_local_string, -1, local_content_slate.width - 30); + } + if (purge != DropType.RaidAttack) { + if (purge == DropType.PurgeSelect) { + draw_set_halign(fa_center); + draw_set_font(fnt_40k_30b); - draw_set_color(c_gray); - var _exit = draw_unit_buttons([_xx + (_width / 2) - 40, 559], "Cancel"); - if (point_and_click(_exit)) { - instance_destroy(); - } - } - var _xx = local_content_slate.XX; + draw_set_color(c_gray); + var _exit = draw_unit_buttons([_xx + (_width / 2) - 40, 559], "Cancel"); + if (point_and_click(_exit)) { + instance_destroy(); + } + } + var _xx = local_content_slate.XX; - /*if (instance_exists(p_target)) { + /*if (instance_exists(p_target)) { if (p_target.p_type[planet_number] = "Shrine") then nup = true; } */ - // 89,31 - draw_set_halign(fa_left); - for (var i = 0; i < array_length(purge_options); i++) { - var _purge_button = purge_options[i]; - _purge_button.x1 = _xx + 10; - _purge_button.width = local_content_slate.width - 20; - _purge_button.draw(); - if (_purge_button.clicked()) { - purge_score = 0; - purge = _purge_button.purge_type; - } - } - } - }; + // 89,31 + draw_set_halign(fa_left); + for (var i = 0; i < array_length(purge_options); i++) { + var _purge_button = purge_options[i]; + _purge_button.x1 = _xx + 10; + _purge_button.width = local_content_slate.width - 20; + _purge_button.draw(); + if (_purge_button.clicked()) { + purge_score = 0; + purge = _purge_button.purge_type; + } + } + } + }; - draw_set_halign(fa_center); - if (purge == DropType.RaidAttack) { - local_content_slate.draw(_x_center - local_content_slate.width, _y_center, (300 / 860), (520 / 850)); - } else if (purge == 1) { - local_content_slate.draw((camera_width / 2) - (local_content_slate.width / 2), _y_center, (300 / 860), (520 / 850)); - } else { - if (local_content_slate.XX > _x_center - local_content_slate.width) { - var _draw_x = max(local_content_slate.XX - 15, _x_center - local_content_slate.width); - local_content_slate.draw(_draw_x, _y_center, (300 / 860), (520 / 850)); - } else { - local_content_slate.draw(local_content_slate.XX, _y_center, (300 / 860), (520 / 850)); - } - } - draw_set_halign(fa_center); - draw_set_font(fnt_40k_14b); - roster_slate.inside_method = function() { - var _xx = roster_slate.XX + (roster_slate.width / 2); - var _yy = roster_slate.YY + 40; - if (purge == 0) { - draw_text_transformed(_xx, _yy, "Battle Roster", 2, 2, 0); - _yy += 30; - draw_text_ext(_xx, _yy, roster.roster_string, -1, roster_slate.width - 30); - draw_text_ext(_xx + 0.1, _yy + 0.1, roster.roster_string, -1, roster_slate.width - 30); - } else if (purge > DropType.PurgeSelect) { - draw_text_transformed(_xx, _yy, "Purge Insight", 2, 2, 0); - _yy += 30; - var hers, influ, poppy; - var hers = p_target.p_heresy[planet_number] + p_target.p_heresy_secret[planet_number]; - var influ = p_target.p_influence[planet_number]; - if (p_target.p_large[planet_number] == 1) { - poppy = string(p_target.p_population[planet_number]) + "B"; - } - if (p_target.p_large[planet_number] == 0) { - poppy = string(scr_display_number(p_target.p_population[planet_number])); - } - draw_text(_xx + 14, _yy + 10, $"Heresy: {max(hers, influ[eFACTION.Tau])}%"); - draw_text(_xx + 14, _yy + 20, $"Population: {poppy}"); - } else if (purge == DropType.PurgeSelect) { - draw_text_transformed(_xx, _yy, "Purge", 2, 2, 0); - _yy += 30; - for (var i = 0; i < array_length(purge_options); i++) { - if (purge_options[i].hover()) { - draw_text_ext(_xx, _yy, purge_options[i].description, -1, roster_slate.width - 30); - } - } - } - }; - var _draw_x = _x_center + main_slate.width; - var _draw_y = _y_center; - if (purge > DropType.PurgeSelect) { - if (roster_slate.XX < _x_center + 660) { - var _draw_x = min(roster_slate.XX + 15, _x_center + 660); - } else { - _draw_x = roster_slate.XX; - } - } else if (purge == DropType.PurgeSelect) { - _draw_x = local_content_slate.XX + local_content_slate.width; - } + draw_set_halign(fa_center); + if (purge == DropType.RaidAttack) { + local_content_slate.draw(_x_center - local_content_slate.width, _y_center, (300 / 860), (520 / 850)); + } else if (purge == 1) { + local_content_slate.draw((camera_width / 2) - (local_content_slate.width / 2), _y_center, (300 / 860), (520 / 850)); + } else { + if (local_content_slate.XX > _x_center - local_content_slate.width) { + var _draw_x = max(local_content_slate.XX - 15, _x_center - local_content_slate.width); + local_content_slate.draw(_draw_x, _y_center, (300 / 860), (520 / 850)); + } else { + local_content_slate.draw(local_content_slate.XX, _y_center, (300 / 860), (520 / 850)); + } + } + draw_set_halign(fa_center); + draw_set_font(fnt_40k_14b); + roster_slate.inside_method = function() { + var _xx = roster_slate.XX + (roster_slate.width / 2); + var _yy = roster_slate.YY + 40; + if (purge == 0) { + draw_text_transformed(_xx, _yy, "Battle Roster", 2, 2, 0); + _yy += 30; + draw_text_ext(_xx, _yy, roster.roster_string, -1, roster_slate.width - 30); + draw_text_ext(_xx + 0.1, _yy + 0.1, roster.roster_string, -1, roster_slate.width - 30); + } else if (purge > DropType.PurgeSelect) { + draw_text_transformed(_xx, _yy, "Purge Insight", 2, 2, 0); + _yy += 30; + var hers, influ, poppy; + var hers = p_target.p_heresy[planet_number] + p_target.p_heresy_secret[planet_number]; + var influ = p_target.p_influence[planet_number]; + if (p_target.p_large[planet_number] == 1) { + poppy = string(p_target.p_population[planet_number]) + "B"; + } + if (p_target.p_large[planet_number] == 0) { + poppy = string(scr_display_number(p_target.p_population[planet_number])); + } + draw_text(_xx + 14, _yy + 10, $"Heresy: {max(hers, influ[eFACTION.Tau])}%"); + draw_text(_xx + 14, _yy + 20, $"Population: {poppy}"); + } else if (purge == DropType.PurgeSelect) { + draw_text_transformed(_xx, _yy, "Purge", 2, 2, 0); + _yy += 30; + for (var i = 0; i < array_length(purge_options); i++) { + if (purge_options[i].hover()) { + draw_text_ext(_xx, _yy, purge_options[i].description, -1, roster_slate.width - 30); + } + } + } + }; + var _draw_x = _x_center + main_slate.width; + var _draw_y = _y_center; + if (purge > DropType.PurgeSelect) { + if (roster_slate.XX < _x_center + 660) { + var _draw_x = min(roster_slate.XX + 15, _x_center + 660); + } else { + _draw_x = roster_slate.XX; + } + } else if (purge == DropType.PurgeSelect) { + _draw_x = local_content_slate.XX + local_content_slate.width; + } - roster_slate.draw(_draw_x, _draw_y, (300 / 860), (520 / 850)); + roster_slate.draw(_draw_x, _draw_y, (300 / 860), (520 / 850)); } catch (_exception) { - handle_exception(_exception); + handle_exception(_exception); instance_destroy(); } diff --git a/objects/obj_drop_select/Mouse_56.gml b/objects/obj_drop_select/Mouse_56.gml index 767d605be9..c966b9f52a 100644 --- a/objects/obj_drop_select/Mouse_56.gml +++ b/objects/obj_drop_select/Mouse_56.gml @@ -1,163 +1,152 @@ var __b__; __b__ = action_if_variable(purge, 0, 0); -if __b__ -{ - -exit; -// TODO Check if code is still used or not -//var xx, yy; -//xx=__view_get( e__VW.XView, 0 ); -//yy=__view_get( e__VW.YView, 0 ); - - - -//var i;i=-1;ships_selected=0; -//repeat(31){ -// i+=1; -// if (ship_all[i]!=0) and (ship[i]!=""){ -// ships_selected+=1; -// } -//} -//if (ship_all[500]!=0) then ships_selected+=1; - - - - -//var i, fy, why, onceh, loca, add_ground;i=0;why=0;onceh=0;loca=0;add_ground=0; - -//if (l_size>0) then loca=1; - -//if (obj_controller.cooldown<=0){fy=1; -// if (fy=1) and (scr_hit(xx+47,yy+107+why,xx+161,yy+122+why)=true){// Leftest -// if (loca=1) and (l_size>0){onceh=0;// Case 1: it is first slot, local -// if (onceh=0) and (ship_all[500]=0){onceh=1;obj_controller.cooldown=8000;ship_all[500]=1;add_ground=1;} -// if (onceh=0) and (ship_all[500]=1){onceh=1;obj_controller.cooldown=8000;ship_all[500]=0;add_ground=-1;} -// } -// } -//} - -//if (loca=1){fy+=1;if (fy=5) then fy=1;}i=0; - -//if (obj_controller.cooldown<=0){ -// repeat(24-loca){i+=1; -// if (fy=1) and (scr_hit(xx+47,yy+107+why,xx+161,yy+122+why)=true){// Leftest -// if (ship[i]!=""){// Case 3: it is a later slot, ship -// if (onceh=0) and (ship_all[i]=0){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],true,i,attack);} -// if (onceh=0) and (ship_all[i]=1){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],false,i,attack);} -// } -// } -// if (fy=2) and (scr_hit(xx+164,yy+107+why,xx+278,yy+122+why)=true){// 2nd -// if (ship[i]!=""){ -// if (onceh=0) and (ship_all[i]=0){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],true,i,attack);} -// if (onceh=0) and (ship_all[i]=1){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],false,i,attack);} -// } -// } -// if (fy=3) and (scr_hit(xx+281,yy+107+why,xx+395,yy+122+why)=true){// 3rd -// if (ship[i]!=""){ -// if (onceh=0) and (ship_all[i]=0){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],true,i,attack);} -// if (onceh=0) and (ship_all[i]=1){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],false,i,attack);} -// } -// } -// if (fy=4) and (scr_hit(xx+398,yy+107+why,xx+512,yy+122+why)=true){// 4th -// if (ship[i]!=""){ -// if (onceh=0) and (ship_all[i]=0){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],true,i,attack);} -// if (onceh=0) and (ship_all[i]=1){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],false,i,attack);} -// } -// } -// fy+=1;if (fy=5){fy=1;why+=18;} -// } -//} - - - - -//if (obj_controller.cooldown <= 0) { -// if (mouse_x >= xx + 456) && (mouse_y >= yy + 378) && (mouse_x < xx + 519) && (mouse_y < yy + 403) { -// instance_destroy(); -// obj_controller.cooldown = 8000; -// } - -// if (mouse_x >= xx + 76) && (mouse_y >= yy + 82) && (mouse_x < xx + 102) && (mouse_y < yy + 95) { -// var onceh; -// once = 0; -// i = 0; -// if (all_sel = 0) && (onceh = 0) { -// var ships_len = array_length(ship); -// for (var i = 0; i < ships_len; i++) { -// if (ship[i] != "") && (ship_all[i] = 0) { -// ship_all[i] = 1; -// scr_drop_fiddle(ship_ide[i], true, i, attack); -// } -// } -// if (ship_all[500] = 0) && (l_size > 0) { -// ship_all[500] = 1; -// add_ground = 1; -// } -// onceh = 1; -// all_sel = 1; -// } -// if (all_sel = 1) && (onceh = 0) { -// var ships_len = array_length(ship); -// for (var i = 0; i < ships_len; i++) { -// if (ship[i] != "") && (ship_all[i] = 1) { -// ship_all[i] = 0; -// scr_drop_fiddle(ship_ide[i], false, i, attack); -// } -// } -// if (ship_all[500] = 1) && (l_size > 0) { -// ship_all[500] = 0; -// add_ground = -1; -// } -// onceh = 1; -// all_sel = 0; -// } -// } -//} - -//if (add_ground = 1) { -// ships_selected += 1; -// master += local_forces.master; -// honor += local_forces.honor; -// capts += local_forces.captains; -// mahreens += l_mahreens; -// veterans += l_veterans; -// terminators += l_terminators; -// dreads += l_dreads; -// chaplains += l_chaplains; -// psykers += l_psykers; -// apothecaries += l_apothecaries; -// techmarines += l_techmarines; -// champions += l_champions; - -// bikes += l_bikes; -// rhinos += l_rhinos; -// whirls += l_whirls; -// predators += l_predators; -// raiders += l_raiders; -// speeders += l_speeders; -//} -//if (add_ground = -1) { -// ships_selected -= 1; -// master -= local_forces.master; -// honor -= local_forces.honor; -// capts -= local_forces.captains; -// mahreens -= l_mahreens; -// veterans -= l_veterans; -// terminators -= l_terminators; -// dreads -= l_dreads; -// chaplains -= l_chaplains; -// psykers -= l_psykers; -// apothecaries -= l_apothecaries; -// techmarines -= l_techmarines; -// champions -= l_champions; - -// bikes -= l_bikes; -// rhinos -= l_rhinos; -// whirls -= l_whirls; -// predators -= l_predators; -// raiders -= l_raiders; -// speeders -= l_speeders; -//} -// END OF CODE REVIEWING - +if (__b__) { + exit; + // TODO Check if code is still used or not + //var xx, yy; + //xx=camera_get_view_x(view_camera[0]); + //yy=camera_get_view_y(view_camera[0]); + + //var i;i=-1;ships_selected=0; + //repeat(31){ + // i+=1; + // if (ship_all[i]!=0) and (ship[i]!=""){ + // ships_selected+=1; + // } + //} + //if (ship_all[500]!=0) then ships_selected+=1; + + //var i, fy, why, onceh, loca, add_ground;i=0;why=0;onceh=0;loca=0;add_ground=0; + + //if (l_size>0) then loca=1; + + //if (obj_controller.cooldown<=0){fy=1; + // if (fy=1) and (scr_hit(xx+47,yy+107+why,xx+161,yy+122+why)=true){// Leftest + // if (loca=1) and (l_size>0){onceh=0;// Case 1: it is first slot, local + // if (onceh=0) and (ship_all[500]=0){onceh=1;obj_controller.cooldown=8000;ship_all[500]=1;add_ground=1;} + // if (onceh=0) and (ship_all[500]=1){onceh=1;obj_controller.cooldown=8000;ship_all[500]=0;add_ground=-1;} + // } + // } + //} + + //if (loca=1){fy+=1;if (fy=5) then fy=1;}i=0; + + //if (obj_controller.cooldown<=0){ + // repeat(24-loca){i+=1; + // if (fy=1) and (scr_hit(xx+47,yy+107+why,xx+161,yy+122+why)=true){// Leftest + // if (ship[i]!=""){// Case 3: it is a later slot, ship + // if (onceh=0) and (ship_all[i]=0){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],true,i,attack);} + // if (onceh=0) and (ship_all[i]=1){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],false,i,attack);} + // } + // } + // if (fy=2) and (scr_hit(xx+164,yy+107+why,xx+278,yy+122+why)=true){// 2nd + // if (ship[i]!=""){ + // if (onceh=0) and (ship_all[i]=0){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],true,i,attack);} + // if (onceh=0) and (ship_all[i]=1){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],false,i,attack);} + // } + // } + // if (fy=3) and (scr_hit(xx+281,yy+107+why,xx+395,yy+122+why)=true){// 3rd + // if (ship[i]!=""){ + // if (onceh=0) and (ship_all[i]=0){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],true,i,attack);} + // if (onceh=0) and (ship_all[i]=1){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],false,i,attack);} + // } + // } + // if (fy=4) and (scr_hit(xx+398,yy+107+why,xx+512,yy+122+why)=true){// 4th + // if (ship[i]!=""){ + // if (onceh=0) and (ship_all[i]=0){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],true,i,attack);} + // if (onceh=0) and (ship_all[i]=1){onceh=1;obj_controller.cooldown=8000;scr_drop_fiddle(ship_ide[i],false,i,attack);} + // } + // } + // fy+=1;if (fy=5){fy=1;why+=18;} + // } + //} + + //if (obj_controller.cooldown <= 0) { + // if (mouse_x >= xx + 456) && (mouse_y >= yy + 378) && (mouse_x < xx + 519) && (mouse_y < yy + 403) { + // instance_destroy(); + // obj_controller.cooldown = 8000; + // } + + // if (mouse_x >= xx + 76) && (mouse_y >= yy + 82) && (mouse_x < xx + 102) && (mouse_y < yy + 95) { + // var onceh; + // once = 0; + // i = 0; + // if (all_sel = 0) && (onceh = 0) { + // var ships_len = array_length(ship); + // for (var i = 0; i < ships_len; i++) { + // if (ship[i] != "") && (ship_all[i] = 0) { + // ship_all[i] = 1; + // scr_drop_fiddle(ship_ide[i], true, i, attack); + // } + // } + // if (ship_all[500] = 0) && (l_size > 0) { + // ship_all[500] = 1; + // add_ground = 1; + // } + // onceh = 1; + // all_sel = 1; + // } + // if (all_sel = 1) && (onceh = 0) { + // var ships_len = array_length(ship); + // for (var i = 0; i < ships_len; i++) { + // if (ship[i] != "") && (ship_all[i] = 1) { + // ship_all[i] = 0; + // scr_drop_fiddle(ship_ide[i], false, i, attack); + // } + // } + // if (ship_all[500] = 1) && (l_size > 0) { + // ship_all[500] = 0; + // add_ground = -1; + // } + // onceh = 1; + // all_sel = 0; + // } + // } + //} + + //if (add_ground = 1) { + // ships_selected += 1; + // master += local_forces.master; + // honor += local_forces.honor; + // capts += local_forces.captains; + // mahreens += l_mahreens; + // veterans += l_veterans; + // terminators += l_terminators; + // dreads += l_dreads; + // chaplains += l_chaplains; + // psykers += l_psykers; + // apothecaries += l_apothecaries; + // techmarines += l_techmarines; + // champions += l_champions; + + // bikes += l_bikes; + // rhinos += l_rhinos; + // whirls += l_whirls; + // predators += l_predators; + // raiders += l_raiders; + // speeders += l_speeders; + //} + //if (add_ground = -1) { + // ships_selected -= 1; + // master -= local_forces.master; + // honor -= local_forces.honor; + // capts -= local_forces.captains; + // mahreens -= l_mahreens; + // veterans -= l_veterans; + // terminators -= l_terminators; + // dreads -= l_dreads; + // chaplains -= l_chaplains; + // psykers -= l_psykers; + // apothecaries -= l_apothecaries; + // techmarines -= l_techmarines; + // champions -= l_champions; + + // bikes -= l_bikes; + // rhinos -= l_rhinos; + // whirls -= l_whirls; + // predators -= l_predators; + // raiders -= l_raiders; + // speeders -= l_speeders; + //} + // END OF CODE REVIEWING } diff --git a/objects/obj_en_fleet/Draw_0.gml b/objects/obj_en_fleet/Draw_0.gml index 0402947b0c..428762f8b7 100644 --- a/objects/obj_en_fleet/Draw_0.gml +++ b/objects/obj_en_fleet/Draw_0.gml @@ -48,21 +48,21 @@ if (obj_controller.zoomed == 1) { // if (obj_controller.selected!=0) and (selected=1) then within=1; if (obj_controller.selecting_planet > 0) { - if ((mouse_x >= __view_get(e__VW.XView, 0) + 529) && (mouse_y >= __view_get(e__VW.YView, 0) + 234) && (mouse_x < __view_get(e__VW.XView, 0) + 611) && (mouse_y < __view_get(e__VW.YView, 0) + 249)) { + if ((mouse_x >= camera_get_view_x(view_camera[0]) + 529) && (mouse_y >= camera_get_view_y(view_camera[0]) + 234) && (mouse_x < camera_get_view_x(view_camera[0]) + 611) && (mouse_y < camera_get_view_y(view_camera[0]) + 249)) { if (instance_exists(obj_star_select)) { if (obj_star_select.button1 != "") { within = 0; } } } - if ((mouse_x >= __view_get(e__VW.XView, 0) + 529) && (mouse_y >= __view_get(e__VW.YView, 0) + 234 + 16) && (mouse_x < __view_get(e__VW.XView, 0) + 611) && (mouse_y < __view_get(e__VW.YView, 0) + 249 + 16)) { + if ((mouse_x >= camera_get_view_x(view_camera[0]) + 529) && (mouse_y >= camera_get_view_y(view_camera[0]) + 234 + 16) && (mouse_x < camera_get_view_x(view_camera[0]) + 611) && (mouse_y < camera_get_view_y(view_camera[0]) + 249 + 16)) { if (instance_exists(obj_star_select)) { if (obj_star_select.button2 != "") { within = 0; } } } - if ((mouse_x >= __view_get(e__VW.XView, 0) + 529) && (mouse_y >= __view_get(e__VW.YView, 0) + 234 + 32) && (mouse_x < __view_get(e__VW.XView, 0) + 611) && (mouse_y < __view_get(e__VW.YView, 0) + 249 + 32)) { + if ((mouse_x >= camera_get_view_x(view_camera[0]) + 529) && (mouse_y >= camera_get_view_y(view_camera[0]) + 234 + 32) && (mouse_x < camera_get_view_x(view_camera[0]) + 611) && (mouse_y < camera_get_view_y(view_camera[0]) + 249 + 32)) { if (instance_exists(obj_star_select)) { if (obj_star_select.button3 != "") { within = 0; diff --git a/objects/obj_event/Alarm_0.gml b/objects/obj_event/Alarm_0.gml index 38f4b5dc9d..7d6d07e34d 100644 --- a/objects/obj_event/Alarm_0.gml +++ b/objects/obj_event/Alarm_0.gml @@ -1,64 +1,96 @@ +var intro; +intro = ""; -var intro;intro=""; +if (obj_controller.fest_type == "Great Feast") { + if (obj_controller.fest_feasts == 0) { + obj_controller.fest_feasts += 1; + } + + if (obj_controller.fest_lav < 4) { + intro = "Once all are seated Chapter Serfs begin to ferry the covered main dish"; + } + if (obj_controller.fest_lav >= 4) { + intro = "Once all are seated Chapter Serfs begin to ferry the first of several dishes"; + } + + if ((obj_controller.fest_feature2 == 1) && (obj_controller.fest_feature3 == 0)) { + intro += " and alcohol"; + } + if ((obj_controller.fest_feature2 == 0) && (obj_controller.fest_feature3 == 1)) { + intro += " and drugs"; + } + if ((obj_controller.fest_feature2 == 1) && (obj_controller.fest_feature3 == 1)) { + intro += ", booze, and drugs"; + } + + intro += " into the room. This is "; -if (obj_controller.fest_type="Great Feast"){ - if (obj_controller.fest_feasts=0) then obj_controller.fest_feasts+=1; - - if (obj_controller.fest_lav<4) then intro="Once all are seated Chapter Serfs begin to ferry the covered main dish"; - if (obj_controller.fest_lav>=4) then intro="Once all are seated Chapter Serfs begin to ferry the first of several dishes"; - - if (obj_controller.fest_feature2=1) and (obj_controller.fest_feature3=0) then intro+=" and alcohol"; - if (obj_controller.fest_feature2=0) and (obj_controller.fest_feature3=1) then intro+=" and drugs"; - if (obj_controller.fest_feature2=1) and (obj_controller.fest_feature3=1) then intro+=", booze, and drugs"; - - intro+=" into the room. This is "; - - if (obj_controller.fest_feature2+obj_controller.fest_feature3>0) then intro+="all "; - intro+="placed front and center. A silver cloche is then removed, revealing "; - - if (obj_controller.fest_lav<=1){ - if (attendants<=50) then intro+="a large vat of stew, made up of Triglyceride Gel and grox meat."; - if (attendants>50) then intro+="several large vats of stew, made up of Triglyceride Gel and grox meat."; + if (obj_controller.fest_feature2 + obj_controller.fest_feature3 > 0) { + intro += "all "; } - if (obj_controller.fest_lav=2){ - if (attendants<=50) then intro+="an entire roast Grox, finely seasoned and flavored. Vegtables lay around the belly and feet of the beast."; - if (attendants>50) then intro+="several roast Grox, each finely seasoned and flavored. Vegtables lay around the bellies and feet of the beasts."; + intro += "placed front and center. A silver cloche is then removed, revealing "; + + if (obj_controller.fest_lav <= 1) { + if (attendants <= 50) { + intro += "a large vat of stew, made up of Triglyceride Gel and grox meat."; + } + if (attendants > 50) { + intro += "several large vats of stew, made up of Triglyceride Gel and grox meat."; + } + } + if (obj_controller.fest_lav == 2) { + if (attendants <= 50) { + intro += "an entire roast Grox, finely seasoned and flavored. Vegtables lay around the belly and feet of the beast."; + } + if (attendants > 50) { + intro += "several roast Grox, each finely seasoned and flavored. Vegtables lay around the bellies and feet of the beasts."; + } } - if (obj_controller.fest_lav=3){ - if (attendants<=105) then intro+="a massive, roasted Borreron Terrorwing, maronated in Dammassine and filled with stuffing."; - if (attendants>105) then intro+="a pair of roasted Borreron Terrorwings, each maronated in Dammassine and filled with stuffing."; + if (obj_controller.fest_lav == 3) { + if (attendants <= 105) { + intro += "a massive, roasted Borreron Terrorwing, maronated in Dammassine and filled with stuffing."; + } + if (attendants > 105) { + intro += "a pair of roasted Borreron Terrorwings, each maronated in Dammassine and filled with stuffing."; + } } - if (obj_controller.fest_lav=4){ - intro+="cheese and wine Hors d'oeuvre and pasties, the small, bite-size edibles decorated with a flourish."; - part2="fish"; + if (obj_controller.fest_lav == 4) { + intro += "cheese and wine Hors d'oeuvre and pasties, the small, bite-size edibles decorated with a flourish."; + part2 = "fish"; } - if (obj_controller.fest_lav>=5){ - if (attendants<=50) then intro+="a large plater of mediterranean Grox salad, with nuts and sliced pears."; - if (attendants>50) then intro+="several platers of mediterranean Grox salad, with nuts and sliced pears."; - part2="fruit";part3="lobster"; + if (obj_controller.fest_lav >= 5) { + if (attendants <= 50) { + intro += "a large plater of mediterranean Grox salad, with nuts and sliced pears."; + } + if (attendants > 50) { + intro += "several platers of mediterranean Grox salad, with nuts and sliced pears."; + } + part2 = "fruit"; + part3 = "lobster"; } - - - if (obj_controller.fest_feature2 == 1){ + + if (obj_controller.fest_feature2 == 1) { var boozer_type = 1; - if ( - (global.chapter_name="Space Wolves") || (obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) - ) { + if ((global.chapter_name == "Space Wolves") || (obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES)) { boozer_type = 2; } - if ( - (global.chapter_name="Blood Angels") || (obj_ini.progenitor == ePROGENITOR.BLOOD_ANGELS) - ) { + if ((global.chapter_name == "Blood Angels") || (obj_ini.progenitor == ePROGENITOR.BLOOD_ANGELS)) { boozer_type = 3; } - - if (boozer_type=1) then intro+=" Also provided is well-aged, finely distilled Amasec."; - if (boozer_type=2) and (global.chapter_name!="Space Wolves") then intro+=" Also provided is Fenrir-imported Mjod, favored by the sons of Russ."; - if (boozer_type=2) and (global.chapter_name="Space Wolves") then intro+=" Also provided is Mjod, favored by the sons of Russ."; - if (boozer_type=3) then intro+=" Many types of alcohol have also been provided in small tasting glasses. Amasec, Dammassine, and half a dozen other kinds have all been provided."; + + if (boozer_type == 1) { + intro += " Also provided is well-aged, finely distilled Amasec."; + } + if ((boozer_type == 2) && (global.chapter_name != "Space Wolves")) { + intro += " Also provided is Fenrir-imported Mjod, favored by the sons of Russ."; + } + if ((boozer_type == 2) && (global.chapter_name == "Space Wolves")) { + intro += " Also provided is Mjod, favored by the sons of Russ."; + } + if (boozer_type == 3) { + intro += " Many types of alcohol have also been provided in small tasting glasses. Amasec, Dammassine, and half a dozen other kinds have all been provided."; + } } - + scr_event_newlines(intro); } - - diff --git a/objects/obj_event/Create_0.gml b/objects/obj_event/Create_0.gml index b668b807b5..80cc3c704a 100644 --- a/objects/obj_event/Create_0.gml +++ b/objects/obj_event/Create_0.gml @@ -1,56 +1,86 @@ +fading = 1; +fade_alpha = 0; +textt = ""; +time_min = 0; +lines_acted = 0; +liness = 0; +time_at = 0; +time_min = 0; +time_max = 100; +part2 = ""; +part3 = ""; +exit_fade = -1; +closing = false; -fading=1;fade_alpha=0;textt=""; -time_min=0;lines_acted=0;liness=0; -time_at=0;time_min=0;time_max=100; -part2="";part3=""; -exit_fade=-1;closing=false; +attendants = 0; +avatars = 0; +var i; +i = -1; +repeat (2501) { + i += 1; + attend_co[i] = 0; + attend_id[i] = 0; + attend_mood[i] = ""; + attend_corrupted[i] = 0; + attend_feasted[i] = 0; + attend_drunk[i] = 0; + attend_high[i] = 0; + attend_confused[i] = 0; + attend_actioned[i] = 0; + attend_corruption[i] = 0; + attend_race[i] = 0; + attend_displayed[i] = 0; // Set to 1 - -attendants=0;avatars=0; -var i;i=-1; -repeat(2501){i+=1; - attend_co[i]=0;attend_id[i]=0;attend_mood[i]="";attend_corrupted[i]=0; - attend_feasted[i]=0;attend_drunk[i]=0;attend_high[i]=0;attend_confused[i]=0;attend_actioned[i]=0; - attend_corruption[i]=0;attend_race[i]=0;attend_displayed[i]=0;// Set to 1 - - if (i<=10){ - avatar_name[i]=""; - avatar_rank[i]=""; - avatar_image[i]=0; - avatar_co[i]=0; - avatar_id[i]=0; + if (i <= 10) { + avatar_name[i] = ""; + avatar_rank[i] = ""; + avatar_image[i] = 0; + avatar_co[i] = 0; + avatar_id[i] = 0; } - if (i<=20){ - line[i]=""; + if (i <= 20) { + line[i] = ""; } } -lines=0; - +lines = 0; -main_color=obj_ini.main_color; -secondary_color=obj_ini.secondary_color; -main_trim=obj_ini.main_trim; -left_pauldron=obj_ini.left_pauldron; -right_pauldron=obj_ini.right_pauldron; -lens_color=obj_ini.lens_color; -weapon_color=obj_ini.weapon_color; -col_special=obj_ini.col_special; -trim=obj_ini.trim; +main_color = obj_ini.main_color; +secondary_color = obj_ini.secondary_color; +main_trim = obj_ini.main_trim; +left_pauldron = obj_ini.left_pauldron; +right_pauldron = obj_ini.right_pauldron; +lens_color = obj_ini.lens_color; +weapon_color = obj_ini.weapon_color; +col_special = obj_ini.col_special; +trim = obj_ini.trim; -stage=5;ticks=-120;ticked=0; -next_display=90;total_displayed=0; +stage = 5; +ticks = -120; +ticked = 0; +next_display = 90; +total_displayed = 0; scr_colors_initialize(); scr_shader_initialize(); - -if (obj_controller.fest_display>0){var q,yep;q=0;yep=0; - if (obj_ini.artifact_tags[obj_controller.fest_display]!=obj_controller.fest_display_tags){ - repeat(20){q+=1;if (yep=0){if (obj_ini.artifact_tags[q]=obj_controller.fest_display_tags) then yep=q;}} - if (yep>0) then obj_controller.fest_display=q; - if (yep=0) then obj_controller.fest_display=0; +if (obj_controller.fest_display > 0) { + var q, yep; + q = 0; + yep = 0; + if (obj_ini.artifact_tags[obj_controller.fest_display] != obj_controller.fest_display_tags) { + repeat (20) { + q += 1; + if (yep == 0) { + if (obj_ini.artifact_tags[q] == obj_controller.fest_display_tags) { + yep = q; + } + } + } + if (yep > 0) { + obj_controller.fest_display = q; + } + if (yep == 0) { + obj_controller.fest_display = 0; + } } } - - - diff --git a/objects/obj_event/Draw_0.gml b/objects/obj_event/Draw_0.gml index f9b5fd1e90..d144c11131 100644 --- a/objects/obj_event/Draw_0.gml +++ b/objects/obj_event/Draw_0.gml @@ -1,98 +1,104 @@ - -var xx,yy,ii; -xx=__view_get( e__VW.XView, 0 )+317; -yy=__view_get( e__VW.YView, 0 )+144; -ii=0; +var xx, yy, ii; +xx = camera_get_view_x(view_camera[0]) + 317; +yy = camera_get_view_y(view_camera[0]) + 144; +ii = 0; draw_set_alpha(fade_alpha); // BG -draw_sprite(spr_popup_event,0,xx,yy); -draw_sprite(spr_popup_event,1,xx,yy); +draw_sprite(spr_popup_event, 0, xx, yy); +draw_sprite(spr_popup_event, 1, xx, yy); // Draw avatars here -var x5,y5; -x5=xx+15-120; -y5=yy+482; - -ii=0; +var x5, y5; +x5 = xx + 15 - 120; +y5 = yy + 482; +ii = 0; draw_set_color(0); draw_set_font(fnt_40k_30b); draw_set_halign(fa_center); // draw_text(view_xview[0]+800,view_yview[0]+165,string(obj_controller.fest_type)+"#"+string(obj_controller.fest_display)+"] "+string(obj_controller.fest_display_tags)); -draw_text(__view_get( e__VW.XView, 0 )+800,__view_get( e__VW.YView, 0 )+165,string_hash_to_newline(string(obj_controller.fest_type))); +draw_text(camera_get_view_x(view_camera[0]) + 800, camera_get_view_y(view_camera[0]) + 165, string_hash_to_newline(string(obj_controller.fest_type))); -if (avatars>0){ - if( shader_is_compiled(sReplaceColor)){ +if (avatars > 0) { + if (shader_is_compiled(sReplaceColor)) { shader_set(sReplaceColor); - - shader_set_uniform_f_array(colour_to_find1, body_colour_find ); - shader_set_uniform_f_array(colour_to_set1, body_colour_replace ); - shader_set_uniform_f_array(colour_to_find2, secondary_colour_find ); - shader_set_uniform_f_array(colour_to_set2, secondary_colour_replace ); - shader_set_uniform_f_array(colour_to_find3, pauldron_colour_find ); - shader_set_uniform_f_array(colour_to_set3, pauldron_colour_replace ); - shader_set_uniform_f_array(colour_to_find4, lens_colour_find ); - shader_set_uniform_f_array(colour_to_set4, lens_colour_replace ); - shader_set_uniform_f_array(colour_to_find5, trim_colour_find ); - shader_set_uniform_f_array(colour_to_set5, trim_colour_replace ); - shader_set_uniform_f_array(colour_to_find6, pauldron2_colour_find ); - shader_set_uniform_f_array(colour_to_set6, pauldron2_colour_replace ); - shader_set_uniform_f_array(colour_to_find7, weapon_colour_find ); - shader_set_uniform_f_array(colour_to_set7, weapon_colour_replace ); + + shader_set_uniform_f_array(colour_to_find1, body_colour_find); + shader_set_uniform_f_array(colour_to_set1, body_colour_replace); + shader_set_uniform_f_array(colour_to_find2, secondary_colour_find); + shader_set_uniform_f_array(colour_to_set2, secondary_colour_replace); + shader_set_uniform_f_array(colour_to_find3, pauldron_colour_find); + shader_set_uniform_f_array(colour_to_set3, pauldron_colour_replace); + shader_set_uniform_f_array(colour_to_find4, lens_colour_find); + shader_set_uniform_f_array(colour_to_set4, lens_colour_replace); + shader_set_uniform_f_array(colour_to_find5, trim_colour_find); + shader_set_uniform_f_array(colour_to_set5, trim_colour_replace); + shader_set_uniform_f_array(colour_to_find6, pauldron2_colour_find); + shader_set_uniform_f_array(colour_to_set6, pauldron2_colour_replace); + shader_set_uniform_f_array(colour_to_find7, weapon_colour_find); + shader_set_uniform_f_array(colour_to_set7, weapon_colour_replace); } - + draw_set_font(fnt_40k_14b); draw_set_halign(fa_center); draw_set_color(c_black); - - repeat(8){ii+=1;x5+=120; - if (avatar_name[ii]!=""){ + + repeat (8) { + ii += 1; + x5 += 120; + if (avatar_name[ii] != "") { // draw_sprite(spr_popup_event_avatar,avatar_image[ii],x5,y5); - scr_image("event",avatar_image[ii],x5,y5,97,95); - draw_text_transformed(x5+47,y5+99,string_hash_to_newline(string(avatar_name[ii])),0.75,1,0); + scr_image("event", avatar_image[ii], x5, y5, 97, 95); + draw_text_transformed(x5 + 47, y5 + 99, string_hash_to_newline(string(avatar_name[ii])), 0.75, 1, 0); // draw_text(x5+45,y5+100,string(avatar_name[ii])+"#"+string(avatar_rank[ii])); } } - + shader_reset(); - } +draw_set_color(c_black); +draw_rectangle(xx + 25, yy + 102, xx + 940, yy + 106, 1); +draw_set_color(c_blue); +draw_rectangle(xx + 25, yy + 102, xx + 25 + ((time_at / time_max) * 915), yy + 106, 0); -draw_set_color(c_black);draw_rectangle(xx+25,yy+102,xx+940,yy+106,1); -draw_set_color(c_blue);draw_rectangle(xx+25,yy+102,xx+25+((time_at/time_max)*915),yy+106,0); +draw_set_halign(fa_left); +draw_set_font(fnt_40k_14); -draw_set_halign(fa_left);draw_set_font(fnt_40k_14); +if (exit_fade >= 0) { + var ealpha; + ealpha = exit_fade / 30; + draw_set_alpha(min(fade_alpha, ealpha)); - -if (exit_fade>=0){ - var ealpha;ealpha=exit_fade/30; - draw_set_alpha(min(fade_alpha,ealpha)); - - if (exit_fade<30) then draw_sprite(spr_help_exit,0,__view_get( e__VW.XView, 0 )+1238,__view_get( e__VW.YView, 0 )+200); - if (exit_fade>=30){ - draw_set_alpha(min(fade_alpha,1)); - if (scr_hit(__view_get( e__VW.XView, 0 )+1238,__view_get( e__VW.YView, 0 )+200,__view_get( e__VW.XView, 0 )+1271,__view_get( e__VW.YView, 0 )+233)=false) then draw_sprite(spr_help_exit,0,__view_get( e__VW.XView, 0 )+1238,__view_get( e__VW.YView, 0 )+200); - if (scr_hit(__view_get( e__VW.XView, 0 )+1238,__view_get( e__VW.YView, 0 )+200,__view_get( e__VW.XView, 0 )+1271,__view_get( e__VW.YView, 0 )+233)=true){ - draw_sprite(spr_help_exit,1,__view_get( e__VW.XView, 0 )+1238,__view_get( e__VW.YView, 0 )+200); - if (scr_click_left()) and (closing=false){ - closing=true;fading=-1; + if (exit_fade < 30) { + draw_sprite(spr_help_exit, 0, camera_get_view_x(view_camera[0]) + 1238, camera_get_view_y(view_camera[0]) + 200); + } + if (exit_fade >= 30) { + draw_set_alpha(min(fade_alpha, 1)); + if (scr_hit(camera_get_view_x(view_camera[0]) + 1238, camera_get_view_y(view_camera[0]) + 200, camera_get_view_x(view_camera[0]) + 1271, camera_get_view_y(view_camera[0]) + 233) == false) { + draw_sprite(spr_help_exit, 0, camera_get_view_x(view_camera[0]) + 1238, camera_get_view_y(view_camera[0]) + 200); + } + if (scr_hit(camera_get_view_x(view_camera[0]) + 1238, camera_get_view_y(view_camera[0]) + 200, camera_get_view_x(view_camera[0]) + 1271, camera_get_view_y(view_camera[0]) + 233) == true) { + draw_sprite(spr_help_exit, 1, camera_get_view_x(view_camera[0]) + 1238, camera_get_view_y(view_camera[0]) + 200); + if (scr_click_left() && (closing == false)) { + closing = true; + fading = -1; } } } draw_set_alpha(1); } - draw_set_color(c_gray); draw_set_alpha(fade_alpha); -ii=0;y5=yy+120-21; -repeat(17){y5+=21;ii+=1; - draw_text_ext(xx+25,y5,string_hash_to_newline(string(line[ii])),-1,916); +ii = 0; +y5 = yy + 120 - 21; +repeat (17) { + y5 += 21; + ii += 1; + draw_text_ext(xx + 25, y5, string_hash_to_newline(string(line[ii])), -1, 916); } draw_set_alpha(1); - - diff --git a/objects/obj_event/Step_0.gml b/objects/obj_event/Step_0.gml index 1cc544cc36..9e392c0b5c 100644 --- a/objects/obj_event/Step_0.gml +++ b/objects/obj_event/Step_0.gml @@ -1,336 +1,507 @@ - -if (fading=1) and (fade_alpha<1) then fade_alpha+=0.025; -if (fading=-1) and (fade_alpha>0) then fade_alpha-=0.025; -if (time_at 0)) { + fade_alpha -= 0.025; +} +if (time_at < time_min) { + time_at += 0.25; +} // if (time_at>=time_max) and (stage!=10) then stage=10; -if (exit_fade>=0) and (exit_fade<30) then exit_fade+=1; +if ((exit_fade >= 0) && (exit_fade < 30)) { + exit_fade += 1; +} -if (closing=true) and (fading=-1) and (fade_alpha<=0){ - if (obj_controller.fest_type="Great Feast"){ - if (obj_controller.fest_feature1=1) then obj_controller.fest_feasts+=1; - if (obj_controller.fest_feature2=1) then obj_controller.fest_boozes+=1; - if (obj_controller.fest_feature3=1) then obj_controller.fest_drugses+=1; +if ((closing == true) && (fading == -1) && (fade_alpha <= 0)) { + if (obj_controller.fest_type == "Great Feast") { + if (obj_controller.fest_feature1 == 1) { + obj_controller.fest_feasts += 1; + } + if (obj_controller.fest_feature2 == 1) { + obj_controller.fest_boozes += 1; + } + if (obj_controller.fest_feature3 == 1) { + obj_controller.fest_drugses += 1; + } } - - var ide=0, unit; - repeat(700){ide+=1; + + var ide = 0, unit; + repeat (700) { + ide += 1; unit = obj_ini.TTRPG[attend_co[ide]][attend_id[ide]]; - if (attend_corrupted[ide]=0) and (attend_id[ide]>0){ - if (array_contains(obj_ini.artifact_tags[obj_controller.fest_display],"chaos")){ - unit.corruption+=choose(1,2,3,4); + if ((attend_corrupted[ide] == 0) && (attend_id[ide] > 0)) { + if (array_contains(obj_ini.artifact_tags[obj_controller.fest_display], "chaos")) { + unit.corruption += choose(1, 2, 3, 4); } - if (array_contains(obj_ini.artifact_tags[obj_controller.fest_display],"daemonic")){ - unit.corruption+=choose(6,7,8,9); - } - attend_corrupted[ide]=1; + if (array_contains(obj_ini.artifact_tags[obj_controller.fest_display], "daemonic")) { + unit.corruption += choose(6, 7, 8, 9); + } + attend_corrupted[ide] = 1; } } - - obj_controller.fest_repeats-=1; - if (obj_controller.fest_repeats<=0){ - obj_controller.fest_scheduled=0; - - var p1,p2,p3; - p1=obj_controller.fest_type; - p3=""; - p2=obj_controller.fest_planet; - - if (p2>0) then p3=string(obj_controller.fest_star)+" "+scr_roman(obj_controller.fest_wid); - if (p2<=0) then p3=+" the vessel '"+string(obj_ini.ship[obj_controller.fest_sid])+"'"; - - scr_alert("green","event",string(p1)+" on "+string(p3)+" ends.",0,0); - scr_event_log("green",string(p1)+" on "+string(p3)+" ends.", p3); + + obj_controller.fest_repeats -= 1; + if (obj_controller.fest_repeats <= 0) { + obj_controller.fest_scheduled = 0; + + var p1, p2, p3; + p1 = obj_controller.fest_type; + p3 = ""; + p2 = obj_controller.fest_planet; + + if (p2 > 0) { + p3 = string(obj_controller.fest_star) + " " + scr_roman(obj_controller.fest_wid); + } + if (p2 <= 0) { + p3 = +" the vessel '" + string(obj_ini.ship[obj_controller.fest_sid]) + "'"; + } + + scr_alert("green", "event", string(p1) + " on " + string(p3) + " ends.", 0, 0); + scr_event_log("green", string(p1) + " on " + string(p3) + " ends.", p3); } - - with(obj_popup){ - if (number!=0) then obj_turn_end.alarm[1]=10; + + with (obj_popup) { + if (number != 0) { + obj_turn_end.alarm[1] = 10; + } instance_destroy(); } - obj_controller.cooldown=30; + obj_controller.cooldown = 30; instance_destroy(); } -if (stage>=5) and (stage!=10){ticks+=1; - if (ticks>=next_display){ - ticks=0;ticked=1; +if ((stage >= 5) && (stage != 10)) { + ticks += 1; + if (ticks >= next_display) { + ticks = 0; + ticked = 1; } } -if (ticked=1){// Select a random marine and have them perform an action - if (lines_acted=18) and (exit_fade<=-1) then exit_fade=0; +if (ticked == 1) { + // Select a random marine and have them perform an action + if ((lines_acted == 18) && (exit_fade <= -1)) { + exit_fade = 0; + } - if (lines_acted=18) and (part2!=""){ - if (part2="fish"){ - if (attendants<=30) then textt="Chapter Serfs ferry out several large, covered dishes, the scent of seafood filling the air. Once they are set front and center the silver cloches are removed, revealing a banquet of exotic fish. Raw rolls of meat with rice, pufferfish, and even a massive broadbill are contained within."; - if (attendants>30) then textt="Chapter Serfs ferry out several large, covered dishes, the scent of seafood filling the air. Once they are set front and center the silver cloches are removed, revealing a banquet of exotic fish. Raw rolls of meat with rice, pufferfish, and several massive broadbill are contained within."; + if ((lines_acted == 18) && (part2 != "")) { + if (part2 == "fish") { + if (attendants <= 30) { + textt = "Chapter Serfs ferry out several large, covered dishes, the scent of seafood filling the air. Once they are set front and center the silver cloches are removed, revealing a banquet of exotic fish. Raw rolls of meat with rice, pufferfish, and even a massive broadbill are contained within."; + } + if (attendants > 30) { + textt = "Chapter Serfs ferry out several large, covered dishes, the scent of seafood filling the air. Once they are set front and center the silver cloches are removed, revealing a banquet of exotic fish. Raw rolls of meat with rice, pufferfish, and several massive broadbill are contained within."; + } } - if (part2="fruit"){ - textt="Chapter Serfs ferry out several large, covered bowls. Without further adeiu the lids are removed, revealing a large bounty of exotic fruits from across the galaxy. Ploin, pineapple, mangos, strawberries, the fruit ranges from commonplace to nearly disappeared treasures."; + if (part2 == "fruit") { + textt = "Chapter Serfs ferry out several large, covered bowls. Without further adeiu the lids are removed, revealing a large bounty of exotic fruits from across the galaxy. Ploin, pineapple, mangos, strawberries, the fruit ranges from commonplace to nearly disappeared treasures."; } scr_event_newlines(textt); - lines_acted+=1;time_min+=10;ticks=-120; - ticked=0;stage=6;textt="";exit; + lines_acted += 1; + time_min += 10; + ticks = -120; + ticked = 0; + stage = 6; + textt = ""; + exit; } - if (lines_acted=36) and (part3!=""){ - if (part3="lobster"){ - textt="A small army of Chapter Serfs and servitors enter the room, carrying with them a truly massive silver plate. Bore much like a palanquin, the massive dish is covered by an equally large and decorated cloche. As the main course inches across the room it gathers quite the number of looks. After struggling a bit the dish is set front and center in the room, the lid removed. Contained within is a giant, boiled Deathcoleri from Zeriah II. The once spikey carapace is now a healthily cooked red, the crustacean smelling absolutely delicious."; + if ((lines_acted == 36) && (part3 != "")) { + if (part3 == "lobster") { + textt = "A small army of Chapter Serfs and servitors enter the room, carrying with them a truly massive silver plate. Bore much like a palanquin, the massive dish is covered by an equally large and decorated cloche. As the main course inches across the room it gathers quite the number of looks. After struggling a bit the dish is set front and center in the room, the lid removed. Contained within is a giant, boiled Deathcoleri from Zeriah II. The once spikey carapace is now a healthily cooked red, the crustacean smelling absolutely delicious."; } scr_event_newlines(textt); - lines_acted+=1;time_min+=10;ticks=-210; - ticked=0;stage=7;textt="";exit; + lines_acted += 1; + time_min += 10; + ticks = -210; + ticked = 0; + stage = 7; + textt = ""; + exit; } - - var ide,good,dire,orig,dice1,dice2,dice3,dice4,txtt,rando,doso,activity; - good=false;doso=false;activity=""; - dire=0;orig=0;rando=choose(1,2); - dice1=floor(random(100))+1; - dice2=floor(random(100))+1; - dice3=floor(random(100))+1; + var ide, good, dire, orig, dice1, dice2, dice3, dice4, txtt, rando, doso, activity; + good = false; + doso = false; + activity = ""; + dire = 0; + orig = 0; + rando = choose(1, 2); + dice1 = floor(random(100)) + 1; + dice2 = floor(random(100)) + 1; + dice3 = floor(random(100)) + 1; var unit = obj_ini.TTRPG[attend_co[ide]][attend_id[ide]]; - - repeat(20){ - if (good=false){ - good=true;ide=floor(random(attendants))+1; - if (unit.IsSpecialist(SPECIALISTS_HEADS)) then good=false; + + repeat (20) { + if (good == false) { + good = true; + ide = floor(random(attendants)) + 1; + if (unit.IsSpecialist(SPECIALISTS_HEADS)) { + good = false; + } } } - if (good=false) then good=true; - - + if (good == false) { + good = true; + } + // If this marine has already acted then look for a nearby marine that has yet to act - if (attend_displayed[ide]>0){ - if (attend_displayed[ide]<=attendants/2) then dire=-1; - if (attend_displayed[ide]>attendants/2) then dire=1; - orig=ide; + if (attend_displayed[ide] > 0) { + if (attend_displayed[ide] <= attendants / 2) { + dire = -1; + } + if (attend_displayed[ide] > attendants / 2) { + dire = 1; + } + orig = ide; } - + // Cycle downward - if (dire=-1){good=false; - var resp;resp=ide; - - repeat(resp){ - if (good=false){ide-=1; - if (attend_displayed[ide]=0) then good=true; + if (dire == -1) { + good = false; + var resp; + resp = ide; + + repeat (resp) { + if (good == false) { + ide -= 1; + if (attend_displayed[ide] == 0) { + good = true; + } } } - - if (good=false) then dire=1; - if (good=true) then dire=0; + + if (good == false) { + dire = 1; + } + if (good == true) { + dire = 0; + } } - + // Cycle upward - if (dire=1){good=false; - var resp;resp=attendants; - - repeat(resp){ - if (good=false){ide+=1; - if (attend_displayed[ide]=0) then good=true; + if (dire == 1) { + good = false; + var resp; + resp = attendants; + + repeat (resp) { + if (good == false) { + ide += 1; + if (attend_displayed[ide] == 0) { + good = true; + } } } - } - - if (dire!=0) and (good=false){ide=orig;good=true;} - - if (attend_confused[ide]>0){ - if (dice1<=70){ - if (obj_controller.fest_type="Great Feast"){ - doso=false;activity="confused"; + + if ((dire != 0) && (good == false)) { + ide = orig; + good = true; + } + + if (attend_confused[ide] > 0) { + if (dice1 <= 70) { + if (obj_controller.fest_type == "Great Feast") { + doso = false; + activity = "confused"; } } - if (dice1>70) then doso=true; + if (dice1 > 70) { + doso = true; + } + } + if ((attend_confused[ide] <= 0) && (activity == "")) { + doso = true; } - if (attend_confused[ide]<=0) and (activity="") then doso=true; var unit = obj_ini.TTRPG[attend_co[ide]][attend_id[ide]]; - if (doso=true){ - dice1=floor(random(100))+1; - dice2=floor(random(100))+1; - dice3=floor(random(100))+1; - dice4=floor(random(100))+1; - - if (obj_controller.fest_type="Great Feast"){// Get chances of random crap when in a Great Feast - var mod1,mod2,mod3,rep1,rep2,rep3; - mod1=0;mod2=0;mod3=0; - - rep1=1;// attend_feasted[ide]+1; - rep2=attend_drunk[ide]+1; - rep3=attend_high[ide]+1; - - mod2=unit.corruption/5; - mod3=unit.corruption/10; - - activity="talk"; - + if (doso == true) { + dice1 = floor(random(100)) + 1; + dice2 = floor(random(100)) + 1; + dice3 = floor(random(100)) + 1; + dice4 = floor(random(100)) + 1; + + if (obj_controller.fest_type == "Great Feast") { + // Get chances of random crap when in a Great Feast + var mod1, mod2, mod3, rep1, rep2, rep3; + mod1 = 0; + mod2 = 0; + mod3 = 0; + + rep1 = 1; // attend_feasted[ide]+1; + rep2 = attend_drunk[ide] + 1; + rep3 = attend_high[ide] + 1; + + mod2 = unit.corruption / 5; + mod3 = unit.corruption / 10; + + activity = "talk"; + // show_message("roll needed for eating: >="+string((((obj_controller.fest_feasts*30)-10)+mod1)/rep1)+", rolled:"+string(dice1)); - if (dice3<=min(75,(((obj_controller.fest_drugses*10)-10)+mod3)/rep3)) and (obj_controller.fest_feature3>0) then activity="drugs"; - if (dice2<=min(75,(((obj_controller.fest_boozes*20)-10)+mod2)/rep2)) and (obj_controller.fest_feature2>0) then activity="drink"; - if (dice1<=min(75,(((obj_controller.fest_feasts*30))+mod1)/rep1)) and (obj_controller.fest_feature1>0) then activity="eat"; - if ( - ( - (global.chapter_name="Space Wolves") || - (obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) - ) && - (obj_controller.fest_feature2 > 0) && - activity != "drink" - ) { - rando=choose(1,1,2); - if (rando=2) { activity="drink"; } - } - rando=choose(1,2,3,4,5,6,7,8,9,10); - if (rando>=8) then activity="talk"; - - if (obj_controller.fest_display>0) and (dice4<=15){ - activity="artifact"; - } - + if ((dice3 <= min(75, (((obj_controller.fest_drugses * 10) - 10) + mod3) / rep3)) && (obj_controller.fest_feature3 > 0)) { + activity = "drugs"; + } + if ((dice2 <= min(75, (((obj_controller.fest_boozes * 20) - 10) + mod2) / rep2)) && (obj_controller.fest_feature2 > 0)) { + activity = "drink"; + } + if ((dice1 <= min(75, ((obj_controller.fest_feasts * 30) + mod1) / rep1)) && (obj_controller.fest_feature1 > 0)) { + activity = "eat"; + } + if (((global.chapter_name == "Space Wolves") || (obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES)) && (obj_controller.fest_feature2 > 0) && activity != "drink") { + rando = choose(1, 1, 2); + if (rando == 2) { + activity = "drink"; + } + } + rando = choose(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + if (rando >= 8) { + activity = "talk"; + } + + if ((obj_controller.fest_display > 0) && (dice4 <= 15)) { + activity = "artifact"; + } } } - - if (activity="confused"){ - rando=choose(1,2,2,3); - if (rando=1) then textt=unit.name_role()+" is unsure of what to do. He sits at the table silently, doing nothing."; - if (rando=2) then textt=unit.name_role()+" is confused. He sits at the table and does nothing, wishing he were "+choose("killing xenos","praying","training","training","studying")+" instead."; - + + if (activity == "confused") { + rando = choose(1, 2, 2, 3); + if (rando == 1) { + textt = unit.name_role() + " is unsure of what to do. He sits at the table silently, doing nothing."; + } + if (rando == 2) { + textt = unit.name_role() + " is confused. He sits at the table and does nothing, wishing he were " + choose("killing xenos", "praying", "training", "training", "studying") + " instead."; + } + // Special CONFUS for the various event types - if (rando=3){ - if (obj_controller.fest_type="Great Feast") and (obj_controller.fest_feature1>0) then textt=unit.name_role()+" picks up silverwear to begin to feast, but then has second thoughts and puts them back down."; - if (obj_controller.fest_type="Great Feast") and (obj_controller.fest_feature1<=0) then textt=unit.name_role()+" is unsure of what to do. He sits at the table silently, doing nothing."; + if (rando == 3) { + if ((obj_controller.fest_type == "Great Feast") && (obj_controller.fest_feature1 > 0)) { + textt = unit.name_role() + " picks up silverwear to begin to feast, but then has second thoughts and puts them back down."; + } + if ((obj_controller.fest_type == "Great Feast") && (obj_controller.fest_feature1 <= 0)) { + textt = unit.name_role() + " is unsure of what to do. He sits at the table silently, doing nothing."; + } } - } - if (activity="eat"){ - var eater_type=1; - if (global.chapter_name="Space Wolves" || obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { eater_type=2; } - - if (stage=5) and (eater_type=1){rando=choose(1,2,3); - if (rando=1) then textt=unit.name_role()+" digs into the food and begins to eat."; - if (rando=2) then textt=unit.name_role()+" begins to feast, eating the food slowly to enjoy the taste."; - if (rando=3) then textt=unit.name_role()+" grabs a portion of food for himself and begins to eat."; - } - if (stage=5) and (eater_type=2){rando=choose(1,2,3); - if (rando=1) then textt=unit.name_role()+" digs into the food and begins to eat."; - if (rando=2) then textt=unit.name_role()+" makes a show out of eating, consuming the food as loudly and dramaticaly as possible."; - if (rando=3) then textt=unit.name_role()+" begins to stuff their face full of food, hardly bothering to chew."; - } - if (stage=6){ - if (part2="fish"){rando=choose(1,2,3,3,3); - if (rando=1) then textt=unit.name_role()+" selects some of the sushi rolls and begins to pop them into his mouth."; - if (rando=2) then textt=unit.name_role()+" chooses a bit of each dish, chapter serfs setting up quite the variety of foods on his plate."; - if (rando=3) then textt=unit.name_role()+" grabs a portion of the broadbill and begins to eat it slowly, savoring the taste."; - } - if (part2="fruit"){rando=choose(1,2,3,3,3); - if (rando=1) then textt=unit.name_role()+" selects an assortment of fruit and begins to eat."; - if (rando=2) then textt=unit.name_role()+" finishes up the rest of his plate, and hails a serf to bring him some "+choose("pineapple","strawberries","grapes","apples","oranges","of each fruit")+"."; - if (rando=3) then textt=unit.name_role()+" hails a chapter serf, and orders a variety of different fruits. He then eats them slowly, enjoying the taste."; - } - } - if (stage=7){ - if (part3="lobster"){ - rando=choose(1,2,2,3,3); - if (eater_type=2) then rando=choose(1,2,2,3,3,4); - if (rando=1) then textt=unit.name_role()+" helps break open one of the massive legs of the Deathcoleri, then scoops out some of the meat within."; - if (rando=2) and (eater_type=1) then textt=unit.name_role()+" tears some of the tendrils free from the crustacean and begins to eat them."; - if (rando=3) and (eater_type=1) then textt=unit.name_role()+" rips some of the delectable meat free from the Deathcoleri's leg, and then eats it slowly, enjoying the treat."; - if (rando=2) and (eater_type=2) then textt=unit.name_role()+" begins to shovel Deathcoleri meat down his throat, boasting that he will eat more than anyone else."; - if (rando=3) and (eater_type=2) then textt=unit.name_role()+" rips tendrils free from the crustaceans face and begins to eat them, loudly."; - if (rando=4) then text=unit.name_role()+" wants the good parts. He shoves his arm through the beast's shell and scoops out the innards, taking some for himself and sharing other bits."; + if (activity == "eat") { + var eater_type = 1; + if (global.chapter_name == "Space Wolves" || obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { + eater_type = 2; + } + + if ((stage == 5) && (eater_type == 1)) { + rando = choose(1, 2, 3); + if (rando == 1) { + textt = unit.name_role() + " digs into the food and begins to eat."; + } + if (rando == 2) { + textt = unit.name_role() + " begins to feast, eating the food slowly to enjoy the taste."; + } + if (rando == 3) { + textt = unit.name_role() + " grabs a portion of food for himself and begins to eat."; } } - - attend_feasted[ide]+=1; + if ((stage == 5) && (eater_type == 2)) { + rando = choose(1, 2, 3); + if (rando == 1) { + textt = unit.name_role() + " digs into the food and begins to eat."; + } + if (rando == 2) { + textt = unit.name_role() + " makes a show out of eating, consuming the food as loudly and dramaticaly as possible."; + } + if (rando == 3) { + textt = unit.name_role() + " begins to stuff their face full of food, hardly bothering to chew."; + } + } + if (stage == 6) { + if (part2 == "fish") { + rando = choose(1, 2, 3, 3, 3); + if (rando == 1) { + textt = unit.name_role() + " selects some of the sushi rolls and begins to pop them into his mouth."; + } + if (rando == 2) { + textt = unit.name_role() + " chooses a bit of each dish, chapter serfs setting up quite the variety of foods on his plate."; + } + if (rando == 3) { + textt = unit.name_role() + " grabs a portion of the broadbill and begins to eat it slowly, savoring the taste."; + } + } + if (part2 == "fruit") { + rando = choose(1, 2, 3, 3, 3); + if (rando == 1) { + textt = unit.name_role() + " selects an assortment of fruit and begins to eat."; + } + if (rando == 2) { + textt = unit.name_role() + " finishes up the rest of his plate, and hails a serf to bring him some " + choose("pineapple", "strawberries", "grapes", "apples", "oranges", "of each fruit") + "."; + } + if (rando == 3) { + textt = unit.name_role() + " hails a chapter serf, and orders a variety of different fruits. He then eats them slowly, enjoying the taste."; + } + } + } + if (stage == 7) { + if (part3 == "lobster") { + rando = choose(1, 2, 2, 3, 3); + if (eater_type == 2) { + rando = choose(1, 2, 2, 3, 3, 4); + } + if (rando == 1) { + textt = unit.name_role() + " helps break open one of the massive legs of the Deathcoleri, then scoops out some of the meat within."; + } + if ((rando == 2) && (eater_type == 1)) { + textt = unit.name_role() + " tears some of the tendrils free from the crustacean and begins to eat them."; + } + if ((rando == 3) && (eater_type == 1)) { + textt = unit.name_role() + " rips some of the delectable meat free from the Deathcoleri's leg, and then eats it slowly, enjoying the treat."; + } + if ((rando == 2) && (eater_type == 2)) { + textt = unit.name_role() + " begins to shovel Deathcoleri meat down his throat, boasting that he will eat more than anyone else."; + } + if ((rando == 3) && (eater_type == 2)) { + textt = unit.name_role() + " rips tendrils free from the crustaceans face and begins to eat them, loudly."; + } + if (rando == 4) { + text = unit.name_role() + " wants the good parts. He shoves his arm through the beast's shell and scoops out the innards, taking some for himself and sharing other bits."; + } + } + } + + attend_feasted[ide] += 1; } - if (activity="drink"){ - var eater_type;eater_type=1; - if (global.chapter_name="Space Wolves" || obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) then eater_type=2; - if (global.chapter_name="Blood Angels" || obj_ini.progenitor == ePROGENITOR.BLOOD_ANGELS) then eater_type=3; - - if (eater_type=1){ - if (attend_drunk[ide]<=0) then textt=unit.name_role()+" hails a serf and has "+choose("him","her")+" pour some Amasec."; - if (attend_drunk[ide]>0) then textt=unit.name_role()+" sips at his Amasec, "+choose("enjoying the taste","judging the quality","savoring the treat")+"."; + if (activity == "drink") { + var eater_type; + eater_type = 1; + if (global.chapter_name == "Space Wolves" || obj_ini.progenitor == ePROGENITOR.SPACE_WOLVES) { + eater_type = 2; + } + if (global.chapter_name == "Blood Angels" || obj_ini.progenitor == ePROGENITOR.BLOOD_ANGELS) { + eater_type = 3; + } + + if (eater_type == 1) { + if (attend_drunk[ide] <= 0) { + textt = unit.name_role() + " hails a serf and has " + choose("him", "her") + " pour some Amasec."; + } + if (attend_drunk[ide] > 0) { + textt = unit.name_role() + " sips at his Amasec, " + choose("enjoying the taste", "judging the quality", "savoring the treat") + "."; + } } - if (eater_type=2){ + if (eater_type == 2) { // if (attend_drunk[ide]<=0) then textt=unit.name_role()+" hails a serf and has "+choose("him","her")+" bring him a tankard of Mjod."; // if (attend_drunk[ide]>0){ - rando=choose(1,2,3); - if (rando=1) then textt=unit.name_role()+" pounds down Mjod, the concoction already beginning to inebriate the astartes."; - if (rando=2) then textt=unit.name_role()+" boasts that he will outdrink anyone, and then pounds down his tankard. Nearby battlebrothers laugh and begin to meet his challenge."; - if (rando=3) then textt=unit.name_role()+" begins to drink down Mjod, a large frothing glass of the substance in each hand. He alternates between the two."; + rando = choose(1, 2, 3); + if (rando == 1) { + textt = unit.name_role() + " pounds down Mjod, the concoction already beginning to inebriate the astartes."; + } + if (rando == 2) { + textt = unit.name_role() + " boasts that he will outdrink anyone, and then pounds down his tankard. Nearby battlebrothers laugh and begin to meet his challenge."; + } + if (rando == 3) { + textt = unit.name_role() + " begins to drink down Mjod, a large frothing glass of the substance in each hand. He alternates between the two."; + } // } } - if (eater_type=3){ - if (attend_drunk[ide]<=0) then textt=unit.name_role()+" hails a serf and has "+choose("him","her")+" pour him a glass of "+choose("red wine","Amasec","Dammassine")+"."; - if (attend_drunk[ide]>0) then textt=unit.name_role()+" sips at his drink slowly, "+choose("enjoying the taste","judging the quality","analyzing the components")+"."; + if (eater_type == 3) { + if (attend_drunk[ide] <= 0) { + textt = unit.name_role() + " hails a serf and has " + choose("him", "her") + " pour him a glass of " + choose("red wine", "Amasec", "Dammassine") + "."; + } + if (attend_drunk[ide] > 0) { + textt = unit.name_role() + " sips at his drink slowly, " + choose("enjoying the taste", "judging the quality", "analyzing the components") + "."; + } } - - attend_drunk[ide]+=1; + + attend_drunk[ide] += 1; } - if (activity="drugs"){ - attend_high[ide]+=1; - unit.corruption=min(100,unit.corruption+10); - if (attend_high[ide]<=1) then textt=unit.name_role()+" snorts up a line of powder through a straw. Why not?"; - if (attend_high[ide]>1) then textt=unit.name_role()+" snorts another line of powder."; + if (activity == "drugs") { + attend_high[ide] += 1; + unit.corruption = min(100, unit.corruption + 10); + if (attend_high[ide] <= 1) { + textt = unit.name_role() + " snorts up a line of powder through a straw. Why not?"; + } + if (attend_high[ide] > 1) { + textt = unit.name_role() + " snorts another line of powder."; + } } - - + // show_message("activity:"+string(activity)+", text:"+string(textt)); - - - if (activity="talk"){ - textt=scr_event_gossip(ide); + + if (activity == "talk") { + textt = scr_event_gossip(ide); } - - if (activity="artifact"){ - var spesh=""; - var woa=string(obj_ini.artifact[obj_controller.fest_display]); - var nerves_spesh = ["GOAT","CHE","THI","TENTACLES","JUM","PRE"] - for (var sp=0;sptime_max) then time_min=time_max; - } - - ticked=0; -} + if (textt != "") { + scr_event_newlines(textt); + textt = ""; + attend_confused[ide] -= 1; + attend_displayed[ide] += 1; + lines_acted += 1; + time_min += 10; + liness += 1; + + if (time_min > time_max) { + time_min = time_max; + } + } -if (liness>(attendants/2)){ - var i;i=-1;repeat(1501){i+=1;attend_displayed[i]=0;} - liness=0; + ticked = 0; } +if (liness > (attendants / 2)) { + var i; + i = -1; + repeat (1501) { + i += 1; + attend_displayed[i] = 0; + } + liness = 0; +} /* */ /* */ diff --git a/objects/obj_event_log/Draw_0.gml b/objects/obj_event_log/Draw_0.gml index 2397192e5d..72e282f877 100644 --- a/objects/obj_event_log/Draw_0.gml +++ b/objects/obj_event_log/Draw_0.gml @@ -9,8 +9,8 @@ if (__b__) { } if (bad == 0) { var ent; - var xx = __view_get(e__VW.XView, 0) + 0; - var yy = __view_get(e__VW.YView, 0) + 0; + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0; draw_set_alpha(1); draw_set_color(0); draw_rectangle(xx, yy, xx + 1600, yy + 900, 0); @@ -70,8 +70,8 @@ if (__b__) { __b__ = action_if_variable(help, 1, 0); if (__b__) { var xx, yy; - xx = __view_get(e__VW.XView, 0); - yy = __view_get(e__VW.YView, 0); + xx = camera_get_view_x(view_camera[0]); + yy = camera_get_view_y(view_camera[0]); draw_set_color(0); draw_set_alpha(0.75); draw_rectangle(0, 0, room_width, room_height, 0); diff --git a/objects/obj_fleet/Mouse_56.gml b/objects/obj_fleet/Mouse_56.gml index a295ca460e..c53b1741c2 100644 --- a/objects/obj_fleet/Mouse_56.gml +++ b/objects/obj_fleet/Mouse_56.gml @@ -41,7 +41,7 @@ if (instance_exists(obj_p_ship) && (control == 1)) { } if ((start == 5) && (obj_controller.zoomed == 0)) { - if ((mouse_x >= __view_get(e__VW.XView, 0) + 12) && (mouse_y >= __view_get(e__VW.YView, 0) + 436) && (mouse_x < __view_get(e__VW.XView, 0) + 48) && (mouse_y < __view_get(e__VW.YView, 0) + 480) && (gamespeed_fps < 90)) { + if ((mouse_x >= camera_get_view_x(view_camera[0]) + 12) && (mouse_y >= camera_get_view_y(view_camera[0]) + 436) && (mouse_x < camera_get_view_x(view_camera[0]) + 48) && (mouse_y < camera_get_view_y(view_camera[0]) + 480) && (gamespeed_fps < 90)) { game_set_speed(gamespeed_fps + 30, gamespeed_fps); } } diff --git a/objects/obj_fleet_controller/Draw_0.gml b/objects/obj_fleet_controller/Draw_0.gml index b8410aa1df..e605155065 100644 --- a/objects/obj_fleet_controller/Draw_0.gml +++ b/objects/obj_fleet_controller/Draw_0.gml @@ -1,6 +1,9 @@ - -if (obj_controller.zoomed=0) then draw_sprite(spr_space_bg,0,(obj_controller.x/8)-48,(obj_controller.y/8)-48); -if (obj_controller.zoomed=1) then draw_sprite(spr_space_bg,0,0,0); +if (obj_controller.zoomed == 0) { + draw_sprite(spr_space_bg, 0, (obj_controller.x / 8) - 48, (obj_controller.y / 8) - 48); +} +if (obj_controller.zoomed == 1) { + draw_sprite(spr_space_bg, 0, 0, 0); +} exit; @@ -8,23 +11,23 @@ draw_set_color(CM_GREEN_COLOR); draw_set_font(fnt_menu); //if (zoomed=0){ -// draw_text(__view_get( e__VW.XView, 0 )+0,__view_get( e__VW.YView, 0 )+0,string_hash_to_newline("Morale: High")); -// draw_text(__view_get( e__VW.XView, 0 )+1,__view_get( e__VW.YView, 0 )+0,string_hash_to_newline("Morale:")); - -// draw_text(__view_get( e__VW.XView, 0 )+0,__view_get( e__VW.YView, 0 )+16,string_hash_to_newline("Ships Remaining: "+string(instance_number(obj_p_ship)))); -// draw_text(__view_get( e__VW.XView, 0 )+1,__view_get( e__VW.YView, 0 )+16,string_hash_to_newline("Ships Remaining:")); - -// draw_text(__view_get( e__VW.XView, 0 )+0,__view_get( e__VW.YView, 0 )+32,string_hash_to_newline("Thunderhawks: "+string(instance_number(obj_p_th)))); -// draw_text(__view_get( e__VW.XView, 0 )+1,__view_get( e__VW.YView, 0 )+32,string_hash_to_newline("Thunderhawks:")); +// draw_text(camera_get_view_x(view_camera[0])+0,camera_get_view_y(view_camera[0])+0,string_hash_to_newline("Morale: High")); +// draw_text(camera_get_view_x(view_camera[0])+1,camera_get_view_y(view_camera[0])+0,string_hash_to_newline("Morale:")); + +// draw_text(camera_get_view_x(view_camera[0])+0,camera_get_view_y(view_camera[0])+16,string_hash_to_newline("Ships Remaining: "+string(instance_number(obj_p_ship)))); +// draw_text(camera_get_view_x(view_camera[0])+1,camera_get_view_y(view_camera[0])+16,string_hash_to_newline("Ships Remaining:")); + +// draw_text(camera_get_view_x(view_camera[0])+0,camera_get_view_y(view_camera[0])+32,string_hash_to_newline("Thunderhawks: "+string(instance_number(obj_p_th)))); +// draw_text(camera_get_view_x(view_camera[0])+1,camera_get_view_y(view_camera[0])+32,string_hash_to_newline("Thunderhawks:")); //} //if (zoomed=1){ // draw_text_transformed(0,0,string_hash_to_newline("Morale: High"),2,2,0); // draw_text_transformed(2,0,string_hash_to_newline("Morale:"),2,2,0); - + // draw_text_transformed(0,32,string_hash_to_newline("Ships Remaining: "+string(instance_number(obj_p_ship))),2,2,0); // draw_text_transformed(2,32,string_hash_to_newline("Ships Remaining:"),2,2,0); - + // draw_text_transformed(0,64,string_hash_to_newline("Thunderhawk: "+string(instance_number(obj_p_th))),2,2,0); // draw_text_transformed(2,64,string_hash_to_newline("Thunderhawk:"),2,2,0); -//} +//} diff --git a/objects/obj_fleet_select/Create_0.gml b/objects/obj_fleet_select/Create_0.gml index 7fd220a21a..33aee50fe0 100644 --- a/objects/obj_fleet_select/Create_0.gml +++ b/objects/obj_fleet_select/Create_0.gml @@ -5,203 +5,237 @@ frigate = 0; capital = 0; selection_window = new DataSlate(); //TODO make this a built in part of the data_slate object -selection_window.currently_entered=false; +selection_window.currently_entered = false; currently_entered = false; -fleet_minimized=false; -fleet_all=true; -screen_expansion=20; +fleet_minimized = false; +fleet_all = true; +screen_expansion = 20; star_travel = []; -void_x=0; -void_y=0; -void_wid=0; -void_hei=0; -player_fleet=false; +void_x = 0; +void_y = 0; +void_wid = 0; +void_hei = 0; +player_fleet = false; -helpful_navigator=new HelpfulPlaces(); +helpful_navigator = new HelpfulPlaces(); -selection_window.inside_method = function(){ - var mnz=0; - var xx = selection_window.XX; - var yy = selection_window.YY; - draw_set_font(fnt_40k_14); - var center_draw = xx + (selection_window.width/2); - var width = selection_window.width; - var height = selection_window.height; +selection_window.inside_method = function() { + var mnz = 0; + var xx = selection_window.XX; + var yy = selection_window.YY; + draw_set_font(fnt_40k_14); + var center_draw = xx + (selection_window.width / 2); + var width = selection_window.width; + var height = selection_window.height; // draw_text(view_xview[0]+46,view_yview[0]+117,"Title"); - // draw_text(view_xview[0]+46,view_yview[0]+142,"1#2#3#4#5#6#7#8#9#10#11#1#13#14#15#16#17#18#19#20#21#22#23#24#25"); + // draw_text(view_xview[0]+46,view_yview[0]+142,"1#2#3#4#5#6#7#8#9#10#11#1#13#14#15#16#17#18#19#20#21#22#23#24#25"); - var type="capital",lines=0,posi=-1,colu=1,x3=48,y3=60,escorts,frigates,capitals,ty=0,current_ship=0,current_fleet=0,name="",sal=0,selection_box,scale=1,void_h=122,shew,ship_health=0; - escorts=escort; - frigates=frigate; - capitals=capital; + var type = "capital", lines = 0, posi = -1, colu = 1, x3 = 48, y3 = 60, escorts, frigates, capitals, ty = 0, current_ship = 0, current_fleet = 0, name = "", sal = 0, selection_box, scale = 1, void_h = 122, shew, ship_health = 0; + escorts = escort; + frigates = frigate; + capitals = capital; - current_fleet=instance_nearest(x,y,obj_p_fleet); + current_fleet = instance_nearest(x, y, obj_p_fleet); - if (escorts>0) then ty++; - if (frigates>0) then ty++; - if (capitals>0) then ty++; - draw_set_halign(fa_center); - var set = "capitol"; - var fleet_sel = "[X]"; - if (!fleet_all) then fleet_sel = "[ ]"; + if (escorts > 0) { + ty++; + } + if (frigates > 0) { + ty++; + } + if (capitals > 0) { + ty++; + } + draw_set_halign(fa_center); + var set = "capitol"; + var fleet_sel = "[X]"; + if (!fleet_all) { + fleet_sel = "[ ]"; + } var fleet_all_click = false; - if (!fleet_minimized){ - if (point_and_click(draw_unit_buttons([xx+width-60, yy+40], fleet_sel,[1,1],c_red))){ - fleet_all = fleet_all==1?0:1; - fleet_all_click=true; - } - - var math_string = (string_width("Manage Units")/2)+6 - if (point_and_click(draw_unit_buttons([center_draw-math_string, yy+height-50], "Manage Units",[1,1],c_blue))){ + if (!fleet_minimized) { + if (point_and_click(draw_unit_buttons([xx + width - 60, yy + 40], fleet_sel, [1, 1], c_red))) { + fleet_all = fleet_all == 1 ? 0 : 1; + fleet_all_click = true; + } + var math_string = (string_width("Manage Units") / 2) + 6; + if (point_and_click(draw_unit_buttons([center_draw - math_string, yy + height - 50], "Manage Units", [1, 1], c_blue))) { var _fleet_array = fleet_full_ship_array(current_fleet); var _fleet_marines = collect_role_group("all", ["", 0, _fleet_array]); - group_selection(_fleet_marines,{ - purpose:"Ship Management", - purpose_code : "manage", - number:0, - system:0, - ships : _fleet_array, - feature:"none", - planet : 0, - selections : [] - }); + group_selection(_fleet_marines, {purpose: "Ship Management", purpose_code: "manage", number: 0, system: 0, ships: _fleet_array, feature: "none", planet: 0, selections: []}); } } - draw_set_halign(fa_center); - var ship_type,current_ship, sel_set, full_id; - if (screen_expansion>0){ - for(var j=0; j<(escorts+frigates+capitals); j++){ - draw_set_color(c_gray); - y3+=20; - if (y3>height-5) then break; - lines++; - posi++; - scale=1; - shew=1; - ship_health=100; - if (colu==1) then void_h=min(void_h+20,560); - - if (posi==0){ - if (mnz=0) then draw_text(center_draw,yy+y3,string_hash_to_newline("=Capital Ships=")); - y3+=20; - if (y3>height-50) then break; - set = "capitol"; - } - - if (posi==capitals) and (frigates>0){ - y3+=20; - if (y3>height-50) then break; - if (mnz=0) then draw_text(center_draw,yy+y3,string_hash_to_newline("=Frigates=")); - y3+=20; - if (y3>height-50) then break; - - set = "frigate"; - } - if (posi==capitals+frigates) and (escorts>0){ - y3+=20; - if (y3>height-50) then break; - if (mnz=0) then draw_text(center_draw,yy+y3,string_hash_to_newline("=Escorts=")); - y3+=20; - if (y3>height-50) then break; - set = "escort"; - } - switch(set){ - case "capitol": - current_ship=posi; - if (current_ship670) and (posi<=escorts+frigates+capitals){ + draw_set_halign(fa_center); + var ship_type, current_ship, sel_set, full_id; + if (screen_expansion > 0) { + for (var j = 0; j < (escorts + frigates + capitals); j++) { + draw_set_color(c_gray); + y3 += 20; + if (y3 > height - 5) { + break; + } + lines++; + posi++; + scale = 1; + shew = 1; + ship_health = 100; + if (colu == 1) { + void_h = min(void_h + 20, 560); + } + + if (posi == 0) { + if (mnz == 0) { + draw_text(center_draw, yy + y3, string_hash_to_newline("=Capital Ships=")); + } + y3 += 20; + if (y3 > height - 50) { + break; + } + set = "capitol"; + } + + if ((posi == capitals) && (frigates > 0)) { + y3 += 20; + if (y3 > height - 50) { + break; + } + if (mnz == 0) { + draw_text(center_draw, yy + y3, string_hash_to_newline("=Frigates=")); + } + y3 += 20; + if (y3 > height - 50) { + break; + } + + set = "frigate"; + } + if ((posi == capitals + frigates) && (escorts > 0)) { + y3 += 20; + if (y3 > height - 50) { + break; + } + if (mnz == 0) { + draw_text(center_draw, yy + y3, string_hash_to_newline("=Escorts=")); + } + y3 += 20; + if (y3 > height - 50) { + break; + } + set = "escort"; + } + switch (set) { + case "capitol": + current_ship = posi; + if (current_ship < array_length(current_fleet.capital)) { + ship_type = current_fleet.capital; + ship_select = current_fleet.capital_sel[current_ship]; + full_id = current_fleet.capital_num[current_ship]; + } + break; + case "frigate": + ship_type = current_fleet.frigate; + current_ship = posi - capitals; + if (current_ship < array_length(current_fleet.frigate)) { + ship_select = current_fleet.frigate_sel[current_ship]; + full_id = current_fleet.frigate_num[current_ship]; + } + break; + case "escort": + ship_type = current_fleet.escort; + current_ship = posi - (capitals + frigates); + if (current_ship < array_length(current_fleet.escort)) { + ship_select = current_fleet.escort_sel[current_ship]; + full_id = current_fleet.escort_num[current_ship]; + } + break; + } + if (fleet_all_click) { + ship_select = fleet_all; + } + + /*if (y3>670) and (posi<=escorts+frigates+capitals){ lines=1; y3=30; x3+=223; posi++; colu++; }*/ - - if (posi<=escorts+frigates+capitals) && is_array(ship_type) && current_ship179){ - for (var i=0;i<9;i++){ - if (string_width(name)*scale>179) then scale-=0.05; - } - } - if (scr_hit(xx+10,yy+y3,xx+width-10,yy+y3+18)){ - if (string_width(name)*scale>135){ - for (var i=0;i<9;i++){ - if (string_width(name)*scale>135) then scale-=0.05; - } - } - shew=2; - } - if (point_and_click([xx+10,yy+y3,xx+width-10,yy+y3+18])){ - if (!(obj_controller.fest_scheduled>0 && obj_controller.fest_sid==full_id)){ - if (ship_select==1){ - ship_select=0; - }else { - ship_select=1; - } - } - } - if (obj_ini.ship_maxhp[current_ship]>0){ - ship_health=round((obj_ini.ship_hp[current_ship]/obj_ini.ship_maxhp[current_ship])*100); - } - - if (ship_select==0){ - selection_box="[ ]"; - }else if (ship_select==1){ - selection_box="[x] "; - } - if (mnz==0){ - draw_text(xx+width-25,yy+y3,selection_box); - if (shew==2) then draw_text(xx+width-60,yy+y3,$"{ship_health}%"); - } - if (ship_health<=60) and (ship_health>40) then draw_set_color(c_yellow); - if (ship_health<=40) and (ship_health>20) then draw_set_color(c_orange); - if (ship_health<=20) then draw_set_color(c_red); - if (mnz=0) then draw_text_transformed(center_draw,yy+y3,name,scale,1,0); - draw_set_color(c_gray); - } - switch(set){ - case "capitol": - current_fleet.capital_sel[current_ship] = ship_select; - break; - case "frigate": - current_fleet.frigate_sel[current_ship] = ship_select; - break; - case "escort": - current_fleet.escort_sel[current_ship] = ship_select; - break; - } - } - } - selection_window.currently_entered = scr_hit([xx,yy, xx+width, yy+selection_window.height]) || helpful_navigator.entered(); -} + + if ((posi <= escorts + frigates + capitals) && is_array(ship_type) && current_ship < array_length(ship_type)) { + name = ship_type[current_ship]; + if (string_width(name) * scale > 179) { + for (var i = 0; i < 9; i++) { + if (string_width(name) * scale > 179) { + scale -= 0.05; + } + } + } + if (scr_hit(xx + 10, yy + y3, xx + width - 10, yy + y3 + 18)) { + if (string_width(name) * scale > 135) { + for (var i = 0; i < 9; i++) { + if (string_width(name) * scale > 135) { + scale -= 0.05; + } + } + } + shew = 2; + } + if (point_and_click([xx + 10, yy + y3, xx + width - 10, yy + y3 + 18])) { + if (!(obj_controller.fest_scheduled > 0 && obj_controller.fest_sid == full_id)) { + if (ship_select == 1) { + ship_select = 0; + } else { + ship_select = 1; + } + } + } + if (obj_ini.ship_maxhp[current_ship] > 0) { + ship_health = round((obj_ini.ship_hp[current_ship] / obj_ini.ship_maxhp[current_ship]) * 100); + } + + if (ship_select == 0) { + selection_box = "[ ]"; + } else if (ship_select == 1) { + selection_box = "[x] "; + } + if (mnz == 0) { + draw_text(xx + width - 25, yy + y3, selection_box); + if (shew == 2) { + draw_text(xx + width - 60, yy + y3, $"{ship_health}%"); + } + } + if ((ship_health <= 60) && (ship_health > 40)) { + draw_set_color(c_yellow); + } + if ((ship_health <= 40) && (ship_health > 20)) { + draw_set_color(c_orange); + } + if (ship_health <= 20) { + draw_set_color(c_red); + } + if (mnz == 0) { + draw_text_transformed(center_draw, yy + y3, name, scale, 1, 0); + } + draw_set_color(c_gray); + } + switch (set) { + case "capitol": + current_fleet.capital_sel[current_ship] = ship_select; + break; + case "frigate": + current_fleet.frigate_sel[current_ship] = ship_select; + break; + case "escort": + current_fleet.escort_sel[current_ship] = ship_select; + break; + } + } + } + selection_window.currently_entered = scr_hit([xx, yy, xx + width, yy + selection_window.height]) || helpful_navigator.entered(); +}; diff --git a/objects/obj_fleet_select/Draw_0.gml b/objects/obj_fleet_select/Draw_0.gml index 325f0c0ba3..1b0130d9b8 100644 --- a/objects/obj_fleet_select/Draw_0.gml +++ b/objects/obj_fleet_select/Draw_0.gml @@ -1,170 +1,172 @@ var __b__; __b__ = action_if_number(obj_drop_select, 0, 0); -if __b__ -{ -__b__ = action_if_number(obj_bomb_select, 0, 0); -if __b__ -{ - -if (obj_controller.diplomacy>0) then exit; - - -draw_set_color(CM_GREEN_COLOR); - -draw_set_font(fnt_40k_14b); -draw_set_halign(fa_center); - -var ppp=""; -switch(owner){ - case eFACTION.Player: - ppp=global.chapter_name; - break; - case eFACTION.Imperium: - ppp="Imperial Navy"; - break; - case eFACTION.Mechanicus: - pppp="Mechanicus Fleet"; - break; - case eFACTION.Tau: - ppp="Tau Fleet"; - break; - -} -// -var scale = obj_controller.zoomed ? 3.5 : 1; -if (!obj_controller.zoomed){ - draw_text_transformed(x,y-32,ppp,scale,scale,0); -} +if (__b__) { + __b__ = action_if_number(obj_bomb_select, 0, 0); + if (__b__) { + if (obj_controller.diplomacy > 0) { + exit; + } -draw_set_halign(fa_left); + draw_set_color(CM_GREEN_COLOR); + + draw_set_font(fnt_40k_14b); + draw_set_halign(fa_center); + + var ppp = ""; + switch (owner) { + case eFACTION.Player: + ppp = global.chapter_name; + break; + case eFACTION.Imperium: + ppp = "Imperial Navy"; + break; + case eFACTION.Mechanicus: + pppp = "Mechanicus Fleet"; + break; + case eFACTION.Tau: + ppp = "Tau Fleet"; + break; + } + // + var scale = obj_controller.zoomed ? 3.5 : 1; + if (!obj_controller.zoomed) { + draw_text_transformed(x, y - 32, ppp, scale, scale, 0); + } + draw_set_halign(fa_left); -// Order here -player_fleet = instance_nearest(x,y,obj_p_fleet).id; -currently_entered = selection_window.currently_entered; -if (player_fleet.just_left){ - var cancel_button = draw_unit_buttons([player_fleet.x+20, player_fleet.y-10], "X",[1,1], c_red,, fnt_40k_30b, 1); + // Order here + player_fleet = instance_nearest(x, y, obj_p_fleet).id; + currently_entered = selection_window.currently_entered; + if (player_fleet.just_left) { + var cancel_button = draw_unit_buttons([player_fleet.x + 20, player_fleet.y - 10], "X", [1, 1], c_red,, fnt_40k_30b, 1); - if (scr_hit(cancel_button)){ - currently_entered = true; - } + if (scr_hit(cancel_button)) { + currently_entered = true; + } - if (point_and_click(cancel_button)){ - with (player_fleet){ - cancel_fleet_movement(); + if (point_and_click(cancel_button)) { + with (player_fleet) { + cancel_fleet_movement(); + } + } } - } -} -if (owner == eFACTION.Player && player_fleet.action==""){ - var xx = __view_get( e__VW.XView, 0 ); - var yy = __view_get( e__VW.YView, 0 ); - var free = !(currently_entered); - - if (free=1){ - - var sys_dist=9999,connected=0; - - with(obj_star){ - if (p_type[1]="Craftworld" && obj_controller.known[eFACTION.Eldar]=0) then instance_deactivate_object(id); - } + if (owner == eFACTION.Player && player_fleet.action == "") { + var xx = camera_get_view_x(view_camera[0]); + var yy = camera_get_view_y(view_camera[0]); + var free = !currently_entered; - var sys=instance_nearest(mouse_x,mouse_y,obj_star); - sys_dist=point_distance(mouse_x,mouse_y,sys.x,sys.y); - act_dist=point_distance(x,y,sys.x,sys.y); - - var mine=instance_nearest(x,y,obj_star); - connected = determine_warp_join(mine, sys); - - var web=0; - - if (sys_dist<32){ - web = (system_feature_bool(mine.p_feature,P_features.Webway) && system_feature_bool(sys.p_feature,P_features.Webway)); - if (mine.id=sys.id) then web=0; - } - - - if (sys_dist<32) and (sys.id!=mine.id){ - - var selection_travel_speed = calculate_action_speed(player_fleet,true); - player_fleet.action_spd = selection_travel_speed; - if (is_array(star_travel)){ - star_travel = new FastestRouteAlgorithm(mine.x,mine.y,sys.x,sys.y, player_fleet); - }else if (sys.id != star_travel.final_route_info[0]){ - star_travel = new FastestRouteAlgorithm(mine.x,mine.y,sys.x,sys.y, player_fleet); - } - star_travel.draw_route(); - draw_set_color(c_white); - draw_set_alpha(1); - if (web!=0) then draw_set_color(c_orange); - if (sys.storm>0) or (instance_nearest(x,y,obj_star).storm>0) then draw_set_color(c_red); - - - draw_line_dashed(x,y,sys.x,sys.y,16,scale); - - draw_set_font(fnt_40k_14b); - var eta=0; - - eta = calculate_fleet_eta(mine.x,mine.y,sys.x,sys.y, selection_travel_speed, ,,player_fleet.warp_able); - - if (sys.storm>0) or (instance_nearest(x,y,obj_star).storm>0) then eta="N/A"; - - draw_set_font(fnt_40k_14b); - eta = "ETA "+string(eta) + "#Press SHIFT to ignore way points"; - var speed_string = ""; - var viable=true; - var types = [0,0,0]; - with (player_fleet){ - types = selected_ship_types(); - } - if (!types[0]){ - speed_string = "#Speed bonus *1.25 frigates and smaller"; - if (!types[1]){ - speed_string = "#Speed bonus *1.75 Escort fleet" - if (!types[2]){ - speed_string = "#No Ships Selected" - viable=false; - } - } - } - eta+=speed_string; - - draw_text_transformed(sys.x+17,sys.y,string_hash_to_newline(eta),scale,scale,0); - if (mouse_check_button(mb_right) && viable){ - var ship_count = player_fleet_ship_count(player_fleet); - var fleet_selected = player_fleet_selected_count(player_fleet); - var move_fleet; - if (ship_count && fleet_selected){ - if (ship_count== fleet_selected){ - move_fleet = player_fleet; - } else { - move_fleet = split_selected_into_new_fleet(player_fleet); + if (free == 1) { + var sys_dist = 9999, connected = 0; + + with (obj_star) { + if (p_type[1] == "Craftworld" && obj_controller.known[eFACTION.Eldar] == 0) { + instance_deactivate_object(id); + } + } + + var sys = instance_nearest(mouse_x, mouse_y, obj_star); + sys_dist = point_distance(mouse_x, mouse_y, sys.x, sys.y); + act_dist = point_distance(x, y, sys.x, sys.y); + + var mine = instance_nearest(x, y, obj_star); + connected = determine_warp_join(mine, sys); + + var web = 0; + + if (sys_dist < 32) { + web = system_feature_bool(mine.p_feature, P_features.Webway) && system_feature_bool(sys.p_feature, P_features.Webway); + if (mine.id == sys.id) { + web = 0; + } + } + + if ((sys_dist < 32) && (sys.id != mine.id)) { + var selection_travel_speed = calculate_action_speed(player_fleet, true); + player_fleet.action_spd = selection_travel_speed; + if (is_array(star_travel)) { + star_travel = new FastestRouteAlgorithm(mine.x, mine.y, sys.x, sys.y, player_fleet); + } else if (sys.id != star_travel.final_route_info[0]) { + star_travel = new FastestRouteAlgorithm(mine.x, mine.y, sys.x, sys.y, player_fleet); + } + star_travel.draw_route(); + draw_set_color(c_white); + draw_set_alpha(1); + if (web != 0) { + draw_set_color(c_orange); + } + if ((sys.storm > 0) || (instance_nearest(x, y, obj_star).storm > 0)) { + draw_set_color(c_red); } - if (keyboard_check(vk_shift)){ - final_course = [sys.name]; - } else { - var final_course = star_travel.final_array_path(); + + draw_line_dashed(x, y, sys.x, sys.y, 16, scale); + + draw_set_font(fnt_40k_14b); + var eta = 0; + + eta = calculate_fleet_eta(mine.x, mine.y, sys.x, sys.y, selection_travel_speed,,, player_fleet.warp_able); + + if ((sys.storm > 0) || (instance_nearest(x, y, obj_star).storm > 0)) { + eta = "N/A"; + } + + draw_set_font(fnt_40k_14b); + eta = "ETA " + string(eta) + "#Press SHIFT to ignore way points"; + var speed_string = ""; + var viable = true; + var types = [0, 0, 0]; + with (player_fleet) { + types = selected_ship_types(); } - with (move_fleet){ - set_new_player_fleet_course(final_course); + if (!types[0]) { + speed_string = "#Speed bonus *1.25 frigates and smaller"; + if (!types[1]) { + speed_string = "#Speed bonus *1.75 Escort fleet"; + if (!types[2]) { + speed_string = "#No Ships Selected"; + viable = false; + } + } + } + eta += speed_string; + + draw_text_transformed(sys.x + 17, sys.y, string_hash_to_newline(eta), scale, scale, 0); + if (mouse_check_button(mb_right) && viable) { + var ship_count = player_fleet_ship_count(player_fleet); + var fleet_selected = player_fleet_selected_count(player_fleet); + var move_fleet; + if (ship_count && fleet_selected) { + if (ship_count == fleet_selected) { + move_fleet = player_fleet; + } else { + move_fleet = split_selected_into_new_fleet(player_fleet); + } + if (keyboard_check(vk_shift)) { + final_course = [sys.name]; + } else { + var final_course = star_travel.final_array_path(); + } + with (move_fleet) { + set_new_player_fleet_course(final_course); + } + } + instance_destroy(); } } + instance_activate_object(obj_star); + } + } + if (!currently_entered) { + currently_entered = keyboard_check(vk_shift); + } + if (mouse_check_button_pressed(mb_left)) { + if (!currently_entered && point_distance(mouse_x, mouse_y, player_fleet.x, player_fleet.y) > 32 && !keyboard_check(vk_shift)) { instance_destroy(); } } - instance_activate_object(obj_star); - } -} -if (!currently_entered){ - currently_entered = keyboard_check(vk_shift); -} -if (mouse_check_button_pressed(mb_left) ){ - if (!currently_entered && point_distance(mouse_x,mouse_y,player_fleet.x,player_fleet.y)>32 && !keyboard_check(vk_shift)){ - instance_destroy(); - } -} -/* */ -} + /* */ + } } /* */ diff --git a/objects/obj_fleet_select/Draw_64.gml b/objects/obj_fleet_select/Draw_64.gml index 47af67f18c..2338ee6e7f 100644 --- a/objects/obj_fleet_select/Draw_64.gml +++ b/objects/obj_fleet_select/Draw_64.gml @@ -1,60 +1,56 @@ //TODO centralise draw logi try { - if (!obj_controller.zoomed) { - var zm = 1, tit = "", mnz = 0; - - //if (fleet_minimized=0){ - // draw_set_color(c_black); - // draw_rectangle(__view_get( e__VW.XView, 0 )+44,__view_get( e__VW.YView, 0 )+110,__view_get( e__VW.XView, 0 )+267,__view_get( e__VW.YView, 0 )+110+void_hei,0); - // draw_set_color(c_gray); - // draw_rectangle(__view_get( e__VW.XView, 0 )+44,__view_get( e__VW.YView, 0 )+110,__view_get( e__VW.XView, 0 )+267,__view_get( e__VW.YView, 0 )+110+void_hei,1); - //} - draw_set_color(c_gray); - - fleet_min_button = "-"; - if (fleet_minimized || screen_expansion < 20) { - fleet_min_button = "+"; - selection_window.draw_cut(60, 110, 0.35, 0.8, screen_expansion * 5); - if (fleet_minimized && screen_expansion > 1) { - screen_expansion--; - } else if (!fleet_minimized && screen_expansion < 20) { - screen_expansion++; - } - } else { - selection_window.draw(60, 110, 0.35, 0.8); - } - var xx = selection_window.XX; - var yy = selection_window.YY; - var center_draw = xx + (selection_window.width / 2); - var width = selection_window.width; - draw_set_halign(fa_center); - draw_text(center_draw, yy + 50,$"{global.chapter_name} Fleet"); - draw_set_halign(fa_left); - - draw_set_color(c_gray); - //draw_rectangle(xx+18+void_wid,yy+116,xx+36+void_wid,yy+134,0); - - draw_set_color(c_red); - - draw_set_color(c_gray); - draw_line(xx + 10, yy + 75, xx + width - 10, yy + 75); - if (point_and_click(draw_unit_buttons([xx + 25, yy + 40], fleet_min_button, [1, 1], c_red))) { - if (fleet_minimized) { - screen_expansion--; - fleet_minimized = false; - } else { - screen_expansion++; - fleet_minimized = true; - } - } - } + if (!obj_controller.zoomed) { + var zm = 1, tit = "", mnz = 0; + + //if (fleet_minimized=0){ + // draw_set_color(c_black); + // draw_rectangle(camera_get_view_x(view_camera[0])+44,camera_get_view_y(view_camera[0])+110,camera_get_view_x(view_camera[0])+267,camera_get_view_y(view_camera[0])+110+void_hei,0); + // draw_set_color(c_gray); + // draw_rectangle(camera_get_view_x(view_camera[0])+44,camera_get_view_y(view_camera[0])+110,camera_get_view_x(view_camera[0])+267,camera_get_view_y(view_camera[0])+110+void_hei,1); + //} + draw_set_color(c_gray); + + fleet_min_button = "-"; + if (fleet_minimized || screen_expansion < 20) { + fleet_min_button = "+"; + selection_window.draw_cut(60, 110, 0.35, 0.8, screen_expansion * 5); + if (fleet_minimized && screen_expansion > 1) { + screen_expansion--; + } else if (!fleet_minimized && screen_expansion < 20) { + screen_expansion++; + } + } else { + selection_window.draw(60, 110, 0.35, 0.8); + } + var xx = selection_window.XX; + var yy = selection_window.YY; + var center_draw = xx + (selection_window.width / 2); + var width = selection_window.width; + draw_set_halign(fa_center); + draw_text(center_draw, yy + 50, $"{global.chapter_name} Fleet"); + draw_set_halign(fa_left); + + draw_set_color(c_gray); + //draw_rectangle(xx+18+void_wid,yy+116,xx+36+void_wid,yy+134,0); + + draw_set_color(c_red); + + draw_set_color(c_gray); + draw_line(xx + 10, yy + 75, xx + width - 10, yy + 75); + if (point_and_click(draw_unit_buttons([xx + 25, yy + 40], fleet_min_button, [1, 1], c_red))) { + if (fleet_minimized) { + screen_expansion--; + fleet_minimized = false; + } else { + screen_expansion++; + fleet_minimized = true; + } + } + } } catch (_exception) { - handle_exception(_exception); - instance_destroy(); + handle_exception(_exception); + instance_destroy(); } - helpful_navigator.draw(); - - - diff --git a/objects/obj_fleet_select/Step_0.gml b/objects/obj_fleet_select/Step_0.gml index a50596a461..882d8107b4 100644 --- a/objects/obj_fleet_select/Step_0.gml +++ b/objects/obj_fleet_select/Step_0.gml @@ -1,13 +1,12 @@ +if ((target != 0) && (!instance_exists(target))) { + instance_destroy(); +} - - -if (target!=0) and (!instance_exists(target)) then instance_destroy(); - - -if (obj_controller.popup<1) or (obj_controller.popup>2) then instance_destroy(); - -if (target!=0) and (instance_exists(target)){ - x=target.x; - y=target.y; +if ((obj_controller.popup < 1) || (obj_controller.popup > 2)) { + instance_destroy(); } +if ((target != 0) && instance_exists(target)) { + x = target.x; + y = target.y; +} diff --git a/objects/obj_formation_bar/Create_0.gml b/objects/obj_formation_bar/Create_0.gml index b7b87a4778..7dc23d54ce 100644 --- a/objects/obj_formation_bar/Create_0.gml +++ b/objects/obj_formation_bar/Create_0.gml @@ -1,24 +1,20 @@ +dragging = false; +rel_mousex = 0; +rel_mousey = 0; +old_x = 0; +old_y = 0; -dragging=false; -rel_mousex=0; -rel_mousey=0; -old_x=0; -old_y=0; - -unit_type=""; -unit_id=0; - -size=0; -col_parent=0; -col_target=0; -above_neighbor=0; -nearest_col=0; -nobar=false; - -height=0; -width=0; -text_xscale=1.25; -image_speed=0; - +unit_type = ""; +unit_id = 0; +size = 0; +col_parent = 0; +col_target = 0; +above_neighbor = 0; +nearest_col = 0; +nobar = false; +height = 0; +width = 0; +text_xscale = 1.25; +image_speed = 0; diff --git a/objects/obj_formation_bar/Destroy_0.gml b/objects/obj_formation_bar/Destroy_0.gml index 1f2d7b7182..61ffe763eb 100644 --- a/objects/obj_formation_bar/Destroy_0.gml +++ b/objects/obj_formation_bar/Destroy_0.gml @@ -1,7 +1,5 @@ - -if (instance_exists(obj_temp8)){ - with(obj_temp8){ +if (instance_exists(obj_temp8)) { + with (obj_temp8) { instance_destroy(); } } - diff --git a/objects/obj_formation_bar/Draw_0.gml b/objects/obj_formation_bar/Draw_0.gml index 7121fe3c8f..93212e3cd3 100644 --- a/objects/obj_formation_bar/Draw_0.gml +++ b/objects/obj_formation_bar/Draw_0.gml @@ -1,42 +1,43 @@ - - /*var tist;tist=true; if (tist=true){ if (nobar=true) then draw_set_alpha(0.5); draw_set_color(c_purple);draw_set_alpha(1); if (instance_exists(col_parent)) and (!instance_exists(col_target)){draw_line_width(mouse_x,mouse_y,col_parent.x,col_parent.y,2);} if (instance_exists(col_target)){draw_line_width(mouse_x,mouse_y,col_target.x,col_target.y,5);} -}*/draw_set_alpha(1); - - - - - -if (dragging=false) then draw_sprite_ext(spr_formation_bars,image_index,x,y,image_xscale,image_yscale,0,c_white,1); -if (dragging=true) then draw_sprite_ext(spr_formation_bars,image_index,x,y+1000,image_xscale,image_yscale,0,c_white,1); - - +}*/ draw_set_alpha(1); +if (dragging == false) { + draw_sprite_ext(spr_formation_bars, image_index, x, y, image_xscale, image_yscale, 0, c_white, 1); +} +if (dragging == true) { + draw_sprite_ext(spr_formation_bars, image_index, x, y + 1000, image_xscale, image_yscale, 0, c_white, 1); +} draw_set_alpha(1); draw_set_color(0); draw_set_font(fnt_40k_14b); draw_set_halign(fa_center); -var max_hi,actual_hi; -max_hi=height-4; -actual_hi=0; - -actual_hi=string_width(string_hash_to_newline(unit_type))*text_xscale; -if (actual_hi>max_hi) then repeat(10){ - actual_hi=string_width(string_hash_to_newline(unit_type))*text_xscale; - if (actual_hi>max_hi) then text_xscale-=0.05; +var max_hi, actual_hi; +max_hi = height - 4; +actual_hi = 0; + +actual_hi = string_width(string_hash_to_newline(unit_type)) * text_xscale; +if (actual_hi > max_hi) { + repeat (10) { + actual_hi = string_width(string_hash_to_newline(unit_type)) * text_xscale; + if (actual_hi > max_hi) { + text_xscale -= 0.05; + } + } } -if (dragging=false) then draw_text_transformed(x+28,y+(height/2),string_hash_to_newline(string(unit_type)),text_xscale,text_xscale,270); -if (dragging=true) then draw_text_transformed(x+28,y+(height/2)+1000,string_hash_to_newline(string(unit_type)),text_xscale,text_xscale,270); - - +if (dragging == false) { + draw_text_transformed(x + 28, y + (height / 2), string_hash_to_newline(string(unit_type)), text_xscale, text_xscale, 270); +} +if (dragging == true) { + draw_text_transformed(x + 28, y + (height / 2) + 1000, string_hash_to_newline(string(unit_type)), text_xscale, text_xscale, 270); +} /* */ /* */ diff --git a/objects/obj_formation_bar/Mouse_0.gml b/objects/obj_formation_bar/Mouse_0.gml index 83d1f0845d..a7b9fe4698 100644 --- a/objects/obj_formation_bar/Mouse_0.gml +++ b/objects/obj_formation_bar/Mouse_0.gml @@ -1,22 +1,21 @@ +if ((obj_cursor.dragging == 0) && (obj_controller.cooldown <= 0)) { + obj_cursor.dragging = 1; + dragging = true; + obj_controller.cooldown = 9999; + obj_controller.click = 1; -if (obj_cursor.dragging=0) and (obj_controller.cooldown<=0){ - obj_cursor.dragging=1;dragging=true; - obj_controller.cooldown=9999; - obj_controller.click=1; - // save crap - rel_mousex=x-mouse_x; - rel_mousey=y-mouse_y-1000; - old_x=x;old_y=y; - + rel_mousex = x - mouse_x; + rel_mousey = y - mouse_y - 1000; + old_x = x; + old_y = y; + // Establish drop areas /*with(obj_temp8){instance_destroy();} with(obj_formation_bar){ if (y<=view_yview[0]+230) then instance_create(x,y,obj_temp8); }*/ - } - /* */ /* */ diff --git a/objects/obj_formation_bar/Mouse_56.gml b/objects/obj_formation_bar/Mouse_56.gml index 18467e871f..355fe4edda 100644 --- a/objects/obj_formation_bar/Mouse_56.gml +++ b/objects/obj_formation_bar/Mouse_56.gml @@ -1,67 +1,134 @@ - - -var mah_target;mah_target=0; +var mah_target; +mah_target = 0; /*if (dragging=true) and (nobar=true) then mah_target=col_target; if (dragging=true) and (nobar=false) then mah_target=nearest_col;*/ +mah_target = col_target; -mah_target=col_target; - - -if (dragging=true) and (instance_exists(mah_target)){ - if (mah_target.col_parent=col_parent){ - obj_controller.click=1;obj_controller.cooldown=20;x=old_x;y=old_y; - rel_mousex=0;rel_mousey=0;old_x=0;old_y=0;col_target=0;nearest_col=0;nobar=false; - obj_cursor.dragging=0;obj_cursor.image_index=0;dragging=false;exit; +if ((dragging == true) && instance_exists(mah_target)) { + if (mah_target.col_parent == col_parent) { + obj_controller.click = 1; + obj_controller.cooldown = 20; + x = old_x; + y = old_y; + rel_mousex = 0; + rel_mousey = 0; + old_x = 0; + old_y = 0; + col_target = 0; + nearest_col = 0; + nobar = false; + obj_cursor.dragging = 0; + obj_cursor.image_index = 0; + dragging = false; + exit; } } -if (dragging=true) and (instance_exists(mah_target)){ - if (x>=mah_target.x-5) and (x<=mah_target.x+42) and (mouse_y>=__view_get( e__VW.YView, 0 )+222) and (mouse_y<=__view_get( e__VW.YView, 0 )+688){ - var himcol,te;himcol=mah_target.col_parent;te=0; - te=4800+himcol;nexti=false; - - if (obj_controller.temp[te]+size<=10){ - obj_controller.temp[4800+col_parent]-=size; - obj_controller.click=1;obj_controller.cooldown=20; - if (unit_id=1) then obj_controller.bat_comm_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=2) then obj_controller.bat_hono_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=3) then obj_controller.bat_libr_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=4) then obj_controller.bat_tech_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=5) then obj_controller.bat_term_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=6) then obj_controller.bat_vete_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=7) then obj_controller.bat_tact_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=8) then obj_controller.bat_deva_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=9) then obj_controller.bat_assa_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=10) then obj_controller.bat_scou_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=11) then obj_controller.bat_drea_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=12) then obj_controller.bat_hire_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=13) then obj_controller.bat_rhin_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=14) then obj_controller.bat_pred_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=15) then obj_controller.bat_landraid_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=16) then obj_controller.bat_landspee_for[obj_controller.formating]=mah_target.col_parent; - if (unit_id=17) then obj_controller.bat_whirl_for[obj_controller.formating]=mah_target.col_parent; - obj_cursor.dragging=0;obj_cursor.image_index=0; - +if ((dragging == true) && instance_exists(mah_target)) { + if ((x >= mah_target.x - 5) && (x <= mah_target.x + 42) && (mouse_y >= camera_get_view_y(view_camera[0]) + 222) && (mouse_y <= camera_get_view_y(view_camera[0]) + 688)) { + var himcol, te; + himcol = mah_target.col_parent; + te = 0; + te = 4800 + himcol; + nexti = false; + + if (obj_controller.temp[te] + size <= 10) { + obj_controller.temp[4800 + col_parent] -= size; + obj_controller.click = 1; + obj_controller.cooldown = 20; + if (unit_id == 1) { + obj_controller.bat_comm_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 2) { + obj_controller.bat_hono_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 3) { + obj_controller.bat_libr_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 4) { + obj_controller.bat_tech_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 5) { + obj_controller.bat_term_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 6) { + obj_controller.bat_vete_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 7) { + obj_controller.bat_tact_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 8) { + obj_controller.bat_deva_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 9) { + obj_controller.bat_assa_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 10) { + obj_controller.bat_scou_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 11) { + obj_controller.bat_drea_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 12) { + obj_controller.bat_hire_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 13) { + obj_controller.bat_rhin_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 14) { + obj_controller.bat_pred_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 15) { + obj_controller.bat_landraid_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 16) { + obj_controller.bat_landspee_for[obj_controller.formating] = mah_target.col_parent; + } + if (unit_id == 17) { + obj_controller.bat_whirl_for[obj_controller.formating] = mah_target.col_parent; + } + obj_cursor.dragging = 0; + obj_cursor.image_index = 0; + // show_message("-> slot "+string(mah_target.col_parent)+", now "+string(obj_controller.temp[te]+size)+"/10 full, old slot is "+string(obj_controller.temp[4800+col_parent])+"/10"); - - with(obj_temp8){instance_destroy();} - with(obj_controller){scr_ui_formation_bars();} + + with (obj_temp8) { + instance_destroy(); + } + with (obj_controller) { + scr_ui_formation_bars(); + } exit; } - if (obj_controller.temp[te]+size>10){ - dragging=false;x=old_x;y=old_y;obj_controller.cooldown=20;obj_cursor.dragging=0;obj_cursor.image_index=0; - if (obj_controller.master_volume>0) and (obj_controller.effect_volume>0){audio_play_sound(snd_error,-80,0);audio_sound_gain(snd_error,1*obj_controller.master_volume*obj_controller.effect_volume,0);} + if (obj_controller.temp[te] + size > 10) { + dragging = false; + x = old_x; + y = old_y; + obj_controller.cooldown = 20; + obj_cursor.dragging = 0; + obj_cursor.image_index = 0; + if ((obj_controller.master_volume > 0) && (obj_controller.effect_volume > 0)) { + audio_play_sound(snd_error, -80, 0); + audio_sound_gain(snd_error, 1 * obj_controller.master_volume * obj_controller.effect_volume, 0); + } } } - if (instance_exists(mah_target)){ - if (xmah_target.x+42) or (mouse_y<__view_get( e__VW.YView, 0 )+222) or (mouse_y>__view_get( e__VW.YView, 0 )+688){ - dragging=false;x=old_x;y=old_y;obj_controller.cooldown=20;obj_cursor.dragging=0;obj_cursor.image_index=0; - if (obj_controller.master_volume>0) and (obj_controller.effect_volume>0){audio_play_sound(snd_error,-80,0);audio_sound_gain(snd_error,1*obj_controller.master_volume*obj_controller.effect_volume,0);} + if (instance_exists(mah_target)) { + if ((x < mah_target.x - 5) || (x > mah_target.x + 42) || (mouse_y < camera_get_view_y(view_camera[0]) + 222) || (mouse_y > camera_get_view_y(view_camera[0]) + 688)) { + dragging = false; + x = old_x; + y = old_y; + obj_controller.cooldown = 20; + obj_cursor.dragging = 0; + obj_cursor.image_index = 0; + if ((obj_controller.master_volume > 0) && (obj_controller.effect_volume > 0)) { + audio_play_sound(snd_error, -80, 0); + audio_sound_gain(snd_error, 1 * obj_controller.master_volume * obj_controller.effect_volume, 0); + } } } } - /* */ /* */ diff --git a/objects/obj_formation_bar/Step_0.gml b/objects/obj_formation_bar/Step_0.gml index c8727cdd93..149215cfb6 100644 --- a/objects/obj_formation_bar/Step_0.gml +++ b/objects/obj_formation_bar/Step_0.gml @@ -1,5 +1,3 @@ - - /* dragging=false; @@ -26,19 +24,27 @@ image_speed=0; */ - -if (dragging=true){ - x=mouse_x+rel_mousex;y=mouse_y+rel_mousey;obj_cursor.image_index=3; - col_target=instance_nearest(x,__view_get( e__VW.YView, 0 )+224,obj_temp8); - nearest_col=instance_nearest(col_target.x,col_target.y,obj_formation_bar); - nobar=false;if (point_distance(col_target.x,col_target.y,nearest_col.x,nearest_col.y)>2) then nobar=true; +if (dragging == true) { + x = mouse_x + rel_mousex; + y = mouse_y + rel_mousey; + obj_cursor.image_index = 3; + col_target = instance_nearest(x, camera_get_view_y(view_camera[0]) + 224, obj_temp8); + nearest_col = instance_nearest(col_target.x, col_target.y, obj_formation_bar); + nobar = false; + if (point_distance(col_target.x, col_target.y, nearest_col.x, nearest_col.y) > 2) { + nobar = true; + } } -if (dragging=false){ - rel_mousex=0;rel_mousey=0;old_x=0;old_y=0; - col_parent=0;col_target=0;above_neighbor=0; - nearest_col=0; +if (dragging == false) { + rel_mousex = 0; + rel_mousey = 0; + old_x = 0; + old_y = 0; + col_parent = 0; + col_target = 0; + above_neighbor = 0; + nearest_col = 0; } - /* */ /* */ diff --git a/objects/obj_img/Draw_0.gml b/objects/obj_img/Draw_0.gml index caaa2ace76..a76a6a2fb4 100644 --- a/objects/obj_img/Draw_0.gml +++ b/objects/obj_img/Draw_0.gml @@ -1,3 +1,3 @@ // Prints a blue circle in the upper left corner. Some leftover debug stuff? //draw_set_alpha(1);draw_set_halign(fa_left);draw_set_color(c_blue); -//draw_circle(__view_get( e__VW.XView, 0 )+20,__view_get( e__VW.YView, 0 )+20,32,0); +//draw_circle(camera_get_view_x(view_camera[0])+20,camera_get_view_y(view_camera[0])+20,32,0); diff --git a/objects/obj_ingame_menu/CleanUp_0.gml b/objects/obj_ingame_menu/CleanUp_0.gml index a2679b7024..abead8fdfa 100644 --- a/objects/obj_ingame_menu/CleanUp_0.gml +++ b/objects/obj_ingame_menu/CleanUp_0.gml @@ -1 +1 @@ -global.ui_click_lock = false; \ No newline at end of file +global.ui_click_lock = false; diff --git a/objects/obj_ingame_menu/Create_0.gml b/objects/obj_ingame_menu/Create_0.gml index e4a3a402dc..ad4821c703 100644 --- a/objects/obj_ingame_menu/Create_0.gml +++ b/objects/obj_ingame_menu/Create_0.gml @@ -1,26 +1,25 @@ - -fading=0; -effect=0; -settings=0; -cooldown=0; +fading = 0; +effect = 0; +settings = 0; +cooldown = 0; ini_open("saves.ini"); -master_volume=ini_read_real("Settings","master_volume",1); -effect_volume=ini_read_real("Settings","effect_volume",1); -music_volume=ini_read_real("Settings","music_volume",1); -large_text=ini_read_real("Settings","large_text",0); -settings_heresy=ini_read_real("Settings","settings_heresy",0); -settings_autosave=ini_read_real("Settings", "settings_autosave", 1); -settings_fullscreen=ini_read_real("Settings","fullscreen",1); -settings_window_data=ini_read_string("Settings","window_data","fullscreen"); +master_volume = ini_read_real("Settings", "master_volume", 1); +effect_volume = ini_read_real("Settings", "effect_volume", 1); +music_volume = ini_read_real("Settings", "music_volume", 1); +large_text = ini_read_real("Settings", "large_text", 0); +settings_heresy = ini_read_real("Settings", "settings_heresy", 0); +settings_autosave = ini_read_real("Settings", "settings_autosave", 1); +settings_fullscreen = ini_read_real("Settings", "fullscreen", 1); +settings_window_data = ini_read_string("Settings", "window_data", "fullscreen"); ini_close(); // create the buttons -var butt,xx,yy; -xx=__view_get( e__VW.XView, 0 ); -yy=__view_get( e__VW.YView, 0 ); +var butt, xx, yy; +xx = camera_get_view_x(view_camera[0]); +yy = camera_get_view_y(view_camera[0]); -if (room_get_name(room)!="Main_Menu"){ +if (room_get_name(room) != "Main_Menu") { butt = instance_create(xx + 821, yy + 256, obj_new_button); butt.sprite_index = spr_ui_but_1; butt.depth = -20010; @@ -28,7 +27,7 @@ if (room_get_name(room)!="Main_Menu"){ butt.button_id = 1; butt.scaling = 1.5; butt.target = 11; - + butt = instance_create(xx + 821, yy + 336, obj_new_button); butt.sprite_index = spr_ui_but_1; butt.depth = -20010; @@ -36,7 +35,7 @@ if (room_get_name(room)!="Main_Menu"){ butt.button_id = 1; butt.scaling = 1.5; butt.target = 12; - + butt = instance_create(xx + 821, yy + 416, obj_new_button); butt.sprite_index = spr_ui_but_1; butt.depth = -20010; @@ -44,7 +43,7 @@ if (room_get_name(room)!="Main_Menu"){ butt.button_id = 1; butt.scaling = 1.5; butt.target = 13; - + butt = instance_create(xx + 821, yy + 496, obj_new_button); butt.sprite_index = spr_ui_but_1; butt.depth = -20010; @@ -52,7 +51,7 @@ if (room_get_name(room)!="Main_Menu"){ butt.button_id = 1; butt.scaling = 1.5; butt.target = 14; - + butt = instance_create(xx + 821, yy + 666, obj_new_button); butt.sprite_index = spr_ui_but_1; butt.depth = -20010; @@ -62,12 +61,12 @@ if (room_get_name(room)!="Main_Menu"){ butt.target = 15; } -if (room_get_name(room)="Main_Menu"){ +if (room_get_name(room) == "Main_Menu") { with (obj_new_button) { instance_destroy(); } settings = 1; - + butt = instance_create(xx + 653, yy + 664, obj_new_button); butt.sprite_index = spr_ui_but_1; butt.depth = -20010; @@ -78,4 +77,3 @@ if (room_get_name(room)="Main_Menu"){ } global.ui_click_lock = true; - diff --git a/objects/obj_ingame_menu/Draw_0.gml b/objects/obj_ingame_menu/Draw_0.gml index 417ac4efb6..af1107765b 100644 --- a/objects/obj_ingame_menu/Draw_0.gml +++ b/objects/obj_ingame_menu/Draw_0.gml @@ -1,82 +1,124 @@ +if (settings == 1) { + var xx, yy; + xx = camera_get_view_x(view_camera[0]); + yy = camera_get_view_y(view_camera[0]); - -if (settings=1){ - var xx,yy; - xx=__view_get( e__VW.XView, 0 ); - yy=__view_get( e__VW.YView, 0 ); - draw_set_color(0); draw_set_alpha(0.75); - draw_rectangle(0,0,room_width,room_height,0); - + draw_rectangle(0, 0, room_width, room_height, 0); + draw_set_alpha(1); // draw_sprite(spr_ingame_menu,1,xx+476,yy+114); - scr_image("menu",1,xx+476,yy+114,562,631); - + scr_image("menu", 1, xx + 476, yy + 114, 562, 631); + draw_set_color(c_gray); draw_set_halign(fa_center); draw_set_font(fnt_cul_14); - draw_text_transformed(xx+763,yy+149,string_hash_to_newline("Settings"),1.5,1.5,0); - + draw_text_transformed(xx + 763, yy + 149, string_hash_to_newline("Settings"), 1.5, 1.5, 0); + draw_set_halign(fa_left); draw_set_font(fnt_cul_18); - draw_text(xx+493,yy+224,string_hash_to_newline("Master Volume")); - draw_text(xx+493,yy+281,string_hash_to_newline("Effects Volume")); - draw_text(xx+493,yy+339,string_hash_to_newline("Music Volume")); - draw_text(xx+493,yy+423,string_hash_to_newline("Full Screen?:")); - draw_text(xx+493,yy+483,string_hash_to_newline("Enable Autosaves?:")); + draw_text(xx + 493, yy + 224, string_hash_to_newline("Master Volume")); + draw_text(xx + 493, yy + 281, string_hash_to_newline("Effects Volume")); + draw_text(xx + 493, yy + 339, string_hash_to_newline("Music Volume")); + draw_text(xx + 493, yy + 423, string_hash_to_newline("Full Screen?:")); + draw_text(xx + 493, yy + 483, string_hash_to_newline("Enable Autosaves?:")); // draw_text(xx+493,yy+423+59,string_hash_to_newline("Large Text?:")); - - draw_set_color(0);// 264 long - draw_rectangle(xx+710,yy+224,xx+974,yy+254,0); - draw_rectangle(xx+710,yy+282,xx+974,yy+312,0); - draw_rectangle(xx+710,yy+338,xx+974,yy+368,0); - - var bar,change_volume;bar=0;change_volume=0; + + draw_set_color(0); // 264 long + draw_rectangle(xx + 710, yy + 224, xx + 974, yy + 254, 0); + draw_rectangle(xx + 710, yy + 282, xx + 974, yy + 312, 0); + draw_rectangle(xx + 710, yy + 338, xx + 974, yy + 368, 0); + + var bar, change_volume; + bar = 0; + change_volume = 0; draw_set_color(CM_GREEN_COLOR); - if (master_volume>0) then bar=(master_volume/1.3)*264;if (master_volume>0) then draw_rectangle(xx+710,yy+224,xx+710+bar,yy+254,0); - if (effect_volume>0) then bar=(effect_volume/1.3)*264;if (effect_volume>0) then draw_rectangle(xx+710,yy+282,xx+710+bar,yy+312,0); - if (music_volume>0) then bar=(music_volume/1.3)*264;if (music_volume>0) then draw_rectangle(xx+710,yy+338,xx+710+bar,yy+368,0); - bar=0; - - draw_set_halign(fa_center);draw_set_color(c_gray); - draw_text(xx+842,yy+227,string_hash_to_newline(string(floor(master_volume*100))+"%")); - draw_text(xx+842,yy+285,string_hash_to_newline(string(floor(effect_volume*100))+"%")); - draw_text(xx+842,yy+341,string_hash_to_newline(string(floor(music_volume*100))+"%")); - - draw_rectangle(xx+710,yy+224,xx+974,yy+254,1); - draw_rectangle(xx+710,yy+282,xx+974,yy+312,1); - draw_rectangle(xx+710,yy+338,xx+974,yy+368,1); - - draw_sprite_stretched(spr_creation_arrow,0,xx+671,yy+223,32,32);// MV left - draw_sprite_stretched(spr_creation_arrow,1,xx+981,yy+223,32,32);// MV right - draw_sprite_stretched(spr_creation_arrow,0,xx+671,yy+281,32,32);// EV left - draw_sprite_stretched(spr_creation_arrow,1,xx+981,yy+281,32,32);// EV right - draw_sprite_stretched(spr_creation_arrow,0,xx+671,yy+339,32,32);// MV left - draw_sprite_stretched(spr_creation_arrow,1,xx+981,yy+339,32,32);// MV right - - bar=settings_fullscreen;draw_sprite(spr_creation_check,bar,xx+626,yy+426); + if (master_volume > 0) { + bar = (master_volume / 1.3) * 264; + } + if (master_volume > 0) { + draw_rectangle(xx + 710, yy + 224, xx + 710 + bar, yy + 254, 0); + } + if (effect_volume > 0) { + bar = (effect_volume / 1.3) * 264; + } + if (effect_volume > 0) { + draw_rectangle(xx + 710, yy + 282, xx + 710 + bar, yy + 312, 0); + } + if (music_volume > 0) { + bar = (music_volume / 1.3) * 264; + } + if (music_volume > 0) { + draw_rectangle(xx + 710, yy + 338, xx + 710 + bar, yy + 368, 0); + } + bar = 0; + + draw_set_halign(fa_center); + draw_set_color(c_gray); + draw_text(xx + 842, yy + 227, string_hash_to_newline(string(floor(master_volume * 100)) + "%")); + draw_text(xx + 842, yy + 285, string_hash_to_newline(string(floor(effect_volume * 100)) + "%")); + draw_text(xx + 842, yy + 341, string_hash_to_newline(string(floor(music_volume * 100)) + "%")); + + draw_rectangle(xx + 710, yy + 224, xx + 974, yy + 254, 1); + draw_rectangle(xx + 710, yy + 282, xx + 974, yy + 312, 1); + draw_rectangle(xx + 710, yy + 338, xx + 974, yy + 368, 1); + + draw_sprite_stretched(spr_creation_arrow, 0, xx + 671, yy + 223, 32, 32); // MV left + draw_sprite_stretched(spr_creation_arrow, 1, xx + 981, yy + 223, 32, 32); // MV right + draw_sprite_stretched(spr_creation_arrow, 0, xx + 671, yy + 281, 32, 32); // EV left + draw_sprite_stretched(spr_creation_arrow, 1, xx + 981, yy + 281, 32, 32); // EV right + draw_sprite_stretched(spr_creation_arrow, 0, xx + 671, yy + 339, 32, 32); // MV left + draw_sprite_stretched(spr_creation_arrow, 1, xx + 981, yy + 339, 32, 32); // MV right + + bar = settings_fullscreen; + draw_sprite(spr_creation_check, bar, xx + 626, yy + 426); // bar=large_text;draw_sprite(spr_creation_check,bar,xx+622,yy+426+59); - bar=settings_autosave;draw_sprite(spr_creation_check,bar,xx+680,yy+485); - - - if (scr_click_left(,true)){ - if (scr_hit(xx+671,yy+223,xx+671+32,yy+223+32)=true) and (master_volume>0){change_volume=1;master_volume-=0.1;} - if (scr_hit(xx+671,yy+281,xx+671+32,yy+281+32)=true) and (effect_volume>0){change_volume=1;effect_volume-=0.1;} - if (scr_hit(xx+671,yy+339,xx+671+32,yy+339+32)=true) and (music_volume>0){change_volume=1;music_volume-=0.1;} - if (scr_hit(xx+981,yy+223,xx+981+32,yy+223+32)=true) and (master_volume<1.3){change_volume=1;master_volume+=0.1;} - if (scr_hit(xx+981,yy+281,xx+981+32,yy+281+32)=true) and (effect_volume<1.3){change_volume=1;effect_volume+=0.1;} - if (scr_hit(xx+981,yy+339,xx+981+32,yy+339+32)=true) and (music_volume<1.3){change_volume=1;music_volume+=0.1;} - - if (scr_hit(xx+626,yy+426,xx+626+32,yy+426+32)=true){ - if (settings_fullscreen=1){settings_fullscreen=0;window_set_fullscreen(false);change_volume=2;} - else if (settings_fullscreen=0){settings_fullscreen=1;window_set_fullscreen(true);change_volume=2;} + bar = settings_autosave; + draw_sprite(spr_creation_check, bar, xx + 680, yy + 485); + + if (scr_click_left(, true)) { + if ((scr_hit(xx + 671, yy + 223, xx + 671 + 32, yy + 223 + 32) == true) && (master_volume > 0)) { + change_volume = 1; + master_volume -= 0.1; + } + if ((scr_hit(xx + 671, yy + 281, xx + 671 + 32, yy + 281 + 32) == true) && (effect_volume > 0)) { + change_volume = 1; + effect_volume -= 0.1; + } + if ((scr_hit(xx + 671, yy + 339, xx + 671 + 32, yy + 339 + 32) == true) && (music_volume > 0)) { + change_volume = 1; + music_volume -= 0.1; + } + if ((scr_hit(xx + 981, yy + 223, xx + 981 + 32, yy + 223 + 32) == true) && (master_volume < 1.3)) { + change_volume = 1; + master_volume += 0.1; + } + if ((scr_hit(xx + 981, yy + 281, xx + 981 + 32, yy + 281 + 32) == true) && (effect_volume < 1.3)) { + change_volume = 1; + effect_volume += 0.1; + } + if ((scr_hit(xx + 981, yy + 339, xx + 981 + 32, yy + 339 + 32) == true) && (music_volume < 1.3)) { + change_volume = 1; + music_volume += 0.1; + } + + if (scr_hit(xx + 626, yy + 426, xx + 626 + 32, yy + 426 + 32) == true) { + if (settings_fullscreen == 1) { + settings_fullscreen = 0; + window_set_fullscreen(false); + change_volume = 2; + } else if (settings_fullscreen == 0) { + settings_fullscreen = 1; + window_set_fullscreen(true); + change_volume = 2; + } ini_open("saves.ini"); ini_write_real("Settings", "fullscreen", settings_fullscreen); ini_close(); } - if (scr_hit(xx+680,yy+485,xx+680+32,yy+485+32)=true){ - settings_autosave = !settings_autosave; + if (scr_hit(xx + 680, yy + 485, xx + 680 + 32, yy + 485 + 32) == true) { + settings_autosave = !settings_autosave; ini_open("saves.ini"); ini_write_real("Settings", "settings_autosave", settings_autosave); ini_close(); @@ -90,81 +132,85 @@ if (settings=1){ // if (settings_heresy=0) and (onceh=0){onceh=1;settings_heresy=1;change_volume=2;} // } } - - - if (change_volume=1){ - if (audio_is_playing(snd_royal)){ - var nope;nope=0;if (master_volume=0) or (music_volume=0) then nope=1; - if (nope!=1){audio_sound_gain(snd_royal,0.25*master_volume*music_volume,0);} - if (nope=1){audio_sound_gain(snd_royal,0,0);} + + if (change_volume == 1) { + if (audio_is_playing(snd_royal)) { + var nope; + nope = 0; + if ((master_volume == 0) || (music_volume == 0)) { + nope = 1; + } + if (nope != 1) { + audio_sound_gain(snd_royal, 0.25 * master_volume * music_volume, 0); + } + if (nope == 1) { + audio_sound_gain(snd_royal, 0, 0); + } } - if (instance_exists(obj_controller)){ - obj_controller.master_volume=master_volume; - obj_controller.effect_volume=effect_volume; - obj_controller.music_volume=music_volume; + if (instance_exists(obj_controller)) { + obj_controller.master_volume = master_volume; + obj_controller.effect_volume = effect_volume; + obj_controller.music_volume = music_volume; // obj_controller.large_text=large_text; // obj_controller.settings_heresy=settings_heresy; - obj_controller.settings_fullscreen=settings_fullscreen; + obj_controller.settings_fullscreen = settings_fullscreen; } - if (instance_exists(obj_main_menu)){ - if (audio_is_playing(global.sound)) and (audio_is_playing(snd_prologue)){ - var nope;nope=0;if (master_volume=0) or (music_volume=0) then nope=1; - if (nope!=1){audio_sound_gain(global.sound,0.25*master_volume*music_volume,0);} - if (nope=1){audio_sound_gain(global.sound,0,0);} + if (instance_exists(obj_main_menu)) { + if (audio_is_playing(global.sound) && audio_is_playing(snd_prologue)) { + var nope; + nope = 0; + if ((master_volume == 0) || (music_volume == 0)) { + nope = 1; + } + if (nope != 1) { + audio_sound_gain(global.sound, 0.25 * master_volume * music_volume, 0); + } + if (nope == 1) { + audio_sound_gain(global.sound, 0, 0); + } } - if (!audio_is_playing(global.sound)) and (!audio_is_playing(snd_prologue)) and (master_volume>0) and (music_volume>0){ - global.sound=audio_play_sound(snd_prologue,0,true); - audio_sound_gain(global.sound,0.25*master_volume*music_volume,0); + if ((!audio_is_playing(global.sound)) && (!audio_is_playing(snd_prologue)) && (master_volume > 0) && (music_volume > 0)) { + global.sound = audio_play_sound(snd_prologue, 0, true); + audio_sound_gain(global.sound, 0.25 * master_volume * music_volume, 0); } - - obj_main_menu.master_volume=master_volume; - obj_main_menu.effect_volume=effect_volume; - obj_main_menu.music_volume=music_volume; + + obj_main_menu.master_volume = master_volume; + obj_main_menu.effect_volume = effect_volume; + obj_main_menu.music_volume = music_volume; // obj_main_menu.large_text=large_text; // obj_main_menu.settings_heresy=settings_heresy; - obj_main_menu.settings_fullscreen=settings_fullscreen; + obj_main_menu.settings_fullscreen = settings_fullscreen; } } - if (change_volume>0){ + if (change_volume > 0) { ini_open("saves.ini"); - ini_write_real("Settings","master_volume",master_volume); - ini_write_real("Settings","effect_volume",effect_volume); - ini_write_real("Settings","music_volume",music_volume); + ini_write_real("Settings", "master_volume", master_volume); + ini_write_real("Settings", "effect_volume", effect_volume); + ini_write_real("Settings", "music_volume", music_volume); // ini_write_real("Settings","large_text",large_text); // ini_write_real("Settings","settings_heresy",settings_heresy); - ini_write_real("Settings","fullscreen",settings_fullscreen); + ini_write_real("Settings", "fullscreen", settings_fullscreen); ini_close(); } } +if (instance_exists(obj_saveload) || (settings == 1)) { + exit; +} - - - - - - - - -if (instance_exists(obj_saveload)) or (settings=1) then exit; - -var xx,yy; -xx=__view_get( e__VW.XView, 0 ); -yy=__view_get( e__VW.YView, 0 ); +var xx, yy; +xx = camera_get_view_x(view_camera[0]); +yy = camera_get_view_y(view_camera[0]); draw_set_color(0); draw_set_alpha(0.75); -draw_rectangle(0,0,room_width,room_height,0); +draw_rectangle(0, 0, room_width, room_height, 0); draw_set_alpha(1); // draw_sprite(spr_ingame_menu,0,xx+476,yy+114); -scr_image("menu",0,xx+476,yy+114,562,631); - +scr_image("menu", 0, xx + 476, yy + 114, 562, 631); draw_set_color(c_gray); draw_set_halign(fa_center); draw_set_font(fnt_cul_14); -draw_text_transformed(xx+929,yy+149,string_hash_to_newline("Menu"),1.5,1.5,0); - - - +draw_text_transformed(xx + 929, yy + 149, string_hash_to_newline("Menu"), 1.5, 1.5, 0); diff --git a/objects/obj_ingame_menu/KeyPress_27.gml b/objects/obj_ingame_menu/KeyPress_27.gml index 832ac3180c..b8d5840f70 100644 --- a/objects/obj_ingame_menu/KeyPress_27.gml +++ b/objects/obj_ingame_menu/KeyPress_27.gml @@ -1,6 +1,6 @@ - -if (instance_number(obj_saveload)=0) and (settings=0){ - with(obj_new_button){instance_destroy();} +if ((instance_number(obj_saveload) == 0) && (settings == 0)) { + with (obj_new_button) { + instance_destroy(); + } instance_destroy(); } - diff --git a/objects/obj_ingame_menu/Step_0.gml b/objects/obj_ingame_menu/Step_0.gml index bdf8a34299..0a97a62dee 100644 --- a/objects/obj_ingame_menu/Step_0.gml +++ b/objects/obj_ingame_menu/Step_0.gml @@ -1,87 +1,155 @@ +if ((cooldown > 0) && (cooldown <= 5000)) { + cooldown -= 1; +} -if (cooldown>0) and (cooldown<=5000) then cooldown-=1; - -var xx,yy; -xx=__view_get( e__VW.XView, 0 )+0; -yy=__view_get( e__VW.YView, 0 )+0; +var xx, yy; +xx = camera_get_view_x(view_camera[0]) + 0; +yy = camera_get_view_y(view_camera[0]) + 0; -if (effect=11) and (!instance_exists(obj_saveload)){ - var sav,butt; - with(obj_new_button){x-=2000;y-=2000;} +if ((effect == 11) && (!instance_exists(obj_saveload))) { + var sav, butt; + with (obj_new_button) { + x -= 2000; + y -= 2000; + } // Force an autosave if none exists the first time someone clicks into the save menu - if(!file_exists(PATH_autosave_file)){ - if(!instance_exists(obj_saveload)){ - instance_create(0,0,obj_saveload); + if (!file_exists(PATH_autosave_file)) { + if (!instance_exists(obj_saveload)) { + instance_create(0, 0, obj_saveload); } obj_saveload.autosaving = true; - with (obj_controller){ - scr_save(0,0,true); + with (obj_controller) { + scr_save(0, 0, true); } - with(obj_saveload){ + with (obj_saveload) { instance_destroy(); } } - sav=instance_create(0,0,obj_saveload); - sav.menu=1; - butt=instance_create(xx+707,yy+830,obj_new_button); - butt.sprite_index=spr_ui_but_1; - butt.depth=-20010; - butt.button_text="Back"; - butt.button_id=1; - butt.scaling=1.5; - butt.target=18; + sav = instance_create(0, 0, obj_saveload); + sav.menu = 1; + butt = instance_create(xx + 707, yy + 830, obj_new_button); + butt.sprite_index = spr_ui_but_1; + butt.depth = -20010; + butt.button_text = "Back"; + butt.button_id = 1; + butt.scaling = 1.5; + butt.target = 18; } -if (effect=12) and (!instance_exists(obj_saveload)){var sav,butt; - with(obj_new_button){x-=2000;y-=2000;} - sav=instance_create(0,0,obj_saveload);sav.menu=2; - butt=instance_create(xx+707,yy+830,obj_new_button);butt.sprite_index=spr_ui_but_1; - butt.depth=-20010;butt.button_text="Back";butt.button_id=1;butt.scaling=1.5;butt.target=18; +if ((effect == 12) && (!instance_exists(obj_saveload))) { + var sav, butt; + with (obj_new_button) { + x -= 2000; + y -= 2000; + } + sav = instance_create(0, 0, obj_saveload); + sav.menu = 2; + butt = instance_create(xx + 707, yy + 830, obj_new_button); + butt.sprite_index = spr_ui_but_1; + butt.depth = -20010; + butt.button_text = "Back"; + butt.button_id = 1; + butt.scaling = 1.5; + butt.target = 18; } -if (effect=13){var butt; - with(obj_new_button){x-=2000;y-=2000;} - butt=instance_create(xx+653,yy+664,obj_new_button);butt.sprite_index=spr_ui_but_1; - butt.depth=-20010;butt.button_text="Back";butt.button_id=1;butt.scaling=1.5;butt.target=25; - settings=1;cooldown=8; +if (effect == 13) { + var butt; + with (obj_new_button) { + x -= 2000; + y -= 2000; + } + butt = instance_create(xx + 653, yy + 664, obj_new_button); + butt.sprite_index = spr_ui_but_1; + butt.depth = -20010; + butt.button_text = "Back"; + butt.button_id = 1; + butt.scaling = 1.5; + butt.target = 25; + settings = 1; + cooldown = 8; } -if (effect=14){ - instance_create(0,0,obj_fade); - fading=0.1; +if (effect == 14) { + instance_create(0, 0, obj_fade); + fading = 0.1; } -if (effect=15){ - if (instance_exists(obj_controller)){obj_controller.cooldown=8000;} - with(obj_new_button){if (target>=10) then instance_destroy();} +if (effect == 15) { + if (instance_exists(obj_controller)) { + obj_controller.cooldown = 8000; + } + with (obj_new_button) { + if (target >= 10) { + instance_destroy(); + } + } instance_destroy(); } - -if (effect=18){with(obj_saveload){instance_destroy();} - with(obj_new_button){if (target=18) then instance_destroy();x+=2000;y+=2000;} +if (effect == 18) { + with (obj_saveload) { + instance_destroy(); + } + with (obj_new_button) { + if (target == 18) { + instance_destroy(); + } + x += 2000; + y += 2000; + } } -if (effect=25){ - if (room_get_name(room)!="Main_Menu"){settings=0;cooldown=8; - with(obj_new_button){if (target=25) then instance_destroy();x+=2000;y+=2000;} - with(obj_new_button){if (x<=0) then x+=2000;if (y<=0) then y+=2000;} +if (effect == 25) { + if (room_get_name(room) != "Main_Menu") { + settings = 0; + cooldown = 8; + with (obj_new_button) { + if (target == 25) { + instance_destroy(); + } + x += 2000; + y += 2000; + } + with (obj_new_button) { + if (x <= 0) { + x += 2000; + } + if (y <= 0) { + y += 2000; + } + } } - if (room_get_name(room)="Main_Menu"){settings=0;cooldown=8; - with(obj_new_button){instance_destroy();} + if (room_get_name(room) == "Main_Menu") { + settings = 0; + cooldown = 8; + with (obj_new_button) { + instance_destroy(); + } instance_destroy(); } } -if (effect=26){settings=0;cooldown=8;if (instance_exists(obj_controller)){obj_controller.cooldown=8;} - with(obj_new_button){instance_destroy();}instance_destroy(); +if (effect == 26) { + settings = 0; + cooldown = 8; + if (instance_exists(obj_controller)) { + obj_controller.cooldown = 8; + } + with (obj_new_button) { + instance_destroy(); + } + instance_destroy(); } - - -if (effect>0) then effect=0; -if (fading>0){ - fading+=1;obj_fade.alpha=fading/30; - if (fading>=35){ - global.returned=1; +if (effect > 0) { + effect = 0; +} +if (fading > 0) { + fading += 1; + obj_fade.alpha = fading / 30; + if (fading >= 35) { + global.returned = 1; audio_stop_all(); - with(obj_ini){instance_destroy();} + with (obj_ini) { + instance_destroy(); + } room_goto(Main_Menu); } } diff --git a/objects/obj_mass_equip/Draw_0.gml b/objects/obj_mass_equip/Draw_0.gml index dc586e618e..be9f155137 100644 --- a/objects/obj_mass_equip/Draw_0.gml +++ b/objects/obj_mass_equip/Draw_0.gml @@ -1,6 +1,6 @@ var xx, yy; -xx = __view_get(e__VW.XView, 0) + 0; -yy = __view_get(e__VW.YView, 0) + 0; +xx = camera_get_view_x(view_camera[0]) + 0; +yy = camera_get_view_y(view_camera[0]) + 0; if (total_role_number > 0) { draw_set_color(c_gray); @@ -105,26 +105,7 @@ if (total_role_number > 0) { if (total_role_number > 0 && tab > -1) { item_name = []; - var infanty_roles = [ - eROLE.ChapterMaster, - eROLE.HonourGuard, - eROLE.Veteran, - eROLE.Terminator, - eROLE.Captain, - eROLE.Champion, - eROLE.Tactical, - eROLE.Devastator, - eROLE.Assault, - eROLE.Ancient, - eROLE.Scout, - eROLE.Chaplain, - eROLE.Apothecary, - eROLE.Techmarine, - eROLE.Librarian, - eROLE.Sergeant, - eROLE.VeteranSergeant, - eROLE.Dreadnought - ]; + var infanty_roles = [eROLE.ChapterMaster, eROLE.HonourGuard, eROLE.Veteran, eROLE.Terminator, eROLE.Captain, eROLE.Champion, eROLE.Tactical, eROLE.Devastator, eROLE.Assault, eROLE.Ancient, eROLE.Scout, eROLE.Chaplain, eROLE.Apothecary, eROLE.Techmarine, eROLE.Librarian, eROLE.Sergeant, eROLE.VeteranSergeant, eROLE.Dreadnought]; // hand slots if ((tab == 0 || tab == 1) && array_get_index(infanty_roles, obj_controller.settings) >= 0) { // Get all available hand weapons diff --git a/objects/obj_mass_equip/Step_0.gml b/objects/obj_mass_equip/Step_0.gml index 8688569b1e..6ac48a046f 100644 --- a/objects/obj_mass_equip/Step_0.gml +++ b/objects/obj_mass_equip/Step_0.gml @@ -13,12 +13,7 @@ try { if (role_number[co] > 0) { for (i = 0; i < array_length(obj_ini.role[co]); i++) { if (obj_ini.role[co][i] == obj_ini.role[100][role]) { - unit = fetch_unit( - [ - co, - i - ] - ); + unit = fetch_unit([co, i]); if (unit.squad != "none") { var _squad = fetch_squad(unit.squad); if (!_squad.allow_bulk_swap) { @@ -81,16 +76,7 @@ try { // ** Start Mobility Items ** if (unit.mobility_item() != req_mobi) { var stop_mobi = false; - if ( - is_struct(unit_armour) - && unit_armour - .has_tags( - [ - "terminator", - "dreadnought" - ] - ) - ) { + if (is_struct(unit_armour) && unit_armour.has_tags(["terminator", "dreadnought"])) { unit.update_mobility_item(""); } else { unit.update_mobility_item(req_mobi); diff --git a/objects/obj_new_button/Create_0.gml b/objects/obj_new_button/Create_0.gml index 5e8784f60d..7c7e9de9f9 100644 --- a/objects/obj_new_button/Create_0.gml +++ b/objects/obj_new_button/Create_0.gml @@ -1,15 +1,11 @@ +button_id = 0; +button_text = ""; +scaling = 1; -button_id=0; -button_text=""; -scaling=1; - -line=0; -highlight=0; -follow_control=false; -highlighted=false; - -target=0; -return_button=0; - - +line = 0; +highlight = 0; +follow_control = false; +highlighted = false; +target = 0; +return_button = 0; diff --git a/objects/obj_new_button/Draw_0.gml b/objects/obj_new_button/Draw_0.gml index 08a591681c..a463fadea9 100644 --- a/objects/obj_new_button/Draw_0.gml +++ b/objects/obj_new_button/Draw_0.gml @@ -1,44 +1,59 @@ - draw_set_alpha(1); -var xx,yy; -xx=x;yy=y; -if (follow_control=true) and (instance_exists(obj_controller)){ - xx+=__view_get( e__VW.XView, 0 ); - yy+=__view_get( e__VW.YView, 0 ); +var xx, yy; +xx = x; +yy = y; +if ((follow_control == true) && instance_exists(obj_controller)) { + xx += camera_get_view_x(view_camera[0]); + yy += camera_get_view_y(view_camera[0]); } - -if (button_id=1) then draw_sprite_ext(spr_ui_but_1,0,x,y,scaling,scaling,0,c_white,1); -if (button_id=2) then draw_sprite_ext(spr_ui_but_2,0,x,y,scaling,scaling,0,c_white,1); -if (button_id=3) then draw_sprite_ext(spr_ui_but_3,0,x,y,scaling,scaling,0,c_white,1); -if (button_id=4) then draw_sprite_ext(spr_ui_but_4,0,x,y,scaling,scaling,0,c_white,1); - +if (button_id == 1) { + draw_sprite_ext(spr_ui_but_1, 0, x, y, scaling, scaling, 0, c_white, 1); +} +if (button_id == 2) { + draw_sprite_ext(spr_ui_but_2, 0, x, y, scaling, scaling, 0, c_white, 1); +} +if (button_id == 3) { + draw_sprite_ext(spr_ui_but_3, 0, x, y, scaling, scaling, 0, c_white, 1); +} +if (button_id == 4) { + draw_sprite_ext(spr_ui_but_4, 0, x, y, scaling, scaling, 0, c_white, 1); +} draw_set_blend_mode(bm_add); // draw_set_alpha(highlight*2); -if (button_id=1) and (highlight>0) then draw_sprite_ext(spr_ui_hov_1,0,x,y,scaling,scaling,0,c_white,highlight*2); -if (button_id=2) and (highlight>0) then draw_sprite_ext(spr_ui_hov_2,0,x,y,scaling,scaling,0,c_white,highlight*2); -if (button_id=3) and (highlight>0) then draw_sprite_ext(spr_ui_hov_3,0,x,y,scaling,scaling,0,c_white,highlight*2); -if (button_id=4) and (highlight>0) then draw_sprite_ext(spr_ui_hov_4,0,x,y,scaling,scaling,0,c_white,highlight*2); +if ((button_id == 1) && (highlight > 0)) { + draw_sprite_ext(spr_ui_hov_1, 0, x, y, scaling, scaling, 0, c_white, highlight * 2); +} +if ((button_id == 2) && (highlight > 0)) { + draw_sprite_ext(spr_ui_hov_2, 0, x, y, scaling, scaling, 0, c_white, highlight * 2); +} +if ((button_id == 3) && (highlight > 0)) { + draw_sprite_ext(spr_ui_hov_3, 0, x, y, scaling, scaling, 0, c_white, highlight * 2); +} +if ((button_id == 4) && (highlight > 0)) { + draw_sprite_ext(spr_ui_hov_4, 0, x, y, scaling, scaling, 0, c_white, highlight * 2); +} draw_set_blend_mode(bm_normal); // draw_set_alpha(1); - draw_set_color(c_white); draw_set_halign(fa_center); draw_set_font(fnt_cul_14); -draw_text_transformed(xx+((sprite_width/2)*scaling),yy+((sprite_height/5)*scaling),string_hash_to_newline(button_text),scaling,scaling,0); - - - - +draw_text_transformed(xx + ((sprite_width / 2) * scaling), yy + ((sprite_height / 5) * scaling), string_hash_to_newline(button_text), scaling, scaling, 0); draw_set_alpha(0.15); -if (line>0) and (button_id<=2){ - var l_hei,l_why;l_hei=37*scaling;l_why=0;if (line>131*scaling){l_hei=(171*scaling)-line;l_why=min(line-(133*scaling),11*(scaling));} +if ((line > 0) && (button_id <= 2)) { + var l_hei, l_why; + l_hei = 37 * scaling; + l_why = 0; + if (line > 131 * scaling) { + l_hei = (171 * scaling) - line; + l_why = min(line - (133 * scaling), 11 * scaling); + } // draw_line(line+xx,yy+1+l_why,xx+line+(34*scaling),yy+(37*scaling)); - draw_line(line+xx,yy+1+l_why,xx+line,yy+(37*scaling)); + draw_line(line + xx, yy + 1 + l_why, xx + line, yy + (37 * scaling)); // draw_line(line+xx+(34*scaling),yy+1+l_why,xx+line+(34*scaling),yy+(37*scaling)); } /* @@ -47,13 +62,25 @@ if (line>0) and (button_id<=2){ // draw_line(line+xx,yy+1+l_why,xx+line+(34*scaling),yy+(37*scaling)); draw_line(line+xx+(34*scaling),yy+1+l_why,xx+line+(34*scaling),yy+(37*scaling)); }*/ -if (line>0) and (button_id=3){ - var l_hei,l_why;l_hei=37*scaling;l_why=0;if (line>101*scaling){l_hei=(141-line)*scaling;l_why=min(line-103,11)*scaling;} - draw_line(xx+line,yy+1+l_why,xx+line,yy+(37)*scaling); +if ((line > 0) && (button_id == 3)) { + var l_hei, l_why; + l_hei = 37 * scaling; + l_why = 0; + if (line > 101 * scaling) { + l_hei = (141 - line) * scaling; + l_why = min(line - 103, 11) * scaling; + } + draw_line(xx + line, yy + 1 + l_why, xx + line, yy + 37 * scaling); } -if (line>0) and (button_id=4){ - var l_hei,l_why;l_hei=37*scaling;l_why=0;if (line>94*scaling){l_hei=(134-line)*scaling;l_why=min(line-96,11)*scaling;} - draw_line(xx+line,yy+(10*scaling)+1,xx+line,yy+((10+37)*scaling)-l_why); +if ((line > 0) && (button_id == 4)) { + var l_hei, l_why; + l_hei = 37 * scaling; + l_why = 0; + if (line > 94 * scaling) { + l_hei = (134 - line) * scaling; + l_why = min(line - 96, 11) * scaling; + } + draw_line(xx + line, yy + (10 * scaling) + 1, xx + line, yy + ((10 + 37) * scaling) - l_why); } draw_set_alpha(1); diff --git a/objects/obj_new_button/Step_0.gml b/objects/obj_new_button/Step_0.gml index a31c677c28..6f8cea6b0a 100644 --- a/objects/obj_new_button/Step_0.gml +++ b/objects/obj_new_button/Step_0.gml @@ -7,8 +7,8 @@ stop = 0; bx = x; by = y; if ((follow_control == true) && instance_exists(obj_controller)) { - xx += __view_get(e__VW.XView, 0); - yy += __view_get(e__VW.YView, 0); + xx += camera_get_view_x(view_camera[0]); + yy += camera_get_view_y(view_camera[0]); } highlighted = false; @@ -20,9 +20,9 @@ if (button_id == 1) { if ((mouse_x >= bx) && (mouse_x <= bx + wid)) { if (mouse_x >= +bx + (134 * scaling)) { var dif1, dif2; - dif1 = mouse_x - (__view_get(e__VW.XView, 0) + bx + (134 * scaling)); + dif1 = mouse_x - (camera_get_view_x(view_camera[0]) + bx + (134 * scaling)); dif2 = dif1 * 1.25; - if (mouse_y < __view_get(e__VW.YView, 0) + by + dif2) { + if (mouse_y < camera_get_view_y(view_camera[0]) + by + dif2) { stop = 1; } } @@ -47,13 +47,13 @@ if (button_id == 1) { if (button_id == 2) { wid = 142 * scaling; hei = 43 * scaling; - if ((mouse_y >= __view_get(e__VW.YView, 0) + by) && (mouse_y <= __view_get(e__VW.YView, 0) + by + hei)) { - if ((mouse_x >= __view_get(e__VW.XView, 0) + bx) && (mouse_x <= __view_get(e__VW.XView, 0) + bx + wid)) { - if (mouse_x >= __view_get(e__VW.XView, 0) + bx + (134 * scaling)) { + if ((mouse_y >= camera_get_view_y(view_camera[0]) + by) && (mouse_y <= camera_get_view_y(view_camera[0]) + by + hei)) { + if ((mouse_x >= camera_get_view_x(view_camera[0]) + bx) && (mouse_x <= camera_get_view_x(view_camera[0]) + bx + wid)) { + if (mouse_x >= camera_get_view_x(view_camera[0]) + bx + (134 * scaling)) { var dif1, dif2; - dif1 = mouse_x - (__view_get(e__VW.XView, 0) + bx + (134 * scaling)); + dif1 = mouse_x - (camera_get_view_x(view_camera[0]) + bx + (134 * scaling)); dif2 = dif1 * 1.25; - if (mouse_y < __view_get(e__VW.YView, 0) + by + dif2) { + if (mouse_y < camera_get_view_y(view_camera[0]) + by + dif2) { stop = 1; } } @@ -66,13 +66,13 @@ if (button_id == 2) { if (button_id == 3) { wid = 115 * scaling; hei = 43 * scaling; - if ((mouse_y >= __view_get(e__VW.YView, 0) + by) && (mouse_y <= __view_get(e__VW.YView, 0) + by + hei)) { - if ((mouse_x >= __view_get(e__VW.XView, 0) + bx) && (mouse_x <= __view_get(e__VW.XView, 0) + bx + wid)) { - if (mouse_x >= __view_get(e__VW.XView, 0) + bx + (108 * scaling)) { + if ((mouse_y >= camera_get_view_y(view_camera[0]) + by) && (mouse_y <= camera_get_view_y(view_camera[0]) + by + hei)) { + if ((mouse_x >= camera_get_view_x(view_camera[0]) + bx) && (mouse_x <= camera_get_view_x(view_camera[0]) + bx + wid)) { + if (mouse_x >= camera_get_view_x(view_camera[0]) + bx + (108 * scaling)) { var dif1, dif2; - dif1 = mouse_x - (__view_get(e__VW.XView, 0) + bx + (108 * scaling)); + dif1 = mouse_x - (camera_get_view_x(view_camera[0]) + bx + (108 * scaling)); dif2 = dif1 * 2; - if (mouse_y < __view_get(e__VW.YView, 0) + by + dif2) { + if (mouse_y < camera_get_view_y(view_camera[0]) + by + dif2) { stop = 1; } } @@ -85,13 +85,13 @@ if (button_id == 3) { if (button_id == 4) { wid = 108 * scaling; hei = 42 * scaling; - if ((mouse_y >= __view_get(e__VW.YView, 0) + by) && (mouse_y <= __view_get(e__VW.YView, 0) + by + hei)) { - if ((mouse_x >= __view_get(e__VW.XView, 0) + bx) && (mouse_x <= __view_get(e__VW.XView, 0) + bx + wid)) { - if (mouse_x >= __view_get(e__VW.XView, 0) + bx + (108 * scaling)) { + if ((mouse_y >= camera_get_view_y(view_camera[0]) + by) && (mouse_y <= camera_get_view_y(view_camera[0]) + by + hei)) { + if ((mouse_x >= camera_get_view_x(view_camera[0]) + bx) && (mouse_x <= camera_get_view_x(view_camera[0]) + bx + wid)) { + if (mouse_x >= camera_get_view_x(view_camera[0]) + bx + (108 * scaling)) { var dif1, dif2; - dif1 = mouse_x - (__view_get(e__VW.XView, 0) + bx + (108 * scaling)); + dif1 = mouse_x - (camera_get_view_x(view_camera[0]) + bx + (108 * scaling)); dif2 = dif1 * 2; - if (mouse_y < __view_get(e__VW.YView, 0) + by + hei - dif2) { + if (mouse_y < camera_get_view_y(view_camera[0]) + by + hei - dif2) { stop = 1; } } @@ -114,7 +114,6 @@ if ((highlighted == false) && (highlight > 0)) { highlight -= 0.04; } - var freq; freq = 150; if (line > 0) { @@ -136,7 +135,7 @@ if ((line == 0) && (floor(random(freq)) == 3)) { /* */ /* */ -if (highlighted == true && target > 10 && scr_click_left(,true)) { // Tip of the day: no idea why, but if you split this into two lines, the check will never pass; +if (highlighted == true && target > 10 && scr_click_left(, true)) { + // Tip of the day: no idea why, but if you split this into two lines, the check will never pass; obj_ingame_menu.effect = self.target; } - diff --git a/objects/obj_p_fleet/Alarm_1.gml b/objects/obj_p_fleet/Alarm_1.gml index 064e294e74..cb53337148 100644 --- a/objects/obj_p_fleet/Alarm_1.gml +++ b/objects/obj_p_fleet/Alarm_1.gml @@ -1,152 +1,174 @@ -try_and_report_loop("player alarm 1",function(){ - var spid, dir;spid=0;dir=0; +try_and_report_loop("player alarm 1", function() { + var spid, dir; + spid = 0; + dir = 0; - acted=0; + acted = 0; - if (action=="Lost"){ + if (action == "Lost") { set_fleet_location("Lost"); exit; - - }else if (action==""){ - spid=instance_nearest(x,y,obj_star); + } else if (action == "") { + spid = instance_nearest(x, y, obj_star); // spid.present_fleets+=1; - spid.present_fleet[1]+=1; - if (spid.vision=0) then spid.vision=1; - orbiting=spid; - - if (orbiting!=0) and (instance_exists(orbiting)){ - if ((orbiting.visited == 0)){ - for (var planet_num = 1; planet_num < orbiting.planets; planet_num += 1){ - if (array_length(orbiting.p_feature[planet_num])!=0) then with(orbiting){scr_planetary_feature(planet_num);} + spid.present_fleet[1] += 1; + if (spid.vision == 0) { + spid.vision = 1; + } + orbiting = spid; + + if ((orbiting != 0) && instance_exists(orbiting)) { + if (orbiting.visited == 0) { + for (var planet_num = 1; planet_num < orbiting.planets; planet_num += 1) { + if (array_length(orbiting.p_feature[planet_num]) != 0) { + with (orbiting) { + scr_planetary_feature(planet_num); + } + } } orbiting.visited = 1; } - - meet_system_governors(orbiting); - } - } - - else if (array_contains(FLEET_MOVE_OPTIONS, action)){ - + meet_system_governors(orbiting); + } + } else if (array_contains(FLEET_MOVE_OPTIONS, action)) { var i; set_fleet_location("Warp"); - if (instance_nearest(action_x,action_y,obj_star).storm>0) then exit; - - spid=point_distance(x,y,action_x,action_y); - spid=spid/(action_eta); - dir=point_direction(x,y,action_x,action_y); - - x=x+lengthdir_x(spid,dir); - y=y+lengthdir_y(spid,dir); - - action_eta-=1; - just_left=false; - - if (action_eta=0) and (action="crusade1"){ - var dr=point_direction(room_width/2,room_height/2,x,y); - action_x=x+lengthdir_x(600,dr); - action_y=y+lengthdir_y(600,dr); - action="crusade2"; + if (instance_nearest(action_x, action_y, obj_star).storm > 0) { + exit; + } + + spid = point_distance(x, y, action_x, action_y); + spid = spid / action_eta; + dir = point_direction(x, y, action_x, action_y); + + x = x + lengthdir_x(spid, dir); + y = y + lengthdir_y(spid, dir); + + action_eta -= 1; + just_left = false; + + if ((action_eta == 0) && (action == "crusade1")) { + var dr = point_direction(room_width / 2, room_height / 2, x, y); + action_x = x + lengthdir_x(600, dr); + action_y = y + lengthdir_y(600, dr); + action = "crusade2"; set_fleet_movement(false, "crusade2"); } - if (action_eta=0) and (action="crusade2"){ - with(obj_star){ - if (owner>5) then instance_deactivate_object(id); + if ((action_eta == 0) && (action == "crusade2")) { + with (obj_star) { + if (owner > 5) { + instance_deactivate_object(id); + } var enemies = false; - for(var i=6;i<13;i++){ - if (scr_orbiting_fleet(i)!="none"){ + for (var i = 6; i < 13; i++) { + if (scr_orbiting_fleet(i) != "none") { enemies = true; break; } } - if (enemies) then instance_deactivate_object(id); + if (enemies) { + instance_deactivate_object(id); + } } - var ret=instance_nearest(x,y,obj_star); - action_x=ret.x; - action_y=ret.y; - action="crusade3"; + var ret = instance_nearest(x, y, obj_star); + action_x = ret.x; + action_y = ret.y; + action = "crusade3"; set_fleet_movement(false, "crusade3"); instance_activate_object(obj_star); } - if (action_eta=0) and (action="crusade3"){ + if ((action_eta == 0) && (action == "crusade3")) { // Popup here scr_crusade(); - action=""; + action = ""; } - - - if (action_eta=0) and (action!="crusade1") and (action!="crusade2"){ + + if ((action_eta == 0) && (action != "crusade1") && (action != "crusade2")) { // Check to see if there are already player ships in the spot where this object will move to // If yes, combine the two of them - - var steh=instance_nearest(action_x,action_y,obj_star); - if (steh.vision=0) then steh.vision=1; - steh.present_fleet[1]+=1; - orbiting=steh; + + var steh = instance_nearest(action_x, action_y, obj_star); + if (steh.vision == 0) { + steh.vision = 1; + } + steh.present_fleet[1] += 1; + orbiting = steh; // show_message("Present Fleets at alarm[1]: "+string(steh.present_fleets)); - + meet_system_governors(steh); - if (steh.p_owner[1]=5) or (steh.p_owner[2]=5) or (steh.p_owner[3]=5) or (steh.p_owner[4]=5){ - if (obj_controller.faction_defeated[5]=0) and (obj_controller.known[eFACTION.Ecclesiarchy]=0) then obj_controller.known[eFACTION.Ecclesiarchy]=1; + if ((steh.p_owner[1] == 5) || (steh.p_owner[2] == 5) || (steh.p_owner[3] == 5) || (steh.p_owner[4] == 5)) { + if ((obj_controller.faction_defeated[5] == 0) && (obj_controller.known[eFACTION.Ecclesiarchy] == 0)) { + obj_controller.known[eFACTION.Ecclesiarchy] = 1; + } + } + if ((steh.owner == eFACTION.Eldar) && (obj_controller.faction_defeated[6] == 0) && (obj_controller.known[eFACTION.Eldar] == 0)) { + obj_controller.known[eFACTION.Eldar] = 1; + } + if ((steh.owner == eFACTION.Tau) && (obj_controller.faction_defeated[8] == 0) && (obj_controller.known[eFACTION.Tau] == 0)) { + obj_controller.known[eFACTION.Tau] = 1; } - if (steh.owner = eFACTION.Eldar) and (obj_controller.faction_defeated[6]=0) and (obj_controller.known[eFACTION.Eldar]=0) then obj_controller.known[eFACTION.Eldar]=1; - if (steh.owner = eFACTION.Tau) and (obj_controller.faction_defeated[8]=0) and (obj_controller.known[eFACTION.Tau]=0) then obj_controller.known[eFACTION.Tau]=1; - - action=""; - x=action_x; - y=action_y; - action_x=0; - action_y=0; - - + + action = ""; + x = action_x; + y = action_y; + action_x = 0; + action_y = 0; + var i; set_fleet_location(steh.name); - if (steh.visited == 0){ - for (var plan_num =1; plan_num < 5; plan_num++){ - if (array_length(steh.p_feature[plan_num])!=0)then with(steh){scr_planetary_feature(plan_num);} - } - steh.visited = 1 - } - if (array_length(complex_route)>0){ + if (steh.visited == 0) { + for (var plan_num = 1; plan_num < 5; plan_num++) { + if (array_length(steh.p_feature[plan_num]) != 0) { + with (steh) { + scr_planetary_feature(plan_num); + } + } + } + steh.visited = 1; + } + if (array_length(complex_route) > 0) { set_new_player_fleet_course(complex_route); - } + } } - } - if (action="") and (obj_controller.known[eFACTION.Eldar]=0){ - instance_activate_object(obj_star);// Kind of half-ass band-aiding that bug, might need to remove this later; this might cause problems later - - - with(obj_star){ - if (p_type[1]!="Craftworld") then instance_deactivate_object(id); - } + if ((action == "") && (obj_controller.known[eFACTION.Eldar] == 0)) { + instance_activate_object(obj_star); // Kind of half-ass band-aiding that bug, might need to remove this later; this might cause problems later - var steh;steh=instance_nearest(x,y,obj_star); - if (instance_exists(steh)) and (steh!=0){ - - if (steh.p_type[1]="Craftworld"){ - var dist, rando; - dist=999;rando=floor(random(100))+1; - dist=point_distance(x,y,steh.old_x,steh.old_y); - - // show_message("Dist: "+string(dist)+", Rando: "+string(rando)); - - if (rando>=95) and (dist<=300){ - obj_controller.known[eFACTION.Eldar]=1; - scr_alert("green","elfs","Eldar Craftworld discovered.",steh.old_x,steh.old_y); - with(obj_en_fleet){if (owner = eFACTION.Eldar) then image_alpha=1;} + with (obj_star) { + if (p_type[1] != "Craftworld") { + instance_deactivate_object(id); } - // Quene eldar introduction - // if (rando>=95) and (dist<=300) then show_message("MON'KEIGH"); } + + var steh; + steh = instance_nearest(x, y, obj_star); + if (instance_exists(steh) && (steh != 0)) { + if (steh.p_type[1] == "Craftworld") { + var dist, rando; + dist = 999; + rando = floor(random(100)) + 1; + dist = point_distance(x, y, steh.old_x, steh.old_y); + + // show_message("Dist: "+string(dist)+", Rando: "+string(rando)); + + if ((rando >= 95) && (dist <= 300)) { + obj_controller.known[eFACTION.Eldar] = 1; + scr_alert("green", "elfs", "Eldar Craftworld discovered.", steh.old_x, steh.old_y); + with (obj_en_fleet) { + if (owner == eFACTION.Eldar) { + image_alpha = 1; + } + } + } + // Quene eldar introduction + // if (rando>=95) and (dist<=300) then show_message("MON'KEIGH"); + } } - - instance_activate_object(obj_star); + instance_activate_object(obj_star); } }); - diff --git a/objects/obj_p_fleet/Alarm_11.gml b/objects/obj_p_fleet/Alarm_11.gml index f891057757..718c564b5a 100644 --- a/objects/obj_p_fleet/Alarm_11.gml +++ b/objects/obj_p_fleet/Alarm_11.gml @@ -1,7 +1,4 @@ - -if (action="") and (orbiting!=0){ - orbiting=instance_nearest(x,y,obj_star); - orbiting.present_fleet[1]+=1; +if ((action == "") && (orbiting != 0)) { + orbiting = instance_nearest(x, y, obj_star); + orbiting.present_fleet[1] += 1; } - - diff --git a/objects/obj_p_fleet/Alarm_2.gml b/objects/obj_p_fleet/Alarm_2.gml index f31914df9b..0ceb87ed03 100644 --- a/objects/obj_p_fleet/Alarm_2.gml +++ b/objects/obj_p_fleet/Alarm_2.gml @@ -1,8 +1,3 @@ - - // At this stage check to see if any of the ships within this object match with the ID // of a destroyed ship within obj_ini -// If yes then remove that ship from the array and bump the others up to take it's place - - - +// If yes then remove that ship from the array and bump the others up to take it's place diff --git a/objects/obj_p_fleet/Alarm_3.gml b/objects/obj_p_fleet/Alarm_3.gml index 651c5e213d..faff553a20 100644 --- a/objects/obj_p_fleet/Alarm_3.gml +++ b/objects/obj_p_fleet/Alarm_3.gml @@ -1,59 +1,65 @@ - -if (obj_controller.zoomed=1){ - obj_controller.x=self.x; - obj_controller.y=self.y; +if (obj_controller.zoomed == 1) { + obj_controller.x = self.x; + obj_controller.y = self.y; } -obj_controller.popup=1;// 1: fleet, 2: other fleet, 3: other -selected=1; -obj_controller.fleet_minimized=0; - +obj_controller.popup = 1; // 1: fleet, 2: other fleet, 3: other +selected = 1; +obj_controller.fleet_minimized = 0; -var xx=x,yy=y; +var xx = x, yy = y; -obj_controller.selected=id; -if (instance_exists(obj_fleet_select)){ - if (obj_controller.selected==obj_fleet_select.id){ +obj_controller.selected = id; +if (instance_exists(obj_fleet_select)) { + if (obj_controller.selected == obj_fleet_select.id) { exit; } } // obj_controller.selected=self; -obj_controller.sel_owner=self.owner; +obj_controller.sel_owner = self.owner; // show_message(obj_controller.selected); -obj_controller.cooldown=8; +obj_controller.cooldown = 8; -if (obj_controller.zoomed){ +if (obj_controller.zoomed) { scr_zoom(); } // Pass variables to obj_controller.temp[t]=""; here -with(obj_fleet_select){instance_destroy();} -instance_create(x,y,obj_fleet_select); -obj_fleet_select.owner=self.owner; -obj_fleet_select.target=self.id; -obj_fleet_select.escort=escort_number; -obj_fleet_select.frigate=frigate_number; -obj_fleet_select.capital=capital_number; - - - -var i=-1; -repeat(91){i+=1; - if (i<=20) then capital_sel[i]=1; - frigate_sel[i]=1; - escort_sel[i]=1; - - if (obj_controller.fest_scheduled>0) and (obj_controller.fest_sid>0){ - if (i<=20){if (capital_num[i]=obj_controller.fest_sid) and (capital_sel[w]=1) then capital_sel[w]=0;} - if (frigate_num[i]=obj_controller.fest_sid) and (frigate_sel[i]=1) then frigate_sel[i]=0; - if (escort_num[i]=obj_controller.fest_sid) and (escort_sel[i]=1) then escort_sel[i]=0; - } +with (obj_fleet_select) { + instance_destroy(); } +instance_create(x, y, obj_fleet_select); +obj_fleet_select.owner = self.owner; +obj_fleet_select.target = self.id; +obj_fleet_select.escort = escort_number; +obj_fleet_select.frigate = frigate_number; +obj_fleet_select.capital = capital_number; +var i = -1; +repeat (91) { + i += 1; + if (i <= 20) { + capital_sel[i] = 1; + } + frigate_sel[i] = 1; + escort_sel[i] = 1; + + if ((obj_controller.fest_scheduled > 0) && (obj_controller.fest_sid > 0)) { + if (i <= 20) { + if ((capital_num[i] == obj_controller.fest_sid) && (capital_sel[w] == 1)) { + capital_sel[w] = 0; + } + } + if ((frigate_num[i] == obj_controller.fest_sid) && (frigate_sel[i] == 1)) { + frigate_sel[i] = 0; + } + if ((escort_num[i] == obj_controller.fest_sid) && (escort_sel[i] == 1)) { + escort_sel[i] = 0; + } + } +} /*var ii;ii=0;ii+=capital_number;ii+=round((frigate_number/2));ii+=round((escort_number/4)); if (ii<=1) then ii=1;image_index=ii;*/ - /* */ /* */ - diff --git a/objects/obj_p_fleet/Alarm_4.gml b/objects/obj_p_fleet/Alarm_4.gml index 203fe9e104..98ad26b469 100644 --- a/objects/obj_p_fleet/Alarm_4.gml +++ b/objects/obj_p_fleet/Alarm_4.gml @@ -1,18 +1,15 @@ - var sys_dist, mine, connected, fleet, cont; -sys_dist=9999;connected=0;cont=0; - +sys_dist = 9999; +connected = 0; +cont = 0; -var eta=calculate_fleet_eta(x,y, action_x,action_y,action_spd, false, false,warp_able); +var eta = calculate_fleet_eta(x, y, action_x, action_y, action_spd, false, false, warp_able); // if (connected=0) then eta=eta*2; // if (connected=1) then connected=1; // if (web=1) then eta=1; -action_eta=eta; - +action_eta = eta; // if (action="crusade2") then action="crusade3"; // if (action="crusade1") then action="crusade2"; -set_fleet_location("Warp") - - +set_fleet_location("Warp"); diff --git a/objects/obj_p_fleet/Alarm_5.gml b/objects/obj_p_fleet/Alarm_5.gml index ded94fbfb5..9012a59566 100644 --- a/objects/obj_p_fleet/Alarm_5.gml +++ b/objects/obj_p_fleet/Alarm_5.gml @@ -1,43 +1,52 @@ - var i, minhp, maxhp; - - -if (capital_number>0){ - i=0;minhp=0;maxhp=0; - for (var i=0;i-1){ - minhp+=obj_ini.ship_hp[i]; - maxhp+=obj_ini.ship_maxhp[i]; +if (capital_number > 0) { + i = 0; + minhp = 0; + maxhp = 0; + for (var i = 0; i < array_length(capital); i++) { + if ((capital[i] != "") && (capital_num[i] > -1)) { + minhp += obj_ini.ship_hp[i]; + maxhp += obj_ini.ship_maxhp[i]; } } - if (maxhp>0) then capital_health=round((minhp/maxhp)*100); - else capital_health=0; + if (maxhp > 0) { + capital_health = round((minhp / maxhp) * 100); + } else { + capital_health = 0; + } } -if (frigate_number>0){ - i=0;minhp=0;maxhp=0; - for (var i=0;i-1 && frigate_num[i] 0) { + i = 0; + minhp = 0; + maxhp = 0; + for (var i = 0; i < array_length(frigate); i++) { + if (frigate[i] != "" && frigate_num[i] > -1 && frigate_num[i] < array_length(obj_ini.ship_hp)) { + minhp += obj_ini.ship_hp[i]; + maxhp += obj_ini.ship_maxhp[i]; } } - if (maxhp>0) then frigate_health=round((minhp/maxhp)*100); - else frigate_health=0; + if (maxhp > 0) { + frigate_health = round((minhp / maxhp) * 100); + } else { + frigate_health = 0; + } } -if (escort_number>0){ - i=0;minhp=0;maxhp=0; - for (var i=0;i-1){ - minhp+=obj_ini.ship_hp[i]; - maxhp+=obj_ini.ship_maxhp[i]; +if (escort_number > 0) { + i = 0; + minhp = 0; + maxhp = 0; + for (var i = 0; i < array_length(escort); i++) { + if ((escort[i] != "") && (escort_num[i] > -1)) { + minhp += obj_ini.ship_hp[i]; + maxhp += obj_ini.ship_maxhp[i]; } } - if (maxhp>0) then escort_health=round((minhp/maxhp)*100); - else escort_health=0; + if (maxhp > 0) { + escort_health = round((minhp / maxhp) * 100); + } else { + escort_health = 0; + } } - - - diff --git a/objects/obj_p_fleet/Alarm_6.gml b/objects/obj_p_fleet/Alarm_6.gml index a578e46c9c..0e1de6d0be 100644 --- a/objects/obj_p_fleet/Alarm_6.gml +++ b/objects/obj_p_fleet/Alarm_6.gml @@ -1,12 +1,10 @@ - - -with(obj_ini){ +with (obj_ini) { scr_ini_ship_cleanup(); } -if (player_fleet_ship_count() == 0) then instance_destroy(); - - +if (player_fleet_ship_count() == 0) { + instance_destroy(); +} /* */ /* */ diff --git a/objects/obj_p_fleet/Alarm_7.gml b/objects/obj_p_fleet/Alarm_7.gml index 63b1549765..7f1765c106 100644 --- a/objects/obj_p_fleet/Alarm_7.gml +++ b/objects/obj_p_fleet/Alarm_7.gml @@ -1,29 +1,32 @@ - - - // right here check for artifacts to be moved -if (capital_number=0) then exit; -var c=0,good=0; +if (capital_number == 0) { + exit; +} +var c = 0, good = 0; var capital_id; -var capital_list = fleet_full_ship_array(, ,true,true); -for(var i=0;igood){ - c=capital_id; - good=obj_ini.ship_hp[capital_id]; + if (obj_ini.ship[capital_id] == "") { + continue; + } + if (obj_ini.ship_hp[capital_id] > good) { + c = capital_id; + good = obj_ini.ship_hp[capital_id]; } } -if (good>0){ +if (good > 0) { var ships_list = fleet_full_ship_array(, true); - for (var a=0;aself.id){ - +if ((other.x == self.x) && (other.y == self.y) && (action == "") && (other.action == "") && (other.owner == eFACTION.Player)) { + if (other.id > self.id) { merge_player_fleets(other.id, self.id); - } } - - diff --git a/objects/obj_p_fleet/Create_0.gml b/objects/obj_p_fleet/Create_0.gml index e0d27e540d..c3185a9df0 100644 --- a/objects/obj_p_fleet/Create_0.gml +++ b/objects/obj_p_fleet/Create_0.gml @@ -1,26 +1,25 @@ - -owner = eFACTION.Player; -capital_number=0; -frigate_number=0; -escort_number=0; -selected=0; -orbiting=0; -warp_able=true; -ii_check=choose(8,9,10,11,12); - -var wop=instance_nearest(x,y,obj_star); -if (instance_exists(wop)) and (y>0) and (x>0){ - if (point_distance(x,y,wop.x,wop.y)<=40){ - orbiting=wop; - wop.present_fleet[1]+=1; +owner = eFACTION.Player; +capital_number = 0; +frigate_number = 0; +escort_number = 0; +selected = 0; +orbiting = 0; +warp_able = true; +ii_check = choose(8, 9, 10, 11, 12); + +var wop = instance_nearest(x, y, obj_star); +if (instance_exists(wop) && (y > 0) && (x > 0)) { + if (point_distance(x, y, wop.x, wop.y) <= 40) { + orbiting = wop; + wop.present_fleet[1] += 1; } } point_breakdown = single_loc_point_data(); -image_xscale=1.25; -image_yscale=1.25; +image_xscale = 1.25; +image_yscale = 1.25; -var i=-1; +var i = -1; capital = []; capital_num = []; capital_sel = []; @@ -36,72 +35,69 @@ escort_num = []; escort_sel = []; escort_uid = []; +image_speed = 0; -image_speed=0; - -fix=2; +fix = 2; -capital_health=100; -frigate_health=100; -escort_health=100; +capital_health = 100; +frigate_health = 100; +escort_health = 100; complex_route = []; -just_left=false; - - -action=""; -action_x=0; -action_y=0; -action_spd=128; -action_eta=0; -connected=0; -acted=0; -hurssy=0; -hurssy_time=0; -/// Called from save function to take all object variables and convert them to a json savable format and return it -serialize = function(){ +just_left = false; + +action = ""; +action_x = 0; +action_y = 0; +action_spd = 128; +action_eta = 0; +connected = 0; +acted = 0; +hurssy = 0; +hurssy_time = 0; +/// Called from save function to take all object variables and convert them to a json savable format and return it +serialize = function() { var object_fleet = self; - + var save_data = { obj: object_get_name(object_index), x, y, - point_breakdown: point_breakdown - } - var excluded_from_save = ["temp", "serialize", "deserialize"] + point_breakdown: point_breakdown, + }; + var excluded_from_save = ["temp", "serialize", "deserialize"]; copy_serializable_fields(object_fleet, save_data, excluded_from_save); return save_data; -} +}; // debugl("obj_p_fleet save data serialized:"); // debugl(json_stringify(serialize(), true)); -deserialize = function(save_data){ +deserialize = function(save_data) { var exclusions = ["orbiting"]; // skip automatic setting of certain vars, handle explicitly later // Automatic var setting var all_names = struct_get_names(save_data); var _len = array_length(all_names); - for(var i = 0; i < _len; i++){ + for (var i = 0; i < _len; i++) { var var_name = all_names[i]; - if(array_contains(exclusions, var_name)){ + if (array_contains(exclusions, var_name)) { continue; } var loaded_value = struct_get(save_data, var_name); try { - variable_struct_set(self, var_name, loaded_value); - } catch (e){ + variable_struct_set(self, var_name, loaded_value); + } catch (e) { show_debug_message(e); } } - - if(save_data.orbiting != 0){ + + if (save_data.orbiting != 0) { var nearest_star = instance_nearest(x, y, obj_star); set_player_fleet_image(); orbiting = nearest_star; } - -} +}; -#endregion \ No newline at end of file +#endregion diff --git a/objects/obj_p_fleet/Destroy_0.gml b/objects/obj_p_fleet/Destroy_0.gml index 93d3f62e62..0d9ab96c6c 100644 --- a/objects/obj_p_fleet/Destroy_0.gml +++ b/objects/obj_p_fleet/Destroy_0.gml @@ -1,6 +1,6 @@ - -if (action="") and (orbiting!=0){ - if (instance_exists(orbiting)){orbiting.present_fleet[1]-=1;} - orbiting=0; +if ((action == "") && (orbiting != 0)) { + if (instance_exists(orbiting)) { + orbiting.present_fleet[1] -= 1; + } + orbiting = 0; } - diff --git a/objects/obj_p_fleet/Draw_0.gml b/objects/obj_p_fleet/Draw_0.gml index 4a06e02fcb..aadd6e3e43 100644 --- a/objects/obj_p_fleet/Draw_0.gml +++ b/objects/obj_p_fleet/Draw_0.gml @@ -1,114 +1,148 @@ +if (!instance_exists(obj_star)) { + exit; +} -if (!instance_exists(obj_star)) then exit; - -if (instance_exists(orbiting)) and (obj_controller.is_test_map=true){ +if (instance_exists(orbiting) && (obj_controller.is_test_map == true)) { draw_set_color(c_red); - draw_line_width(x,y,orbiting.x,orbiting.y,1); + draw_line_width(x, y, orbiting.x, orbiting.y, 1); } var scale = obj_controller.scale_mod; -if (x<0) or (x>room_width) or (y<0) or (y>room_height) then exit; -if (image_alpha=0) then exit; +if ((x < 0) || (x > room_width) || (y < 0) || (y > room_height)) { + exit; +} +if (image_alpha == 0) { + exit; +} -var coords = [0,0]; +var coords = [0, 0]; -var near_star = instance_nearest(x,y, obj_star); -if (x==near_star.x && y==near_star.y){ - var coords = [24,-24]; +var near_star = instance_nearest(x, y, obj_star); +if (x == near_star.x && y == near_star.y) { + var coords = [24, -24]; } -var within=false; -var m_dist=point_distance(mouse_x,mouse_y,x+(coords[0]*scale),y+((coords[1])*scale+(12*scale))); +var within = false; +var m_dist = point_distance(mouse_x, mouse_y, x + (coords[0] * scale), y + (coords[1] * scale + (12 * scale))); -if (obj_controller.zoomed=0){ - if (m_dist<=(16*scale)) then within=1; +if (obj_controller.zoomed == 0) { + if (m_dist <= (16 * scale)) { + within = 1; + } } -if (obj_controller.zoomed=1){ +if (obj_controller.zoomed == 1) { within = true; - if (m_dist<=24){ - within=1; - } + if (m_dist <= 24) { + within = 1; + } } var select_instance = instance_exists(obj_fleet_select); -if (!select_instance) then selected=0; -if ( !keyboard_check(vk_shift)){ - if (within){ - if (mouse_check_button_pressed(mb_left) && obj_controller.menu==0 && !selected){ - alarm[3]=1; - } - } else (mouse_check_button_pressed(mb_left)){ - if (selected){ - if (select_instance){ - if (instance_exists(obj_fleet_select.player_fleet)){ - if !(obj_fleet_select.player_fleet.id == self.id && !obj_fleet_select.currently_entered){ - selected=0; +if (!select_instance) { + selected = 0; +} +if (!keyboard_check(vk_shift)) { + if (within) { + if (mouse_check_button_pressed(mb_left) && obj_controller.menu == 0 && !selected) { + alarm[3] = 1; + } + } else { + (mouse_check_button_pressed(mb_left)) + } + { + if (selected) { + if (select_instance) { + if (instance_exists(obj_fleet_select.player_fleet)) { + if (!(obj_fleet_select.player_fleet.id == self.id && !obj_fleet_select.currently_entered)) { + selected = 0; } } } } else { - selected=0; + selected = 0; } } } // if (obj_controller.selected!=0) and (selected=1) then within=1; -if (obj_controller.selecting_planet>0){ - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249){ - if (instance_exists(obj_star_select)){if (obj_star_select.button1!="") then within=0;} +if (obj_controller.selecting_planet > 0) { + if ((mouse_x >= camera_get_view_x(view_camera[0]) + 529) && (mouse_y >= camera_get_view_y(view_camera[0]) + 234) && (mouse_x < camera_get_view_x(view_camera[0]) + 611) && (mouse_y < camera_get_view_y(view_camera[0]) + 249)) { + if (instance_exists(obj_star_select)) { + if (obj_star_select.button1 != "") { + within = 0; + } + } } - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234+16) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249+16){ - if (instance_exists(obj_star_select)){if (obj_star_select.button2!="") then within=0;} + if ((mouse_x >= camera_get_view_x(view_camera[0]) + 529) && (mouse_y >= camera_get_view_y(view_camera[0]) + 234 + 16) && (mouse_x < camera_get_view_x(view_camera[0]) + 611) && (mouse_y < camera_get_view_y(view_camera[0]) + 249 + 16)) { + if (instance_exists(obj_star_select)) { + if (obj_star_select.button2 != "") { + within = 0; + } + } } - if (mouse_x>=__view_get( e__VW.XView, 0 )+529) and (mouse_y>=__view_get( e__VW.YView, 0 )+234+32) and (mouse_x<__view_get( e__VW.XView, 0 )+611) and (mouse_y<__view_get( e__VW.YView, 0 )+249+32){ - if (instance_exists(obj_star_select)){if (obj_star_select.button3!="") then within=0;} + if ((mouse_x >= camera_get_view_x(view_camera[0]) + 529) && (mouse_y >= camera_get_view_y(view_camera[0]) + 234 + 32) && (mouse_x < camera_get_view_x(view_camera[0]) + 611) && (mouse_y < camera_get_view_y(view_camera[0]) + 249 + 32)) { + if (instance_exists(obj_star_select)) { + if (obj_star_select.button3 != "") { + within = 0; + } + } } } -var line_width = obj_controller.zoomed ? 6:1; +var line_width = obj_controller.zoomed ? 6 : 1; var line_width = sqr(scale); var text_size = sqr(scale); -if (action!=""){ - draw_set_halign(fa_left);draw_set_alpha(1); +if (action != "") { + draw_set_halign(fa_left); + draw_set_alpha(1); draw_set_color(c_white); - draw_line_width(x,y,action_x,action_y,line_width); - // + draw_line_width(x, y, action_x, action_y, line_width); + // draw_set_font(fnt_40k_14b); - draw_text_transformed(x+12,y,string_hash_to_newline("ETA "+string(action_eta)),text_size,text_size,0); - if (array_length(complex_route)>0){ - var next_loc = instance_nearest(action_x,action_y, obj_star); - for (var i=0;i 0) { + var next_loc = instance_nearest(action_x, action_y, obj_star); + for (var i = 0; i < array_length(complex_route); i++) { var target_loc = star_by_name(complex_route[i]); draw_set_color(c_blue); - draw_set_alpha(1); - draw_line_dashed(next_loc.x,next_loc.y,target_loc.x,target_loc.y,16,line_width); + draw_set_alpha(1); + draw_line_dashed(next_loc.x, next_loc.y, target_loc.x, target_loc.y, 16, line_width); next_loc = star_by_name(complex_route[i]); } } } - -if (within=1) or (selected>0){ +if ((within == 1) || (selected > 0)) { var ppp; - if (owner = eFACTION.Player) then ppp=global.chapter_name; - if (capital_number=1) and (frigate_number=0) and (escort_number=0) then ppp=capital[0]; - if (capital_number=0) and (frigate_number=1) and (escort_number=0) then ppp=frigate[0]; - if (capital_number=0) and (frigate_number=0) and (escort_number=1) then ppp=escort[0]; + if (owner == eFACTION.Player) { + ppp = global.chapter_name; + } + if ((capital_number == 1) && (frigate_number == 0) && (escort_number == 0)) { + ppp = capital[0]; + } + if ((capital_number == 0) && (frigate_number == 1) && (escort_number == 0)) { + ppp = frigate[0]; + } + if ((capital_number == 0) && (frigate_number == 0) && (escort_number == 1)) { + ppp = escort[0]; + } // ppp=acted; - // + // draw_set_color(CM_GREEN_COLOR); draw_set_font(fnt_40k_14b); draw_set_halign(fa_center); - if (obj_controller.zoomed) then draw_text_transformed(x,y-48,string_hash_to_newline(ppp),text_size,text_size,0);// was 1.4 + if (obj_controller.zoomed) { + draw_text_transformed(x, y - 48, string_hash_to_newline(ppp), text_size, text_size, 0); + } // was 1.4 draw_set_halign(fa_left); - draw_circle(x+(coords[0]*scale),y+(coords[1]*scale),12*scale,0); + draw_circle(x + (coords[0] * scale), y + (coords[1] * scale), 12 * scale, 0); } else { draw_set_color(global.star_name_colors[eFACTION.Player]); draw_set_alpha(0.5); - draw_circle(x+(coords[0]*scale),y+(coords[1]*scale),12*scale,0); + draw_circle(x + (coords[0] * scale), y + (coords[1] * scale), 12 * scale, 0); draw_set_alpha(1); } @@ -118,16 +152,6 @@ if (within=1) or (selected>0){ // var draw_y = y - orbiting.y; // } +draw_sprite_ext(sprite_index, image_index, x + (coords[0] * scale), y + (coords[1] * scale), 1 * scale, 1 * scale, 0, c_white, 1); - -draw_sprite_ext(sprite_index,image_index,x+(coords[0]*scale),y+(coords[1]*scale),1*scale,1*scale,0,c_white,1); - -// draw_sprite_ext(sprite_index,image_index,(draw_x*scale),(draw_y*scale),1*scale,1*scale,0,c_white,1) - - - - - - - - +// draw_sprite_ext(sprite_index,image_index,(draw_x*scale),(draw_y*scale),1*scale,1*scale,0,c_white,1) diff --git a/objects/obj_p_fleet/Mouse_50.gml b/objects/obj_p_fleet/Mouse_50.gml index f3e714d426..f69b41afb6 100644 --- a/objects/obj_p_fleet/Mouse_50.gml +++ b/objects/obj_p_fleet/Mouse_50.gml @@ -1,31 +1,33 @@ var __b__; __b__ = action_if_number(obj_drop_select, 0, 0); -if __b__ -{ -__b__ = action_if_number(obj_bomb_select, 0, 0); -if __b__ -{ - - -var m_dist, exi;exi=0; - -m_dist=point_distance(x,y,mouse_x,mouse_y); - - -if (!scr_void_click()){ - exit; -} - - -if ((obj_controller.zoomed=0) and (mouse_y<__view_get( e__VW.YView, 0 )+60)) or (obj_controller.menu!=0) then exi=1; -if ((obj_controller.zoomed=0) and (mouse_y>__view_get( e__VW.YView, 0 )+836)) or (obj_controller.menu!=0) then exi=1; - -if (exi=1) then exit; - - -if (obj_controller.popup=1) and (obj_controller.cooldown<=0){obj_controller.selected=0;obj_controller.popup=0;selected=0;} - -} +if (__b__) { + __b__ = action_if_number(obj_bomb_select, 0, 0); + if (__b__) { + var m_dist, exi; + exi = 0; + + m_dist = point_distance(x, y, mouse_x, mouse_y); + + if (!scr_void_click()) { + exit; + } + + if (((obj_controller.zoomed == 0) && (mouse_y < camera_get_view_y(view_camera[0]) + 60)) || (obj_controller.menu != 0)) { + exi = 1; + } + if (((obj_controller.zoomed == 0) && (mouse_y > camera_get_view_y(view_camera[0]) + 836)) || (obj_controller.menu != 0)) { + exi = 1; + } + + if (exi == 1) { + exit; + } + + if ((obj_controller.popup == 1) && (obj_controller.cooldown <= 0)) { + obj_controller.selected = 0; + obj_controller.popup = 0; + selected = 0; + } + } } /* */ - \ No newline at end of file diff --git a/objects/obj_p_fleet/Step_0.gml b/objects/obj_p_fleet/Step_0.gml index ff07d786e2..1c712b0f0a 100644 --- a/objects/obj_p_fleet/Step_0.gml +++ b/objects/obj_p_fleet/Step_0.gml @@ -1,20 +1,26 @@ -ii_check-=1; -if (action=="Lost") then exit; -if (action!="") and (orbiting!=0){ - orbiting = instance_nearest(x,y,obj_star) - orbiting.present_fleet[1]-=1; - orbiting=0; +ii_check -= 1; +if (action == "Lost") { + exit; +} +if ((action != "") && (orbiting != 0)) { + orbiting = instance_nearest(x, y, obj_star); + orbiting.present_fleet[1] -= 1; + orbiting = 0; } action_spd = calculate_action_speed(); -if (ii_check=0){set_player_fleet_image()} - -if (global.load>=0) and (sprite_index!=spr_fleet_tiny) then sprite_index=spr_fleet_tiny; - -if (fix>-1) then fix-=1; -if (fix=0) and (action==""){ - set_fleet_location(instance_nearest(x,y,obj_star).name); +if (ii_check == 0) { + set_player_fleet_image(); } +if ((global.load >= 0) && (sprite_index != spr_fleet_tiny)) { + sprite_index = spr_fleet_tiny; +} +if (fix > -1) { + fix -= 1; +} +if ((fix == 0) && (action == "")) { + set_fleet_location(instance_nearest(x, y, obj_star).name); +} diff --git a/objects/obj_p_ship/Alarm_0.gml b/objects/obj_p_ship/Alarm_0.gml index eabf2f872f..322c42c9e4 100644 --- a/objects/obj_p_ship/Alarm_0.gml +++ b/objects/obj_p_ship/Alarm_0.gml @@ -1,225 +1,238 @@ - - -action=""; - direction=0; - - - cooldown1=0; - cooldown2=0; - cooldown3=0; - cooldown4=0; - cooldown5=0; - - - name=obj_ini.ship[ship_id]; - class=obj_ini.ship_class[ship_id]; - hp=obj_ini.ship_hp[ship_id]*1; - maxhp=obj_ini.ship_hp[ship_id]*1; - conditions=obj_ini.ship_conditions[ship_id]; - shields=obj_ini.ship_shields[ship_id]*100; - maxshields=shields; - armour_front=obj_ini.ship_front_armour[ship_id]; - armour_other=obj_ini.ship_other_armour[ship_id]; - weapons=obj_ini.ship_weapons[ship_id]; - turrets=0; - ship_colour=obj_controller.body_colour_replace; - weapon = obj_ini.ship_wep[ship_id] - - weapon_facing[1]=""; - weapon_cooldown[1]=0; - weapon_hp[1]=hp/4; - weapon_dam[1]=0; - weapon_ammo[1]=999; - weapon_range[1]=0; - weapon_minrange[1]=0; - weapon_facing[2]=""; - weapon_cooldown[2]=0; - weapon_hp[2]=hp/4; - weapon_dam[2]=0; - weapon_ammo[2]=999; - weapon_range[2]=0; - weapon_minrange[2]=0; - - weapon_facing[3]=""; - weapon_cooldown[3]=0; - weapon_hp[3]=hp/4; - weapon_dam[3]=0; - weapon_ammo[3]=999; - weapon_range[3]=0; - weapon_minrange[3]=0; - - weapon_facing[4]=""; - weapon_cooldown[4]=0; - weapon_hp[4]=hp/4; - weapon_dam[4]=0; - weapon_ammo[4]=999; - weapon_range[4]=0; - weapon_minrange[4]=0; - - weapon_facing[5]=""; - weapon_cooldown[5]=0; - weapon_hp[5]=hp/4; - weapon_dam[5]=0; - weapon_ammo[5]=999; - weapon_range[5]=0; - weapon_minrange[5]=0; - - - - - - if (class="Battle Barge"){ - turrets=3; - weapons=5; - shield_size=3; - sprite_index=spr_ship_bb; - weapon_facing[1]="left"; - weapon_dam[1]=15; - weapon_range[1]=450; - weapon_cooldown[1]=30; - weapon_facing[2]="right"; - weapon_dam[2]=15; - weapon_range[2]=450; - weapon_cooldown[2]=30; - weapon_facing[3]="special"; - weapon_cooldown[3]=90; - weapon_ammo[3]=3; - weapon_range[3]=9999; - weapon_facing[4]="front"; - weapon_dam[4]=12; - weapon_range[4]=1000; - weapon_cooldown[4]=120;// volley several - weapon_facing[5]="most"; - weapon_dam[5]=16; - weapon_range[5]=300; - weapon_cooldown[5]=30; - } - - if (class="Slaughtersong"){turrets=3; - weapons=5;shield_size=3;sprite_index=spr_ship_song; - weapon_facing[1]="most"; - weapon_dam[1]=16; - weapon_range[1]=550; - weapon_cooldown[1]=26; - weapon_facing[2]="most"; - weapon_dam[2]=16; - weapon_range[2]=550; - weapon_cooldown[2]=26; - weapon_facing[3]="most"; - weapon_dam[3]=16; - weapon_range[3]=550; - weapon_cooldown[3]=26; - weapon_facing[4]="front"; - weapon_dam[4]=32; - weapon_range[4]=1000; - weapon_cooldown[4]=90; - } - - -if (class="Gloriana"){ - turrets=3; - weapons=5; - shield_size=3; - sprite_index=spr_ship_song; - weapon_facing[1]="most"; - weapon_dam[1]=16; - weapon_range[1]=550; - weapon_cooldown[1]=26; - weapon_facing[2]="most"; - weapon_dam[2]=16; - weapon_range[2]=550; - weapon_cooldown[2]=26; - weapon_facing[3]="most"; - weapon_dam[3]=16; - weapon_range[3]=550; - weapon_cooldown[3]=26; - weapon_facing[4]="front"; - weapon_dam[4]=32; - weapon_range[4]=1000; - weapon_cooldown[4]=90; +action = ""; +direction = 0; + +cooldown1 = 0; +cooldown2 = 0; +cooldown3 = 0; +cooldown4 = 0; +cooldown5 = 0; + +name = obj_ini.ship[ship_id]; +class = obj_ini.ship_class[ship_id]; +hp = obj_ini.ship_hp[ship_id] * 1; +maxhp = obj_ini.ship_hp[ship_id] * 1; +conditions = obj_ini.ship_conditions[ship_id]; +shields = obj_ini.ship_shields[ship_id] * 100; +maxshields = shields; +armour_front = obj_ini.ship_front_armour[ship_id]; +armour_other = obj_ini.ship_other_armour[ship_id]; +weapons = obj_ini.ship_weapons[ship_id]; +turrets = 0; +ship_colour = obj_controller.body_colour_replace; +weapon = obj_ini.ship_wep[ship_id]; + +weapon_facing[1] = ""; +weapon_cooldown[1] = 0; +weapon_hp[1] = hp / 4; +weapon_dam[1] = 0; +weapon_ammo[1] = 999; +weapon_range[1] = 0; +weapon_minrange[1] = 0; +weapon_facing[2] = ""; +weapon_cooldown[2] = 0; +weapon_hp[2] = hp / 4; +weapon_dam[2] = 0; +weapon_ammo[2] = 999; +weapon_range[2] = 0; +weapon_minrange[2] = 0; + +weapon_facing[3] = ""; +weapon_cooldown[3] = 0; +weapon_hp[3] = hp / 4; +weapon_dam[3] = 0; +weapon_ammo[3] = 999; +weapon_range[3] = 0; +weapon_minrange[3] = 0; + +weapon_facing[4] = ""; +weapon_cooldown[4] = 0; +weapon_hp[4] = hp / 4; +weapon_dam[4] = 0; +weapon_ammo[4] = 999; +weapon_range[4] = 0; +weapon_minrange[4] = 0; + +weapon_facing[5] = ""; +weapon_cooldown[5] = 0; +weapon_hp[5] = hp / 4; +weapon_dam[5] = 0; +weapon_ammo[5] = 999; +weapon_range[5] = 0; +weapon_minrange[5] = 0; + +if (class == "Battle Barge") { + turrets = 3; + weapons = 5; + shield_size = 3; + sprite_index = spr_ship_bb; + weapon_facing[1] = "left"; + weapon_dam[1] = 15; + weapon_range[1] = 450; + weapon_cooldown[1] = 30; + weapon_facing[2] = "right"; + weapon_dam[2] = 15; + weapon_range[2] = 450; + weapon_cooldown[2] = 30; + weapon_facing[3] = "special"; + weapon_cooldown[3] = 90; + weapon_ammo[3] = 3; + weapon_range[3] = 9999; + weapon_facing[4] = "front"; + weapon_dam[4] = 12; + weapon_range[4] = 1000; + weapon_cooldown[4] = 120; // volley several + weapon_facing[5] = "most"; + weapon_dam[5] = 16; + weapon_range[5] = 300; + weapon_cooldown[5] = 30; } - if (class="Strike Cruiser"){turrets=1; - weapons=4; - shield_size=1; - sprite_index=spr_ship_stri; - weapon_facing[1]="left"; - weapon_dam[1]=8; - weapon_range[1]=300; - weapon_cooldown[1]=30; - weapon_facing[2]="right"; - weapon_dam[2]=8; - weapon_range[2]=300; - weapon_cooldown[2]=30; - weapon_facing[3]="special"; - weapon_cooldown[3]=90; - weapon_ammo[3]=3; - weapon_range[3]=9999; - weapon_facing[4]="most"; - weapon_dam[4]=12; - weapon_range[4]=300; - weapon_cooldown[4]=30; - } - if (class="Hunter"){turrets=1; - weapons=2;shield_size=1;sprite_index=spr_ship_hunt; - weapon_facing[1]="front"; - weapon_dam[1]=8; - weapon_range[1]=450; - weapon_cooldown[1]=60; - weapon_facing[2]="most"; - weapon_dam[2]=8; - weapon_range[2]=300; - weapon_cooldown[2]=60; - } +if (class == "Slaughtersong") { + turrets = 3; + weapons = 5; + shield_size = 3; + sprite_index = spr_ship_song; + weapon_facing[1] = "most"; + weapon_dam[1] = 16; + weapon_range[1] = 550; + weapon_cooldown[1] = 26; + weapon_facing[2] = "most"; + weapon_dam[2] = 16; + weapon_range[2] = 550; + weapon_cooldown[2] = 26; + weapon_facing[3] = "most"; + weapon_dam[3] = 16; + weapon_range[3] = 550; + weapon_cooldown[3] = 26; + weapon_facing[4] = "front"; + weapon_dam[4] = 32; + weapon_range[4] = 1000; + weapon_cooldown[4] = 90; +} - if (class="Gladius"){turrets=1; - weapons=2;shield_size=1;sprite_index=spr_ship_glad; - weapon_facing[1]="most"; - weapon_dam[1]=8; - weapon_range[1]=300; - weapon_cooldown[1]=30; - } +if (class == "Gloriana") { + turrets = 3; + weapons = 5; + shield_size = 3; + sprite_index = spr_ship_song; + weapon_facing[1] = "most"; + weapon_dam[1] = 16; + weapon_range[1] = 550; + weapon_cooldown[1] = 26; + weapon_facing[2] = "most"; + weapon_dam[2] = 16; + weapon_range[2] = 550; + weapon_cooldown[2] = 26; + weapon_facing[3] = "most"; + weapon_dam[3] = 16; + weapon_range[3] = 550; + weapon_cooldown[3] = 26; + weapon_facing[4] = "front"; + weapon_dam[4] = 32; + weapon_range[4] = 1000; + weapon_cooldown[4] = 90; +} +if (class == "Strike Cruiser") { + turrets = 1; + weapons = 4; + shield_size = 1; + sprite_index = spr_ship_stri; + weapon_facing[1] = "left"; + weapon_dam[1] = 8; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; + weapon_facing[2] = "right"; + weapon_dam[2] = 8; + weapon_range[2] = 300; + weapon_cooldown[2] = 30; + weapon_facing[3] = "special"; + weapon_cooldown[3] = 90; + weapon_ammo[3] = 3; + weapon_range[3] = 9999; + weapon_facing[4] = "most"; + weapon_dam[4] = 12; + weapon_range[4] = 300; + weapon_cooldown[4] = 30; +} +if (class == "Hunter") { + turrets = 1; + weapons = 2; + shield_size = 1; + sprite_index = spr_ship_hunt; + weapon_facing[1] = "front"; + weapon_dam[1] = 8; + weapon_range[1] = 450; + weapon_cooldown[1] = 60; + weapon_facing[2] = "most"; + weapon_dam[2] = 8; + weapon_range[2] = 300; + weapon_cooldown[2] = 60; +} - // STC Bonuses - if (obj_controller.stc_bonus[5]=5){armour_front=round(armour_front*1.1);armour_other=round(armour_other*1.1);} - if (obj_controller.stc_bonus[6]=2){armour_front=round(armour_front*1.1);armour_other=round(armour_other*1.1);} +if (class == "Gladius") { + turrets = 1; + weapons = 2; + shield_size = 1; + sprite_index = spr_ship_glad; + weapon_facing[1] = "most"; + weapon_dam[1] = 8; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; +} +// STC Bonuses +if (obj_controller.stc_bonus[5] == 5) { + armour_front = round(armour_front * 1.1); + armour_other = round(armour_other * 1.1); +} +if (obj_controller.stc_bonus[6] == 2) { + armour_front = round(armour_front * 1.1); + armour_other = round(armour_other * 1.1); +} - var i=0, unit, b=0; +var i = 0, unit, b = 0; - for (var co=0;co<=obj_ini.companies;co++){ - for (i=0;i(unit.max_health()/10)){ - array_push(board_co, co); - array_push(board_id, i); - array_push(board_location, 0); - array_push(board_raft, 0); - boarders+=1; +for (var co = 0; co <= obj_ini.companies; co++) { + for (i = 0; i < array_length(obj_ini.name[co]); i++) { + if (obj_ini.name[co][i] == "") { + continue; + } + unit = fetch_unit([co, i]); + if (unit.ship_location == ship_id) { + if (unit.is_boarder && unit.hp() > (unit.max_health() / 10)) { + array_push(board_co, co); + array_push(board_id, i); + array_push(board_location, 0); + array_push(board_raft, 0); + boarders += 1; + } + // Loc 0: on origin ship + // Loc 1: in transit + // Loc >1: (instance_id), on enemy vessel + if (co == 0 && master_present == 0 && i < 100) { + if (unit.role() == obj_ini.role[100][eROLE.ChapterMaster] && unit.ship_location == ship_id) { + master_present = 1; + obj_fleet.control = 1; } - // Loc 0: on origin ship - // Loc 1: in transit - // Loc >1: (instance_id), on enemy vessel - if (co==0 && master_present==0 && i<100){ - if (unit.role()==obj_ini.role[100][eROLE.ChapterMaster] && unit.ship_location==ship_id){ - master_present=1; - obj_fleet.control=1; - } - } } } } +} - if (boarders>0){ - if (obj_controller.command_set[25]=1) then board_capital=true; - if (obj_controller.command_set[26]=1) then board_frigate=true; +if (boarders > 0) { + if (obj_controller.command_set[25] == 1) { + board_capital = true; + } + if (obj_controller.command_set[26] == 1) { + board_frigate = true; } +} - if (hp<=0){ - x=-1000; - y=room_height/2; - if (ship_id=0) then instance_destroy(); - } \ No newline at end of file +if (hp <= 0) { + x = -1000; + y = room_height / 2; + if (ship_id == 0) { + instance_destroy(); + } +} diff --git a/objects/obj_p_ship/Alarm_3.gml b/objects/obj_p_ship/Alarm_3.gml index eeee677d2f..362cdbc374 100644 --- a/objects/obj_p_ship/Alarm_3.gml +++ b/objects/obj_p_ship/Alarm_3.gml @@ -1,22 +1,21 @@ +if ((hp < maxhp) && (ship_id != 0)) { + obj_fleet.ships_damaged += 1; + obj_ini.ship_hp[self.ship_id] = hp; -if (hp0){ - obj_controller.gene_seed-=floor(obj_controller.gene_seed/10); + if (obj_controller.und_gene_vaults > 0) { + obj_controller.gene_seed -= floor(obj_controller.gene_seed / 10); } } - + // 135 // maybe check for dead marines here? } - diff --git a/objects/obj_p_ship/Create_0.gml b/objects/obj_p_ship/Create_0.gml index 16db031709..257cb45c93 100644 --- a/objects/obj_p_ship/Create_0.gml +++ b/objects/obj_p_ship/Create_0.gml @@ -1,66 +1,66 @@ +ship_id = 0; +master_present = 0; +o_dist = 0; -ship_id=0; -master_present=0; -o_dist=0; - -selected=0; -sel_x1=0; -sel_y1=0; -sel_x2=0; -sel_y2=0; +selected = 0; +sel_x1 = 0; +sel_y1 = 0; +sel_x2 = 0; +sel_y2 = 0; // if (x<0) then ship_id=2; -action="";paction=""; -action_dis=0; -action_dir=0; -action_fac=0; -direction=0; -target=-50; -if (instance_exists(obj_en_ship)){ - target=instance_nearest(x,y,obj_en_ship); +action = ""; +paction = ""; +action_dis = 0; +action_dir = 0; +action_fac = 0; +direction = 0; +target = -50; +if (instance_exists(obj_en_ship)) { + target = instance_nearest(x, y, obj_en_ship); } -target_l=0; -target_r=0; -target_x=0; -target_y=0; +target_l = 0; +target_r = 0; +target_x = 0; +target_y = 0; cooldown = array_create(6, 0); -turret_cool=0; -shield_size=0; +turret_cool = 0; +shield_size = 0; -board_capital=false; -board_frigate=false; +board_capital = false; +board_frigate = false; -name=""; -class=""; -hp=0; -maxhp=0; -conditions=""; -shields=1; -maxshields=1; -armour_front=0; -armour_other=0; -weapons=0; -turrets=0; -fighters=0; -bombers=0; -thunderhawks=0; -boarders=0; -board_cooldown=0; +name = ""; +class = ""; +hp = 0; +maxhp = 0; +conditions = ""; +shields = 1; +maxshields = 1; +armour_front = 0; +armour_other = 0; +weapons = 0; +turrets = 0; +fighters = 0; +bombers = 0; +thunderhawks = 0; +boarders = 0; +board_cooldown = 0; weapon = array_create(8, ""); -weapon_facing=array_create(8, ""); -weapon_cooldown=array_create(8, 0); -weapon_hp=array_create(8, 0); -weapon_dam=array_create(8, 0); -weapon_ammo=array_create(8, 0); -weapon_range=array_create(8, 0); -weapon_minrange=array_create(8, 0); +weapon_facing = array_create(8, ""); +weapon_cooldown = array_create(8, 0); +weapon_hp = array_create(8, 0); +weapon_dam = array_create(8, 0); +weapon_ammo = array_create(8, 0); +weapon_range = array_create(8, 0); +weapon_minrange = array_create(8, 0); -board_co=[]; -board_id=[]; -board_location=[]; -board_raft=[]; -//action_set_alarm(1, 0); +board_co = []; +board_id = []; +board_location = []; +board_raft = []; +//action_set_alarm(1, 0); diff --git a/objects/obj_p_ship/Draw_0.gml b/objects/obj_p_ship/Draw_0.gml index ca76a0a738..84178cf041 100644 --- a/objects/obj_p_ship/Draw_0.gml +++ b/objects/obj_p_ship/Draw_0.gml @@ -1,80 +1,75 @@ var __b__; __b__ = action_if_variable(name, "", 0); -if !__b__ -{ -{ +if (!__b__) { + { + if (selected == 1) { + draw_set_color(CM_GREEN_COLOR); + draw_circle(x, y, (sprite_width / 2), 1); + draw_circle(x, y, (sprite_width / 2) - 1, 1); + draw_circle(x, y, (sprite_width / 2) + 1, 1); -if (selected=1){ - draw_set_color(CM_GREEN_COLOR); - draw_circle(x,y,(sprite_width/2),1); - draw_circle(x,y,(sprite_width/2)-1,1); - draw_circle(x,y,(sprite_width/2)+1,1); - - if (boarders>0){ - draw_set_color(c_red); - draw_set_alpha(0.3); - draw_circle(x,y,400,1); - - - if (instance_exists(obj_en_ship)){ - var e=instance_nearest(mouse_x,mouse_y,obj_en_ship); - if (point_distance(mouse_x,mouse_y,e.x,e.y)<=32){ - obj_cursor.board=1; - } - if (point_distance(mouse_x,mouse_y,e.x,e.y)>32){ - obj_cursor.board=0; - obj_cursor.image_alpha=1; + if (boarders > 0) { + draw_set_color(c_red); + draw_set_alpha(0.3); + draw_circle(x, y, 400, 1); + + if (instance_exists(obj_en_ship)) { + var e = instance_nearest(mouse_x, mouse_y, obj_en_ship); + if (point_distance(mouse_x, mouse_y, e.x, e.y) <= 32) { + obj_cursor.board = 1; + } + if (point_distance(mouse_x, mouse_y, e.x, e.y) > 32) { + obj_cursor.board = 0; + obj_cursor.image_alpha = 1; + } + } } - } - } - - draw_set_alpha(1); -} -shader_set(Ship_shader); -shader_set_uniform_f_array(shader_get_uniform(Ship_shader, "main_colour"), ship_colour); -//draw_sprite(sprite_index, 0, x, y); -draw_self(); + draw_set_alpha(1); + } + shader_set(Ship_shader); + shader_set_uniform_f_array(shader_get_uniform(Ship_shader, "main_colour"), ship_colour); + //draw_sprite(sprite_index, 0, x, y); + draw_self(); -shader_reset(); -draw_set_color(CM_GREEN_COLOR); -draw_set_font(fnt_info); -draw_set_halign(fa_center); + shader_reset(); + draw_set_color(CM_GREEN_COLOR); + draw_set_font(fnt_info); + draw_set_halign(fa_center); + if (boarders > 0) { + // draw_sprite(spr_force_icon,0,x-16,y+12); + scr_image("ui/force", 1, x - 16 - 32, y + 12 - 32, 64, 64); -if (boarders>0){ - // draw_sprite(spr_force_icon,0,x-16,y+12); - scr_image("ui/force",1,x-16-32,y+12-32,64,64); - - draw_set_color(0); - draw_text(x-16,y+12,string_hash_to_newline(string(boarders))); - draw_text(x-16-1,y+12-1,string_hash_to_newline(string(boarders))); - draw_text(x-16+1,y+12+1,string_hash_to_newline(string(boarders))); - draw_text(x-16+1,y+12,string_hash_to_newline(string(boarders))); - draw_set_color(c_white); - draw_text(x-16,y+12,string_hash_to_newline(string(boarders))); -} -draw_set_color(CM_GREEN_COLOR); + draw_set_color(0); + draw_text(x - 16, y + 12, string_hash_to_newline(string(boarders))); + draw_text(x - 16 - 1, y + 12 - 1, string_hash_to_newline(string(boarders))); + draw_text(x - 16 + 1, y + 12 + 1, string_hash_to_newline(string(boarders))); + draw_text(x - 16 + 1, y + 12, string_hash_to_newline(string(boarders))); + draw_set_color(c_white); + draw_text(x - 16, y + 12, string_hash_to_newline(string(boarders))); + } + draw_set_color(CM_GREEN_COLOR); + if (maxhp != 0) { + var zoom_modifier = obj_controller.zoomed ? 2 : 1; + if (shields <= 0) { + var hp_percent = $"{(hp / maxhp) * 100}%"; -if (maxhp!=0){ - var zoom_modifier = obj_controller.zoomed?2:1; - if (shields<=0){ - var hp_percent = $"{(hp/maxhp)*100}%" - - draw_text_transformed(x,y-sprite_height,hp_percent,zoom_modifier,zoom_modifier,0); - } + draw_text_transformed(x, y - sprite_height, hp_percent, zoom_modifier, zoom_modifier, 0); + } - if (shields>0){ - draw_set_color(c_white); - var shield_percent = $"{(shields/maxshields)*100}%" - - draw_text_transformed(x,y-sprite_height,shield_percent,zoom_modifier,zoom_modifier,0); - } -} + if (shields > 0) { + draw_set_color(c_white); + var shield_percent = $"{(shields / maxshields) * 100}%"; -if (master_present!=0) then draw_sprite_ext(spr_popup_select,0,x,y,2,2,0,c_white,1); + draw_text_transformed(x, y - sprite_height, shield_percent, zoom_modifier, zoom_modifier, 0); + } + } -} + if (master_present != 0) { + draw_sprite_ext(spr_popup_select, 0, x, y, 2, 2, 0, c_white, 1); + } + } } diff --git a/objects/obj_p_ship/KeyPress_66.gml b/objects/obj_p_ship/KeyPress_66.gml index 991f9188b3..4dc1912204 100644 --- a/objects/obj_p_ship/KeyPress_66.gml +++ b/objects/obj_p_ship/KeyPress_66.gml @@ -1,22 +1,25 @@ - // if (obj_fleet.start!=5) then exit; -if (selected=1) and (boarders>0) and (board_cooldown<=0) and (point_distance(x,y,mouse_x,mouse_y)<=428){ +if ((selected == 1) && (boarders > 0) && (board_cooldown <= 0) && (point_distance(x, y, mouse_x, mouse_y) <= 428)) { var tar_final; - var tar1=instance_nearest(mouse_x,mouse_y,obj_en_ship); - var tar2=instance_nearest(mouse_x,mouse_y,obj_en_capital); - - if (!instance_exists(obj_en_capital)) and (instance_exists(obj_en_ship)) then tar_final=instance_nearest(mouse_x,mouse_y,obj_en_ship); - if (instance_exists(obj_en_capital)){ - var target_one_distance = point_distance(tar2.x,tar2.y,mouse_x,mouse_y)-32; - var target_two_distance = point_distance(tar1.x,tar1.y,mouse_x,mouse_y); + var tar1 = instance_nearest(mouse_x, mouse_y, obj_en_ship); + var tar2 = instance_nearest(mouse_x, mouse_y, obj_en_capital); + + if ((!instance_exists(obj_en_capital)) && instance_exists(obj_en_ship)) { + tar_final = instance_nearest(mouse_x, mouse_y, obj_en_ship); + } + if (instance_exists(obj_en_capital)) { + var target_one_distance = point_distance(tar2.x, tar2.y, mouse_x, mouse_y) - 32; + var target_two_distance = point_distance(tar1.x, tar1.y, mouse_x, mouse_y); - if (target_one_distance < target_two_distance) then tar_final=instance_nearest(mouse_x,mouse_y,obj_en_capital); - if (target_one_distance >= target_two_distance) then tar_final=instance_nearest(mouse_x,mouse_y,obj_en_ship); + if (target_one_distance < target_two_distance) { + tar_final = instance_nearest(mouse_x, mouse_y, obj_en_capital); + } + if (target_one_distance >= target_two_distance) { + tar_final = instance_nearest(mouse_x, mouse_y, obj_en_ship); + } } create_boarding_craft(tar_final); } - -// board_co[i]=0;board_id[i]=0;board_location[i]=0; - +// board_co[i]=0;board_id[i]=0;board_location[i]=0; diff --git a/objects/obj_p_ship/Mouse_51.gml b/objects/obj_p_ship/Mouse_51.gml index b28aaecc13..21cebc7e3e 100644 --- a/objects/obj_p_ship/Mouse_51.gml +++ b/objects/obj_p_ship/Mouse_51.gml @@ -1,18 +1,21 @@ +if ((selected == 1) && (!instance_exists(obj_circular)) && (obj_fleet.control != 0)) { + var stahp; + stahp = 0; + var xx = camera_get_view_x(view_camera[0]); + var yy = camera_get_view_y(view_camera[0]); -if (selected=1) and (!instance_exists(obj_circular)) and (obj_fleet.control!=0){ - var stahp;stahp=0; - var xx=__view_get( e__VW.XView, 0); - var yy=__view_get( e__VW.YView, 0); - - if (obj_fleet.start=5) and (obj_controller.zoomed=0){ - if (point_in_rectangle(mouse_x,mouse_y, xx+12,yy+436,xx+48,yy+480)) then stahp=1; - } - else if (obj_fleet.start=5) and (obj_controller.zoomed=1){ - if (point_in_rectangle(mouse_x,mouse_y, xx+24,yy+872,xx+90,yy+960)) then stahp=1; - }// and (room_speed<90) - - if (stahp=0){ - paction=""; + if ((obj_fleet.start == 5) && (obj_controller.zoomed == 0)) { + if (point_in_rectangle(mouse_x, mouse_y, xx + 12, yy + 436, xx + 48, yy + 480)) { + stahp = 1; + } + } else if ((obj_fleet.start == 5) && (obj_controller.zoomed == 1)) { + if (point_in_rectangle(mouse_x, mouse_y, xx + 24, yy + 872, xx + 90, yy + 960)) { + stahp = 1; + } + } // and (room_speed<90) + + if (stahp == 0) { + paction = ""; /*target_x=mouse_x; target_y=mouse_y; @@ -32,11 +35,10 @@ if (selected=1) and (!instance_exists(obj_circular)) and (obj_fleet.control!=0){ if (!instance_exists(obj_en_ship)){ paction="turn"; }*/ - - instance_create(20,20,obj_circular); + + instance_create(20, 20, obj_circular); } } - /* */ /* */ diff --git a/objects/obj_p_ship/Step_0.gml b/objects/obj_p_ship/Step_0.gml index e48c62af00..a08c002be8 100644 --- a/objects/obj_p_ship/Step_0.gml +++ b/objects/obj_p_ship/Step_0.gml @@ -1,335 +1,457 @@ -image_angle=direction; - -if (obj_fleet.start!=5) then exit; +image_angle = direction; +if (obj_fleet.start != 5) { + exit; +} var dist; -if (shields>0) and (shields=0) then board_cooldown-=1; +if ((shields > 0) && (shields < maxshields)) { + shields += 0.02; +} +if (board_cooldown >= 0) { + board_cooldown -= 1; +} // Need to every couple of seconds check this // with obj_en_ship if not big then disable, check nearest, and activate once more - -if (instance_exists(target)){if ((target.x<3) and (target.y<3)) or (target.hp<0) then target=-50;} -if (!instance_exists(target)) or (target=-50){ - with(obj_en_ship){if ((x<3) and (y<3)) or (hp<=0) then instance_deactivate_object(id);} - target=instance_nearest(x,y,obj_en_ship); +if (instance_exists(target)) { + if (((target.x < 3) && (target.y < 3)) || (target.hp < 0)) { + target = -50; + } +} +if ((!instance_exists(target)) || (target == -50)) { + with (obj_en_ship) { + if (((x < 3) && (y < 3)) || (hp <= 0)) { + instance_deactivate_object(id); + } + } + target = instance_nearest(x, y, obj_en_ship); instance_activate_object(obj_en_ship); } //if (!instance_exists(target)) then exit; -if (instance_exists(obj_en_ship)){ - if (!instance_exists(target) and (instance_nearest(x,y,obj_en_ship).x>500)) then target=instance_nearest(x,y,obj_en_ship); +if (instance_exists(obj_en_ship)) { + if (!instance_exists(target) && (instance_nearest(x, y, obj_en_ship).x > 500)) { + target = instance_nearest(x, y, obj_en_ship); + } - if (!instance_exists(target)) then target=instance_nearest(x,y,obj_en_ship); + if (!instance_exists(target)) { + target = instance_nearest(x, y, obj_en_ship); + } } -if (hp<=0) and (x>-5000){ - - if (class="Battle Barge") or (class="Gloriana"){ - obj_fleet.capital-=1; - obj_fleet.capital_lost+=1; +if ((hp <= 0) && (x > -5000)) { + if ((class == "Battle Barge") || (class == "Gloriana")) { + obj_fleet.capital -= 1; + obj_fleet.capital_lost += 1; } - if (class="Strike Cruiser"){ - obj_fleet.frigate-=1; - obj_fleet.frigate_lost+=1; + if (class == "Strike Cruiser") { + obj_fleet.frigate -= 1; + obj_fleet.frigate_lost += 1; } - if (class="Hunter"){ - obj_fleet.escort-=1; - obj_fleet.escort_lost+=1; + if (class == "Hunter") { + obj_fleet.escort -= 1; + obj_fleet.escort_lost += 1; } - if (class="Gladius"){ - obj_fleet.escort-=1; - obj_fleet.escort_lost+=1; + if (class == "Gladius") { + obj_fleet.escort -= 1; + obj_fleet.escort_lost += 1; } - - obj_fleet.ship_lost[ship_id]=1;// show_message("obj_fleet.ship_lost["+string(ship_id)+"] = 1"); - - image_alpha=0.5; - if (obj_fleet.start!=0){ + obj_fleet.ship_lost[ship_id] = 1; // show_message("obj_fleet.ship_lost["+string(ship_id)+"] = 1"); + + image_alpha = 0.5; + if (obj_fleet.start != 0) { /*ex=instance_create(x,y,obj_explosion); ex.image_xscale=2;ex.image_yscale=2; ex.image_speed=0.75;*/ - - var husk;husk=instance_create(x,y,obj_en_husk); - husk.sprite_index=sprite_index;husk.direction=direction; - husk.image_angle=image_angle;husk.depth=depth;husk.image_speed=0; - repeat(choose(4,5,6)){ - var explo;explo=instance_create(x,y,obj_explosion); - explo.image_xscale=0.5;explo.image_yscale=0.5; - explo.x+=random_range(sprite_width*0.25,sprite_width*-0.25); - explo.y+=random_range(sprite_width*0.25,sprite_width*-0.25); + + var husk; + husk = instance_create(x, y, obj_en_husk); + husk.sprite_index = sprite_index; + husk.direction = direction; + husk.image_angle = image_angle; + husk.depth = depth; + husk.image_speed = 0; + repeat (choose(4, 5, 6)) { + var explo; + explo = instance_create(x, y, obj_explosion); + explo.image_xscale = 0.5; + explo.image_yscale = 0.5; + explo.x += random_range(sprite_width * 0.25, sprite_width * -0.25); + explo.y += random_range(sprite_width * 0.25, sprite_width * -0.25); } - } - x=-7000;y=room_height/2; + x = -7000; + y = room_height / 2; } -if (hp>0) and (instance_exists(target)){ - for (var i=0;i0){ +if ((hp > 0) && instance_exists(target)) { + for (var i = 0; i < array_length(cooldown); i++) { + if (cooldown[i] > 0) { cooldown[i]--; } } - if (class="Apocalypse Class Battleship") or (class="Gloriana"){ - o_dist=500; - action="attack"; - } - else if (class="Nemesis Class Fleet Carrier"){ - o_dist=1000; - action="attack"; - } - else if (class="Avenger Class Grand Cruiser"){ - o_dist=64; - action="broadside"; - } - else if (class="Battle Barge") or (class="Strike Cruiser"){ - o_dist=300; - action="attack"; - } - else if (class="Hunter") or (class="Gladius"){ - o_dist=64; - action="flank"; + if ((class == "Apocalypse Class Battleship") || (class == "Gloriana")) { + o_dist = 500; + action = "attack"; + } else if (class == "Nemesis Class Fleet Carrier") { + o_dist = 1000; + action = "attack"; + } else if (class == "Avenger Class Grand Cruiser") { + o_dist = 64; + action = "broadside"; + } else if ((class == "Battle Barge") || (class == "Strike Cruiser")) { + o_dist = 300; + action = "attack"; + } else if ((class == "Hunter") || (class == "Gladius")) { + o_dist = 64; + action = "flank"; } // if (class!="big") then flank!!!! - - - dist=point_distance(x,y,target.x,target.y)-(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))); - + + dist = point_distance(x, y, target.x, target.y) - max(sprite_get_width(sprite_index), sprite_get_height(sprite_index)); + // STC Bonuses - var ts;ts=0.2;if (obj_controller.stc_bonus[5]=3) then ts+=0.1; - - - if (paction!="move") and (paction!="attack_move") and (paction!="turn") and (paction!="attack_turn"){ - if (target!=0) and (action="attack"){ - direction=turn_towards_point(direction,x,y,target.x,target.y,ts/2); + var ts; + ts = 0.2; + if (obj_controller.stc_bonus[5] == 3) { + ts += 0.1; + } + + if ((paction != "move") && (paction != "attack_move") && (paction != "turn") && (paction != "attack_turn")) { + if ((target != 0) && (action == "attack")) { + direction = turn_towards_point(direction, x, y, target.x, target.y, ts / 2); } - if (target!=0) and (action="broadside") and (dist>o_dist){ - if (y>=target.y) then dist=point_distance(x,y,target.x+lengthdir_x(64,target.direction-180),target.y+lengthdir_y(128,target.direction-90))-(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))); - if (ytarget.y) and (dist>o_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction-90),ts); - if (yo_dist) then direction=turn_towards_point(direction,x+lengthdir_x(64,target.direction-180),y,target.x,target.y+lengthdir_y(128,target.direction+90),ts); + if ((target != 0) && (action == "broadside") && (dist > o_dist)) { + if (y >= target.y) { + dist = point_distance(x, y, target.x + lengthdir_x(64, target.direction - 180), target.y + lengthdir_y(128, target.direction - 90)) - max(sprite_get_width(sprite_index), sprite_get_height(sprite_index)); + } + if (y < target.y) { + dist = point_distance(x, y, target.x + lengthdir_x(64, target.direction - 180), target.y + lengthdir_y(128, target.direction + 90)) - max(sprite_get_width(sprite_index), sprite_get_height(sprite_index)); + } + if ((y > target.y) && (dist > o_dist)) { + direction = turn_towards_point(direction, x + lengthdir_x(64, target.direction - 180), y, target.x, target.y + lengthdir_y(128, target.direction - 90), ts); + } + if ((y < target.y) && (dist > o_dist)) { + direction = turn_towards_point(direction, x + lengthdir_x(64, target.direction - 180), y, target.x, target.y + lengthdir_y(128, target.direction + 90), ts); + } } - if (target!=0) and (action="flank") and (dist>o_dist){ - if (y>=target.y) then dist=point_distance(x,y,target.x+lengthdir_x(64,target.direction-180),target.y+lengthdir_y(128,target.direction-90))-(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))); - if (ytarget.y) and (dist>o_dist) then direction=turn_towards_point(direction,x,y,target.x,target.y,ts); - if (yo_dist) then direction=turn_towards_point(direction,x,y,target.x,target.y,ts); + if ((target != 0) && (action == "flank") && (dist > o_dist)) { + if (y >= target.y) { + dist = point_distance(x, y, target.x + lengthdir_x(64, target.direction - 180), target.y + lengthdir_y(128, target.direction - 90)) - max(sprite_get_width(sprite_index), sprite_get_height(sprite_index)); + } + if (y < target.y) { + dist = point_distance(x, y, target.x + lengthdir_x(64, target.direction - 180), target.y + lengthdir_y(128, target.direction + 90)) - max(sprite_get_width(sprite_index), sprite_get_height(sprite_index)); + } + if ((y > target.y) && (dist > o_dist)) { + direction = turn_towards_point(direction, x, y, target.x, target.y, ts); + } + if ((y < target.y) && (dist > o_dist)) { + direction = turn_towards_point(direction, x, y, target.x, target.y, ts); + } } } - + // STC Bonuses - var speed_up, speed_down;speed_up=0.005;speed_down=0.025; - if (obj_controller.stc_bonus[6]=3){speed_up=0.008;speed_down=0.037;} - - if (paction="turn") or (paction="attack_turn"){ - direction=turn_towards_point(direction,x,y,target_x,target_y,ts/2); - dist=point_distance(x,y,target_x,target_y); - if (y>target_y) then direction=turn_towards_point(direction,x,y,target_x,target_y,ts); - if (y0) then speed-=speed_down; - - if (direction-point_direction(x,y,target_x,target_y)<=2) and (direction-point_direction(x,y,target_x,target_y)>=-2){ - if (paction="turn") then paction="move"; - if (paction="attack_turn") then paction="attack_move"; + var speed_up, speed_down; + speed_up = 0.005; + speed_down = 0.025; + if (obj_controller.stc_bonus[6] == 3) { + speed_up = 0.008; + speed_down = 0.037; + } + + if ((paction == "turn") || (paction == "attack_turn")) { + direction = turn_towards_point(direction, x, y, target_x, target_y, ts / 2); + dist = point_distance(x, y, target_x, target_y); + if (y > target_y) { + direction = turn_towards_point(direction, x, y, target_x, target_y, ts); + } + if (y < target_y) { + direction = turn_towards_point(direction, x, y, target_x, target_y, ts); + } + if (speed > 0) { + speed -= speed_down; + } + + if ((direction - point_direction(x, y, target_x, target_y) <= 2) && (direction - point_direction(x, y, target_x, target_y) >= -2)) { + if (paction == "turn") { + paction = "move"; + } + if (paction == "attack_turn") { + paction = "attack_move"; + } } } - - if (paction!="move") and (paction!="turn") and (paction!="attack_move") and (paction!="attack_turn"){ - if (action="attack"){ - if (dist>o_dist) and (speed<(max_speed)) then speed+=speed_up; - if (dist0) then speed-=speed_down; + + if ((paction != "move") && (paction != "turn") && (paction != "attack_move") && (paction != "attack_turn")) { + if (action == "attack") { + if ((dist > o_dist) && (speed < max_speed)) { + speed += speed_up; + } + if ((dist < o_dist) && (speed > 0)) { + speed -= speed_down; + } } - if (action="broadside"){ - if (dist>o_dist) and (speed<(max_speed)) then speed+=speed_up; - if (dist0) then speed-=speed_down; + if (action == "broadside") { + if ((dist > o_dist) && (speed < max_speed)) { + speed += speed_up; + } + if ((dist < o_dist) && (speed > 0)) { + speed -= speed_down; + } } - if (action="flank"){// flank here - if (dist>o_dist) and (speed<(max_speed)) then speed+=speed_up; - if (dist0) then speed-=speed_down; + if (action == "flank") { + // flank here + if ((dist > o_dist) && (speed < max_speed)) { + speed += speed_up; + } + if ((dist < o_dist) && (speed > 0)) { + speed -= speed_down; + } } } - if (paction="move") or (paction="attack_move"){ - direction=turn_towards_point(direction,x,y,target_x,target_y,ts/2); - var dist;dist=point_distance(x,y,target_x,target_y); - if (y>target_y) then direction=turn_towards_point(direction,x,y,target_x,target_y,ts); - if (y target_y) { + direction = turn_towards_point(direction, x, y, target_x, target_y, ts); } + if (y < target_y) { + direction = turn_towards_point(direction, x, y, target_x, target_y, ts); } - - if (dist>20) and (speed<(max_speed)) then speed+=speed_up; - if (dist<=20) and (speed>0){ - paction=""; - action="attack"; + + if ((paction == "attack_move") && instance_exists(obj_en_ship)) { + if (!instance_exists(target)) { + target = instance_nearest(x, y, obj_en_ship); + } + dist = point_distance(x, y, target.x, target.y); + if (dist <= o_dist) { + paction = ""; + action = "attack"; + } } + + if ((dist > 20) && (speed < max_speed)) { + speed += speed_up; + } + if ((dist <= 20) && (speed > 0)) { + paction = ""; + action = "attack"; + } + } + + if (speed < 0) { + speed = speed * 0.9; } - - - if (speed<0) then speed=speed*0.9; - if (turret_cool>0) then turret_cool-=1; - - + if (turret_cool > 0) { + turret_cool -= 1; + } + var bull, targe, rdir, dirr, dist, xx, yy, ok; - targe=0;rdir=0;dirr="";dist=9999;xx=x;yy=y; - - - if (turrets>0) and (instance_exists(obj_en_in)) and (turret_cool=0){ - targe=instance_nearest(x,y,obj_en_in); - if (instance_exists(targe)) then dist=point_distance(x,y,targe.x,targe.y); - - if (dist>64) and (dist<300){ - bull=instance_create(x,y,obj_p_round); - bull.direction=point_direction(x,y,targe.x,targe.y); - bull.speed=20;bull.dam=3; - bull.image_xscale=0.5; - bull.image_yscale=0.5; - turret_cool=floor(60/turrets); - bull.direction+=choose(random(3),1*-(random(3))); + targe = 0; + rdir = 0; + dirr = ""; + dist = 9999; + xx = x; + yy = y; + + if ((turrets > 0) && instance_exists(obj_en_in) && (turret_cool == 0)) { + targe = instance_nearest(x, y, obj_en_in); + if (instance_exists(targe)) { + dist = point_distance(x, y, targe.x, targe.y); + } + + if ((dist > 64) && (dist < 300)) { + bull = instance_create(x, y, obj_p_round); + bull.direction = point_direction(x, y, targe.x, targe.y); + bull.speed = 20; + bull.dam = 3; + bull.image_xscale = 0.5; + bull.image_yscale = 0.5; + turret_cool = floor(60 / turrets); + bull.direction += choose(random(3), 1 * -random(3)); } } - targe=0;rdir=0;dirr="";dist=9999; - - - xx=lengthdir_x(64,direction+90); - yy=lengthdir_y(64,direction+90); - + targe = 0; + rdir = 0; + dirr = ""; + dist = 9999; + + xx = lengthdir_x(64, direction + 90); + yy = lengthdir_y(64, direction + 90); + var front, right, left, rear; - front=0;right=0;left=0;rear=0; - - targe=instance_nearest(xx,yy,obj_en_ship); - if (instance_exists(targe)){ - rdir=point_direction(x,y,target.x,target.y); - if (rdir>45) and (rdir<=135) and (targe!=target){target_r=targe;right=1;} - if (rdir>225) and (rdir<=315) and (targe!=target) and (targe!=target_r){target_l=targe;left=1;} - if (collision_line(x,y,x+lengthdir_x(2000,direction),y+lengthdir_y(2000,direction),obj_en_ship,0,1)) then front=1; - - - var f=0,facing="",ammo=0,range=0,wep="",dam=0; - - for (var gg=1;gg 45) && (rdir <= 135) && (targe != target)) { + target_r = targe; + right = 1; + } + if ((rdir > 225) && (rdir <= 315) && (targe != target) && (targe != target_r)) { + target_l = targe; + left = 1; + } + if (collision_line(x, y, x + lengthdir_x(2000, direction), y + lengthdir_y(2000, direction), obj_en_ship, 0, 1)) { + front = 1; + } + + var f = 0, facing = "", ammo = 0, range = 0, wep = "", dam = 0; + + for (var gg = 1; gg < array_length(weapon); gg++) { // if (cooldown[gg]>0) then cooldown[gg]-=1; - - ok=0;f+=1;facing="";ammo=0;range=0;wep=""; - - - if (cooldown[gg]<=0) and (weapon[gg]!="") and (weapon_ammo[gg]>0) then ok=1; - if (ok=1){ - facing=weapon_facing[gg]; - ammo=weapon_ammo[gg]; - range=weapon_range[gg]; + + ok = 0; + f += 1; + facing = ""; + ammo = 0; + range = 0; + wep = ""; + + if ((cooldown[gg] <= 0) && (weapon[gg] != "") && (weapon_ammo[gg] > 0)) { + ok = 1; + } + if (ok == 1) { + facing = weapon_facing[gg]; + ammo = weapon_ammo[gg]; + range = weapon_range[gg]; + } + + targe = target; + + if (facing == "right") { + targe = target_r; + } + if (facing == "left") { + targe = target_l; + } + if (((facing == "front") || (facing == "most")) && (front == 1)) { + ok = 2; } - - targe=target; - - if (facing="right") then targe=target_r; - if (facing="left") then targe=target_l; - if ((facing="front") or (facing="most")) and (front=1) then ok=2; - if (facing="right") or (facing="most") and (right=1) then ok=2; - if (facing="left") or (facing="most") and (left=1) then ok=2; - if (facing="special") then ok=2; - if (instance_exists(targe)){ - - - dist=point_distance(x,y,targe.x,targe.y); - - - if (ok=2) and (dist<(range+(max(sprite_get_width(sprite_index),sprite_get_height(sprite_index))))){ + if ((facing == "right") || (facing == "most") && (right == 1)) { + ok = 2; + } + if ((facing == "left") || (facing == "most") && (left == 1)) { + ok = 2; + } + if (facing == "special") { + ok = 2; + } + if (instance_exists(targe)) { + dist = point_distance(x, y, targe.x, targe.y); + + if ((ok == 2) && (dist < (range + max(sprite_get_width(sprite_index), sprite_get_height(sprite_index))))) { //if (ammo>0) and (ammo<500) then ammo-=1; - weapon_ammo[gg]=ammo; - cooldown[gg]=weapon_cooldown[gg]; - wep=weapon[gg]; - dam=weapon_dam[gg]; - + weapon_ammo[gg] = ammo; + cooldown[gg] = weapon_cooldown[gg]; + wep = weapon[gg]; + dam = weapon_dam[gg]; + // if (f=3) and (ship_id=2) then show_message("ammo: "+string(ammo)+" | range: "+string(range)); - - if (ammo<0) then ok=0; - ok=3; - - if (string_count("orpedo",wep)=0) and (string_count("hawk",wep)=0) and (ok=3){ - bull=instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),obj_p_round); - bull.speed=20;bull.dam=dam; - if (targe=target) then bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y); - if (facing!="front"){bull.direction=point_direction(x+lengthdir_x(32,direction),y+lengthdir_y(32,direction),target.x,target.y);} - if (string_count("ova",wep)=1){bull.image_xscale=2;bull.image_yscale=2;} - if (wep="Lance Battery"){ - bull.sprite_index=spr_ground_las; - bull.image_xscale=2; - bull.image_yscale=2; + + if (ammo < 0) { + ok = 0; + } + ok = 3; + + if ((string_count("orpedo", wep) == 0) && (string_count("hawk", wep) == 0) && (ok == 3)) { + bull = instance_create(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), obj_p_round); + bull.speed = 20; + bull.dam = dam; + if (targe == target) { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); + } + if (facing != "front") { + bull.direction = point_direction(x + lengthdir_x(32, direction), y + lengthdir_y(32, direction), target.x, target.y); } - if (wep="Plasma Cannon"){ - bull.sprite_index=spr_ground_plasma; - bull.image_xscale=3;bull.image_yscale=3; + if (string_count("ova", wep) == 1) { + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if (wep == "Lance Battery") { + bull.sprite_index = spr_ground_las; + bull.image_xscale = 2; + bull.image_yscale = 2; + } + if (wep == "Plasma Cannon") { + bull.sprite_index = spr_ground_plasma; + bull.image_xscale = 3; + bull.image_yscale = 3; } } - if (string_count("orpedo",wep)=1) and (ok=3){ - - if (sprite_index=spr_ship_bb){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_p_round); - bull.speed=10;bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + if ((string_count("orpedo", wep) == 1) && (ok == 3)) { + if (sprite_index == spr_ship_bb) { + bull = instance_create(x, y + lengthdir_y(-30, direction + 90), obj_p_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; } - - bull=instance_create(x,y+lengthdir_y(-10,direction+90),obj_p_round); - bull.speed=10; - bull.direction=direction;bull.sprite_index=spr_torpedo; - bull.dam=dam; - bull=instance_create(x,y+lengthdir_y(10,direction+90),obj_p_round); - bull.speed=10; - bull.direction=direction;bull.sprite_index=spr_torpedo; - bull.dam=dam; - - if (sprite_index=spr_ship_bb){ - bull=instance_create(x,y+lengthdir_y(30,direction+90),obj_p_round); - bull.speed=10; - bull.direction=direction;bull.sprite_index=spr_torpedo;bull.dam=dam; + + bull = instance_create(x, y + lengthdir_y(-10, direction + 90), obj_p_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + bull = instance_create(x, y + lengthdir_y(10, direction + 90), obj_p_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; + + if (sprite_index == spr_ship_bb) { + bull = instance_create(x, y + lengthdir_y(30, direction + 90), obj_p_round); + bull.speed = 10; + bull.direction = direction; + bull.sprite_index = spr_torpedo; + bull.dam = dam; } } - if (string_count("hawk",wep)=1) and (ok=3){ - bull=instance_create(x,y+lengthdir_y(-30,direction+90),obj_p_th); - bull.direction=self.direction; + if ((string_count("hawk", wep) == 1) && (ok == 3)) { + bull = instance_create(x, y + lengthdir_y(-30, direction + 90), obj_p_th); + bull.direction = self.direction; } } } } } - - - } - - - - - /* */ //Deploy boarding craft logic -if (instance_exists(obj_en_ship)) and (boarders>0) and (board_cooldown<=0) and ((board_capital=true) or (board_frigate=true)){ - var eh=0,te=0; - repeat(2){ - eh+=1;te=0; - if (eh=1) and (board_capital=true){if (instance_exists(obj_en_capital)) then te=instance_nearest(x,y,obj_en_capital);} - if (eh=2) and (board_frigate=true){if (instance_exists(obj_en_cruiser)) then te=instance_nearest(x,y,obj_en_cruiser);} - if (te!=0) and (instance_exists(te)){ - if (point_distance(x,y,te.x,te.y)<=428){ +if (instance_exists(obj_en_ship) && (boarders > 0) && (board_cooldown <= 0) && ((board_capital == true) || (board_frigate == true))) { + var eh = 0, te = 0; + repeat (2) { + eh += 1; + te = 0; + if ((eh == 1) && (board_capital == true)) { + if (instance_exists(obj_en_capital)) { + te = instance_nearest(x, y, obj_en_capital); + } + } + if ((eh == 2) && (board_frigate == true)) { + if (instance_exists(obj_en_cruiser)) { + te = instance_nearest(x, y, obj_en_cruiser); + } + } + if ((te != 0) && instance_exists(te)) { + if (point_distance(x, y, te.x, te.y) <= 428) { create_boarding_craft(te); } } - } - } - /* */ /* */ diff --git a/objects/obj_popup/Draw_64.gml b/objects/obj_popup/Draw_64.gml index 2fd7cae928..0940bdba5d 100644 --- a/objects/obj_popup/Draw_64.gml +++ b/objects/obj_popup/Draw_64.gml @@ -30,7 +30,7 @@ try { draw_set_color(CM_GREEN_COLOR); if (!obj_controller.zoomed) { - draw_text_transformed(__view_get(e__VW.XView, 0) + 320, __view_get(e__VW.YView, 0) + 60, "SELECT DESTINATION", 0.5, 0.5, 0); + draw_text_transformed(camera_get_view_x(view_camera[0]) + 320, camera_get_view_y(view_camera[0]) + 60, "SELECT DESTINATION", 0.5, 0.5, 0); } else { draw_text_transformed(room_width / 2, 60 * 3, "SELECT DESTINATION", 1.5, 1.5, 0); } diff --git a/objects/obj_popup_dialogue/CleanUp_0.gml b/objects/obj_popup_dialogue/CleanUp_0.gml index e254457844..abead8fdfa 100644 --- a/objects/obj_popup_dialogue/CleanUp_0.gml +++ b/objects/obj_popup_dialogue/CleanUp_0.gml @@ -1 +1 @@ -global.ui_click_lock = false; \ No newline at end of file +global.ui_click_lock = false; diff --git a/objects/obj_popup_dialogue/Create_0.gml b/objects/obj_popup_dialogue/Create_0.gml index d7e62aac34..5da45cb8b6 100644 --- a/objects/obj_popup_dialogue/Create_0.gml +++ b/objects/obj_popup_dialogue/Create_0.gml @@ -1,31 +1,30 @@ -xx = __view_get(e__VW.XView, 0) + x; -yy = __view_get(e__VW.YView, 0) + y; +xx = camera_get_view_x(view_camera[0]) + x; +yy = camera_get_view_y(view_camera[0]) + y; obj_controller.cooldown = 8000; -question=""; -inputting=""; +question = ""; +inputting = ""; blink = 0; -execute=false; -target=""; -target2=""; +execute = false; +target = ""; +target2 = ""; input_type = 0; // 0 for anything, 1 for cheats, 2 for real -maximum=0; -cancel_button={ +maximum = 0; +cancel_button = { x1: xx + 26, y1: yy + 103, x2: xx + 126, y2: yy + 123, -} -accept_button={ +}; +accept_button = { x1: xx + 175, y1: yy + 103, x2: xx + 275, y2: yy + 123, -} +}; -// +// // question="How many Terminator Armours? Max: 5"; // maximum=5; -// value_is_string=false; - +// value_is_string=false; diff --git a/objects/obj_popup_dialogue/Destroy_0.gml b/objects/obj_popup_dialogue/Destroy_0.gml index 2a417fa76a..5ebbb2fdc4 100644 --- a/objects/obj_popup_dialogue/Destroy_0.gml +++ b/objects/obj_popup_dialogue/Destroy_0.gml @@ -3,4 +3,4 @@ if (instance_exists(obj_cursor)) { } if (instance_exists(obj_controller)) { obj_controller.cooldown = 8000; -} \ No newline at end of file +} diff --git a/objects/obj_popup_dialogue/Draw_64.gml b/objects/obj_popup_dialogue/Draw_64.gml index fdd1ea73e7..79a3999c14 100644 --- a/objects/obj_popup_dialogue/Draw_64.gml +++ b/objects/obj_popup_dialogue/Draw_64.gml @@ -1,17 +1,17 @@ global.ui_click_lock = true; -cancel_button={ +cancel_button = { x1: x + 26, y1: y + 103, x2: x + 126, y2: y + 123, -} +}; -accept_button={ +accept_button = { x1: x + 175, y1: y + 103, x2: x + 275, y2: y + 123, -} +}; draw_sprite(spr_popup_dialogue, 0, x, y); @@ -22,15 +22,19 @@ draw_set_halign(fa_center); draw_text_ext(x + 150, y + 7, question, 18, 260); if (scr_hit(x + 19, y + 46, x + 280, y + 70)) { - if (instance_exists(obj_cursor)) obj_cursor.image_index = 2; + if (instance_exists(obj_cursor)) { + obj_cursor.image_index = 2; + } } else { - if (instance_exists(obj_cursor)) obj_cursor.image_index = 0; + if (instance_exists(obj_cursor)) { + obj_cursor.image_index = 0; + } } draw_set_font(fnt_40k_14); draw_set_color(c_gray); -draw_text(x + 150 + (blink?2:0), y + 50, $"{inputting}{blink?"|":""}"); +draw_text(x + 150 + (blink ? 2 : 0), y + 50, $"{inputting}{blink ? "|" : ""}"); // Button 1s draw_set_alpha(0.25); @@ -47,7 +51,7 @@ if (scr_hit(cancel_button.x1, cancel_button.y1, cancel_button.x2, cancel_button. draw_set_alpha(0.1); draw_set_color(c_white); draw_rectangle(x + 26, y + 103, x + 126, y + 123, 0); - if (instance_exists(obj_cursor)){ + if (instance_exists(obj_cursor)) { obj_cursor.image_index = 1; } if (mouse_check_button_pressed(mb_left) && obj_controller.cooldown <= 0) { @@ -71,17 +75,19 @@ if (scr_hit(accept_button.x1, accept_button.y1, accept_button.x2, accept_button. draw_set_alpha(0.1); draw_set_color(c_white); draw_rectangle(x + 175, y + 103, x + 275, y + 123, 0); - if (instance_exists(obj_cursor)) obj_cursor.image_index = 1; + if (instance_exists(obj_cursor)) { + obj_cursor.image_index = 1; + } if (mouse_check_button_pressed(mb_left) && obj_controller.cooldown <= 0) { - if (is_struct(target)){ - if (inputting != 0){ - target.number = inputting; + if (is_struct(target)) { + if (inputting != 0) { + target.number = inputting; + } + global.ui_click_lock = false; + instance_destroy(); } - global.ui_click_lock = false; - instance_destroy(); - } execute = true; } } -draw_set_alpha(1); \ No newline at end of file +draw_set_alpha(1); diff --git a/objects/obj_popup_dialogue/Step_0.gml b/objects/obj_popup_dialogue/Step_0.gml index 21707a638c..fba945ed81 100644 --- a/objects/obj_popup_dialogue/Step_0.gml +++ b/objects/obj_popup_dialogue/Step_0.gml @@ -13,12 +13,12 @@ if (press_with_held(ord("V"), vk_control)) { } if (blink > 0) { - blink -= delta_time/1000000; + blink -= delta_time / 1000000; } else if (blink <= 0) { - blink = 2 + blink = 2; } -if (input_type = 1) { +if (input_type == 1) { inputting = keyboard_string; if (execute) { if (inputting == "") { @@ -29,8 +29,8 @@ if (input_type = 1) { } } -if (input_type = 2) { - if (string_length(string_letters(keyboard_string)) > 0){ +if (input_type == 2) { + if (string_length(string_letters(keyboard_string)) > 0) { keyboard_string = string_digits(keyboard_string); } @@ -49,8 +49,5 @@ if (input_type = 2) { keyboard_string = $"{maximum}"; } - if (execute = true) { - - } + if (execute == true) {} } - diff --git a/objects/obj_saveload/Alarm_0.gml b/objects/obj_saveload/Alarm_0.gml index 1cb513237c..5115df63e0 100644 --- a/objects/obj_saveload/Alarm_0.gml +++ b/objects/obj_saveload/Alarm_0.gml @@ -1,133 +1,134 @@ if (save_part == 6) { - txt = "Praise to the Machine God"; + txt = "Praise to the Machine God"; - with (obj_controller) { - scr_save(5, obj_saveload.save_number); - } - trickle = 2; + with (obj_controller) { + scr_save(5, obj_saveload.save_number); + } + trickle = 2; } if (save_part == 5) { - txt = "Astartes Registry"; + txt = "Astartes Registry"; - with (obj_controller) { - scr_save(4, obj_saveload.save_number); - } - trickle = 2; - save_part = 6; + with (obj_controller) { + scr_save(4, obj_saveload.save_number); + } + trickle = 2; + save_part = 6; } if (save_part == 4) { - txt = "Sacred Anointing of Oil"; + txt = "Sacred Anointing of Oil"; - with (obj_controller) { - scr_save(3, obj_saveload.save_number); - } - trickle = 2; - save_part = 5; + with (obj_controller) { + scr_save(3, obj_saveload.save_number); + } + trickle = 2; + save_part = 5; } if (save_part == 3) { - txt = "Charting Sector"; + txt = "Charting Sector"; - with (obj_controller) { - scr_save(2, obj_saveload.save_number); - } - trickle = 2; - save_part = 4; + with (obj_controller) { + scr_save(2, obj_saveload.save_number); + } + trickle = 2; + save_part = 4; } if (save_part == 2) { - txt = "Finding Servo Skulls"; + txt = "Finding Servo Skulls"; - with (obj_controller) { - scr_save(1, obj_saveload.save_number); - } - trickle = 2; - save_part = 3; + with (obj_controller) { + scr_save(1, obj_saveload.save_number); + } + trickle = 2; + save_part = 3; } if (save_part == 1) { - if (file_exists(string(PATH_save_files, save_number))) { - file_delete(string(PATH_save_files, save_number)); - } - obj_saveload.save[save_number] = 0; - save_part += 1; - trickle = 2; - txt = "Preparing"; + if (file_exists(string(PATH_save_files, save_number))) { + file_delete(string(PATH_save_files, save_number)); + } + obj_saveload.save[save_number] = 0; + save_part += 1; + trickle = 2; + txt = "Preparing"; } -if (load_part==6){ - txt="Praise to the Machine God"; - if (global.restart>0) then txt="Praise be to the Emperor"; - with(obj_controller){ - // show_debug_message($"load section 5"); - scr_load(5,global.load); - +if (load_part == 6) { + txt = "Praise to the Machine God"; + if (global.restart > 0) { + txt = "Praise be to the Emperor"; + } + with (obj_controller) { + // show_debug_message($"load section 5"); + scr_load(5, global.load); } - trickle=2; + trickle = 2; // if (instance_exists(obj_cuicons)){ // obj_cuicons.alarm[1]=30; // } } if (load_part == 5) { - txt = "Sacred Anointing of Oil"; - if (global.restart > 0) { - txt = "Speed Dialing Howling Banshee"; - } - - with (obj_controller) { - // show_debug_message($"load section 4"); - scr_load(4, global.load); - } - trickle = 2; - load_part = 6; + txt = "Sacred Anointing of Oil"; + if (global.restart > 0) { + txt = "Speed Dialing Howling Banshee"; + } + + with (obj_controller) { + // show_debug_message($"load section 4"); + scr_load(4, global.load); + } + trickle = 2; + load_part = 6; } if (load_part == 4) { - txt = "Astartes Registry"; - if (global.restart > 0) { - txt = "Donning Power Armour"; - } - with (obj_controller) { - // show_debug_message($"load section 3"); - scr_load(3, global.load); - } - trickle = 2; - load_part = 5; + txt = "Astartes Registry"; + if (global.restart > 0) { + txt = "Donning Power Armour"; + } + with (obj_controller) { + // show_debug_message($"load section 3"); + scr_load(3, global.load); + } + trickle = 2; + load_part = 5; } if (load_part == 3) { - txt = "Charting Sector"; - if (global.restart > 0) { - txt = "Rousing the Machine Spirit"; - } - with (obj_controller) { - // show_debug_message($"load section 2"); - scr_load(2, global.load); - } - trickle = 2; - load_part = 4; + txt = "Charting Sector"; + if (global.restart > 0) { + txt = "Rousing the Machine Spirit"; + } + with (obj_controller) { + // show_debug_message($"load section 2"); + scr_load(2, global.load); + } + trickle = 2; + load_part = 4; } if (load_part == 2) { - txt = "Finding Servo Skulls"; - if (global.restart > 0) { - txt = "Turtle Waxing Scalp"; - } - with (obj_controller) { - // show_debug_message($"load section 1"); - scr_load(1, global.load); - } - trickle = 2; - load_part = 3; + txt = "Finding Servo Skulls"; + if (global.restart > 0) { + txt = "Turtle Waxing Scalp"; + } + with (obj_controller) { + // show_debug_message($"load section 1"); + scr_load(1, global.load); + } + trickle = 2; + load_part = 3; } if (load_part == 1) { - if (file_exists(string(PATH_save_files, global.load))) { - load_part += 1; - trickle = 2; - txt = "Preparing"; - } + if (file_exists(string(PATH_save_files, global.load))) { + load_part += 1; + trickle = 2; + txt = "Preparing"; + } } diff --git a/objects/obj_saveload/Alarm_1.gml b/objects/obj_saveload/Alarm_1.gml index 5346fb3230..d42e5c78c2 100644 --- a/objects/obj_saveload/Alarm_1.gml +++ b/objects/obj_saveload/Alarm_1.gml @@ -1,14 +1,13 @@ - -obj_controller.menu=0;obj_controller.zui=0;obj_controller.invis=false; -obj_cursor.image_alpha=1; - - -if (global.restart>0){ - - with(obj_ini){instance_destroy();} +obj_controller.menu = 0; +obj_controller.zui = 0; +obj_controller.invis = false; +obj_cursor.image_alpha = 1; + +if (global.restart > 0) { + with (obj_ini) { + instance_destroy(); + } room_goto(Creation); } instance_destroy(); - - diff --git a/objects/obj_saveload/Alarm_2.gml b/objects/obj_saveload/Alarm_2.gml index c9a864774c..5e351ad6ca 100644 --- a/objects/obj_saveload/Alarm_2.gml +++ b/objects/obj_saveload/Alarm_2.gml @@ -1 +1 @@ -alarm[3]=1; +alarm[3] = 1; diff --git a/objects/obj_saveload/Alarm_3.gml b/objects/obj_saveload/Alarm_3.gml index fd6ad1e870..49a11a4a3b 100644 --- a/objects/obj_saveload/Alarm_3.gml +++ b/objects/obj_saveload/Alarm_3.gml @@ -1,3 +1,3 @@ -hide=0; -obj_controller.invis=false; -obj_controller.zui=1; +hide = 0; +obj_controller.invis = false; +obj_controller.zui = 1; diff --git a/objects/obj_saveload/Create_0.gml b/objects/obj_saveload/Create_0.gml index 2ce7683417..a90611c476 100644 --- a/objects/obj_saveload/Create_0.gml +++ b/objects/obj_saveload/Create_0.gml @@ -1,5 +1,4 @@ - -scr_image("loading",-50,0,0,0,0); +scr_image("loading", -50, 0, 0, 0, 0); GameSave = {}; GameSave.Stars = []; GameSave.PlayerFleet = []; @@ -8,29 +7,29 @@ GameSave.Ini = {}; GameSave.Controller = {}; GameSave.EventLog = []; -menu=0;// 1 : save, 2: load -save_part=0; -load_part=0; -save_number=0; +menu = 0; // 1 : save, 2: load +save_part = 0; +load_part = 0; +save_number = 0; /// set to true before calling alarm[0] to run autosave behaviour -autosaving=false; +autosaving = false; /// number of frames between load sections to draw the progress bar -trickle=0; -txt=""; -hide=0; -bar=0; -slow=0; -saves=0; -highlighting=0; -spr_screen=0; -first_open=0; -max_ini=0; -reset=0; -splash=choose(0,1,2,3,4); +trickle = 0; +txt = ""; +hide = 0; +bar = 0; +slow = 0; +saves = 0; +highlighting = 0; +spr_screen = 0; +first_open = 0; +max_ini = 0; +reset = 0; +splash = choose(0, 1, 2, 3, 4); -debug=""; +debug = ""; -top=0; +top = 0; if (instance_exists(obj_controller)) { if (obj_controller.zoomed == 1) { @@ -70,34 +69,32 @@ repeat (100) { i += 1; } +first_open = saves; -first_open=saves; - - -if (file_exists("saves.ini")){ +if (file_exists("saves.ini")) { ini_open("saves.ini"); - for(var i = 0; i <= 200; i++){ - if (save[i]>=0){ - if (ini_section_exists(string(save[i]))){ - save_turn[save[i]]=ini_read_real(string(save[i]),"turn",0); - save_chapter[save[i]]=ini_read_string(string(save[i]),"chapter_name","Error"); - save_master[save[i]]=ini_read_string(string(save[i]),"master_name","Error"); - save_marines[save[i]]=ini_read_real(string(save[i]),"marines",0); - save_date[save[i]]=ini_read_string(string(save[i]),"date","Error"); - save_time[save[i]]=ini_read_real(string(save[i]),"time",0); - save_seed[save[i]]=ini_read_real(string(save[i]),"seed",0); - save_icon[save[i]]=ini_read_string(string(save[i]), "icon_name", "unknown"); + for (var i = 0; i <= 200; i++) { + if (save[i] >= 0) { + if (ini_section_exists(string(save[i]))) { + save_turn[save[i]] = ini_read_real(string(save[i]), "turn", 0); + save_chapter[save[i]] = ini_read_string(string(save[i]), "chapter_name", "Error"); + save_master[save[i]] = ini_read_string(string(save[i]), "master_name", "Error"); + save_marines[save[i]] = ini_read_real(string(save[i]), "marines", 0); + save_date[save[i]] = ini_read_string(string(save[i]), "date", "Error"); + save_time[save[i]] = ini_read_real(string(save[i]), "time", 0); + save_seed[save[i]] = ini_read_real(string(save[i]), "seed", 0); + save_icon[save[i]] = ini_read_string(string(save[i]), "icon_name", "unknown"); } - if (!ini_section_exists(string(i))){ - save_turn[i]=-50; - save_chapter[i]="Unknown Save Data"; - save_master[i]="Unknown"; - save_marines[i]=-50; - save_date[i]=""; - save_time[i]=0; - save_icon[i]="unknown"; + if (!ini_section_exists(string(i))) { + save_turn[i] = -50; + save_chapter[i] = "Unknown Save Data"; + save_master[i] = "Unknown"; + save_marines[i] = -50; + save_date[i] = ""; + save_time[i] = 0; + save_icon[i] = "unknown"; } } } @@ -105,10 +102,4 @@ if (file_exists("saves.ini")){ ini_close(); } var view = new DebugView("Save Debug", self); -view.add_section("Save Vars") -.add_watch("menu") -.add_watch("first_open") -.add_watch("top") -.add_watch("debug") -.dump_props() -.hide(); \ No newline at end of file +view.add_section("Save Vars").add_watch("menu").add_watch("first_open").add_watch("top").add_watch("debug").dump_props().hide(); diff --git a/objects/obj_saveload/Destroy_0.gml b/objects/obj_saveload/Destroy_0.gml index f38e20e81c..6b59995f2a 100644 --- a/objects/obj_saveload/Destroy_0.gml +++ b/objects/obj_saveload/Destroy_0.gml @@ -1,9 +1,15 @@ -scr_image("loading",-666,0,0,0,0); +scr_image("loading", -666, 0, 0, 0, 0); -if (!audio_is_playing(snd_royal)) and (instance_exists(obj_controller)){ - audio_play_sound(snd_royal,0,1);audio_sound_gain(snd_royal,0,0); - - var nope;nope=0; - if (obj_controller.master_volume=0) or (obj_controller.music_volume=0) then nope=1; - if (nope!=1){audio_sound_gain(snd_royal,0.25*obj_controller.master_volume*obj_controller.music_volume,2000);} +if ((!audio_is_playing(snd_royal)) && instance_exists(obj_controller)) { + audio_play_sound(snd_royal, 0, 1); + audio_sound_gain(snd_royal, 0, 0); + + var nope; + nope = 0; + if ((obj_controller.master_volume == 0) || (obj_controller.music_volume == 0)) { + nope = 1; + } + if (nope != 1) { + audio_sound_gain(snd_royal, 0.25 * obj_controller.master_volume * obj_controller.music_volume, 2000); + } } diff --git a/objects/obj_saveload/Draw_0.gml b/objects/obj_saveload/Draw_0.gml index f939fff667..a8c1918cb4 100644 --- a/objects/obj_saveload/Draw_0.gml +++ b/objects/obj_saveload/Draw_0.gml @@ -1,149 +1,202 @@ var __b__; __b__ = action_if_variable(hide, 0, 0); -if __b__ -{ +if (__b__) { + var xx, yy; + xx = camera_get_view_x(view_camera[0]) + 0; + yy = camera_get_view_y(view_camera[0]) + 0; + if (instance_exists(obj_main_menu)) { + xx = 0; + yy = 0; + } -var xx,yy; -xx=__view_get( e__VW.XView, 0 )+0;yy=__view_get( e__VW.YView, 0 )+0; -if (instance_exists(obj_main_menu)){xx=0;yy=0;} + if (autosaving) { + exit; + } + if (save_part + load_part > 0) { + draw_set_color(0); -if(autosaving){ - exit; -} + // + // draw_sprite(spr_load_splash,splash,xx+0,yy+0); + scr_image("loading", splash, xx + 0, yy + 0, 1600, 900); + // + draw_sprite(spr_loadbar_empty, 0, xx + 1047, yy + 875); + draw_sprite(spr_loadbar, 0, xx + 1047, yy + 875); + draw_sprite(spr_loadbar_cover, bar, xx + 1047, yy + 875); + if (save_part > 0) { + draw_sprite(spr_load_text, 1, xx + 1068, yy + 821); + } + if ((load_part > 0) && (global.restart == 0)) { + draw_sprite(spr_load_text, 0, xx + 1068, yy + 821); + } + if ((load_part > 0) && (global.restart > 0)) { + draw_sprite(spr_load_text, 2, xx + 1068, yy + 821); + } + } -if (save_part+load_part>0){ - draw_set_color(0); - - // - // draw_sprite(spr_load_splash,splash,xx+0,yy+0); - scr_image("loading",splash,xx+0,yy+0,1600,900); - // - - draw_sprite(spr_loadbar_empty,0,xx+1047,yy+875); - draw_sprite(spr_loadbar,0,xx+1047,yy+875); - draw_sprite(spr_loadbar_cover,bar,xx+1047,yy+875); - - if (save_part>0) then draw_sprite(spr_load_text,1,xx+1068,yy+821); - if (load_part>0) and (global.restart=0) then draw_sprite(spr_load_text,0,xx+1068,yy+821); - if (load_part>0) and (global.restart>0) then draw_sprite(spr_load_text,2,xx+1068,yy+821); - -} + if ((menu == 1) || (menu == 2)) { + // This is the other one + draw_set_color(0); + draw_set_alpha(0.75); + if (room_get_name(room) != "Main_Menu") { + draw_rectangle(0, 0, room_width, room_height, 0); + } + if (room_get_name(room) == "Main_Menu") { + draw_rectangle(0, 0, room_width, 707, 0); + } + draw_set_alpha(1); + draw_set_halign(fa_center); + draw_set_color(0); + draw_sprite(spr_save_header, 0, xx + 0, yy + 27); + if (menu == 1) { + draw_sprite(spr_save_headers, 1, xx + 800, yy + 60); + } + if (menu == 2) { + draw_sprite(spr_save_headers, 0, xx + 800, yy + 60); + } + draw_sprite(spr_save_footer, 0, xx + 0, yy + 797); + var o, x2, y2, s; + o = top; + x2 = camera_get_view_x(view_camera[0]) + 32; + y2 = camera_get_view_y(view_camera[0]) + 166; + s = 0; + repeat (4) { + if (((save[o] >= 0) || ((first_open == o) && (menu == 1)) || (global.load == o) || (save_number == o)) && (save_number == 0)) { + s = save[o]; + draw_set_font(fnt_40k_30b); + draw_set_halign(fa_left); + draw_set_color(0); -if (menu=1) or (menu=2){// This is the other one - draw_set_color(0);draw_set_alpha(0.75); - if (room_get_name(room)!="Main_Menu") then draw_rectangle(0,0,room_width,room_height,0); - if (room_get_name(room)="Main_Menu") then draw_rectangle(0,0,room_width,707,0); - draw_set_alpha(1); - - draw_set_halign(fa_center); - draw_set_color(0); - - draw_sprite(spr_save_header,0,xx+0,yy+27); - if (menu=1) then draw_sprite(spr_save_headers,1,xx+800,yy+60); - if (menu=2) then draw_sprite(spr_save_headers,0,xx+800,yy+60); - draw_sprite(spr_save_footer,0,xx+0,yy+797); - - var o,x2,y2,s;o=top;x2=__view_get( e__VW.XView, 0 )+32;y2=__view_get( e__VW.YView, 0 )+166;s=0; - repeat(4){ - if ((save[o]>=0) or ((first_open=o) and (menu=1)) or (global.load=o) or (save_number=o)) and (save_number=0){ - s=save[o]; - draw_set_font(fnt_40k_30b); - draw_set_halign(fa_left); - draw_set_color(0); - - draw_rectangle(x2+56,y2+5,x2+238,y2+123,0); - draw_rectangle(x2+258,y2+25,x2+1480,y2+80,0); + draw_rectangle(x2 + 56, y2 + 5, x2 + 238, y2 + 123, 0); + draw_rectangle(x2 + 258, y2 + 25, x2 + 1480, y2 + 80, 0); - var high;high=0; - if (scr_hit(x2,y2,x2+1526,y2+149)){ - // high=1; - debug="Save:"+string(save[o])+", array position:"+string(o)+", turn:"+string(save_turn[o]); - } - draw_sprite(spr_save_data,0,x2,y2); - if(o == 0){ - //autosave - draw_text_transformed(x2+21,y2+62,string_hash_to_newline("A"),1.1,1.1,0); - } else { - draw_text_transformed(x2+23,y2+62,string_hash_to_newline(o),1.1,1.1,0); - } - draw_text_transformed(x2+270,y2+10,string_hash_to_newline("Chapter"),0.9,0.9,0); - draw_text_transformed(x2+774,y2+10,string_hash_to_newline("Marines"),0.9,0.9,0); - draw_text_transformed(x2+1024,y2+10,string_hash_to_newline("Turn"),0.9,0.9,0); - draw_text_transformed(x2+1274,y2+10,string_hash_to_newline("Game Time"),0.9,0.9,0); - - draw_set_color(c_gray); - if (first_open!=o){ - draw_text_transformed(x2+270,y2+48,string_hash_to_newline(string(save_chapter[save[o]])+" ("+string(save_date[save[o]])+")"),0.7,0.7,0); - draw_text_transformed(x2+774,y2+48,string_hash_to_newline(string(save_marines[save[o]])),0.7,0.7,0); - draw_text_transformed(x2+1024,y2+48,string_hash_to_newline(string(save_turn[save[o]])),0.7,0.7,0); - var _chapter_icon = scr_load_chapter_icon(save_icon[save[o]]); - var _icon_size = 94; - draw_sprite_stretched(_chapter_icon, 0, x2+147 - (_icon_size / 2), y2+28, _icon_size, _icon_size); - var ohboy,result,tsec,tmin,thour,tday; - ohboy=save_time[save[o]];result=""; - tsec=0;tmin=0;thour=0;tday=0; - if (ohboy>0){ - tday=floor(ohboy/86400);if (tday>=1) then ohboy-=(tday*86400); - thour=floor(ohboy/3600);if (thour>=1) then ohboy-=(thour*3600); - tmin=floor(ohboy/60);if (tmin>=1) then ohboy-=(tmin*60); - tsec=ohboy; - - if (tday>0) then result+=string(tday)+"d "; - if (thour=0) then result+="00:"; - if (thour>0) and (thour<10) then result+="0"+string(thour)+":"; - if (thour>=10) then result+=string(thour)+":"; - if (tmin=0) then result+="00:"; - if (tmin>0) and (tmin<10) then result+="0"+string(tmin)+":"; - if (tmin>=10) then result+=string(tmin)+":"; - if (tsec=0) then result+="00"; - if (tsec>0) and (tsec<10) then result+="0"+string(tsec); - if (tsec>=10) then result+=string(tsec); + var high; + high = 0; + if (scr_hit(x2, y2, x2 + 1526, y2 + 149)) { + // high=1; + debug = "Save:" + string(save[o]) + ", array position:" + string(o) + ", turn:" + string(save_turn[o]); + } + draw_sprite(spr_save_data, 0, x2, y2); + if (o == 0) { + //autosave + draw_text_transformed(x2 + 21, y2 + 62, string_hash_to_newline("A"), 1.1, 1.1, 0); + } else { + draw_text_transformed(x2 + 23, y2 + 62, string_hash_to_newline(o), 1.1, 1.1, 0); + } + draw_text_transformed(x2 + 270, y2 + 10, string_hash_to_newline("Chapter"), 0.9, 0.9, 0); + draw_text_transformed(x2 + 774, y2 + 10, string_hash_to_newline("Marines"), 0.9, 0.9, 0); + draw_text_transformed(x2 + 1024, y2 + 10, string_hash_to_newline("Turn"), 0.9, 0.9, 0); + draw_text_transformed(x2 + 1274, y2 + 10, string_hash_to_newline("Game Time"), 0.9, 0.9, 0); + + draw_set_color(c_gray); + if (first_open != o) { + draw_text_transformed(x2 + 270, y2 + 48, string_hash_to_newline(string(save_chapter[save[o]]) + " (" + string(save_date[save[o]]) + ")"), 0.7, 0.7, 0); + draw_text_transformed(x2 + 774, y2 + 48, string_hash_to_newline(string(save_marines[save[o]])), 0.7, 0.7, 0); + draw_text_transformed(x2 + 1024, y2 + 48, string_hash_to_newline(string(save_turn[save[o]])), 0.7, 0.7, 0); + var _chapter_icon = scr_load_chapter_icon(save_icon[save[o]]); + var _icon_size = 94; + draw_sprite_stretched(_chapter_icon, 0, x2 + 147 - (_icon_size / 2), y2 + 28, _icon_size, _icon_size); + var ohboy, result, tsec, tmin, thour, tday; + ohboy = save_time[save[o]]; + result = ""; + tsec = 0; + tmin = 0; + thour = 0; + tday = 0; + if (ohboy > 0) { + tday = floor(ohboy / 86400); + if (tday >= 1) { + ohboy -= tday * 86400; + } + thour = floor(ohboy / 3600); + if (thour >= 1) { + ohboy -= thour * 3600; + } + tmin = floor(ohboy / 60); + if (tmin >= 1) { + ohboy -= tmin * 60; + } + tsec = ohboy; + + if (tday > 0) { + result += string(tday) + "d "; + } + if (thour == 0) { + result += "00:"; + } + if ((thour > 0) && (thour < 10)) { + result += "0" + string(thour) + ":"; + } + if (thour >= 10) { + result += string(thour) + ":"; + } + if (tmin == 0) { + result += "00:"; + } + if ((tmin > 0) && (tmin < 10)) { + result += "0" + string(tmin) + ":"; + } + if (tmin >= 10) { + result += string(tmin) + ":"; + } + if (tsec == 0) { + result += "00"; + } + if ((tsec > 0) && (tsec < 10)) { + result += "0" + string(tsec); + } + if (tsec >= 10) { + result += string(tsec); + } + } + draw_text_transformed(x2 + 1274, y2 + 48, string_hash_to_newline(string(result)), 0.7, 0.7, 0); + } + if ((first_open == o) && (menu == 1)) { + draw_text_transformed(x2 + 270, y2 + 48, string_hash_to_newline("(EMPTY SAVE SLOT)"), 0.7, 0.7, 0); } - draw_text_transformed(x2+1274,y2+48,string_hash_to_newline(string(result)),0.7,0.7,0); } - if (first_open=o) and (menu=1) then draw_text_transformed(x2+270,y2+48,string_hash_to_newline("(EMPTY SAVE SLOT)"),0.7,0.7,0); - } - - draw_set_font(fnt_40k_30b);draw_set_halign(fa_center); - - if (save[o] > 0) { //intentionally not allowed to delete the autosave file - // Delete Data - draw_set_alpha(1); - draw_set_color(c_gray); - draw_rectangle(x2 + 807, y2 + 113, x2 + 951, y2 + 146, 0); - draw_set_color(c_black); - draw_rectangle(x2 + 807, y2 + 113, x2 + 951, y2 + 146, 1); - draw_text_transformed(x2 + 879, y2 + 117, string_hash_to_newline("Delete Game"), 0.7, 0.7, 0); - if (scr_hit(x2 + 807, y2 + 113, x2 + 951, y2 + 146)) { - draw_set_alpha(0.1); - draw_set_color(c_white); - draw_rectangle(x2 + 807, y2 + 113, x2 + 951, y2 + 146, 0); + + draw_set_font(fnt_40k_30b); + draw_set_halign(fa_center); + + if (save[o] > 0) { + //intentionally not allowed to delete the autosave file + // Delete Data draw_set_alpha(1); - if (scr_click_left(,true) && !instance_exists(obj_popup)) { - // Clear - var com; - com = instance_create(0, 0, obj_popup); - com.image = "fuklaw"; - com.title = "Delete Save Game?"; - com.text = "Are you sure you wish to delete Save " + string(save[o]) + "- " + string(save_chapter[save[o]]) + "?"; - com.add_option(["Yes", "No"]); - com.save = o; - com.woopwoopwoop = menu; - com.owner = top; + draw_set_color(c_gray); + draw_rectangle(x2 + 807, y2 + 113, x2 + 951, y2 + 146, 0); + draw_set_color(c_black); + draw_rectangle(x2 + 807, y2 + 113, x2 + 951, y2 + 146, 1); + draw_text_transformed(x2 + 879, y2 + 117, string_hash_to_newline("Delete Game"), 0.7, 0.7, 0); + if (scr_hit(x2 + 807, y2 + 113, x2 + 951, y2 + 146)) { + draw_set_alpha(0.1); + draw_set_color(c_white); + draw_rectangle(x2 + 807, y2 + 113, x2 + 951, y2 + 146, 0); + draw_set_alpha(1); + if (scr_click_left(, true) && !instance_exists(obj_popup)) { + // Clear + var com; + com = instance_create(0, 0, obj_popup); + com.image = "fuklaw"; + com.title = "Delete Save Game?"; + com.text = "Are you sure you wish to delete Save " + string(save[o]) + "- " + string(save_chapter[save[o]]) + "?"; + com.add_option(["Yes", "No"]); + com.save = o; + com.woopwoopwoop = menu; + com.owner = top; + } } } - } - - if (menu=2) and (save[o]>=0){ - // Restart - //! Doesn't work properly, commented out until repaired; - /* draw_set_alpha(1); + + if ((menu == 2) && (save[o] >= 0)) { + // Restart + //! Doesn't work properly, commented out until repaired; + /* draw_set_alpha(1); draw_set_color(c_gray);draw_rectangle(x2+977,y2+113,x2+1121,y2+146,0); draw_set_color(c_black);draw_rectangle(x2+977,y2+113,x2+1121,y2+146,1); draw_text_transformed(x2+1050,y2+117,string_hash_to_newline("Restart Game"),0.7,0.7,0); @@ -173,103 +226,136 @@ if (menu=1) or (menu=2){// This is the other one } } } */ - - // Load - draw_set_alpha(1); - draw_set_color(c_gray);draw_rectangle(x2+1317,y2+113,x2+1461,y2+146,0); - draw_set_color(c_black);draw_rectangle(x2+1317,y2+113,x2+1461,y2+146,1); - draw_text_transformed(x2+1385,y2+117,string_hash_to_newline("Load Game"),0.7,0.7,0); - if (scr_hit(x2+1317,y2+113,x2+1461,y2+146)){ - draw_set_alpha(0.1);draw_set_color(c_white);draw_rectangle(x2+1317,y2+113,x2+1461,y2+146,0);draw_set_alpha(1); - if (scr_click_left(,true) and !instance_exists(obj_popup)) {// Load - global.load=save[o];menu=0;load_part=1;obj_cursor.image_alpha=0;splash=choose(0,1,2,3,4); - - // show_message("loading 'save"+string(save[o])+".json'"); - - if (instance_exists(obj_main_menu)){ - with(obj_main_menu){ - part_particles_clear(p_system); - instance_destroy(); - } - } - - with(obj_controller){instance_destroy();} - with(obj_creation){instance_destroy();} - with(obj_ini){instance_destroy();} - with(obj_star){instance_destroy();} - with(obj_all_fleet){instance_destroy();} - with(obj_popup){instance_destroy();} - audio_stop_all(); - - room_goto(Game); - } - } - } - - if (menu=1) and ((save[o]>0) or (first_open=o)){ // intentionally not allowed to saveover the autosave slot manually - // Save - draw_set_alpha(1); - draw_set_color(c_gray);draw_rectangle(x2+1317,y2+113,x2+1461,y2+146,0); - draw_set_color(c_black);draw_rectangle(x2+1317,y2+113,x2+1461,y2+146,1); - draw_text_transformed(x2+1386,y2+117,string_hash_to_newline("Save Game"),0.7,0.7,0); - if (scr_hit(x2+1317,y2+113,x2+1461,y2+146)){ - draw_set_alpha(0.1);draw_set_color(c_white);draw_rectangle(x2+1317,y2+113,x2+1461,y2+146,0);draw_set_alpha(1); - if (scr_click_left(,true)) { - if (instance_exists(obj_main_menu)){with(obj_main_menu){part_particles_clear(p_system);}} - - // If open slot then set the save.ini to the maximum - if (!file_exists(string(PATH_save_files, save[o])) || (save[o] == 0)) { - save_part=1;menu=0;save_number=max_ini;obj_cursor.image_alpha=0;splash=choose(0,1,2,3,4); - with(obj_new_button){instance_destroy();} - with(obj_ingame_menu){instance_destroy();} - // Other here - alarm[0]=1; - } - // If file exists then overright - if (file_exists(string(PATH_save_files, save[o]))) { - file_delete(string(PATH_save_files, save[o])); - save_part = 1; + + // Load + draw_set_alpha(1); + draw_set_color(c_gray); + draw_rectangle(x2 + 1317, y2 + 113, x2 + 1461, y2 + 146, 0); + draw_set_color(c_black); + draw_rectangle(x2 + 1317, y2 + 113, x2 + 1461, y2 + 146, 1); + draw_text_transformed(x2 + 1385, y2 + 117, string_hash_to_newline("Load Game"), 0.7, 0.7, 0); + if (scr_hit(x2 + 1317, y2 + 113, x2 + 1461, y2 + 146)) { + draw_set_alpha(0.1); + draw_set_color(c_white); + draw_rectangle(x2 + 1317, y2 + 113, x2 + 1461, y2 + 146, 0); + draw_set_alpha(1); + if (scr_click_left(, true) && !instance_exists(obj_popup)) { + // Load + global.load = save[o]; menu = 0; - save_number = o; + load_part = 1; obj_cursor.image_alpha = 0; splash = choose(0, 1, 2, 3, 4); - with (obj_new_button) { + + // show_message("loading 'save"+string(save[o])+".json'"); + + if (instance_exists(obj_main_menu)) { + with (obj_main_menu) { + part_particles_clear(p_system); + instance_destroy(); + } + } + + with (obj_controller) { instance_destroy(); } - with (obj_ingame_menu) { + with (obj_creation) { instance_destroy(); } - // Other here - alarm[0] = 1; + with (obj_ini) { + instance_destroy(); + } + with (obj_star) { + instance_destroy(); + } + with (obj_all_fleet) { + instance_destroy(); + } + with (obj_popup) { + instance_destroy(); + } + audio_stop_all(); + + room_goto(Game); } - } } - } - - o+=1;y2+=158; - } - - // 32,166 - - -if (instance_exists(obj_main_menu_buttons)){ - if (obj_main_menu_buttons.fade>0){ - draw_set_color(0); - draw_set_alpha(obj_main_menu_buttons.fade/40); - draw_rectangle(0,0,room_width,room_height,0); - } - draw_set_alpha(1); -} - -} + if ((menu == 1) && ((save[o] > 0) || (first_open == o))) { + // intentionally not allowed to saveover the autosave slot manually + // Save + draw_set_alpha(1); + draw_set_color(c_gray); + draw_rectangle(x2 + 1317, y2 + 113, x2 + 1461, y2 + 146, 0); + draw_set_color(c_black); + draw_rectangle(x2 + 1317, y2 + 113, x2 + 1461, y2 + 146, 1); + draw_text_transformed(x2 + 1386, y2 + 117, string_hash_to_newline("Save Game"), 0.7, 0.7, 0); + if (scr_hit(x2 + 1317, y2 + 113, x2 + 1461, y2 + 146)) { + draw_set_alpha(0.1); + draw_set_color(c_white); + draw_rectangle(x2 + 1317, y2 + 113, x2 + 1461, y2 + 146, 0); + draw_set_alpha(1); + if (scr_click_left(, true)) { + if (instance_exists(obj_main_menu)) { + with (obj_main_menu) { + part_particles_clear(p_system); + } + } + // If open slot then set the save.ini to the maximum + if (!file_exists(string(PATH_save_files, save[o])) || (save[o] == 0)) { + save_part = 1; + menu = 0; + save_number = max_ini; + obj_cursor.image_alpha = 0; + splash = choose(0, 1, 2, 3, 4); + with (obj_new_button) { + instance_destroy(); + } + with (obj_ingame_menu) { + instance_destroy(); + } + // Other here + alarm[0] = 1; + } + // If file exists then overright + if (file_exists(string(PATH_save_files, save[o]))) { + file_delete(string(PATH_save_files, save[o])); + save_part = 1; + menu = 0; + save_number = o; + obj_cursor.image_alpha = 0; + splash = choose(0, 1, 2, 3, 4); + with (obj_new_button) { + instance_destroy(); + } + with (obj_ingame_menu) { + instance_destroy(); + } + // Other here + alarm[0] = 1; + } + } + } + } + o += 1; + y2 += 158; + } + // 32,166 + if (instance_exists(obj_main_menu_buttons)) { + if (obj_main_menu_buttons.fade > 0) { + draw_set_color(0); + draw_set_alpha(obj_main_menu_buttons.fade / 40); + draw_rectangle(0, 0, room_width, room_height, 0); + } + draw_set_alpha(1); + } + } -/*draw_set_color(c_red);draw_set_font(fnt_menu); + /*draw_set_color(c_red);draw_set_font(fnt_menu); draw_set_alpha(1);draw_text(xx+30,yy+30,"First Open: "+string(first_open)); draw_set_alpha(1);draw_text(xx+30,yy+50,"save1: "+string(save[1])); draw_set_alpha(1);draw_text(xx+30,yy+70,"save2: "+string(save[2])); @@ -284,8 +370,6 @@ draw_set_alpha(1);draw_text(xx+30,yy+230,"save10: "+string(save[10])); draw_set_alpha(1);draw_text(xx+30,yy+250,"save11: "+string(save[11])); draw_set_alpha(1);draw_text(xx+30,yy+270,"save12: "+string(save[12]));*/ - - -/* */ + /* */ } /* */ diff --git a/objects/obj_saveload/KeyPress_1.gml b/objects/obj_saveload/KeyPress_1.gml index 0b0ebff512..0c572e8c7d 100644 --- a/objects/obj_saveload/KeyPress_1.gml +++ b/objects/obj_saveload/KeyPress_1.gml @@ -1,4 +1 @@ - -reset=0; - - +reset = 0; diff --git a/objects/obj_saveload/Mouse_60.gml b/objects/obj_saveload/Mouse_60.gml index 62188dfc13..27fa3806ad 100644 --- a/objects/obj_saveload/Mouse_60.gml +++ b/objects/obj_saveload/Mouse_60.gml @@ -1,9 +1,10 @@ - -if (slow<0) then slow=0; -slow+=1; +if (slow < 0) { + slow = 0; +} +slow += 1; if (slow >= 3) { - if (top > 0) { - top -= 1; - } + if (top > 0) { + top -= 1; + } } diff --git a/objects/obj_saveload/Mouse_61.gml b/objects/obj_saveload/Mouse_61.gml index 31fd8ce50d..3158267d7e 100644 --- a/objects/obj_saveload/Mouse_61.gml +++ b/objects/obj_saveload/Mouse_61.gml @@ -1,9 +1,10 @@ +if (slow > 0) { + slow = 0; +} +slow -= 1; -if (slow>0) then slow=0; -slow-=1; - -if (slow<=-3){ - if (top+3<=saves){ - top+=1; +if (slow <= -3) { + if (top + 3 <= saves) { + top += 1; } } diff --git a/objects/obj_saveload/Step_0.gml b/objects/obj_saveload/Step_0.gml index fc22c7c900..44af9a15ad 100644 --- a/objects/obj_saveload/Step_0.gml +++ b/objects/obj_saveload/Step_0.gml @@ -1,17 +1,24 @@ - -reset+=1; -if (reset>=50){ - slow=0;reset=0; +reset += 1; +if (reset >= 50) { + slow = 0; + reset = 0; } -if (trickle>-1){ +if (trickle > -1) { var save_parts = 6; + trickle -= 1; + if (trickle > 0) { + bar += min(100, round(100 / save_parts)); + } + if (trickle == 0) { + alarm[0] = 1; + } - trickle-=1; - if (trickle>0) then bar+= min(100, round(100/save_parts)); - if (trickle=0) then alarm[0]=1; - - if (bar>=100){trickle=-1;bar=100;alarm[0]=-1;alarm[1]=5;} + if (bar >= 100) { + trickle = -1; + bar = 100; + alarm[0] = -1; + alarm[1] = 5; + } } - diff --git a/objects/obj_shop/Create_0.gml b/objects/obj_shop/Create_0.gml index b5fab365a0..9f9128b76b 100644 --- a/objects/obj_shop/Create_0.gml +++ b/objects/obj_shop/Create_0.gml @@ -7,8 +7,8 @@ construction_started = 0; eta = 0; target_comp = obj_controller.new_vehicles; -slate_panel = new DataSlate(); -scroll_point=0; +slate_panel = new DataSlate(); +scroll_point = 0; tooltip_show = 0; tooltip = ""; tooltip_stat1 = 0; @@ -18,12 +18,12 @@ tooltip_stat4 = 0; tooltip_other = ""; last_item = ""; forge_master = scr_role_count("Forge Master", "", "units"); -if (array_length(forge_master)>0){ - forge_master=forge_master[0]; +if (array_length(forge_master) > 0) { + forge_master = forge_master[0]; } else { - forge_master="none"; + forge_master = "none"; } -mechanicus_modifier = (((obj_controller.disposition[eFACTION.Mechanicus]-50)/200)*-1)+1 +mechanicus_modifier = (((obj_controller.disposition[eFACTION.Mechanicus] - 50) / 200) * -1) + 1; var research = obj_controller.production_research; shop = "equipment"; /*if (obj_controller.menu=55) then shop="equipment"; @@ -34,7 +34,7 @@ if (instance_number(obj_shop) > 1) { var war; war = instance_nearest(0, 0, obj_shop); shop = war.shop; - with(war) { + with (war) { instance_destroy(); } x = 0; @@ -46,7 +46,7 @@ var research_pathways = obj_controller.production_research_pathways; var i, rene; i = -1; rene = 0; -repeat(80) { +repeat (80) { i += 1; item[i] = ""; x_mod[i] = 0; @@ -54,36 +54,40 @@ repeat(80) { mc_stocked[i] = 0; item_cost[i] = 0; nobuy[i] = 0; - forge_cost[i]=0; - tooltip_overide[i]=0; + forge_cost[i] = 0; + tooltip_overide[i] = 0; } -if (obj_controller.faction_status[eFACTION.Imperium] = "War") { +if (obj_controller.faction_status[eFACTION.Imperium] == "War") { rene = 1; - with(obj_temp6) { + with (obj_temp6) { instance_destroy(); } - with(obj_star) { + with (obj_star) { var u; u = 0; - repeat(4) { + repeat (4) { u += 1; - if (p_type[u] = "Forge") and(p_owner[u] = 1) then instance_create(x, y, obj_temp6); + if ((p_type[u] == "Forge") && (p_owner[u] == 1)) { + instance_create(x, y, obj_temp6); + } } } - if (instance_exists(obj_temp6)) then rene = 0; - with(obj_temp6) { + if (instance_exists(obj_temp6)) { + rene = 0; + } + with (obj_temp6) { instance_destroy(); } } tab_buttons = { - "equipment":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "armour":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "vehicles":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), - "ships":new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), -} -var require_tool_tip = "requires: #" -if (shop = "equipment") { + "equipment": new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), + "armour": new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), + "vehicles": new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), + "ships": new MainMenuButton(spr_ui_but_3, spr_ui_hov_3), +}; +var require_tool_tip = "requires: #"; +if (shop == "equipment") { i = 0; i += 1; item[i] = "Combat Knife"; @@ -98,11 +102,11 @@ if (shop = "equipment") { i += 1; x_mod[i] = 9; item[i] = "Eviscerator"; - if (research.chain[0]>0){ + if (research.chain[0] > 0) { forge_cost[i] = 150; } else { - tooltip_overide[i] = $"{require_tool_tip} {research_pathways.chain[0][0]}" - } + tooltip_overide[i] = $"{require_tool_tip} {research_pathways.chain[0][0]}"; + } item_stocked[i] = scr_item_count(item[i]); nobuy[i] = 1; i += 1; @@ -111,15 +115,14 @@ if (shop = "equipment") { item_cost[i] = 10; forge_cost[i] = 40; i += 1; - - + item[i] = "Power Axe"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 40; - if (research.power_fields[0]>1){ + if (research.power_fields[0] > 1) { forge_cost[i] = 100; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -127,32 +130,32 @@ if (shop = "equipment") { item[i] = "Power Sword"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 25; - if (research.power_fields[0]>1){ + if (research.power_fields[0] > 1) { forge_cost[i] = 100; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - i += 1; + i += 1; item[i] = "Power Spear"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 40; - if (research.power_fields[0]>1){ + if (research.power_fields[0] > 1) { forge_cost[i] = 100; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - i += 1; + i += 1; item[i] = "Crozius Arcanum"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 75; - if (research.power_fields[0]>1){ + if (research.power_fields[0] > 1) { forge_cost[i] = 150; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -160,25 +163,25 @@ if (shop = "equipment") { item[i] = "Power Fist"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 60; - if (research.power_fields[0]>1){ + if (research.power_fields[0] > 1) { forge_cost[i] = 150; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - i += 1; + i += 1; item[i] = "Boltstorm Gauntlet"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 90; - if (research.power_fields[0]>1&& research.bolt[0]>=2){ + if (research.power_fields[0] > 1 && research.bolt[0] >= 2) { forge_cost[i] = 300; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - /*i += 1; + /*i += 1; item[i] = "Executioner Power Axe"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 100; @@ -194,19 +197,19 @@ if (shop = "equipment") { item[i] = "Power Mace"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 50; - if (research.power_fields[0]>1){ + if (research.power_fields[0] > 1) { forge_cost[i] = 140; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - if (global.chapter_name == "Dark Angels"){ + if (global.chapter_name == "Dark Angels") { i += 1; item[i] = "Mace of Absolution"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 70; - if (research.power_fields[0]>1){ + if (research.power_fields[0] > 1) { forge_cost[i] = 160; } } @@ -214,10 +217,10 @@ if (shop = "equipment") { item[i] = "Lightning Claw"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 90; - if (research.power_fields[0]>1){ + if (research.power_fields[0] > 1) { forge_cost[i] = 150; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -225,65 +228,65 @@ if (shop = "equipment") { item[i] = "Chainfist"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 75; - if (research.power_fields[0]>1 && research.chain[0]>0){ + if (research.power_fields[0] > 1 && research.chain[0] > 0) { forge_cost[i] = 150; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } i += 1; item[i] = "Force Staff"; item_stocked[i] = scr_item_count(item[i]); - if (research.psi[0]>0){ + if (research.psi[0] > 0) { forge_cost[i] = 500; } item_cost[i] = 70; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - i += 1; + i += 1; item[i] = "Force Sword"; item_stocked[i] = scr_item_count(item[i]); - if (research.psi[0]>0){ + if (research.psi[0] > 0) { forge_cost[i] = 400; } item_cost[i] = 55; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - i += 1; + i += 1; item[i] = "Force Axe"; item_stocked[i] = scr_item_count(item[i]); - if (research.psi[0]>0){ + if (research.psi[0] > 0) { forge_cost[i] = 450; } item_cost[i] = 60; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } i += 1; item[i] = "Thunder Hammer"; - if (research.power_fields[0]>1){ + if (research.power_fields[0] > 1) { forge_cost[i] = 500; - } + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 90; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } i += 1; item[i] = "Heavy Thunder Hammer"; - if (research.power_fields[0]>1){ + if (research.power_fields[0] > 1) { forge_cost[i] = 750; - } + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 135; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -304,10 +307,10 @@ if (shop = "equipment") { item[i] = "Storm Shield"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 50; - if (research.power_fields[0]>1){ + if (research.power_fields[0] > 1) { forge_cost[i] = 500; - } - if (rene = 1) { + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -318,12 +321,11 @@ if (shop = "equipment") { nobuy[i] = 1; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 0; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - i += 1; item[i] = "Bolt Pistol"; item_stocked[i] = scr_item_count(item[i]); @@ -338,15 +340,17 @@ if (shop = "equipment") { item[i] = "Stalker Pattern Bolter"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 80; - forge_cost[i] = 230; + forge_cost[i] = 230; i += 1; x_mod[i] = 9; item[i] = "Combiflamer"; item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 200; - if (research.bolt[0]<1 || research.flame[0]<1) then forge_cost[i] = 0; + if (research.bolt[0] < 1 || research.flame[0] < 1) { + forge_cost[i] = 0; + } item_cost[i] = 35; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -355,9 +359,11 @@ if (shop = "equipment") { item[i] = "Combiplasma"; item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 450; - if (research.bolt[0]<1 || research.plasma[0]<1) then forge_cost[i] = 0; + if (research.bolt[0] < 1 || research.plasma[0] < 1) { + forge_cost[i] = 0; + } item_cost[i] = 110; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -366,9 +372,11 @@ if (shop = "equipment") { item[i] = "Combimelta"; item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 350; - if (research.bolt[0]<1 || research.melta[0]<1) then forge_cost[i] = 0; + if (research.bolt[0] < 1 || research.melta[0] < 1) { + forge_cost[i] = 0; + } item_cost[i] = 40; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -377,9 +385,11 @@ if (shop = "equipment") { item[i] = "Combigrav"; item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 450; - if (research.bolt[0]<1 || research.grav[0]<1) then forge_cost[i] = 0; + if (research.bolt[0] < 1 || research.grav[0] < 1) { + forge_cost[i] = 0; + } item_cost[i] = 110; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -387,8 +397,10 @@ if (shop = "equipment") { item[i] = "Heavy Bolter"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 50; - if (research.bolt[0]>=2) then forge_cost[i] = 300; - if (rene = 1) { + if (research.bolt[0] >= 2) { + forge_cost[i] = 300; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -396,36 +408,46 @@ if (shop = "equipment") { item[i] = "Storm Bolter"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 50; - if (research.bolt[0]>=2) then forge_cost[i] = 300; - if (rene = 1) { + if (research.bolt[0] >= 2) { + forge_cost[i] = 300; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - i += 1; + i += 1; item[i] = "Infernus Pistol"; forge_cost[i] = 100; - if (research.flame[0]<1) then forge_cost[i] = 0; + if (research.flame[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 12; i += 1; item[i] = "Hand Flamer"; forge_cost[i] = 75; - if (research.flame[0]<1) then forge_cost[i] = 0; + if (research.flame[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 12; i += 1; item[i] = "Flamer"; forge_cost[i] = 150; - if (research.flame[0]<1) then forge_cost[i] = 0; + if (research.flame[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 25; i += 1; item[i] = "Heavy Flamer"; forge_cost[i] = 350; - if (research.flame[0]<1) then forge_cost[i] = 0; + if (research.flame[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 40; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -434,8 +456,10 @@ if (shop = "equipment") { item[i] = "Incinerator"; item_stocked[i] = scr_item_count(item[i]); nobuy[i] = 1; - forge_cost[i] = 350; - if (research.flame[0]<1) then forge_cost[i] = 0; + forge_cost[i] = 350; + if (research.flame[0] < 1) { + forge_cost[i] = 0; + } // i += 1; // item[i] = "Integrated Bolter"; // item_stocked[i] = scr_item_count(item[i]); @@ -443,76 +467,92 @@ if (shop = "equipment") { i += 1; item[i] = "Meltagun"; forge_cost[i] = 250; - if (research.melta[0]<1) then forge_cost[i] = 0; + if (research.melta[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 30; i += 1; item[i] = "Multi-Melta"; forge_cost[i] = 350; - if (research.melta[0]<1) then forge_cost[i] = 0; + if (research.melta[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 60; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } i += 1; item[i] = "Plasma Pistol"; forge_cost[i] = 250; - if (research.plasma[0]<1) then forge_cost[i] = 0; + if (research.plasma[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 60; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } i += 1; item[i] = "Plasma Gun"; forge_cost[i] = 350; - if (research.plasma[0]<1) then forge_cost[i] = 0; + if (research.plasma[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 100; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } i += 1; item[i] = "Plasma Cannon"; forge_cost[i] = 600; - if (research.plasma[0]<1) then forge_cost[i] = 0; + if (research.plasma[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 300; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } i += 1; item[i] = "Grav-Pistol"; forge_cost[i] = 250; - if (research.grav[0]<1) then forge_cost[i] = 0; + if (research.grav[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 60; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } i += 1; item[i] = "Grav-Gun"; forge_cost[i] = 350; - if (research.grav[0]<1) then forge_cost[i] = 0; + if (research.grav[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 100; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } i += 1; item[i] = "Grav-Cannon"; forge_cost[i] = 600; - if (research.grav[0]<1) then forge_cost[i] = 0; + if (research.grav[0] < 1) { + forge_cost[i] = 0; + } item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 300; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -545,204 +585,204 @@ if (shop = "equipment") { item[i] = "Lascannon"; item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 500; - if (research.las[0]<1) then forge_cost[i] = 0; + if (research.las[0] < 1) { + forge_cost[i] = 0; + } item_cost[i] = 70; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - i += 1; - //Debug space for 30k weapons - //Volkite Pack - item[i] = "Volkite Serpenta"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - nobuy[i] = 1; - i += 1; - nobuy[i] = 1; - item[i] = "Volkite Charger"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Volkite Caliver"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] ="Volkite Culverin"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - //Bolt Pack - item[i] = "Phobos Bolt Pistol"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Phobos Bolter"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Mars Heavy Bolter"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Tigris Combi Bolter"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - //Plasma Pack - item[i] = "Ryza Plasma Gun"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Ryza Plasma Pistol"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Mars Plasma Cannon"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Primus Melta Gun"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Proteus Multi-Melta"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Phaestos Flamer"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Power Scythe"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Ryza Lascannon"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i] = 1; - item[i] = "Cthon Autocannon"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - item[i] = "Contemptor Dreadnought"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - nobuy[i]=1 - i += 1; - nobuy[i]=1; - item[i] = "Twin-linked Volkite Culverins"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - i += 1; - nobuy[i]=1; - item[i] = "Contemptor CCW"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - nobuy[i]=1; - i += 1; - item[i] = "Heavy Conversion Beamer"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - nobuy[i]=1; - i += 1; - item[i] = "Kheres Assault Cannon"; - item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 0; - forge_cost[i] = 0; - nobuy[i]=1; - i += 1; - - + i += 1; + //Debug space for 30k weapons + //Volkite Pack + item[i] = "Volkite Serpenta"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + nobuy[i] = 1; + i += 1; + nobuy[i] = 1; + item[i] = "Volkite Charger"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Volkite Caliver"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Volkite Culverin"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + //Bolt Pack + item[i] = "Phobos Bolt Pistol"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Phobos Bolter"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Mars Heavy Bolter"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Tigris Combi Bolter"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + //Plasma Pack + item[i] = "Ryza Plasma Gun"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Ryza Plasma Pistol"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Mars Plasma Cannon"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Primus Melta Gun"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Proteus Multi-Melta"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Phaestos Flamer"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Power Scythe"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Ryza Lascannon"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Cthon Autocannon"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + item[i] = "Contemptor Dreadnought"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + nobuy[i] = 1; + i += 1; + nobuy[i] = 1; + item[i] = "Twin-linked Volkite Culverins"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + i += 1; + nobuy[i] = 1; + item[i] = "Contemptor CCW"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + nobuy[i] = 1; + i += 1; + item[i] = "Heavy Conversion Beamer"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + nobuy[i] = 1; + i += 1; + item[i] = "Kheres Assault Cannon"; + item_stocked[i] = scr_item_count(item[i]); + item_cost[i] = 0; + forge_cost[i] = 0; + nobuy[i] = 1; + i += 1; + var mc = 0; - repeat(i) { + repeat (i) { mc++; - if (item[mc] != ""){ + if (item[mc] != "") { mc_stocked[mc] = scr_item_count(item[mc], "master_crafted"); } } } -if (shop = "equipment2") { +if (shop == "equipment2") { i = 0; i += 1; item[i] = "MK3 Iron Armour"; item_stocked[i] = scr_item_count("MK3 Iron Armour"); nobuy[i] = 1; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - if (obj_controller.in_forge){ - if (research.armour[1].armour[0]>2){ + if (obj_controller.in_forge) { + if (research.armour[1].armour[0] > 2) { forge_cost[i] = 1250; } else { tooltip_overide[i] = "requires : #"; - for (var r = research.armour[1].armour[0]; r < 3;r++){ + for (var r = research.armour[1].armour[0]; r < 3; r++) { tooltip_overide[i] += $" {research_pathways.armour[1].armour[0][r]}#"; } - } + } } i += 1; var mk_4_able = false; - var mk_4_tool_tip = "" + var mk_4_tool_tip = ""; item[i] = "MK4 Maximus"; item_stocked[i] = scr_item_count("MK4 Maximus"); - if (obj_controller.in_forge){ - if (research.armour[1].stealth[0] >0 && research.armour[1].armour[0] >1){ + if (obj_controller.in_forge) { + if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1) { forge_cost[i] = 1250; - mk_4_able=true; + mk_4_able = true; } else { tooltip_overide[i] = "requires : #"; - if (research.armour[1].stealth[0] < 1){ + if (research.armour[1].stealth[0] < 1) { tooltip_overide[i] += $" {research_pathways.armour[1].stealth[0][0]}#"; - for (var r = research.armour[1].armour[0]; r < 2;r++){ + for (var r = research.armour[1].armour[0]; r < 2; r++) { tooltip_overide[i] += $" {research_pathways.armour[1].armour[0][r]}#"; } } mk_4_tool_tip = tooltip_overide[i]; } - } nobuy[i] = 1; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -750,7 +790,7 @@ if (shop = "equipment2") { item[i] = "MK5 Heresy"; item_stocked[i] = scr_item_count("MK5 Heresy"); item_cost[i] = 45; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -758,16 +798,16 @@ if (shop = "equipment2") { item[i] = "MK6 Corvus"; item_stocked[i] = scr_item_count("MK6 Corvus"); item_cost[i] = 35; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - if (obj_controller.in_forge){ - if (research.armour[1].stealth[0] > 0){ + if (obj_controller.in_forge) { + if (research.armour[1].stealth[0] > 0) { forge_cost[i] = 1400; } else { tooltip_overide[i] = "requires : #"; - if (research.armour[1].stealth[0] < 1){ + if (research.armour[1].stealth[0] < 1) { tooltip_overide[i] += $" {research_pathways.armour[1].stealth[0][0]}#"; } } @@ -777,16 +817,16 @@ if (shop = "equipment2") { item[i] = "MK7 Aquila"; item_stocked[i] = scr_item_count("MK7 Aquila"); item_cost[i] = 20; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - if (obj_controller.in_forge){ - if (research.armour[0] > 0){ + if (obj_controller.in_forge) { + if (research.armour[0] > 0) { forge_cost[i] = 1000; } else { tooltip_overide[i] = "requires : #"; - if (research.armour[0] < 1){ + if (research.armour[0] < 1) { tooltip_overide[i] += $" {research_pathways.armour[0][0]}#"; } } @@ -796,22 +836,22 @@ if (shop = "equipment2") { item[i] = "MK8 Errant"; item_stocked[i] = scr_item_count("MK8 Errant"); nobuy[i] = 1; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - if (obj_controller.in_forge){ - if (research.armour[0] > 1){ + if (obj_controller.in_forge) { + if (research.armour[0] > 1) { forge_cost[i] = 1000; } else { tooltip_overide[i] = "requires : #"; - if (research.armour[0] < 2 && mk_4_able){ + if (research.armour[0] < 2 && mk_4_able) { tooltip_overide[i] += $" {research_pathways.armour[0][1]}#"; } else { - tooltip_overide[i] = mk_4_tool_tip; + tooltip_overide[i] = mk_4_tool_tip; } } - } + } i += 1; item[i] = "Scout Armour"; item_stocked[i] = scr_item_count(item[i]); @@ -821,58 +861,57 @@ if (shop = "equipment2") { item[i] = "Artificer Armour"; item_stocked[i] = scr_item_count("Artificer Armour"); nobuy[i] = 1; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } -if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1) { - forge_cost[i] = 1500; -} else { - tooltip_overide[i] = "requires : \n"; - if (research.armour[1].stealth[0] < 1) { - tooltip_overide[i] += $" {research_pathways.armour[1].stealth[0][0]}\n"; - for (var r = research.armour[1].armour[0]; r < 2; r++) { - tooltip_overide[i] += $" {research_pathways.armour[1].armour[0][r]}\n"; + if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1) { + forge_cost[i] = 1500; + } else { + tooltip_overide[i] = "requires : \n"; + if (research.armour[1].stealth[0] < 1) { + tooltip_overide[i] += $" {research_pathways.armour[1].stealth[0][0]}\n"; + for (var r = research.armour[1].armour[0]; r < 2; r++) { + tooltip_overide[i] += $" {research_pathways.armour[1].armour[0][r]}\n"; + } } + mk_4_tool_tip = tooltip_overide[i]; } - mk_4_tool_tip = tooltip_overide[i]; - -} i += 1; item[i] = "Terminator Armour"; item_stocked[i] = scr_item_count("Terminator Armour"); nobuy[i] = 1; -if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj_controller.stc_wargear >= 6) { - forge_cost[i] = 2000; -} else { - tooltip_overide[i] = "requires : \n"; - if (research.armour[1].stealth[0] < 1) { - tooltip_overide[i] += $" {research_pathways.armour[1].stealth[0][0]}\n"; - for (var r = research.armour[1].armour[0]; r < 2; r++) { - tooltip_overide[i] += $" {research_pathways.armour[1].armour[0][r]}\n"; + if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj_controller.stc_wargear >= 6) { + forge_cost[i] = 2000; + } else { + tooltip_overide[i] = "requires : \n"; + if (research.armour[1].stealth[0] < 1) { + tooltip_overide[i] += $" {research_pathways.armour[1].stealth[0][0]}\n"; + for (var r = research.armour[1].armour[0]; r < 2; r++) { + tooltip_overide[i] += $" {research_pathways.armour[1].armour[0][r]}\n"; + } } + mk_4_tool_tip = tooltip_overide[i]; + tooltip_overide[i] += $"STC wargear component 6"; } - mk_4_tool_tip = tooltip_overide[i]; - tooltip_overide[i] += $"STC wargear component 6"; -} - // if (rene=1){nobuy[i]=1;item_cost[i]=0;} -i += 1; -item[i] = "Tartaros"; -item_stocked[i] = scr_item_count("Tartaros"); -nobuy[i] = 1; -if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj_controller.stc_wargear >= 6) { - forge_cost[i] = 2500; -} else { - tooltip_overide[i] = "requires : \n"; - if (research.armour[1].stealth[0] < 1) { - tooltip_overide[i] += $" {research_pathways.armour[1].stealth[0][0]}\n"; - for (var r = research.armour[1].armour[0]; r < 2; r++) { - tooltip_overide[i] += $" {research_pathways.armour[1].armour[0][r]}\n"; + // if (rene=1){nobuy[i]=1;item_cost[i]=0;} + i += 1; + item[i] = "Tartaros"; + item_stocked[i] = scr_item_count("Tartaros"); + nobuy[i] = 1; + if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj_controller.stc_wargear >= 6) { + forge_cost[i] = 2500; + } else { + tooltip_overide[i] = "requires : \n"; + if (research.armour[1].stealth[0] < 1) { + tooltip_overide[i] += $" {research_pathways.armour[1].stealth[0][0]}\n"; + for (var r = research.armour[1].armour[0]; r < 2; r++) { + tooltip_overide[i] += $" {research_pathways.armour[1].armour[0][r]}\n"; + } } + mk_4_tool_tip = tooltip_overide[i]; + tooltip_overide[i] += $"STC wargear component 6"; } - mk_4_tool_tip = tooltip_overide[i]; - tooltip_overide[i] += $"STC wargear component 6"; -} i += 1; item[i] = "Cataphractii"; item_stocked[i] = scr_item_count("Cataphractii"); @@ -884,7 +923,7 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 250; item_cost[i] = 20; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -892,7 +931,7 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj i += 1; x_mod[i] = 9; nobuy[i] = 1; - item[i] = "Serpha Jump Pack"; + item[i] = "Serpha Jump Pack"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 0; forge_cost[i] = 0; @@ -902,8 +941,8 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Heavy Weapons Pack"; item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 250; - item_cost[i] = 25; - if (rene = 1) { + item_cost[i] = 25; + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -914,10 +953,10 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 1500; item_cost[i] = 150; - if (obj_controller.stc_wargear >= 6) { - forge_cost[i] = 400; + if (obj_controller.stc_wargear >= 6) { + forge_cost[i] = 400; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -927,8 +966,10 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Conversion Beamer Pack"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 180; - if (research.grav[0]>=1 && research.flame[0]>=1 && research.las[0]>=1 && research.plasma[0]>=1 ) then forge_cost[i] = 450; - if (rene = 1) { + if (research.grav[0] >= 1 && research.flame[0] >= 1 && research.las[0] >= 1 && research.plasma[0] >= 1) { + forge_cost[i] = 450; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -939,8 +980,8 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 750; item_cost[i] = 30; - forge_cost[i] = 150; - if (rene = 1) { + forge_cost[i] = 150; + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -957,7 +998,7 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 500; item_cost[i] = 10; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -967,7 +1008,7 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 1000; item_cost[i] = 100; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -983,7 +1024,7 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 1500; item_cost[i] = 100; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -993,7 +1034,7 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item_stocked[i] = scr_item_count(item[i]); forge_cost[i] = 2000; item_cost[i] = 300; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1015,37 +1056,36 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Gene Pod Incubator"; item_stocked[i] = scr_item_count(item[i]); nobuy[i] = 1; - item_cost[i] = 0; - forge_cost[i] = 80; + item_cost[i] = 0; + forge_cost[i] = 80; - mc=0; - repeat(i) { + mc = 0; + repeat (i) { mc += 1; - if (item[mc] != ""){ + if (item[mc] != "") { mc_stocked[i] = scr_item_count(item[mc], "master_crafted"); } - } - + } } -var player_hanger = min(array_length(obj_controller.player_forge_data.vehicle_hanger),1); -if (shop = "vehicles") { +var player_hanger = min(array_length(obj_controller.player_forge_data.vehicle_hanger), 1); +if (shop == "vehicles") { i = 0; i += 1; item[i] = "Rhino"; item_stocked[i] = scr_vehicle_count(item[i], ""); - forge_cost[i] = 1500*player_hanger; + forge_cost[i] = 1500 * player_hanger; item_cost[i] = 120; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } i += 1; item[i] = "Predator"; item_stocked[i] = scr_vehicle_count(item[i], ""); - forge_cost[i] = 3000*player_hanger; + forge_cost[i] = 3000 * player_hanger; item_cost[i] = 240; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1054,8 +1094,10 @@ if (shop = "vehicles") { item[i] = "Autocannon Turret"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 30; - if (research.bolt[0]> 2) then forge_cost[i] = 150*player_hanger; - if (rene = 1) { + if (research.bolt[0] > 2) { + forge_cost[i] = 150 * player_hanger; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1064,8 +1106,10 @@ if (shop = "vehicles") { item[i] = "Twin Linked Lascannon Turret"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 60; - if (research.las[0]>1) then forge_cost[i] = 400*player_hanger; - if (rene = 1) { + if (research.las[0] > 1) { + forge_cost[i] = 400 * player_hanger; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1074,9 +1118,11 @@ if (shop = "vehicles") { item[i] = "Heavy Bolter Sponsons"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 38; - forge_cost[i] = 100*player_hanger; - if (research.bolt[0]> 2) then forge_cost[i] = 100*player_hanger; - if (rene = 1) { + forge_cost[i] = 100 * player_hanger; + if (research.bolt[0] > 2) { + forge_cost[i] = 100 * player_hanger; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1085,9 +1131,11 @@ if (shop = "vehicles") { item[i] = "Heavy Flamer Sponsons"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 50; - forge_cost[i] = 150*player_hanger; - if (research.flame[0]<1) then forge_cost[i] = 0; - if (rene = 1) { + forge_cost[i] = 150 * player_hanger; + if (research.flame[0] < 1) { + forge_cost[i] = 0; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1096,8 +1144,10 @@ if (shop = "vehicles") { item[i] = "Lascannon Sponsons"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 60; - if (research.las[0]>1) then forge_cost[i] = 300; - if (rene = 1) { + if (research.las[0] > 1) { + forge_cost[i] = 300; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1108,19 +1158,21 @@ if (shop = "vehicles") { if (obj_controller.stc_vehicles >= 6) { nobuy[i] = 0; item_cost[i] = 500; - forge_cost[i] = 4500*player_hanger; + forge_cost[i] = 4500 * player_hanger; } - if (rene=1) { - nobuy[i]=1; - item_cost[i]=0; + if (rene == 1) { + nobuy[i] = 1; + item_cost[i] = 0; } i += 1; x_mod[i] = 9; item[i] = "Twin Linked Heavy Bolter Mount"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 28; - if (research.bolt[0]> 2) then forge_cost[i] = 250*player_hanger; - if (rene = 1) { + if (research.bolt[0] > 2) { + forge_cost[i] = 250 * player_hanger; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1129,8 +1181,10 @@ if (shop = "vehicles") { item[i] = "Quad Linked Heavy Bolter Sponsons"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 60; - if (research.bolt[0]> 3) then forge_cost[i] = 350*player_hanger; - if (rene = 1) { + if (research.bolt[0] > 3) { + forge_cost[i] = 350 * player_hanger; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1139,8 +1193,10 @@ if (shop = "vehicles") { item[i] = "Twin Linked Assault Cannon Mount"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 60; - if (research.bolt[0]> 3) then forge_cost[i] = 400*player_hanger; - if (rene = 1) { + if (research.bolt[0] > 3) { + forge_cost[i] = 400 * player_hanger; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1149,9 +1205,11 @@ if (shop = "vehicles") { item[i] = "Flamestorm Cannon Sponsons"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 100; - forge_cost[i] = 300*player_hanger; - if (research.flame[0]<1) then forge_cost[i] = 0; - if (rene = 1) { + forge_cost[i] = 300 * player_hanger; + if (research.flame[0] < 1) { + forge_cost[i] = 0; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1160,8 +1218,10 @@ if (shop = "vehicles") { item[i] = "Hurricane Bolter Sponsons"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 70; - if (research.bolt[0]> 3) then forge_cost[i] = 300*player_hanger; - if (rene = 1) { + if (research.bolt[0] > 3) { + forge_cost[i] = 300 * player_hanger; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1170,8 +1230,10 @@ if (shop = "vehicles") { item[i] = "Twin Linked Lascannon Sponsons"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 120; - if (research.las[0]>1) then forge_cost[i] = 250*player_hanger; - if (rene = 1) { + if (research.las[0] > 1) { + forge_cost[i] = 250 * player_hanger; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1179,8 +1241,8 @@ if (shop = "vehicles") { item[i] = "Whirlwind"; item_stocked[i] = scr_vehicle_count(item[i], ""); item_cost[i] = 180; - forge_cost[i] = 2000*player_hanger; - if (rene = 1) { + forge_cost[i] = 2000 * player_hanger; + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1189,8 +1251,8 @@ if (shop = "vehicles") { item[i] = "HK Missile"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 10; - forge_cost[i] = 250*player_hanger; - if (rene = 1) { + forge_cost[i] = 250 * player_hanger; + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1198,46 +1260,48 @@ if (shop = "vehicles") { item[i] = "Land Speeder"; item_stocked[i] = scr_vehicle_count(item[i], ""); nobuy[i] = 1; - if (obj_controller.stc_vehicles >= 6) { - nobuy[i] = 0; - item_cost[i] = 120; - forge_cost[i] = 700*player_hanger; + if (obj_controller.stc_vehicles >= 6) { + nobuy[i] = 0; + item_cost[i] = 120; + forge_cost[i] = 700 * player_hanger; } i += 1; x_mod[i] = 9; item[i] = "Twin Linked Bolters"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 8; - if (research.bolt[0]>= 2) then forge_cost[i] = 150*player_hanger; + if (research.bolt[0] >= 2) { + forge_cost[i] = 150 * player_hanger; + } i += 1; item[i] = "Bike"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 35; - forge_cost[i] = 150*player_hanger; + forge_cost[i] = 150 * player_hanger; i += 1; item[i] = "Dreadnought"; item_stocked[i] = scr_item_count(item[i]); nobuy[i] = 1; // if (rene=1){nobuy[i]=1;item_cost[i]=0;} -if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj_controller.stc_wargear >= 6) { - forge_cost[i] = 3000; -} else { - tooltip_overide[i] = "requires : \n"; - if (research.armour[1].stealth[0] < 1) { - tooltip_overide[i] += $" {research_pathways.armour[1].stealth[0][0]}\n"; - for (var r = research.armour[1].armour[0]; r < 2; r++) { - tooltip_overide[i] += $" {research_pathways.armour[1].armour[0][r]}\n"; + if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj_controller.stc_wargear >= 6) { + forge_cost[i] = 3000; + } else { + tooltip_overide[i] = "requires : \n"; + if (research.armour[1].stealth[0] < 1) { + tooltip_overide[i] += $" {research_pathways.armour[1].stealth[0][0]}\n"; + for (var r = research.armour[1].armour[0]; r < 2; r++) { + tooltip_overide[i] += $" {research_pathways.armour[1].armour[0][r]}\n"; + } } + mk_4_tool_tip = tooltip_overide[i]; + tooltip_overide[i] += $"STC wargear component 6"; } - mk_4_tool_tip = tooltip_overide[i]; - tooltip_overide[i] += $"STC wargear component 6"; -} i += 1; x_mod[i] = 9; item[i] = "Close Combat Weapon"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 45; - forge_cost[i] = 200*player_hanger; - if (rene = 1) { + forge_cost[i] = 200 * player_hanger; + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1246,8 +1310,10 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Twin Linked Heavy Bolter"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 110; - if (research.bolt[0]> 2) then forge_cost[i] = 150*player_hanger; - if (rene = 1) { + if (research.bolt[0] > 2) { + forge_cost[i] = 150 * player_hanger; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1256,8 +1322,10 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Twin Linked Lascannon"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 110; - if (research.las[0]>1) then forge_cost[i] = 150*player_hanger; - if (rene = 1) { + if (research.las[0] > 1) { + forge_cost[i] = 150 * player_hanger; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1266,8 +1334,10 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Autocannon"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 80; - if (research.bolt[0]> 2) then forge_cost[i] = 150; - if (rene = 1) { + if (research.bolt[0] > 2) { + forge_cost[i] = 150; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1276,8 +1346,8 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Inferno Cannon"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 115; - forge_cost[i] = 250*player_hanger; - if (rene = 1) { + forge_cost[i] = 250 * player_hanger; + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1286,8 +1356,8 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Dreadnought Lightning Claw"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 185; - forge_cost[i] = 250*player_hanger; - if (rene = 1) { + forge_cost[i] = 250 * player_hanger; + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1296,8 +1366,10 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Assault Cannon"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 75; - if (research.bolt[0]> 2) then forge_cost[i] = 350; - if (rene = 1) { + if (research.bolt[0] > 2) { + forge_cost[i] = 350; + } + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1306,8 +1378,8 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Dreadnought Power Claw"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 150; - forge_cost[i] = 200*player_hanger; - if (rene = 1) { + forge_cost[i] = 200 * player_hanger; + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1316,8 +1388,8 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Whirlwind Missiles"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 90; - forge_cost[i] = 250*player_hanger; - if (rene = 1) { + forge_cost[i] = 250 * player_hanger; + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1325,101 +1397,101 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj x_mod[i] = 9; item[i] = "Heavy Conversion Beam Projector"; item_stocked[i] = scr_item_count(item[i]); - forge_cost[i] = 350*player_hanger; - nobuy[i] = 1; - if (rene = 1) { + forge_cost[i] = 350 * player_hanger; + nobuy[i] = 1; + if (rene == 1) { item_cost[i] = 0; } - i += 1; + i += 1; x_mod[i] = 9; item[i] = "Plasma Destroyer Turret"; item_stocked[i] = scr_item_count(item[i]); - forge_cost[i] = 400*player_hanger; - nobuy[i] = 1; - if (rene = 1) { + forge_cost[i] = 400 * player_hanger; + nobuy[i] = 1; + if (rene == 1) { item_cost[i] = 0; } i += 1; x_mod[i] = 9; item[i] = "Flamestorm Cannon Turret"; item_stocked[i] = scr_item_count(item[i]); - forge_cost[i] = 400*player_hanger; - nobuy[i] = 1; - if (rene = 1) { + forge_cost[i] = 400 * player_hanger; + nobuy[i] = 1; + if (rene == 1) { item_cost[i] = 0; } - i += 1; + i += 1; x_mod[i] = 9; item[i] = "Magna-Melta Turret"; item_stocked[i] = scr_item_count(item[i]); - forge_cost[i] = 400*player_hanger; - nobuy[i] = 1; - if (rene = 1) { + forge_cost[i] = 400 * player_hanger; + nobuy[i] = 1; + if (rene == 1) { item_cost[i] = 0; } - i += 1; + i += 1; x_mod[i] = 9; item[i] = "Neutron Blaster Turret"; item_stocked[i] = scr_item_count(item[i]); - forge_cost[i] = 450*player_hanger; - nobuy[i] = 1; - if (rene = 1) { + forge_cost[i] = 450 * player_hanger; + nobuy[i] = 1; + if (rene == 1) { item_cost[i] = 0; } - i += 1; + i += 1; x_mod[i] = 9; item[i] = "Volkite Saker Turret"; item_stocked[i] = scr_item_count(item[i]); - forge_cost[i] = 400*player_hanger; - nobuy[i] = 1; - if (rene = 1) { + forge_cost[i] = 400 * player_hanger; + nobuy[i] = 1; + if (rene == 1) { item_cost[i] = 0; } - i += 1; + i += 1; x_mod[i] = 9; item[i] = "Volkite Culverin Sponsons"; item_stocked[i] = scr_item_count(item[i]); - forge_cost[i] = 350*player_hanger; - nobuy[i] = 1; - if (rene = 1) { + forge_cost[i] = 350 * player_hanger; + nobuy[i] = 1; + if (rene == 1) { item_cost[i] = 0; } - i += 1; + i += 1; x_mod[i] = 9; item[i] = "Twin Linked Volkite Culverin Sponsons"; item_stocked[i] = scr_item_count(item[i]); - forge_cost[i] = 400*player_hanger; - nobuy[i] = 1; - if (rene = 1) { + forge_cost[i] = 400 * player_hanger; + nobuy[i] = 1; + if (rene == 1) { item_cost[i] = 0; } - i += 1; + i += 1; x_mod[i] = 9; item[i] = "Twin Linked Multi-Melta Sponsons"; item_stocked[i] = scr_item_count(item[i]); - item_cost[i] = 200; - forge_cost[i] = 200*player_hanger; - if (rene = 1) { + item_cost[i] = 200; + forge_cost[i] = 200 * player_hanger; + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - i += 1; + i += 1; x_mod[i] = 9; item[i] = "Twin Linked Heavy Flamer Sponsons"; item_stocked[i] = scr_item_count(item[i]); - forge_cost[i] = 200*player_hanger; - item_cost[i] = 150; - if (rene = 1) { + forge_cost[i] = 200 * player_hanger; + item_cost[i] = 150; + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } - i += 1; + i += 1; x_mod[i] = 9; item[i] = "Reaper Autocannon Mount"; item_stocked[i] = scr_item_count(item[i]); - forge_cost[i] = 250*player_hanger; - nobuy[i] = 1; - if (rene = 1) { + forge_cost[i] = 250 * player_hanger; + nobuy[i] = 1; + if (rene == 1) { item_cost[i] = 0; } i += 1; @@ -1430,9 +1502,9 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj if (obj_controller.stc_vehicles >= 6) { nobuy[i] = 0; item_cost[i] = 500; - forge_cost[i] = 2000*player_hanger; + forge_cost[i] = 2000 * player_hanger; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1444,9 +1516,9 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj if (obj_controller.stc_vehicles >= 6) { nobuy[i] = 0; item_cost[i] = 90; - forge_cost[i] = 1250*player_hanger; + forge_cost[i] = 1250 * player_hanger; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1458,9 +1530,9 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj if (obj_controller.stc_vehicles >= 3) { nobuy[i] = 0; item_cost[i] = 200; - forge_cost[i] = 1000*player_hanger; + forge_cost[i] = 1000 * player_hanger; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1469,11 +1541,11 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Armoured Ceramite"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 120; - if (obj_controller.stc_vehicles >= 3) { + if (obj_controller.stc_vehicles >= 3) { item_cost[i] = 200; - forge_cost[i] = 500*player_hanger; + forge_cost[i] = 500 * player_hanger; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1482,11 +1554,11 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Heavy Armour"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 50; - if (obj_controller.stc_vehicles >= 3) { + if (obj_controller.stc_vehicles >= 3) { item_cost[i] = 200; - forge_cost[i] = 250*player_hanger; + forge_cost[i] = 250 * player_hanger; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1495,11 +1567,11 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Smoke Launchers"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 10; - if (obj_controller.stc_vehicles >= 3) { + if (obj_controller.stc_vehicles >= 3) { item_cost[i] = 200; - forge_cost[i] = 250*player_hanger; + forge_cost[i] = 250 * player_hanger; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1508,11 +1580,11 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Dozer Blades"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 10; - if (obj_controller.stc_vehicles >= 3) { + if (obj_controller.stc_vehicles >= 3) { item_cost[i] = 200; - forge_cost[i] = 200*player_hanger; + forge_cost[i] = 200 * player_hanger; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1521,11 +1593,11 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Searchlight"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 15; - if (obj_controller.stc_vehicles >= 3) { + if (obj_controller.stc_vehicles >= 3) { item_cost[i] = 200; - forge_cost[i] = 250*player_hanger; + forge_cost[i] = 250 * player_hanger; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1534,22 +1606,22 @@ if (research.armour[1].stealth[0] > 0 && research.armour[1].armour[0] > 1 && obj item[i] = "Frag Assault Launchers"; item_stocked[i] = scr_item_count(item[i]); item_cost[i] = 30; - if (obj_controller.stc_vehicles >= 3) { + if (obj_controller.stc_vehicles >= 3) { item_cost[i] = 200; - forge_cost[i] = 250*player_hanger; + forge_cost[i] = 250 * player_hanger; } - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } } -if (shop = "warships") { +if (shop == "warships") { i = 0; i += 1; item[i] = "Battle Barge"; item_stocked[i] = scr_ship_count(item[i]); item_cost[i] = 20000; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1557,7 +1629,7 @@ if (shop = "warships") { item[i] = "Strike Cruiser"; item_stocked[i] = scr_ship_count(item[i]); item_cost[i] = 8000; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1565,7 +1637,7 @@ if (shop = "warships") { item[i] = "Gladius"; item_stocked[i] = scr_ship_count(item[i]); item_cost[i] = 2250; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1573,7 +1645,7 @@ if (shop = "warships") { item[i] = "Hunter"; item_stocked[i] = scr_ship_count(item[i]); item_cost[i] = 3000; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } @@ -1582,234 +1654,263 @@ if (shop = "warships") { item[i] = "Cyclonic Torpedo"; item_stocked[i] = scr_item_count(item[i]); nobuy[i] = 1; - if (rene = 1) { + if (rene == 1) { nobuy[i] = 1; item_cost[i] = 0; } } - - -with(obj_p_fleet) { - if (capital_number > 0) and(action = "") { +with (obj_p_fleet) { + if ((capital_number > 0) && (action == "")) { var you; you = instance_nearest(x, y, obj_star); - if (you.trader > 0) then obj_shop.discount = 1; + if (you.trader > 0) { + obj_shop.discount = 1; + } } } -with(obj_star) { - if (array_contains(p_owner, 1)) and(trader > 0) then obj_shop.discount = 1; +with (obj_star) { + if (array_contains(p_owner, 1) && (trader > 0)) { + obj_shop.discount = 1; + } } - -if (shop = "equipment") or(shop = "equipment2") { +if ((shop == "equipment") || (shop == "equipment2")) { var disc; disc = 1; - if (obj_controller.stc_wargear >= 1) then disc = 0.92; - if (obj_controller.stc_wargear >= 3) then disc = 0.86; - if (obj_controller.stc_wargear >= 5) then disc = 0.75; + if (obj_controller.stc_wargear >= 1) { + disc = 0.92; + } + if (obj_controller.stc_wargear >= 3) { + disc = 0.86; + } + if (obj_controller.stc_wargear >= 5) { + disc = 0.75; + } var mc = 0; - repeat(i) { + repeat (i) { mc++; - if (forge_cost[mc] > 1) then forge_cost[mc] = round(forge_cost[mc] * disc); + if (forge_cost[mc] > 1) { + forge_cost[mc] = round(forge_cost[mc] * disc); + } } } -if (shop = "vehicles") { +if (shop == "vehicles") { var disc; disc = 1; - if (obj_controller.stc_vehicles >= 1) then disc = 0.92; - if (obj_controller.stc_vehicles >= 3) then disc = 0.86; - if (obj_controller.stc_vehicles >= 5) then disc = 0.75; - var mc = 0; - repeat(31) { + if (obj_controller.stc_vehicles >= 1) { + disc = 0.92; + } + if (obj_controller.stc_vehicles >= 3) { + disc = 0.86; + } + if (obj_controller.stc_vehicles >= 5) { + disc = 0.75; + } + var mc = 0; + repeat (31) { mc += 1; var ahuh; ahuh = 1; - if (mc >= 7) and(mc <= 12) then ahuh = 0; - if (ahuh = 1) { - if (forge_cost[mc] > 1) then forge_cost[mc] = round(forge_cost[mc] * disc); + if ((mc >= 7) && (mc <= 12)) { + ahuh = 0; + } + if (ahuh == 1) { + if (forge_cost[mc] > 1) { + forge_cost[mc] = round(forge_cost[mc] * disc); + } } } } -if (shop == "production"){ +if (shop == "production") { i = 0; var research_item; - if (research.flame[0] == 0){ + if (research.flame[0] == 0) { i++; item[i] = ["research", research_pathways.flame[0][research.flame[0]], ["flame"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research grants the ability to fabricate and harness Promethium Tanks, allowing for the construction of flame-based weaponry. This technology taps into the potent destructive potential of Promethium, turning it into a terrifying tool of war, capable of reducing enemies to ash.\nUnlocks: Flamers, Heavy Flamers, Incinerator.\nRequired for: Heavy Flamer Sponsons, Flamestorm Cannon Sponsons, Inferno Cannon, Servo-harness, Combi-flamer."; - } - if (research.psi[0] == 0){ + if (research.psi[0] == 0) { i++; item[i] = ["research", research_pathways.psi[0][research.psi[0]], ["psi"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research unlocks the arcane art of crafting Force Weapons, allowing our trained psykers to channel the raw, untamed power of the Warp into tangible forms. It transforms ordinary melee implements into conduits of psychic fury, each blow imbued with devastating energy This grants our psykers the ability to strike down the mightiest foes, turning the tide of battle with the very power of the immaterium.\n\nUnlocks: Force Staff, Force Sword, Force Axe."; } - if (research.las[0] == 0){ + if (research.las[0] == 0) { i++; item[i] = ["research", research_pathways.las[0][research.las[0]], ["las"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research unveils the secrets of advanced Las Weaponry, a testament to the Imperium's mastery of directed energy. It allows the construction of more potent and reliable las weapons, each pulse of light capable of searing through armor and flesh alike. This empowers our forces with vastly enhanced range, penetration, and damage, ensuring the Emperor's light shines brighter against the encroaching darkness.\n\nUnlocks: Lascannon.\nRequired for: Twin Linked Lascannon Turret, Twin Linked Lascannon Sponsons, Twin Linked Lascannon."; - } - if (research.chain[0] == 0){ + } + if (research.chain[0] == 0) { i++; item[i] = ["research", research_pathways.chain[0][research.chain[0]], ["chain"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research unleashes the technology for Advanced Chain Weaponry, allowing us to produce tools of brutal, unrelenting destruction. It allows for the creation of weapons that tear and rend, leaving nothing but bloody ruin in their wake. Our warriors wield these instruments of carnage to devastating effect, carving through the ranks of our enemies with unstoppable fury. \n\nUnlocks: Eviscerator, Chainfist."; - } - if (research.plasma[0] == 0){ + } + if (research.plasma[0] == 0) { i++; item[i] = ["research", research_pathways.plasma[0][research.plasma[0]], ["plasma"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research delves into the dangerous art of Plasma Weaponry, granting us the means to unleash the raw power of superheated plasma upon the enemy. This volatile technology produces weapons that can inflict devastating wounds, but its very nature demands a careful hand, lest its power consume the wielder. These weapons provide a high damage potential, capable of obliterating even heavily armored foes.\n\nUnlocks: Plasma Pistol, Plasma Gun, Plasma Cannon.\nRequired for: Combiplasma."; } - if (research.bolt[0] == 1){ + if (research.bolt[0] == 1) { i++; - item[i] = ["research",research_pathways.bolt[0][research.bolt[0]], ["bolt"]]; - item_stocked[i] = 0; + item[i] = ["research", research_pathways.bolt[0][research.bolt[0]], ["bolt"]]; + item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research reveals the secrets of Advanced Bolt Weapons, an expansion of the Emperor's favored projectile weapons into more specialized and lethal forms. It is the pinnacle of projectile technology, combining explosive force with devastating impact. This provides our forces with a significant increase in firepower, ensuring that each shot finds its mark and shatters the foe. \n\nUnlocks: Stalker Pattern Bolter, Heavy Bolter, Heavy bolter Sponsons.\nRequired for: Combiflamer, Combiplasma, Combimelta, Combigrav, Assault Cannon, Autocannon Turret, Hurricane Bolter, Quad Linked Heavy Bolter Sponsons, Twin Linked Bolters, Twin Linked Heavy Bolter mount, Twin Linked assault cannon."; } - if (research.bolt[0] == 2){ + if (research.bolt[0] == 2) { i++; - item[i] = ["research","Advanced Weapon Integration and Targeting", ["bolt"]]; - item_stocked[i] = 0; + item[i] = ["research", "Advanced Weapon Integration and Targeting", ["bolt"]]; + item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research unlocks the divine secrets of Advanced Weapon Integration and Targeting, allowing for the creation of systems that connect the chapter’s weaponry with the Astartes in perfect harmony, enhancing their coordination and tactical prowess upon the Emperor's battlefields. It also allows for the construction of the devastating Assault Cannon and the mighty Autocannon for Predator tanks, making them instruments of divine vengeance, ensuring that the enemies of Mankind tremble before their might. This knowledge shall improve the efficiency of standard bolter weaponry, while also unleashing newer and more devastating tools of annihilation. \nUnlocks: Assault Cannon, Autocannon Turret, Twin Linked Heavy Bolter mount, Twin Linked bolter.\nRequired for: Hurricane Bolter, Quad Linked Heavy Bolter Sponsons, Twin linked assault cannon."; } - if (research.bolt[0] == 3){ + if (research.bolt[0] == 3) { i++; - item[i] = ["research","Integrated Weapon Stabilization and Rate of Fire Enhancements", ["bolt"]]; - item_stocked[i] = 0; + item[i] = ["research", "Integrated Weapon Stabilization and Rate of Fire Enhancements", ["bolt"]]; + item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research unlocks the sacred technology of Integrated Weapon Stabilization and Rate of Fire Enhancements, allowing our warriors to unleash bolter fire with unprecedented might, creating a maelstrom of righteous destruction upon the heretic and the alien. This divine advancement focuses on the inner workings of the weaponry, turning them into the Emperor's own instruments of divine wrath, rivaled only by the most sacred creations of the Machine God. Their might shall tear down the very fortresses of our foes, and their righteous fury shall cleanse the battlefield from all that would oppose the Imperium. \nUnlocks: Hurricane Bolter, Quad Linked Heavy Bolter Sponsons, Twin linked assault cannon."; } - if (research.power_fields[0] < 2){ + if (research.power_fields[0] < 2) { i++; - item[i] = ["research",research_pathways.power_fields[0][research.power_fields[0]], ["power_fields"]]; + item[i] = ["research", research_pathways.power_fields[0][research.power_fields[0]], ["power_fields"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research unlocks the ancient science of Advanced Power Weapons, enhancing melee armaments with potent energy fields that disrupt the very bonds of matter. It is a testament to the power of technology, transforming ordinary weapons into instruments of righteous fury. This allows our warriors to devastate the most armored foes, cleaving through enemy ranks with the raw energy of the machine god.\n\nUnlocks: Power Axe, Power Sword, Power Spear, Crozius Arcanum, Power Fist, Power Mace, Lightning Claw, Chainfist, Thunder Hammer, Heavy Thunder Hammer, Storm Shield."; } - if (research.melta[0] == 0){ + if (research.melta[0] == 0) { i++; - item[i] = ["research",research_pathways.melta[0][research.melta[0]], ["melta"]]; + item[i] = ["research", research_pathways.melta[0][research.melta[0]], ["melta"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research unlocks the terrifying potential of Basic Melta Weaponry, granting us the ability to unleash the searing heat of miniature suns upon the enemy. These weapons melt through armor and fortifications with unparalleled ease. This enhances our anti-tank capabilities, allowing our forces to shatter enemy vehicles and fortifications, leaving only molten slag in their wake.\n\nUnlocks: Meltagun, Multi-Melta.\nRequired for: Combimelta"; } - if (research.grav[0] == 0){ + if (research.grav[0] == 0) { i++; item[i] = ["research", research_pathways.grav[0][research.grav[0]], ["grav"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research unravels the enigmatic science of Grav Weapons, allowing us to manipulate the very fabric of gravity for destructive purposes. These weapons crush and pulverize their targets with the force of collapsing worlds. They become the bane of armored units, allowing our forces to annihilate heavy infantry and vehicles with the very force of celestial bodies. \n\nUnlocks: Grav-Pistol, Grav-Gun, Grav-Cannon.\nRequired for: Combigrav"; } - if (research.armour[0]>0){ - if (research.armour[1].stealth[0] == 0){ + if (research.armour[0] > 0) { + if (research.armour[1].stealth[0] == 0) { i++; - item[i] = ["research","Advanced Servo Motors", ["armour", "stealth"]]; + item[i] = ["research", "Advanced Servo Motors", ["armour", "stealth"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research unlocks the secrets of Advanced Servo Motors, allowing the fabrication of enhanced movement systems, greatly boosting the speed and agility of our warriors. The speed and maneuverability increase will provide our troops with a significant advantage. It also unlocks the construction of specialized armors and advanced items.\n\nUnlocks: Mk6 Corvus.\nRequired for: Artificer Armour, Terminator Armour, Tartaros."; } - if (research.armour[1].armour[0] == 0){ + if (research.armour[1].armour[0] == 0) { i++; - item[i] = ["research","Advanced Ceramite Bonding", ["armour", "armour"]]; + item[i] = ["research", "Advanced Ceramite Bonding", ["armour", "armour"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research uncovers the lost techniques of Advanced Ceramite Bonding, allowing us to create superior armors. It fortifies our war plate, offering unparalleled protection against enemy fire. This dramatically enhances the survivability of our units as well as unlocking new armor capabilities.\n\nUnlocks: MK3 Iron Armour.\nRequired for: MK8 Errant, Artificer Armour, Terminator Armour, Tartaros."; - } else if (research.armour[1].armour[0] == 2){ + } else if (research.armour[1].armour[0] == 2) { i++; - item[i] = ["research","Ceremite Void Hardening", ["armour", "armour"]]; + item[i] = ["research", "Ceremite Void Hardening", ["armour", "armour"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research grants the secrets of Ceramite Void Hardening techniques, reinforcing our armors to withstand the harshest conditions of the void. It is essential for warriors who brave the vacuum of space, ensuring they can perform their duties where others would falter. It increases the unit's resilience in harsh environments as well as providing a superior armor plating. \n\nUnlocks: MK3 Iron Armour.\nRequired for: MK8 Errant, Artificer Armour."; } - if (research.armour[0]==1){ + if (research.armour[0] == 1) { i++; - item[i] = ["research",research_pathways.armour[0][1], ["armour"]]; + item[i] = ["research", research_pathways.armour[0][1], ["armour"]]; item_stocked[i] = 0; forge_cost[i] = 3000; - tooltip_overide[i] = "This research unlocks the knowledge to fabricate the Mk VIII 'Errant' pattern Power Armour, a refinement of the ubiquitous Aquila armour, often favored by veteran Astartes and officers due to its unparalleled protection. It features improved plating around the torso and neck, enhancing its resilience against both ranged and melee attacks. This technology marks the pinnacle of power armour technology and a significant step in the path to becoming a battle-hardened Astartes.\n\nUnlocks: MK8 Errant.\nRequired for: Artificer Armour."; - } - if (research.armour[1].stealth[0] == 1 && research.armour[1].armour[0] == 1){ + tooltip_overide[i] = "This research unlocks the knowledge to fabricate the Mk VIII 'Errant' pattern Power Armour, a refinement of the ubiquitous Aquila armour, often favored by veteran Astartes and officers due to its unparalleled protection. It features improved plating around the torso and neck, enhancing its resilience against both ranged and melee attacks. This technology marks the pinnacle of power armour technology and a significant step in the path to becoming a battle-hardened Astartes.\n\nUnlocks: MK8 Errant.\nRequired for: Artificer Armour."; + } + if (research.armour[1].stealth[0] == 1 && research.armour[1].armour[0] == 1) { i++; - item[i] = ["research","Enhanced Nerve Interfacing", ["armour", "armour"]]; + item[i] = ["research", "Enhanced Nerve Interfacing", ["armour", "armour"]]; item_stocked[i] = 0; forge_cost[i] = 3000; tooltip_overide[i] = "This research allows the creation of Enhanced Nerve Interfacing systems, binding unit and armor in perfect harmony. It augments the link between warrior and war plate, unlocking new levels of effectiveness. This provides the user with better accuracy, damage output, and mobility, unlocking new levels of tactical potential. \n\nUnlocks: MK4 Maximus."; } - } else if (research.armour[0]==0){ + } else if (research.armour[0] == 0) { i++; - item[i] = ["research",research_pathways.armour[0][0], ["armour"]]; + item[i] = ["research", research_pathways.armour[0][0], ["armour"]]; item_stocked[i] = 0; forge_cost[i] = 3000; - tooltip_overide[i] = "This research unlocks the knowledge to fabricate Mk VII 'Aquila' pattern Power Armour, the standard armour pattern for the Adeptus Astartes. It is a reliable and ubiquitous armour used by many Chapters that is also easy to construct and maintain, making it a stable base for the might of the Imperium's warriors.\n\nUnlocks: MK7 Aquila.\nRequired for: MK8 Errant, Artificer Armour, Terminator Armour, Tartaros."; - } - + tooltip_overide[i] = "This research unlocks the knowledge to fabricate Mk VII 'Aquila' pattern Power Armour, the standard armour pattern for the Adeptus Astartes. It is a reliable and ubiquitous armour used by many Chapters that is also easy to construct and maintain, making it a stable base for the might of the Imperium's warriors.\n\nUnlocks: MK7 Aquila.\nRequired for: MK8 Errant, Artificer Armour, Terminator Armour, Tartaros."; + } } legitimate_items = i; -if (shop = "warships") { +if (shop == "warships") { var disc; disc = 1; - if (obj_controller.stc_ships >= 1) then disc = 0.92; - if (obj_controller.stc_ships >= 3) then disc = 0.86; - if (obj_controller.stc_ships >= 5) then disc = 0.75; + if (obj_controller.stc_ships >= 1) { + disc = 0.92; + } + if (obj_controller.stc_ships >= 3) { + disc = 0.86; + } + if (obj_controller.stc_ships >= 5) { + disc = 0.75; + } i = 0; - repeat(31) { + repeat (31) { i += 1; - if (item_cost[i] > 1) then item_cost[i] = round(item_cost[i] * disc); + if (item_cost[i] > 1) { + item_cost[i] = round(item_cost[i] * disc); + } } } -if (discount = 1) { +if (discount == 1) { discount = 2; i = 0; - repeat(31) { + repeat (31) { i += 1; - if (item_cost[i] >= 5) then item_cost[i] = round(item_cost[i] * 0.8); - if (item_cost[i] > 1) and(item_cost[i] < 5) then item_cost[i] -= 1; + if (item_cost[i] >= 5) { + item_cost[i] = round(item_cost[i] * 0.8); + } + if ((item_cost[i] > 1) && (item_cost[i] < 5)) { + item_cost[i] -= 1; + } } } -if (rene = 1) { +if (rene == 1) { i = 0; - repeat(31) { + repeat (31) { i += 1; item_cost[i] *= 2; } } -forge_master_modifier=0; -if (forge_master!="none"){ - forge_master_modifier = 2500/((forge_master.charisma+10)*forge_master.technology); - if (forge_master.has_trait("flesh_is_weak") && forge_master_modifier>0.75){ - forge_master_modifier-=0.1; - }; +forge_master_modifier = 0; +if (forge_master != "none") { + forge_master_modifier = 2500 / ((forge_master.charisma + 10) * forge_master.technology); + if (forge_master.has_trait("flesh_is_weak") && forge_master_modifier > 0.75) { + forge_master_modifier -= 0.1; + } } else { - forge_master_modifier=1.7; + forge_master_modifier = 1.7; } -var tech_heretic_modifier =1 - i = 0; - repeat(array_length(item_cost)-2){ +var tech_heretic_modifier = 1; +i = 0; +repeat (array_length(item_cost) - 2) { i += 1; - if (shop != "warships"){ + if (shop != "warships") { item_cost[i] *= 2; } - if (rene != 1){ - item_cost[i]*=mechanicus_modifier; - if (obj_controller.tech_status=="heretics"){ + if (rene != 1) { + item_cost[i] *= mechanicus_modifier; + if (obj_controller.tech_status == "heretics") { tech_heretic_modifier = 1.05; - item_cost[i]*=tech_heretic_modifier + item_cost[i] *= tech_heretic_modifier; } - } - item_cost[i] *= forge_master_modifier; + } + item_cost[i] *= forge_master_modifier; item_cost[i] = ceil(item_cost[i]); } @@ -1822,10 +1923,9 @@ if (global.cheat_debug) { } item_cost_tooltip_info = ""; -item_cost_tooltip_info += $"Modifier from forge Master : X{forge_master_modifier}/n" -item_cost_tooltip_info += $"Mechanicus Relations : X{mechanicus_modifier}/n" -item_cost_tooltip_info += $"Chapter tech approach (obj_controller.tech_status) : X{tech_heretic_modifier}/n" - +item_cost_tooltip_info += $"Modifier from forge Master : X{forge_master_modifier}/n"; +item_cost_tooltip_info += $"Mechanicus Relations : X{mechanicus_modifier}/n"; +item_cost_tooltip_info += $"Chapter tech approach (obj_controller.tech_status) : X{tech_heretic_modifier}/n"; /* */ /* */ @@ -1835,14 +1935,14 @@ item_cost_tooltip_info += $"Chapter tech approach (obj_controller.tech_status) : /// @param {Real} sell_count The quantity to sell /// @param {Real} sell_modifier The value modifier (0.0-1.0) /// @returns {Boolean} Whether the sale was successful -sell_item = function (item_index, sell_count, sell_modifier) { +sell_item = function(item_index, sell_count, sell_modifier) { if (item_stocked[item_index] >= sell_count) { scr_add_item(item[item_index], (-sell_count), "standard"); - item_stocked[item_index] -= (sell_count); + item_stocked[item_index] -= sell_count; var sell_price = (item_cost[item_index] * sell_modifier) * sell_count; obj_controller.requisition += sell_price; return true; } return false; -} +}; diff --git a/objects/obj_shop/Draw_0.gml b/objects/obj_shop/Draw_0.gml index 1bbcee0d9e..f1385baf0a 100644 --- a/objects/obj_shop/Draw_0.gml +++ b/objects/obj_shop/Draw_0.gml @@ -1,168 +1,174 @@ add_draw_return_values(); -var xx,yy,x2,y2; -var romanNumerals=scr_roman_numerals(); -xx=__view_get( e__VW.XView, 0 )+0; -yy=__view_get( e__VW.YView, 0 )+0; -tooltip_show=0; -x2=962;y2=117; -slate_panel.inside_method = function(){ - var x2=962;y2=157; - var xx=__view_get( e__VW.XView, 0 )+0; - var yy=__view_get( e__VW.YView, 0 )+0; +var xx, yy, x2, y2; +var romanNumerals = scr_roman_numerals(); +xx = camera_get_view_x(view_camera[0]) + 0; +yy = camera_get_view_y(view_camera[0]) + 0; +tooltip_show = 0; +x2 = 962; +y2 = 117; +slate_panel.inside_method = function() { + var x2 = 962; + y2 = 157; + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0; draw_set_halign(fa_left); draw_set_font(fnt_40k_14b); - draw_text(xx+962,yy+159,"Name"); - draw_text(xx+962.5,yy+159.5,"Name"); - if (shop!="production"){ - draw_text(xx+1280,yy+159,"Stocked"); - draw_text(xx+1280.5,yy+159.5,"Stocked"); - if (shop="equipment" or shop="equipment2"){ - draw_text(xx+1280+10+string_width("Stocked"),yy+159.5,"MC"); - draw_text(xx+1280+10.5+string_width("Stocked"),yy+159.5,"MC"); + draw_text(xx + 962, yy + 159, "Name"); + draw_text(xx + 962.5, yy + 159.5, "Name"); + if (shop != "production") { + draw_text(xx + 1280, yy + 159, "Stocked"); + draw_text(xx + 1280.5, yy + 159.5, "Stocked"); + if (shop == "equipment" || shop == "equipment2") { + draw_text(xx + 1280 + 10 + string_width("Stocked"), yy + 159.5, "MC"); + draw_text(xx + 1280 + 10.5 + string_width("Stocked"), yy + 159.5, "MC"); } } - draw_text(xx+1410,yy+159,("Cost")); - draw_text(xx+1410.5,yy+159.5,("Cost")); + draw_text(xx + 1410, yy + 159, "Cost"); + draw_text(xx + 1410.5, yy + 159.5, "Cost"); draw_set_color(c_gray); - - if (shop="warships"){ - if (construction_started>0){ - var apa=construction_started/30; + if (shop == "warships") { + if (construction_started > 0) { + var apa = construction_started / 30; draw_set_alpha(apa); draw_set_color(c_yellow); draw_set_halign(fa_center); - draw_text_transformed(__view_get( e__VW.XView, 0 )+420,yy+370,$"CONSTRUCTION STARTED!\nETA: {eta} months",1.5,1.5,0); + draw_text_transformed(camera_get_view_x(view_camera[0]) + 420, yy + 370, $"CONSTRUCTION STARTED!\nETA: {eta} months", 1.5, 1.5, 0); draw_set_halign(fa_left); draw_set_color(CM_GREEN_COLOR); draw_set_alpha(1); } } - var i=(scroll_point*28); - var viable=1; - var final =1; + var i = scroll_point * 28; + var viable = 1; + var final = 1; var entered; - while (i<79 && viable<=28){ - entered=false; + while (i < 79 && viable <= 28) { + entered = false; i++; - y2+=20; - if (item[i]!=""){ + y2 += 20; + if (item[i] != "") { viable++; - final=i; - if (!obj_controller.in_forge && nobuy[i]=0) || (obj_controller.in_forge && forge_cost[i]>0){ + final = i; + if ((!obj_controller.in_forge && nobuy[i] == 0) || (obj_controller.in_forge && forge_cost[i] > 0)) { draw_set_color(c_gray); - if (scr_hit(xx+962, yy+y2+2, xx+1580, yy+y2+18)){ + if (scr_hit(xx + 962, yy + y2 + 2, xx + 1580, yy + y2 + 18)) { draw_set_color(c_gray); entered = true; - draw_rectangle(xx+960, yy+y2+1, xx+1582, yy+y2+18, 0); + draw_rectangle(xx + 960, yy + y2 + 1, xx + 1582, yy + y2 + 18, 0); draw_set_color(c_white); } - if (shop!="production"){ - if (!keyboard_check(vk_shift) || shop == "warships") then draw_text(xx+x2+x_mod[i], yy+y2, item[i]); // Name - if (keyboard_check(vk_shift) && shop != "warships") then draw_text(xx+x2+x_mod[i], yy+y2, string(item[i] + " x5")); // Name + if (shop != "production") { + if (!keyboard_check(vk_shift) || shop == "warships") { + draw_text(xx + x2 + x_mod[i], yy + y2, item[i]); + } // Name + if (keyboard_check(vk_shift) && shop != "warships") { + draw_text(xx + x2 + x_mod[i], yy + y2, string(item[i] + " x5")); + } // Name } else { - draw_text(xx+x2+x_mod[i],yy+y2,string_hash_to_newline(item[i][1]));// Name + draw_text(xx + x2 + x_mod[i], yy + y2, string_hash_to_newline(item[i][1])); // Name + } + if ((item_stocked[i] == 0) && ((mc_stocked[i] == 0) || (shop != "equipment"))) { + draw_set_alpha(0.5); + } + if ((mc_stocked[i] == 0) && (shop != "production")) { + draw_text(xx + 1300, yy + y2, string_hash_to_newline(item_stocked[i])); + } // Stocked + if (mc_stocked[i] > 0) { + draw_text(xx + 1300, yy + y2, string_hash_to_newline(string(item_stocked[i]) + " mc: " + string(mc_stocked[i]))); } - if (item_stocked[i]=0) and ((mc_stocked[i]=0) or (shop!="equipment")) then draw_set_alpha(0.5); - if (mc_stocked[i]=0) and (shop!="production") then draw_text(xx+1300,yy+y2,string_hash_to_newline(item_stocked[i]));// Stocked - if (mc_stocked[i]>0) then draw_text(xx+1300,yy+y2,string_hash_to_newline(string(item_stocked[i])+" mc: "+string(mc_stocked[i]))); draw_set_alpha(1); - if (obj_controller.in_forge){ - draw_sprite_ext( - spr_forge_points_icon,0, - xx+1410, - yy+y2+3, - 0.3, - 0.3, - 0, - c_white, - 1); - } else{ - draw_sprite_ext(spr_requisition,0,xx+1410,yy+y2+6,1,1,0,c_white,1); - } - draw_set_color(16291875) - if (obj_controller.in_forge){ - draw_set_color(#af5a00) - } + if (obj_controller.in_forge) { + draw_sprite_ext(spr_forge_points_icon, 0, xx + 1410, yy + y2 + 3, 0.3, 0.3, 0, c_white, 1); + } else { + draw_sprite_ext(spr_requisition, 0, xx + 1410, yy + y2 + 6, 1, 1, 0, c_white, 1); + } + draw_set_color(16291875); + if (obj_controller.in_forge) { + draw_set_color(#af5a00); + } - var cost = obj_controller.in_forge ? forge_cost[i] : item_cost[i] - if (!obj_controller.in_forge){ - if (!keyboard_check(vk_shift)) and (obj_controller.requisition 0){ + if (shop != "warships" && shop != "vehicles" && item_stocked[i] > 0) { draw_set_alpha(1); - var _button = draw_sprite_as_button([xx+1480,yy+y2+2], spr_sell_tiny); + var _button = draw_sprite_as_button([xx + 1480, yy + y2 + 2], spr_sell_tiny); if (scr_hit(_button)) { var _sell_mod = SHOP_SELL_MOD; tooltip = $"Send items back for {_sell_mod * 100}% of the requisition cost."; - tooltip_show=1; + tooltip_show = 1; if (scr_click_left()) { var sell_mult_count = keyboard_check(vk_shift) ? 5 : 1; - sell_item(i, sell_mult_count, _sell_mod) + sell_item(i, sell_mult_count, _sell_mod); } } } } } - var clicked = (point_and_click([xx+1520, yy+y2+2, xx+1570, yy+y2+14])); - if (obj_controller.in_forge){ - draw_sprite(spr_build_tiny,0,xx+1530,yy+y2+2); - if (clicked){ - if (array_length(obj_controller.specialist_point_handler.forge_queue)<20){ + var clicked = point_and_click([xx + 1520, yy + y2 + 2, xx + 1570, yy + y2 + 14]); + if (obj_controller.in_forge) { + draw_sprite(spr_build_tiny, 0, xx + 1530, yy + y2 + 2); + if (clicked) { + if (array_length(obj_controller.specialist_point_handler.forge_queue) < 20) { var new_queue_item = { - name:item[i], - count:1, - forge_points:forge_cost[i], - ordered:obj_controller.turn, - } - if (shop!="production"){ - if (keyboard_check(vk_shift)){ + name: item[i], + count: 1, + forge_points: forge_cost[i], + ordered: obj_controller.turn, + }; + if (shop != "production") { + if (keyboard_check(vk_shift)) { new_queue_item.count = 5; new_queue_item.forge_points = 5 * forge_cost[i]; } } array_push(obj_controller.specialist_point_handler.forge_queue, new_queue_item); - } + } } - } else if (nobuy[i]=0 && clicked && !obj_controller.in_forge){ - cost=item_cost[i]; - var _mult_count = keyboard_check(vk_shift) ?5 : 1; - if (shop!="warships"){ + } else if (nobuy[i] == 0 && clicked && !obj_controller.in_forge) { + cost = item_cost[i]; + var _mult_count = keyboard_check(vk_shift) ? 5 : 1; + if (shop != "warships") { cost *= _mult_count; } - if (obj_controller.requisition>=cost) and (shop!="warships"){ - + if ((obj_controller.requisition >= cost) && (shop != "warships")) { var _vehics = ["Rhino", "Predator", "Land Raider", "Whirlwind", "Land Speeder"]; - if (!array_contains(_vehics, item[i])){ - scr_add_item(item[i],_mult_count); + if (!array_contains(_vehics, item[i])) { + scr_add_item(item[i], _mult_count); item_stocked[i] += _mult_count; click2 = true; - } - else{ - + } else { repeat (_mult_count) { scr_add_vehicle(item[i], target_comp, {}); } @@ -172,111 +178,109 @@ slate_panel.inside_method = function(){ scr_vehicle_order(obj_shop.target_comp); } } - obj_controller.requisition-=cost; + obj_controller.requisition -= cost; } - if (obj_controller.requisition>=cost) and (shop=="warships"){ - + if ((obj_controller.requisition >= cost) && (shop == "warships")) { var _duration = 4; - if (item[i]="Battle Barge"){ - _duration=30; - } - else if (item[i]="Strike Cruiser"){ - _duration=10; + if (item[i] == "Battle Barge") { + _duration = 30; + } else if (item[i] == "Strike Cruiser") { + _duration = 10; } eta = _duration; - construction_started=120; + construction_started = 120; obj_controller.requisition -= cost; - add_event({ - e_id : "ship_construction", - ship_class : item[i], - duration : _duration, - }); + add_event({e_id: "ship_construction", ship_class: item[i], duration: _duration}); } } } - if (!obj_controller.in_forge && nobuy[i]=1) || (obj_controller.in_forge && forge_cost[i]=0){ + if ((!obj_controller.in_forge && nobuy[i] == 1) || (obj_controller.in_forge && forge_cost[i] == 0)) { draw_set_alpha(1); draw_set_color(881503); - draw_text(xx+x2+x_mod[i],yy+y2,item[i]);// Name - if (item_stocked[i]=0) then draw_set_alpha(0.5); - draw_text(xx+1300,yy+y2,item_stocked[i]);// Stocked + draw_text(xx + x2 + x_mod[i], yy + y2, item[i]); // Name + if (item_stocked[i] == 0) { + draw_set_alpha(0.5); + } + draw_text(xx + 1300, yy + y2, item_stocked[i]); // Stocked draw_set_alpha(1); } - if (scr_hit(xx+962 ,yy+y2,xx+1280,yy+y2+19) && shop!="warships"){ - if (last_item == item[i]){ - tooltip_show=1; + if (scr_hit(xx + 962, yy + y2, xx + 1280, yy + y2 + 19) && shop != "warships") { + if (last_item == item[i]) { + tooltip_show = 1; } else { - if (!is_string(tooltip_overide[i])){ - tooltip=gen_item_tooltip(item[i]) + if (!is_string(tooltip_overide[i])) { + tooltip = gen_item_tooltip(item[i]); } else { tooltip = tooltip_overide[i]; } - tooltip_show=1; + tooltip_show = 1; } - } - + } } } //draw_set_color(c_red); - pages_required = ceil(legitimate_items/28); - for (i=0;i=xx+1262) and (mouse_y>=yy+78) and (mouse_x<=xx+1417) and (mouse_y= xx + 1262) && (mouse_y >= yy + 78) && (mouse_x <= xx + 1417) && (mouse_y < yy + 103)) { + draw_set_alpha(0.8); + } + draw_text(xx + 1310, yy + 82, string_hash_to_newline("Target: " + string(te) + " Company")); } draw_set_alpha(1); draw_set_font(fnt_40k_14b); draw_set_color(0); -var shop_area=""; -if(tab_buttons.equipment.draw(xx+960,yy+64, "Equipment")){ - shop_area="equipment"; +var shop_area = ""; +if (tab_buttons.equipment.draw(xx + 960, yy + 64, "Equipment")) { + shop_area = "equipment"; } -if (tab_buttons.armour.draw(xx+1075,yy+64, "Armour")){ - shop_area="equipment2"; +if (tab_buttons.armour.draw(xx + 1075, yy + 64, "Armour")) { + shop_area = "equipment2"; } -if (tab_buttons.vehicles.draw(xx+1190,yy+64, "Vehicles")){ - shop_area="vehicles"; +if (tab_buttons.vehicles.draw(xx + 1190, yy + 64, "Vehicles")) { + shop_area = "vehicles"; } -if (obj_controller.in_forge){ - if (tab_buttons.ships.draw(xx+1460,yy+64, "Manufactoring")){ - shop_area="production"; +if (obj_controller.in_forge) { + if (tab_buttons.ships.draw(xx + 1460, yy + 64, "Manufactoring")) { + shop_area = "production"; } -}else{ - if (tab_buttons.ships.draw(xx+1460,yy+64, "Ships")){ - shop_area="warships"; +} else { + if (tab_buttons.ships.draw(xx + 1460, yy + 64, "Ships")) { + shop_area = "warships"; } } -if (tooltip_show!=0){ - tooltip_draw(tooltip, 400) +if (tooltip_show != 0) { + tooltip_draw(tooltip, 400); } -if (shop_area!=""){ - obj_controller.cooldown=8000; - shop=shop_area - instance_create(50,50,obj_shop); +if (shop_area != "") { + obj_controller.cooldown = 8000; + shop = shop_area; + instance_create(50, 50, obj_shop); } pop_draw_return_values(); diff --git a/objects/obj_shop/Mouse_50.gml b/objects/obj_shop/Mouse_50.gml index 90193d3a48..a1b1bd4d35 100644 --- a/objects/obj_shop/Mouse_50.gml +++ b/objects/obj_shop/Mouse_50.gml @@ -1,32 +1,35 @@ - - -var i,xx,yy,x2,y2,cost,multiple;i=0; -xx=__view_get( e__VW.XView, 0 )+0; -yy=__view_get( e__VW.YView, 0 )+0; - -x2=962; -y2=107; - - -if (mouse_x>=xx+1262) and (mouse_y>=yy+82) and (mouse_x<=xx+1417) and (mouse_y=1) and (onceh=0) then target_comp+=1; - if (target_comp>obj_ini.companies) then target_comp=1; - obj_controller.new_vehicles=target_comp; +var i, xx, yy, x2, y2, cost, multiple; +i = 0; +xx = camera_get_view_x(view_camera[0]) + 0; +yy = camera_get_view_y(view_camera[0]) + 0; + +x2 = 962; +y2 = 107; + +if ((mouse_x >= xx + 1262) && (mouse_y >= yy + 82) && (mouse_x <= xx + 1417) && (mouse_y < yy + 103) && (obj_controller.cooldown <= 0)) { + var onceh; + onceh = 0; + obj_controller.cooldown = 8000; + if ((target_comp >= 1) && (onceh == 0)) { + target_comp += 1; + } + if (target_comp > obj_ini.companies) { + target_comp = 1; + } + obj_controller.new_vehicles = target_comp; } -draw_rectangle(xx+957,yy+76,xx+1062,yy+104,0); -draw_rectangle(xx+1068,yy+76,xx+1150,yy+104,0); -draw_rectangle(xx+1167,yy+76,xx+1255,yy+104,0); -draw_rectangle(xx+1487,yy+76,xx+1545,yy+104,0); +draw_rectangle(xx + 957, yy + 76, xx + 1062, yy + 104, 0); +draw_rectangle(xx + 1068, yy + 76, xx + 1150, yy + 104, 0); +draw_rectangle(xx + 1167, yy + 76, xx + 1255, yy + 104, 0); +draw_rectangle(xx + 1487, yy + 76, xx + 1545, yy + 104, 0); draw_set_color(c_black); -draw_text_transformed(xx+960,yy+76,string_hash_to_newline("Equipment"),0.6,0.6,0); -draw_text_transformed(xx+1070,yy+76,string_hash_to_newline("Armour"),0.6,0.6,0); -draw_text_transformed(xx+1170,yy+76,string_hash_to_newline("Vehicles"),0.6,0.6,0); -draw_text_transformed(xx+1490,yy+76,string_hash_to_newline("Ships"),0.6,0.6,0); - +draw_text_transformed(xx + 960, yy + 76, string_hash_to_newline("Equipment"), 0.6, 0.6, 0); +draw_text_transformed(xx + 1070, yy + 76, string_hash_to_newline("Armour"), 0.6, 0.6, 0); +draw_text_transformed(xx + 1170, yy + 76, string_hash_to_newline("Vehicles"), 0.6, 0.6, 0); +draw_text_transformed(xx + 1490, yy + 76, string_hash_to_newline("Ships"), 0.6, 0.6, 0); /* */ /* */ diff --git a/objects/obj_shop/Step_0.gml b/objects/obj_shop/Step_0.gml index e9a1b4c16e..039d84e4bc 100644 --- a/objects/obj_shop/Step_0.gml +++ b/objects/obj_shop/Step_0.gml @@ -1,16 +1,23 @@ +if (click > 0) { + click = -1; + audio_play_sound(snd_click, -100, 0); + audio_sound_gain(snd_click, 0.25 * obj_controller.master_volume * obj_controller.effect_volume, 0); +} +if (click2 > 0) { + click2 = -1; + audio_play_sound(snd_click, -100, 0); + audio_sound_gain(snd_click, 0.25 * obj_controller.master_volume * obj_controller.effect_volume, 0); +} -if (click>0){click=-1;audio_play_sound(snd_click,-100,0);audio_sound_gain(snd_click,0.25*obj_controller.master_volume*obj_controller.effect_volume,0);} -if (click2>0){click2=-1;audio_play_sound(snd_click,-100,0);audio_sound_gain(snd_click,0.25*obj_controller.master_volume*obj_controller.effect_volume,0);} - -hover=0; -var i,xx,yy,x2,y2;i=0; -xx=__view_get( e__VW.XView, 0 )+0; -yy=__view_get( e__VW.YView, 0 )+0; +hover = 0; +var i, xx, yy, x2, y2; +i = 0; +xx = camera_get_view_x(view_camera[0]) + 0; +yy = camera_get_view_y(view_camera[0]) + 0; -if (construction_started>0){ - construction_started-=1; +if (construction_started > 0) { + construction_started -= 1; } - /* */ /* */ diff --git a/objects/obj_star_select/Alarm_0.gml b/objects/obj_star_select/Alarm_0.gml index 2486ebd802..9799664c59 100644 --- a/objects/obj_star_select/Alarm_0.gml +++ b/objects/obj_star_select/Alarm_0.gml @@ -1,6 +1,3 @@ - - - /*if (instance_exists(target)){ if (target.craftworld=1) or (target.space_hulk=1){ // 135 ; @@ -22,22 +19,30 @@ } }*/ - -if (loading=0) then exit; - +if (loading == 0) { + exit; +} // check for the right star var xb, yb, good, tiber; -xb=0;yb=0;good=0;tiber=0; - -with(obj_star){ - if (name=obj_star_select.loading_name) then instance_create(x,y,obj_temp2); +xb = 0; +yb = 0; +good = 0; +tiber = 0; + +with (obj_star) { + if (name == obj_star_select.loading_name) { + instance_create(x, y, obj_temp2); + } +} +if (instance_exists(obj_temp2)) { + tiber = instance_nearest(obj_temp2.x, obj_temp2.y, obj_star); + target = tiber; } -if (instance_exists(obj_temp2)){ - tiber=instance_nearest(obj_temp2.x,obj_temp2.y,obj_star);target=tiber; +with (obj_temp2) { + instance_destroy(); } -with(obj_temp2){instance_destroy();} instance_activate_object(obj_star); diff --git a/objects/obj_star_select/Alarm_1.gml b/objects/obj_star_select/Alarm_1.gml index ce93d559ae..9c1fc9fafe 100644 --- a/objects/obj_star_select/Alarm_1.gml +++ b/objects/obj_star_select/Alarm_1.gml @@ -1,29 +1,56 @@ +player_fleet = target.present_fleet[1]; +imperial_fleet = target.present_fleet[2]; +mechanicus_fleet = target.present_fleet[3]; +inquisitor_fleet = target.present_fleet[4]; +eldar_fleet = target.present_fleet[6]; +ork_fleet = target.present_fleet[7]; +tau_fleet = target.present_fleet[8]; +tyranid_fleet = target.present_fleet[9]; +heretic_fleet = target.present_fleet[10]; -player_fleet=target.present_fleet[1]; -imperial_fleet=target.present_fleet[2]; -mechanicus_fleet=target.present_fleet[3]; -inquisitor_fleet=target.present_fleet[4]; -eldar_fleet=target.present_fleet[6]; -ork_fleet=target.present_fleet[7]; -tau_fleet=target.present_fleet[8]; -tyranid_fleet=target.present_fleet[9]; -heretic_fleet=target.present_fleet[10]; - -en_fleet[0]=0; -var i;i=-1; -repeat(15){i+=1;en_fleet[i]=0;} - -if (player_fleet>0) and (imperial_fleet+mechanicus_fleet+inquisitor_fleet+eldar_fleet+ork_fleet+tau_fleet+heretic_fleet>0){ - var open;open=1;i=-1; - - if (imperial_fleet>0){en_fleet[open]=2;open+=1;} - if (mechanicus_fleet>0){en_fleet[open]=3;open+=1;} - if (inquisitor_fleet>0){en_fleet[open]=4;open+=1;} - if (eldar_fleet>0){en_fleet[open]=6;open+=1;} - if (ork_fleet>0){en_fleet[open]=7;open+=1;} - if (tau_fleet>0){en_fleet[open]=8;open+=1;} - if (tyranid_fleet>0){en_fleet[open]=9;open+=1;} - if (heretic_fleet>0){en_fleet[open]=10;open+=1;} +en_fleet[0] = 0; +var i; +i = -1; +repeat (15) { + i += 1; + en_fleet[i] = 0; } +if ((player_fleet > 0) && (imperial_fleet + mechanicus_fleet + inquisitor_fleet + eldar_fleet + ork_fleet + tau_fleet + heretic_fleet > 0)) { + var open; + open = 1; + i = -1; + if (imperial_fleet > 0) { + en_fleet[open] = 2; + open += 1; + } + if (mechanicus_fleet > 0) { + en_fleet[open] = 3; + open += 1; + } + if (inquisitor_fleet > 0) { + en_fleet[open] = 4; + open += 1; + } + if (eldar_fleet > 0) { + en_fleet[open] = 6; + open += 1; + } + if (ork_fleet > 0) { + en_fleet[open] = 7; + open += 1; + } + if (tau_fleet > 0) { + en_fleet[open] = 8; + open += 1; + } + if (tyranid_fleet > 0) { + en_fleet[open] = 9; + open += 1; + } + if (heretic_fleet > 0) { + en_fleet[open] = 10; + open += 1; + } +} diff --git a/objects/obj_star_select/Create_0.gml b/objects/obj_star_select/Create_0.gml index b5397e8489..d06c4a0dcd 100644 --- a/objects/obj_star_select/Create_0.gml +++ b/objects/obj_star_select/Create_0.gml @@ -1,54 +1,33 @@ - -owner=0; -target=instance_nearest(x,y,obj_star); -loading=0; -loading_name=""; -alarm[0]=1; -debug=0; -guard=0; -pdf=0; -fortification=0; -corruption=0; -ork=0; -tau=0; -chaos=0; +owner = 0; +target = instance_nearest(x, y, obj_star); +loading = 0; +loading_name = ""; +alarm[0] = 1; +debug = 0; +guard = 0; +pdf = 0; +fortification = 0; +corruption = 0; +ork = 0; +tau = 0; +chaos = 0; p_data = new PlanetData(0, target); has_player_forces = array_sum(target.p_player); -manage_units_button = new UnitButtonObject({x1 :115, y1:200, style : "pixel", label:"Manage Units"}); +manage_units_button = new UnitButtonObject({x1: 115, y1: 200, style: "pixel", label: "Manage Units"}); //if (global.cheat_debug){ - debug_button = new UnitButtonObject({x1 :36, y1:185, style : "pixel", label:"Debug"}); - - debug_options = new RadioSet([ - { - str1 : "Edit Forces", - - }, - { - str1 : "Add Problem", - - }, - { - str1 : "Add Feature", - - }, - ],"Debug options",{x1 : 36, y1 : 129, max_width : 300}); - - debug_slate = new DataSlate({ - style : "plain", - XX : 36, - YY : 100, - set_width : true, - width : 310, - height : 900, - }); +debug_button = new UnitButtonObject({x1: 36, y1: 185, style: "pixel", label: "Debug"}); + +debug_options = new RadioSet([{str1: "Edit Forces"}, {str1: "Add Problem"}, {str1: "Add Feature"}], "Debug options", {x1: 36, y1: 129, max_width: 300}); + +debug_slate = new DataSlate({style: "plain", XX: 36, YY: 100, set_width: true, width: 310, height: 900}); //} torpedo = scr_item_count("Cyclonic Torpedo"); -feature= ""; -garrison= ""; +feature = ""; +garrison = ""; population = false; garrison_data_slate = new DataSlate(); @@ -56,99 +35,84 @@ garrison_data_slate.title = "Garrison Report"; main_data_slate = new DataSlate(); colonist_button = new PurchaseButton(1000); -colonist_button.update({ - tooltip : "Planets with higher populations can provide more recruits both for your chapter and to keep a planets PDF bolstered, however colonists from other planets bring with them their home planets influences and evils /n REQ : 1000", - label : "Request Colonists", - target : target, -}); -colonist_button.bind_method = function(){ +colonist_button.update({tooltip: "Planets with higher populations can provide more recruits both for your chapter and to keep a planets PDF bolstered, however colonists from other planets bring with them their home planets influences and evils /n REQ : 1000", label: "Request Colonists", target: target}); +colonist_button.bind_method = function() { var doner = array_random_element(obj_star_select.potential_doners); - new_colony_fleet(doner[0],doner[1],target.id,obj_controller.selecting_planet,"bolster_population"); + new_colony_fleet(doner[0], doner[1], target.id, obj_controller.selecting_planet, "bolster_population"); }; recruiting_button = new PurchaseButton(0); -recruiting_button.update({ - tooltip : "Enable recruiting", - label : "Recruiting", - target : target, -}); -recruiting_button.bind_method = function(){ +recruiting_button.update({tooltip: "Enable recruiting", label: "Recruiting", target: target}); +recruiting_button.bind_method = function() { if (!p_data.has_feature(P_features.Recruiting_World)) { p_data.add_feature(P_features.Recruiting_World); obj_controller.recruiting_worlds += $"{planet_numeral_name(obj_controller.selecting_planet, target)}|"; } else { delete_features(target.p_feature[obj_controller.selecting_planet], P_features.Recruiting_World); - obj_controller.recruiting_worlds=string_replace(obj_controller.recruiting_worlds,string(target.name)+" "+scr_roman(obj_controller.selecting_planet)+"|",""); + obj_controller.recruiting_worlds = string_replace(obj_controller.recruiting_worlds, string(target.name) + " " + scr_roman(obj_controller.selecting_planet) + "|", ""); } }; recruitment_type_button = new PurchaseButton(0); -recruitment_type_button.update({ - tooltip : "Change recruitment type", - label : "Recruitment Type", - target : target, -}); -recruitment_type_button.bind_method = function(){ +recruitment_type_button.update({tooltip: "Change recruitment type", label: "Recruitment Type", target: target}); +recruitment_type_button.bind_method = function() { var _recruit_world = p_data.get_features(P_features.Recruiting_World)[0]; if (_recruit_world.recruit_type < 1) { - _recruit_world.recruit_type++ + _recruit_world.recruit_type++; } else { - _recruit_world.recruit_type-- + _recruit_world.recruit_type--; } }; recruitment_costdown_button = new PurchaseButton(0); -recruitment_costdown_button.update({ - tooltip : "Deaccelerate recruitment", - label : "RQD", - target : target, -}); -recruitment_costdown_button.bind_method = function(){ +recruitment_costdown_button.update({tooltip: "Deaccelerate recruitment", label: "RQD", target: target}); +recruitment_costdown_button.bind_method = function() { var _recruit_world = p_data.get_features(P_features.Recruiting_World)[0]; - _recruit_world.recruit_cost-- + _recruit_world.recruit_cost--; }; recruitment_costup_button = new PurchaseButton(0); -recruitment_costup_button.update({ - tooltip : "Accelerate recruitment with req", - label : "RQU", - target : target, -}); -recruitment_costup_button.bind_method = function(){ +recruitment_costup_button.update({tooltip: "Accelerate recruitment with req", label: "RQU", target: target}); +recruitment_costup_button.bind_method = function() { var _recruit_world = p_data.get_features(P_features.Recruiting_World)[0]; - _recruit_world.recruit_cost++ + _recruit_world.recruit_cost++; }; buttons_selected = false; -button1=""; -button2=""; -button3=""; -button4=""; -button5=""; +button1 = ""; +button2 = ""; +button3 = ""; +button4 = ""; +button5 = ""; button_manager = new UnitButtonObject(); shutter_1 = new ShutterButton(); shutter_2 = new ShutterButton(); shutter_3 = new ShutterButton(); shutter_4 = new ShutterButton(); shutter_5 = new ShutterButton(); -attack=0; -raid=0; -bombard=0; -purge=0; - -player_fleet=0; -imperial_fleet=0; -mechanicus_fleet=0; -inquisitor_fleet=0; -eldar_fleet=0; -ork_fleet=0; -tau_fleet=0; -tyranid_fleet=0; -heretic_fleet=0; - -en_fleet[0]=0; -var i;i=-1; -repeat(15){i+=1;en_fleet[i]=0;} - -if (obj_controller.menu=0) then alarm[1]=1; - +attack = 0; +raid = 0; +bombard = 0; +purge = 0; + +player_fleet = 0; +imperial_fleet = 0; +mechanicus_fleet = 0; +inquisitor_fleet = 0; +eldar_fleet = 0; +ork_fleet = 0; +tau_fleet = 0; +tyranid_fleet = 0; +heretic_fleet = 0; + +en_fleet[0] = 0; +var i; +i = -1; +repeat (15) { + i += 1; + en_fleet[i] = 0; +} + +if (obj_controller.menu == 0) { + alarm[1] = 1; +} diff --git a/objects/obj_star_select/Draw_64.gml b/objects/obj_star_select/Draw_64.gml index 0ee09b3011..1c1ae264b1 100644 --- a/objects/obj_star_select/Draw_64.gml +++ b/objects/obj_star_select/Draw_64.gml @@ -1,13 +1,16 @@ - - - -if (instances_exist_any([obj_bomb_select, obj_drop_select, obj_popup])){ +if (instances_exist_any([obj_bomb_select, obj_drop_select, obj_popup])) { exit; } -if (obj_controller.zoomed=1) then exit; -if (!instance_exists(target)) then exit; -if (obj_controller.menu=60) then exit; +if (obj_controller.zoomed == 1) { + exit; +} +if (!instance_exists(target)) { + exit; +} +if (obj_controller.menu == 60) { + exit; +} add_draw_return_values(); draw_set_font(fnt_40k_14b); @@ -15,129 +18,126 @@ draw_set_halign(fa_center); draw_set_valign(fa_top); draw_set_color(0); -var temp1=0; -var xx=__view_get( e__VW.XView, 0 )+0; -var yy=__view_get( e__VW.YView, 0 )+0; -if (loading=1){ - xx=xx; - yy=yy; -} else if (loading==1){ - var temp1, dist; - dist=999; - - obj_controller.selecting_planet=0; - button1=""; - button2=""; - button3=""; - button4=""; - - if (instance_exists(target)){ - if (target.space_hulk==1){ +var temp1 = 0; +var xx = camera_get_view_x(view_camera[0]) + 0; +var yy = camera_get_view_y(view_camera[0]) + 0; +if (loading == 1) { + xx = xx; + yy = yy; +} else if (loading == 1) { + var temp1, dist; + dist = 999; + + obj_controller.selecting_planet = 0; + button1 = ""; + button2 = ""; + button3 = ""; + button4 = ""; + + if (instance_exists(target)) { + if (target.space_hulk == 1) { pop_draw_return_values(); exit; } } } -if (obj_controller.selecting_planet>target.planets){ +if (obj_controller.selecting_planet > target.planets) { obj_controller.selecting_planet = 0; } -var click_accepted = (!obj_controller.menu) and (!obj_controller.zoomed) and (!instance_exists(obj_bomb_select)) and (!instance_exists(obj_drop_select)); +var click_accepted = (!obj_controller.menu) && (!obj_controller.zoomed) && (!instance_exists(obj_bomb_select)) && (!instance_exists(obj_drop_select)); if (click_accepted && (!debug || !debug_slate.entered())) { if (scr_click_left(0)) { - var closes=0,sta1=0,sta2=0; + var closes = 0, sta1 = 0, sta2 = 0; var mouse_consts = return_mouse_consts(); - sta1=instance_nearest(mouse_consts[0],mouse_consts[1],obj_star); - sta2=point_distance(mouse_consts[0],mouse_consts[1],sta1.x,sta1.y); - closes=true; - if (sta2>15){ - if (scr_hit( - 27, - 165, - 300, - 165+294) - ){ - closes=false - } else if (obj_controller.selecting_planet>0){ + sta1 = instance_nearest(mouse_consts[0], mouse_consts[1], obj_star); + sta2 = point_distance(mouse_consts[0], mouse_consts[1], sta1.x, sta1.y); + closes = true; + if (sta2 > 15) { + if (scr_hit(27, 165, 300, 165 + 294)) { + closes = false; + } else if (obj_controller.selecting_planet > 0) { closes = !main_data_slate.entered(); - if (closes){ - if (is_struct(garrison) || population){ - closes = !garrison_data_slate.entered(); + if (closes) { + if (is_struct(garrison) || population) { + closes = !garrison_data_slate.entered(); } } - - if (!is_string(feature)){ - if (feature.main_slate.entered()){ - closes=false; + + if (!is_string(feature)) { + if (feature.main_slate.entered()) { + closes = false; } } } var shutter_button; var shutters = [shutter_1, shutter_2, shutter_3, shutter_4]; - for (var i=0; i<4;i++){ + for (var i = 0; i < 4; i++) { shutter_button = shutters[i]; - if (shutter_button.hit()){ - closes=false; + if (shutter_button.hit()) { + closes = false; break; } } - if (closes){ - cooldown=0; - obj_controller.sel_system_x=0; - obj_controller.sel_system_y=0; - obj_controller.selecting_planet=0; - obj_controller.popup=0; + if (closes) { + cooldown = 0; + obj_controller.sel_system_x = 0; + obj_controller.sel_system_y = 0; + obj_controller.selecting_planet = 0; + obj_controller.popup = 0; instance_destroy(); } } } } -if (target.craftworld=0) and (target.space_hulk=0) then draw_sprite(spr_star_screen,target.planets,27,165); -if (target.craftworld=1) then draw_sprite(spr_star_screen,5,27,165); -if (target.space_hulk=1) then draw_sprite(spr_star_screen,6,27,165); -if (target.craftworld=0) and (target.space_hulk=0) then draw_sprite_ext(target.sprite_index,target.image_index,77,287,1.25,1.25,0,c_white,1); +if ((target.craftworld == 0) && (target.space_hulk == 0)) { + draw_sprite(spr_star_screen, target.planets, 27, 165); +} +if (target.craftworld == 1) { + draw_sprite(spr_star_screen, 5, 27, 165); +} +if (target.space_hulk == 1) { + draw_sprite(spr_star_screen, 6, 27, 165); +} +if ((target.craftworld == 0) && (target.space_hulk == 0)) { + draw_sprite_ext(target.sprite_index, target.image_index, 77, 287, 1.25, 1.25, 0, c_white, 1); +} var _screen_height = sprite_get_height(spr_star_screen); var _screen_width = sprite_get_width(spr_star_screen); -draw_sprite_ext(spr_servo_left_arm, 0,27+_screen_width,165+_screen_height/3, 2, 2, 0, c_white, 1); -draw_sprite_ext(spr_servo_right_arm, 0,27,165+_screen_height/3, 2, 2, 0, c_white, 1); -draw_sprite_ext(spr_servo_skull_head, 0,27+_screen_width/2,165, 2, 2, 0, c_white, 1); +draw_sprite_ext(spr_servo_left_arm, 0, 27 + _screen_width, 165 + _screen_height / 3, 2, 2, 0, c_white, 1); +draw_sprite_ext(spr_servo_right_arm, 0, 27, 165 + _screen_height / 3, 2, 2, 0, c_white, 1); +draw_sprite_ext(spr_servo_skull_head, 0, 27 + _screen_width / 2, 165, 2, 2, 0, c_white, 1); -var system_string = target.name+" System"; -if (target.owner!=1) then draw_set_color(0); -if (target.owner = eFACTION.Player) then draw_set_color(c_blue); -if (target.craftworld=0) and (target.space_hulk=0){ - draw_text_transformed(184,180,system_string,1,1,0); +var system_string = target.name + " System"; +if (target.owner != 1) { + draw_set_color(0); +} +if (target.owner == eFACTION.Player) { + draw_set_color(c_blue); +} +if ((target.craftworld == 0) && (target.space_hulk == 0)) { + draw_text_transformed(184, 180, system_string, 1, 1, 0); } -if (target.craftworld=0) and (target.space_hulk=0){ +if ((target.craftworld == 0) && (target.space_hulk == 0)) { draw_set_color(global.star_name_colors[target.owner]); - draw_text_transformed(184,180,system_string,1,1,0); + draw_text_transformed(184, 180, system_string, 1, 1, 0); } - -if (global.cheat_debug && obj_controller.selecting_planet && !loading){ +if (global.cheat_debug && obj_controller.selecting_planet && !loading) { draw_planet_debug_options(); } - -if (obj_controller.menu == 0 && !debug){ - if (manage_units_button.draw(has_player_forces)){ - var _viewer = obj_controller.location_viewer +if (obj_controller.menu == 0 && !debug) { + if (manage_units_button.draw(has_player_forces)) { + var _viewer = obj_controller.location_viewer; _viewer.update_garrison_log(); var _unit_dispersement = _viewer.garrison_log; var _sys_name = target.name; - if (struct_exists(_unit_dispersement, target.name)){ - group_selection(_unit_dispersement[$ _sys_name].units,{ - purpose:$"{target.name} Management", - purpose_code : "manage", - number:0, - system:target.id, - feature:"none", - planet : 0, - selections : [] - }); + if (struct_exists(_unit_dispersement, target.name)) { + group_selection(_unit_dispersement[$ _sys_name].units, {purpose: $"{target.name} Management", purpose_code: "manage", number: 0, system: target.id, feature: "none", planet: 0, selections: []}); instance_destroy(); pop_draw_return_values(); exit; @@ -145,304 +145,275 @@ if (obj_controller.menu == 0 && !debug){ } } - -if (loading!=0){ +if (loading != 0) { draw_set_font(fnt_40k_14); draw_set_color(CM_GREEN_COLOR); - draw_text(184,202, - string_hash_to_newline("Select Destination")); + draw_text(184, 202, string_hash_to_newline("Select Destination")); } - //the draw and click on planets logic -if (!debug){ +if (!debug) { planet_selection_action(); } draw_set_font(fnt_40k_14b); -if (obj_controller.selecting_planet!=0){ - if (p_data.planet != obj_controller.selecting_planet){ +if (obj_controller.selecting_planet != 0) { + if (p_data.planet != obj_controller.selecting_planet) { delete p_data; p_data = new PlanetData(obj_controller.selecting_planet, target); } -// Buttons that are available - if (!buttons_selected){ - if (obj_controller.faction_status[eFACTION.Imperium] != "War" && p_data.current_owner > 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War" && p_data.at_war(0, 1, 1) && p_data.player_disposition <= 50) { - var is_enemy=true; + // Buttons that are available + if (!buttons_selected) { + if ((obj_controller.faction_status[eFACTION.Imperium] != "War" && p_data.current_owner > 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War" && p_data.at_war(0, 1, 1) && p_data.player_disposition <= 50)) { + var is_enemy = true; } else { - var is_enemy=false; + var is_enemy = false; } - if (p_data.planet>0){ - if (target.present_fleet[1]=0)/* and (target.p_type[obj_controller.selecting_planet]!="Dead")*/{ - if (p_data.player_forces>0){ - if (is_enemy){ - button1="Attack"; - button2="Purge"; + if (p_data.planet > 0) { + if (target.present_fleet[1] == 0) /* and (target.p_type[obj_controller.selecting_planet]!="Dead")*/ { + if (p_data.player_forces > 0) { + if (is_enemy) { + button1 = "Attack"; + button2 = "Purge"; } } } - if (target.present_fleet[1]>0)/* and (target.p_type[obj_controller.selecting_planet]!="Dead")*/{ + if (target.present_fleet[1] > 0) /* and (target.p_type[obj_controller.selecting_planet]!="Dead")*/ { if (is_enemy) { - button1="Attack"; - button2="Raid"; - button3="Bombard"; + button1 = "Attack"; + button2 = "Raid"; + button3 = "Bombard"; + } else { + button1 = "Attack"; + button2 = "Raid"; + button3 = "Purge"; } - else { - button1="Attack"; - button2="Raid"; - button3="Purge"; - } - - if (torpedo>0){ - var pfleet=instance_nearest(x,y,obj_p_fleet); - if (instance_exists(pfleet)) and (point_distance(pfleet.x,pfleet.y,target.x,target.y)<=40) and (pfleet.action=""){ - if (pfleet.capital_number+pfleet.frigate_number>0) and (button4="") then button4="Cyclonic Torpedo"; + + if (torpedo > 0) { + var pfleet = instance_nearest(x, y, obj_p_fleet); + if (instance_exists(pfleet) && (point_distance(pfleet.x, pfleet.y, target.x, target.y) <= 40) && (pfleet.action == "")) { + if ((pfleet.capital_number + pfleet.frigate_number > 0) && (button4 == "")) { + button4 = "Cyclonic Torpedo"; + } } } - } } var planet_upgrades = target.p_upgrades[obj_controller.selecting_planet]; - if (((p_data.planet_type=="Dead") or (array_length(p_data.upgrades)>0)) and ((target.present_fleet[1]>0) or (target.p_player[obj_controller.selecting_planet]>0))){ - if (array_length(p_data.features)==0) or (array_length(planet_upgrades)>0){ - + if (((p_data.planet_type == "Dead") || (array_length(p_data.upgrades) > 0)) && ((target.present_fleet[1] > 0) || (target.p_player[obj_controller.selecting_planet] > 0))) { + if ((array_length(p_data.features) == 0) || (array_length(planet_upgrades) > 0)) { chock = !p_data.xenos_and_heretics(); - if (chock==1){ - if (p_data.has_upgrade(P_features.Secret_Base)){ - button1="Base"; - }else if (p_data.has_upgrade(P_features.Arsenal)){ - button1="Arsenal"; - }else if (p_data.has_upgrade(P_features.Gene_Vault)){ - button1="Gene-Vault"; - }else if (array_length(p_data.upgrades)==0){ - button1="Build"; + if (chock == 1) { + if (p_data.has_upgrade(P_features.Secret_Base)) { + button1 = "Base"; + } else if (p_data.has_upgrade(P_features.Arsenal)) { + button1 = "Arsenal"; + } else if (p_data.has_upgrade(P_features.Gene_Vault)) { + button1 = "Gene-Vault"; + } else if (array_length(p_data.upgrades) == 0) { + button1 = "Build"; } - if (array_contains(["Build","Gene-Vault","Arsenal","Base"],button1)){ - button2=""; - button3=""; - button4=""; - button5=""; + if (array_contains(["Build", "Gene-Vault", "Arsenal", "Base"], button1)) { + button2 = ""; + button3 = ""; + button4 = ""; + button5 = ""; } } } } - - if (obj_controller.recruiting_worlds_bought>0 && !p_data.at_war()){ - if (!p_data.has_feature(P_features.Recruiting_World) && p_data.planet_type != "Dead" && !target.space_hulk){ - button4="+Recruiting"; + + if (obj_controller.recruiting_worlds_bought > 0 && !p_data.at_war()) { + if (!p_data.has_feature(P_features.Recruiting_World) && p_data.planet_type != "Dead" && !target.space_hulk) { + button4 = "+Recruiting"; } } - if (target.space_hulk){ - if (target.present_fleet[1]>0){ - button1="Raid"; - button2="Bombard"; - button3=""; - button4=""; + if (target.space_hulk) { + if (target.present_fleet[1] > 0) { + button1 = "Raid"; + button2 = "Bombard"; + button3 = ""; + button4 = ""; } } - buttons_selected=true; + buttons_selected = true; } - main_data_slate.inside_method = function(){ + main_data_slate.inside_method = function() { p_data.planet_info_screen(); - } - var slate_draw_scale = 420/850; - if (feature!=""){ - if (is_struct(feature)){ - feature.draw_planet_features(344+main_data_slate.width-4,165) - if (feature.remove){ - feature=""; - }else if (feature.destroy){ + }; + var slate_draw_scale = 420 / 850; + if (feature != "") { + if (is_struct(feature)) { + feature.draw_planet_features(344 + main_data_slate.width - 4, 165); + if (feature.remove) { + feature = ""; + } else if (feature.destroy) { feature = ""; instance_destroy(); pop_draw_return_values(); exit; } } - }else if (garrison!="" && !population){ - if (garrison.garrison_force ){ + } else if (garrison != "" && !population) { + if (garrison.garrison_force) { draw_set_font(fnt_40k_14); - if (!garrison.garrison_leader){ - garrison.find_leader() + if (!garrison.garrison_leader) { + garrison.find_leader(); garrison.garrison_disposition_change(target, obj_controller.selecting_planet, true); - garrison_data_slate.sub_title = $"Garrison Leader {garrison.garrison_leader.name_role()}" + garrison_data_slate.sub_title = $"Garrison Leader {garrison.garrison_leader.name_role()}"; garrison_data_slate.body_text = garrison.garrison_report(); } - garrison_data_slate.inside_method=function(){ - garrison_data_slate.title = "Garrison Report" + garrison_data_slate.inside_method = function() { + garrison_data_slate.title = "Garrison Report"; draw_set_color(c_gray); var xx = garrison_data_slate.XX; var yy = garrison_data_slate.YY; var cur_planet = obj_controller.selecting_planet; - var half_way = yy+garrison_data_slate.height/2; + var half_way = yy + garrison_data_slate.height / 2; draw_set_halign(fa_left); - draw_line(xx+10, half_way, garrison_data_slate.width-10, half_way); - var defence_data = determine_pdf_defence(target.p_pdf[cur_planet], garrison,target.p_fortified[cur_planet]); + draw_line(xx + 10, half_way, garrison_data_slate.width - 10, half_way); + var defence_data = determine_pdf_defence(target.p_pdf[cur_planet], garrison, target.p_fortified[cur_planet]); var defence_string = $"Planetary Defence : {defence_data[0]}"; - draw_text(xx+20, half_way, defence_string); - if (scr_hit(xx+20, half_way+10, xx+20+string_width(defence_string), half_way+10+20)){ + draw_text(xx + 20, half_way, defence_string); + if (scr_hit(xx + 20, half_way + 10, xx + 20 + string_width(defence_string), half_way + 10 + 20)) { tooltip_draw(defence_data[1], 400); } - if (garrison.dispo_change!="none"){ - if (garrison.dispo_change>55){ - draw_text(xx+20, half_way+30, $"Garrison Disposition Effect : Positive"); - } else if (garrison.dispo_change>44){ - draw_text(xx+20, half_way+30, $"Garrison Disposition Effect : Neutral"); - } else{ - draw_text(xx+20, half_way+30, $"Garrison Disposition Effect : Negative"); + if (garrison.dispo_change != "none") { + if (garrison.dispo_change > 55) { + draw_text(xx + 20, half_way + 30, $"Garrison Disposition Effect : Positive"); + } else if (garrison.dispo_change > 44) { + draw_text(xx + 20, half_way + 30, $"Garrison Disposition Effect : Neutral"); + } else { + draw_text(xx + 20, half_way + 30, $"Garrison Disposition Effect : Negative"); } } - } - garrison_data_slate.draw(340+main_data_slate.width, 160, 0.6, 0.6); - - } - } else if (population){ + }; + garrison_data_slate.draw(340 + main_data_slate.width, 160, 0.6, 0.6); + } + } else if (population) { garrison_data_slate.title = "Population Report"; - garrison_data_slate.inside_method = function(){ + garrison_data_slate.inside_method = function() { draw_set_color(c_gray); var xx = garrison_data_slate.XX; - var yy = garrison_data_slate.YY; + var yy = garrison_data_slate.YY; var cur_planet = obj_controller.selecting_planet; - var half_way = garrison_data_slate.height/2; - var spacing_x = 100 - var spacing_y = 65 + var half_way = garrison_data_slate.height / 2; + var spacing_x = 100; + var spacing_y = 65; draw_set_halign(fa_left); if (!target.space_hulk) { - if (obj_controller.faction_status[eFACTION.Imperium] != "War" && p_data.current_owner <= 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War") { - colonist_button.update({ - x1:xx+35, - y1:half_way, - allow_click : array_length(potential_doners), - }); + if ((obj_controller.faction_status[eFACTION.Imperium] != "War" && p_data.current_owner <= 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War")) { + colonist_button.update({x1: xx + 35, y1: half_way, allow_click: array_length(potential_doners)}); colonist_button.draw(); - recruiting_button.update({ - x1:xx+(spacing_x*2)+15, - y1:half_way, - allow_click : true, - }); + recruiting_button.update({x1: xx + (spacing_x * 2) + 15, y1: half_way, allow_click: true}); recruiting_button.draw(); if (p_data.has_feature(P_features.Recruiting_World)) { var _recruit_world = p_data.get_features(P_features.Recruiting_World)[0]; - if (_recruit_world.recruit_type == 0) && (obj_controller.faction_status[p_data.current_owner] != "War" && obj_controller.faction_status[p_data.current_owner] != "Antagonism" || p_data.player_disposition >= 50) { - draw_text(xx+(spacing_x*3)+35, half_way-20, "Open: Voluntery"); + if ((_recruit_world.recruit_type == 0) && (obj_controller.faction_status[p_data.current_owner] != "War" && obj_controller.faction_status[p_data.current_owner] != "Antagonism" || p_data.player_disposition >= 50)) { + draw_text(xx + (spacing_x * 3) + 35, half_way - 20, "Open: Voluntery"); } else if (_recruit_world.recruit_type == 0 && p_data.player_disposition <= 50) { - draw_text(xx+(spacing_x*3)+35, half_way-20, "Covert: Voluntery"); + draw_text(xx + (spacing_x * 3) + 35, half_way - 20, "Covert: Voluntery"); } else { - draw_text(xx+(spacing_x*3)+35, half_way-20, "Abduct"); + draw_text(xx + (spacing_x * 3) + 35, half_way - 20, "Abduct"); } - recruitment_type_button.update({ - x1:xx+(spacing_x*3)+35, - y1:half_way, - allow_click : true, - }); + recruitment_type_button.update({x1: xx + (spacing_x * 3) + 35, y1: half_way, allow_click: true}); recruitment_type_button.draw(); - draw_text(xx+(spacing_x*3)-15, half_way+(spacing_y)-20, $"Req:{_recruit_world.recruit_cost * 2}"); + draw_text(xx + (spacing_x * 3) - 15, half_way + spacing_y - 20, $"Req:{_recruit_world.recruit_cost * 2}"); if (_recruit_world.recruit_cost > 0) { - recruitment_costdown_button.update({ - x1:xx+(spacing_x*2)+35, - y1:half_way+(spacing_y), - allow_click : true, - }); + recruitment_costdown_button.update({x1: xx + (spacing_x * 2) + 35, y1: half_way + spacing_y, allow_click: true}); recruitment_costdown_button.draw(); } if (_recruit_world.recruit_cost < 5) { - recruitment_costup_button.update({ - x1:xx+(spacing_x*3)+35, - y1:half_way+(spacing_y), - allow_click : true, - }); + recruitment_costup_button.update({x1: xx + (spacing_x * 3) + 35, y1: half_way + spacing_y, allow_click: true}); recruitment_costup_button.draw(); } } } } - - } - garrison_data_slate.draw(344+main_data_slate.width-4, 160, 0.6, 0.6); - } - if (obj_controller.selecting_planet>0){ - main_data_slate.draw(344,160, slate_draw_scale, slate_draw_scale+0.1); + }; + garrison_data_slate.draw(344 + main_data_slate.width - 4, 160, 0.6, 0.6); } - var current_button=""; - var shutter_x = main_data_slate.XX-165; - var shutter_y = 296+165; - if (!debug){ - if (shutter_1.draw_shutter(shutter_x, shutter_y, button1, 0.5, true)) then current_button=button1; - if (shutter_2.draw_shutter(shutter_x, shutter_y+47, button2,0.5, true))then current_button=button2; - if (shutter_3.draw_shutter(shutter_x, shutter_y+(47*2), button3,0.5, true))then current_button=button3; - if (shutter_4.draw_shutter(shutter_x, shutter_y+(47*3), button4,0.5, true))then current_button=button4; + if (obj_controller.selecting_planet > 0) { + main_data_slate.draw(344, 160, slate_draw_scale, slate_draw_scale + 0.1); } - if (current_button!=""){ - if (array_contains(["Build","Base","Arsenal","Gene-Vault"],current_button)){ - var building=instance_create(x,y,obj_temp_build); - building.target=target; - building.planet=obj_controller.selecting_planet; - if (p_data.has_upgrade(P_features.Secret_Base)) then building.lair=1; - if (p_data.has_upgrade(P_features.Arsenal)) then building.arsenal=1; - if (p_data.has_upgrade(P_features.Gene_Vault)) then building.gene_vault=1; - obj_controller.temp[104]=string(scr_master_loc()); - obj_controller.menu=60; - with(obj_star_select){ + var current_button = ""; + var shutter_x = main_data_slate.XX - 165; + var shutter_y = 296 + 165; + if (!debug) { + if (shutter_1.draw_shutter(shutter_x, shutter_y, button1, 0.5, true)) { + current_button = button1; + } + if (shutter_2.draw_shutter(shutter_x, shutter_y + 47, button2, 0.5, true)) { + current_button = button2; + } + if (shutter_3.draw_shutter(shutter_x, shutter_y + (47 * 2), button3, 0.5, true)) { + current_button = button3; + } + if (shutter_4.draw_shutter(shutter_x, shutter_y + (47 * 3), button4, 0.5, true)) { + current_button = button4; + } + } + if (current_button != "") { + if (array_contains(["Build", "Base", "Arsenal", "Gene-Vault"], current_button)) { + var building = instance_create(x, y, obj_temp_build); + building.target = target; + building.planet = obj_controller.selecting_planet; + if (p_data.has_upgrade(P_features.Secret_Base)) { + building.lair = 1; + } + if (p_data.has_upgrade(P_features.Arsenal)) { + building.arsenal = 1; + } + if (p_data.has_upgrade(P_features.Gene_Vault)) { + building.gene_vault = 1; + } + obj_controller.temp[104] = string(scr_master_loc()); + obj_controller.menu = 60; + with (obj_star_select) { instance_destroy(); } - }else if (current_button=="Raid" && instance_nearest(x,y,obj_p_fleet).acted<=1){ - instance_create_layer(x, y, layer_get_all()[0], obj_drop_select,{ - p_target:target, - planet_number : obj_controller.selecting_planet, - sh_target:instance_nearest(x,y,obj_p_fleet), - purge:0, - }); - - }else if (current_button=="Attack"){ + } else if (current_button == "Raid" && instance_nearest(x, y, obj_p_fleet).acted <= 1) { + instance_create_layer(x, y, layer_get_all()[0], obj_drop_select, {p_target: target, planet_number: obj_controller.selecting_planet, sh_target: instance_nearest(x, y, obj_p_fleet), purge: 0}); + } else if (current_button == "Attack") { var _allow_attack = true; - var _targ = !target.present_fleet[1] ? -50 : instance_nearest(x,y,obj_p_fleet); - if (instance_exists(_targ)){ - if (_targ.acted>=2){ + var _targ = !target.present_fleet[1] ? -50 : instance_nearest(x, y, obj_p_fleet); + if (instance_exists(_targ)) { + if (_targ.acted >= 2) { _allow_attack = false; } } - if (_allow_attack){ - instance_create_layer(x, y, layer_get_all()[0], obj_drop_select,{ - p_target:target, - planet_number : obj_controller.selecting_planet, - attack :true, - sh_target : _targ, - purge:0, - }); - } - - }else if (current_button=="Purge"){ + if (_allow_attack) { + instance_create_layer(x, y, layer_get_all()[0], obj_drop_select, {p_target: target, planet_number: obj_controller.selecting_planet, attack: true, sh_target: _targ, purge: 0}); + } + } else if (current_button == "Purge") { var _allow_attack = true; - var _targ = !target.present_fleet[1] ? -50 : instance_nearest(x,y,obj_p_fleet); - if (instance_exists(_targ)){ - if (_targ.acted>=2){ + var _targ = !target.present_fleet[1] ? -50 : instance_nearest(x, y, obj_p_fleet); + if (instance_exists(_targ)) { + if (_targ.acted >= 2) { _allow_attack = false; } } - if (_allow_attack){ - instance_create_layer(x, y, layer_get_all()[0], obj_drop_select,{ - p_target:target, - purge:1, - planet_number : obj_controller.selecting_planet, - sh_target : _targ, - }); + if (_allow_attack) { + instance_create_layer(x, y, layer_get_all()[0], obj_drop_select, {p_target: target, purge: 1, planet_number: obj_controller.selecting_planet, sh_target: _targ}); } - - }else if (current_button=="Bombard"){ - instance_create(x,y,obj_bomb_select); - if (instance_exists(obj_bomb_select)){ - obj_bomb_select.p_target=target; - obj_bomb_select.sh_target=instance_nearest(x,y,obj_p_fleet); + } else if (current_button == "Bombard") { + instance_create(x, y, obj_bomb_select); + if (instance_exists(obj_bomb_select)) { + obj_bomb_select.p_target = target; + obj_bomb_select.sh_target = instance_nearest(x, y, obj_p_fleet); obj_bomb_select.p_data = p_data; - if (instance_nearest(x,y,obj_p_fleet).acted>0) then with(obj_bomb_select){ - instance_destroy(); + if (instance_nearest(x, y, obj_p_fleet).acted > 0) { + with (obj_bomb_select) { + instance_destroy(); + } } } - }else if (current_button=="+Recruiting"){ + } else if (current_button == "+Recruiting") { if (obj_controller.recruiting_worlds_bought > 0 && p_data.current_owner <= 5 && !p_data.at_war()) { if (!p_data.has_feature(P_features.Recruiting_World)) { if (obj_controller.faction_status[eFACTION.Imperium] == "War") { @@ -470,47 +441,45 @@ if (obj_controller.selecting_planet!=0){ // 135 ; popup? } } - }else if (current_button=="Cyclonic Torpedo"){ + } else if (current_button == "Cyclonic Torpedo") { scr_destroy_planet(2); } - } + } } - -if (target!=0){ - if (player_fleet>0) and (imperial_fleet+mechanicus_fleet+inquisitor_fleet+eldar_fleet+ork_fleet+tau_fleet+heretic_fleet>0){ +if (target != 0) { + if ((player_fleet > 0) && (imperial_fleet + mechanicus_fleet + inquisitor_fleet + eldar_fleet + ork_fleet + tau_fleet + heretic_fleet > 0)) { draw_set_color(0); draw_set_alpha(0.75); - draw_rectangle(37,413,270,452,0); + draw_rectangle(37, 413, 270, 452, 0); draw_set_alpha(1); - + /*draw_set_color(CM_GREEN_COLOR);draw_rectangle(40,247,253,273,1);*/ - - + draw_set_halign(fa_left); - - + draw_set_color(0); draw_set_font(fnt_40k_14b); - draw_text(37,413,"Select Fleet Combat"); - + draw_text(37, 413, "Select Fleet Combat"); + draw_set_color(CM_GREEN_COLOR); draw_set_font(fnt_40k_14b); - draw_text(37.5,413.5,"Select Fleet Combat"); - - var i,x3,y3;i=0; + draw_text(37.5, 413.5, "Select Fleet Combat"); + + var i, x3, y3; + i = 0; // x3=46;y3=252; - x3=49;y3=441; - - repeat(7){i+=1; - if (en_fleet[i]>0){ + x3 = 49; + y3 = 441; + + repeat (7) { + i += 1; + if (en_fleet[i] > 0) { // draw_sprite_ext(spr_force_icon,en_fleet[i],x3,y3,0.5,0.5,0,c_white,1); - scr_image("ui/force",en_fleet[i],x3-16,y3-16,32,32); - x3+=64; + scr_image("ui/force", en_fleet[i], x3 - 16, y3 - 16, 32, 32); + x3 += 64; } } - - } } @@ -518,5 +487,4 @@ pop_draw_return_values(); /* */ - /* */ diff --git a/objects/obj_star_select/Mouse_50.gml b/objects/obj_star_select/Mouse_50.gml index c015c64398..97df602ee7 100644 --- a/objects/obj_star_select/Mouse_50.gml +++ b/objects/obj_star_select/Mouse_50.gml @@ -1,235 +1,239 @@ var __b__; __b__ = action_if_number(obj_saveload, 0, 0); -if __b__ -{ -__b__ = action_if_number(obj_drop_select, 0, 0); -if __b__ -{ -__b__ = action_if_variable(obj_controller.diplomacy, 0, 0); -if __b__ -{ - -draw_set_font(fnt_fancy); -draw_set_halign(fa_center); -draw_set_color(0); +if (__b__) { + __b__ = action_if_number(obj_drop_select, 0, 0); + if (__b__) { + __b__ = action_if_variable(obj_controller.diplomacy, 0, 0); + if (__b__) { + draw_set_font(fnt_fancy); + draw_set_halign(fa_center); + draw_set_color(0); + + if (obj_controller.menu == 60) { + exit; + } -if (obj_controller.menu=60) then exit; + var xx, yy, dist, close; + xx = camera_get_view_x(view_camera[0]) + 0; + yy = camera_get_view_y(view_camera[0]) + 0; + dist = 999; + close = false; -var xx, yy, dist, close; -xx=__view_get( e__VW.XView, 0 )+0; -yy=__view_get( e__VW.YView, 0 )+0; -dist=999;close=false; + if (debug != 0) { + exit; + } + //TODO centralise this logic + if (instance_exists(obj_fleet_select)) { + if (obj_fleet_select.currently_entered) { + exit; + } + } + // Exit button + if ((mouse_x >= xx + 274) && (mouse_y >= yy + 426) && (mouse_x < xx + 337) && (mouse_y < yy + 451) && (obj_controller.cooldown <= 0)) { + if (!loading) { + obj_controller.sel_system_x = 0; + obj_controller.sel_system_y = 0; + obj_controller.popup = 0; + obj_controller.cooldown = 8000; + obj_controller.selecting_planet = 0; + instance_destroy(); + } else { + sel_plan = 0; + obj_controller.cooldown = 8000; + if (obj_controller.menu == 1 && obj_controller.view_squad) { + var company_data = obj_controller.company_data; + var squad_index = company_data.company_squads[company_data.cur_squad]; + var current_squad = obj_ini.squads[squad_index]; + if (sel_plan > 0) { + var planet = sel_plan; + for (var i = 0; i < array_length(target.p_operatives[planet]); i++) { + operation = target.p_operatives[planet][i]; + if (operation.type == "squad" && operation.reference == squad_index) { + array_delete(target.p_operatives[planet], i, 1); + } + } + } + current_squad.assignment = "none"; + } + instance_destroy(); + } + } + if ((obj_controller.cooldown <= 0) && (loading == 1)) {} -if (debug!=0) then exit; + attack = 0; + bombard = 0; + raid = 0; + purge = 0; - //TODO centralise this logic - if (instance_exists(obj_fleet_select)){ - if (obj_fleet_select.currently_entered) then exit; - } + if ((player_fleet > 0) && (imperial_fleet + mechanicus_fleet + inquisitor_fleet + eldar_fleet + ork_fleet + tau_fleet + heretic_fleet > 0) && (obj_controller.cooldown <= 0)) { + var i, x3, y3; + i = 0; + // x3=xx+46;y3=yy+252; + x3 = xx + 49; + y3 = yy + 441; + var combating = 0; -// Exit button -if (mouse_x>=xx+274) and (mouse_y>=yy+426) and (mouse_x0){ - var planet = sel_plan; - for (var i=0;i 0) && (mouse_x >= x3 - 24) && (mouse_y >= y3 - 24) && (mouse_x < x3 + 48) && (mouse_y < y3 + 48) && (obj_controller.cooldown <= 0)) { + obj_controller.cooldown = 8; + combating = en_fleet[i]; } - } - } - current_squad.assignment="none"; - } - instance_destroy(); - } -} + x3 += 64; + } -if (obj_controller.cooldown<=0) and (loading==1){ - -} + if (combating > 0) { + obj_controller.combat = combating; + + var xx = false, yy = false, good = false, e1 = false, e2 = false, e3 = false; + + var enemy_fleet = array_create(20, 0); + var allied_fleet = array_create(20, 0); + var ecap = array_create(20, 0); + var efri = array_create(20, 0); + var eesc = array_create(20, 0); + var acap = array_create(20, 0); + var afri = array_create(20, 0); + var aesc = array_create(20, 0); + + good = 1; + + var p_fleet = get_nearest_player_fleet(x, y, true); + + obj_controller.temp[1099] = target.name; + good = p_fleet != "none" && instance_exists(target); + + if (good == 1) { + // trying to find the star + instance_activate_object(obj_star); + obj_controller.x = target.x; + obj_controller.y = target.y; // show=current_battle; + + strin[1] = string(p_fleet.capital_number); + strin[2] = string(p_fleet.frigate_number); + strin[3] = string(p_fleet.escort_number); + // pull health values here + strin[4] = string(p_fleet.capital_health); + strin[5] = string(p_fleet.frigate_health); + strin[6] = string(p_fleet.escort_health); + + // pull enemy ships here + + var e = 1; + var khorne_count = 0; + var chaos_space_marine_count = 0; + var en_capitals, en_frigates, en_escorts; + repeat (9) { + e += 1; + if (target.present_fleet[e] > 0) { + obj_controller.temp[1070] = target.id; + obj_controller.temp[1071] = e; + en_capitals = 0; + en_frigates = 0; + en_escorts = 0; + + with (obj_en_fleet) { + if ((orbiting == obj_controller.temp[1070]) && (owner == obj_controller.temp[1071])) { + en_capitals += capital_number; + en_frigates += frigate_number; + en_escorts += escort_number; + if (fleet_has_cargo("warband")) { + khorne_count++; + } + if (fleet_has_cargo("csm")) { + chaos_space_marine_count++; + } + } + } + + var l1, l2; + l1 = 0; + l2 = 0; + if ((obj_controller.faction_status[e] != "War") && (e != combating)) { + repeat (10) { + l1 += 1; + if ((allied_fleet[l1] == 0) && (l2 == 0)) { + l2 = l1; + } + } + allied_fleet[l2] = e; + acap[l2] = en_capitals; + afri[l2] = en_frigates; + aesc[l2] = en_escorts; + } else if ((obj_controller.faction_status[e] == "War") || (e == 9) || (e == combating)) { + repeat (10) { + l1 += 1; + if ((enemy_fleet[l1] == 0) && (l2 == 0)) { + l2 = l1; + } + } + enemy_fleet[l2] = e; + ecap[l2] = en_capitals; + efri[l2] = en_frigates; + eesc[l2] = en_escorts; + } + } + } + obj_controller.cooldown = 8000; -attack=0;bombard=0;raid=0;purge=0; + // Start battle here -if (player_fleet>0) and (imperial_fleet+mechanicus_fleet+inquisitor_fleet+eldar_fleet+ork_fleet+tau_fleet+heretic_fleet>0) and (obj_controller.cooldown<=0){ - var i,x3,y3;i=0; - // x3=xx+46;y3=yy+252; - x3=xx+49;y3=yy+441; - - var combating=0; - - repeat(7){i+=1; - if (en_fleet[i]>0) and (mouse_x>=x3-24) and (mouse_y>=y3-24) and (mouse_x0){ - obj_controller.combat=combating; - - var xx=false, yy=false, good=false, e1=false,e2=false,e3=false; - - - var enemy_fleet = array_create(20, 0); - var allied_fleet = array_create(20, 0); - var ecap = array_create(20, 0); - var efri = array_create(20, 0); - var eesc = array_create(20, 0); - var acap = array_create(20, 0); - var afri = array_create(20, 0); - var aesc = array_create(20, 0); - - good=1; - - var p_fleet = get_nearest_player_fleet(x,y,true); - - obj_controller.temp[1099]=target.name; - good = (p_fleet!="none" and instance_exists(target)); - - if (good=1){// trying to find the star - instance_activate_object(obj_star); - obj_controller.x=target.x; - obj_controller.y=target.y;// show=current_battle; - - strin[1]=string(p_fleet.capital_number); - strin[2]=string(p_fleet.frigate_number); - strin[3]=string(p_fleet.escort_number); - // pull health values here - strin[4]=string(p_fleet.capital_health); - strin[5]=string(p_fleet.frigate_health); - strin[6]=string(p_fleet.escort_health); - - // pull enemy ships here - - var e=1; - var khorne_count=0; - var chaos_space_marine_count=0; - var en_capitals, en_frigates, en_escorts; - repeat(9){e+=1; - if (target.present_fleet[e]>0){ - obj_controller.temp[1070]=target.id; - obj_controller.temp[1071]=e; - en_capitals=0; - en_frigates=0; - en_escorts=0; - - with(obj_en_fleet){ - if (orbiting=obj_controller.temp[1070]) and (owner=obj_controller.temp[1071]){ - en_capitals+=capital_number; - en_frigates+=frigate_number; - en_escorts+=escort_number; - if (fleet_has_cargo("warband")) then khorne_count++; - if (fleet_has_cargo("csm")){ - chaos_space_marine_count++; - } + combating = 1; + + instance_deactivate_all(true); + instance_activate_object(obj_controller); + instance_activate_object(obj_ini); + // instance_activate_object(battle_object[current_battle]); + instance_activate_object(p_fleet); + instance_activate_object(obj_star); + + instance_create(0, 0, obj_fleet); + obj_fleet.star_name = target.name; + // + obj_fleet.enemy[1] = enemy_fleet[1]; + obj_fleet.enemy_status[1] = -1; + + obj_fleet.en_capital[1] = ecap[1]; + obj_fleet.en_frigate[1] = efri[1]; + obj_fleet.en_escort[1] = eesc[1]; + + // Plug in all of the enemies first + // And then plug in the allies after then with their status set to positive + + if (chaos_space_marine_count) { + obj_fleet.csm_exp = 1; } - } - - var l1,l2;l1=0;l2=0; - if (obj_controller.faction_status[e]!="War") and (e!=combating){ - repeat(10){ - l1+=1; - if (allied_fleet[l1]=0) and (l2=0) then l2=l1; + if (khorne_count) { + obj_fleet.csm_exp = 2; } - allied_fleet[l2]=e; - acap[l2]=en_capitals; - afri[l2]=en_frigates; - aesc[l2]=en_escorts; - }else if (obj_controller.faction_status[e]="War") or (e=9) or (e=combating){ - repeat(10){ - l1+=1; - if (enemy_fleet[l1]=0) and (l2=0) then l2=l1; + + for (var i = 0; i < target.planets; i++) { + if (planet_feature_bool(target.p_feature[i], P_features.Monastery) == 1) { + obj_fleet.player_lasers = target.p_lasers[i]; + } } - enemy_fleet[l2]=e; - ecap[l2]=en_capitals; - efri[l2]=en_frigates; - eesc[l2]=en_escorts; + instance_deactivate_object(obj_star); + + add_fleet_ships_to_combat(p_fleet, obj_fleet); + + // instance_deactivate_object(battle_object[current_battle]); + instance_deactivate_object(p_fleet); + + obj_controller.combat = 1; + obj_fleet.player_started = 1; + obj_fleet.pla_fleet = p_fleet; + obj_fleet.ene_fleet = target; } } } - - - obj_controller.cooldown=8000; - - // Start battle here - - combating=1; - - instance_deactivate_all(true); - instance_activate_object(obj_controller); - instance_activate_object(obj_ini); - // instance_activate_object(battle_object[current_battle]); - instance_activate_object(p_fleet); - instance_activate_object(obj_star); - - instance_create(0,0,obj_fleet); - obj_fleet.star_name=target.name; - // - obj_fleet.enemy[1]=enemy_fleet[1]; - obj_fleet.enemy_status[1]=-1; - - obj_fleet.en_capital[1]=ecap[1]; - obj_fleet.en_frigate[1]=efri[1]; - obj_fleet.en_escort[1]=eesc[1]; - - // Plug in all of the enemies first - // And then plug in the allies after then with their status set to positive - - if (chaos_space_marine_count){ - obj_fleet.csm_exp=1; - } - if (khorne_count){ - obj_fleet.csm_exp=2; - } - - - for (var i=0;i 0) { } if ((show == 0) && (obj_controller.zoomed == 0) && (current_popup == 0)) { - draw_sprite(spr_loading, image_index, __view_get(e__VW.XView, 0) + 23, __view_get(e__VW.YView, 0) + 73); + draw_sprite(spr_loading, image_index, camera_get_view_x(view_camera[0]) + 23, camera_get_view_y(view_camera[0]) + 73); } if ((show == 0) && (obj_controller.zoomed == 1) && (current_popup == 0)) { draw_sprite_ext(spr_loading, image_index, 40, 40, 2, 2, 0, c_white, 1); @@ -22,8 +22,8 @@ if ((show == 0) && (obj_controller.zoomed == 1) && (current_popup == 0)) { if ((show > 0) && (current_battle <= battles)) { var xxx, yyy, i; - xxx = __view_get(e__VW.XView, 0) + 535; - yyy = __view_get(e__VW.YView, 0) + 200; + xxx = camera_get_view_x(view_camera[0]) + 535; + yyy = camera_get_view_y(view_camera[0]) + 200; i = current_battle; draw_sprite(spr_purge_panel, 0, xxx, yyy); diff --git a/objects/obj_turn_end/Mouse_56.gml b/objects/obj_turn_end/Mouse_56.gml index 881f98d87b..b1370c81c7 100644 --- a/objects/obj_turn_end/Mouse_56.gml +++ b/objects/obj_turn_end/Mouse_56.gml @@ -14,8 +14,8 @@ if (__b__) { } var xxx, yyy; - xxx = __view_get(e__VW.XView, 0) + 535; - yyy = __view_get(e__VW.YView, 0) + 200; + xxx = camera_get_view_x(view_camera[0]) + 535; + yyy = camera_get_view_y(view_camera[0]) + 200; if ((cooldown <= 0) && (battle_world[current_battle] == -50) && (combating == 0)) { if ((mouse_x >= xxx + 132) && (mouse_y >= yyy + 354) && (mouse_x < xxx + 259) && (mouse_y < yyy + 389)) { diff --git a/scripts/__view_get/__view_get.gml b/scripts/__view_get/__view_get.gml deleted file mode 100644 index 665cc414d6..0000000000 --- a/scripts/__view_get/__view_get.gml +++ /dev/null @@ -1,33 +0,0 @@ -function __view_get(argument0, argument1) { - var __prop = argument0; - var __index = argument1; - var __cam = view_get_camera(__index); - - var __res = -1; - - switch(__prop) - { - case e__VW.XView: __cam = view_get_camera(__index); __res = camera_get_view_x(__cam); break; - case e__VW.YView: __cam = view_get_camera(__index); __res = camera_get_view_y(__cam); break; - case e__VW.WView: __cam = view_get_camera(__index); __res = camera_get_view_width(__cam); break; - case e__VW.HView: __cam = view_get_camera(__index); __res = camera_get_view_height(__cam); break; - case e__VW.Angle: __cam = view_get_camera(__index); __res = camera_get_view_angle(__cam); break; - case e__VW.HBorder: __cam = view_get_camera(__index); __res = camera_get_view_border_x(__cam); break; - case e__VW.VBorder: __cam = view_get_camera(__index); __res = camera_get_view_border_y(__cam); break; - case e__VW.HSpeed: __cam = view_get_camera(__index); __res = camera_get_view_speed_x(__cam); break; - case e__VW.VSpeed: __cam = view_get_camera(__index); __res = camera_get_view_speed_y(__cam); break; - case e__VW.Object: __cam = view_get_camera(__index); __res = camera_get_view_target(__cam); break; - case e__VW.Visible: __res = view_get_visible(__index); break; - case e__VW.XPort: __res = view_get_xport(__index); break; - case e__VW.YPort: __res = view_get_yport(__index); break; - case e__VW.WPort: __res = view_get_wport(__index); break; - case e__VW.HPort: __res = view_get_hport(__index); break; - case e__VW.Camera: __res = view_get_camera(__index); break; - case e__VW.SurfaceID: __res = view_get_surface_id(__index); break; - default: break; - }; - - return __res; - - -} diff --git a/scripts/__view_get/__view_get.yy b/scripts/__view_get/__view_get.yy deleted file mode 100644 index 3b7623ca91..0000000000 --- a/scripts/__view_get/__view_get.yy +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$GMScript":"v1", - "%Name":"__view_get", - "isCompatibility":true, - "isDnD":false, - "name":"__view_get", - "parent":{ - "name":"view", - "path":"folders/Scripts/compatibility/view.yy", - }, - "resourceType":"GMScript", - "resourceVersion":"2.0", -} \ No newline at end of file diff --git a/scripts/scr_company_struct/scr_company_struct.gml b/scripts/scr_company_struct/scr_company_struct.gml index 7eace95d2f..c5cd5ec332 100644 --- a/scripts/scr_company_struct/scr_company_struct.gml +++ b/scripts/scr_company_struct/scr_company_struct.gml @@ -1,559 +1,509 @@ - -function new_company_struct(){ - with (obj_controller){ - if (struct_exists(company_data,"company")){ - company_data.garbage_collect(); - delete company_data; - } - company_data = new CompanyStruct(managing); - - } +function new_company_struct() { + with (obj_controller) { + if (struct_exists(company_data, "company")) { + company_data.garbage_collect(); + delete company_data; + } + company_data = new CompanyStruct(managing); + } } -function CompanyStruct(comp) constructor{ - has_squads = true; - - if (comp == 0 || comp == -1){ - has_squads = false; - } - - unit_ui_panel = new DataSlate(); - unit_ui_panel.width = 572; - unit_ui_panel.height = 378; - unit_ui_panel.XX = 1008; - unit_ui_panel.YY = 141; - unit_ui_panel.set_width = true; - unit_ui_panel.style = "decorated"; - - company = comp; - company_squads = []; - tooltip_drawing = []; - static garbage_collect = function(){ - reset_squad_surface(); - delete next_squad_button; - delete mass_equip_toggle; - delete previous_squad_button; - delete reset_loadout_button; - delete sabotage_button; - delete garrison_button; - delete unit_ui_panel; - } - squad_location = ""; - static squad_search = function(){ - var _squads = obj_ini.squads; - //array_copy(_squads, 0, obj_ini.squads, 0, array_length(obj_ini.squads)); - if (company>=0){ - company_squads = []; - var cur_squad; - for (var i=0;i0 && _squads[i].base_company == company){ - array_push(company_squads,i); - } - } - } else if (company == -1){ - var _disp_units = obj_controller.display_unit; - for (var i=0; i0){ - array_push(company_squads,_unit.squad); - } - } else { - _unit.squad = "none"; - } - } - } - } - } - if (squad_location != ""){ - var _squads_len = array_length(company_squads); - for (var i=_squads_len-1;i>=0;i--){ - var _squad = fetch_squad(company_squads[i]); - var _squad_loc = _squad.squad_loci(); - if (_squad_loc.system != squad_location){ - array_delete(company_squads, i, 1); - } - } - } - has_squads = array_length(company_squads); - if (has_squads){ - obj_controller.unit_focus = fetch_squad(company_squads[0]).fetch_member(0); - } - } - - - var xx=__view_get( e__VW.XView, 0 )+0; - var yy=__view_get( e__VW.YView, 0 )+0; - center_width = [580,1005]; - center_height = [144,957]; - - previous_squad_button = new UnitButtonObject({ - x1 : xx+center_width[0], - y1 : yy+center_height[0]+6, - color:c_red, - label : "<--", - tooltip : "Press Left arrow to toggle" - }); - - next_squad_button = new UnitButtonObject({ - x1 : xx+center_width[1]-44, - y1 : yy+center_height[0]+6, - color:c_red, - label : "-->", - tooltip : "Press tab to toggle" - }); - - garrison_button = new UnitButtonObject({ - x1 : xx+center_width[0]+5, - y1 : yy+center_height[0]+150, - color:c_red, - label : "Garrison Duty", - tooltip : "Having squads assigned to Garrison Duty will increase relations with a planet over time, it will also bolster planet defence forces in case of attack, and reduce corruption growth. Press G to toggle" - }); - - sabotage_button = new UnitButtonObject({ - x1 : garrison_button.x2+5, - y1 : yy+center_height[0]+150, - color:c_red, - label : "Sabotage", - tooltip : "Sabotage missions can reduce enemy growth while avoiding direct enemy contact however they are not without risk." - }); - - reset_loadout_button = new UnitButtonObject({ - x1 : xx+center_width[0]+5, - y1 : yy+center_height[0]+330, - color:c_green, - label : "Reset Squad Loadout", - }); - - mass_equip_toggle = new ToggleButton({ - x1 : xx+center_width[0]+5, - y1 : yy+center_height[0]+380, - button_color:c_green, - text_color : c_green, - str1 : "Allow mass equip", - }); - - mass_equip_toggle.update(); - - static squad_selection_mode = function(){ - return (obj_controller.managing<0 && obj_controller.selection_data.select_type==MissionSelectType.Squads); - } - - - select_squad_button = new UnitButtonObject({ - x1 : xx+center_width[0]+5, - y1 : yy+center_height[0]+150, - color:c_red, - label : "Select Squad", - //tooltip : obj_controller.selection_data.purpose - }); - - selected_squads = []; - - - - static send_squad_on_mission = function(mission_type, star){ - with (star){ - var unload_squad=instance_create(x,y,obj_star_select); - unload_squad.target=self; - unload_squad.loading=1; - unload_squad.loading_name=name; - //unload_squad.loading_name=name; - unload_squad.depth=-10000; - unload_squad.mission=mission_type; - scr_company_load(name); - break; - } - - } - - static draw_squad_unit_sprites = function(){ - var member_width=0, member_height=0; - var x_mod=0,y_mod=0; - - var x_overlap_mod =0; - if (unit_rollover){ - if (scr_hit(xx+25, yy+144, xx+925, yy+981)){ - x_overlap_mod =180; - } else { - unit_rollover = !unit_rollover; - } - } else { - x_overlap_mod =90+(9*rollover_sequence); - } - var sprite_draw_delay="none" - var unit_sprite_coords=[]; - for (var i=0;i0){ - rollover_sequence--; - } - } - } - if (exit_period and !scr_hit(xx+25, yy+144, xx+525, yy+981)){ - exit_period=false; - } - } - - static draw_squad_assignment_options = function(){ - var _squad_sys = squad_loc.system; - if (current_squad.assignment == "none"){ - - draw_text_transformed(xx+bound_width[0]+5, yy+bound_height[0]+125, $"Squad has no current assignments",1,1,0); - - var send_on_mission=false, mission_type; - if (squad_loc.same_system) and (_squad_sys!="Warp" && _squad_sys!="Lost"){ - if (garrison_button.draw()){ - send_on_mission=true; - mission_type="garrison"; - } - - garrison_button.keystroke = press_exclusive(ord("G")); - if (array_contains(current_squad.class, "scout")) || (array_contains(current_squad.class, "bike")){ - if (sabotage_button.draw()){ - send_on_mission=true; - mission_type="sabotage"; - } - } - } - if (send_on_mission){ - send_squad_on_mission(mission_type,star_by_name(_squad_sys)); - } - bound_height[0] += 180; - } else { - if (is_struct(current_squad.assignment)){ - var cur_assignment = current_squad.assignment - draw_text_transformed(xx+bound_width[0]+5, yy+bound_height[0]+125, $"Assignment : {cur_assignment.type}",1,1,0); - var tooltip_text = "Cancel Assignment" - var cancel_but = draw_unit_buttons([xx+bound_width[0]+5, yy+bound_height[0]+150],tooltip_text,[1,1],c_red,,,,true); - if(point_and_click(cancel_but) || keyboard_check_pressed(ord("C"))){ - var cancel_system=noone; - with (obj_star){ - if (name == _squad_sys){ - cancel_system=self; - } - } - if (cancel_system!=noone){ - var planet = current_squad.assignment.ident; - var operation; - for (var i=0;i=array_length(company_squads) ? 0 : cur_squad+1; - } else { - cur_squad = (cur_squad-1<0) ? array_length(company_squads)-1 : cur_squad-1; - } - member = grab_current_squad().members[0]; - obj_controller.unit_focus = fetch_unit(member); - } - squad_search(); - - cur_squad = 0; - exit_period=false; - unit_rollover=false; - rollover_sequence=0; - selected_unit=obj_controller.unit_focus; - drop_down_open=false; - captain = "none"; - champion = "none"; - ancient = "none"; + +function CompanyStruct(comp) constructor { + has_squads = true; + + if (comp == 0 || comp == -1) { + has_squads = false; + } + + unit_ui_panel = new DataSlate(); + unit_ui_panel.width = 572; + unit_ui_panel.height = 378; + unit_ui_panel.XX = 1008; + unit_ui_panel.YY = 141; + unit_ui_panel.set_width = true; + unit_ui_panel.style = "decorated"; + + company = comp; + company_squads = []; + tooltip_drawing = []; + + static garbage_collect = function() { + reset_squad_surface(); + delete next_squad_button; + delete mass_equip_toggle; + delete previous_squad_button; + delete reset_loadout_button; + delete sabotage_button; + delete garrison_button; + delete unit_ui_panel; + }; + + squad_location = ""; + + static squad_search = function() { + var _squads = obj_ini.squads; + //array_copy(_squads, 0, obj_ini.squads, 0, array_length(obj_ini.squads)); + if (company >= 0) { + company_squads = []; + var cur_squad; + for (var i = 0; i < array_length(_squads); i++) { + cur_squad = _squads[i]; + if (cur_squad.base_company != company) { + continue; + } + cur_squad.update_fulfilment(); + if (array_length(_squads[i].members) > 0 && _squads[i].base_company == company) { + array_push(company_squads, i); + } + } + } else if (company == -1) { + var _disp_units = obj_controller.display_unit; + for (var i = 0; i < array_length(_disp_units); i++) { + var _unit = _disp_units[i]; + if (!is_array(_unit)) { + if (_unit.squad != "none") { + if (array_contains(company_squads, _unit.squad)) { + continue; + } + if (_unit.squad < array_length(obj_ini.squads)) { + var cur_squad = _squads[_unit.squad]; + cur_squad.update_fulfilment(); + if (array_length(cur_squad.members) > 0) { + array_push(company_squads, _unit.squad); + } + } else { + _unit.squad = "none"; + } + } + } + } + } + if (squad_location != "") { + var _squads_len = array_length(company_squads); + for (var i = _squads_len - 1; i >= 0; i--) { + var _squad = fetch_squad(company_squads[i]); + var _squad_loc = _squad.squad_loci(); + if (_squad_loc.system != squad_location) { + array_delete(company_squads, i, 1); + } + } + } + has_squads = array_length(company_squads); + if (has_squads) { + obj_controller.unit_focus = fetch_squad(company_squads[0]).fetch_member(0); + } + }; + + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0; + center_width = [580, 1005]; + center_height = [144, 957]; + + previous_squad_button = new UnitButtonObject({x1: xx + center_width[0], y1: yy + center_height[0] + 6, color: c_red, label: "<--", tooltip: "Press Left arrow to toggle"}); + + next_squad_button = new UnitButtonObject({x1: xx + center_width[1] - 44, y1: yy + center_height[0] + 6, color: c_red, label: "-->", tooltip: "Press tab to toggle"}); + + garrison_button = new UnitButtonObject({x1: xx + center_width[0] + 5, y1: yy + center_height[0] + 150, color: c_red, label: "Garrison Duty", tooltip: "Having squads assigned to Garrison Duty will increase relations with a planet over time, it will also bolster planet defence forces in case of attack, and reduce corruption growth. Press G to toggle"}); + + sabotage_button = new UnitButtonObject({x1: garrison_button.x2 + 5, y1: yy + center_height[0] + 150, color: c_red, label: "Sabotage", tooltip: "Sabotage missions can reduce enemy growth while avoiding direct enemy contact however they are not without risk."}); + + reset_loadout_button = new UnitButtonObject({x1: xx + center_width[0] + 5, y1: yy + center_height[0] + 330, color: c_green, label: "Reset Squad Loadout"}); + + mass_equip_toggle = new ToggleButton({x1: xx + center_width[0] + 5, y1: yy + center_height[0] + 380, button_color: c_green, text_color: c_green, str1: "Allow mass equip"}); + + mass_equip_toggle.update(); + + static squad_selection_mode = function() { + return obj_controller.managing < 0 && obj_controller.selection_data.select_type == MissionSelectType.Squads; + }; + + select_squad_button = new UnitButtonObject({ + x1: xx + center_width[0] + 5, + y1: yy + center_height[0] + 150, + color: c_red, + label: "Select Squad" + , //tooltip : obj_controller.selection_data.purpose + }); + + selected_squads = []; + + static send_squad_on_mission = function(mission_type, star) { + with (star) { + var unload_squad = instance_create(x, y, obj_star_select); + unload_squad.target = self; + unload_squad.loading = 1; + unload_squad.loading_name = name; + //unload_squad.loading_name=name; + unload_squad.depth = -10000; + unload_squad.mission = mission_type; + scr_company_load(name); + break; + } + }; + + static draw_squad_unit_sprites = function() { + var member_width = 0, member_height = 0; + var x_mod = 0, y_mod = 0; + + var x_overlap_mod = 0; + if (unit_rollover) { + if (scr_hit(xx + 25, yy + 144, xx + 925, yy + 981)) { + x_overlap_mod = 180; + } else { + unit_rollover = !unit_rollover; + } + } else { + x_overlap_mod = 90 + (9 * rollover_sequence); + } + var sprite_draw_delay = "none"; + var unit_sprite_coords = []; + for (var i = 0; i < array_length(current_squad.members); i++) { + member = fetch_unit(current_squad.members[i]); + if (!array_equals(squad_draw_surfaces[i][0], current_squad.members[i])) { + squad_draw_surfaces[i][0] = [member.company, member.marine_number]; + squad_draw_surfaces[i][1] = member.draw_unit_image(); + } + var cur_member_surface = squad_draw_surfaces[i][1]; + if (member.name() != "") { + if (member_width == 5) { + member_width = 0; + x_mod = 0; + member_height++; + y_mod += 231; + } + member_width++; + cur_member_surface.draw_part(xx + 25 + x_mod, yy + 144 + y_mod, 0, 0, 166, 231, true); + + if (cur_member_surface.hit() && !exit_period && unit_rollover) { + sprite_draw_delay = [member, cur_member_surface.box(), cur_member_surface]; + obj_controller.unit_focus = member; + } else { + if (obj_controller.unit_focus.company == member.company && obj_controller.unit_focus.marine_number == member.marine_number && !is_array(sprite_draw_delay)) { + sprite_draw_delay = [member, cur_member_surface.box(), cur_member_surface]; + obj_controller.unit_focus = member; + } + } + x_mod += x_overlap_mod; + } + } + if (is_array(sprite_draw_delay)) { + member = sprite_draw_delay[0]; + unit_sprite_coords = sprite_draw_delay[1]; + sprite_draw_delay[2].draw_part(unit_sprite_coords[0], unit_sprite_coords[1], 0, 0, 166, 231, true); + draw_set_color(c_red); + draw_rectangle(unit_sprite_coords[0], unit_sprite_coords[1], unit_sprite_coords[2], unit_sprite_coords[3], 1); + draw_set_color(c_gray); + if (mouse_check_button_pressed(mb_left)) { + unit_rollover = false; + exit_period = true; + } + } + if (!unit_rollover && !instance_exists(obj_star_select)) { + if (scr_hit(xx + 25, yy + 144, xx + 525, yy + 981) && !exit_period) { + if (rollover_sequence < 10) { + rollover_sequence++; + } else { + unit_rollover = true; + } + } else { + if (rollover_sequence > 0) { + rollover_sequence--; + } + } + } + if (exit_period && !scr_hit(xx + 25, yy + 144, xx + 525, yy + 981)) { + exit_period = false; + } + }; + + static draw_squad_assignment_options = function() { + var _squad_sys = squad_loc.system; + if (current_squad.assignment == "none") { + draw_text_transformed(xx + bound_width[0] + 5, yy + bound_height[0] + 125, $"Squad has no current assignments", 1, 1, 0); + + var send_on_mission = false, mission_type; + if (squad_loc.same_system && (_squad_sys != "Warp" && _squad_sys != "Lost")) { + if (garrison_button.draw()) { + send_on_mission = true; + mission_type = "garrison"; + } + + garrison_button.keystroke = press_exclusive(ord("G")); + if (array_contains(current_squad.class, "scout") || array_contains(current_squad.class, "bike")) { + if (sabotage_button.draw()) { + send_on_mission = true; + mission_type = "sabotage"; + } + } + } + if (send_on_mission) { + send_squad_on_mission(mission_type, star_by_name(_squad_sys)); + } + bound_height[0] += 180; + } else { + if (is_struct(current_squad.assignment)) { + var cur_assignment = current_squad.assignment; + draw_text_transformed(xx + bound_width[0] + 5, yy + bound_height[0] + 125, $"Assignment : {cur_assignment.type}", 1, 1, 0); + var tooltip_text = "Cancel Assignment"; + var cancel_but = draw_unit_buttons([xx + bound_width[0] + 5, yy + bound_height[0] + 150], tooltip_text, [1, 1], c_red,,,, true); + if (point_and_click(cancel_but) || keyboard_check_pressed(ord("C"))) { + var cancel_system = noone; + with (obj_star) { + if (name == _squad_sys) { + cancel_system = self; + } + } + if (cancel_system != noone) { + var planet = current_squad.assignment.ident; + var operation; + for (var i = 0; i < array_length(cancel_system.p_operatives[planet]); i++) { + operation = cancel_system.p_operatives[planet][i]; + if (operation.type == "squad" && operation.reference == company_squads[cur_squad]) { + array_delete(cancel_system.p_operatives[planet], i, 1); + } + } + } + current_squad.assignment = "none"; + } + bound_height[0] += 180; + if (cur_assignment.type == "garrison") { + var garrison_but = draw_unit_buttons([cancel_but[2] + 10, cancel_but[1]], "View Garrison", [1, 1], c_red,,,, true); + if (point_and_click(garrison_but)) { + var garrrison_star = star_by_name(cur_assignment.location); + obj_controller.view_squad = false; + if (garrrison_star != "none") { + scr_toggle_manage(); + obj_controller.x = garrrison_star.x; + obj_controller.y = garrrison_star.y; + obj_controller.selection_data = { + system: garrrison_star.id, + planet: cur_assignment.ident, + feature: "", + }; + garrrison_star.alarm[3] = 4; + } + } + } + } + } + }; + + next_squad = function(up = true) { + if (up) { + cur_squad = cur_squad + 1 >= array_length(company_squads) ? 0 : cur_squad + 1; + } else { + cur_squad = (cur_squad - 1 < 0) ? array_length(company_squads) - 1 : cur_squad - 1; + } + member = grab_current_squad().members[0]; + obj_controller.unit_focus = fetch_unit(member); + }; + squad_search(); + + cur_squad = 0; + exit_period = false; + unit_rollover = false; + rollover_sequence = 0; + selected_unit = obj_controller.unit_focus; + drop_down_open = false; + captain = "none"; + champion = "none"; + ancient = "none"; chaplain = "none"; apothecary = "none"; - tech_marine = "none"; - lib = "none"; - - static reset_squad_surface = function(){ - if (is_array(squad_draw_surfaces)){ - for (var i=0;i0 && company<11){ - var _unit; - var company_units = obj_controller.display_unit; - var role_set = obj_ini.role[100]; - for (var i=0;i 0){ - if (selected_unit.company == company || company ==-1){ - if (company_squads[cur_squad] != selected_unit.squad){ - var squad_found =false - for (var i =0;i 0){ - if (previous_squad_button.draw()){ - next_squad(false); - } - if (next_squad_button.draw()){ - next_squad(); - } - } - - draw_set_color(c_gray); - draw_set_alpha(1); - draw_set_halign(fa_center); - draw_text_transformed(xx+bound_width[0]+((bound_width[1]-bound_width[0])/2)-6, yy+bound_height[0]+6,$"{selected_unit.squad} {current_squad.display_name}",1.5,1.5,0); - if (current_squad.nickname!=""){ - draw_text_transformed(xx+bound_width[0]+((bound_width[1]-bound_width[0])/2), yy+bound_height[0]+30,$"{current_squad.display_name}",1.5,1.5,0); - } - - draw_set_halign(fa_left); - //should be moved elsewhere for efficiency - squad_leader = current_squad.determine_leader(); - if (squad_leader != "none"){ - var leader_text = $"Squad Leader : {fetch_unit(squad_leader).name_role()}" - draw_text_transformed(xx+bound_width[0]+5, yy+bound_height[0]+50, leader_text,1,1,0); - } - squad_loc = current_squad.squad_loci(); - draw_text_transformed(xx+bound_width[0]+5, yy+bound_height[0]+75, $"Squad Members : {current_squad.life_members}",1,1,0); - draw_text_transformed(xx+bound_width[0]+5, yy+bound_height[0]+100, $"Squad Location : {squad_loc.text}",1,1,0); - - if (!squad_selection_mode()){ - draw_squad_assignment_options(); - } else { - var _select_action = false; - if (array_contains(selected_squads, company_squads[cur_squad])){ - select_squad_button.update({ - color:c_red, - label : "De-select Squad", - x1 : xx+center_width[0]+5, - y1 : yy+center_height[0]+150, - }); - } else { - - select_squad_button.update({ - color:c_green, - label : "Select Squad", - tooltip : obj_controller.selection_data.purpose, - x1 : xx+center_width[0]+5, - y1 : yy+center_height[0]+150, - }); - _select_action = true; - } - if (select_squad_button.draw()){ - if (_select_action){ - array_push(selected_squads, company_squads[cur_squad]) - } else { - array_delete(selected_squads, array_find_value(selected_squads, company_squads[cur_squad]), 1); - } - } - } - bound_height[0] += 125; - previous_squad_button.keystroke = press_exclusive(vk_left); - next_squad_button.keystroke = press_exclusive(vk_tab); - //TODO compartmentalise drop down option logic - var deploy_text = "Squad will deploy in the"; - if (current_squad.formation_place!=""){ - //draw_set_font(fnt_40k_14b) - draw_text_transformed(xx+bound_width[0]+5, yy+bound_height[0], deploy_text,1,1,0); - button = draw_unit_buttons([xx+bound_width[0]+5 + string_width(deploy_text), yy+bound_height[0]-2],current_squad.formation_place,[1,1],c_green,,,,true); - draw_set_color(c_red); - draw_text_transformed(xx+bound_width[0]+5+ string_width(deploy_text) + string_width(current_squad.formation_place)+9, yy+bound_height[0], "column",1,1,0); - draw_set_color(c_gray); - if (array_length(current_squad.formation_options)>1){ - if (scr_hit(button)){ - drop_down_open = true; - } - if (drop_down_open){ - var roll_down_offset=8+string_height(current_squad.formation_place); - for (var col = 0;col 0 && company < 11) { + var _unit; + var company_units = obj_controller.display_unit; + var role_set = obj_ini.role[100]; + for (var i = 0; i < array_length(company_units); i++) { + if (is_struct(company_units[i])) { + _unit = company_units[i]; + if (_unit.role() == role_set[eROLE.Captain]) { + captain = _unit; + } else if (_unit.role() == role_set[eROLE.Ancient]) { + ancient = _unit; + } else if (_unit.role() == role_set[eROLE.Champion]) { + champion = _unit; + } else { + if (_unit.IsSpecialist(SPECIALISTS_CHAPLAINS)) { + chaplain = _unit; + } + if (_unit.IsSpecialist(SPECIALISTS_APOTHECARIES)) { + apothecary = _unit; + } + if (_unit.IsSpecialist(SPECIALISTS_TECHS)) { + tech_marine = _unit; + } + if (_unit.IsSpecialist(SPECIALISTS_LIBRARIANS)) { + lib = _unit; + } + } + } + } + } + + static grab_current_squad = function() { + return obj_ini.squads[company_squads[cur_squad]]; + }; + + static default_member = function() { + var member = obj_ini.squads[company_squads[0]].members[0]; + obj_controller.unit_focus = fetch_unit(member); + selected_unit = obj_controller.unit_focus; + }; + + static draw_squad_view = function() { + center_width = [580, 1005]; + center_height = [144, 957]; + xx = camera_get_view_x(view_camera[0]) + 0; + yy = camera_get_view_y(view_camera[0]) + 0; + var member; + selected_unit = obj_controller.unit_focus; + if (array_length(company_squads) > 0) { + if (selected_unit.company == company || company == -1) { + if (company_squads[cur_squad] != selected_unit.squad) { + var squad_found = false; + for (var i = 0; i < array_length(company_squads); i++) { + if (company_squads[i] == selected_unit.squad) { + cur_squad = i; + squad_found = true; + break; + } + } + if (!squad_found) { + default_member(); + } + } + } else { + default_member(); + } + } else if (obj_controller.view_squad) { + obj_controller.view_squad = false; + obj_controller.unit_profile = false; + } + if (selected_unit.squad == "none") { + default_member(); + } else { + current_squad = obj_ini.squads[selected_unit.squad]; + bound_width = center_width; + bound_height = center_height; + draw_set_halign(fa_left); + + if (array_length(company_squads) > 0) { + if (previous_squad_button.draw()) { + next_squad(false); + } + if (next_squad_button.draw()) { + next_squad(); + } + } + + draw_set_color(c_gray); + draw_set_alpha(1); + draw_set_halign(fa_center); + draw_text_transformed(xx + bound_width[0] + ((bound_width[1] - bound_width[0]) / 2) - 6, yy + bound_height[0] + 6, $"{selected_unit.squad} {current_squad.display_name}", 1.5, 1.5, 0); + if (current_squad.nickname != "") { + draw_text_transformed(xx + bound_width[0] + ((bound_width[1] - bound_width[0]) / 2), yy + bound_height[0] + 30, $"{current_squad.display_name}", 1.5, 1.5, 0); + } + + draw_set_halign(fa_left); + //should be moved elsewhere for efficiency + squad_leader = current_squad.determine_leader(); + if (squad_leader != "none") { + var leader_text = $"Squad Leader : {fetch_unit(squad_leader).name_role()}"; + draw_text_transformed(xx + bound_width[0] + 5, yy + bound_height[0] + 50, leader_text, 1, 1, 0); + } + squad_loc = current_squad.squad_loci(); + draw_text_transformed(xx + bound_width[0] + 5, yy + bound_height[0] + 75, $"Squad Members : {current_squad.life_members}", 1, 1, 0); + draw_text_transformed(xx + bound_width[0] + 5, yy + bound_height[0] + 100, $"Squad Location : {squad_loc.text}", 1, 1, 0); + + if (!squad_selection_mode()) { + draw_squad_assignment_options(); + } else { + var _select_action = false; + if (array_contains(selected_squads, company_squads[cur_squad])) { + select_squad_button.update({color: c_red, label: "De-select Squad", x1: xx + center_width[0] + 5, y1: yy + center_height[0] + 150}); + } else { + select_squad_button.update({color: c_green, label: "Select Squad", tooltip: obj_controller.selection_data.purpose, x1: xx + center_width[0] + 5, y1: yy + center_height[0] + 150}); + _select_action = true; + } + if (select_squad_button.draw()) { + if (_select_action) { + array_push(selected_squads, company_squads[cur_squad]); + } else { + array_delete(selected_squads, array_find_value(selected_squads, company_squads[cur_squad]), 1); + } + } + } + bound_height[0] += 125; + previous_squad_button.keystroke = press_exclusive(vk_left); + next_squad_button.keystroke = press_exclusive(vk_tab); + //TODO compartmentalise drop down option logic + var deploy_text = "Squad will deploy in the"; + if (current_squad.formation_place != "") { + //draw_set_font(fnt_40k_14b) + draw_text_transformed(xx + bound_width[0] + 5, yy + bound_height[0], deploy_text, 1, 1, 0); + button = draw_unit_buttons([xx + bound_width[0] + 5 + string_width(deploy_text), yy + bound_height[0] - 2], current_squad.formation_place, [1, 1], c_green,,,, true); + draw_set_color(c_red); + draw_text_transformed(xx + bound_width[0] + 5 + string_width(deploy_text) + string_width(current_squad.formation_place) + 9, yy + bound_height[0], "column", 1, 1, 0); + draw_set_color(c_gray); + if (array_length(current_squad.formation_options) > 1) { + if (scr_hit(button)) { + drop_down_open = true; + } + if (drop_down_open) { + var roll_down_offset = 8 + string_height(current_squad.formation_place); + for (var col = 0; col < array_length(current_squad.formation_options); col++) { + if (current_squad.formation_options[col] == current_squad.formation_place) { + continue; + } + button = draw_unit_buttons([button[0], button[3] + 2], current_squad.formation_options[col], [1, 1], c_red,,,, true); + if (point_and_click(button)) { + current_squad.formation_place = current_squad.formation_options[col]; + drop_down_open = false; + } + roll_down_offset += string_height(current_squad.formation_options[col]) + 4; + } + if (!scr_hit(xx + bound_width[0] + 5 + string_width(deploy_text), yy + bound_height[0], xx + bound_width[0] + 13 + string_width(deploy_text) + string_width(current_squad.formation_place), yy + bound_height[0] + roll_down_offset)) { + drop_down_open = false; + } + } + } + bound_height[0] += button[3] - button[1]; + } + + if (reset_loadout_button.draw()) { + current_squad.sort_squad_loadout(); + reset_squad_surface(); + } + + mass_equip_toggle.active = current_squad.allow_bulk_swap; + mass_equip_toggle.clicked(); + mass_equip_toggle.draw(); + current_squad.allow_bulk_swap = mass_equip_toggle.active; + + draw_squad_unit_sprites(); + } + }; } diff --git a/scripts/scr_company_view/scr_company_view.gml b/scripts/scr_company_view/scr_company_view.gml index 69a3927bd3..162f3b6519 100644 --- a/scripts/scr_company_view/scr_company_view.gml +++ b/scripts/scr_company_view/scr_company_view.gml @@ -13,27 +13,27 @@ function reset_ship_manage_arrays() { function reset_manage_arrays() { with (obj_controller) { - display_unit=[]; - man=[]; - ide=[]; - man_sel=[]; - ma_lid=[]; - ma_wid=[]; - ma_race=[]; - ma_loc=[]; - ma_name=[]; - ma_role=[]; - ma_gear=[]; - ma_mobi=[]; - ma_wep1=[]; - ma_wep2=[]; - ma_armour=[]; - ma_health=[]; - ma_health_string=[]; - ma_chaos=[]; - ma_exp=[]; - ma_promote=[]; - ma_god=[]; + display_unit = []; + man = []; + ide = []; + man_sel = []; + ma_lid = []; + ma_wid = []; + ma_race = []; + ma_loc = []; + ma_name = []; + ma_role = []; + ma_gear = []; + ma_mobi = []; + ma_wep1 = []; + ma_wep2 = []; + ma_armour = []; + ma_health = []; + ma_health_string = []; + ma_chaos = []; + ma_exp = []; + ma_promote = []; + ma_god = []; ma_view = []; squad = []; } @@ -41,103 +41,102 @@ function reset_manage_arrays() { reset_ship_manage_arrays(); } -function find_company_open_slot(target_company){ - good = -1; - for (var i = 0;i-1){ - array_push(ma_loc,obj_ini.ship_location[obj_ini.veh_lid[unit[0]][unit[1]]]); - } else { - array_push(ma_loc,obj_ini.veh_loc[unit[0]][unit[1]]); - } - array_push(ma_name ,""); - array_push(ma_role,obj_ini.veh_role[unit[0]][unit[1]]); - array_push(ma_wep1,obj_ini.veh_wep1[unit[0]][unit[1]]); - array_push(ma_wep2,obj_ini.veh_wep2[unit[0]][unit[1]]); - array_push(ma_armour,obj_ini.veh_wep3[unit[0]][unit[1]]); - array_push(ma_gear,obj_ini.veh_upgrade[unit[0]][unit[1]]); - array_push(ma_health,obj_ini.veh_hp[unit[0]][unit[1]]); - var _percent = round((obj_ini.veh_hp[unit[0]][unit[1]] / 100) * 100); +function add_vehicle_to_manage_arrays(unit) { + with (obj_controller) { + array_push(display_unit, unit); + array_push(man, "vehicle"); + array_push(ide, unit[1]); + array_push(man_sel, 0); + array_push(ma_lid, obj_ini.veh_lid[unit[0]][unit[1]]); + array_push(ma_wid, obj_ini.veh_wid[unit[0]][unit[1]]); + array_push(ma_race, obj_ini.veh_race[unit[0]][unit[1]]); + if (obj_ini.veh_lid[unit[0]][unit[1]] > -1) { + array_push(ma_loc, obj_ini.ship_location[obj_ini.veh_lid[unit[0]][unit[1]]]); + } else { + array_push(ma_loc, obj_ini.veh_loc[unit[0]][unit[1]]); + } + array_push(ma_name, ""); + array_push(ma_role, obj_ini.veh_role[unit[0]][unit[1]]); + array_push(ma_wep1, obj_ini.veh_wep1[unit[0]][unit[1]]); + array_push(ma_wep2, obj_ini.veh_wep2[unit[0]][unit[1]]); + array_push(ma_armour, obj_ini.veh_wep3[unit[0]][unit[1]]); + array_push(ma_gear, obj_ini.veh_upgrade[unit[0]][unit[1]]); + array_push(ma_health, obj_ini.veh_hp[unit[0]][unit[1]]); + var _percent = round((obj_ini.veh_hp[unit[0]][unit[1]] / 100) * 100); array_push(ma_health_string, $"{_percent}% HP"); - array_push(ma_mobi,obj_ini.veh_acc[unit[0]][unit[1]]); - array_push(ma_chaos,0); - array_push(ma_exp,0); - array_push(ma_promote,0); - array_push(ma_god,0); - array_push(ma_view,true); - array_push(squad, -1); - } + array_push(ma_mobi, obj_ini.veh_acc[unit[0]][unit[1]]); + array_push(ma_chaos, 0); + array_push(ma_exp, 0); + array_push(ma_promote, 0); + array_push(ma_god, 0); + array_push(ma_view, true); + array_push(squad, -1); + } } - function scr_company_view(company) { - if (company < 0 || company > 10){ + if (company < 0 || company > 10) { var error_message = $"scr_company_view passed bad company:\n{company}"; show_error(error_message, true); - }; + } var mans, squads, squad_type, squad_loc, squad_members, unit, unit_loc; mans = 0; @@ -161,10 +160,7 @@ function scr_company_view(company) { unit_loc = unit.marine_location(); // Check if unit is on a lost ship - if ( - unit_loc[0] == location_types.ship && - obj_ini.ship_location[unit_loc[1]] == "Lost" - ) { + if (unit_loc[0] == location_types.ship && obj_ini.ship_location[unit_loc[1]] == "Lost") { continue; } @@ -198,26 +194,23 @@ function scr_company_view(company) { } // Check if unit is on a lost ship - if ( - obj_ini.veh_lid[company][i] > -1 && - obj_ini.ship_location[obj_ini.veh_lid[company][i]] == "Lost" - ) { - continue + if (obj_ini.veh_lid[company][i] > -1 && obj_ini.ship_location[obj_ini.veh_lid[company][i]] == "Lost") { + continue; } add_vehicle_to_manage_arrays([company, i]); // Select All Vehicle Setup var go = 0, op = 0; - for (var p = 0; p < 20; p++){ - if (sel_veh[p] == "" && op == 0){ + for (var p = 0; p < 20; p++) { + if (sel_veh[p] == "" && op == 0) { op = p; } - if (sel_veh[p] == obj_ini.veh_role[company][i]){ + if (sel_veh[p] == obj_ini.veh_role[company][i]) { go = 1; } } - if (go == 0){ + if (go == 0) { sel_veh[op] = obj_ini.veh_role[company][i]; } } @@ -338,7 +331,7 @@ function other_manage_data() { } if (_unit.company > -1 && _unit.IsSpecialist(SPECIALISTS_RANK_AND_FILE)) { - var _target_company = 0; + var _target_company = 0; if (_unit.company >= 8) { _target_company = _unit.company - 1; } else if (_unit.company >= 6) { @@ -347,7 +340,7 @@ function other_manage_data() { _target_company = 1; } - var _company_promotion_limits = [0, 100, 65, 65, 65, 65, 45, 45, 35, 25, 0]; + var _company_promotion_limits = [0, 100, 65, 65, 65, 65, 45, 45, 35, 25, 0]; var _promotion_limit = _company_promotion_limits[_target_company]; if (_unit.experience >= _promotion_limit && _promotion_limit > 0) { ma_promote[v] = 1; @@ -363,180 +356,179 @@ function other_manage_data() { } } -function filter_and_sort_company(type, specific){ - var i ,j, limit; - function switchy(a, b){ +function filter_and_sort_company(type, specific) { + var i, j, limit; + function switchy(a, b) { var tempman = man[a]; - var tempide =ide[a]; - var tempsel =man_sel[a]; - var templid =ma_lid[a]; - var tempwid =ma_wid[a]; - var temprace =ma_race[a]; - var temploc =ma_loc[a]; - var tempname =ma_name[a]; - var temprole =ma_role[a]; - var tempwep =ma_wep1[a]; - var tempwep2 =ma_wep2[a]; - var temparm =ma_armour[a]; - var temphealth =ma_health[a]; - var tempcha =ma_chaos[a]; - var tempexp =ma_exp[a]; - var tempprom =ma_promote[a]; - var tempdis =display_unit[a]; + var tempide = ide[a]; + var tempsel = man_sel[a]; + var templid = ma_lid[a]; + var tempwid = ma_wid[a]; + var temprace = ma_race[a]; + var temploc = ma_loc[a]; + var tempname = ma_name[a]; + var temprole = ma_role[a]; + var tempwep = ma_wep1[a]; + var tempwep2 = ma_wep2[a]; + var temparm = ma_armour[a]; + var temphealth = ma_health[a]; + var tempcha = ma_chaos[a]; + var tempexp = ma_exp[a]; + var tempprom = ma_promote[a]; + var tempdis = display_unit[a]; var tempview = ma_view[a]; - var temp_squad = squad[a] - - man[a]=man[b]; - ide[a]=ide[b]; - man_sel[a]=man_sel[b]; - ma_lid[a]=ma_lid[b]; - ma_wid[a]= ma_wid[b]; - ma_race[a]=ma_race[b]; - ma_loc[a]=ma_loc[b]; - ma_name[a]= ma_name[b]; - ma_role[a]=ma_role[b]; - ma_wep1[a]= ma_wep1[b]; - ma_wep2[a]= ma_wep2[b]; - ma_armour[a]=ma_armour[b]; - ma_health[a]=ma_health[b]; - ma_chaos[a]=ma_chaos[b]; - ma_exp[a]=ma_exp[b]; - ma_promote[a]=ma_promote[b]; - display_unit[a] =display_unit[b]; - ma_view[a] =ma_view[b]; - squad[a] = squad[b] - - man[b]=tempman; - ide[b]=tempide; - man_sel[b]=tempsel; - ma_lid[b]=templid; - ma_wid[b]= tempwid; - ma_race[b]=temprace; - ma_loc[b]= temploc; - ma_name[b]= tempname; - ma_role[b]=temprole; - ma_wep1[b]= tempwep; - ma_wep2[b]= tempwep2; - ma_armour[b]= temparm; - ma_health[b]= temphealth; - ma_chaos[b]= tempcha; - ma_exp[b]= tempexp; - ma_promote[b]= tempprom; - display_unit[b] = tempdis; + var temp_squad = squad[a]; + + man[a] = man[b]; + ide[a] = ide[b]; + man_sel[a] = man_sel[b]; + ma_lid[a] = ma_lid[b]; + ma_wid[a] = ma_wid[b]; + ma_race[a] = ma_race[b]; + ma_loc[a] = ma_loc[b]; + ma_name[a] = ma_name[b]; + ma_role[a] = ma_role[b]; + ma_wep1[a] = ma_wep1[b]; + ma_wep2[a] = ma_wep2[b]; + ma_armour[a] = ma_armour[b]; + ma_health[a] = ma_health[b]; + ma_chaos[a] = ma_chaos[b]; + ma_exp[a] = ma_exp[b]; + ma_promote[a] = ma_promote[b]; + display_unit[a] = display_unit[b]; + ma_view[a] = ma_view[b]; + squad[a] = squad[b]; + + man[b] = tempman; + ide[b] = tempide; + man_sel[b] = tempsel; + ma_lid[b] = templid; + ma_wid[b] = tempwid; + ma_race[b] = temprace; + ma_loc[b] = temploc; + ma_name[b] = tempname; + ma_role[b] = temprole; + ma_wep1[b] = tempwep; + ma_wep2[b] = tempwep2; + ma_armour[b] = temparm; + ma_health[b] = temphealth; + ma_chaos[b] = tempcha; + ma_exp[b] = tempexp; + ma_promote[b] = tempprom; + display_unit[b] = tempdis; ma_view[b] = tempview; squad[b] = temp_squad; - } - if (type=="stat"){ - var swapped; - with (obj_controller){ - for (i = 0; i=0){ - if (struct_exists(company_data, "reset_squad_surface")){ - company_data.reset_squad_surface(); - } - } - scr_ui_refresh(); - - managing = new_view; - if (new_view != 0 ){ - with(obj_managment_panel){instance_destroy();} - } - if (new_view>10){ - view_squad=false; - scr_special_view(new_view); - } else { - with (obj_ini){ - scr_company_order(new_view); - } - scr_company_view(new_view); - } +function switch_view_company(new_view) { + with (obj_controller) { + if (new_view < 1) { + exit; + } + filter_mode = false; + text_bar = 0; + if (managing <= 10 && managing >= 0) { + if (struct_exists(company_data, "reset_squad_surface")) { + company_data.reset_squad_surface(); + } + } + scr_ui_refresh(); + + managing = new_view; + if (new_view != 0) { + with (obj_managment_panel) { + instance_destroy(); + } + } + if (new_view > 10) { + view_squad = false; + scr_special_view(new_view); + } else { + with (obj_ini) { + scr_company_order(new_view); + } + scr_company_view(new_view); + } new_company_struct(); - } + } } -function company_manage_actions(){ - var onceh=0; - var xx=__view_get( e__VW.XView, 0 ); - var yy=__view_get( e__VW.YView, 0 ); + +function company_manage_actions() { + var onceh = 0; + var xx = camera_get_view_x(view_camera[0]); + var yy = camera_get_view_y(view_camera[0]); // Back out from company - if (point_and_click([xx+23,yy+80,xx+95,yy+128])){ - managing=0; + if (point_and_click([xx + 23, yy + 80, xx + 95, yy + 128])) { + managing = 0; scr_ui_refresh(); scr_management(1); - click=1; - popup=0; - selected=0; - hide_banner=1; - view_squad=false; - unit_profile=false; + click = 1; + popup = 0; + selected = 0; + hide_banner = 1; + view_squad = false; + unit_profile = false; } // Previous company - if (point_and_click([xx+424, yy+80,xx+496,yy+128]) || (keyboard_check_pressed(ord(string("N"))) && allow_shortcuts)){ - var new_view = managing == 1 ? 15 : managing-1; - switch_view_company(new_view) + if (point_and_click([xx + 424, yy + 80, xx + 496, yy + 128]) || (keyboard_check_pressed(ord(string("N"))) && allow_shortcuts)) { + var new_view = managing == 1 ? 15 : managing - 1; + switch_view_company(new_view); } // Next company - if (point_and_click([xx+1105, yy+80,xx+1178,yy+128]) || (keyboard_check_pressed(ord(string("M"))) && allow_shortcuts)){ - var new_view = managing == 15 ? 1 : managing+1; - switch_view_company(new_view) - } + if (point_and_click([xx + 1105, yy + 80, xx + 1178, yy + 128]) || (keyboard_check_pressed(ord(string("M"))) && allow_shortcuts)) { + var new_view = managing == 15 ? 1 : managing + 1; + switch_view_company(new_view); + } } -function ui_manage_hotkeys(){ - if (managing >=0){ - for (var i=1;i<10;i++){ - if (press_exclusive(ord(string(i)))){ - switch_view_company(i); - } - } - if (press_exclusive(ord("0"))){ - switch_view_company(10); - } - else if (press_exclusive(ord("Q"))){ - switch_view_company(11); - } - else if (press_exclusive(ord("E"))){ - switch_view_company(12); - } - else if (press_exclusive(ord("R"))){ - switch_view_company(13); - } - else if (press_exclusive(ord("T"))){ - switch_view_company(14); - } - else if (press_exclusive(ord("Y"))){ - switch_view_company(15); - } - } +function ui_manage_hotkeys() { + if (managing >= 0) { + for (var i = 1; i < 10; i++) { + if (press_exclusive(ord(string(i)))) { + switch_view_company(i); + } + } + if (press_exclusive(ord("0"))) { + switch_view_company(10); + } else if (press_exclusive(ord("Q"))) { + switch_view_company(11); + } else if (press_exclusive(ord("E"))) { + switch_view_company(12); + } else if (press_exclusive(ord("R"))) { + switch_view_company(13); + } else if (press_exclusive(ord("T"))) { + switch_view_company(14); + } else if (press_exclusive(ord("Y"))) { + switch_view_company(15); + } + } } diff --git a/scripts/scr_controller_helpers/scr_controller_helpers.gml b/scripts/scr_controller_helpers/scr_controller_helpers.gml index c4c245dbf5..a29981ecdd 100644 --- a/scripts/scr_controller_helpers/scr_controller_helpers.gml +++ b/scripts/scr_controller_helpers/scr_controller_helpers.gml @@ -26,7 +26,7 @@ function scr_menu_clear_up(specific_area_function) { exit; } if ((zoomed == 0) && (cooldown <= 0) && (menu >= 500) && (menu <= 510)) { - if (mouse_y >= __view_get(e__VW.YView, 0) + 27) { + if (mouse_y >= camera_get_view_y(view_camera[0]) + 27) { cooldown = 8000; if ((menu >= 500) && (temp[menu - 434] == "")) { menu = 0; @@ -43,8 +43,8 @@ function scr_menu_clear_up(specific_area_function) { }*/ diyst = 999; - xx = __view_get(e__VW.XView, 0); - yy = __view_get(e__VW.YView, 0); + xx = camera_get_view_x(view_camera[0]); + yy = camera_get_view_y(view_camera[0]); if (menu == 0) { hide_banner = 0; @@ -156,26 +156,10 @@ function basic_manage_settings() { function init_manage_buttons() { management_buttons = { - squad_toggle: new UnitButtonObject({ - style: "pixel", - label: "Squad View", - tooltip: "Click here or press S to toggle Squad View.", - }), - profile_toggle: new UnitButtonObject({ - style: "pixel", - label: "Show Profile", - tooltip: "Click here or press P to show unit profile.", - }), - bio_toggle: new UnitButtonObject({ - style: "pixel", - label: "Show Bio", - tooltip: "Click here or press B to Toggle Unit Biography.", - }), - capture_image: new UnitButtonObject({ - style: "pixel", - label: "Capture Image", - tooltip: "Click to create a local png of the given marine in the game folder.", - }), + squad_toggle: new UnitButtonObject({style: "pixel", label: "Squad View", tooltip: "Click here or press S to toggle Squad View."}), + profile_toggle: new UnitButtonObject({style: "pixel", label: "Show Profile", tooltip: "Click here or press P to show unit profile."}), + bio_toggle: new UnitButtonObject({style: "pixel", label: "Show Bio", tooltip: "Click here or press B to Toggle Unit Biography."}), + capture_image: new UnitButtonObject({style: "pixel", label: "Capture Image", tooltip: "Click to create a local png of the given marine in the game folder."}), company_namer: new TextBarArea(800, 108, 600, false), }; } @@ -281,13 +265,7 @@ function scr_toggle_lib() { artifact_destroy = new ShutterButton(); artifact_namer = new TextBarArea(xx + 622, yy + 460, 350); set_chapter_arti_data(); - artifact_slate = new DataSlate({ - set_width: true, - XX: 392, - YY: 500, - width: 460, - height: 240, - }); + artifact_slate = new DataSlate({set_width: true, XX: 392, YY: 500, width: 460, height: 240}); } } }); diff --git a/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml b/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml index 8bd20811d8..0c61f33ac2 100644 --- a/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml +++ b/scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml @@ -100,8 +100,8 @@ function add_diplomacy_option(option = {}) { } function basic_diplomacy_screen() { - var yy = __view_get(e__VW.YView, 0); - var xx = __view_get(e__VW.XView, 0); + var yy = camera_get_view_y(view_camera[0]); + var xx = camera_get_view_x(view_camera[0]); if (trading == 0 && valid_diplomacy_options()) { if (!force_goodbye) { draw_set_halign(fa_center); @@ -123,10 +123,7 @@ function basic_diplomacy_screen() { for (var slot = 0; slot < opts; slot++) { var _opt = diplo_option[slot]; - _opt.update({ - x1: xx + 354, - y1: yy + 694, - }); + _opt.update({x1: xx + 354, y1: yy + 694}); if (_opt.draw()) { diplo_pressed = slot; @@ -137,7 +134,7 @@ function basic_diplomacy_screen() { if (diplo_pressed > -1) { evaluate_chosen_diplomacy_option(diplo_pressed); } - yy = __view_get(e__VW.YView, 0); + yy = camera_get_view_y(view_camera[0]); } if ((menu == eMENU.Diplomacy) && (diplomacy == 10.1)) { scr_emmisary_diplomacy_routes(); @@ -196,17 +193,7 @@ function draw_character_diplomacy() { obj_controller.diplo_image = _diplo_unit.draw_unit_image(); } obj_controller.diplo_image.draw(210, 520 - 271, true, 1, 1, 0, CM_GREEN_COLOR, 1); - _diplo_unit - .stat_display( - false, - { - x1: 10, - y1: 520, - w: 569, - h: 303, - }, - true - ); + _diplo_unit.stat_display(false, {x1: 10, y1: 520, w: 569, h: 303}, true); draw_sprite(spr_holo_pad, 0, 210, 520); }; @@ -231,17 +218,7 @@ function draw_character_diplomacy() { obj_controller.master_image = _master.draw_unit_image(); } obj_controller.master_image.draw(1108 + 200, 520 - 271, true, 1, 1, 0, CM_GREEN_COLOR, 1); - _master - .stat_display( - false, - { - x1: 1108, - y1: 520, - w: 569, - h: 303, - }, - true - ); + _master.stat_display(false, {x1: 1108, y1: 520, w: 569, h: 303}, true); draw_sprite(spr_holo_pad, 0, 1108 + 200, 520); }; _cm_slate.draw_with_dimensions(); diff --git a/scripts/scr_draw_armentarium/scr_draw_armentarium.gml b/scripts/scr_draw_armentarium/scr_draw_armentarium.gml index 192d7ae460..fd3ab194c9 100644 --- a/scripts/scr_draw_armentarium/scr_draw_armentarium.gml +++ b/scripts/scr_draw_armentarium/scr_draw_armentarium.gml @@ -1,48 +1,30 @@ // Script assets have changed for v2.3.0 see // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information -function drop_down_sandwich(selection, draw_x, draw_y, options, open_marker,left_text,right_text){ - draw_text_transformed(draw_x, draw_y, left_text,1,1,0); - draw_x += string_width(left_text)+5; - var results = drop_down(selection, draw_x, draw_y-2, options,open_marker); +function drop_down_sandwich(selection, draw_x, draw_y, options, open_marker, left_text, right_text) { + draw_text_transformed(draw_x, draw_y, left_text, 1, 1, 0); + draw_x += string_width(left_text) + 5; + var results = drop_down(selection, draw_x, draw_y - 2, options, open_marker); draw_set_color(c_gray); - draw_text_transformed(draw_x+9+ string_width(selection), draw_y, right_text,1,1,0); + draw_text_transformed(draw_x + 9 + string_width(selection), draw_y, right_text, 1, 1, 0); return results; } -function set_up_armentarium(){ - static xx=__view_get( e__VW.XView, 0 ); - static yy=__view_get( e__VW.YView, 0 ); - menu=14; - onceh=1; - cooldown=8000; - click=1; - temp[36]=scr_role_count(obj_ini.role[100][16],""); - temp[37]=temp[36]+scr_role_count(string(obj_ini.role[100][16])+" Aspirant",""); +function set_up_armentarium() { + static xx = camera_get_view_x(view_camera[0]); + static yy = camera_get_view_y(view_camera[0]); + menu = 14; + onceh = 1; + cooldown = 8000; + click = 1; + temp[36] = scr_role_count(obj_ini.role[100][16], ""); + temp[37] = temp[36] + scr_role_count(string(obj_ini.role[100][16]) + " Aspirant", ""); specialist_point_handler.calculate_research_points(); - in_forge=false + in_forge = false; forge_button = new ShutterButton(); forge_button.cover_text = "FORGE"; stc_flashes = new GlowDot(); - gift_stc_button = new UnitButtonObject( - { - x1: 650, - y1: 467, - style : "pixel", - label : "Gift", - set_width : true, - w : 90, - } - ); - identify_stc_button = new UnitButtonObject( - { - x1: 670, - y1: 467, - style : "pixel", - label : "Identify", - set_width : true, - w : 90, - } - ); + gift_stc_button = new UnitButtonObject({x1: 650, y1: 467, style: "pixel", label: "Gift", set_width: true, w: 90}); + identify_stc_button = new UnitButtonObject({x1: 670, y1: 467, style: "pixel", label: "Identify", set_width: true, w: 90}); /*for (var i =0;i<3;i++){ for (var f =0;f<7;f++){ stc_flashes[i][f] = new GlowDot(); @@ -50,105 +32,107 @@ function set_up_armentarium(){ } }*/ speeding_bits = { - "wargear":new SpeedingDot(0, 0,(210/6)*stc_wargear), - "vehicles":new SpeedingDot(0, 0,(210/6)*stc_vehicles), - "ships":new SpeedingDot(0, 0,(210/6)*stc_ships) - } + "wargear": new SpeedingDot(0, 0, (210 / 6) * stc_wargear), + "vehicles": new SpeedingDot(0, 0, (210 / 6) * stc_vehicles), + "ships": new SpeedingDot(0, 0, (210 / 6) * stc_ships), + }; } -function same_locations(first_loc,second_loc){ +function same_locations(first_loc, second_loc) { var same_loc = false; - if (is_array(first_loc)&& is_array(second_loc)){ - if (first_loc[2] != "Warp" && first_loc[2] != "Lost"){ - if (first_loc[2] == second_loc[2]) then same_loc=true; + if (is_array(first_loc) && is_array(second_loc)) { + if (first_loc[2] != "Warp" && first_loc[2] != "Lost") { + if (first_loc[2] == second_loc[2]) { + same_loc = true; + } } else { - if (first_loc[1] == second_loc[1]) && - (first_loc[0] == second_loc[0]){ - same_loc=true; + if ((first_loc[1] == second_loc[1]) && (first_loc[0] == second_loc[0])) { + same_loc = true; } } } return same_loc; } - - -function identify_stc(area){ - switch(area){ +function identify_stc(area) { + switch (area) { case "wargear": stc_wargear++; - if (stc_wargear==2) then stc_bonus[1]=choose(1,2,3,4,5); - if (stc_wargear==4) then stc_bonus[2]=choose(1,2,3); - stc_research.wargear=0; + if (stc_wargear == 2) { + stc_bonus[1] = choose(1, 2, 3, 4, 5); + } + if (stc_wargear == 4) { + stc_bonus[2] = choose(1, 2, 3); + } + stc_research.wargear = 0; break; case "vehicles": stc_vehicles++; - if (stc_vehicles==2) then stc_bonus[3]=choose(1,2,3,4,5); - if (stc_vehicles==4) then stc_bonus[4]=choose(1,2,3); - stc_research.vehicles=0; + if (stc_vehicles == 2) { + stc_bonus[3] = choose(1, 2, 3, 4, 5); + } + if (stc_vehicles == 4) { + stc_bonus[4] = choose(1, 2, 3); + } + stc_research.vehicles = 0; break; - case "ships": + case "ships": stc_ships++; - if (stc_ships==2) then stc_bonus[5]=choose(1,2,3,4,5); - if (stc_ships==4) then stc_bonus[6]=choose(1,2,3); - stc_research.ships=0; - break; + if (stc_ships == 2) { + stc_bonus[5] = choose(1, 2, 3, 4, 5); + } + if (stc_ships == 4) { + stc_bonus[6] = choose(1, 2, 3); + } + stc_research.ships = 0; + break; } } -function scr_draw_armentarium_gui(){ - if (!in_forge){ +function scr_draw_armentarium_gui() { + if (!in_forge) { draw_set_alpha(1); draw_set_font(fnt_40k_14); draw_set_halign(fa_left); - draw_text(384, 468, string(stc_wargear_un + stc_vehicles_un + stc_ships_un )+ " Unidentified Fragments"); + draw_text(384, 468, string(stc_wargear_un + stc_vehicles_un + stc_ships_un) + " Unidentified Fragments"); var _has_stc = stc_wargear_un + stc_vehicles_un + stc_ships_un > 0; - if (!_has_stc){ + if (!_has_stc) { var _tools = "No STCs Available"; gift_stc_button.tooltip = _tools; identify_stc_button.tooltip = _tools; } - if (gift_stc_button.draw(_has_stc)){ + if (gift_stc_button.draw(_has_stc)) { setup_gift_stc_popup(); } - identify_stc_button.update({x1 :gift_stc_button.x2}); - if (identify_stc_button.draw(_has_stc)){ - audio_play_sound(snd_stc,-500,0) - audio_sound_gain(snd_stc,master_volume*effect_volume,0); - + identify_stc_button.update({x1: gift_stc_button.x2}); + if (identify_stc_button.draw(_has_stc)) { + audio_play_sound(snd_stc, -500, 0); + audio_sound_gain(snd_stc, master_volume * effect_volume, 0); - if (stc_wargear_un > 0 && - stc_wargear < MAX_STC_PER_SUBCATEGORY) { - + if (stc_wargear_un > 0 && stc_wargear < MAX_STC_PER_SUBCATEGORY) { stc_wargear_un--; - identify_stc("wargear"); - } - else if (stc_vehicles_un > 0 && - stc_vehicles < MAX_STC_PER_SUBCATEGORY) { - + identify_stc("wargear"); + } else if (stc_vehicles_un > 0 && stc_vehicles < MAX_STC_PER_SUBCATEGORY) { stc_vehicles_un--; - identify_stc("vehicles"); - } - else if(stc_ships_un > 0 && - stc_ships < MAX_STC_PER_SUBCATEGORY) { - + identify_stc("vehicles"); + } else if (stc_ships_un > 0 && stc_ships < MAX_STC_PER_SUBCATEGORY) { stc_ships_un--; identify_stc("ships"); } - + // Refresh the shop - instance_create(1000,1000,obj_shop); - set_up_armentarium(); + instance_create(1000, 1000, obj_shop); + set_up_armentarium(); } } } -function scr_draw_armentarium(){ +function scr_draw_armentarium() { var _recruit_pace = ARR_recruitment_pace; - var _train_tiers = ARR_techmarine_training_tiers; - var xx = __view_get(e__VW.XView, 0) + 0; - var yy = __view_get(e__VW.YView, 0) + 0; - draw_sprite(spr_rock_bg, 0, xx, yy); + var _train_tiers = ARR_techmarine_training_tiers; + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0; + draw_sprite(spr_rock_bg, 0, xx, yy); draw_set_alpha(0.75); draw_set_color(0); @@ -157,10 +141,10 @@ function scr_draw_armentarium(){ draw_set_color(c_gray); draw_rectangle(xx + 326 + 16, yy + 66, xx + 887 + 16, yy + 818, 1); draw_line(xx + 326 + 16, yy + 426, xx + 887 + 16, yy + 426); - - if (menu_adept = 0) { + + if (menu_adept == 0) { // draw_sprite(spr_advisors,4,xx+16,yy+43); - if(struct_exists(obj_ini.custom_advisors, "forge_master")){ + if (struct_exists(obj_ini.custom_advisors, "forge_master")) { scr_image("advisor/splash", obj_ini.custom_advisors.forge_master, xx + 16, yy + 43, 310, 828); } else { scr_image("advisor/splash", 5, xx + 16, yy + 43, 310, 828); @@ -168,14 +152,14 @@ function scr_draw_armentarium(){ draw_set_halign(fa_left); draw_set_color(c_gray); draw_set_font(fnt_40k_30b); - var header = in_forge ? "Forge" : "Armamentarium"; + var header = in_forge ? "Forge" : "Armamentarium"; draw_text_transformed(xx + 336 + 16, yy + 66, string_hash_to_newline(header), 1, 1, 0); - if (!in_forge){ + if (!in_forge) { draw_set_font(fnt_40k_30b); - draw_text_transformed(xx + 336 + 16, yy + 100, string_hash_to_newline("Forge Master " + string(obj_ini.name[0, 1])), 0.6, 0.6, 0); + draw_text_transformed(xx + 336 + 16, yy + 100, string_hash_to_newline("Forge Master " + string(obj_ini.name[0][1])), 0.6, 0.6, 0); } } - if (menu_adept = 1) { + if (menu_adept == 1) { // draw_sprite(spr_advisors,0,xx+16,yy+43); scr_image("advisor/splash", 1, xx + 16, yy + 43, 310, 828); draw_set_halign(fa_left); @@ -190,18 +174,24 @@ function scr_draw_armentarium(){ draw_set_color(c_black); draw_set_alpha(0.2); - if (mouse_y >= yy + 76) and(mouse_y < yy + 104) { - if (mouse_x >= xx + 957) and(mouse_x < xx + 1062) then draw_rectangle(xx + 957, yy + 76, xx + 1062, yy + 104, 0); - if (mouse_x >= xx + 1068) and(mouse_x < xx + 1136) then draw_rectangle(xx + 1068, yy + 76, xx + 1136, yy + 104, 0); - if (mouse_x >= xx + 1167) and(mouse_x < xx + 1255) then draw_rectangle(xx + 1167, yy + 76, xx + 1255, yy + 104, 0); - if (mouse_x >= xx + 1447) and(mouse_x < xx + 1545) then draw_rectangle(xx + 1487, yy + 76, xx + 1545, yy + 104, 0); + if ((mouse_y >= yy + 76) && (mouse_y < yy + 104)) { + if ((mouse_x >= xx + 957) && (mouse_x < xx + 1062)) { + draw_rectangle(xx + 957, yy + 76, xx + 1062, yy + 104, 0); + } + if ((mouse_x >= xx + 1068) && (mouse_x < xx + 1136)) { + draw_rectangle(xx + 1068, yy + 76, xx + 1136, yy + 104, 0); + } + if ((mouse_x >= xx + 1167) && (mouse_x < xx + 1255)) { + draw_rectangle(xx + 1167, yy + 76, xx + 1255, yy + 104, 0); + } + if ((mouse_x >= xx + 1447) && (mouse_x < xx + 1545)) { + draw_rectangle(xx + 1487, yy + 76, xx + 1545, yy + 104, 0); + } } draw_set_alpha(1); draw_set_color(c_gray); - - if (!in_forge){ - + if (!in_forge) { draw_set_alpha(1); draw_set_font(fnt_40k_12); @@ -214,49 +204,70 @@ function scr_draw_armentarium(){ var yyy1, yyy; yyy1 = max_techs - temp[37]; - if (yyy1 < 0) then yyy1 = yyy1 * -1; - yyy = (yyy1 * 2); - if (disposition[3] % 2 == 0) then yyy += 2; - else { + if (yyy1 < 0) { + yyy1 = yyy1 * -1; + } + yyy = yyy1 * 2; + if (disposition[3] % 2 == 0) { + yyy += 2; + } else { yyy += 1; } - blurp = "Subject ID confirmed. Rank Identified: Chapter Master. Salutations Chapter Master. We have assembled the following Data: ##" + string(obj_ini.role[100, 16]) + "s: " + string(temp[36]) + ".##Summation: "; + blurp = "Subject ID confirmed. Rank Identified: Chapter Master. Salutations Chapter Master. We have assembled the following Data: ##" + string(obj_ini.role[100][16]) + "s: " + string(temp[36]) + ".##Summation: "; if (obj_controller.faction_status[eFACTION.Mechanicus] != "War") { - if (max_techs > temp[37]) then blurp += $"Our Mechanicus Requisitionary powers are sufficient to train {max_techs - temp[37]} additional {obj_ini.role[100][eROLE.Techmarine]}."; - if (max_techs <= temp[37]) then blurp += $"We require {yyy} additional Mechanicus Disposition to train one additional {obj_ini.role[100][eROLE.Techmarine]}."; + if (max_techs > temp[37]) { + blurp += $"Our Mechanicus Requisitionary powers are sufficient to train {max_techs - temp[37]} additional {obj_ini.role[100][eROLE.Techmarine]}."; + } + if (max_techs <= temp[37]) { + blurp += $"We require {yyy} additional Mechanicus Disposition to train one additional {obj_ini.role[100][eROLE.Techmarine]}."; + } } else { - blurp += $"Since we are at war with the Mechanicus we'll have to train our own {obj_ini.role[100][eROLE.Techmarine]}s." + blurp += $"Since we are at war with the Mechanicus we'll have to train our own {obj_ini.role[100][eROLE.Techmarine]}s."; } - blurp += " The training of new " + string(obj_ini.role[100, 16]) + "s"; + blurp += " The training of new " + string(obj_ini.role[100][16]) + "s"; - if (menu_adept = 1) { - blurp = "Your Chapter contains " + string(temp[36]) + " " + string(obj_ini.role[100, 16]) + ".##"; - blurp += "The training of a new " + string(obj_ini.role[100, 16]); + if (menu_adept == 1) { + blurp = "Your Chapter contains " + string(temp[36]) + " " + string(obj_ini.role[100][16]) + ".##"; + blurp += "The training of a new " + string(obj_ini.role[100][16]); } - if (training_techmarine>=0){ + if (training_techmarine >= 0) { blurp += _recruit_pace[training_techmarine]; } - if (training_techmarine >0 && training_techmarine<=6) { - eta = floor((359 - tech_points) / _train_tiers[training_techmarine])+ 1; + if (training_techmarine > 0 && training_techmarine <= 6) { + eta = floor((359 - tech_points) / _train_tiers[training_techmarine]) + 1; } - if (tech_aspirant > 0) and(training_techmarine > 0) and(menu_adept = 1) { - if (eta = 1) then blurp += " Your current " + string(obj_ini.role[100, 16]) + " Aspirant will finish training in " + string(eta) + " month."; - if (eta != 1) then blurp += " Your current " + string(obj_ini.role[100, 16]) + " Aspirant will finish training in " + string(eta) + " months."; + if ((tech_aspirant > 0) && (training_techmarine > 0) && (menu_adept == 1)) { + if (eta == 1) { + blurp += " Your current " + string(obj_ini.role[100][16]) + " Aspirant will finish training in " + string(eta) + " month."; + } + if (eta != 1) { + blurp += " Your current " + string(obj_ini.role[100][16]) + " Aspirant will finish training in " + string(eta) + " months."; + } } - if (tech_aspirant > 0) and(training_techmarine > 0) and(menu_adept = 0) { - if (eta = 1) then blurp += " The current " + string(obj_ini.role[100, 16]) + " Aspirant will finish training in " + string(eta) + " month."; - if (eta != 1) then blurp += " The current " + string(obj_ini.role[100, 16]) + " Aspirant will finish training in " + string(eta) + " months."; + if ((tech_aspirant > 0) && (training_techmarine > 0) && (menu_adept == 0)) { + if (eta == 1) { + blurp += " The current " + string(obj_ini.role[100][16]) + " Aspirant will finish training in " + string(eta) + " month."; + } + if (eta != 1) { + blurp += " The current " + string(obj_ini.role[100][16]) + " Aspirant will finish training in " + string(eta) + " months."; + } + } + if (menu_adept == 0) { + blurp += "##Data compilation complete. We currently possess the technology to produce the following:"; } - if (menu_adept = 0) then blurp += "##Data compilation complete. We currently possess the technology to produce the following:"; - if (menu_adept = 1) { + if (menu_adept == 1) { if (obj_controller.faction_status[eFACTION.Mechanicus] != "War") { - if (max_techs > temp[37]) then blurp += $"Our Mechanicus Requisitionary powers are sufficient to train {max_techs - temp[37]} additional {obj_ini.role[100][eROLE.Techmarine]}."; - if (max_techs <= temp[37]) then blurp += $"We require {yyy} additional Mechanicus Disposition to train one additional {obj_ini.role[100][eROLE.Techmarine]}."; + if (max_techs > temp[37]) { + blurp += $"Our Mechanicus Requisitionary powers are sufficient to train {max_techs - temp[37]} additional {obj_ini.role[100][eROLE.Techmarine]}."; + } + if (max_techs <= temp[37]) { + blurp += $"We require {yyy} additional Mechanicus Disposition to train one additional {obj_ini.role[100][eROLE.Techmarine]}."; + } } else { - blurp += $"Since we are at war with the Mechanicus we'll have to train our own {obj_ini.role[100][eROLE.Techmarine]}s." + blurp += $"Since we are at war with the Mechanicus we'll have to train our own {obj_ini.role[100][eROLE.Techmarine]}s."; } blurp += "##Data compilation complete. You currently possess the technology to produce the following:"; @@ -264,164 +275,139 @@ function scr_draw_armentarium(){ draw_text_ext(xx + 336 + 16, yy + 130, string_hash_to_newline(string(blurp)), -1, 536); - var y_offset = yy + 130 + string_height_ext(string_hash_to_newline(string(blurp)), -1, 536)+10; + var y_offset = yy + 130 + string_height_ext(string_hash_to_newline(string(blurp)), -1, 536) + 10; var research_area_limit; - if (stc_research.research_focus=="vehicles"){ + if (stc_research.research_focus == "vehicles") { research_area_limit = stc_vehicles; - } else if (stc_research.research_focus=="wargear"){ + } else if (stc_research.research_focus == "wargear") { research_area_limit = stc_wargear; - }else if (stc_research.research_focus=="ships"){ + } else if (stc_research.research_focus == "ships") { research_area_limit = stc_ships; } - var research_progress = ceil(((5000*(research_area_limit+1))-stc_research[$ stc_research.research_focus])/specialist_point_handler.research_points); - static research_drop_down = false; + var research_progress = ceil(((5000 * (research_area_limit + 1)) - stc_research[$ stc_research.research_focus]) / specialist_point_handler.research_points); + static research_drop_down = false; var research_eta_message = $"Based on current progress it will be {research_progress} months until next significant research step is complete, Research is currently focussed on {stc_research.research_focus}"; - draw_text_ext(xx + 336 + 16, y_offset+25, string_hash_to_newline(research_eta_message), -1, 536); - - + draw_text_ext(xx + 336 + 16, y_offset + 25, string_hash_to_newline(research_eta_message), -1, 536); - var forge_buttons = [xx + 450 + 16, y_offset+40+string_height(research_eta_message), 0, 0] - if (forge_button.draw_shutter(forge_buttons[0]+60, forge_buttons[1], "Enter Forge", 0.5)){ - in_forge=true; + var forge_buttons = [xx + 450 + 16, y_offset + 40 + string_height(research_eta_message), 0, 0]; + if (forge_button.draw_shutter(forge_buttons[0] + 60, forge_buttons[1], "Enter Forge", 0.5)) { + in_forge = true; } draw_set_font(fnt_40k_30b); draw_set_halign(fa_center); draw_text_transformed(xx + 605, yy + 432, "STC Fragments", 0.75, 0.75, 0); draw_set_font(fnt_40k_12); draw_set_halign(fa_left); - draw_set_color(c_gray); - + draw_set_color(c_gray); + var hi = 0; var f, y_loc; draw_set_color(c_gray); var _area_coords = { - "wargear" : [xx+350, yy+535, xx+520, yy+800], - "vehicles" : [xx+530, yy+535, xx+700, yy+800], - "ships" : [xx+710, yy+535, xx+880, yy+800], - } + "wargear": [xx + 350, yy + 535, xx + 520, yy + 800], + "vehicles": [xx + 530, yy + 535, xx + 700, yy + 800], + "ships": [xx + 710, yy + 535, xx + 880, yy + 800], + }; var _area_data = { - "wargear" : stc_wargear, - "vehicles" : stc_vehicles, - "ships" : stc_ships, - } + "wargear": stc_wargear, + "vehicles": stc_vehicles, + "ships": stc_ships, + }; var _display_string = { - "wargear" : "Wargear", - "vehicles" : "Vehicles", - "ships" : "Ships", - } - var _wargear_one = ["Random","Enhanced Bolts","Enhanced Chain Weapons","Enhanced Flame Weapons","Enhanced Missiles","Enhanced Armour"]; - var _wargear_two = [ "Random","Enhanced Fist Weapons Bolts","Enhanced Plasma","Enhanced Armour"]; - var _vehicle_one = ["Random","Enhanced Hull","Enhanced Accuracy","New Weapons","Survivability","Enhanced Armour"]; - var _vehicle_two = ["Random","Enhanced Hull","Enhanced Armour","New Weapons"]; - var _ship_one = ["Random","Enhanced Hull","Enhanced Accuracy","Enhanced Turning","Enhanced Boarding","Enhanced Armour"]; - var _ship_two = ["Random","Enhanced Hull","Enhanced Armour","Enhanced Speed"]; + "wargear": "Wargear", + "vehicles": "Vehicles", + "ships": "Ships", + }; + var _wargear_one = ["Random", "Enhanced Bolts", "Enhanced Chain Weapons", "Enhanced Flame Weapons", "Enhanced Missiles", "Enhanced Armour"]; + var _wargear_two = ["Random", "Enhanced Fist Weapons Bolts", "Enhanced Plasma", "Enhanced Armour"]; + var _vehicle_one = ["Random", "Enhanced Hull", "Enhanced Accuracy", "New Weapons", "Survivability", "Enhanced Armour"]; + var _vehicle_two = ["Random", "Enhanced Hull", "Enhanced Armour", "New Weapons"]; + var _ship_one = ["Random", "Enhanced Hull", "Enhanced Accuracy", "Enhanced Turning", "Enhanced Boarding", "Enhanced Armour"]; + var _ship_two = ["Random", "Enhanced Hull", "Enhanced Armour", "Enhanced Speed"]; var _bonus_strings = { - "wargear" : [ - "8% discount", - _wargear_one[stc_bonus[1]], - "16% discount", - _wargear_two[stc_bonus[2]], - "25% discount", - "Can produce Terminator Armour and Dreadnoughts." - ], - "vehicles" : [ - "8% discount", - _vehicle_one[stc_bonus[3]], - "16% discount", - _vehicle_two[stc_bonus[4]], - "25% discount", - "Can produce Land Speeders and Land Raiders." - ], - "ships" : [ - "8% discount", - _ship_one[stc_bonus[5]], - "16% discount", - _ship_two[stc_bonus[6]], - "25% discount", - "Warp Speed is increased and ships self-repair." - ], - } - var _researches = ["vehicles","wargear", "ships"]; - for (var i=0;i0){ - speeding_bits[$_res].draw(_coords[0], _coords[1]+20); + draw_sprite_ext(spr_research_bar, 0, _coords[0] + 9, _coords[1] + 19, 1, 0.7, 0, c_white, 1); + if (_area_data[$ _res] > 0) { + speeding_bits[$ _res].draw(_coords[0], _coords[1] + 20); } - for (f =0;f<6;f++){ - if (f>=_area_data[$_res]){ - draw_sprite_ext(spr_research_bar, 1, _coords[0]+9, _coords[1]+19+((210/6)*f), 1, 0.6, 0, c_white, 1) + for (f = 0; f < 6; f++) { + if (f >= _area_data[$ _res]) { + draw_sprite_ext(spr_research_bar, 1, _coords[0] + 9, _coords[1] + 19 + ((210 / 6) * f), 1, 0.6, 0, c_white, 1); } - } - if (stc_research.research_focus == _res){ - stc_flashes.draw(_coords[0]+9,_coords[1]+19+((210/6)*_area_data[$_res])); + } + if (stc_research.research_focus == _res) { + stc_flashes.draw(_coords[0] + 9, _coords[1] + 19 + ((210 / 6) * _area_data[$ _res])); } draw_set_alpha(1); draw_set_color(c_gray); draw_set_font(fnt_40k_14); - draw_text(_coords[0] + 36, _coords[1] - 18, _display_string[$_res]); - var _bonus = _bonus_strings[$_res]; + draw_text(_coords[0] + 36, _coords[1] - 18, _display_string[$ _res]); + var _bonus = _bonus_strings[$ _res]; draw_set_font(fnt_40k_12); - if (stc_research.research_focus == _res || scr_hit(_coords)){ + if (stc_research.research_focus == _res || scr_hit(_coords)) { draw_set_color(c_black); } - for (var s=0;ss?1:0.5); - draw_text_ext(_coords[0] + 22, yy + 549+(s*35), $"{s+1}) {_bonus[s]}", -1,140); + for (var s = 0; s < array_length(_bonus); s++) { + draw_set_alpha(stc_wargear > s ? 1 : 0.5); + draw_text_ext(_coords[0] + 22, yy + 549 + (s * 35), $"{s + 1}) {_bonus[s]}", -1, 140); } } - draw_set_color(CM_GREEN_COLOR); - // draw_rectangle(xx + 711, yy + 539, xx + 728, yy + 539 + hi, 0); + draw_set_color(CM_GREEN_COLOR); + // draw_rectangle(xx + 711, yy + 539, xx + 728, yy + 539 + hi, 0); draw_set_alpha(1); draw_set_color(c_gray); //draw_rectangle(xx + 351, yy + 539, xx + 368, yy + 749, 1); //draw_rectangle(xx + 531, yy + 539, xx + 548, yy + 749, 1); //draw_rectangle(xx + 711, yy + 539, xx + 728, yy + 749, 1); - - }else { - yy+=25; + } else { + yy += 25; draw_set_halign(fa_left); - draw_set_color(0); + draw_set_color(0); //draw_rectangle(xx + 359, yy + 66, xx + 886, yy + 818, 0); - if (point_and_click(draw_unit_buttons([xx + 359, yy + 77],"<-- Overview",[1,1],c_red))){ - in_forge=false; - } + if (point_and_click(draw_unit_buttons([xx + 359, yy + 77], "<-- Overview", [1, 1], c_red))) { + in_forge = false; + } - specialist_point_handler.draw_forge_queue(xx+ 359,yy + 107); + specialist_point_handler.draw_forge_queue(xx + 359, yy + 107); - // draw_set_color(c_red); - //draw_line(xx + 326 + 16, yy + 426, xx + 887 + 16, yy + 426); + //draw_line(xx + 326 + 16, yy + 426, xx + 887 + 16, yy + 426); draw_set_color(#af5a00); - draw_set_font(fnt_40k_14b) + draw_set_font(fnt_40k_14b); var forge_text = $"Forge point production per turn: {forge_points}#"; // draw_sprite_ext(spr_forge_points_icon,0,xx+359+string_width(forge_text), yy+410,0.3,0.3,0,c_white,1); - forge_text += $"Chapter total {obj_ini.role[100, 16]}s: {temp[36]}#"; + forge_text += $"Chapter total {obj_ini.role[100][16]}s: {temp[36]}#"; forge_text += $"Planetary Forges in operation: {obj_controller.player_forge_data.player_forges}#"; forge_text += $"Master Craft Forge Chance: {master_craft_chance}%# Assign techmarines to forges to increase Master Craft Chance"; // forge_text += $"A total of {obj_ini.role[100, 16]}s assigned to Forges: {var}#"; - draw_text_ext(xx+359, yy+410, string_hash_to_newline(forge_text),-1,670); + draw_text_ext(xx + 359, yy + 410, string_hash_to_newline(forge_text), -1, 670); } } diff --git a/scripts/scr_draw_unit_image/scr_draw_unit_image.gml b/scripts/scr_draw_unit_image/scr_draw_unit_image.gml index df3a5608b9..eaba308407 100644 --- a/scripts/scr_draw_unit_image/scr_draw_unit_image.gml +++ b/scripts/scr_draw_unit_image/scr_draw_unit_image.gml @@ -60,7 +60,7 @@ function UnitImage(_unit_sprite) constructor { x2 = 0; y2 = 0; - static draw = function(xx, yy, _background = false,xscale = 1, yscale=1, rot=0, col=c_white, alpha=1) { + static draw = function(xx, yy, _background = false, xscale = 1, yscale = 1, rot = 0, col = c_white, alpha = 1) { if (_background) { draw_rectangle_color_simple(xx - 1, yy - 1, xx + 1 + 166, yy + 271 + 1, 0, c_black); draw_rectangle_color_simple(xx - 1, yy - 1, xx + 166 + 1, yy + 271 + 1, 1, c_gray); @@ -68,10 +68,11 @@ function UnitImage(_unit_sprite) constructor { draw_rectangle_color_simple(xx - 3, yy - 3, xx + 166 + 3, yy + 3 + 271, 1, c_gray); } if (sprite_exists(unit_sprite)) { - draw_sprite_ext(unit_sprite, 0, xx - 200, yy - 90, xscale, yscale, rot, col, alpha) + draw_sprite_ext(unit_sprite, 0, xx - 200, yy - 90, xscale, yscale, rot, col, alpha); } }; - static draw_part = function(xx, yy, left, top, width, height, _background = false,xscale = 1, yscale=1, rot=0, col=c_white, alpha=1) { + + static draw_part = function(xx, yy, left, top, width, height, _background = false, xscale = 1, yscale = 1, rot = 0, col = c_white, alpha = 1) { if (_background) { draw_rectangle_color_simple(xx - 1 + left, yy - 1 + top, xx + 1 + width, yy + height + 1, 0, c_black); draw_rectangle_color_simple(xx - 1 + left, yy - 1 + top, xx + width + 1, yy + height + 1, 1, c_gray); @@ -84,16 +85,17 @@ function UnitImage(_unit_sprite) constructor { x1 = xx; y1 = yy; x2 = xx + width; - y2 = yy + height; + y2 = yy + height; }; - - static hit = function(){ + static hit = function() { return scr_hit(x1, y1, x2, y2); - } - static box = function(){ + }; + + static box = function() { return [x1, y1, x2, y2]; - } + }; + static destroy_image = function() { if (sprite_exists(unit_sprite)) { sprite_delete(unit_sprite); @@ -111,7 +113,7 @@ function BaseColor(R, G, B) constructor { function set_shader_color(shaderType, colorIndex) { var findShader, setShader; if (instance_exists(obj_controller)) { - with(obj_controller) { + with (obj_controller) { switch (shaderType) { case ShaderType.Body: setShader = colour_to_set1; @@ -138,7 +140,7 @@ function set_shader_color(shaderType, colorIndex) { shader_set_uniform_f(setShader, col_r[colorIndex] / 255, col_g[colorIndex] / 255, col_b[colorIndex] / 255); } } else if (instance_exists(obj_creation)) { - with(obj_controller) { + with (obj_controller) { switch (shaderType) { case ShaderType.Body: setShader = colour_to_set1; @@ -181,7 +183,7 @@ function make_colour_from_array(col_array) { } function set_shader_to_base_values() { - with(obj_controller) { + with (obj_controller) { shader_set_uniform_f_array(colour_to_find1, body_colour_find); shader_set_uniform_f_array(colour_to_set1, body_colour_replace); shader_set_uniform_f_array(colour_to_find2, secondary_colour_find); @@ -210,16 +212,12 @@ function set_shader_array(shader_array) { /// @mixin function scr_draw_unit_image(_background = false) { - var _role = active_roles(); var complex_set = {}; var x_surface_offset = 200; var y_surface_offset = 110; - var xx = __view_get(e__VW.XView, 0) + 0, - yy = __view_get(e__VW.YView, 0) + 0, - bb = "", - img = 0; + var xx = camera_get_view_x(view_camera[0]) + 0, yy = camera_get_view_y(view_camera[0]) + 0, bb = "", img = 0; var _controller = instance_exists(obj_controller); var _creation = instance_exists(obj_creation); @@ -274,36 +272,36 @@ function scr_draw_unit_image(_background = false) { } else { unit_specialization = UnitSpecialization.Chaplain; } - } else // Techmarine - if (is_specialist(unit_role, SPECIALISTS_TECHS, true)) { - if (unit_chapter == "Iron Hands") { - unit_specialization = UnitSpecialization.IronFather; - } else { - unit_specialization = UnitSpecialization.Techmarine; - } - } else // Apothecary - if (is_specialist(unit_role, SPECIALISTS_APOTHECARIES, true)) { - if (unit_chapter == "Space Wolves") { - unit_specialization = UnitSpecialization.WolfPriest; - } else { - unit_specialization = UnitSpecialization.Apothecary; - } - } else // Librarian - if (is_specialist(unit_role, SPECIALISTS_LIBRARIANS, true)) { - unit_specialization = UnitSpecialization.Librarian; - } else // Death Company - if (unit_role == "Death Company") { - unit_specialization = UnitSpecialization.DeathCompany; - } + } else if (is_specialist(unit_role, SPECIALISTS_TECHS, true)) { + // Techmarine + if (unit_chapter == "Iron Hands") { + unit_specialization = UnitSpecialization.IronFather; + } else { + unit_specialization = UnitSpecialization.Techmarine; + } + } else if (is_specialist(unit_role, SPECIALISTS_APOTHECARIES, true)) { + // Apothecary + if (unit_chapter == "Space Wolves") { + unit_specialization = UnitSpecialization.WolfPriest; + } else { + unit_specialization = UnitSpecialization.Apothecary; + } + } else if (is_specialist(unit_role, SPECIALISTS_LIBRARIANS, true)) { + // Librarian + unit_specialization = UnitSpecialization.Librarian; + } else if (unit_role == "Death Company") { + // Death Company + unit_specialization = UnitSpecialization.DeathCompany; + } // Dark Angels if (unit_chapter == "Dark Angels") { // Deathwing if (company == 1) { unit_special_colours = UnitSpecialColours.Deathwing; - } else // Ravenwing - if (company == 2) { - unit_special_colours = UnitSpecialColours.Ravenwing; - } + } else if (company == 2) { + // Ravenwing + unit_special_colours = UnitSpecialColours.Ravenwing; + } } // Blood Angels gold if ((unit_role == _role[eROLE.HonourGuard] || unit_role == _role[eROLE.ChapterMaster]) && (unit_chapter == "Blood Angels")) { @@ -327,7 +325,7 @@ function scr_draw_unit_image(_background = false) { halo = 1; } - if (is_dreadnought()){ + if (is_dreadnought()) { armour_type = ArmourType.Dreadnought; } else { switch (unit_armour) { @@ -349,7 +347,6 @@ function scr_draw_unit_image(_background = false) { draw_backpack = armour_type == ArmourType.Normal; - //if(shader_is_compiled(sReplaceColor)){ //shader_set(sReplaceColor); @@ -377,7 +374,6 @@ function scr_draw_unit_image(_background = false) { //Rejoice! // draw_sprite(spr_marine_base,img,x_surface_offset,y_surface_offset); - armour_sprite = spr_weapon_blank; // Draw Techmarine gear @@ -399,20 +395,14 @@ function scr_draw_unit_image(_background = false) { // if (skin_color!=6) then draw_sprite(spr_clothing_colors,clothing_style,x_surface_offset,y_surface_offset); } else { - var _complex_armours = ["MK3 Iron Armour", "Terminator Armour", "Tartaros", "MK7 Aquila", "Power Armour", "MK8 Errant", "Artificer Armour", "MK4 Maximus", "MK5 Heresy", "MK6 Corvus", "Dreadnought", "Scout Armour","Cataphractii", "Contemptor Dreadnought"]; + var _complex_armours = ["MK3 Iron Armour", "Terminator Armour", "Tartaros", "MK7 Aquila", "Power Armour", "MK8 Errant", "Artificer Armour", "MK4 Maximus", "MK5 Heresy", "MK6 Corvus", "Dreadnought", "Scout Armour", "Cataphractii", "Contemptor Dreadnought"]; if (array_contains(_complex_armours, unit_armour)) { complex_set = new ComplexSet(self); complex_livery = true; } if (armour_type == ArmourType.Normal && complex_livery && unit_role == _role[2]) { - complex_set.add_group({ - right_leg: spr_artificer_right_leg, - left_leg: spr_artificer_left_leg, - chest_variants: spr_artificer_chest, - thorax_variants: spr_artificer_thorax, - mouth_variants: spr_artificer_mouth - }); + complex_set.add_group({right_leg: spr_artificer_right_leg, left_leg: spr_artificer_left_leg, chest_variants: spr_artificer_chest, thorax_variants: spr_artificer_thorax, mouth_variants: spr_artificer_mouth}); } // Draw the Iron Halo @@ -550,14 +540,14 @@ function scr_draw_unit_image(_background = false) { } } } - + surface_clear_and_free(global.base_component_surface); global.base_component_surface = -1; - var _keep_alive = ["unit", "_texture_draws", "texture_draws"] + var _keep_alive = ["unit", "_texture_draws", "texture_draws"]; - for (var i=0;i= 1) then blurp += ", none of which are damaged."; - if (va < 1) then blurp += $". Our most damaged vessel is the {temp[40]} - it has {min(99, round(va * 100))}% Hull Integrity."; + if (va >= 1) { + blurp += ", none of which are damaged."; + } + if (va < 1) { + blurp += $". Our most damaged vessel is the {temp[40]} - it has {min(99, round(va * 100))}% Hull Integrity."; + } va = real(temp[42]); - if (va = 2) then blurp += " Two of our ships are highly damaged. You may wish to purchase a Repair License from the Sector Governerner."; - if (va > 2) then blurp += " Several of our ships are highly damaged. It is advisable that you purchase a Repair License from the Sector Governer."; + if (va == 2) { + blurp += " Two of our ships are highly damaged. You may wish to purchase a Repair License from the Sector Governerner."; + } + if (va > 2) { + blurp += " Several of our ships are highly damaged. It is advisable that you purchase a Repair License from the Sector Governer."; + } blurp += "\n\nHere are the current positions of our ships and their contents:"; - if (menu_adept = 1) { + if (menu_adept == 1) { blurp = string_replace(blurp, "Our", "Your"); blurp = string_replace(blurp, " our", " your"); blurp = string_replace(blurp, "We", "You"); @@ -108,28 +116,28 @@ function scr_fleet_advisor(){ }, }; - var _column_x = xx + 953; + var _column_x = xx + 953; var _header_offset = 80; var _columns_array = ["name", "class", "location", "hp", "carrying"]; for (var i = 0; i < array_length(_columns_array); i++) { - with(_columns[$ _columns_array[i]]) { + with (_columns[$ _columns_array[i]]) { x1 = _column_x; _column_x += w; x2 = x1 + w; y1 = yy + _header_offset; - header_y = (y1 - 2); + header_y = y1 - 2; switch (h_align) { - case fa_right: - header_x = x2; - break; - case fa_center: - header_x = (x1 + x2) / 2; - break; - case fa_left: - default: - header_x = x1; - break; + case fa_right: + header_x = x2; + break; + case fa_center: + header_x = (x1 + x2) / 2; + break; + case fa_left: + default: + header_x = x1; + break; } draw_set_halign(h_align); draw_text(header_x, header_y, text); @@ -140,7 +148,9 @@ function scr_fleet_advisor(){ var _row_height = 20; var _row_gap = 2; for (var i = ship_current; i < ship_current + 34; i++) { - if (i>= array_length(obj_ini.ship)) then continue; + if (i >= array_length(obj_ini.ship)) { + continue; + } if (obj_ini.ship[i] != "") { var _row_y = _columns[$ "name"].y1 + _row_height + (i * (_row_height + _row_gap)); draw_rectangle(xx + 950, _row_y, xx + 1546, _row_y + _row_height, 1); @@ -151,9 +161,9 @@ function scr_fleet_advisor(){ sprite: spr_view_small, click: function() { return point_and_click([x1, y1, x2, y2]); - } + }, }; - with(_goto_button) { + with (_goto_button) { w = sprite_get_width(sprite); h = sprite_get_height(sprite); x2 = x1 + w; @@ -161,7 +171,7 @@ function scr_fleet_advisor(){ draw_sprite(sprite, 0, x1, y1); } - with(_columns) { + with (_columns) { name.contents = string_truncate(obj_ini.ship[i], _columns.name.w - 6); class.contents = obj_ini.ship_class[i]; location.contents = obj_ini.ship_location[i]; @@ -170,7 +180,7 @@ function scr_fleet_advisor(){ } for (var g = 0; g < array_length(_columns_array); g++) { - with(_columns[$ _columns_array[g]]) { + with (_columns[$ _columns_array[g]]) { draw_set_halign(h_align); switch (h_align) { case fa_right: @@ -183,11 +193,11 @@ function scr_fleet_advisor(){ default: draw_text(x1, _row_y, contents); break; - } + } } } - if scr_hit(xx + 950, _row_y, xx + 1546, _row_y + _row_height) { + if (scr_hit(xx + 950, _row_y, xx + 1546, _row_y + _row_height)) { if (cn.temp[101] != obj_ini.ship[i]) { cn.temp[101] = obj_ini.ship[i]; cn.temp[102] = obj_ini.ship_class[i]; @@ -208,26 +218,28 @@ function scr_fleet_advisor(){ var max_weapons = min(facing_length, wep_length, 5); for (var s = 1; s < max_weapons; s++) { - cn.temp[110+((s-1)*2)] = obj_ini.ship_wep[i][s]; - cn.temp[110+((s-1)*2)+1] = obj_ini.ship_wep_facing[i][s]; + cn.temp[110 + ((s - 1) * 2)] = obj_ini.ship_wep[i][s]; + cn.temp[110 + ((s - 1) * 2) + 1] = obj_ini.ship_wep_facing[i][s]; } cn.temp[118] = $"{obj_ini.ship_carrying[i]}/{obj_ini.ship_capacity[i]}"; cn.temp[119] = ""; - if (obj_ini.ship_carrying[i] > 0) then cn.temp[119] = scr_ship_occupants(i); + if (obj_ini.ship_carrying[i] > 0) { + cn.temp[119] = scr_ship_occupants(i); + } } tooltip_draw($"Carrying ({cn.temp[118]}): {cn.temp[119]}"); if (_goto_button.click()) { - with(obj_p_fleet) { + with (obj_p_fleet) { var _fleet_ships = fleet_full_ship_array(); - if (array_contains(_fleet_ships, i)){ + if (array_contains(_fleet_ships, i)) { obj_controller.x = x; obj_controller.y = y; obj_controller.menu = 0; - with(obj_fleet_show) { + with (obj_fleet_show) { instance_destroy(); - } - instance_create(x, y, obj_fleet_show); + } + instance_create(x, y, obj_fleet_show); } } } @@ -243,11 +255,11 @@ function scr_fleet_advisor(){ draw_set_color(c_gray); draw_rectangle(xx + 488, yy + 492, xx + 756, yy + 634, 1); - var ships = ["Battle Barge", "Strike Cruiser","Gladius","Hunter"]; + var ships = ["Battle Barge", "Strike Cruiser", "Gladius", "Hunter"]; var ship_im = 0; - for (var i=0;i=0 ? "the ship" :""} '{cur_arti.location_string()}'."; - if (cur_arti.identified() > 0) and (identifiable = 0) { + var artif_descr = $"This artifact is an unidentified {cur_arti.type()}.##It is stored on {cur_arti.ship_id() >= 0 ? "the ship" : ""} '{cur_arti.location_string()}'."; + if ((cur_arti.identified() > 0) && (identifiable == 0)) { draw_set_color(881503); artif_descr += $"#To be identified it must be brought to a fleet with a Battle Barge or your Homeworld."; - }else if (cur_arti.identified() > 0) and(identifiable = 1) { + } else if ((cur_arti.identified() > 0) && (identifiable == 1)) { draw_set_color(881503); artif_descr += $"##It will be identified in {cur_arti.identified()} turns. #You may spend 150 Requisition to identify it immediately."; //TODO solidify following button into a proper styled struct button - var ident_button = draw_unit_buttons([532,765], "IDENTIFY NOW",[1,1],c_black,,fnt_40k_14b,,1,c_gray); - if (point_and_click(ident_button)){ - if (requisition>=150){ - obj_ini.artifact_identified[menu_artifact]=0; - requisition-=150; - cooldown=8000; - identifiable=0; - audio_play_sound(snd_identify,-500,0); - audio_sound_gain(snd_identify,master_volume*effect_volume,0); - } + var ident_button = draw_unit_buttons([532, 765], "IDENTIFY NOW", [1, 1], c_black,, fnt_40k_14b,, 1, c_gray); + if (point_and_click(ident_button)) { + if (requisition >= 150) { + obj_ini.artifact_identified[menu_artifact] = 0; + requisition -= 150; + cooldown = 8000; + identifiable = 0; + audio_play_sound(snd_identify, -500, 0); + audio_sound_gain(snd_identify, master_volume * effect_volume, 0); + } } - } - else if (cur_arti.identified() < 1) { + } else if (cur_arti.identified() < 1) { draw_set_color(881503); artif_descr = ""; - try{ + try { artif_descr = cur_arti.description(); - } catch( _exception){ + } catch (_exception) { handle_exception(_exception); } tooltip = ""; tooltip_other = ""; - var arti_data = gear_weapon_data("any",cur_arti.type(), "all", false, cur_arti.quality()); + var arti_data = gear_weapon_data("any", cur_arti.type(), "all", false, cur_arti.quality()); var _can_equip = cur_arti.can_equip(); - if (_can_equip){ - if (cur_arti.equipped()) then _can_equip = false; + if (_can_equip) { + if (cur_arti.equipped()) { + _can_equip = false; + } - if (_can_equip){ - if (artifact_equip.draw_shutter(385, 770, "EQUIP", 0.3,true)){ - if (_can_equip && !instance_exists(obj_popup)){ - equip_artifact_popup_setup(); + if (_can_equip) { + if (artifact_equip.draw_shutter(385, 770, "EQUIP", 0.3, true)) { + if (_can_equip && !instance_exists(obj_popup)) { + equip_artifact_popup_setup(); } - } } else if (is_array(cur_arti.bearer)) { - if (artifact_equip.draw_shutter(385, 770, "UNEQUIP", 0.3,true)){ + if (artifact_equip.draw_shutter(385, 770, "UNEQUIP", 0.3, true)) { cur_arti.unequip_from_unit(); - } + } } } - if (artifact_gift.draw_shutter(575, 770, "GIFT", 0.3, true)){ - setup_gift_artifact_popup() + if (artifact_gift.draw_shutter(575, 770, "GIFT", 0.3, true)) { + setup_gift_artifact_popup(); } - if (artifact_destroy.draw_shutter(765, 770, "DESTROY", 0.3, true)){ + if (artifact_destroy.draw_shutter(765, 770, "DESTROY", 0.3, true)) { // Below here cleans up the artifacts - if (menu_artifact==fest_display) then fest_display=0; + if (menu_artifact == fest_display) { + fest_display = 0; + } cur_arti.destroy_arti(); @@ -100,7 +104,7 @@ function scr_librarium_gui(){ array_delete(recent_turn, e, 1); array_delete(recent_number, e, 1); } - scr_recent("artifact_destroyed", obj_controller.recent_keyword,2); + scr_recent("artifact_destroyed", obj_controller.recent_keyword, 2); scr_recent("", "", 0); break; } @@ -110,7 +114,7 @@ function scr_librarium_gui(){ } var base_type = cur_arti.determine_base_type(); var _tip2 = ""; - if (base_type!="device" && is_struct(arti_data)){ + if (base_type != "device" && is_struct(arti_data)) { if (arti_data.armour_value != 0) { _tip2 += $"{arti_data.armour_value} Armour#"; } @@ -129,7 +133,8 @@ function scr_librarium_gui(){ if (arti_data.damage_resistance_mod != 0) { _tip2 += $"{arti_data.damage_resistance_mod}% Resistance Bonus#"; } - if (base_type=="gear") { // Gear + if (base_type == "gear") { + // Gear _tip2 = tooltip_other; } } @@ -139,7 +144,6 @@ function scr_librarium_gui(){ artifact_slate.body_text = artif_descr; artifact_slate.draw_with_dimensions(); - } else { artifact_destroy.draw_shutter(765, 740, "DESTROY", 0.3, false); artifact_equip.draw_shutter(385, 740, "EQUIP", 0.3, false); @@ -151,12 +155,12 @@ function scr_librarium_gui(){ pop_draw_return_values(); } -function scr_librarium(){ +function scr_librarium() { add_draw_return_values(); - var blurp=""; - var xx = __view_get(e__VW.XView, 0) + 0; - var yy = __view_get(e__VW.YView, 0) + 0; - draw_sprite(spr_rock_bg, 0, xx, yy); + var blurp = ""; + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0; + draw_sprite(spr_rock_bg, 0, xx, yy); draw_set_alpha(0.75); draw_set_color(0); @@ -172,9 +176,9 @@ function scr_librarium(){ draw_set_color(c_gray); draw_rectangle(xx + 945, yy + 66, xx + 1580, yy + 818, 1); // Right librarium box - if (menu_adept = 0) { + if (menu_adept == 0) { // draw_sprite(spr_advisors,3,xx+16,yy+43); - if(struct_exists(obj_ini.custom_advisors, "librarian")){ + if (struct_exists(obj_ini.custom_advisors, "librarian")) { scr_image("advisor/splash", obj_ini.custom_advisors.librarian, xx + 16, yy + 43, 310, 828); } else { scr_image("advisor/splash", 4, xx + 16, yy + 43, 310, 828); @@ -185,10 +189,10 @@ function scr_librarium(){ draw_set_color(c_gray); draw_set_font(fnt_40k_30b); draw_text_transformed(xx + 336 + 16, yy + 66, "Librarium", 1, 1, 0); - draw_text_transformed(xx + 336 + 16, yy + 100, string_hash_to_newline("Chief " + string(obj_ini.role[100, 17]) + " " + string(obj_ini.name[0, 4])), 0.6, 0.6, 0); + draw_text_transformed(xx + 336 + 16, yy + 100, string_hash_to_newline("Chief " + string(obj_ini.role[100][17]) + " " + string(obj_ini.name[0][4])), 0.6, 0.6, 0); draw_set_font(fnt_40k_14); } - if (menu_adept = 1) { + if (menu_adept == 1) { // draw_sprite(spr_advisors,0,xx+16,yy+43); scr_image("advisor/splash", 1, xx + 16, yy + 43, 310, 828); draw_set_halign(fa_left); @@ -200,30 +204,36 @@ function scr_librarium(){ } // Set pace of recruitment based on training psyker value - if (training_psyker >= 0 && training_psyker <= 6){ + if (training_psyker >= 0 && training_psyker <= 6) { var _recruit_pace = ARR_recruitment_pace; blurp += _recruit_pace[training_psyker]; } - var artif = "", - artif_descr = "", - tp = 0; + var artif = "", artif_descr = "", tp = 0; - if (unused_artifacts = 0) { artif = "no unused artifacts.";} - else if (unused_artifacts = 1) { artif = "one unused artifact.";} - else if (unused_artifacts > 1) { artif = string(unused_artifacts) + " unused artifacts.";} + if (unused_artifacts == 0) { + artif = "no unused artifacts."; + } else if (unused_artifacts == 1) { + artif = "one unused artifact."; + } else if (unused_artifacts > 1) { + artif = string(unused_artifacts) + " unused artifacts."; + } // Greetings message - if (menu_adept = 0) then draw_text_ext(xx + 336 + 16, yy + 130, string_hash_to_newline("Chapter Master " + string(obj_ini.name[0, 0]) + ", greetings.#I assume you've come for the report? The Chapter currently possesses " + string(temp[36]) + " Epistolaries, " + string(temp[37]) + " Codiceries, and " + string(temp[38]) + " Lexicanum. We are working to identify additional warp-sensitive brothers before they cause harm, and the training is " + string(blurp) + ".##We could likely speed up the identification and application of appropriate training, but we would need more resources...I don't suppose we can spare some?##Our Chapter has " + string(artif)), -1, 536); - if (menu_adept = 1) then draw_text_ext(xx + 336 + 16, yy + 130, string_hash_to_newline("Your Chapter contains " + string(temp[36]) + " " + string(obj_ini.role[100, 17]) + "s, " + string(temp[37]) + " Codiceries, and " + string(temp[38]) + " Lexicanum.##Training of more " + string(obj_ini.role[100, 17]) + "s is " + string(blurp) + ".##Your chapter has " + string(artif)), -1, 536); + if (menu_adept == 0) { + draw_text_ext(xx + 336 + 16, yy + 130, string_hash_to_newline("Chapter Master " + string(obj_ini.name[0][0]) + ", greetings.#I assume you've come for the report? The Chapter currently possesses " + string(temp[36]) + " Epistolaries, " + string(temp[37]) + " Codiceries, and " + string(temp[38]) + " Lexicanum. We are working to identify additional warp-sensitive brothers before they cause harm, and the training is " + string(blurp) + ".##We could likely speed up the identification and application of appropriate training, but we would need more resources...I don't suppose we can spare some?##Our Chapter has " + string(artif)), -1, 536); + } + if (menu_adept == 1) { + draw_text_ext(xx + 336 + 16, yy + 130, string_hash_to_newline("Your Chapter contains " + string(temp[36]) + " " + string(obj_ini.role[100][17]) + "s, " + string(temp[37]) + " Codiceries, and " + string(temp[38]) + " Lexicanum.##Training of more " + string(obj_ini.role[100][17]) + "s is " + string(blurp) + ".##Your chapter has " + string(artif)), -1, 536); + } draw_set_color(881503); draw_set_halign(fa_center); identifiable = 0; if (artifacts > 0) { - var usey =0; + var usey = 0; for (var i = 0, ilen = array_length(obj_ini.artifact); i < ilen; i++) { - if (obj_ini.artifact[i]!="") { + if (obj_ini.artifact[i] != "") { usey++; } if (i == menu_artifact) { @@ -232,23 +242,23 @@ function scr_librarium(){ } draw_text(xx + 622, yy + 440, $"[Artifact {usey} of {artifacts}]"); - if scr_hit(xx + 326 + 16, yy + 426, xx + 887 + 16, yy + 818) { + if (scr_hit(xx + 326 + 16, yy + 426, xx + 887 + 16, yy + 818)) { var arrow_hovered = false; var scroll_engaged = false; - var arrow = [xx+400,yy+437,xx+445,yy+461]; - if (scr_hit(arrow[0],arrow[1],arrow[2],arrow[3])) { + var arrow = [xx + 400, yy + 437, xx + 445, yy + 461]; + if (scr_hit(arrow[0], arrow[1], arrow[2], arrow[3])) { arrow_hovered = true; - if (scr_click_left()){ + if (scr_click_left()) { scroll_engaged = true; } } - if (mouse_wheel_down()){ + if (mouse_wheel_down()) { scroll_engaged = true; } if (scroll_engaged) { - artifact_namer.allow_input=false; - identifiable=false; + artifact_namer.allow_input = false; + identifiable = false; artifact_equip = new ShutterButton(); artifact_gift = new ShutterButton(); artifact_destroy = new ShutterButton(); @@ -260,7 +270,7 @@ function scr_librarium(){ break; } } - if (!done and menu_artifact <= 0) { + if (!done && menu_artifact <= 0) { // we didn't find a lower artifact to goto, so we find the highest for (var i = array_length(obj_ini.artifact) - 1; i >= 0; i--) { if (obj_ini.artifact[i] != "") { @@ -276,20 +286,20 @@ function scr_librarium(){ arrow_hovered = false; scroll_engaged = false; - arrow = [xx+790,yy+437,xx+832,yy+461]; - if (scr_hit(arrow[0],arrow[1],arrow[2],arrow[3])) { + arrow = [xx + 790, yy + 437, xx + 832, yy + 461]; + if (scr_hit(arrow[0], arrow[1], arrow[2], arrow[3])) { arrow_hovered = true; - if (scr_click_left()){ + if (scr_click_left()) { scroll_engaged = true; } } - if (mouse_wheel_up()){ + if (mouse_wheel_up()) { scroll_engaged = true; } if (scroll_engaged) { - artifact_namer.allow_input=false; - identifiable=0; + artifact_namer.allow_input = false; + identifiable = 0; artifact_equip = new ShutterButton(); artifact_gift = new ShutterButton(); artifact_destroy = new ShutterButton(); @@ -302,7 +312,7 @@ function scr_librarium(){ break; } } - if (!done and menu_artifact >= max_index) { + if (!done && menu_artifact >= max_index) { // we didn't find a higher artifact to goto, so we find the lowest for (var i = 0, ilen = array_length(obj_ini.artifact); i < ilen; i++) { if (obj_ini.artifact[i] != "") { @@ -318,38 +328,44 @@ function scr_librarium(){ } var artifact_name = obj_ini.artifact_struct[menu_artifact].name; - if (artifact_name == "") then artifact_name = obj_ini.artifact[menu_artifact]; - obj_ini.artifact_struct[menu_artifact].name = artifact_namer.draw(artifact_name); + if (artifact_name == "") { + artifact_name = obj_ini.artifact[menu_artifact]; + } + obj_ini.artifact_struct[menu_artifact].name = artifact_namer.draw(artifact_name); draw_sprite(spr_arrow, 0, xx + 403, yy + 433); draw_sprite(spr_arrow, 1, xx + 795, yy + 433); if (instance_exists(obj_p_fleet)) { - with(obj_p_fleet) { + with (obj_p_fleet) { var _cur_arti = obj_ini.artifact_struct[obj_controller.menu_artifact]; var good = 0; - for (var i = 0; i <= max(array_length(capital_num),array_length(frigate_num),array_length(escort_num)); i++) { - if (i <= 9 && i 0) then good = 2; - if (good = 2) then obj_controller.identifiable = 1; + if ((good == 1) && (capital_number > 0)) { + good = 2; + } + if (good == 2) { + obj_controller.identifiable = 1; + } } } // Artifact description box - } + } draw_set_color(881503); draw_set_halign(fa_center); pop_draw_return_values(); -} \ No newline at end of file +} diff --git a/scripts/scr_map_and_warp_functions/scr_map_and_warp_functions.gml b/scripts/scr_map_and_warp_functions/scr_map_and_warp_functions.gml index aa8d3217fc..bb4e950807 100644 --- a/scripts/scr_map_and_warp_functions/scr_map_and_warp_functions.gml +++ b/scripts/scr_map_and_warp_functions/scr_map_and_warp_functions.gml @@ -5,329 +5,346 @@ // } // Main menu movement -function in_camera_view(rect){ - var x1 = __view_get( e__VW.XView, 0 ); - var y1 = __view_get( e__VW.YView, 0 ); - var w = x1 + camera_get_view_width(view_camera[0]); - var h = y1 + camera_get_view_height(view_camera[0]); - return rectangle_in_rectangle(rect[0],rect[1],rect[2],rect[3], x1, y1, w, h); +function in_camera_view(rect) { + var x1 = camera_get_view_x(view_camera[0]); + var y1 = camera_get_view_y(view_camera[0]); + var w = x1 + camera_get_view_width(view_camera[0]); + var h = y1 + camera_get_view_height(view_camera[0]); + return rectangle_in_rectangle(rect[0], rect[1], rect[2], rect[3], x1, y1, w, h); } - -function main_map_move_keys(){ +function main_map_move_keys() { var view_w = camera_get_view_width(view_camera[0]); var view_h = camera_get_view_height(view_camera[0]); var x_limits = 0; var y_limits = 0; - if ((menu==0) and (formating==0)) or (instance_exists(obj_fleet)){ - var spd=12*obj_controller.scale_mod,keyb=""; // player move speed on campaign map - if (!instances_exist_any([obj_ingame_menu,obj_ncombat]) || instance_exists(obj_fleet)){ - if keyboard_check(vk_shift){spd*=3;} // shift down, increase speed - var view_x = __view_get( e__VW.XView, 0 )+2; - var view_y = __view_get( e__VW.YView, 0 )+2; - - if ((keyboard_check(vk_left)) or (mouse_x<=view_x+(view_w*0.02)) or (keyboard_check(ord("A")))) and (x>x_limits){ - var rel_view = view_w>global.default_view_width ?global.default_view_width/2:view_w/2; - x = (x>view_x+rel_view) ? view_x+rel_view : x; - x-=spd; - } - if ((keyboard_check(vk_right)) or (mouse_x>=view_x+(view_w*0.98)) or (keyboard_check(ord("D")))) and (x<(room_width-(x_limits))){ - var rel_view = view_w>global.default_view_width ?global.default_view_width/2:view_w/2; - x = (xy_limits){ - var rel_view = view_h>global.default_view_height ?global.default_view_height/2:view_h/2; - y = (y>view_y+rel_view) ? view_y+rel_view : y; - y-=spd; - } - if ((keyboard_check(vk_down)) or (mouse_y>=view_y+(view_h*0.98)) or (keyboard_check(ord("S")))) and (yglobal.default_view_height ?global.default_view_height/2:view_h/2; - y = (y x_limits)) { + var rel_view = view_w > global.default_view_width ? global.default_view_width / 2 : view_w / 2; + x = (x > view_x + rel_view) ? view_x + rel_view : x; + x -= spd; + } + if ((keyboard_check(vk_right) || (mouse_x >= view_x + (view_w * 0.98)) || keyboard_check(ord("D"))) && (x < (room_width - x_limits))) { + var rel_view = view_w > global.default_view_width ? global.default_view_width / 2 : view_w / 2; + x = (x < view_x + view_w - rel_view) ? view_x + view_w - rel_view : x; + x += spd; + } + if ((keyboard_check(vk_up) || (mouse_y <= view_y + (view_h * 0.02)) || keyboard_check(ord("W"))) && (y > y_limits)) { + var rel_view = view_h > global.default_view_height ? global.default_view_height / 2 : view_h / 2; + y = (y > view_y + rel_view) ? view_y + rel_view : y; + y -= spd; + } + if ((keyboard_check(vk_down) || (mouse_y >= view_y + (view_h * 0.98)) || keyboard_check(ord("S"))) && (y < room_height - y_limits)) { + var rel_view = view_h > global.default_view_height ? global.default_view_height / 2 : view_h / 2; + y = (y < view_y + view_h - rel_view) ? view_y + view_h - rel_view : y; + y += spd; + } + } + } + + x = clamp(x, x_limits, room_width); + y = clamp(y, y_limits, room_height); } -function scr_map_scale(){ - return global.default_view_width/camera_get_view_width(view_camera[0]); +function scr_map_scale() { + return global.default_view_width / camera_get_view_width(view_camera[0]); } -function draw_warp_lanes(){ - static routes = []; - static current_seed = global.game_seed; - if (array_length(routes)==0 || current_seed!=global.game_seed){ - current_seed=global.game_seed; - routes = []; - var star_degrade_list = []; - var total_stars = instance_number(obj_star); - var cur_star,this_star,connection,i, check_star; - for (i = 0; i < total_stars; i++){ - array_push(star_degrade_list, i); - } - for (i = 0; i < total_stars; i++){ - cur_star = instance_find(obj_star,star_degrade_list[i]); - var this_star = cur_star.id; - var in_view = true; - - //var in_view = in_camera_view(star_box_shape(this_star)); - //if (!in_view) then in_view = zoomed; - if (array_length(cur_star.warp_lanes)>0){ - for (var s = 0; s < total_stars; s++){ - if (s==i) then continue - check_star = instance_find(obj_star,star_degrade_list[s]); - //if (!in_view && !in_camera_view(star_box_shape(check_star))) then continue; - connection = determine_warp_join(check_star.id, this_star); - if (connection){ - array_push(routes, [[check_star.x,check_star.y,this_star.x,this_star.y],connection]); - } - } - } - array_delete(star_degrade_list, i,1); - total_stars--; - i--; - } - } - var route; - static warp_image=-1; - warp_image+=0.5; - if warp_image==58 then warp_image = 0; - // if (!warp_point_hover) then hover_time=0; - // warp_point_hover = false; - for (var i = 0;i=0 ? 1:-1; - var downward = direction_y>=0 ? 1:-1; - //var grade = direction_x/direction_y; - var total_dist = 80; - var pythag_dist = sqr(total_dist) - var sum = (direction_x*forward)+(direction_y*downward) - var x_ratio = direction_x*forward/(sum); - var y_ratio = direction_y*downward/(sum); - /*if (debug_c<100){ +function draw_warp_lanes() { + static routes = []; + static current_seed = global.game_seed; + if (array_length(routes) == 0 || current_seed != global.game_seed) { + current_seed = global.game_seed; + routes = []; + var star_degrade_list = []; + var total_stars = instance_number(obj_star); + var cur_star, this_star, connection, i, check_star; + for (i = 0; i < total_stars; i++) { + array_push(star_degrade_list, i); + } + for (i = 0; i < total_stars; i++) { + cur_star = instance_find(obj_star, star_degrade_list[i]); + var this_star = cur_star.id; + var in_view = true; + + //var in_view = in_camera_view(star_box_shape(this_star)); + //if (!in_view) then in_view = zoomed; + if (array_length(cur_star.warp_lanes) > 0) { + for (var s = 0; s < total_stars; s++) { + if (s == i) { + continue; + } + check_star = instance_find(obj_star, star_degrade_list[s]); + //if (!in_view && !in_camera_view(star_box_shape(check_star))) then continue; + connection = determine_warp_join(check_star.id, this_star); + if (connection) { + array_push(routes, [[check_star.x, check_star.y, this_star.x, this_star.y], connection]); + } + } + } + array_delete(star_degrade_list, i, 1); + total_stars--; + i--; + } + } + var route; + static warp_image = -1; + warp_image += 0.5; + if (warp_image == 58) { + warp_image = 0; + } + // if (!warp_point_hover) then hover_time=0; + // warp_point_hover = false; + for (var i = 0; i < array_length(routes); i++) { + draw_set_color(c_gray); + route = routes[i]; + + var route_coords = route[0]; + + if (route[1] < 4) { + draw_line(route_coords[0], route_coords[1], route_coords[2], route_coords[3]); + } else if (route[1] == 4) { + draw_set_color(c_yellow); + //TODO abstract code as a ratio distance function + //static debug_c = 0; + var direction_x = route_coords[2] - route_coords[0]; + var direction_y = route_coords[3] - route_coords[1]; + var forward = direction_x >= 0 ? 1 : -1; + var downward = direction_y >= 0 ? 1 : -1; + //var grade = direction_x/direction_y; + var total_dist = 80; + var pythag_dist = sqr(total_dist); + var sum = (direction_x * forward) + (direction_y * downward); + var x_ratio = direction_x * forward / sum; + var y_ratio = direction_y * downward / sum; + /*if (debug_c<100){ show_debug_message($"{x_ratio},{forward},{y_ratio},{downward}"); }*/ - var dist_x = (sqrt(pythag_dist*(x_ratio)))*forward; - var dist_y = (sqrt(pythag_dist*(y_ratio)))*downward; - - var warp_width = sprite_get_width(spr_warp_storm)*0.75; - var warp_height = sprite_get_height(spr_warp_storm)*0.75; - - for (var s=0;s 300); - } - var warp_route_tooltip = "Major warp route to {0} (x4 travel speed for warp capable crafts)\n\nHold Shift and click Left Mouse Button to see destination."; - if (scr_hit(hit_box)){ - //TODO centralise this for efficiency so it's only run once at the beggingin of step sequence - var star_overlap = false; - with (obj_star){ - if (point_distance(mouse_x, mouse_y, x, y)< 20){ - star_overlap=true; - break; - } - } - - if (!star_overlap){ - var to = instance_nearest(route_coords[2],route_coords[3], obj_star); - // warp_point_hover = true; - - if (_allow_tooltips){ - tooltip_draw(string(warp_route_tooltip, to.name)); - } - - /* if (array_equals(hover_loc,[route_coords[0] ,route_coords[1]])){ + var dist_x = sqrt(pythag_dist * x_ratio) * forward; + var dist_y = sqrt(pythag_dist * y_ratio) * downward; + + var warp_width = sprite_get_width(spr_warp_storm) * 0.75; + var warp_height = sprite_get_height(spr_warp_storm) * 0.75; + + for (var s = 0; s < route[1]; s++) { + draw_line(route_coords[0], route_coords[1], route_coords[0] + dist_x, route_coords[1] + dist_y); + } + + draw_sprite_centered(spr_warp_storm, warp_image + i, route_coords[0] + dist_x, route_coords[1] + dist_y, 0.75, 0.75, 0, c_white, 1); + + var hit_box = [route_coords[0] + dist_x - (warp_width / 2), route_coords[1] + dist_y - (warp_height / 2), route_coords[0] + dist_x + (warp_width / 2), route_coords[1] + dist_y + (warp_height / 2)]; + + var _allow_tooltips = !instance_exists(obj_star_select); + + if (_allow_tooltips && instance_exists(obj_fleet_select)) { + var mouse_consts = return_mouse_consts(); + + _allow_tooltips = !obj_fleet_select.currently_entered || (mouse_consts[0] - camera_get_view_x(view_camera[0]) > 300); + } + var warp_route_tooltip = "Major warp route to {0} (x4 travel speed for warp capable crafts)\n\nHold Shift and click Left Mouse Button to see destination."; + if (scr_hit(hit_box)) { + //TODO centralise this for efficiency so it's only run once at the beggingin of step sequence + var star_overlap = false; + with (obj_star) { + if (point_distance(mouse_x, mouse_y, x, y) < 20) { + star_overlap = true; + break; + } + } + + if (!star_overlap) { + var to = instance_nearest(route_coords[2], route_coords[3], obj_star); + // warp_point_hover = true; + + if (_allow_tooltips) { + tooltip_draw(string(warp_route_tooltip, to.name)); + } + + /* if (array_equals(hover_loc,[route_coords[0] ,route_coords[1]])){ hover_time++; } else { hover_loc = [route_coords[0] ,route_coords[1]]; hover_time = 0; }*/ - if ((mouse_check_button_pressed(mb_left) && keyboard_check(vk_shift)) /* || (instance_exists(obj_fleet_select) && hover_time>=30) */){ - set_map_pan_to_loc(to); - } - } - } - - for (var s=0;s=30) */){ - set_map_pan_to_loc(to); - } - } - } - //debug_c++; - } - - } + if (mouse_check_button_pressed(mb_left) && keyboard_check(vk_shift) /* || (instance_exists(obj_fleet_select) && hover_time>=30) */) { + set_map_pan_to_loc(to); + } + } + } + + for (var s = 0; s < route[1]; s++) { + draw_line(route_coords[2] + s, route_coords[3] + s, (route_coords[2] - dist_x + s), (route_coords[3] + s - dist_y)); + } + draw_sprite_centered(spr_warp_storm, warp_image + i, (route_coords[2] - dist_x), (route_coords[3] - dist_y), 0.75, 0.75, 0, c_white, 1); + + hit_box = [(route_coords[2] - dist_x) - (warp_width / 2), (route_coords[3] - dist_y) - (warp_height / 2), (route_coords[2] - dist_x) + (warp_width / 2), (route_coords[3] - dist_y) + (warp_height / 2)]; + if (scr_hit(hit_box)) { + var star_overlap = false; + with (obj_star) { + if (point_distance(mouse_x, mouse_y, x, y) < 20) { + star_overlap = true; + break; + } + } + if (!star_overlap) { + var to = instance_nearest(route_coords[0], route_coords[1], obj_star); + // warp_point_hover = true; + + if (_allow_tooltips) { + tooltip_draw(string(warp_route_tooltip, to.name)); + } + + // if (array_equals(hover_loc,[route_coords[2] ,route_coords[3]])){ + // hover_time++; + // } else { + // hover_loc = [route_coords[2] ,route_coords[3]]; + // hover_time = 0; + // } + + if (mouse_check_button_pressed(mb_left) && keyboard_check(vk_shift) /* || (instance_exists(obj_fleet_select) && hover_time>=30) */) { + set_map_pan_to_loc(to); + } + } + } + //debug_c++; + } + } } -function create_complex_star_routes(player_star){ - var north=[], east=[], west=[], south=[], central=[]; - with (obj_star){ - - var _home = id == player_star; - if (_home){ - if (obj_ini.home_warp_position==0){//isolated environment - instance_deactivate_object(id); - continue; - } - } - var _allow_major = (!_home || (obj_ini.home_warp_position == 2 && _home)); - if (_allow_major){ - if (x<700) then array_push(west, id); - if (y<700) then array_push(north, id); - if (x>room_width-700) then array_push(east, id); - if (y>room_height-700) then array_push(south, id); - if (x>700) && (y>700) && (x room_width - 700) { + array_push(east, id); + } + if (y > room_height - 700) { + array_push(south, id); + } + if ((x > 700) && (y > 700) && (x < room_width - 700) && (y < room_height - 700)) { + array_push(central, id); + } + } + + var nearest_star = distance_removed_star(x, y, 1, true, true, false); + if (determine_warp_join(nearest_star.id, self.id)) { + array_push(warp_lanes, [distance_removed_star(x, y, 2, true, true, false).name, 1]); + } else { + array_push(warp_lanes, [nearest_star.name, 1]); + } + + if (!irandom(8) || (id == player_star && obj_ini.home_warp_position == 2)) { + array_push(warp_lanes, [distance_removed_star(x, y, irandom_range(3, 6), true, true, false).name, 1]); + } + } + full_loci = [north, east, west, south, central]; + // here is where we set up the warp hubs + var WarpHub, set, join_set, total_joins; + for (var i = 0; i < array_length(full_loci); i++) { + var player_hub_overide = false; + if (irandom(1)) { + if (obj_ini.home_warp_position != 2) { + continue; + } else { + if (!array_contains(full_loci[i], player_star)) { + continue; + } else { + player_hub_overide = true; + } + } + } else { + if (array_contains(full_loci[i], player_star)) { + player_hub_overide = true; + } + } + set = full_loci[i]; + if (array_length(set) == 0) { + continue; + } + if (player_hub_overide) { + for (var i = 0; i < array_length(set); i++) { + if (set[i] == player_star) { + WarpHub = set[i]; + break; + } + } + } else { + WarpHub = array_random_element(set); + } + total_joins = 0; + for (var s = 0; s < array_length(full_loci); s++) { + if (!irandom(1)) { + continue; + } + join_set = full_loci[s]; + var set_count = array_length(join_set); + if (s == i || set_count == 0) { + continue; + } + /*//if (irandom(1)) then continue; for (var i=0;i3) then break; - } - } - instance_activate_object(obj_star); + join_star = array_random_element(join_set); + array_push(WarpHub.warp_lanes, [join_star.name, 4]); + total_joins++; + if (total_joins > 3) { + break; + } + } + } + instance_activate_object(obj_star); } -function set_map_pan_to_loc(target){ - with(obj_controller){ - location_viewer.travel_target = [target.x, target.y]; - location_viewer.travel_increments = [(target.x-x)/15,(target.y-y)/15]; - location_viewer.travel_time = 0; - } +function set_map_pan_to_loc(target) { + with (obj_controller) { + location_viewer.travel_target = [target.x, target.y]; + location_viewer.travel_increments = [(target.x - x) / 15, (target.y - y) / 15]; + location_viewer.travel_time = 0; + } } + /*function ration_distance(){ }*/ -function star_box_shape(star="none"){ - var scale = obj_controller.map_scale; - if (star=="none"){ - return [x-(60*scale), y+(5*scale), x+60*scale , y-40*scale]; - } else { - with (star){ - return [x-(60*scale), y+(5*scale), x+60*scale , y-40*scale]; - } - } +function star_box_shape(star = "none") { + var scale = obj_controller.map_scale; + if (star == "none") { + return [x - (60 * scale), y + (5 * scale), x + 60 * scale, y - 40 * scale]; + } else { + with (star) { + return [x - (60 * scale), y + (5 * scale), x + 60 * scale, y - 40 * scale]; + } + } } -function draw_sprite_centered(sprite, subimg, x, y, xscale, yscale, rot, col, alpha){ - draw_set_halign(fa_left); - var width = ((sprite_get_width(sprite)*xscale)/2); - var height = ((sprite_get_height(sprite)*yscale)/2); - draw_sprite_ext(sprite, subimg, x, y, xscale, yscale, rot, col, alpha); -} \ No newline at end of file +function draw_sprite_centered(sprite, subimg, x, y, xscale, yscale, rot, col, alpha) { + draw_set_halign(fa_left); + var width = (sprite_get_width(sprite) * xscale) / 2; + var height = (sprite_get_height(sprite) * yscale) / 2; + draw_sprite_ext(sprite, subimg, x, y, xscale, yscale, rot, col, alpha); +} diff --git a/scripts/scr_planetary_feature/scr_planetary_feature.gml b/scripts/scr_planetary_feature/scr_planetary_feature.gml index b02c6c98ff..aa24487735 100644 --- a/scripts/scr_planetary_feature/scr_planetary_feature.gml +++ b/scripts/scr_planetary_feature/scr_planetary_feature.gml @@ -495,8 +495,8 @@ function discover_artifact_popup(feature) { /// @mixin obj_star_select function planet_selection_action() { - var xx = __view_get(e__VW.XView, 0) + 0; - var yy = __view_get(e__VW.YView, 0) + 0; + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0; if (instance_exists(target)) { if (loading) { obj_controller.selecting_planet = 0; diff --git a/scripts/scr_recruit_data/scr_recruit_data.gml b/scripts/scr_recruit_data/scr_recruit_data.gml index e926978a58..8437ed3324 100644 --- a/scripts/scr_recruit_data/scr_recruit_data.gml +++ b/scripts/scr_recruit_data/scr_recruit_data.gml @@ -1,25 +1,25 @@ -enum eTrials{ - BLOODDUEL, - HUNTING, - SURVIVAL, - EXPOSURE, - KNOWLEDGE, - CHALLENGE, - APPRENTICESHIP, - num +enum eTrials { + BLOODDUEL, + HUNTING, + SURVIVAL, + EXPOSURE, + KNOWLEDGE, + CHALLENGE, + APPRENTICESHIP, + num, } #macro ARR_recruitment_pace [" is currently halted."," is advancing sluggishly."," is advancing slowly."," is advancing moderately fast."," is advancing fast."," is advancing frenetically."," is advancing as fast as possible."] -#macro ARR_recruitement_rate ["HALTED","SLUGGISH","SLOW","MODERATE","FAST","FRENETIC","MAXIMUM",] -#macro ARR_recruitment_rates ["halted","sluggish","slow","moderate","fast","frenetic","hereticly fast"] +#macro ARR_recruitement_rate ["HALTED","SLUGGISH","SLOW","MODERATE","FAST","FRENETIC","MAXIMUM",] +#macro ARR_recruitment_rates ["halted","sluggish","slow","moderate","fast","frenetic","hereticly fast"] -#macro ARR_neophyte_rate ["HALTED","ONGOING"] -#macro ARR_neophyte_rates ["halted","ongoing"] +#macro ARR_neophyte_rate ["HALTED","ONGOING"] +#macro ARR_neophyte_rates ["halted","ongoing"] #macro ARR_apothecary_training_tiers [0,0.8,0.9,1,1.5,2,4 ] -#macro ARR_chaplain_training_tiers [0,0.8,0.9, 1,1.5,2,4] -#macro ARR_techmarine_training_tiers [0,1,2,4, 6,10,14] +#macro ARR_chaplain_training_tiers [0,0.8,0.9, 1,1.5,2,4] +#macro ARR_techmarine_training_tiers [0,1,2,4, 6,10,14] -function find_recruit_success_chance(local_apothecary_points, system, planet, ui=0) { +function find_recruit_success_chance(local_apothecary_points, system, planet, ui = 0) { var p_data = new PlanetData(planet, system); var _recruit_world = p_data.get_features(P_features.Recruiting_World)[0]; var _recruit_cost = _recruit_world.recruit_cost; @@ -41,46 +41,46 @@ function find_recruit_success_chance(local_apothecary_points, system, planet, ui if (local_apothecary_points > 0) { if (ui == 0) { if (_recruit_cost > 0 && obj_controller.requisition >= (_recruit_cost * 2)) { - obj_controller.requisition-=_recruit_cost * 2; + obj_controller.requisition -= _recruit_cost * 2; } else { - _recruit_world.recruit_cost=0; + _recruit_world.recruit_cost = 0; } } if (p_data.at_war(0, 1, 1) && p_data.player_disposition < 0) { - recruit_chance = 3000 + recruit_chance = 3000; } else if (p_data.at_war(0, 0, 0) && p_data.player_disposition < 0) { - recruit_chance = 2000 - } else if (p_data.player_disposition<-1000 && p_data.current_owner == eFACTION.Player) { - var recruit_chance = 1500 - _recruit_cost*100; + recruit_chance = 2000; + } else if (p_data.player_disposition < -1000 && p_data.current_owner == eFACTION.Player) { + var recruit_chance = 1500 - _recruit_cost * 100; } else { - var _frictious = (p_data.at_war(0, 1, 1) && p_data.player_disposition <= 50); + var _frictious = p_data.at_war(0, 1, 1) && p_data.player_disposition <= 50; var _disp_mod = -((_frictious ? 30 : 10) * p_data.player_disposition); var _faction_disp_mod = !_frictious ? 2000 : 3000; - var _recruit_cost_mod = -_recruit_cost*100; + var _recruit_cost_mod = -_recruit_cost * 100; - var recruit_chance = _disp_mod + _recruit_cost_mod + _faction_disp_mod - }; + var recruit_chance = _disp_mod + _recruit_cost_mod + _faction_disp_mod; + } if (_recruit_world.recruit_type == 1) { - recruit_chance = recruit_chance/2; + recruit_chance = recruit_chance / 2; if (recruit_chance < 300) { recruit_chance = 300; } if (ui == 0) { if (scr_has_adv("Ambushers")) { - var droll = irandom(400) + var droll = irandom(400); } else { - var droll = irandom(100) + var droll = irandom(100); } if (droll == 0) { - var _planet_name = p_data.name - scr_alert(#FF9900, "DIPLOMATIC DISASTER", $"Apothecaries at {_planet_name} has been spotted doing suspicious activities!", system.x, system.y) + var _planet_name = p_data.name; + scr_alert(#FF9900, "DIPLOMATIC DISASTER", $"Apothecaries at {_planet_name} has been spotted doing suspicious activities!", system.x, system.y); scr_event_log(#FF9900, $"Apothecaries at {_planet_name} has been spotted doing suspicious activities!", system.name); p_data.add_disposition(-25); if (p_data.current_owner != eFACTION.Player) { - obj_controller.disposition[p_data.current_owner]-=5; + obj_controller.disposition[p_data.current_owner] -= 5; } } } @@ -111,62 +111,62 @@ function find_recruit_success_chance(local_apothecary_points, system, planet, ui return _success_chance; } -function find_recruit_corruption(planet_type){ - var _recruit_corruption = 0; - var _trial_type = scr_trial_data(obj_controller.recruit_trial); - static _planet_types_data = { - // The first number is base, the second one is SD for gaussian distribution; - "Hive": { - corruption_bonus: [15, 2], - }, - "Temperate": { - corruption_bonus: [10, 2], - }, - "Feudal": { - corruption_bonus: [10, 2], - }, - "Forge": { - corruption_bonus: [5, 2], - }, - "Shrine": { - corruption_bonus: [-10, 2], - }, - "Desert": { - corruption_bonus: [5, 2], - }, - "Ice": { - corruption_bonus: [5, 2], - }, - "Agri": { - corruption_bonus: [5, 2], - }, - "Death": { - corruption_bonus: [5, 2], - }, - "Lava": { - corruption_bonus: [5, 2], - }, - }; - - if (struct_exists(_planet_types_data, planet_type)){ - var _planet_type_data = _planet_types_data[$ planet_type]; - if (struct_exists(_planet_type_data, "corruption_bonus")){ - var _planet_corruption = _planet_type_data[$ "corruption_bonus"][0]; - var _gauss_sd = _planet_type_data[$ "corruption_bonus"][1]; - _planet_corruption = gauss(_planet_corruption, _gauss_sd); - _recruit_corruption += _planet_corruption; - } - } - - if (struct_exists(_trial_type, "corruption_bonus")){ - var _trial_corruption = _trial_type[$ "corruption_bonus"][0]; - var _gauss_sd = _trial_type[$ "corruption_bonus"][1]; - _trial_corruption = gauss(_trial_corruption, _gauss_sd); - _recruit_corruption += _trial_corruption; - } - - _recruit_corruption = floor(_recruit_corruption); - _recruit_corruption = max(0, _recruit_corruption); +function find_recruit_corruption(planet_type) { + var _recruit_corruption = 0; + var _trial_type = scr_trial_data(obj_controller.recruit_trial); + static _planet_types_data = { + // The first number is base, the second one is SD for gaussian distribution; + "Hive": { + corruption_bonus: [15, 2], + }, + "Temperate": { + corruption_bonus: [10, 2], + }, + "Feudal": { + corruption_bonus: [10, 2], + }, + "Forge": { + corruption_bonus: [5, 2], + }, + "Shrine": { + corruption_bonus: [-10, 2], + }, + "Desert": { + corruption_bonus: [5, 2], + }, + "Ice": { + corruption_bonus: [5, 2], + }, + "Agri": { + corruption_bonus: [5, 2], + }, + "Death": { + corruption_bonus: [5, 2], + }, + "Lava": { + corruption_bonus: [5, 2], + }, + }; + + if (struct_exists(_planet_types_data, planet_type)) { + var _planet_type_data = _planet_types_data[$ planet_type]; + if (struct_exists(_planet_type_data, "corruption_bonus")) { + var _planet_corruption = _planet_type_data[$ "corruption_bonus"][0]; + var _gauss_sd = _planet_type_data[$ "corruption_bonus"][1]; + _planet_corruption = gauss(_planet_corruption, _gauss_sd); + _recruit_corruption += _planet_corruption; + } + } + + if (struct_exists(_trial_type, "corruption_bonus")) { + var _trial_corruption = _trial_type[$ "corruption_bonus"][0]; + var _gauss_sd = _trial_type[$ "corruption_bonus"][1]; + _trial_corruption = gauss(_trial_corruption, _gauss_sd); + _recruit_corruption += _trial_corruption; + } + + _recruit_corruption = floor(_recruit_corruption); + _recruit_corruption = max(0, _recruit_corruption); return _recruit_corruption; } @@ -176,7 +176,7 @@ function planet_training_sequence(local_apothecary_points) { var thirdpop = max_population / 3; var halfpop = max_population / 2; - if (obj_controller.faction_status[eFACTION.Imperium] != "War" && current_owner <= 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War") { + if ((obj_controller.faction_status[eFACTION.Imperium] != "War" && current_owner <= 5) || (obj_controller.faction_status[eFACTION.Imperium] == "War")) { var _planet_population = population; if (large_population) { _planet_population *= 1000000000; @@ -189,13 +189,13 @@ function planet_training_sequence(local_apothecary_points) { population -= 1; } - var recruit_chance = 999; - var aspirant = 0; - var new_recruit_corruption = find_recruit_corruption(planet_type); - show_debug_message($"new_recruit_corruption: {new_recruit_corruption}"); - var months_to_neo = 72; - var dista = 0; - var onceh = 0; + var recruit_chance = 999; + var aspirant = 0; + var new_recruit_corruption = find_recruit_corruption(planet_type); + show_debug_message($"new_recruit_corruption: {new_recruit_corruption}"); + var months_to_neo = 72; + var dista = 0; + var onceh = 0; var _recruit_chance = find_recruit_success_chance(local_apothecary_points, system, planet); aspirant = random(1) < _recruit_chance; @@ -285,354 +285,356 @@ function planet_training_sequence(local_apothecary_points) { } // End recruiting possible } -function scr_trial_data(wanted=-1){ - var role_data = instance_exists(obj_ini)? obj_ini.role[100] : obj_creation.role[100]; - var data = [ - { - name : "Blood Duel", - train_time : { - base : [24, 48], - }, - recruit_count_modifier : { - base : 0.3, - }, - seed_waste : 0.1, - corruption_bonus: [10, 2], - long_description :$"THE BLOOD DUEL? HA DO I EVEN NEED TO EXPLAIN, CHAPTER MASTER? ASPIRANTS ENTER. NEOPHYTES LEAVE. Those worthy of serving the Emperor are rewarded justly and those merely pretending at glory are lost in the BLOOD AND THUNDER of the dome. Do not be alarmed at the carnage. The Apothecarium has become quite adept at rebuilding those fit to serve. The others are given to the {role_data[eROLE.Techmarine]}s. The mind is a terrible thing to waste and the Emperor does hate waste. Not every man is useful as an Astartes but every man is useful.", - }, - { - name : "Hunting the Hunter", - train_time : { - base : [72, 80], - }, - exp_bonus : { - base:[0,0], - planets : { - Ice : [7,10], - Desert : [7,10], - Death : [7,10] - } - }, - recruit_count_modifier : { - base : 1, - planets : { - Ice :2, - Desert : 1.25, - Death : 3, - Feudal : 1.5 - } - }, - long_description :$"To be an Astartes is to be a hunter of xenos, of traitors, of heretics, and of all those that dare defy the Emperor. What better way to test the worthiness of Aspirants than to have to them hunt the most dangerous predator to be found on their planet? Such a task requires a combination of wits and cunning, in addition to raw martial skill. When they have received the blessed geneseed and become full battle brothers, they will hunt across the stars with bolter and chainsword. For now, let them hunt with nothing more than a spear and their wits.", - }, - { - name : "Survival of the Fittest", - train_time : { - base : [72, 80], - }, - recruit_count_modifier : { - base : 1.0, - planets : { - Ice :3, - Desert : 3, - Death : 3, - Feudal : 3 - } - }, - exp_bonus : { - base:[0,0], - }, - corruption_bonus: [5, 1], - long_description :$"To become one of the Imperium’s finest warriors, the Space Marines, is the greatest glory that any human can aspire to. And is glory not worth fighting, bleeding or even dying for? It must be, for whole worlds of ice, ash and sand have buried generations of sons in pursuit of this glory and never once called the price too dear. To ensure the necessary bloodshed, lies, paranoia and psychosis-inducing drugs have been introduced to . This trial will seperate the weak from the strong and the chaff from the wheat.", - }, - { - name : "Exposure", - train_time : { - base : [72, 80], - planets : { - Desert :[36, 60], - Ice :[36, 60], - Forge :[36, 60], - Lava :[36, 60], - Death :[36, 60], - } - }, - exp_bonus : { - base:[0,0], - planets : { - Ice : [2,4], - Desert : [2,4], - Death : [2,4], - } - }, - recruit_count_modifier : { - base : 1.0, - }, - long_description :$"Few worlds of the Imperium are free from the adversity of pollution or toxic waste. Still others are bequeathed with flows of lava and choking atmosphere. The glory of rising to astartes is only granted to those that can tackle and overcome these dangerous environments. Aspirants are placed upon the most hellish of planet in the sector, and then expected to traverse the continent with only himself to rely upon. Those who face the impossible without faltering and survive past the point they should have perished are recovered by {role_data[eROLE.Apothecary]}s, judged worthy of becoming a Neophyte.", - }, - { - name : "Knowledge of self", - train_time : { - base : [90, 108], - planets : { - Shrine :[70, 108], - } - }, - exp_bonus : { - base: [15,25], - planets : { - Temperate : [20,35], - } - }, - recruit_count_modifier : { - base : 1.0, - }, - corruption_bonus: [-5, 1], - long_description :$"An Aspirant’s spiritual and mental capability is every bit as important as his physical characteristics. It is wise to impose Trials not upon their body, but on the mind. Either through psychic powers, chemical agents, or endurance trials, the Aspirant’s willpower is tested. Those unworthy do not survive the stress and trauma placed upon their hearts- only those whose minds are proven to be unbreakable are welcomed into our ranks.", - }, - { - name : "Combat Challange", - train_time : { - base : [66, 80], - planets : { - Shrine :[70, 108], - } - }, - exp_bonus : { - base: [10,20,0.2], - }, - corruption_bonus: [5, 1], - long_description :$"What better gauge of an Aspirant than in a duel with our astartes? Our brother, unarmed and unarmoured, will face against the armed challenger until one cannot continue. It is impossible for the Aspirant to actually succeed these trials, but demonstrates how far they can possibly go, and allow us to judge him accordingly. As with most trials the Aspirant’s life is in their own hands. He who has failed the duel- yet proven himself worthy- is rescued from the jaws of death by {role_data[eROLE.Apothecary]} and allowed to progress to the rank of Neophyte.", - }, - { - name : "Apprenticeship", - train_time : { - base : [120, 140], - planets : { - Shrine :[70, 108], - } - }, - exp_bonus : { - base: [35, 40], - }, - recruit_count_modifier : { - base : 1, - planets : { - Lava :2, - }, - }, - corruption_bonus: [-10, 1], - long_description :$"What better way to cultivate astartes than to raise them from youth? The capable children of our recruitment targets are apprenticed to our battle brothers. Beneath their steady guidance the Aspirants spend several years learning the art of the smith. The most able are judged by our Chapter’s {role_data[eROLE.Apothecary]}s and {role_data[eROLE.Chaplain]} to deem if they are compatible with gene-seed implantation. If so, the Aspirant’s trial culminates in hunting and slaying a massive beast. Only the brightest and bravest are added to our ranks.", - }, - ] - if (wanted>-1){ - var train_traits = find_favoured_training_traits(wanted); - data[wanted].favoured_traits = train_traits[1]; - data[wanted].disfavoured_traits = train_traits[0]; - return data[wanted]; - } else { - for (var i=0;i -1) { + var train_traits = find_favoured_training_traits(wanted); + data[wanted].favoured_traits = train_traits[1]; + data[wanted].disfavoured_traits = train_traits[0]; + return data[wanted]; + } else { + for (var i = 0; i < array_length(data); i++) { + var train_traits = find_favoured_training_traits(i); + data[i].favoured_traits = train_traits[1]; + data[i].disfavoured_traits = train_traits[0]; + data[i].stat_diffs = train_traits[2]; + } + return data; + } } -function find_favoured_training_traits(training_enum){ - var _traits = global.astartes_trait_dist; - var _trait_data; - var disfavoured_traits = []; - var favoured_traits = []; - var trait_id =""; - var stat_diffs = {}; - var _stat_names = ARR_stat_list; - for (var i=0;i= 3){ - var _trait_spawn_mods = _trait_data[2]; - if (is_struct(_trait_spawn_mods)){ - if (struct_exists(_trait_spawn_mods,"recruit_trial")){ - var _trial_spawn_mods = _trait_spawn_mods.recruit_trial; - for (var s=0;s= 3) { + var _trait_spawn_mods = _trait_data[2]; + if (is_struct(_trait_spawn_mods)) { + if (struct_exists(_trait_spawn_mods, "recruit_trial")) { + var _trial_spawn_mods = _trait_spawn_mods.recruit_trial; + for (var s = 0; s < array_length(_trial_spawn_mods); s++) { + if (_trial_spawn_mods[s][0] == training_enum) { + var _trait_spawn_chance = _trial_spawn_mods[s][1]; + var _spawn_percent = (_trait_spawn_chance / _trait_data[1][0]) * -1; + if (_trial_spawn_mods[s][1]) { + array_push(disfavoured_traits, trait_id); + } else { + array_push(favoured_traits, trait_id); + } + if (_spawn_percent != 0) { + var _trait_stats = global.trait_list[$ trait_id]; + for (var stat_i = 0; stat_i < array_length(_stat_names); stat_i++) { + var stat = _stat_names[stat_i]; + if (struct_exists(_trait_stats, stat)) { + var _stat_value = _trait_stats[$ stat]; + if (is_array(_stat_value)) { + _stat_value = _stat_value[0]; + } + stat_diffs[$ stat] += _stat_value * _spawn_percent; + } + } + } + break; + } + } + } + } + } + } + return [disfavoured_traits, favoured_traits, stat_diffs]; } -function scr_compile_trial_bonus_string(trial_data){ - var bonus_string = ""; - var train_time_string = function(tarray){ - return $"{tarray[0]/12} - {tarray[1]/12}" ; - } - var exp_bonus_string = function(tarray){ - if (tarray[0] == 0 && tarray[1]==0){ - tarray[1]=5; - } - return $"{tarray[0]} - {tarray[1]}" ; - } - if (struct_exists(trial_data,"train_time")){ - var train_time_data = trial_data.train_time; - bonus_string+=$"Years training : {train_time_string(train_time_data.base)}\n"; - if (struct_exists(train_time_data, "planets")){ - var planets = struct_get_names(train_time_data.planets); - for (var i=0;idata_upper_end){ - data_lower_end=data[$_stat]; - } - } - //data_upper_end = - static draw = function(){ - - } + +function StatDistributionUnit(data) constructor { + data_upper_end = 0; + data_lower_end = 0; + var _stat_names = ARR_stat_list; + for (var i = 0; i < array_length(_stat_names); i++) { + var _stat = _stat_names[i]; + if (data[$ _stat] < data_lower_end) { + data_lower_end = data[$ _stat]; + } + if (data[$ data_upper_end] > data_upper_end) { + data_lower_end = data[$ _stat]; + } + } + + //data_upper_end = + static draw = function() {}; } -function set_up_recruitment_view(){ - with (obj_controller){ - menu=15; - onceh=1; - cooldown=8000; - click=1; - recruit_list_pane = new DataSlate(); - recruit_list_pane.inside_method = function(){ - var xx=__view_get( e__VW.XView, 0 )+0; - var yy=__view_get( e__VW.YView, 0 )+0+60; - draw_set_font(fnt_40k_30b); - draw_set_halign(fa_center); - draw_text_transformed(xx + 1242, yy + 70, "Neophytes", 0.6, 0.6, 0); - - if (recruit_name[0] != "") { - draw_set_font(fnt_40k_14); - draw_set_halign(fa_left); - - var t_eta = 0; - for (var qp = 0, n = 0; qp < array_length(recruit_name) && n < 36; qp++) { - if (recruit_name[qp] != "") { - n++; - draw_rectangle(xx + 947, yy + 100 + ((n - 1) * 20), xx + 1577, yy + 100 + (n * 20), 1); - draw_text(xx + 950, yy + 100 + ((n - 1) * 20), $"Neophyte {recruit_name[qp]}"); - draw_text(xx + 1200, yy + 100 + ((n - 1) * 20), $"Starting EXP: {recruit_exp[qp]}"); - draw_text(xx + 1500, yy + 100 + ((n - 1) * 20),$"ETA: {recruit_training[qp] + recruit_distance[qp]}"); - } - } - } - } - left_panel = new DataSlate(); - middle_panel = new DataSlate(); - } + +function set_up_recruitment_view() { + with (obj_controller) { + menu = 15; + onceh = 1; + cooldown = 8000; + click = 1; + recruit_list_pane = new DataSlate(); + recruit_list_pane.inside_method = function() { + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0 + 60; + draw_set_font(fnt_40k_30b); + draw_set_halign(fa_center); + draw_text_transformed(xx + 1242, yy + 70, "Neophytes", 0.6, 0.6, 0); + + if (recruit_name[0] != "") { + draw_set_font(fnt_40k_14); + draw_set_halign(fa_left); + + var t_eta = 0; + for (var qp = 0, n = 0; qp < array_length(recruit_name) && n < 36; qp++) { + if (recruit_name[qp] != "") { + n++; + draw_rectangle(xx + 947, yy + 100 + ((n - 1) * 20), xx + 1577, yy + 100 + (n * 20), 1); + draw_text(xx + 950, yy + 100 + ((n - 1) * 20), $"Neophyte {recruit_name[qp]}"); + draw_text(xx + 1200, yy + 100 + ((n - 1) * 20), $"Starting EXP: {recruit_exp[qp]}"); + draw_text(xx + 1500, yy + 100 + ((n - 1) * 20), $"ETA: {recruit_training[qp] + recruit_distance[qp]}"); + } + } + } + }; + left_panel = new DataSlate(); + middle_panel = new DataSlate(); + } } /// @mixin -function scr_draw_recruit_advisor(){ - var blurp, eta, va; +function scr_draw_recruit_advisor() { + var blurp, eta, va; var romanNumerals; romanNumerals = scr_roman_numerals(); var _recruit_rate = ARR_recruitement_rate; - var xx=__view_get( e__VW.XView, 0 )+0; - var yy=__view_get( e__VW.YView, 0 )+0; + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0; blurp = ""; eta = 0; draw_sprite(spr_rock_bg, 0, xx, yy); @@ -643,7 +645,7 @@ function scr_draw_recruit_advisor(){ draw_set_color(c_gray); draw_rectangle(xx + 326 + 16, yy + 66, xx + 887 + 16, yy + 818, 1); draw_line(xx + 326 + 16, yy + 480, xx + 887 + 16, yy + 480); - var lower_middle_box = [xx+326, yy+480, xx+887, yy+828]; + var lower_middle_box = [xx + 326, yy + 480, xx + 887, yy + 828]; draw_set_alpha(0.75); draw_set_color(0); draw_rectangle(xx + 945, yy + 66, xx + 1580, yy + 818, 0); @@ -651,20 +653,21 @@ function scr_draw_recruit_advisor(){ draw_set_color(c_gray); draw_rectangle(xx + 945, yy + 66, xx + 1580, yy + 818, 1); - if (menu_adept = 0) { + if (menu_adept == 0) { // draw_sprite(spr_advisors,5,xx+16,yy+43); - if(struct_exists(obj_ini.custom_advisors, "recruiter")){ + if (struct_exists(obj_ini.custom_advisors, "recruiter")) { scr_image("advisor/splash", obj_ini.custom_advisors.recruiter, xx + 16, yy + 43, 310, 828); } else { scr_image("advisor/splash", 6, xx + 16, yy + 43, 310, 828); - } draw_set_halign(fa_left); + } + draw_set_halign(fa_left); draw_set_color(c_gray); draw_set_font(fnt_40k_30b); draw_text_transformed(xx + 336 + 16, yy + 66, string_hash_to_newline("World " + string(obj_ini.recruiting_name)), 1, 1, 0); draw_text_transformed(xx + 336 + 16, yy + 100, string_hash_to_newline("First Sergeant " + string(recruiter_name)), 0.6, 0.6, 0); draw_set_font(fnt_40k_14); } - if (menu_adept = 1) { + if (menu_adept == 1) { // draw_sprite(spr_advisors,0,xx+16,yy+43); scr_image("advisor/splash", 1, xx + 16, yy + 43, 310, 828); draw_set_halign(fa_left); @@ -675,58 +678,59 @@ function scr_draw_recruit_advisor(){ draw_set_font(fnt_40k_14); } - if (menu_adept = 0) then blurp = $"Hail {obj_ini.name[0, 0]}! You asked for a report?\n\n"; + if (menu_adept == 0) { + blurp = $"Hail {obj_ini.name[0][0]}! You asked for a report?\n\n"; + } - if (obj_ini.doomed == 0) { - if (recruits <= 0) { - if (marines >= 1000) { - blurp += "Our Chapter currently has no Neophytes - we are at maximum strength and do not require more marines."; - } - if ((marines < 1000) && (recruiting == 0)) { - blurp += "Our Chapter currently has no Neophytes. Without training more our chapter is doomed to a slow death."; - } - if ((marines < 1000) && (recruiting > 0)) { - blurp += "Our Chapter currently has no Neophytes. We are doing our utmost best to find suitable recruits."; - } - } else if (recruits == 1) { - blurp += $"Our Chapter currently has one recruit being trained. The Neophyte's name is {recruit_name[0]} and they are scheduled to become a battle brother in {recruit_training[0] + recruit_distance[0]} months' time."; - } else if (recruits > 1) { - blurp += $"Our Chapter currently has {recruits} recruits being trained. {recruit_name[0]} is the next scheduled Neophyte to become a battle brother in {recruit_training[0] + recruit_distance[0]} months' time."; - } - - if (gene_seed > 0) { - var _recruit_rates = ARR_neophyte_rates; - var _cur_recruit_rate = $"The recruitment is {_recruit_rates[recruiting]}"; - if ((recruiting == 0) && (marines >= 1000)) { - blurp += $"\n{_cur_recruit_rate}. You must only give me the word and I can begin further increasing our numbers... though this would violate the Codex Astartes."; - } else if ((recruiting == 0) && (marines < 1000)) { - blurp += $"\n{_cur_recruit_rate}. You must only give me the word and I can begin further increasing our numbers."; - } else if (recruiting == 1) { - blurp += $"\n{_cur_recruit_rate}."; - } - } - } - - if (obj_ini.doomed == 1) { - blurp += "\nMutation of our gene-seed currently makes us unable to recruit new Neophytes. We are doomed to a slow demise unless the Apothecaries can fix it."; - } - - if (gene_seed == 0) { - blurp += "\nThere is no more gene-seed in our vaults and we cannot create more neophytes as a result. Something must be done, Chapter Master."; - } - - if (recruiting > 0) { - if ((string_count("|", obj_controller.recruiting_worlds) == 1)) { - blurp += $"\nWe're recruiting from one world - {obj_ini.recruiting_name}."; - } else if ((string_count("|", obj_controller.recruiting_worlds) == 2)) { - blurp += "\nWe're recruiting from two worlds. Finding recruits is vastly accelerated."; - } else if ((string_count("|", obj_controller.recruiting_worlds) > 2)) { - blurp += "\nWe're recruiting from several worlds."; - } - } - - - if (menu_adept = 1) { + if (obj_ini.doomed == 0) { + if (recruits <= 0) { + if (marines >= 1000) { + blurp += "Our Chapter currently has no Neophytes - we are at maximum strength and do not require more marines."; + } + if ((marines < 1000) && (recruiting == 0)) { + blurp += "Our Chapter currently has no Neophytes. Without training more our chapter is doomed to a slow death."; + } + if ((marines < 1000) && (recruiting > 0)) { + blurp += "Our Chapter currently has no Neophytes. We are doing our utmost best to find suitable recruits."; + } + } else if (recruits == 1) { + blurp += $"Our Chapter currently has one recruit being trained. The Neophyte's name is {recruit_name[0]} and they are scheduled to become a battle brother in {recruit_training[0] + recruit_distance[0]} months' time."; + } else if (recruits > 1) { + blurp += $"Our Chapter currently has {recruits} recruits being trained. {recruit_name[0]} is the next scheduled Neophyte to become a battle brother in {recruit_training[0] + recruit_distance[0]} months' time."; + } + + if (gene_seed > 0) { + var _recruit_rates = ARR_neophyte_rates; + var _cur_recruit_rate = $"The recruitment is {_recruit_rates[recruiting]}"; + if ((recruiting == 0) && (marines >= 1000)) { + blurp += $"\n{_cur_recruit_rate}. You must only give me the word and I can begin further increasing our numbers... though this would violate the Codex Astartes."; + } else if ((recruiting == 0) && (marines < 1000)) { + blurp += $"\n{_cur_recruit_rate}. You must only give me the word and I can begin further increasing our numbers."; + } else if (recruiting == 1) { + blurp += $"\n{_cur_recruit_rate}."; + } + } + } + + if (obj_ini.doomed == 1) { + blurp += "\nMutation of our gene-seed currently makes us unable to recruit new Neophytes. We are doomed to a slow demise unless the Apothecaries can fix it."; + } + + if (gene_seed == 0) { + blurp += "\nThere is no more gene-seed in our vaults and we cannot create more neophytes as a result. Something must be done, Chapter Master."; + } + + if (recruiting > 0) { + if (string_count("|", obj_controller.recruiting_worlds) == 1) { + blurp += $"\nWe're recruiting from one world - {obj_ini.recruiting_name}."; + } else if (string_count("|", obj_controller.recruiting_worlds) == 2) { + blurp += "\nWe're recruiting from two worlds. Finding recruits is vastly accelerated."; + } else if (string_count("|", obj_controller.recruiting_worlds) > 2) { + blurp += "\nWe're recruiting from several worlds."; + } + } + + if (menu_adept == 1) { blurp = string_replace(blurp, "Our", "Your"); blurp = string_replace(blurp, " our", " your"); blurp = string_replace(blurp, "We", "You"); @@ -737,13 +741,12 @@ function scr_draw_recruit_advisor(){ // draw_line(xx+216,yy+252,xx+597,yy+252);draw_line(xx+216,yy+292,xx+597,yy+292); var _neophyte_rate = ARR_neophyte_rate; - var blur = "", - amo = 0; + var blur = "", amo = 0; // ** Normal recruiting ** draw_set_color(16291875); draw_set_color(c_gray); - if (recruiting >= 0) and(recruiting <= 1){ - blur = _neophyte_rate[recruiting]; + if ((recruiting >= 0) && (recruiting <= 1)) { + blur = _neophyte_rate[recruiting]; } draw_text(xx + 407, yy + 354, string_hash_to_newline("Space Marine Recruiting: " + string(blur))); draw_text(xx + 728, yy + 354, string_hash_to_newline("[-] [+]")); @@ -751,34 +754,70 @@ function scr_draw_recruit_advisor(){ amo = 0; // ** Apothecary recruitment ** draw_set_color(16291875); - if (training_apothecary = 1) then amo = -1; - if (training_apothecary = 2) then amo = -2; - if (training_apothecary = 3) then amo = -3; - if (training_apothecary = 4) then amo = -4; - if (training_apothecary = 5) then amo = -6; - if (training_apothecary = 6) then amo = -12; - if (amo != 0) then draw_sprite(spr_requisition, 0, xx + 336 + 16, yy + 396); - if (training_apothecary != 0) then draw_text(xx + 351 + 16, yy + 394, string_hash_to_newline(string(amo))); + if (training_apothecary == 1) { + amo = -1; + } + if (training_apothecary == 2) { + amo = -2; + } + if (training_apothecary == 3) { + amo = -3; + } + if (training_apothecary == 4) { + amo = -4; + } + if (training_apothecary == 5) { + amo = -6; + } + if (training_apothecary == 6) { + amo = -12; + } + if (amo != 0) { + draw_sprite(spr_requisition, 0, xx + 336 + 16, yy + 396); + } + if (training_apothecary != 0) { + draw_text(xx + 351 + 16, yy + 394, string_hash_to_newline(string(amo))); + } draw_set_color(c_gray); - if (training_apothecary >= 0) and(training_apothecary <= 6) then blur = _recruit_rate[training_apothecary]; + if ((training_apothecary >= 0) && (training_apothecary <= 6)) { + blur = _recruit_rate[training_apothecary]; + } draw_text(xx + 407, yy + 394, string_hash_to_newline("Apothecary Training: " + string(blur))); draw_text(xx + 728, yy + 394, string_hash_to_newline("[-] [+]")); // TODO implement Spave Wolves and Iron Hands cases - if (global.chapter_name != "Space Wolves") and(global.chapter_name != "Iron Hands") { + if ((global.chapter_name != "Space Wolves") && (global.chapter_name != "Iron Hands")) { // ** Chaplain recruitment ** amo = 0; draw_set_color(16291875); - if (training_chaplain = 1) then amo = -1; - if (training_chaplain = 2) then amo = -2; - if (training_chaplain = 3) then amo = -3; - if (training_chaplain = 4) then amo = -4; - if (training_chaplain = 5) then amo = -6; - if (training_chaplain = 6) then amo = -12; - if (amo != 0) then draw_sprite(spr_requisition, 0, xx + 336 + 16, yy + 416); - if (training_chaplain != 0) then draw_text(xx + 351 + 16, yy + 414, string_hash_to_newline(string(amo))); + if (training_chaplain == 1) { + amo = -1; + } + if (training_chaplain == 2) { + amo = -2; + } + if (training_chaplain == 3) { + amo = -3; + } + if (training_chaplain == 4) { + amo = -4; + } + if (training_chaplain == 5) { + amo = -6; + } + if (training_chaplain == 6) { + amo = -12; + } + if (amo != 0) { + draw_sprite(spr_requisition, 0, xx + 336 + 16, yy + 416); + } + if (training_chaplain != 0) { + draw_text(xx + 351 + 16, yy + 414, string_hash_to_newline(string(amo))); + } draw_set_color(c_gray); - if (training_chaplain >= 0) and(training_chaplain <= 6) then blur = _recruit_rate[training_chaplain]; + if ((training_chaplain >= 0) && (training_chaplain <= 6)) { + blur = _recruit_rate[training_chaplain]; + } draw_text(xx + 407, yy + 414, string_hash_to_newline("Chaplain Training: " + string(blur))); draw_text(xx + 728, yy + 414, string_hash_to_newline("[-] [+]")); } @@ -786,32 +825,68 @@ function scr_draw_recruit_advisor(){ // ** Psyker recruitment ** amo = 0; draw_set_color(16291875); - if (training_psyker = 1) then amo = -1; - if (training_psyker = 2) then amo = -2; - if (training_psyker = 3) then amo = -3; - if (training_psyker = 4) then amo = -4; - if (training_psyker = 5) then amo = -6; - if (training_psyker = 6) then amo = -12; - if (amo != 0) then draw_sprite(spr_requisition, 0, xx + 336 + 16, yy + 436); - if (training_psyker != 0) then draw_text(xx + 351 + 16, yy + 434, string_hash_to_newline(string(amo))); + if (training_psyker == 1) { + amo = -1; + } + if (training_psyker == 2) { + amo = -2; + } + if (training_psyker == 3) { + amo = -3; + } + if (training_psyker == 4) { + amo = -4; + } + if (training_psyker == 5) { + amo = -6; + } + if (training_psyker == 6) { + amo = -12; + } + if (amo != 0) { + draw_sprite(spr_requisition, 0, xx + 336 + 16, yy + 436); + } + if (training_psyker != 0) { + draw_text(xx + 351 + 16, yy + 434, string_hash_to_newline(string(amo))); + } draw_set_color(c_gray); - if (training_psyker >= 0) and(training_psyker <= 6) then blur = _recruit_rate[training_psyker]; + if ((training_psyker >= 0) && (training_psyker <= 6)) { + blur = _recruit_rate[training_psyker]; + } draw_text(xx + 407, yy + 434, string_hash_to_newline("Psyker Training: " + string(blur))); draw_text(xx + 728, yy + 434, string_hash_to_newline("[-] [+]")); // ** Techmarine recruitment ** amo = 0; draw_set_color(16291875); - if (training_techmarine = 1) then amo = -1; - if (training_techmarine = 2) then amo = -2; - if (training_techmarine = 3) then amo = -3; - if (training_techmarine = 4) then amo = -4; - if (training_techmarine = 5) then amo = -6; - if (training_techmarine = 6) then amo = -12; - if (amo != 0) then draw_sprite(spr_requisition, 0, xx + 336 + 16, yy + 456); - if (training_techmarine != 0) then draw_text(xx + 351 + 16, yy + 456, string_hash_to_newline(string(amo))); + if (training_techmarine == 1) { + amo = -1; + } + if (training_techmarine == 2) { + amo = -2; + } + if (training_techmarine == 3) { + amo = -3; + } + if (training_techmarine == 4) { + amo = -4; + } + if (training_techmarine == 5) { + amo = -6; + } + if (training_techmarine == 6) { + amo = -12; + } + if (amo != 0) { + draw_sprite(spr_requisition, 0, xx + 336 + 16, yy + 456); + } + if (training_techmarine != 0) { + draw_text(xx + 351 + 16, yy + 456, string_hash_to_newline(string(amo))); + } draw_set_color(c_gray); - if (training_techmarine >= 0) and(training_techmarine <= 6) then blur = _recruit_rate[training_techmarine]; + if ((training_techmarine >= 0) && (training_techmarine <= 6)) { + blur = _recruit_rate[training_techmarine]; + } draw_text(xx + 407, yy + 454, $"Techmarine Training: {blur}"); draw_text(xx + 728, yy + 454, "[-] [+]"); @@ -836,21 +911,20 @@ function scr_draw_recruit_advisor(){ draw_sprite(spr_arrow, 0, xx + 494, yy + 515); draw_sprite(spr_arrow, 1, xx + 717, yy + 515); recruit_list_pane.draw(xx + 940, yy + 66, 0.72); - left_panel.inside_method = function(){ - var xx=__view_get( e__VW.XView, 0 )+0; - var yy=__view_get( e__VW.YView, 0 )+0; - draw_set_halign(fa_left); - draw_set_font(fnt_40k_14); - if (left_panel.percent_cut>90){ - var trial_data = scr_trial_data(); - var cur_trial = trial_data[recruit_trial]; - draw_text_ext(xx + 20 + 16, yy + 120 , string_hash_to_newline(scr_compile_trial_bonus_string(cur_trial)), -1, 280); - } - } - if (scr_hit(lower_middle_box)){ - left_panel.percent_mod_draw_cut(xx + 10, yy + 38, 0.38, 1, 6); + left_panel.inside_method = function() { + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0; + draw_set_halign(fa_left); + draw_set_font(fnt_40k_14); + if (left_panel.percent_cut > 90) { + var trial_data = scr_trial_data(); + var cur_trial = trial_data[recruit_trial]; + draw_text_ext(xx + 20 + 16, yy + 120, string_hash_to_newline(scr_compile_trial_bonus_string(cur_trial)), -1, 280); + } + }; + if (scr_hit(lower_middle_box)) { + left_panel.percent_mod_draw_cut(xx + 10, yy + 38, 0.38, 1, 6); } else { - left_panel.percent_mod_draw_cut(xx + 10, yy + 38, 0.38, 1, -6); + left_panel.percent_mod_draw_cut(xx + 10, yy + 38, 0.38, 1, -6); } } - diff --git a/scripts/scr_scrollbar/scr_scrollbar.gml b/scripts/scr_scrollbar/scr_scrollbar.gml index 6f88ba200e..3f9a6dbb89 100644 --- a/scripts/scr_scrollbar/scr_scrollbar.gml +++ b/scripts/scr_scrollbar/scr_scrollbar.gml @@ -1,140 +1,152 @@ function scr_scrollbar(argument0, argument1, argument2, argument3, argument4, argument5, argument6) { + // argument0 : x1 + // argument1: y1 + // argument2: x2 + // argument3: y2 + // argument4: see_size + // argument5: total maximum value + // argument6: current_position + + if ((argument5 != 0) && (argument5 > argument4)) { + var xx, yy, x1, x2, y1, y2; + var siz1, siz2, siz3; + // draw_set_color(CM_GREEN_COLOR); + xx = 0; + yy = 0; + x1 = 0; + x2 = 0; + y1 = 0; + y2 = 0; + temp1 = 0; + temp2 = 0; + siz1 = 0; + siz2 = 0; + siz3 = 0; + + xx = camera_get_view_x(view_camera[0]) + 0; + yy = camera_get_view_y(view_camera[0]) + 0; + + siz1 = argument3 - argument1; // know the size of the total scroll area + siz2 = (argument4 / argument5) * siz1; // know the relative size of the bar + siz3 = (argument6 / argument5) * siz1; // know the pre-space before the bar is drawn + + if ((!instance_exists(obj_controller)) && instance_exists(obj_creation)) { + var checka = 0; + if ((!mouse_button_held(mb_left)) && (obj_creation.scrollbar_engaged == 1)) { + obj_creation.scrollbar_engaged = 0; + } + if (mouse_button_held(mb_left) && (mouse_x >= xx + argument0) && (mouse_y >= yy + argument1) && (mouse_x < xx + argument2) && (mouse_y < yy + argument3)) { + obj_creation.scrollbar_engaged = 1; + } - // argument0 : x1 - // argument1: y1 - // argument2: x2 - // argument3: y2 - // argument4: see_size - // argument5: total maximum value - // argument6: current_position - - - if (argument5!=0) and (argument5>argument4){ - - - - - - - - - - - var xx,yy,x1,x2,y1,y2; - var siz1, siz2, siz3; - // draw_set_color(CM_GREEN_COLOR); - xx=0;yy=0;x1=0;x2=0;y1=0;y2=0;temp1=0;temp2=0; - siz1=0;siz2=0;siz3=0; - - xx=__view_get( e__VW.XView, 0 )+0; - yy=__view_get( e__VW.YView, 0 )+0; - - siz1=argument3-argument1;// know the size of the total scroll area - siz2=(argument4/argument5)*siz1;// know the relative size of the bar - siz3=(argument6/argument5)*siz1;// know the pre-space before the bar is drawn - - - - - - - if (!instance_exists(obj_controller)) and (instance_exists(obj_creation)){ - - var checka=0; - if (!mouse_button_held(mb_left)) and (obj_creation.scrollbar_engaged=1) then obj_creation.scrollbar_engaged=0; - if (mouse_button_held(mb_left)) and (mouse_x>=xx+argument0) and (mouse_y>=yy+argument1) and (mouse_x0){ - var click_y,center,ratio,ss,tmv,cp; - ratio=0;ss=0;tmv=0;cp=0; - - click_y=window_mouse_get_y(); - - center=click_y-(siz2/2); - - if (centerargument3-(siz2)) then center=argument3-(siz2); - - ratio=(center-argument1)/(argument3-argument1); - - draw_rectangle(xx+argument0,yy+center,xx+argument2,yy+center+siz2,0); - exit; - } - - - if (argument5=xx+argument0) and (mouse_y>=yy+argument1) and (mouse_x0 || obj_controller.managing=-1) and (obj_controller.menu!=30) and (obj_controller.man_max-MANAGE_MAN_SEE>-1){checka=1;} - if (instance_exists(obj_popup)){if (obj_popup.type=8) and (obj_popup.target_comp>=0){if (obj_controller.man_max-MANAGE_MAN_SEE>-1){checka=1;}}} - - - if (obj_controller.scrollbar_engaged=1) and (checka>0){ - var click_y,center,ratio,ss,tmv,cp; - ratio=0;ss=0;tmv=0;cp=0; - - click_y=window_mouse_get_y(); - - center=click_y-(siz2/2); - - if (centerargument3-(siz2)) then center=argument3-(siz2); - - ratio=(center-argument1)/(argument3-argument1); - - // draw_set_font(fnt_large);draw_set_color(c_red);draw_text(view_xview[0]+320,view_yview[0]+240,ratio); - // draw_set_color(CM_GREEN_COLOR); - - if (checka=1){ - obj_controller.man_current=floor((obj_controller.man_max)*ratio); - - if (obj_controller.man_current>(obj_controller.man_max-MANAGE_MAN_SEE)) then obj_controller.man_current=(obj_controller.man_max-MANAGE_MAN_SEE); - - if (obj_controller.man_current<0) then obj_controller.man_current=0; - } - - draw_rectangle(xx+argument0,yy+center,xx+argument2,yy+center+siz2,0); - exit; - } - - - if (argument5 0)) { + var click_y, center, ratio, ss, tmv, cp; + ratio = 0; + ss = 0; + tmv = 0; + cp = 0; -} + click_y = window_mouse_get_y(); + + center = click_y - (siz2 / 2); + + if (center < argument1) { + center = argument1; + } + if (center > argument3 - siz2) { + center = argument3 - siz2; + } + + ratio = (center - argument1) / (argument3 - argument1); + + draw_rectangle(xx + argument0, yy + center, xx + argument2, yy + center + siz2, 0); + exit; + } + + if (argument5 < argument4) { + siz3 = 0; + siz2 = siz1; + } + + draw_rectangle(xx + argument0, yy + argument1 + siz3, xx + argument2, yy + argument1 + siz3 + siz2, 0); + } + + if (instance_exists(obj_controller)) { + var checka = 0; + if ((!mouse_button_held(mb_left)) && (obj_controller.scrollbar_engaged == 1)) { + obj_controller.scrollbar_engaged = 0; + } + if (mouse_button_held(mb_left) && (mouse_x >= xx + argument0) && (mouse_y >= yy + argument1) && (mouse_x < xx + argument2) && (mouse_y < yy + argument3)) { + obj_controller.scrollbar_engaged = 1; + } + + if ((obj_controller.managing > 0 || obj_controller.managing == -1) && (obj_controller.menu != 30) && (obj_controller.man_max - MANAGE_MAN_SEE > -1)) { + checka = 1; + } + if (instance_exists(obj_popup)) { + if ((obj_popup.type == 8) && (obj_popup.target_comp >= 0)) { + if (obj_controller.man_max - MANAGE_MAN_SEE > -1) { + checka = 1; + } + } + } + + if ((obj_controller.scrollbar_engaged == 1) && (checka > 0)) { + var click_y, center, ratio, ss, tmv, cp; + ratio = 0; + ss = 0; + tmv = 0; + cp = 0; + + click_y = window_mouse_get_y(); + + center = click_y - (siz2 / 2); + + if (center < argument1) { + center = argument1; + } + if (center > argument3 - siz2) { + center = argument3 - siz2; + } + + ratio = (center - argument1) / (argument3 - argument1); + + // draw_set_font(fnt_large);draw_set_color(c_red);draw_text(view_xview[0]+320,view_yview[0]+240,ratio); + // draw_set_color(CM_GREEN_COLOR); + if (checka == 1) { + obj_controller.man_current = floor(obj_controller.man_max * ratio); + + if (obj_controller.man_current > (obj_controller.man_max - MANAGE_MAN_SEE)) { + obj_controller.man_current = obj_controller.man_max - MANAGE_MAN_SEE; + } + + if (obj_controller.man_current < 0) { + obj_controller.man_current = 0; + } + } + + draw_rectangle(xx + argument0, yy + center, xx + argument2, yy + center + siz2, 0); + exit; + } + + if (argument5 < argument4) { + siz3 = 0; + siz2 = siz1; + } + + draw_rectangle(xx + argument0, yy + argument1 + siz3, xx + argument2, yy + argument1 + siz3 + siz2, 0); + } + } +} function ScrollableContainer(_width, _height) constructor { surface = -1; surface_width = 0; surface_height = 0; - + width = _width; height = _height; @@ -142,127 +154,123 @@ function ScrollableContainer(_width, _height) constructor { scrollbar_width = 20; dragging = false; drag_offset = 0; - + pos_x = 0; pos_y = 0; - + static start_draw_to_surface = function(_height) { if (!surface_exists(surface)) { surface = surface_create(width, _height); - surface_width = surface_get_width(surface); + surface_width = surface_get_width(surface); surface_height = surface_get_height(surface); } - surface_set_target(surface); + surface_set_target(surface); draw_clear_alpha(c_white, 0); }; mouse_binds = []; - static add_scroll_mousse_binds = function(pre_offset_coords, bind_method){ - array_push(mouse_binds, pre_offset_coords); - } + + static add_scroll_mousse_binds = function(pre_offset_coords, bind_method) { + array_push(mouse_binds, pre_offset_coords); + }; children = []; - static add_children = function(pre_offset_coords, object, method, arguments){ - array_push(children, {object, pre_offset_coords, method, arguments}); - } - static stop_draw_to_surface = function() { + static add_children = function(pre_offset_coords, object, method, arguments) { + array_push(children, {object, pre_offset_coords, method, arguments}); + }; + + static stop_draw_to_surface = function() { surface_reset_target(); }; - static cleanup = function() { + static cleanup = function() { if (!surface_exists(surface)) { - return; - } - surface_clear_and_free(surface); + return; + } + surface_clear_and_free(surface); }; static resize = function(_width, _height) { - width = _width; - height = _height; + width = _width; + height = _height; }; - + static update = function() { if (!surface_exists(surface)) { - return; - } - + return; + } + var grip_height = max((height / surface_height) * height, 32); var scroll_area = height - grip_height; var grip_y = (scroll_offset / (surface_height - height)) * scroll_area; - + var grip_x1 = pos_x + width - scrollbar_width; var grip_x2 = pos_x + width; var grip_y1 = pos_y + grip_y; var grip_y2 = grip_y1 + grip_height; - + var _mouse_y = return_mouse_consts()[1]; - + // Dragging if (mouse_check_button(mb_left)) { if (dragging) { var new_grip_y = clamp(_mouse_y - pos_y - drag_offset, 0, scroll_area); scroll_offset = (new_grip_y / scroll_area) * (surface_height - height); - } - else if (scr_hit(grip_x1, grip_y1, grip_x2, grip_y2)) { + } else if (scr_hit(grip_x1, grip_y1, grip_x2, grip_y2)) { dragging = true; drag_offset = _mouse_y - grip_y1; } } else { dragging = false; } - + // Mouse wheel (scroll up / down) - var _scroll_speed = surface_height * 0.05; + var _scroll_speed = surface_height * 0.05; if (mouse_wheel_up()) { - scroll_offset -= _scroll_speed; - } else if (mouse_wheel_down()) { - scroll_offset += _scroll_speed; - } - + scroll_offset -= _scroll_speed; + } else if (mouse_wheel_down()) { + scroll_offset += _scroll_speed; + } + scroll_offset = clamp(scroll_offset, 0, surface_height - height); }; - + static draw = function(_x, _y) { pos_x = _x; pos_y = _y; - + if (!surface_exists(surface)) { - return; - } + return; + } update(); // Self-manages mouse & scroll logic - + var grip_height = max((height / surface_height) * height, 32); var scroll_area = height - grip_height; var grip_y = (scroll_offset / (surface_height - height)) * scroll_area; - + // Draw content draw_surface_part(surface, 0, scroll_offset, width - scrollbar_width, height, pos_x, pos_y); - for (var i=0;i 0.7) && (obj_controller.faction_defeated[_faction_enum] == 0)) || global.cheat_debug) { var _audience = management_buttons.audience; - _audience - .update({ - x1: xx + 169, - y1: yy + 85, - }); + _audience.update({x1: xx + 169, y1: yy + 85}); _audience.bind_method = function() { if ((obj_controller.known[_faction_enum] != 0 || global.cheat_debug) && (obj_controller.turns_ignored[_faction_enum] == 0)) { obj_controller.diplomacy = _faction_enum; @@ -415,11 +362,7 @@ function set_up_diplomacy_persons() { _audience.draw(); var _ignore_status = obj_controller.ignore[_faction_enum] < 1 ? management_buttons.ignore : management_buttons.unignore; - _ignore_status - .update({ - x1: _audience.x2 + 1, - y1: yy + 85, - }); + _ignore_status.update({x1: _audience.x2 + 1, y1: yy + 85}); _ignore_status.draw(); /*var fis;fis="[Request Audience]"; @@ -450,8 +393,8 @@ function scr_ui_diplomacy() { return; } - var xx = __view_get(e__VW.XView, 0) + 0; - var yy = __view_get(e__VW.YView, 0) + 0; + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0; var show_stuff = false; var warning = 0; @@ -560,8 +503,8 @@ function scr_ui_diplomacy() { #endregion } - xx = __view_get(e__VW.XView, 0); - yy = __view_get(e__VW.YView, 0); + xx = camera_get_view_x(view_camera[0]); + yy = camera_get_view_y(view_camera[0]); var _main_slate = diplo_buttons.main_slate; _main_slate.XX = xx + 328; diff --git a/scripts/scr_ui_formation_bars/scr_ui_formation_bars.gml b/scripts/scr_ui_formation_bars/scr_ui_formation_bars.gml index 41877760c0..0e715911cd 100644 --- a/scripts/scr_ui_formation_bars/scr_ui_formation_bars.gml +++ b/scripts/scr_ui_formation_bars/scr_ui_formation_bars.gml @@ -4,16 +4,16 @@ function scr_ui_formation_bars() { nbar: 0, abar: 0, te: 4700, - x9: __view_get(e__VW.XView, 0) + 49, - y9: __view_get(e__VW.YView, 0) + 224 + x9: camera_get_view_x(view_camera[0]) + 49, + y9: camera_get_view_y(view_camera[0]) + 224, }; var _formatting = formating; - with(obj_formation_bar) { + with (obj_formation_bar) { instance_destroy(); } - with(obj_temp8) { + with (obj_temp8) { instance_destroy(); } @@ -27,57 +27,42 @@ function scr_ui_formation_bars() { temp[ui_formations_data.te + 100] = 0; for (var ii = 1; ii <= 17; ii++) { - if (ii == 1) and(bat_comm_for[_formatting] == bar) { + if ((ii == 1) && (bat_comm_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 2, 0, "HQ"); - } - else if (ii == 2) and(bat_hono_for[_formatting] == bar) { + } else if ((ii == 2) && (bat_hono_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 1, 1, "Hono"); - } - else if (ii == 3) and(bat_libr_for[_formatting] == bar) { + } else if ((ii == 3) && (bat_libr_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 1, 8, "Lib"); - } - else if (ii == 4) and(bat_tech_for[_formatting] == bar) { + } else if ((ii == 4) && (bat_tech_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 1, 9, "Tech"); - } - else if (ii == 5) and(bat_term_for[_formatting] == bar) { + } else if ((ii == 5) && (bat_term_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 1, 10, "Term"); - } - else if (ii == 6) and(bat_vete_for[_formatting] == bar) { + } else if ((ii == 6) && (bat_vete_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 2, 6, "Veteran"); - } - else if (ii == 7) and(bat_tact_for[_formatting] == bar) { + } else if ((ii == 7) && (bat_tact_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 6, 3, "Tactical"); - } - else if (ii == 8) and(bat_deva_for[_formatting] == bar) { + } else if ((ii == 8) && (bat_deva_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 3, 2, "Devastator"); - } - else if (ii == 9) and(bat_assa_for[_formatting] == bar) { + } else if ((ii == 9) && (bat_assa_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 3, 5, "Assault"); - } - else if (ii == 10) and(bat_scou_for[_formatting] == bar) { + } else if ((ii == 10) && (bat_scou_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 1, 4, "Sco"); - } - else if (ii == 11) and(bat_drea_for[_formatting] == bar) { + } else if ((ii == 11) && (bat_drea_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 2, 11, "Dread"); - } - else if (ii == 12) and(bat_hire_for[_formatting] == bar) { + } else if ((ii == 12) && (bat_hire_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 1, 7, "???"); - } - else if (ii == 16) and(bat_landspee_for[_formatting] == bar) { + } else if ((ii == 16) && (bat_landspee_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 2, 14, "Land Speeder"); } if (bat_formation_type[_formatting] != 2) { - if (ii == 13) and(bat_rhin_for[_formatting] == bar) { + if ((ii == 13) && (bat_rhin_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 4, 12, "Rhino"); - } - else if (ii == 14) and(bat_pred_for[_formatting] == bar) { + } else if ((ii == 14) && (bat_pred_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 2, 13, "Predator"); - } - else if (ii == 15) and(bat_landraid_for[_formatting] == bar) { + } else if ((ii == 15) && (bat_landraid_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 2, 14, "Land Raider"); - } - else if (ii == 17) and(bat_whirl_for[_formatting] == bar) { + } else if ((ii == 17) && (bat_whirl_for[_formatting] == bar)) { init_combat_bars(bar, ii, ui_formations_data, 2, 14, "Whirlwind"); } } @@ -108,7 +93,7 @@ function scr_ui_formation_bars() { } } - ui_formations_data.y9 = __view_get(e__VW.YView, 0) + 224; + ui_formations_data.y9 = camera_get_view_y(view_camera[0]) + 224; ui_formations_data.x9 += 50; } } @@ -118,7 +103,9 @@ function init_combat_bars(bar, ii, formations_data, size, image_index, unit_type formations_data.nbar = instance_create(formations_data.x9, formations_data.y9 + temp[formations_data.te], obj_formation_bar); formations_data.nbar.size = size; formations_data.nbar.height = formations_data.nbar.size * 47; - if (temp[formations_data.te] > 0) then above_neighbor = formations_data.abar; + if (temp[formations_data.te] > 0) { + above_neighbor = formations_data.abar; + } temp[formations_data.te] += formations_data.nbar.height; formations_data.abar = formations_data.nbar; temp[formations_data.te + 100] += formations_data.nbar.size; @@ -126,4 +113,4 @@ function init_combat_bars(bar, ii, formations_data, size, image_index, unit_type formations_data.nbar.unit_type = unit_type; formations_data.nbar.unit_id = ii; formations_data.nbar.col_parent = bar; -} \ No newline at end of file +} diff --git a/scripts/scr_ui_manage/scr_ui_manage.gml b/scripts/scr_ui_manage/scr_ui_manage.gml index 56739e019f..fb9553e5b7 100644 --- a/scripts/scr_ui_manage/scr_ui_manage.gml +++ b/scripts/scr_ui_manage/scr_ui_manage.gml @@ -94,15 +94,7 @@ function load_marines_into_ship(system, ship, units, reload = false) { /// @param {string} purpose_code - Code that identifies the selection’s purpose function command_slot_prompt(search_params, role_group_params, purpose, purpose_code) { var candidates = collect_role_group(role_group_params.group, role_group_params.location, role_group_params.opposite, search_params); - group_selection(candidates, { - purpose: purpose, - purpose_code: purpose_code, - number: 1, - target_company: managing, - feature: "none", - planet: 0, - selections: [], - }); + group_selection(candidates, {purpose: purpose, purpose_code: purpose_code, number: 1, target_company: managing, feature: "none", planet: 0, selections: []}); } /// @desc Displays a selectable prompt for special roles to be assigned. @@ -208,11 +200,7 @@ function reset_manage_unit_constants(unit) { _psionic = $"{_psionic}\n{max(0, unit.corruption())}% Corruption."; } - unit_manage_constants.psy = new LabeledIcon(spr_icon_psyker, _psionic, 0, 0, { - icon_width: 24, - icon_height: 24, - tooltip: $"==Psychic Stats==\n{_tooltip}", - }); + unit_manage_constants.psy = new LabeledIcon(spr_icon_psyker, _psionic, 0, 0, {icon_width: 24, icon_height: 24, tooltip: $"==Psychic Stats==\n{_tooltip}"}); // Damage Resistance var _res_tool = "Health damage taken by the marine is reduced by this percentage. This happens after the flat reduction from armor.\n\nContributing factors:\n"; @@ -250,11 +238,7 @@ function reset_manage_unit_constants(unit) { } _res_tool += $"CON: {unit.constitution / 2}%\nEXP: {unit.experience / 10}%"; - unit_manage_constants.damage_res = new LabeledIcon(spr_icon_iron_halo, $"{_damage_res}%", 0, 0, { - icon_width: 24, - icon_height: 24, - tooltip: _res_tool, - }); + unit_manage_constants.damage_res = new LabeledIcon(spr_icon_iron_halo, $"{_damage_res}%", 0, 0, {icon_width: 24, icon_height: 24, tooltip: _res_tool}); var _hp_val = $"{round(unit.hp())}/{round(unit.max_health())}"; var _hp_tool = "A measure of how much punishment the creature can take. Marines can go into the negatives and still survive, but they'll require a bionic to become fighting fit once more.\n\nContributing factors:\n"; _hp_tool += $"CON: {round(100 * (1 + ((unit.constitution - 40) * 0.025)))}\n"; @@ -290,11 +274,7 @@ function reset_manage_unit_constants(unit) { } } - unit_manage_constants.hp = new LabeledIcon(spr_icon_health, _hp_val, 0, 0, { - icon_width: 24, - icon_height: 24, - tooltip: _hp_tool, - }); + unit_manage_constants.hp = new LabeledIcon(spr_icon_health, _hp_val, 0, 0, {icon_width: 24, icon_height: 24, tooltip: _hp_tool}); // ------------------------- // Armour Rating @@ -337,51 +317,23 @@ function reset_manage_unit_constants(unit) { _armour_tool += "STC Bonus: x1.05\n"; } - unit_manage_constants.armour = new LabeledIcon(spr_icon_shield2, _armour_val, 0, 0, { - icon_width: 24, - icon_height: 24, - tooltip: _armour_tool, - }); + unit_manage_constants.armour = new LabeledIcon(spr_icon_shield2, _armour_val, 0, 0, {icon_width: 24, icon_height: 24, tooltip: _armour_tool}); - unit_manage_constants.exp = new LabeledIcon(spr_icon_veteran, string(floor(unit.experience)), 0, 0, { - icon_width: 24, - icon_height: 24, - tooltip: $"==Experience==\nA measurement of how battle-hardened the unit is. Provides various bonuses across the board. Every 15 EXP, a new stat is assigned. Hover over the unit’s stats in the marine profile to see projected growth over time.", - }); + unit_manage_constants.exp = new LabeledIcon(spr_icon_veteran, string(floor(unit.experience)), 0, 0, {icon_width: 24, icon_height: 24, tooltip: $"==Experience==\nA measurement of how battle-hardened the unit is. Provides various bonuses across the board. Every 15 EXP, a new stat is assigned. Hover over the unit’s stats in the marine profile to see projected growth over time."}); // Melee Attack var _melee = unit.melee_attack(); - unit_manage_constants.melee_attack = new LabeledIcon(spr_icon_weapon_skill, $"{round(_melee[0])}", 0, 0, { - icon_width: 24, - icon_height: 24, - tooltip: $"==Melee Attack==\n{_melee[1]}", - colour: unit.encumbered_melee ? #bf4040 : CM_GREEN_COLOR, - }); + unit_manage_constants.melee_attack = new LabeledIcon(spr_icon_weapon_skill, $"{round(_melee[0])}", 0, 0, {icon_width: 24, icon_height: 24, tooltip: $"==Melee Attack==\n{_melee[1]}", colour: unit.encumbered_melee ? #bf4040 : CM_GREEN_COLOR}); var _carry = _melee[2]; - unit_manage_constants.melee_burden = new LabeledIcon(spr_icon_weight, $"{_carry[0]}/{_carry[1]}", 0, 0, { - icon_width: 24, - icon_height: 24, - tooltip: $"==Melee Burden==\n{_carry[2]}", - colour: unit.encumbered_melee ? #bf4040 : CM_GREEN_COLOR, - }); + unit_manage_constants.melee_burden = new LabeledIcon(spr_icon_weight, $"{_carry[0]}/{_carry[1]}", 0, 0, {icon_width: 24, icon_height: 24, tooltip: $"==Melee Burden==\n{_carry[2]}", colour: unit.encumbered_melee ? #bf4040 : CM_GREEN_COLOR}); // Ranged Attack var _range = unit.ranged_attack(); - unit_manage_constants.ranged_attack = new LabeledIcon(spr_icon_ballistic_skill, $"{round(_range[0])}", 0, 0, { - icon_width: 24, - icon_height: 24, - tooltip: $"==Ranged Attack==\n{_range[1]}", - colour: unit.encumbered_ranged ? #bf4040 : CM_GREEN_COLOR, - }); + unit_manage_constants.ranged_attack = new LabeledIcon(spr_icon_ballistic_skill, $"{round(_range[0])}", 0, 0, {icon_width: 24, icon_height: 24, tooltip: $"==Ranged Attack==\n{_range[1]}", colour: unit.encumbered_ranged ? #bf4040 : CM_GREEN_COLOR}); var _carry = _range[2]; - unit_manage_constants.ranged_burden = new LabeledIcon(spr_icon_weight, $"{_carry[0]}/{_carry[1]}", 0, 0, { - icon_width: 24, - icon_height: 24, - tooltip: $"==Ranged Burden==\n{_carry[2]}", - colour: unit.encumbered_ranged ? #bf4040 : CM_GREEN_COLOR, - }); + unit_manage_constants.ranged_burden = new LabeledIcon(spr_icon_weight, $"{_carry[0]}/{_carry[1]}", 0, 0, {icon_width: 24, icon_height: 24, tooltip: $"==Ranged Burden==\n{_carry[2]}", colour: unit.encumbered_ranged ? #bf4040 : CM_GREEN_COLOR}); // ------------------------- // Bionics @@ -426,11 +378,7 @@ function reset_manage_unit_constants(unit) { } } - unit_manage_constants.bionics = new LabeledIcon(spr_icon_bionics, _bionic_val, 0, 0, { - icon_width: 24, - icon_height: 24, - tooltip: _bionic_tool, - }); + unit_manage_constants.bionics = new LabeledIcon(spr_icon_bionics, _bionic_val, 0, 0, {icon_width: 24, icon_height: 24, tooltip: _bionic_tool}); if (is_struct(unit_manage_image)) { try { @@ -445,8 +393,7 @@ function reset_manage_unit_constants(unit) { /*if (man[sel]="vehicle"){ // TODO }*/ - } - catch (_exception) {} //not sure handling with normal method exception could just be a pain here + } catch (_exception) {} //not sure handling with normal method exception could just be a pain here } function company_specific_management() { @@ -502,13 +449,7 @@ function alternative_manage_views(x1, y1) { init_manage_buttons(); } var _squad_button = management_buttons.squad_toggle; - _squad_button - .update({ - x1: x1 + 5, - y1: y1 + 6, - label: !obj_controller.view_squad && !obj_controller.company_report ? "Squad View" : "Company View", - keystroke: keyboard_check_pressed(ord("S")) && allow_shortcuts, - }); + _squad_button.update({x1: x1 + 5, y1: y1 + 6, label: !obj_controller.view_squad && !obj_controller.company_report ? "Squad View" : "Company View", keystroke: keyboard_check_pressed(ord("S")) && allow_shortcuts}); if (company_data.has_squads) { if (_squad_button.draw(!text_bar)) { @@ -521,26 +462,14 @@ function alternative_manage_views(x1, y1) { if (!view_squad) { var _profile_toggle = management_buttons.profile_toggle; - _profile_toggle - .update({ - label: !unit_profile ? "Show Profile" : "Hide Profile", - x1: _squad_button.x2, - y1: _squad_button.y1, - keystroke: keyboard_check_pressed(ord("P")) && allow_shortcuts, - }); + _profile_toggle.update({label: !unit_profile ? "Show Profile" : "Hide Profile", x1: _squad_button.x2, y1: _squad_button.y1, keystroke: keyboard_check_pressed(ord("P")) && allow_shortcuts}); if (_profile_toggle.draw(!text_bar)) { unit_profile = !unit_profile; } if (unit_profile) { var bio_toggle = management_buttons.bio_toggle; - bio_toggle - .update({ - label: !unit_bio ? "Show Bio" : "Hide Bio", - x1: _profile_toggle.x2, - y1: _profile_toggle.y1, - keystroke: keyboard_check_pressed(ord("B")) && allow_shortcuts, - }); + bio_toggle.update({label: !unit_bio ? "Show Bio" : "Hide Bio", x1: _profile_toggle.x2, y1: _profile_toggle.y1, keystroke: keyboard_check_pressed(ord("B")) && allow_shortcuts}); if (bio_toggle.draw(!text_bar)) { unit_bio = !unit_bio; } @@ -563,11 +492,7 @@ function alternative_manage_views(x1, y1) { } var _capture_button = management_buttons.capture_image; - _capture_button - .update({ - x1: _last_button_x, - y1: _last_button_y, - }); + _capture_button.update({x1: _last_button_x, y1: _last_button_y}); if (is_struct(obj_controller.unit_focus) && _capture_button.draw(!text_bar)) { // Capture the sprite frame as PNG @@ -718,144 +643,74 @@ function draw_sprite_and_unit_equip_data() { // Equipment var _armour = unit_manage_constants.armour_string; - _armour - .update({ - x1: x_left, - y1: yy + 179, - }); + _armour.update({x1: x_left, y1: yy + 179}); _armour.draw(); var _gear = unit_manage_constants.gear_string; - _gear - .update({ - x1: x_left, - y1: yy + 305, - }); + _gear.update({x1: x_left, y1: yy + 305}); _gear.draw(); var _mobi = unit_manage_constants.mobi_string; - _mobi - .update({ - x1: x_left, - y1: yy + 326, - }); + _mobi.update({x1: x_left, y1: yy + 326}); _mobi.draw(); var _wep1 = unit_manage_constants.wep1_string; - _wep1 - .update({ - x1: x_left, - y1: yy + 204, - }); + _wep1.update({x1: x_left, y1: yy + 204}); _wep1.draw(); var _wep2 = unit_manage_constants.wep2_string; - _wep2 - .update({ - x1: x_left, - y1: yy + 254, - }); + _wep2.update({x1: x_left, y1: yy + 254}); _wep2.draw(); // Stats // Bionics trackers - unit_manage_constants - .bionics - .update({ - x1: x_left + 84, - y1: yy + 63, - }); + unit_manage_constants.bionics.update({x1: x_left + 84, y1: yy + 63}); unit_manage_constants.bionics.draw(); - unit_manage_constants - .armour - .update({ - x1: x_left - 6, - y1: yy + 87, - }); + unit_manage_constants.armour.update({x1: x_left - 6, y1: yy + 87}); unit_manage_constants.armour.draw(); - unit_manage_constants - .hp - .update({ - x1: x_left - 6, - y1: yy + 63, - }); + unit_manage_constants.hp.update({x1: x_left - 6, y1: yy + 63}); unit_manage_constants.hp.draw(); // Experience - unit_manage_constants - .exp - .update({ - x1: x_left - 6, - y1: yy + 39, - }); + unit_manage_constants.exp.update({x1: x_left - 6, y1: yy + 39}); unit_manage_constants.exp.draw(); - unit_manage_constants - .damage_res - .update({ - x1: x_left + 84, - y1: yy + 87, - }); + unit_manage_constants.damage_res.update({x1: x_left + 84, y1: yy + 87}); unit_manage_constants.damage_res.draw(); // Psyker things if (array_length(selected_unit.powers_known)) { - unit_manage_constants - .psy - .update({ - x1: x_left + 84, - y1: yy + 39, - }); + unit_manage_constants.psy.update({x1: x_left + 84, y1: yy + 39}); unit_manage_constants.psy.draw(); } - unit_manage_constants - .melee_attack - .update({ - x1: x_left - 6, - y1: yy + 111, - }); + unit_manage_constants.melee_attack.update({x1: x_left - 6, y1: yy + 111}); unit_manage_constants.melee_attack.draw(); - unit_manage_constants - .ranged_attack - .update({ - x1: x_left - 6, - y1: yy + 135, - }); + unit_manage_constants.ranged_attack.update({x1: x_left - 6, y1: yy + 135}); unit_manage_constants.ranged_attack.draw(); - unit_manage_constants - .melee_burden - .update({ - x1: x_left + 84, - y1: yy + 111, - }); + unit_manage_constants.melee_burden.update({x1: x_left + 84, y1: yy + 111}); unit_manage_constants.melee_burden.draw(); - unit_manage_constants - .ranged_burden - .update({ - x1: x_left + 84, - y1: yy + 135, - }); + unit_manage_constants.ranged_burden.update({x1: x_left + 84, y1: yy + 135}); unit_manage_constants.ranged_burden.draw(); } @@ -900,7 +755,7 @@ function scr_ui_manage() { var unit, x1, x2, x3, y1, y2, y3, text; var tooltip_text = "", bionic_tooltip = ""; company_data.tooltip_drawing = []; - var xx = __view_get(e__VW.XView, 0) + 0, yy = __view_get(e__VW.YView, 0) + 0, bb = "", img = 0; + var xx = camera_get_view_x(view_camera[0]) + 0, yy = camera_get_view_y(view_camera[0]) + 0, bb = "", img = 0; // Draw BG draw_set_alpha(1); @@ -1061,20 +916,7 @@ function scr_ui_manage() { ]; if (!scr_has_disadv("Psyker Intolerant")) { - array_push(_command_slots_data, { - search_params: { - companies: [managing, 0], - }, - role_group_params: { - group: [SPECIALISTS_LIBRARIANS, false, false], - location: "", - opposite: false, - }, - purpose: $"{int_to_roman(managing)} Company Librarian Candidates", - purpose_code: "librarian_promote", - button_text: "Librarian Required", - unit_check: "lib", - }); + array_push(_command_slots_data, {search_params: {companies: [managing, 0]}, role_group_params: {group: [SPECIALISTS_LIBRARIANS, false, false], location: "", opposite: false}, purpose: $"{int_to_roman(managing)} Company Librarian Candidates", purpose_code: "librarian_promote", button_text: "Librarian Required", unit_check: "lib"}); } return _command_slots_data; @@ -1145,8 +987,8 @@ function scr_ui_manage() { sel_all = ""; draw_set_color(c_black); - xx = __view_get(e__VW.XView, 0) + 0; - yy = __view_get(e__VW.YView, 0) + 0; + xx = camera_get_view_x(view_camera[0]) + 0; + yy = camera_get_view_y(view_camera[0]) + 0; draw_rectangle(xx + 974, yy + 165, xx + 1005, yy + 822, 0); draw_set_color(c_gray); draw_rectangle(xx + 974, yy + 165, xx + 1005, yy + 822, 1); @@ -1193,7 +1035,7 @@ function scr_ui_manage() { var selected_unit = obj_controller.unit_focus; if ((selected_unit.name() != "") && (selected_unit.race() != 0)) { draw_set_alpha(1); - var xx = __view_get(e__VW.XView, 0) + 0, yy = __view_get(e__VW.YView, 0) + 0; + var xx = camera_get_view_x(view_camera[0]) + 0, yy = camera_get_view_y(view_camera[0]) + 0; if (obj_controller.unit_profile && !instance_exists(obj_popup)) { stats_displayed = true; selected_unit.stat_display(true); @@ -1223,8 +1065,8 @@ function scr_ui_manage() { bb = ""; img = 0; - xx = __view_get(e__VW.XView, 0) + 0; - yy = __view_get(e__VW.YView, 0) + 0; + xx = camera_get_view_x(view_camera[0]) + 0; + yy = camera_get_view_y(view_camera[0]) + 0; // BG draw_set_alpha(1); @@ -1326,8 +1168,8 @@ function scr_ui_manage() { draw_set_font(fnt_40k_14b); draw_text_transformed(xx + 320, yy + 402, $"Click a Ship to Load Selection (Req. {man_size} Space)", 1, 1, 0); - xx = __view_get(e__VW.XView, 0) + 0; - yy = __view_get(e__VW.YView, 0) + 0; + xx = camera_get_view_x(view_camera[0]) + 0; + yy = camera_get_view_y(view_camera[0]) + 0; // draw_text_transformed(xx + 488, yy + 426, "Selection Size: " + string(man_size), 0.4, 0.4, 0); scr_scrollbar(974, 172, 1005, 790, 34, ship_max, ship_current); diff --git a/scripts/scr_ui_popup/scr_ui_popup.gml b/scripts/scr_ui_popup/scr_ui_popup.gml index e83fda09b2..0232e14974 100644 --- a/scripts/scr_ui_popup/scr_ui_popup.gml +++ b/scripts/scr_ui_popup/scr_ui_popup.gml @@ -1,522 +1,832 @@ function scr_ui_popup() { - // 48,48 over like 256, down to 480-128 - - if (obj_controller.menu=60){ - var xx=__view_get( e__VW.XView, 0 )+25; - var yy=__view_get( e__VW.YView, 0 )+165; - - draw_sprite(spr_popup_large,1,xx,yy); - // draw_set_color(0);draw_rectangle(xx+31,yy+29,xx+593,yy+402,0); - draw_set_color(c_gray); - // draw_rectangle(xx+31,yy+47,xx+593,yy+402,1); - - draw_set_font(fnt_40k_30b); - draw_set_halign(fa_center); - var planet_upgrades = obj_temp_build.target.p_upgrades[obj_controller.selecting_planet]; - var un_upgraded = 0; - var arsenal = 0; - var gene_vault=0; - var s_base=0; - var ttitle=""; - var woob=""; - - if (planet_feature_bool(planet_upgrades, P_features.Secret_Base)==1){s_base=1} - if (planet_feature_bool(planet_upgrades, P_features.Arsenal)==1){arsenal=1} - if (planet_feature_bool(planet_upgrades, P_features.Gene_Vault)==1){gene_vault=1} - un_upgraded = gene_vault+arsenal+s_base; - if (obj_temp_build.isnew == 1) { - title = "Secret Lair (" + string(obj_temp_build.target.name) + " " + scr_roman(obj_temp_build.planet) + ")"; - draw_text_transformed(xx + 312, yy + 10, string_hash_to_newline(title), 0.7, 0.7, 0); - - draw_set_font(fnt_40k_14b); - draw_text(xx + 312, yy + 45, "Select a Secret Lair style."); - draw_set_halign(fa_left); - - var styles = [ - {name: "Barbarian", description: "Heavy on leather, hides, and trophy body parts.", tag: "BRB"}, - {name: "Disco", description: "Rainbow colored dance floor and steel rafters.", tag: "DIS"}, - {name: "Feudal", description: "Lots of stone, metal filigree, and statues.", tag: "FEU"}, - {name: "Gothic", description: "Heavy on leather, hides, and trophy body parts.", tag: "GTH"}, - {name: "Mechanicus", description: "Grates, tubes, gears, and augmented reality.", tag: "MCH"}, - {name: "Prospero", description: "Marble or sandstone surfaces and gold filigree.", tag: "PRS"}, - {name: "Rave Club", description: "Large, open area with neon or strobe lights.", tag: "RAV"}, - {name: "Steel", description: "Stainless steel surfaces and water fountains.", tag: "STL"}, - {name: "Utilitarian", description: "Plaster or concrete surfaces with carpeting.", tag: "UTL"} - ]; - - var base_x1 = xx + 21; - var base_x2 = base_x1 + 579; - var base_y1 = yy + 88; - var base_y2 = base_y1 + 18; - var text_x1 = base_x1 + 2; - var text_x2 = text_x1 + 100; - - for (var r = 0; r < array_length(styles); r++) { - var style = styles[r]; - var y_offset = r * 30; - - draw_set_color(c_gray); - draw_rectangle(base_x1, base_y1 + y_offset, base_x2, base_y2 + y_offset, 0); - - if (scr_hit(base_x1, base_y1 + y_offset, base_x2, base_y2 + y_offset) == true) { - draw_set_color(c_black); - draw_set_alpha(0.2); - draw_rectangle(base_x1, base_y1 + y_offset, base_x2, base_y2 + y_offset, 0); - draw_set_alpha(1); - - if (scr_click_left()) { - var base_options = {style: style.tag}; - obj_temp_build.isnew = 0; - array_push(planet_upgrades, new NewPlanetFeature(P_features.Secret_Base, base_options)); - } - } - - draw_set_color(c_black); - draw_set_font(fnt_40k_14b); - draw_text_transformed(text_x1, base_y1 + 2 + y_offset, string_hash_to_newline(style.name), 1, 0.8, 0); - draw_set_font(fnt_40k_14); - draw_text_transformed(text_x2, base_y1 + 2 + y_offset, string_hash_to_newline(style.description), 1, 0.8, 0); - } - } - - - - if (un_upgraded==0){ - title="Build ("+string(obj_temp_build.target.name)+" "+scr_roman(obj_temp_build.planet)+")"; - }else if(un_upgraded!=0){ - if (s_base!=0) then title="Secret Lair ("+string(obj_temp_build.target.name)+" "+scr_roman(obj_temp_build.planet)+")"; - if (arsenal!=0) then title="Secret Arsenal ("+string(obj_temp_build.target.name)+" "+scr_roman(obj_temp_build.planet)+")"; - if (gene_vault!=0) then title="Secret Gene-Vault ("+string(obj_temp_build.target.name)+" "+scr_roman(obj_temp_build.planet)+")"; - } - - draw_text_transformed(xx+312,yy+10,string_hash_to_newline(title),0.7,0.7,0); - - draw_set_halign(fa_left); - - if (s_base>0){ - var search_list =search_planet_features(planet_upgrades, P_features.Secret_Base); - if (array_length(search_list) > 0){ - woob=""; - var secret=true; - s_base = planet_upgrades[search_list[0]]; - if (s_base.built>obj_controller.turn){ - draw_set_font(fnt_40k_14b); - draw_text(xx+21,yy+65,string_hash_to_newline($"This feature will be constructed in {s_base.built-obj_controller.turn} months.")); - }else if (s_base.built<=obj_controller.turn){ - if (s_base.inquis_hidden != 1){secret = false;} - - var r=0,butt="",alp=1,cost=0,fuck=obj_temp_build,tooltip="",tooltip2="",tooltip3="",tooltip4="",tcost=0; - for (r=1;r<13;r++){ - alp=1; - cost=0; - switch(r){ - case 1: if (s_base.forge>0) then alp=0.33;cost=1000;butt="Forge";tooltip2="A modest, less elaborate forge able to employ a handful of Astartes or Techpriest."; break; - case 2: if (s_base.hippo>0) then alp=0.33;cost=1000;butt="Hippodrome";tooltip2="A moderate sized garage fit to hold, service, and display vehicles."; break; - case 3: if (s_base.beastarium>0) then alp=0.33;cost=1000;butt="Beastarium";tooltip2="An enclosure with simulated greenery and foilage meant to hold beasts."; break; - case 4: if (s_base.torture>0) then alp=0.33;cost=500;butt="Torture Chamber";tooltip2="Only the best for the best. A room full of torture tools and devices."; break; - case 5: if (s_base.narcotics>0) then alp=0.33;cost=500;butt="Narcotics";tooltip2="Several boxes worth of Obscura, Black Lethe, Kyxa... line it up."; break; - case 6: if (s_base.relic>0) then alp=10+fuck.relic;cost=500;butt="Relic Room";tooltip2="A room meant for displaying trophies. May be purchased successive times."; break; - case 7: if (s_base.cookery>0) then alp=0.33;cost=250;butt="Cookery";tooltip2="A larger, well-stocked cookery, complete with a number of Imperial Chef servants."; break; - case 8: if (s_base.vox>0) then alp=0.33;cost=250;butt="Vox Casters";tooltip2="All the bass one could ever imaginably need."; break; - case 9: if (s_base.librarium>0) then alp=0.33;cost=250;butt="Librarium";tooltip2="A study fit to hold a staggering amount of tomes and scrolls."; break; - case 10: if (s_base.throne>0) then alp=0.33;cost=250;butt="Throne";tooltip2="A massive, ego boosting throne."; break; - case 11: if (s_base.stasis>0) then alp=0.33;cost=200;butt="Stasis Pods";tooltip2="Though they start empty, you may capture and display your foes in these."; break; - case 12: if (s_base.swimming>0) then alp=0.33;cost=100;butt="Swimming Pool";tooltip2="A large body of water meant for excersize or relaxation."; break; - } - tooltip=butt; - - draw_set_font(fnt_40k_14);draw_set_alpha(alp);draw_set_color(c_gray); - draw_rectangle(xx+494,yy+12+((r-1)*22),xx+614,yy+32+((r-1)*22),0); - draw_set_color(c_black); - draw_text_transformed(xx+496,yy+14+((r-1)*22),string_hash_to_newline(string(butt)),1,0.9,0);draw_set_alpha(1); - - if (scr_hit(xx+494,yy+12+((r-1)*22),xx+614,yy+32+((r-1)*22))=true){ - if (alp<=0.33) then draw_set_alpha(0.1); - if (alp>0.33) then draw_set_alpha(0.2); - draw_set_color(0); - draw_rectangle(xx+494,yy+12+((r-1)*22),xx+614,yy+32+((r-1)*22),0); - draw_set_alpha(1); - tooltip3=tooltip; - tooltip4=tooltip2; - tcost=cost; - if (scr_click_left()) and (obj_controller.requisition>=tcost) and (alp!=0.33){ - obj_controller.requisition-=tcost; - switch(r){ - case 1: - s_base.forge=1; - s_base.forge_data = new PlayerForge(); - break; - case 2: s_base.hippo=1; break; - case 3: s_base.beastarium=1; break; - case 4: s_base.torture=1; break; - case 5: s_base.narcotics=1; break; - case 6: s_base.relic=1; break; - case 7: s_base.cookery=1; break; - case 8: s_base.vox=1; break; - case 9: s_base.librarium=1; break; - case 10: s_base.throne=1; break; - case 11: s_base.stasis=1; break; - case 12: s_base.swimming=1; break; - } - } - } - } - - woob="Deep beneath the surface of "+string(fuck.target.name)+" "+scr_roman(obj_controller.selecting_planet)+" lays your "; - if (secret) { woob+="secret lair. ";} - else if (!secret){ woob+="previously discovered lair. ";} - - woob+="It is massive"; - switch (s_base.style){ - case "BRB": - woob+=", the walls decorated with animal hides and leather. Among the copius body-trophies and bones are torches that hiss and spit. "; - break; - case "DIS": - woob+="- the main attraction is the rainbow-colored, lit up grid flooring which quickly change color. Far overhead are metal rafters. "; - break; - case "FEU": - woob+=", the walls made up of sturdy blocks of stones. It is heavily decorated with wooden furniture, banners, and medieval weaponry. "; - break; - case "GTH": - woob+=", the walls made up of lightly-dusty stone. Mosaics and statues are abundant throughout, giving it that comfortable gothic feel. "; - break; - case "MCH": - woob+="- at a glance it appears decorated like a factory. Those with a neural network see the lair as brightly colored and lit, full of knowledge, learning, and chapter iconography. "; - break; - case "PRS": - woob+=", the walls made up of polished sandstone or marble. All throughout are chapter iconography and ancient symbols, wrought in gold. "; - break; - case "RAV": - woob+=" but nearly pitch-black inside. The only illumination is provided by loopy neon lux-casters, and strobes, which blast out light in random, flickering patterns. "; - break; - case "STL": - woob+=". All of the surfaces are made up of highly polished stainless steel. An occasional small water fountain or plant decorates the place. "; - break; - case "UTL": - woob+=" and almost civilian looking in nature- the walls are up of simple concrete or plaster. A thick carpet covers much of the floor."; - break; - } - - if (s_base.throne==1){ - woob+=" The center chamber is dominated by "; - var yep=false,c=0; - - if (obj_controller.temp[104]=string(obj_temp_build.target.name)+"."+string(obj_controller.selecting_planet)) then yep=true; - if (yep) { woob+="a massive throne, which you are currently seated upon. ";} - else if (!yep) {woob+="a massive throne, though it is currently vacant. ";} - } - if (s_base.vox>0) and (fuck.target.p_player[obj_controller.selecting_planet]>0) then woob+="Heretical music blasts from the vox-casters, shaking the walls. "; - if (s_base.narcotics>0) then woob+=" Many of the tables have lines of white powder set on paper or bunches of needles. Plastic straws lay close by. "; - if (s_base.cookery=1){ - if (fuck.target.p_player[obj_controller.selecting_planet]>0) then woob+="Imperial Chefs are currently bustling to and from the kitchen, cooking savory treats and food for those present. "; - if (fuck.target.p_player[obj_controller.selecting_planet]=0) then woob+="The Imperial Chefs are mostly idle, making use of the other rooms and facilities. "; - } - switch(s_base.stock){ - case 1: woob+=" One of the chambers is hollowed out to display war trophies and gear. "; break; - case 2: woob+=" One of the chambers holds war trophies from recent conquests. "; break; - case 3: woob+=" War trophies taken from several Xeno races are displayed in the Relic Room. "; break; - case 4: woob+=" Your Relic Room contains trophies and skulls, taken from every Xeno race. "; break; - case 5: woob+=" Your Relic Room contains trophies, skulls, and suits of armour taken from Xenos races. "; break; - case 6: woob+=" Your Relic Room contains wargear and suits of armour from all races, several Adeptus Astartes suits included. "; break; - case 7: woob+=" One of the chambers holds wargear and suits of armour from all races. A suit of Terminator armour is included, half of the armour taken off to reveal the inner workings."; break; - case 8: woob+=" Your Relic Room's trophies, skulls, and armours now spill out into the hallways, such is their number. "; break; - case 9: woob+=" Many of the xenos war trophies and suits of armour are placed around the Lair, filling out spare surfaces. "; break; - case 10: woob+=" In addition to the many war trophies your Relic Room also has small amounts of gold coins. "; break; - case 11: woob+=" In addition to the many war trophies your Relic Room also has small piles of gold coins and clutter. "; break; - case 12: woob+=" In addition to the many war trophies your Relic Room also has sizeable piles of gold. "; break; - case 13: woob+=" In addition to the many war trophies your Relic Room also has chests and cabinets full of gold. "; break; - case 14: woob+=" In addition to the many war trophies your Relic Room also has chests full to the brim of gold and many precious gems. "; break; - case 15: woob+=" War trophies, chests of gold, precious gems, your lair has it all. "; break; - case 16: woob+=" War trophies, chests of gold, precious gems, your lair has it all, and in abundance. "; break; - case 17: woob+=" The abundant gold and gem piles have begun to spill out into the hallway. "; break; - case 18: woob+=" The abundant gold and gems spill out into the hallway, your forces idly stepping across it. "; break; - case 19: woob+=" A sizeable portion of your lair is carelessly covered in gold coins, objects, and gems. "; break; - case 20: woob+=" Much of your lair is carelessly covered in gold coins, objects, and gems. "; break; - case 21: case 22: case 23: case 24: woob+=" Your abundant wealth is evident in your lair- every surface and much of the floor smothered by gold or gems. "; break; - case 25: case 26: case 27: case 28: case 29: woob+=" Gold and gems are everywhere, occasionally attached to the walls and ceiling where able. "; break; - default: - if (s_base.stock >= 30) { - woob+=" Gold and gems are EVERYWHERE. The main chamber in particular is a sea of gold and gems, especially deep at the corners. In all it is nearly three feet deep. Coins clink and settle as your forces walk through the room. "; - } - break; - } - if (s_base.forge>0) then woob+=" Your lair has a forge, fit to be used by several astartes at once. "; - if (s_base.hippo>0) then woob+=" Your lair has a hippodrome, or garage, that holds luxury vehicles. "; - if (s_base.torture>0) then woob+=" One of the rooms is a well-stocked torture chamber. "; - // if (string_count("forge",upp)>0) then woob+=" Your lair has a forge, fit to be used by several astartes at once. "; - if (s_base.librarium>0) then woob+=" A large librarium makes up one of the wings, holding countless novels, books, scrolls, and documents on various topics. "; - if (s_base.beastarium>0) then woob+=" Your lair has a beastarium, animals native to your homeworld living within. "; - if (s_base.swimming>0) then woob+=" A large swimming pool with chapter-themed floaties is emplaced near the entrance. "; - if (s_base.stasis>0) then woob+=" One of the chambers holds several stasis pods for display. They are currently empty. "; - - - draw_set_color(c_gray);draw_set_font(fnt_40k_14);draw_set_halign(fa_left); - draw_rectangle(xx+12,yy+45,xx+486,yy+378,1); - - var hh=1; - for(i=0;i<2;i++){if (((string_height_ext(string_hash_to_newline(string(woob)),-1,470))*hh)>330) then hh-=0.1;} - draw_text_ext_transformed(xx+14,yy+47,string_hash_to_newline(string(woob)),-1,470*(2+(hh*-1)),hh,hh,0); - - if (tooltip3!=""){ - draw_set_alpha(1); - draw_set_font(fnt_40k_14); - draw_set_halign(fa_left); - draw_set_color(0); - draw_rectangle(mouse_x+18,mouse_y+20,mouse_x+string_width_ext(string_hash_to_newline(tooltip4),-1,500)+24,mouse_y+64+string_height_ext(string_hash_to_newline(tooltip4),-1,500),0); - draw_set_color(c_gray); - draw_rectangle(mouse_x+18,mouse_y+20,mouse_x+string_width_ext(string_hash_to_newline(tooltip4),-1,500)+24,mouse_y+64+string_height_ext(string_hash_to_newline(tooltip4),-1,500),1); - draw_set_font(fnt_40k_14b); - draw_text(mouse_x+22,mouse_y+22,string_hash_to_newline(string(tooltip3))); - draw_set_font(fnt_40k_14);draw_text_ext(mouse_x+22,mouse_y+42,string_hash_to_newline(string(tooltip4)),-1,500); - - draw_set_color(16291875); - if (obj_controller.requisition=1000){ - obj_temp_build.isnew=1; - obj_controller.requisition-=1000; - } - }draw_set_halign(fa_left); - - draw_sprite(spr_requisition,0,xx+160,yy+112); - draw_set_color(16291875);if (obj_controller.requisition<1500) then draw_set_color(c_red);draw_text(xx+180,yy+112,string_hash_to_newline("1500"));draw_set_color(c_gray); - draw_text_ext(xx+21,yy+130,string_hash_to_newline("Hidden armoury that stores unused Chaos and Daemonic artifacts, preventing them from discovery."),-1,600); - draw_rectangle(xx+300,yy+110,xx+400,yy+130,0); - draw_set_halign(fa_center); - draw_set_color(0); - draw_text(xx+350,yy+112,string_hash_to_newline("Build"));draw_text(xx+351,yy+113,string_hash_to_newline("Build")); - if (scr_hit(xx+300,yy+110,xx+400,yy+130)){ - draw_set_alpha(0.2); - draw_rectangle(xx+300,yy+110,xx+400,yy+130,0); - draw_set_alpha(1); - - if (scr_click_left()) and (obj_controller.requisition>=1500){ - array_push(planet_upgrades, new NewPlanetFeature(P_features.Arsenal)); - obj_controller.requisition-=1500; - } - }draw_set_halign(fa_left); - - draw_sprite(spr_requisition,0,xx+160,yy+177); - draw_set_color(16291875); - if (obj_controller.requisition<4000) then draw_set_color(c_red); - draw_text(xx+180,yy+177,string_hash_to_newline("4000")); - draw_set_color(c_gray); - draw_text_ext(xx+21,yy+195,string_hash_to_newline("Hidden gene-vault that off-sources the majority of your Gene-Seed and Test-Slave Incubators."),-1,600); - draw_rectangle(xx+300,yy+175,xx+400,yy+195,0); - draw_set_halign(fa_center);draw_set_color(0); - draw_text(xx+350,yy+177,string_hash_to_newline("Build"));draw_text(xx+351,yy+178,string_hash_to_newline("Build")); - if (scr_hit(xx+300,yy+175,xx+400,yy+195)){ - draw_set_alpha(0.2);draw_rectangle(xx+300,yy+175,xx+400,yy+195,0);draw_set_alpha(1); - - if (scr_click_left()) and (obj_controller.requisition>=4000){ - array_push(planet_upgrades, new NewPlanetFeature(P_features.Gene_Vault)); - obj_controller.requisition-=4000; - } - }draw_set_halign(fa_left); - } - - draw_set_font(fnt_40k_30b); - draw_set_color(c_gray); - draw_rectangle(xx+312-60,yy+388,xx+312+60,yy+420,0); - draw_set_halign(fa_center); - draw_set_color(0); - draw_text(xx+312,yy+388,string_hash_to_newline("Back")); - if (scr_hit(xx+312-60,yy+388,xx+312+60,yy+420)=true){ - draw_set_alpha(0.2); - draw_rectangle(xx+312-60,yy+388,xx+312+60,yy+420,0);draw_set_alpha(1); - - if (scr_click_left()){ - obj_controller.menu=0; - } - - }draw_set_halign(fa_left); - } - - if (selected!=0) and (!instance_exists(selected)) then selected=0; - - var xx=__view_get( e__VW.XView, 0 )+0; - var yy=__view_get( e__VW.YView, 0 )+0; - if (zoomed == 0){ - // Requisition income tooltip - if (scr_hit(xx+5,yy+10,xx+137,yy+38)){ - var tx=0,ty=0,plu=""; - tool1="Requisition Points#"; - tool2=tool1; - if (income_base>0) then plu="+"; - tool1+=string("Base Income: {0}{1}", plu, income_base); - tool2+="Base Income: "; - if (obj_ini.fleet_type=ePlayerBase.home_world){ - plu=""; - - if (income_home>0){ - tool1+=string("#Fortress Monastery Bonus: +{1}", plu,income_home); - tool2+="#Fortress Monastery Bonus: "; - } - if (income_forge>0){ - tool1+=string("#Nearby Forge Worlds: +{0}",income_forge); - tool2+="#Nearby Forge Worlds:"; - } - if (income_agri>0){ - tool1+=string("#Nearby Agri Worlds: +{0}",income_agri); - tool2+="#Nearby Agri Worlds:"; - } - } - if (obj_ini.fleet_type != ePlayerBase.home_world){ - plu=""; - if (income_home>0) then plu="+"; - tool1+="#Battle Barge Trade: "+string(plu)+string(income_home); - tool2+="#Battle Barge Trade: "; - } - plu=""; - if (income_training>0) then plu="+"; - if (income_training!=0){ - tool1+=string("#Specialist Training: {0}{1}",plu,income_training); - tool2+="#Specialist Training:"; - } - plu=""; - if (income_fleet>0) then plu="+"; - if (income_fleet!=0){ - tool1+=string("#Fleet Maintenance: {0}{1}",plu,income_fleet); - tool2+="#Fleet Maintenance:"; - } - plu=""; - if (income_tribute>0) then plu="+"; - if (income_tribute!=0){ - tool1+=string("#Planet Tithes: {0}{1}",plu,income_tribute); - tool2+="#Planet Tithes:"; - } - - if (tool1!=""){ - tooltip_draw(tool1); - } - } - - // Current Loyalty tooltip - if (scr_hit(xx+247,yy+10,xx+328,yy+38)){ - var tx=0,ty=0,tool1="",tool2="",plu=""; - - var d,lines;d=0;lines=0; - for(var d=1; d<=20; d++){ - if (loyal_num[d]>1) and (lines=0){ - tool1+=string(loyal[d])+": -"+string(loyal_num[d])+"#"; - tool2+=string(loyal[d])+": #"; - lines++; - } - if (loyal_num[d]>1) and (lines>0){ - tool1+=string(loyal[d])+": -"+string(loyal_num[d])+"#"; - tool2+=string(loyal[d])+": #"; - lines++; - } - } - - if (tool1="") then tool1="Loyalty"; - - if (tool1!=""){ - tooltip_draw(tool1); - } - } - - // Stored Gene-Seed tooltip - if (scr_hit(xx+373,yy+10,xx+443,yy+38)){ - var tx=0,ty=0,tool1="",tool2="",plu=""; - tool1="Gene-Seed"; - if (tool1!=""){ - tooltip_draw(tool1); - } - } - // Current Astartes tooltip - if (scr_hit(xx+478, yy+3, xx+552, yy+38)){ - var tx=0,ty=0,tool1="",tool2="",plu=""; - tool1="Astartes#(Normal/Command)"; - tool2="Astartes"; - if (tool1!=""){ - tooltip_draw(tool1); - } - } - // Turn tooltip - if (menu == 0) and (diplomacy<=0){ - if (scr_hit(xx+1435,yy+40,xx+1580,yy+267)){ - var tx=0,ty=0,tool1="",tool2="",plu=""; - tool1=$"Turn :{obj_controller.turn}"; - tool2="Astartes"; - if (tool1!=""){ - tooltip_draw(tool1); - } - } - } - // Forge Points income tooltip - if (scr_hit(xx+153,yy+10,xx+241,yy+38)){ - tooltip_draw(obj_controller.forge_string); - } - - // Penitence/Blood Debt tooltip - if (scr_hit(xx+923,yy+10,xx+1060,yy+38)) and (penitent==1) { - var tx=0,ty=0,tool1="",tool2="",plu="",hei_bonus; - - var endb=0,endb2=""; - endb=min(0,(((penitent_turn+1)*(penitent_turn+1))-512)*-1); - - if (obj_controller.blood_debt==1){ - tool1="Blood Spilled: "+string(penitent_current);tool2="Blood Spilled: "; - tool1+="#Blood Debt: "+string(penitent_max);tool2+="#Blood Debt: "; - tool1+="#Decay Rate: "+string(endb);tool2+="#Decay Rate: "; - - tool1+="##Attacking enemies, Raiding enemies, and losing Astartes will lower your Chapter's Blood Debt. Over time it decays. Bombarding enemies will prevent decay."; - hei_bonus=-20; - } - if (obj_controller.blood_debt=0){ - tool1="Current Penitence: "+string(penitent_current);tool2="Current Penitence: "; - tool1+="#Required Penitence: "+string(penitent_max);tool2+="#Required Penitence: "; - // tool1+="#Each Turn: +1";tool2+="#Each Turn: "; - // tool1+="# ";tool2+="# "; - - tool1+="##Penitence will be gained slowly over time. After the timer runs out your Chapter will no longer be considered Penitent."; - hei_bonus=23; - } - - if (tool1!=""){ - tooltip_draw(tool1) - } - } - } - exit; + // 48,48 over like 256, down to 480-128 + + if (obj_controller.menu == 60) { + var xx = camera_get_view_x(view_camera[0]) + 25; + var yy = camera_get_view_y(view_camera[0]) + 165; + + draw_sprite(spr_popup_large, 1, xx, yy); + // draw_set_color(0);draw_rectangle(xx+31,yy+29,xx+593,yy+402,0); + draw_set_color(c_gray); + // draw_rectangle(xx+31,yy+47,xx+593,yy+402,1); + + draw_set_font(fnt_40k_30b); + draw_set_halign(fa_center); + var planet_upgrades = obj_temp_build.target.p_upgrades[obj_controller.selecting_planet]; + var un_upgraded = 0; + var arsenal = 0; + var gene_vault = 0; + var s_base = 0; + var ttitle = ""; + var woob = ""; + + if (planet_feature_bool(planet_upgrades, P_features.Secret_Base) == 1) { + s_base = 1; + } + if (planet_feature_bool(planet_upgrades, P_features.Arsenal) == 1) { + arsenal = 1; + } + if (planet_feature_bool(planet_upgrades, P_features.Gene_Vault) == 1) { + gene_vault = 1; + } + un_upgraded = gene_vault + arsenal + s_base; + if (obj_temp_build.isnew == 1) { + title = "Secret Lair (" + string(obj_temp_build.target.name) + " " + scr_roman(obj_temp_build.planet) + ")"; + draw_text_transformed(xx + 312, yy + 10, string_hash_to_newline(title), 0.7, 0.7, 0); + + draw_set_font(fnt_40k_14b); + draw_text(xx + 312, yy + 45, "Select a Secret Lair style."); + draw_set_halign(fa_left); + + var styles = [ + { + name: "Barbarian", + description: "Heavy on leather, hides, and trophy body parts.", + tag: "BRB", + }, + { + name: "Disco", + description: "Rainbow colored dance floor and steel rafters.", + tag: "DIS", + }, + { + name: "Feudal", + description: "Lots of stone, metal filigree, and statues.", + tag: "FEU", + }, + { + name: "Gothic", + description: "Heavy on leather, hides, and trophy body parts.", + tag: "GTH", + }, + { + name: "Mechanicus", + description: "Grates, tubes, gears, and augmented reality.", + tag: "MCH", + }, + { + name: "Prospero", + description: "Marble or sandstone surfaces and gold filigree.", + tag: "PRS", + }, + { + name: "Rave Club", + description: "Large, open area with neon or strobe lights.", + tag: "RAV", + }, + { + name: "Steel", + description: "Stainless steel surfaces and water fountains.", + tag: "STL", + }, + { + name: "Utilitarian", + description: "Plaster or concrete surfaces with carpeting.", + tag: "UTL", + } + ]; + + var base_x1 = xx + 21; + var base_x2 = base_x1 + 579; + var base_y1 = yy + 88; + var base_y2 = base_y1 + 18; + var text_x1 = base_x1 + 2; + var text_x2 = text_x1 + 100; + + for (var r = 0; r < array_length(styles); r++) { + var style = styles[r]; + var y_offset = r * 30; + + draw_set_color(c_gray); + draw_rectangle(base_x1, base_y1 + y_offset, base_x2, base_y2 + y_offset, 0); + + if (scr_hit(base_x1, base_y1 + y_offset, base_x2, base_y2 + y_offset) == true) { + draw_set_color(c_black); + draw_set_alpha(0.2); + draw_rectangle(base_x1, base_y1 + y_offset, base_x2, base_y2 + y_offset, 0); + draw_set_alpha(1); + + if (scr_click_left()) { + var base_options = { + style: style.tag, + }; + obj_temp_build.isnew = 0; + array_push(planet_upgrades, new NewPlanetFeature(P_features.Secret_Base, base_options)); + } + } + + draw_set_color(c_black); + draw_set_font(fnt_40k_14b); + draw_text_transformed(text_x1, base_y1 + 2 + y_offset, string_hash_to_newline(style.name), 1, 0.8, 0); + draw_set_font(fnt_40k_14); + draw_text_transformed(text_x2, base_y1 + 2 + y_offset, string_hash_to_newline(style.description), 1, 0.8, 0); + } + } + + if (un_upgraded == 0) { + title = "Build (" + string(obj_temp_build.target.name) + " " + scr_roman(obj_temp_build.planet) + ")"; + } else if (un_upgraded != 0) { + if (s_base != 0) { + title = "Secret Lair (" + string(obj_temp_build.target.name) + " " + scr_roman(obj_temp_build.planet) + ")"; + } + if (arsenal != 0) { + title = "Secret Arsenal (" + string(obj_temp_build.target.name) + " " + scr_roman(obj_temp_build.planet) + ")"; + } + if (gene_vault != 0) { + title = "Secret Gene-Vault (" + string(obj_temp_build.target.name) + " " + scr_roman(obj_temp_build.planet) + ")"; + } + } + + draw_text_transformed(xx + 312, yy + 10, string_hash_to_newline(title), 0.7, 0.7, 0); + + draw_set_halign(fa_left); + + if (s_base > 0) { + var search_list = search_planet_features(planet_upgrades, P_features.Secret_Base); + if (array_length(search_list) > 0) { + woob = ""; + var secret = true; + s_base = planet_upgrades[search_list[0]]; + if (s_base.built > obj_controller.turn) { + draw_set_font(fnt_40k_14b); + draw_text(xx + 21, yy + 65, string_hash_to_newline($"This feature will be constructed in {s_base.built - obj_controller.turn} months.")); + } else if (s_base.built <= obj_controller.turn) { + if (s_base.inquis_hidden != 1) { + secret = false; + } + + var r = 0, butt = "", alp = 1, cost = 0, fuck = obj_temp_build, tooltip = "", tooltip2 = "", tooltip3 = "", tooltip4 = "", tcost = 0; + for (r = 1; r < 13; r++) { + alp = 1; + cost = 0; + switch (r) { + case 1: + if (s_base.forge > 0) { + alp = 0.33; + } + cost = 1000; + butt = "Forge"; + tooltip2 = "A modest, less elaborate forge able to employ a handful of Astartes or Techpriest."; + break; + case 2: + if (s_base.hippo > 0) { + alp = 0.33; + } + cost = 1000; + butt = "Hippodrome"; + tooltip2 = "A moderate sized garage fit to hold, service, and display vehicles."; + break; + case 3: + if (s_base.beastarium > 0) { + alp = 0.33; + } + cost = 1000; + butt = "Beastarium"; + tooltip2 = "An enclosure with simulated greenery and foilage meant to hold beasts."; + break; + case 4: + if (s_base.torture > 0) { + alp = 0.33; + } + cost = 500; + butt = "Torture Chamber"; + tooltip2 = "Only the best for the best. A room full of torture tools and devices."; + break; + case 5: + if (s_base.narcotics > 0) { + alp = 0.33; + } + cost = 500; + butt = "Narcotics"; + tooltip2 = "Several boxes worth of Obscura, Black Lethe, Kyxa... line it up."; + break; + case 6: + if (s_base.relic > 0) { + alp = 10 + fuck.relic; + } + cost = 500; + butt = "Relic Room"; + tooltip2 = "A room meant for displaying trophies. May be purchased successive times."; + break; + case 7: + if (s_base.cookery > 0) { + alp = 0.33; + } + cost = 250; + butt = "Cookery"; + tooltip2 = "A larger, well-stocked cookery, complete with a number of Imperial Chef servants."; + break; + case 8: + if (s_base.vox > 0) { + alp = 0.33; + } + cost = 250; + butt = "Vox Casters"; + tooltip2 = "All the bass one could ever imaginably need."; + break; + case 9: + if (s_base.librarium > 0) { + alp = 0.33; + } + cost = 250; + butt = "Librarium"; + tooltip2 = "A study fit to hold a staggering amount of tomes and scrolls."; + break; + case 10: + if (s_base.throne > 0) { + alp = 0.33; + } + cost = 250; + butt = "Throne"; + tooltip2 = "A massive, ego boosting throne."; + break; + case 11: + if (s_base.stasis > 0) { + alp = 0.33; + } + cost = 200; + butt = "Stasis Pods"; + tooltip2 = "Though they start empty, you may capture and display your foes in these."; + break; + case 12: + if (s_base.swimming > 0) { + alp = 0.33; + } + cost = 100; + butt = "Swimming Pool"; + tooltip2 = "A large body of water meant for excersize or relaxation."; + break; + } + tooltip = butt; + + draw_set_font(fnt_40k_14); + draw_set_alpha(alp); + draw_set_color(c_gray); + draw_rectangle(xx + 494, yy + 12 + ((r - 1) * 22), xx + 614, yy + 32 + ((r - 1) * 22), 0); + draw_set_color(c_black); + draw_text_transformed(xx + 496, yy + 14 + ((r - 1) * 22), string_hash_to_newline(string(butt)), 1, 0.9, 0); + draw_set_alpha(1); + + if (scr_hit(xx + 494, yy + 12 + ((r - 1) * 22), xx + 614, yy + 32 + ((r - 1) * 22)) == true) { + if (alp <= 0.33) { + draw_set_alpha(0.1); + } + if (alp > 0.33) { + draw_set_alpha(0.2); + } + draw_set_color(0); + draw_rectangle(xx + 494, yy + 12 + ((r - 1) * 22), xx + 614, yy + 32 + ((r - 1) * 22), 0); + draw_set_alpha(1); + tooltip3 = tooltip; + tooltip4 = tooltip2; + tcost = cost; + if (scr_click_left() && (obj_controller.requisition >= tcost) && (alp != 0.33)) { + obj_controller.requisition -= tcost; + switch (r) { + case 1: + s_base.forge = 1; + s_base.forge_data = new PlayerForge(); + break; + case 2: + s_base.hippo = 1; + break; + case 3: + s_base.beastarium = 1; + break; + case 4: + s_base.torture = 1; + break; + case 5: + s_base.narcotics = 1; + break; + case 6: + s_base.relic = 1; + break; + case 7: + s_base.cookery = 1; + break; + case 8: + s_base.vox = 1; + break; + case 9: + s_base.librarium = 1; + break; + case 10: + s_base.throne = 1; + break; + case 11: + s_base.stasis = 1; + break; + case 12: + s_base.swimming = 1; + break; + } + } + } + } + + woob = "Deep beneath the surface of " + string(fuck.target.name) + " " + scr_roman(obj_controller.selecting_planet) + " lays your "; + if (secret) { + woob += "secret lair. "; + } else if (!secret) { + woob += "previously discovered lair. "; + } + + woob += "It is massive"; + switch (s_base.style) { + case "BRB": + woob += ", the walls decorated with animal hides and leather. Among the copius body-trophies and bones are torches that hiss and spit. "; + break; + case "DIS": + woob += "- the main attraction is the rainbow-colored, lit up grid flooring which quickly change color. Far overhead are metal rafters. "; + break; + case "FEU": + woob += ", the walls made up of sturdy blocks of stones. It is heavily decorated with wooden furniture, banners, and medieval weaponry. "; + break; + case "GTH": + woob += ", the walls made up of lightly-dusty stone. Mosaics and statues are abundant throughout, giving it that comfortable gothic feel. "; + break; + case "MCH": + woob += "- at a glance it appears decorated like a factory. Those with a neural network see the lair as brightly colored and lit, full of knowledge, learning, and chapter iconography. "; + break; + case "PRS": + woob += ", the walls made up of polished sandstone or marble. All throughout are chapter iconography and ancient symbols, wrought in gold. "; + break; + case "RAV": + woob += " but nearly pitch-black inside. The only illumination is provided by loopy neon lux-casters, and strobes, which blast out light in random, flickering patterns. "; + break; + case "STL": + woob += ". All of the surfaces are made up of highly polished stainless steel. An occasional small water fountain or plant decorates the place. "; + break; + case "UTL": + woob += " and almost civilian looking in nature- the walls are up of simple concrete or plaster. A thick carpet covers much of the floor."; + break; + } + + if (s_base.throne == 1) { + woob += " The center chamber is dominated by "; + var yep = false, c = 0; + + if (obj_controller.temp[104] == string(obj_temp_build.target.name) + "." + string(obj_controller.selecting_planet)) { + yep = true; + } + if (yep) { + woob += "a massive throne, which you are currently seated upon. "; + } else if (!yep) { + woob += "a massive throne, though it is currently vacant. "; + } + } + if ((s_base.vox > 0) && (fuck.target.p_player[obj_controller.selecting_planet] > 0)) { + woob += "Heretical music blasts from the vox-casters, shaking the walls. "; + } + if (s_base.narcotics > 0) { + woob += " Many of the tables have lines of white powder set on paper or bunches of needles. Plastic straws lay close by. "; + } + if (s_base.cookery == 1) { + if (fuck.target.p_player[obj_controller.selecting_planet] > 0) { + woob += "Imperial Chefs are currently bustling to and from the kitchen, cooking savory treats and food for those present. "; + } + if (fuck.target.p_player[obj_controller.selecting_planet] == 0) { + woob += "The Imperial Chefs are mostly idle, making use of the other rooms and facilities. "; + } + } + switch (s_base.stock) { + case 1: + woob += " One of the chambers is hollowed out to display war trophies and gear. "; + break; + case 2: + woob += " One of the chambers holds war trophies from recent conquests. "; + break; + case 3: + woob += " War trophies taken from several Xeno races are displayed in the Relic Room. "; + break; + case 4: + woob += " Your Relic Room contains trophies and skulls, taken from every Xeno race. "; + break; + case 5: + woob += " Your Relic Room contains trophies, skulls, and suits of armour taken from Xenos races. "; + break; + case 6: + woob += " Your Relic Room contains wargear and suits of armour from all races, several Adeptus Astartes suits included. "; + break; + case 7: + woob += " One of the chambers holds wargear and suits of armour from all races. A suit of Terminator armour is included, half of the armour taken off to reveal the inner workings."; + break; + case 8: + woob += " Your Relic Room's trophies, skulls, and armours now spill out into the hallways, such is their number. "; + break; + case 9: + woob += " Many of the xenos war trophies and suits of armour are placed around the Lair, filling out spare surfaces. "; + break; + case 10: + woob += " In addition to the many war trophies your Relic Room also has small amounts of gold coins. "; + break; + case 11: + woob += " In addition to the many war trophies your Relic Room also has small piles of gold coins and clutter. "; + break; + case 12: + woob += " In addition to the many war trophies your Relic Room also has sizeable piles of gold. "; + break; + case 13: + woob += " In addition to the many war trophies your Relic Room also has chests and cabinets full of gold. "; + break; + case 14: + woob += " In addition to the many war trophies your Relic Room also has chests full to the brim of gold and many precious gems. "; + break; + case 15: + woob += " War trophies, chests of gold, precious gems, your lair has it all. "; + break; + case 16: + woob += " War trophies, chests of gold, precious gems, your lair has it all, and in abundance. "; + break; + case 17: + woob += " The abundant gold and gem piles have begun to spill out into the hallway. "; + break; + case 18: + woob += " The abundant gold and gems spill out into the hallway, your forces idly stepping across it. "; + break; + case 19: + woob += " A sizeable portion of your lair is carelessly covered in gold coins, objects, and gems. "; + break; + case 20: + woob += " Much of your lair is carelessly covered in gold coins, objects, and gems. "; + break; + case 21: + case 22: + case 23: + case 24: + woob += " Your abundant wealth is evident in your lair- every surface and much of the floor smothered by gold or gems. "; + break; + case 25: + case 26: + case 27: + case 28: + case 29: + woob += " Gold and gems are everywhere, occasionally attached to the walls and ceiling where able. "; + break; + default: + if (s_base.stock >= 30) { + woob += " Gold and gems are EVERYWHERE. The main chamber in particular is a sea of gold and gems, especially deep at the corners. In all it is nearly three feet deep. Coins clink and settle as your forces walk through the room. "; + } + break; + } + if (s_base.forge > 0) { + woob += " Your lair has a forge, fit to be used by several astartes at once. "; + } + if (s_base.hippo > 0) { + woob += " Your lair has a hippodrome, or garage, that holds luxury vehicles. "; + } + if (s_base.torture > 0) { + woob += " One of the rooms is a well-stocked torture chamber. "; + } + // if (string_count("forge",upp)>0) then woob+=" Your lair has a forge, fit to be used by several astartes at once. "; + if (s_base.librarium > 0) { + woob += " A large librarium makes up one of the wings, holding countless novels, books, scrolls, and documents on various topics. "; + } + if (s_base.beastarium > 0) { + woob += " Your lair has a beastarium, animals native to your homeworld living within. "; + } + if (s_base.swimming > 0) { + woob += " A large swimming pool with chapter-themed floaties is emplaced near the entrance. "; + } + if (s_base.stasis > 0) { + woob += " One of the chambers holds several stasis pods for display. They are currently empty. "; + } + + draw_set_color(c_gray); + draw_set_font(fnt_40k_14); + draw_set_halign(fa_left); + draw_rectangle(xx + 12, yy + 45, xx + 486, yy + 378, 1); + + var hh = 1; + for (i = 0; i < 2; i++) { + if ((string_height_ext(string_hash_to_newline(string(woob)), -1, 470) * hh) > 330) { + hh -= 0.1; + } + } + draw_text_ext_transformed(xx + 14, yy + 47, string_hash_to_newline(string(woob)), -1, 470 * (2 + (hh * -1)), hh, hh, 0); + + if (tooltip3 != "") { + draw_set_alpha(1); + draw_set_font(fnt_40k_14); + draw_set_halign(fa_left); + draw_set_color(0); + draw_rectangle(mouse_x + 18, mouse_y + 20, mouse_x + string_width_ext(string_hash_to_newline(tooltip4), -1, 500) + 24, mouse_y + 64 + string_height_ext(string_hash_to_newline(tooltip4), -1, 500), 0); + draw_set_color(c_gray); + draw_rectangle(mouse_x + 18, mouse_y + 20, mouse_x + string_width_ext(string_hash_to_newline(tooltip4), -1, 500) + 24, mouse_y + 64 + string_height_ext(string_hash_to_newline(tooltip4), -1, 500), 1); + draw_set_font(fnt_40k_14b); + draw_text(mouse_x + 22, mouse_y + 22, string_hash_to_newline(string(tooltip3))); + draw_set_font(fnt_40k_14); + draw_text_ext(mouse_x + 22, mouse_y + 42, string_hash_to_newline(string(tooltip4)), -1, 500); + + draw_set_color(16291875); + if (obj_controller.requisition < tcost) { + draw_set_color(c_red); + } + draw_sprite(spr_requisition, 0, mouse_x + 22, mouse_y + 45 + string_height_ext(string_hash_to_newline(tooltip4), -1, 500)); + draw_text(mouse_x + 42, mouse_y + 42 + string_height_ext(string_hash_to_newline(tooltip4), -1, 500), string_hash_to_newline(string(tcost))); + } + } + } + } + draw_set_font(fnt_40k_14b); + woob = ""; + var arsenal = 0, gene_vault = 0; + if (planet_feature_bool(planet_upgrades, P_features.Arsenal) == 1) { + var arsenal = planet_upgrades[search_planet_features(planet_upgrades, P_features.Arsenal)[0]]; + if (arsenal.inquis_hidden == 1) { + woob = "A moderate sized secret Arsenal, this structure has ample holding area to store any number of artifacts and wargear. Chaos and Daemonic items will be sent here by your Master of Relics, and due to the secret nature of its existance, the Inquisition will not find them during routine inspections."; + } + if (arsenal.inquis_hidden == 0) { + woob = "A moderate sized Arsenal, this structure has ample holding area to store any number of artifacts and wargear. Since being discovered it may no longer hide Chaos and Daemonic wargear from routine Inquisition inspections. You may wish to construct another Arsenal on a different planet."; + } + } + if (planet_feature_bool(planet_upgrades, P_features.Gene_Vault) == 1) { + var gene_vault = planet_upgrades[search_planet_features(planet_upgrades, P_features.Gene_Vault)[0]]; + if (gene_vault.inquis_hidden == 1) { + woob = "A large facility with Gene-Vaults and additional spare rooms, this structure safely stores the majority of your Gene-Seed and is ran by servitors. Due to its secret nature you may amass Gene-Seed and Test-Slave Incubators without fear of Inquisition reprisal or taking offense."; + } + if (gene_vault.inquis_hidden == 0) { + woob = "A large facility with Gene-Vaults and additional spare rooms, this structure safely stores the majority of your Gene-Seed and is ran by servitors. Since being discovered all the contents are known to the Inquisition. Your Gene-Seed remains protected but you may wish to build a new, secret one."; + } + } + if ((arsenal != 0) || (gene_vault != 0)) { + draw_text_ext(xx + 21, yy + 65, string_hash_to_newline(string(woob)), -1, 595); + } + if (un_upgraded == 0 && obj_temp_build.isnew != 1) { + draw_set_font(fnt_40k_14b); + if (s_base == 0) { + draw_text(xx + 21, yy + 45, string_hash_to_newline("Lair")); + } + if (arsenal == 0) { + draw_text(xx + 21, yy + 110, string_hash_to_newline("Arsenal")); + } + if (gene_vault == 0) { + draw_text(xx + 21, yy + 175, string_hash_to_newline("Gene-Vault")); + } + draw_set_font(fnt_40k_14); + + draw_sprite(spr_requisition, 0, xx + 160, yy + 47); + draw_set_color(16291875); + if (obj_controller.requisition < 1000) { + draw_set_color(c_red); + } + draw_text(xx + 180, yy + 47, string_hash_to_newline("1000")); + draw_set_color(c_gray); + draw_text_ext(xx + 21, yy + 65, string_hash_to_newline("Customizable hideout that your forces may garrison into. The Lair may be upgraded further."), -6, 600); + draw_rectangle(xx + 300, yy + 45, xx + 400, yy + 65, 0); + draw_set_halign(fa_center); + draw_set_color(0); + draw_text(xx + 350, yy + 47, string_hash_to_newline("Build")); + draw_text(xx + 351, yy + 48, string_hash_to_newline("Build")); + if (scr_hit(xx + 300, yy + 45, xx + 400, yy + 65) == true) { + draw_set_alpha(0.2); + draw_rectangle(xx + 300, yy + 45, xx + 400, yy + 65, 0); + draw_set_alpha(1); + + if (scr_click_left() && (obj_controller.requisition >= 1000)) { + obj_temp_build.isnew = 1; + obj_controller.requisition -= 1000; + } + } + draw_set_halign(fa_left); + + draw_sprite(spr_requisition, 0, xx + 160, yy + 112); + draw_set_color(16291875); + if (obj_controller.requisition < 1500) { + draw_set_color(c_red); + } + draw_text(xx + 180, yy + 112, string_hash_to_newline("1500")); + draw_set_color(c_gray); + draw_text_ext(xx + 21, yy + 130, string_hash_to_newline("Hidden armoury that stores unused Chaos and Daemonic artifacts, preventing them from discovery."), -1, 600); + draw_rectangle(xx + 300, yy + 110, xx + 400, yy + 130, 0); + draw_set_halign(fa_center); + draw_set_color(0); + draw_text(xx + 350, yy + 112, string_hash_to_newline("Build")); + draw_text(xx + 351, yy + 113, string_hash_to_newline("Build")); + if (scr_hit(xx + 300, yy + 110, xx + 400, yy + 130)) { + draw_set_alpha(0.2); + draw_rectangle(xx + 300, yy + 110, xx + 400, yy + 130, 0); + draw_set_alpha(1); + + if (scr_click_left() && (obj_controller.requisition >= 1500)) { + array_push(planet_upgrades, new NewPlanetFeature(P_features.Arsenal)); + obj_controller.requisition -= 1500; + } + } + draw_set_halign(fa_left); + + draw_sprite(spr_requisition, 0, xx + 160, yy + 177); + draw_set_color(16291875); + if (obj_controller.requisition < 4000) { + draw_set_color(c_red); + } + draw_text(xx + 180, yy + 177, string_hash_to_newline("4000")); + draw_set_color(c_gray); + draw_text_ext(xx + 21, yy + 195, string_hash_to_newline("Hidden gene-vault that off-sources the majority of your Gene-Seed and Test-Slave Incubators."), -1, 600); + draw_rectangle(xx + 300, yy + 175, xx + 400, yy + 195, 0); + draw_set_halign(fa_center); + draw_set_color(0); + draw_text(xx + 350, yy + 177, string_hash_to_newline("Build")); + draw_text(xx + 351, yy + 178, string_hash_to_newline("Build")); + if (scr_hit(xx + 300, yy + 175, xx + 400, yy + 195)) { + draw_set_alpha(0.2); + draw_rectangle(xx + 300, yy + 175, xx + 400, yy + 195, 0); + draw_set_alpha(1); + + if (scr_click_left() && (obj_controller.requisition >= 4000)) { + array_push(planet_upgrades, new NewPlanetFeature(P_features.Gene_Vault)); + obj_controller.requisition -= 4000; + } + } + draw_set_halign(fa_left); + } + + draw_set_font(fnt_40k_30b); + draw_set_color(c_gray); + draw_rectangle(xx + 312 - 60, yy + 388, xx + 312 + 60, yy + 420, 0); + draw_set_halign(fa_center); + draw_set_color(0); + draw_text(xx + 312, yy + 388, string_hash_to_newline("Back")); + if (scr_hit(xx + 312 - 60, yy + 388, xx + 312 + 60, yy + 420) == true) { + draw_set_alpha(0.2); + draw_rectangle(xx + 312 - 60, yy + 388, xx + 312 + 60, yy + 420, 0); + draw_set_alpha(1); + + if (scr_click_left()) { + obj_controller.menu = 0; + } + } + draw_set_halign(fa_left); + } + + if ((selected != 0) && (!instance_exists(selected))) { + selected = 0; + } + + var xx = camera_get_view_x(view_camera[0]) + 0; + var yy = camera_get_view_y(view_camera[0]) + 0; + if (zoomed == 0) { + // Requisition income tooltip + if (scr_hit(xx + 5, yy + 10, xx + 137, yy + 38)) { + var tx = 0, ty = 0, plu = ""; + tool1 = "Requisition Points#"; + tool2 = tool1; + if (income_base > 0) { + plu = "+"; + } + tool1 += string("Base Income: {0}{1}", plu, income_base); + tool2 += "Base Income: "; + if (obj_ini.fleet_type == ePlayerBase.home_world) { + plu = ""; + + if (income_home > 0) { + tool1 += string("#Fortress Monastery Bonus: +{1}", plu, income_home); + tool2 += "#Fortress Monastery Bonus: "; + } + if (income_forge > 0) { + tool1 += string("#Nearby Forge Worlds: +{0}", income_forge); + tool2 += "#Nearby Forge Worlds:"; + } + if (income_agri > 0) { + tool1 += string("#Nearby Agri Worlds: +{0}", income_agri); + tool2 += "#Nearby Agri Worlds:"; + } + } + if (obj_ini.fleet_type != ePlayerBase.home_world) { + plu = ""; + if (income_home > 0) { + plu = "+"; + } + tool1 += "#Battle Barge Trade: " + string(plu) + string(income_home); + tool2 += "#Battle Barge Trade: "; + } + plu = ""; + if (income_training > 0) { + plu = "+"; + } + if (income_training != 0) { + tool1 += string("#Specialist Training: {0}{1}", plu, income_training); + tool2 += "#Specialist Training:"; + } + plu = ""; + if (income_fleet > 0) { + plu = "+"; + } + if (income_fleet != 0) { + tool1 += string("#Fleet Maintenance: {0}{1}", plu, income_fleet); + tool2 += "#Fleet Maintenance:"; + } + plu = ""; + if (income_tribute > 0) { + plu = "+"; + } + if (income_tribute != 0) { + tool1 += string("#Planet Tithes: {0}{1}", plu, income_tribute); + tool2 += "#Planet Tithes:"; + } + + if (tool1 != "") { + tooltip_draw(tool1); + } + } + + // Current Loyalty tooltip + if (scr_hit(xx + 247, yy + 10, xx + 328, yy + 38)) { + var tx = 0, ty = 0, tool1 = "", tool2 = "", plu = ""; + + var d, lines; + d = 0; + lines = 0; + for (var d = 1; d <= 20; d++) { + if ((loyal_num[d] > 1) && (lines == 0)) { + tool1 += string(loyal[d]) + ": -" + string(loyal_num[d]) + "#"; + tool2 += string(loyal[d]) + ": #"; + lines++; + } + if ((loyal_num[d] > 1) && (lines > 0)) { + tool1 += string(loyal[d]) + ": -" + string(loyal_num[d]) + "#"; + tool2 += string(loyal[d]) + ": #"; + lines++; + } + } + + if (tool1 == "") { + tool1 = "Loyalty"; + } + + if (tool1 != "") { + tooltip_draw(tool1); + } + } + + // Stored Gene-Seed tooltip + if (scr_hit(xx + 373, yy + 10, xx + 443, yy + 38)) { + var tx = 0, ty = 0, tool1 = "", tool2 = "", plu = ""; + tool1 = "Gene-Seed"; + if (tool1 != "") { + tooltip_draw(tool1); + } + } + // Current Astartes tooltip + if (scr_hit(xx + 478, yy + 3, xx + 552, yy + 38)) { + var tx = 0, ty = 0, tool1 = "", tool2 = "", plu = ""; + tool1 = "Astartes#(Normal/Command)"; + tool2 = "Astartes"; + if (tool1 != "") { + tooltip_draw(tool1); + } + } + // Turn tooltip + if ((menu == 0) && (diplomacy <= 0)) { + if (scr_hit(xx + 1435, yy + 40, xx + 1580, yy + 267)) { + var tx = 0, ty = 0, tool1 = "", tool2 = "", plu = ""; + tool1 = $"Turn :{obj_controller.turn}"; + tool2 = "Astartes"; + if (tool1 != "") { + tooltip_draw(tool1); + } + } + } + // Forge Points income tooltip + if (scr_hit(xx + 153, yy + 10, xx + 241, yy + 38)) { + tooltip_draw(obj_controller.forge_string); + } + + // Penitence/Blood Debt tooltip + if (scr_hit(xx + 923, yy + 10, xx + 1060, yy + 38) && (penitent == 1)) { + var tx = 0, ty = 0, tool1 = "", tool2 = "", plu = "", hei_bonus; + + var endb = 0, endb2 = ""; + endb = min(0, (((penitent_turn + 1) * (penitent_turn + 1)) - 512) * -1); + + if (obj_controller.blood_debt == 1) { + tool1 = "Blood Spilled: " + string(penitent_current); + tool2 = "Blood Spilled: "; + tool1 += "#Blood Debt: " + string(penitent_max); + tool2 += "#Blood Debt: "; + tool1 += "#Decay Rate: " + string(endb); + tool2 += "#Decay Rate: "; + + tool1 += "##Attacking enemies, Raiding enemies, and losing Astartes will lower your Chapter's Blood Debt. Over time it decays. Bombarding enemies will prevent decay."; + hei_bonus = -20; + } + if (obj_controller.blood_debt == 0) { + tool1 = "Current Penitence: " + string(penitent_current); + tool2 = "Current Penitence: "; + tool1 += "#Required Penitence: " + string(penitent_max); + tool2 += "#Required Penitence: "; + // tool1+="#Each Turn: +1";tool2+="#Each Turn: "; + // tool1+="# ";tool2+="# "; + + tool1 += "##Penitence will be gained slowly over time. After the timer runs out your Chapter will no longer be considered Penitent."; + hei_bonus = 23; + } + + if (tool1 != "") { + tooltip_draw(tool1); + } + } + } + exit; } diff --git a/scripts/scr_ui_settings/scr_ui_settings.gml b/scripts/scr_ui_settings/scr_ui_settings.gml index 3fd0672d85..a7c724a821 100644 --- a/scripts/scr_ui_settings/scr_ui_settings.gml +++ b/scripts/scr_ui_settings/scr_ui_settings.gml @@ -5,11 +5,11 @@ function scr_ui_settings() { var xx, yy; var tool1 = "", tool2 = ""; var che = false; - var cx, cy; + var cx, cy; var x5 = 0, y5 = 0, x6 = 0; var too_img = 0; - xx = __view_get(e__VW.XView, 0) + 0; - yy = __view_get(e__VW.YView, 0) + 0; + xx = camera_get_view_x(view_camera[0]) + 0; + yy = camera_get_view_y(view_camera[0]) + 0; if ((menu >= 21) && (menu <= 24)) { draw_sprite(spr_settings_bg, 0, xx, yy); @@ -64,7 +64,7 @@ function scr_ui_settings() { keyboard_string = bat_formation[formating]; } } else { - text_bar = 0; + text_bar = 0; } } @@ -90,13 +90,13 @@ function scr_ui_settings() { che = true; } else { che = false; - } + } cx = xx + 757; cy = yy + 120; // Defines the attack command - var _formation_name = "Attack Formation"; + var _formation_name = "Attack Formation"; draw_text(cx, cy, _formation_name); cx -= 35; @@ -111,22 +111,22 @@ function scr_ui_settings() { if (scr_hit(cx, cy, cx + string_width(_formation_name), cy + sprite_get_height(spr_creation_check))) { tool1 = _formation_name; tool2 = "Can't be used in Raids. Can use any vehicles."; - if (scr_click_left() && formating > 3 && bat_formation_type[formating] != 1) { - bat_formation_type[formating] = 1; - scr_ui_formation_bars(); - } + if (scr_click_left() && formating > 3 && bat_formation_type[formating] != 1) { + bat_formation_type[formating] = 1; + scr_ui_formation_bars(); + } } if (bat_formation_type[formating] == 2) { che = true; } else { che = false; - } + } // Defines the Raid action cx = xx + 757; cy = yy + 155; - _formation_name = "Raid Formation"; + _formation_name = "Raid Formation"; draw_text(cx, cy, _formation_name); cx -= 35; @@ -141,10 +141,10 @@ function scr_ui_settings() { if (scr_hit(cx, cy, cx + string_width(_formation_name), cy + sprite_get_height(spr_creation_check))) { tool1 = _formation_name; tool2 = "Can only be used in Raids. Prevents the use of all vehicles aside from Dreadnoughts and Land Speeders. Starts in melee."; - if (scr_click_left() && formating > 3 && bat_formation_type[formating] != 2) { - bat_formation_type[formating] = 2; - scr_ui_formation_bars(); - } + if (scr_click_left() && formating > 3 && bat_formation_type[formating] != 2) { + bat_formation_type[formating] = 2; + scr_ui_formation_bars(); + } } draw_set_color(c_gray); @@ -288,19 +288,19 @@ function scr_ui_settings() { scr_image("formation", too_img, xx + 1271, yy + 252, 239, 297); } - if (tool1 != "") { - draw_set_alpha(1); - draw_set_font(fnt_40k_14); - draw_set_halign(fa_left); - draw_set_color(0); - draw_rectangle(mouse_x + 18, mouse_y + 20, mouse_x + string_width_ext(tool2, -1, 500) + 24, mouse_y + 44 + string_height_ext(tool2, -1, 500), 0); - draw_set_color(c_gray); - draw_rectangle(mouse_x + 18, mouse_y + 20, mouse_x + string_width_ext(tool2, -1, 500) + 24, mouse_y + 44 + string_height_ext(tool2, -1, 500), 1); - draw_set_font(fnt_40k_14b); - draw_text(mouse_x + 22, mouse_y + 22, string(tool1)); - draw_set_font(fnt_40k_14); - draw_text_ext(mouse_x + 22, mouse_y + 42, string(tool2), -1, 500); - } + if (tool1 != "") { + draw_set_alpha(1); + draw_set_font(fnt_40k_14); + draw_set_halign(fa_left); + draw_set_color(0); + draw_rectangle(mouse_x + 18, mouse_y + 20, mouse_x + string_width_ext(tool2, -1, 500) + 24, mouse_y + 44 + string_height_ext(tool2, -1, 500), 0); + draw_set_color(c_gray); + draw_rectangle(mouse_x + 18, mouse_y + 20, mouse_x + string_width_ext(tool2, -1, 500) + 24, mouse_y + 44 + string_height_ext(tool2, -1, 500), 1); + draw_set_font(fnt_40k_14b); + draw_text(mouse_x + 22, mouse_y + 22, string(tool1)); + draw_set_font(fnt_40k_14); + draw_text_ext(mouse_x + 22, mouse_y + 42, string(tool2), -1, 500); + } } if (menu == 23) { @@ -321,7 +321,7 @@ function scr_ui_settings() { draw_set_halign(fa_center); draw_set_color(c_gray); draw_set_font(fnt_40k_30b); - draw_text_transformed(xx + 800, yy + 66, string(obj_ini.role[100, settings]) + " Settings", 1, 1, 0); + draw_text_transformed(xx + 800, yy + 66, string(obj_ini.role[100][settings]) + " Settings", 1, 1, 0); // New: 678,160 // Old: 444,550 @@ -330,10 +330,10 @@ function scr_ui_settings() { draw_set_font(fnt_40k_30b); draw_set_color(c_gray); draw_set_halign(fa_left); - draw_text_transformed(xx + 678, yy + 160, obj_ini.role[co, ide], 0.6, 0.6, 0); + draw_text_transformed(xx + 678, yy + 160, obj_ini.role[co][ide], 0.6, 0.6, 0); var wid, hei; wid = 0; - hei = string_height_ext(string(obj_ini.role[co, ide]) + "Q", -1, 580) * 0.6; + hei = string_height_ext(string(obj_ini.role[co][ide]) + "Q", -1, 580) * 0.6; draw_rectangle(xx + 678 - 1, yy + 160 - 1, xx + 1056, yy + 160 + hei, 1); draw_set_color(c_gray); draw_set_font(fnt_40k_14b); @@ -349,23 +349,23 @@ function scr_ui_settings() { y5 += spacing; if (gg == 0) { title = "Main Weapon: "; - geh = obj_ini.wep1[co, ide]; + geh = obj_ini.wep1[co][ide]; } if (gg == 1) { title = "Secondary Weapon: "; - geh = obj_ini.wep2[co, ide]; + geh = obj_ini.wep2[co][ide]; } if (gg == 2) { title = "Armour: "; - geh = obj_ini.armour[co, ide]; + geh = obj_ini.armour[co][ide]; } if (gg == 3) { title = "Special Item: "; - geh = obj_ini.gear[co, ide]; + geh = obj_ini.gear[co][ide]; } if (gg == 4) { title = "Mobility Item: "; - geh = obj_ini.mobi[co, ide]; + geh = obj_ini.mobi[co][ide]; } draw_set_halign(fa_right); @@ -380,8 +380,8 @@ function scr_ui_settings() { draw_rectangle(x5, y5, x5 - string_width(title), y5 + string_height(title) - 2, 0); var nep = false; - - if (((obj_ini.armour[co, ide] == "Terminator Armour") || (obj_ini.armour[co, ide] == "Dreadnought")) && (gg == 3)) { + + if (((obj_ini.armour[co][ide] == "Terminator Armour") || (obj_ini.armour[co][ide] == "Dreadnought")) && (gg == 3)) { nep = true; } if ((ide == 6) && ((gg == 2) || (gg == 4))) { @@ -905,21 +905,21 @@ function scr_ui_settings() { } draw_set_alpha(1); - if (obj_ini.race[100, ide] != 0) { + if (obj_ini.race[100][ide] != 0) { // Creates mass_equip here // if (custom!=eCHAPTER_TYPE.CUSTOM) then draw_set_alpha(0.5); yyy += 31; draw_set_color(c_gray); draw_rectangle(xxx, yyy, xxx + 289, yyy + 20, 0); draw_set_color(0); - draw_text(xxx, yyy, obj_ini.role[100, ide]); + draw_text(xxx, yyy, obj_ini.role[100][ide]); if (scr_hit(xxx, yyy, xxx + 289, yyy + 20) == true) { /*if (custom==eCHAPTER_TYPE.CUSTOM) then draw_set_alpha(0.2);if (custom!=eCHAPTER_TYPE.CUSTOM) then */ draw_set_alpha(0.1); draw_set_color(c_white); draw_rectangle(xxx, yyy, xxx + 289, yyy + 20, 0); draw_set_alpha(1); - tool1 = string(obj_ini.role[100, ide]) + " Settings"; + tool1 = string(obj_ini.role[100][ide]) + " Settings"; tool2 = "Click to open the settings for this unit."; if (scr_click_left()) { settings = ide; From b0c28da241dd00a114330257bf06f14204bf0710 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sun, 28 Dec 2025 14:05:56 -0500 Subject: [PATCH 40/45] fixed a bunch of logic bugs, and improved readability of some sections. --- ...compatibility_report_040421_2234143414.txt | 93 -------- objects/obj_credits/Draw_0.gml | 93 ++++---- objects/obj_credits/Step_0.gml | 6 +- objects/obj_ini/Create_0.gml | 215 ++++++++++-------- objects/obj_ncombat/Alarm_2.gml | 10 +- objects/obj_ncombat/Alarm_3.gml | 190 ++++++++-------- objects/obj_ncombat/Alarm_6.gml | 6 +- objects/obj_ncombat/Alarm_8.gml | 24 +- objects/obj_ncombat/Create_0.gml | 12 +- objects/obj_ncombat/KeyPress_13.gml | 29 ++- objects/obj_ncombat/KeyPress_67.gml | 4 +- objects/obj_ncombat/Step_0.gml | 10 +- 12 files changed, 301 insertions(+), 391 deletions(-) diff --git a/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt b/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt index e4a9a84b0a..70a3636fb9 100644 --- a/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt +++ b/notes/compatibility_report_040421_2234143414/compatibility_report_040421_2234143414.txt @@ -410,73 +410,6 @@ ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\Chap ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\objects\obj_temp_build\Create_0.gml - 9: unexpected terminal operator new Too many errors - GML not processed : ${project_dir}\objects\obj_temp_build\Create_0.gml -Converting GML script: ${project_dir}\objects\obj_credits\Draw_0.gml -Converted string - line 63: '_blank' -> "_blank" - -Converting GML script: ${project_dir}\objects\obj_cuicons\Destroy_0.gml -Converted string - line 7: "\icons\custom" -> "\\icons\\custom" - -Converting GML script: ${project_dir}\objects\obj_cuicons\Alarm_2.gml -Converted string - line 5: "\icons\custom" -> "\\icons\\custom" -Converted string - line 18: "\icons\custom" -> "\\icons\\custom" -Converted string - line 19: "\icons\custom" -> "\\icons\\custom" - -Converting GML script: ${project_dir}\objects\obj_cuicons\Alarm_1.gml -Converted string - line 11: "\icons\custom" -> "\\icons\\custom" -Converted string - line 22: "\icons\custom" -> "\\icons\\custom" -Converted string - line 24: "\icons\custom" -> "\\icons\\custom" -Converted string - line 33: "\icons\custom" -> "\\icons\\custom" - -Converting GML script: ${project_dir}\objects\obj_cuicons\Alarm_0.gml -Converted string - line 6: "\icons\custom" -> "\\icons\\custom" - -Converting GML script: ${project_dir}\objects\obj_controller\Alarm_1.gml -Converted builtin - line 268: instance_id -> instance_id_get( 0 ) - -Converting GML script: ${project_dir}\objects\obj_saveload\Create_0.gml -Converted string - line 99: "\screen" -> "\\screen" -Converted string - line 99: "\screen" -> "\\screen" -Converted string - line 100: "\screen" -> "\\screen" -Converted string - line 100: "\screen" -> "\\screen" -Converted string - line 101: "\screen" -> "\\screen" -Converted string - line 101: "\screen" -> "\\screen" -Converted string - line 102: "\screen" -> "\\screen" -Converted string - line 102: "\screen" -> "\\screen" - -Converting GML script: ${project_dir}\objects\obj_saveload\Alarm_4.gml -Converted string - line 7: "\screen" -> "\\screen" -Converted string - line 7: "\screen" -> "\\screen" -Converted string - line 8: "\screen" -> "\\screen" -Converted string - line 8: "\screen" -> "\\screen" -Converted string - line 9: "\screen" -> "\\screen" -Converted string - line 9: "\screen" -> "\\screen" -Converted string - line 10: "\screen" -> "\\screen" -Converted string - line 10: "\screen" -> "\\screen" - -Converting GML script: ${project_dir}\objects\obj_saveload\Mouse_61.gml -Converted string - line 12: "\screen" -> "\\screen" -Converted string - line 12: "\screen" -> "\\screen" -Converted string - line 13: "\screen" -> "\\screen" -Converted string - line 13: "\screen" -> "\\screen" -Converted string - line 14: "\screen" -> "\\screen" -Converted string - line 14: "\screen" -> "\\screen" -Converted string - line 15: "\screen" -> "\\screen" -Converted string - line 15: "\screen" -> "\\screen" - -Converting GML script: ${project_dir}\objects\obj_saveload\Mouse_60.gml -Converted string - line 9: "\screen" -> "\\screen" -Converted string - line 9: "\screen" -> "\\screen" -Converted string - line 10: "\screen" -> "\\screen" -Converted string - line 10: "\screen" -> "\\screen" -Converted string - line 11: "\screen" -> "\\screen" -Converted string - line 11: "\screen" -> "\\screen" -Converted string - line 12: "\screen" -> "\\screen" -Converted string - line 12: "\screen" -> "\\screen" - -Converting GML script: ${project_dir}\objects\obj_en_fleet\Alarm_4.gml -Removing instance reference from builtin - line 7 : self. -Converted builtin - line 7: instance_id -> instance_id_get( 0 ) - Converting GML script: ${project_dir}\objects\obj_en_fleet\Alarm_1.gml ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\objects\obj_en_fleet\Alarm_1.gml - 908: unexpected syntax error ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\objects\obj_en_fleet\Alarm_1.gml - 908: unexpected terminal operator new @@ -548,33 +481,7 @@ ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\Chap ERROR: C:\Users\Sinthorion\AppData\Local\GameMakerStudio2\GMS2TEMP\conv\gmx\ChapterMaster_7ABEC6D2\objects\obj_en_fleet\Alarm_1.gml - 2231: unexpected syntax error Too many errors - GML not processed : ${project_dir}\objects\obj_en_fleet\Alarm_1.gml -Converting GML script: ${project_dir}\objects\obj_popup\Step_0.gml -Converted string - line 8: '1' -> "1" -Converted string - line 9: '2' -> "2" -Converted string - line 10: '3' -> "3" - -Converting GML script: ${project_dir}\objects\obj_star\Alarm_4.gml -Converted builtin - line 33: instance_id -> instance_id_get( 0 ) -Windows NSIS Installer Script has been set to default due to changes in GameMaker Studio 2 -Missing audiogroup for sound: 'snd_blood' - setting to default audio group -Missing audiogroup for sound: 'snd_diboz' - setting to default audio group -Missing audiogroup for sound: 'snd_legal' - setting to default audio group -Missing audiogroup for sound: 'snd_prologue' - setting to default audio group -Missing audiogroup for sound: 'snd_royal' - setting to default audio group -Missing audiogroup for sound: 'snd_vode' - setting to default audio group -Missing audiogroup for sound: 'snd_battle' - setting to default audio group -Missing audiogroup for sound: 'snd_postbattle' - setting to default audio group -Missing audiogroup for sound: 'snd_defeat' - setting to default audio group -Missing audiogroup for sound: 'snd_buzz' - setting to default audio group -Missing audiogroup for sound: 'snd_redownload' - setting to default audio group -Missing audiogroup for sound: 'snd_click' - setting to default audio group -Missing audiogroup for sound: 'snd_click_small' - setting to default audio group -Missing audiogroup for sound: 'snd_end_turn' - setting to default audio group -Missing audiogroup for sound: 'snd_error' - setting to default audio group -Missing audiogroup for sound: 'snd_stc' - setting to default audio group -Missing audiogroup for sound: 'snd_identify' - setting to default audio group -Game speed set to 30 Added compatibility script 'action/action_another_room.gml' Added compatibility script 'action/action_color.gml' Added compatibility script 'action/action_draw_ellipse.gml' diff --git a/objects/obj_credits/Draw_0.gml b/objects/obj_credits/Draw_0.gml index 0e445fff93..3d92d83dc8 100644 --- a/objects/obj_credits/Draw_0.gml +++ b/objects/obj_credits/Draw_0.gml @@ -1,91 +1,90 @@ - draw_set_color(0); -draw_rectangle(918,102,1110,610,0); -draw_sprite(spr_credits_bg,0,0,0); +draw_rectangle(918, 102, 1110, 610, 0); +draw_sprite(spr_credits_bg, 0, 0, 0); draw_set_font(fnt_cul_18); draw_set_halign(fa_center); draw_set_color(c_gray); -draw_text_transformed(172,373,string_hash_to_newline("LEAD PROGRAMMERS"),0.85,0.85,0); +draw_text_transformed(172, 373, string_hash_to_newline("LEAD PROGRAMMERS"), 0.85, 0.85, 0); draw_set_font(fnt_cul_14); -draw_text(172,397,string_hash_to_newline("ZAB#Mystic#NelsonH#EttyKitty")); +draw_text(172, 397, string_hash_to_newline("ZAB#Mystic#NelsonH#EttyKitty")); draw_set_font(fnt_cul_18); -draw_text_transformed(172,472,string_hash_to_newline("CONTRIBUTORS&#SPECIAL THANKS"),0.85,0.85,0); +draw_text_transformed(172, 472, string_hash_to_newline("CONTRIBUTORS&#SPECIAL THANKS"), 0.85, 0.85, 0); -draw_text(172,526,string_hash_to_newline("vbcoder, Batat#Xorcon#IRC AFK'ers#/TG/")); +draw_text(172, 526, string_hash_to_newline("vbcoder, Batat#Xorcon#IRC AFK'ers#/TG/")); -draw_text_transformed(492-100,373,string_hash_to_newline("LEAD WRITERS"),0.85,0.85,0); +draw_text_transformed(492 - 100, 373, string_hash_to_newline("LEAD WRITERS"), 0.85, 0.85, 0); -draw_text(492-100,397,string_hash_to_newline("Neddy#Nenjin#Pilz")); +draw_text(492 - 100, 397, string_hash_to_newline("Neddy#Nenjin#Pilz")); -draw_text_transformed(492-100,472,string_hash_to_newline("ASSISTANT WRITERS"),0.85,0.85,0); +draw_text_transformed(492 - 100, 472, string_hash_to_newline("ASSISTANT WRITERS"), 0.85, 0.85, 0); -draw_text(492-100,498,string_hash_to_newline("Earthflame#Bludhawk#UCO Agent")); +draw_text(492 - 100, 498, string_hash_to_newline("Earthflame#Bludhawk#UCO Agent")); -draw_text_transformed(802-200,373,string_hash_to_newline("LEAD ARTISTS"),0.85,0.85,0); +draw_text_transformed(802 - 200, 373, string_hash_to_newline("LEAD ARTISTS"), 0.85, 0.85, 0); -draw_text(802-200,397,string_hash_to_newline("Duke")); +draw_text(802 - 200, 397, string_hash_to_newline("Duke")); -draw_text_transformed(802-200,472,string_hash_to_newline("ASSISTANT ARTISTS"),0.85,0.85,0); +draw_text_transformed(802 - 200, 472, string_hash_to_newline("ASSISTANT ARTISTS"), 0.85, 0.85, 0); -draw_text(802-200,498,string_hash_to_newline("sinndogg#efngn#Toni ''TrashMan'' Stanicic")); +draw_text(802 - 200, 498, string_hash_to_newline("sinndogg#efngn#Toni ''TrashMan'' Stanicic")); -draw_text_transformed(802,373,string_hash_to_newline("SUPPORTERS AND LEGACY CODERS"),0.85,0.85,0); +draw_text_transformed(802, 373, string_hash_to_newline("SUPPORTERS AND LEGACY CODERS"), 0.85, 0.85, 0); // draw_text_transformed(802,472,"FORMER SUPPORTERS",0.85,0.85,0); -draw_text(802,397,string_hash_to_newline("Duke#Paul-Ross#MANDOZERTHEGREAT#Alex Norry#Carli")); +draw_text(802, 397, string_hash_to_newline("Duke#Paul-Ross#MANDOZERTHEGREAT#Alex Norry#Carli")); // draw_text(802,496,""); - - - - draw_set_font(fnt_cul_18); draw_set_halign(fa_center); -draw_text_ext(room_width/2,706-25,string_hash_to_newline(obj_main_menu.legal_text),-1,1406); +draw_text_ext(room_width / 2, 706 - 25, string_hash_to_newline(obj_main_menu.legal_text), -1, 1406); -draw_set_font(fnt_cul_14);draw_set_halign(fa_left); -draw_text_ext(991,92+15,string_hash_to_newline(@" Late 2011 /tg/ came up with the idea of Chapter Master- a Space Marine Chapter simulation game, set in the grim darkness of the 40k universe. One good attempt was made to create it, and accomplished some very cool framework, but never progressed beyond a demo. +draw_set_font(fnt_cul_14); +draw_set_halign(fa_left); +draw_text_ext(991, 92 + 15, string_hash_to_newline(@" Late 2011 /tg/ came up with the idea of Chapter Master- a Space Marine Chapter simulation game, set in the grim darkness of the 40k universe. One good attempt was made to create it, and accomplished some very cool framework, but never progressed beyond a demo. Starting over with a simpler programming language, this version is an almost one-man project, meant to bring what the discussions and threads always imagined. It's been a year of keyboard face-rolling, but the amused reactions of neckbeards have been all worth it. Hopefully you have as much fun playing Chapter Master as I did making it. --Duke"),-1,570); +-Duke"), -1, 570); // 253,96 - -var bhih;bhih=0; -if (scr_hit(319,307,393,324)=false) and (obj_main_menu.browser=1) then obj_main_menu.browser=0; -if (scr_hit(319,307,393,324)=true){ - bhih=1; - if (obj_main_menu.browser=0) and (scr_click_left()){ +var bhih; +bhih = 0; +if ((scr_hit(319, 307, 393, 324) == false) && (obj_main_menu.browser == 1)) { + obj_main_menu.browser = 0; +} +if (scr_hit(319, 307, 393, 324) == true) { + bhih = 1; + if ((obj_main_menu.browser == 0) && scr_click_left()) { /*switch(show_question("Open your browser?")) { case 1:*/ - // url_open_ext( 'http://planetofthebrandons.com/donate.html', '_blank');browser=1; - if (obj_main_menu.blog_url!="Error") then url_open_ext(obj_main_menu.blog_url, "_blank");obj_main_menu.browser=1; + // url_open_ext( "http://planetofthebrandons.com/donate.html", "_blank");browser=1; + if (obj_main_menu.blog_url != "Error") { + url_open_ext(obj_main_menu.blog_url, "_blank"); + } + obj_main_menu.browser = 1; // break; // } } } -draw_text(257,96,string_hash_to_newline("DukeFluffy")); -draw_text_ext_transformed(257,96,string_hash_to_newline("#A hobbyist game producer with insomnia and way too much time on his hands. Duke has created several pen and paper RPG's, namely ChromeStrike and the Morrowind RPG. He has aspirations of one day working on robots."),-1,208*1.1,0.9,0.9,0); -draw_sprite(spr_blog,bhih,319,307); - - - -if (fade_in>0){ - draw_set_color(0);draw_set_alpha(fade_in/40); - draw_rectangle(0,0,room_width,room_height,0); +draw_text(257, 96, string_hash_to_newline("DukeFluffy")); +draw_text_ext_transformed(257, 96, string_hash_to_newline("#A hobbyist game producer with insomnia and way too much time on his hands. Duke has created several pen and paper RPG's, namely ChromeStrike and the Morrowind RPG. He has aspirations of one day working on robots."), -1, 208 * 1.1, 0.9, 0.9, 0); +draw_sprite(spr_blog, bhih, 319, 307); + +if (fade_in > 0) { + draw_set_color(0); + draw_set_alpha(fade_in / 40); + draw_rectangle(0, 0, room_width, room_height, 0); draw_set_alpha(1); } - -if (instance_exists(obj_main_menu_buttons)){ - if (obj_main_menu_buttons.fade>0){ +if (instance_exists(obj_main_menu_buttons)) { + if (obj_main_menu_buttons.fade > 0) { draw_set_color(0); - draw_set_alpha(obj_main_menu_buttons.fade/40); - draw_rectangle(0,0,room_width,room_height,0); + draw_set_alpha(obj_main_menu_buttons.fade / 40); + draw_rectangle(0, 0, room_width, room_height, 0); } draw_set_alpha(1); } diff --git a/objects/obj_credits/Step_0.gml b/objects/obj_credits/Step_0.gml index c3bf0f8ff1..052d361d8e 100644 --- a/objects/obj_credits/Step_0.gml +++ b/objects/obj_credits/Step_0.gml @@ -1,3 +1,3 @@ - -if (fade_in>0) then fade_in-=1; - +if (fade_in > 0) { + fade_in -= 1; +} diff --git a/objects/obj_ini/Create_0.gml b/objects/obj_ini/Create_0.gml index b075fbcac3..c12640fd17 100644 --- a/objects/obj_ini/Create_0.gml +++ b/objects/obj_ini/Create_0.gml @@ -3,29 +3,42 @@ show_debug_message("Creating obj_ini"); // // normal stuff -specials=0;firsts=0;seconds=0;thirds=0;fourths=0;fifths=0; -sixths=0;sevenths=0;eighths=0;ninths=0;tenths=0;commands=0; - -heh1=0;heh2=0; +specials = 0; +firsts = 0; +seconds = 0; +thirds = 0; +fourths = 0; +fifths = 0; +sixths = 0; +sevenths = 0; +eighths = 0; +ninths = 0; +tenths = 0; +commands = 0; + +heh1 = 0; +heh2 = 0; // strin=""; // strin2=""; -companies=10; -progenitor=ePROGENITOR.NONE; +companies = 10; +progenitor = ePROGENITOR.NONE; aspirant_trial = 0; -obj_ini.custom_advisors = {}; +obj_ini.custom_advisors = {}; //default sector name to prevent potential crash sector_name = "Terra Nova"; //default -load_to_ships=[2,0,0]; -if (instance_exists(obj_creation)){load_to_ships=obj_creation.load_to_ships;} - -penitent=0; -penitent_max=0; -penitent_current=0; -penitent_end=0; -man_size=0; +load_to_ships = [2, 0, 0]; +if (instance_exists(obj_creation)) { + load_to_ships = obj_creation.load_to_ships; +} + +penitent = 0; +penitent_max = 0; +penitent_current = 0; +penitent_end = 0; +man_size = 0; home_planet = 2; artifact_struct = array_create(200); @@ -49,27 +62,29 @@ for (var i = 0; i < _artifact_array_size; i++) { init_player_fleet_arrays(); ship_id = []; -var v; -var company=-1; -repeat(11){ - company+=1;v=-1;// show_message("v company: "+string(company)); - repeat(205){v+=1;// show_message(string(company)+"."+string(v)); - last_ship[company,v] = {uid : "", name : ""}; - veh_race[company,v]=0; - veh_loc[company,v]=""; - veh_name[company,v]=""; - veh_role[company,v]=""; - veh_wep1[company,v]=""; - veh_wep2[company,v]=""; - veh_wep3[company,v]=""; - veh_upgrade[company,v]=""; - veh_acc[company,v]=""; - veh_hp[company,v]=100; - veh_chaos[company,v]=0; - veh_pilots[company,v]=0; - veh_lid[company,v]=-1; - veh_wid[company,v]=2; - veh_uid[company,v]=0; +for (var company = 0; company <= 10; company++) { + // show_message("v company: "+string(company)); + for (var vehicle_index = 0; vehicle_index <= 204; vehicle_index++) { + // show_message(string(company)+"."+string(vehicle_index)); + last_ship[company][vehicle_index] = { + uid: "", + name: "", + }; + veh_race[company][vehicle_index] = 0; + veh_loc[company][vehicle_index] = ""; + veh_name[company][vehicle_index] = ""; + veh_role[company][vehicle_index] = ""; + veh_wep1[company][vehicle_index] = ""; + veh_wep2[company][vehicle_index] = ""; + veh_wep3[company][vehicle_index] = ""; + veh_upgrade[company][vehicle_index] = ""; + veh_acc[company][vehicle_index] = ""; + veh_hp[company][vehicle_index] = 100; + veh_chaos[company][vehicle_index] = 0; + veh_pilots[company][vehicle_index] = 0; + veh_lid[company][vehicle_index] = -1; + veh_wid[company][vehicle_index] = 2; + veh_uid[company][vehicle_index] = 0; } } @@ -80,58 +95,60 @@ repeat(11){ obj_controller.penitent_current=300; }*/ -check_number=0; -year_fraction=0; -year=0; -millenium=0; +check_number = 0; +year_fraction = 0; +year = 0; +millenium = 0; company_spawn_buffs = []; -role_spawn_buffs ={}; +role_spawn_buffs = {}; previous_forge_masters = []; recruit_trial = 0; -recruiting_type="Death"; +recruiting_type = "Death"; gene_slaves = []; adv = []; dis = []; +if (instance_exists(obj_creation)) { + custom = obj_creation.custom; +} -if (instance_exists(obj_creation)) then custom=obj_creation.custom; - -if (global.load==-1) then scr_initialize_custom(); +if (global.load == -1) { + scr_initialize_custom(); +} -#region save/load serialization +#region save/load serialization -/// Called from save function to take all object variables and convert them to a json savable format and return it -serialize = function(){ +/// Called from save function to take all object variables and convert them to a json savable format and return it +serialize = function() { var object_ini = self; - + var marines = array_create(0); - for(var coy = 0; coy <=10; coy++){ - for(var mar = 0; mar <=500; mar++){ + for (var coy = 0; coy <= 10; coy++) { + for (var mar = 0; mar <= 500; mar++) { var marine_json; - if(obj_ini.name[coy][mar] != ""){ + if (obj_ini.name[coy][mar] != "") { marine_json = jsonify_marine_struct(coy, mar, false); array_push(marines, marine_json); - } else if(mar > 0){ + } else if (mar > 0) { break; } } } var squads = []; - if (array_length(object_ini.squads)> 0){ - for (var i = 0;i < array_length(object_ini.squads);i++){ + if (array_length(object_ini.squads) > 0) { + for (var i = 0; i < array_length(object_ini.squads); i++) { array_push(squads, object_ini.squads[i].jsonify(false)); } } var artifact_struct_trimmed = []; - for(var i = 0; i < array_length(artifact_struct); i++){ - if(artifact_struct[i].name != ""){ + for (var i = 0; i < array_length(artifact_struct); i++) { + if (artifact_struct[i].name != "") { array_push(artifact_struct_trimmed, artifact_struct[i]); } } - var save_data = { obj: object_get_name(object_index), @@ -139,7 +156,7 @@ serialize = function(){ y, custom_advisors, full_liveries: full_liveries, - company_liveries : company_liveries, + company_liveries: company_liveries, complex_livery_data: complex_livery_data, squad_types: squad_types, artifact_struct: artifact_struct_trimmed, @@ -148,103 +165,106 @@ serialize = function(){ equipment: equipment, gene_slaves: gene_slaves // marines, - // squads - } + , // squads + }; - if(struct_exists(object_ini, "last_ship")){ + if (struct_exists(object_ini, "last_ship")) { save_data.last_ship = object_ini.last_ship; } - + var excluded_from_save = ["temp", "serialize", "deserialize", "load_default_gear", "role_spawn_buffs", "TTRPG", "squads", "squad_types", "marines", "last_ship"]; copy_serializable_fields(object_ini, save_data, excluded_from_save); return save_data; -} +}; -deserialize = function(save_data){ - var exclusions = ["complex_livery_data", "full_liveries","company_liveries", "squad_types", "marine_structs", "squad_structs"]; // skip automatic setting of certain vars, handle explicitly later +deserialize = function(save_data) { + var exclusions = ["complex_livery_data", "full_liveries", "company_liveries", "squad_types", "marine_structs", "squad_structs"]; // skip automatic setting of certain vars, handle explicitly later // Automatic var setting var all_names = struct_get_names(save_data); var _len = array_length(all_names); - for(var i = 0; i < _len; i++){ + for (var i = 0; i < _len; i++) { var var_name = all_names[i]; - if(array_contains(exclusions, var_name)){ + if (array_contains(exclusions, var_name)) { continue; } - + var loaded_value = struct_get(save_data, var_name); // show_debug_message($"obj_ini var: {var_name} - val: {loaded_value}"); try { - variable_struct_set(obj_ini, var_name, loaded_value); - } catch (e){ + variable_struct_set(obj_ini, var_name, loaded_value); + } catch (e) { show_debug_message(e); } } // Set explicit vars here - var livery_picker = new ColourItem(0,0); + var livery_picker = new ColourItem(0, 0); livery_picker.scr_unit_draw_data(); - if(struct_exists(save_data, "full_liveries")){ - variable_struct_set(obj_ini, "full_liveries", save_data.full_liveries) + if (struct_exists(save_data, "full_liveries")) { + variable_struct_set(obj_ini, "full_liveries", save_data.full_liveries); } else { - variable_struct_set(obj_ini, "full_liveries", array_create(21,variable_clone(livery_picker.map_colour))); + variable_struct_set(obj_ini, "full_liveries", array_create(21, variable_clone(livery_picker.map_colour))); } livery_picker.scr_unit_draw_data(-1); - if(struct_exists(save_data, "company_liveries")){ - variable_struct_set(obj_ini, "company_liveries", save_data.company_liveries) + if (struct_exists(save_data, "company_liveries")) { + variable_struct_set(obj_ini, "company_liveries", save_data.company_liveries); } else { - variable_struct_set(obj_ini, "company_liveries", array_create(11,variable_clone(livery_picker.map_colour))); + variable_struct_set(obj_ini, "company_liveries", array_create(11, variable_clone(livery_picker.map_colour))); } livery_picker.scr_unit_draw_data(); - if(struct_exists(save_data, "complex_livery_data")){ + if (struct_exists(save_data, "complex_livery_data")) { variable_struct_set(obj_ini, "complex_livery_data", save_data.complex_livery_data); } - if(struct_exists(save_data, "squad_types")){ + if (struct_exists(save_data, "squad_types")) { variable_struct_set(obj_ini, "squad_types", save_data.squad_types); } - if(struct_exists(save_data, "marine_structs")){ + if (struct_exists(save_data, "marine_structs")) { obj_ini.TTRPG = array_create(11, []); var marines_encoded_arr = save_data.marine_structs; var _m_ar_len = array_length(marines_encoded_arr); - for(var m = 0; m < _m_ar_len; m++){ - var marine_json = marines_encoded_arr[m]; - var coy = marine_json.company; - var mar = marine_json.marine_number; - load_marine_struct(coy, mar, marine_json); + for (var m = 0; m < _m_ar_len; m++) { + var marine_json = marines_encoded_arr[m]; + var coy = marine_json.company; + var mar = marine_json.marine_number; + load_marine_struct(coy, mar, marine_json); } - for(var coy = 0; coy < 11; coy++){ + for (var coy = 0; coy < 11; coy++) { var mar_start = array_length(obj_ini.TTRPG[coy]); - for(var mar = mar_start; mar < 501; mar++){ - obj_ini.TTRPG[coy][mar] = new TTRPG_stats("chapter",coy, mar, "blank"); + for (var mar = mar_start; mar < 501; mar++) { + obj_ini.TTRPG[coy][mar] = new TTRPG_stats("chapter", coy, mar, "blank"); } } } - if(struct_exists(save_data, "squad_structs")){ + if (struct_exists(save_data, "squad_structs")) { obj_ini.squads = []; var squad_fetch = save_data.squad_structs; - for (i=0;i 0) && (ally_forces > 0)) { if (ally == 3) { if (ally_forces >= 1) { @@ -15,9 +18,6 @@ if ((ally > 0) && (ally_forces > 0)) { ii = 0; good = 0; - //TODO refactor so that unit structs are created for ally forces - - /* if (instance_exists(thata)){ ii=array_length(marine_type); @@ -57,9 +57,9 @@ if ((ally > 0) && (ally_forces > 0)) { repeat(50){if (good=0){ii+=1;if (thata.dudes[ii]="") and (thata.dudes_num[ii]=0) then good=ii;}} if (good>0){thata.dudes[ii]="Skitarii";thata.dudes_num[ii]=20;thata.dudes_vehicle[ii]=0;} thata.alarm[1]=1; - }*/ + } } } -} +}*/ instance_activate_object(obj_enunit); diff --git a/objects/obj_ncombat/Alarm_3.gml b/objects/obj_ncombat/Alarm_3.gml index e50d0f7ac1..6541d8e3ea 100644 --- a/objects/obj_ncombat/Alarm_3.gml +++ b/objects/obj_ncombat/Alarm_3.gml @@ -7,96 +7,88 @@ if (wall_destroyed == 1) { wall_destroyed = 0; } -var i, good, changed; -i = 0; -good = 0; -changed = 0; - -// if (messages_to_show = 24) and (messages_shown=0) then alarm[6]=75; -// if (messages_shown=105) then exit; - -/*i+=1;if (message[i]!="") then show_message(message[i]); -i+=1;if (message[i]!="") then show_message(message[i]); -i+=1;if (message[i]!="") then show_message(message[i]); -i+=1;if (message[i]!="") then show_message(message[i]); -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; - - repeat (55) { - i += 1; - - // Collide the messages if needed - if ((message[i] == "") && (message[i + 1] != "")) { - message[i] = message[i + 1]; - message_sz[i] = message_sz[i + 1]; - message_priority[i] = message_priority[i + 1]; - - message[i + 1] = ""; - message_sz[i + 1] = 0; - message_priority[i + 1] = 0; - changed = 1; - } - - // Move larger messages up - if ((message[i] != "") && (message[i + 1] != "") && (message_sz[i] < message_sz[i + 1]) && ((message_priority[i] < message_priority[i + 1]) || (message_priority[i] == 0))) { - message[100] = message[i]; - message_sz[100] = message_sz[i]; - message_priority[100] = message_priority[i]; - - message[i] = message[i + 1]; - message_sz[i] = message_sz[i + 1]; - message_priority[i] = message_priority[i + 1]; - - message[i + 1] = message[100]; - message_sz[i + 1] = message_sz[100]; - message_priority[i + 1] = message_priority[100]; - changed = 1; - } - - // Move messages with higher priority up - if ((message[i] != "") && (message[i + 1] != "") && (message_priority[i] < message_priority[i + 1])) { - message[100] = message[i]; - message_sz[100] = message_sz[i]; - message_priority[100] = message_priority[i]; - - message[i] = message[i + 1]; - message_sz[i] = message_sz[i + 1]; - message_priority[i] = message_priority[i + 1]; - - message[i + 1] = message[100]; - message_sz[i + 1] = message_sz[100]; - message_priority[i + 1] = message_priority[100]; - changed = 1; - } - - if (changed == 0) { - good = 1; - } +// if (combat_messages_to_show = 24) and (combat_messages_shown=0) then alarm[6]=75; +// if (combat_messages_shown=105) then exit; + +/*i+=1;if (combat_messages[i]!="") then show_message(combat_messages[i]); +i+=1;if (combat_messages[i]!="") then show_message(combat_messages[i]); +i+=1;if (combat_messages[i]!="") then show_message(combat_messages[i]); +i+=1;if (combat_messages[i]!="") then show_message(combat_messages[i]); +i+=1;if (combat_messages[i]!="") then show_message(combat_messages[i]); +i+=1;if (combat_messages[i]!="") then show_message(combat_messages[i]);*/ + +var messages_ordered = false; + +while (messages_ordered == false) { + var message_order_changed = false; + for (var i = 0; i < 55; i++) { + // Collide the messages if needed + if ((combat_messages[i] == "") && (combat_messages[i + 1] != "")) { + combat_messages[i] = combat_messages[i + 1]; + combat_message_sz[i] = combat_message_sz[i + 1]; + combat_message_priority[i] = combat_message_priority[i + 1]; + + combat_messages[i + 1] = ""; + combat_message_sz[i + 1] = 0; + combat_message_priority[i + 1] = 0; + message_order_changed = true; + } + + // Move larger messages up + if ((combat_messages[i] != "") && (combat_messages[i + 1] != "") && (combat_message_sz[i] < combat_message_sz[i + 1]) && ((combat_message_priority[i] < combat_message_priority[i + 1]) || (combat_message_priority[i] == 0))) { + combat_messages[100] = combat_messages[i]; + combat_message_sz[100] = combat_message_sz[i]; + combat_message_priority[100] = combat_message_priority[i]; + + combat_messages[i] = combat_messages[i + 1]; + combat_message_sz[i] = combat_message_sz[i + 1]; + combat_message_priority[i] = combat_message_priority[i + 1]; + + combat_messages[i + 1] = combat_messages[100]; + combat_message_sz[i + 1] = combat_message_sz[100]; + combat_message_priority[i + 1] = combat_message_priority[100]; + message_order_changed = true; + } + + // Move messages with higher priority up + if ((combat_messages[i] != "") && (combat_messages[i + 1] != "") && (combat_message_priority[i] < combat_message_priority[i + 1])) { + combat_messages[100] = combat_messages[i]; + combat_message_sz[100] = combat_message_sz[i]; + combat_message_priority[100] = combat_message_priority[i]; + + combat_messages[i] = combat_messages[i + 1]; + combat_message_sz[i] = combat_message_sz[i + 1]; + combat_message_priority[i] = combat_message_priority[i + 1]; + + combat_messages[i + 1] = combat_messages[100]; + combat_message_sz[i + 1] = combat_message_sz[100]; + combat_message_priority[i + 1] = combat_message_priority[100]; + message_order_changed = true; } } + + if (message_order_changed == false) { + messages_ordered = true; + } } -if (((messages > 0) && (messages_shown < 24)) && (messages_shown <= 100)) { - var that_sz, that; // show_message("Largest Message"); - that_sz = 0; - that = 0; +if ((array_length(combat_messages > 0) && (combat_messages_shown < 24)) && (combat_messages_shown <= 100)) { + // If the left side demands that messages_shown is less than 24, then the right side of the messages_shown being less than 100 will always be true. ??? + // show_message("Largest Message"); + var largest_message_sz = 0; + var largest_message_index = 0; - i = 0; - repeat (60) { - i += 1; - if ((message[i] != "") && (message_sz[i] > that_sz)) { - that_sz = message_sz[i]; - that = i; + for (var i = 0; i < 60; i++) { + //I don't know why the magic number is 60, but this would be much better as a for loop than a repeat + if ((combat_messages[i] != "") && (combat_message_sz[i] > largest_message_sz)) { + largest_message_sz = combat_message_sz[i]; + largest_message_index = i; } } - if ((that != 0) && (that_sz > 0)) { - newline = message[that]; - if (message_priority[that] > 0) { + + if ((largest_message_index != 0) && (largest_message_sz > 0)) { + newline = combat_messages[largest_message_index]; + if (combat_message_priority[largest_message_index] > 0) { newline_color = "bright"; } if (string_count("lost", newline) > 0) { @@ -107,34 +99,30 @@ if (((messages > 0) && (messages_shown < 24)) && (messages_shown <= 100)) { newline_color = "white"; } - if (message_priority[that] == 134) { + if (combat_(message_priority[largest_message_index] == 134)) { newline_color = "purple"; } - if (message_priority[that] == 135) { + if (combat_message_priority[largest_message_index] == 135) { newline_color = "blue"; } - if (message_priority[that] == 137) { + if (combat_message_priority[largest_message_index] == 137) { newline_color = "red"; } scr_newtext(); - messages_shown += 1; + combat_messages_shown += 1; largest += 1; - message[that] = ""; - message_sz[that] = 0; - message_priority[that] = 0; - messages -= 1; + combat_messages[largest_message_index] = ""; + combat_message_sz[largest_message_index] = 0; + combat_message_priority[largest_message_index] = 0; + array_delete(combat_messages, largest_message_index, 1); } alarm[3] = 2; } -if ((messages == 0) || (messages_shown >= 24)) { - messages_shown = 999; -} - -if (messages == 0) { - messages_shown = 999; +if ((array_length(combat_messages) == 0) || (combat_messages_shown >= 24)) { + combat_messages_shown = 999; } /*var noloss;noloss=instance_nearest(50,300,obj_pnunit); @@ -152,7 +140,7 @@ if (!instance_exists(obj_pnunit)) { player_forces = 0; } -if (((messages_shown == 999) || (messages == 0)) && (timer_stage == 2)) { +if (((combat_messages_shown == 999) || (array_length(combat_messages) == 0)) && (timer_stage == 2)) { newline_color = "yellow"; if (obj_ncombat.enemy != 6) { if ((enemy_forces > 0) && (obj_ncombat.enemy != 30)) { @@ -203,14 +191,14 @@ if (((messages_shown == 999) || (messages == 0)) && (timer_stage == 2)) { instance_activate_object(obj_pnunit); } } - messages_shown = 105; + combat_messages_shown = 105; done = 1; scr_newtext(); timer_stage = 3; exit; } -if (((messages_shown == 999) || (messages == 0)) && ((timer_stage == 4) || (timer_stage == 5)) && (four_show == 0)) { +if (((combat_messages_shown == 999) || (array_length(combat_messages) == 0)) && ((timer_stage == 4) || (timer_stage == 5)) && (four_show == 0)) { newline_color = "yellow"; if (obj_ncombat.enemy != 6) { var jims; @@ -255,7 +243,7 @@ if (((messages_shown == 999) || (messages == 0)) && ((timer_stage == 4) || (time instance_activate_object(obj_pnunit); } } - messages_shown = 105; + combat_messages_shown = 105; done = 1; scr_newtext(); timer_stage = 5; diff --git a/objects/obj_ncombat/Alarm_6.gml b/objects/obj_ncombat/Alarm_6.gml index aec8c6c53f..120c162364 100644 --- a/objects/obj_ncombat/Alarm_6.gml +++ b/objects/obj_ncombat/Alarm_6.gml @@ -2,15 +2,15 @@ if (battle_over == 1) { exit; } -/*if (messages_to_show = 24){ +/*if (combat_messages_to_show = 24){ if (enemy_forces<=0) or (!instance_exists(obj_enunit)) and (defeat_message=0){defeat_message=1; newline_color="yellow";newline="Enemy Forces Defeated";timer_maxspeed=0; - timer_speed=0;timer=0;started=2;messages_shown=105;// done=1;// alarm[3]=-1; + timer_speed=0;timer=0;started=2;combat_messages_shown=105;// done=1;// alarm[3]=-1; scr_newtext();exit; } if (player_forces<=0) and (defeat_message=0){defeat_message=1; newline_color="yellow";newline=string(global.chapter_name)+" Defeated"; - timer_maxspeed=0;timer_speed=0;started=4;messages_shown=105;defeat=1;// done=1; + timer_maxspeed=0;timer_speed=0;started=4;combat_messages_shown=105;defeat=1;// done=1; scr_newtext();exit; } if (instance_exists(obj_enunit)){ diff --git a/objects/obj_ncombat/Alarm_8.gml b/objects/obj_ncombat/Alarm_8.gml index 3065c5f81b..c4d4293570 100644 --- a/objects/obj_ncombat/Alarm_8.gml +++ b/objects/obj_ncombat/Alarm_8.gml @@ -2,44 +2,44 @@ if ((enemy_forces != 0) && (player_forces != 0) && (battle_over == 0)) { if ((enemy == 6) && (timer_stage == 2)) { timer_stage = 3; - messages = 0; - messages_to_show = 24; + combat_messages = []; + combat_messages_to_show = 24; largest = 0; random_messages = 0; priority = 0; - messages_shown = 0; + combat_messages_shown = 0; } if ((enemy != 6) && (timer_stage == 2)) { timer_stage = 3; - messages = 0; - messages_to_show = 24; + combat_messages = []; + combat_messages_to_show = 24; largest = 0; random_messages = 0; priority = 0; - messages_shown = 0; + combat_messages_shown = 0; } if ((enemy == 6) && (timer_stage == 4)) { timer_stage = 5; - messages = 0; - messages_to_show = 24; + combat_messages = []; + combat_messages_to_show = 24; largest = 0; random_messages = 0; priority = 0; - messages_shown = 0; + combat_messages_shown = 0; } if ((enemy != 6) && (timer_stage == 4)) { timer_stage = 5; - messages = 0; - messages_to_show = 24; + combat_messages = []; + combat_messages_to_show = 24; largest = 0; random_messages = 0; priority = 0; - messages_shown = 0; + combat_messages_shown = 0; } } diff --git a/objects/obj_ncombat/Create_0.gml b/objects/obj_ncombat/Create_0.gml index 8b3249d49a..4aacc7ff6a 100644 --- a/objects/obj_ncombat/Create_0.gml +++ b/objects/obj_ncombat/Create_0.gml @@ -141,9 +141,9 @@ enemy_max = 0; hulk_forces = 0; i = -1; -messages = 0; -messages_to_show = 24; -messages_shown = 0; +combat_messages = []; +combat_messages_to_show = 24; +combat_messages_shown = 0; largest = 0; priority = 0; random_messages = 0; @@ -156,9 +156,9 @@ repeat (70) { i += 1; lines[i] = ""; lines_color[i] = ""; - message[i] = ""; - message_sz[i] = 0; - message_priority[i] = 0; + combat_messages[i] = ""; + combat_message_sz[i] = 0; + combat_message_priority[i] = 0; dead_jim[i] = ""; dead_ene[i] = ""; dead_ene_n[i] = 0; diff --git a/objects/obj_ncombat/KeyPress_13.gml b/objects/obj_ncombat/KeyPress_13.gml index 260059f1e9..47d7639874 100644 --- a/objects/obj_ncombat/KeyPress_13.gml +++ b/objects/obj_ncombat/KeyPress_13.gml @@ -88,10 +88,10 @@ if (__b__) { } function reset_combat_message_arrays() { - for (var i = 0; i < array_length(message); i++) { - message[i] = ""; - message_sz[i] = 0; - message_priority[i] = 0; + for (var i = 0; i < array_length(combat_messages); i++) { + combat_messages[i] = ""; + combat_message_sz[i] = 0; + combat_message_priority[i] = 0; } } if ((timer_stage == 1) || (timer_stage == 5)) { @@ -129,17 +129,16 @@ if (__b__) { turn_count++; } } - messages = 0; - messages_to_show = 24; + combat_messages = []; + combat_messages_to_show = 24; largest = 0; random_messages = 0; priority = 0; - messages_shown = 0; + combat_messages_shown = 0; reset_combat_message_arrays(); timer_stage = 2; timer = 0; done = 0; - messages_shown = 0; } else if (timer_stage == 3) { if (battle_over != 1) { alarm[8] = 15; @@ -158,17 +157,16 @@ if (__b__) { obj_enunit.alarm[8] = 4; turns += 1; } - var messages = 0; - messages_to_show = 24; + combat_messages = []; + combat_messages_to_show = 24; largest = 0; random_messages = 0; priority = 0; - messages_shown = 0; + combat_messages_shown = 0; reset_combat_message_arrays(); timer_stage = 4; timer = 0; done = 0; - messages_shown = 0; } if (enemy == 6) { if (instance_exists(obj_pnunit)) { @@ -184,17 +182,16 @@ if (__b__) { // alarm[9]=5; var i; i = 0; - messages = 0; - messages_to_show = 24; + combat_messages = []; + combat_messages_to_show = 24; largest = 0; random_messages = 0; priority = 0; - messages_shown = 0; + combat_messages_shown = 0; reset_combat_message_arrays(); timer_stage = 4; timer = 0; done = 0; - messages_shown = 0; } } } diff --git a/objects/obj_ncombat/KeyPress_67.gml b/objects/obj_ncombat/KeyPress_67.gml index 06e4946e08..ac8f95b15d 100644 --- a/objects/obj_ncombat/KeyPress_67.gml +++ b/objects/obj_ncombat/KeyPress_67.gml @@ -1,7 +1,7 @@ if (global.cheat_debug == 1) { for (var i = 0; i < 30; i++) { - if (_message[i] != "") { - show_message(string(_message[i])); + if (combat_messages[i] != "") { + show_message(string(combat_messages[i])); } } } diff --git a/objects/obj_ncombat/Step_0.gml b/objects/obj_ncombat/Step_0.gml index ecbd3e136a..ee4f7271c1 100644 --- a/objects/obj_ncombat/Step_0.gml +++ b/objects/obj_ncombat/Step_0.gml @@ -22,7 +22,7 @@ if (fack == 1) { instance_activate_object(obj_centerline); instance_activate_object(obj_cursor); -if (((fugg >= 60) || (fugg2 >= 60)) && (messages_shown == 0) && (messages_to_show == 24) && (defeat_message == 0)) { +if (((fugg >= 60) || (fugg2 >= 60)) && (combat_messages_shown == 0) && (combat_messages_to_show == 24) && (defeat_message == 0)) { fugg = 0; fugg2 = 0; with (obj_pnunit) { @@ -40,7 +40,7 @@ if (((fugg >= 60) || (fugg2 >= 60)) && (messages_shown == 0) && (messages_to_sho } } } - if (((messages_shown == 999) || (messages == 0)) && (timer_stage == 2)) { + if (((combat_messages_shown == 999) || (combat_messages == 0)) && (timer_stage == 2)) { newline_color = "yellow"; if (obj_ncombat.enemy != 6) { if ((enemy_forces <= 0) || (!instance_exists(obj_enunit)) && (defeat_message == 0)) { @@ -64,7 +64,7 @@ if (((fugg >= 60) || (fugg2 >= 60)) && (messages_shown == 0) && (messages_to_sho instance_activate_object(obj_pnunit); } } - messages_shown = 105; + combat_messages_shown = 105; done = 1; scr_newtext(); timer_stage = 3; @@ -72,7 +72,7 @@ if (((fugg >= 60) || (fugg2 >= 60)) && (messages_shown == 0) && (messages_to_sho } // show_message("Shown: "+string(messages_shown)+"#Messages: "+string(messages)+"#Timer Stage: "+string(timer_stage)); - if (((messages_shown == 999) || (messages == 0)) && ((timer_stage == 4) || (timer_stage == 5)) && (four_show == 0)) { + if (((combat_messages_shown == 999) || (array_length(combat_messages) == 0)) && ((timer_stage == 4) || (timer_stage == 5)) && (four_show == 0)) { newline_color = "yellow"; if (obj_ncombat.enemy != 6) { if (((player_forces <= 0) || (!instance_exists(obj_pnunit))) && (defeat_message == 0)) { @@ -96,7 +96,7 @@ if (((fugg >= 60) || (fugg2 >= 60)) && (messages_shown == 0) && (messages_to_sho instance_activate_object(obj_pnunit); } } - messages_shown = 105; + combat_messages_shown = 105; done = 1; scr_newtext(); timer_stage = 5; From 1295b62cf758575fddb53eebd0302667c5f91a63 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sun, 28 Dec 2025 17:00:20 -0500 Subject: [PATCH 41/45] General cleanup of GM2004 suggestions, GM2043 warnings, and GM1041 errors. Some of these are simply good programming habit related, some make the code more readable, and others fix edge cases and improve logical consistency. --- objects/obj_controller/CleanUp_0.gml | 3 +- objects/obj_controller/Create_0.gml | 5 +- objects/obj_controller/Draw_64.gml | 2 +- objects/obj_controller/Step_0.gml | 30 +- objects/obj_en_fleet/Collision_obj_pnunit.gml | 24 +- objects/obj_fleet/Alarm_1.gml | 3 +- objects/obj_fleet/Alarm_2.gml | 272 ++++----- objects/obj_fleet/Alarm_6.gml | 2 +- objects/obj_fleet/Create_0.gml | 4 +- objects/obj_fleet_spawner/Alarm_0.gml | 523 +++++++++++++----- objects/obj_fleet_spawner/Alarm_1.gml | 408 +++++++------- objects/obj_fleet_spawner/Create_0.gml | 25 +- objects/obj_fleet_spawner/Draw_0.gml | 26 +- objects/obj_ncombat/Alarm_0.gml | 14 +- objects/obj_ncombat/Create_0.gml | 45 +- 15 files changed, 765 insertions(+), 621 deletions(-) diff --git a/objects/obj_controller/CleanUp_0.gml b/objects/obj_controller/CleanUp_0.gml index fb194912e4..5a8d4d08a5 100644 --- a/objects/obj_controller/CleanUp_0.gml +++ b/objects/obj_controller/CleanUp_0.gml @@ -1,7 +1,6 @@ global.name_generator = new NameGenerator(); -var _star_arrays = []; -ds_map_values_to_array(global.star_sprites, _star_arrays); +var _star_arrays = ds_map_values_to_array(global.star_sprites); for (var i = 0; i < array_length(_star_arrays); i++) { if (sprite_exists(_star_arrays[i])) { diff --git a/objects/obj_controller/Create_0.gml b/objects/obj_controller/Create_0.gml index 7b14c12556..70a7c0c298 100644 --- a/objects/obj_controller/Create_0.gml +++ b/objects/obj_controller/Create_0.gml @@ -735,7 +735,7 @@ inquisitor_gender = array_create(11, 0); inquisitor_type = array_create(11, ""); inquisitor = array_create(11, ""); -for (var i = 0, l = array_length(inquisitor_gender); i < l; i++) { +for (var i = 0; i < 11; i++) { // The Magic number isn't great but it's quicker to read as long as you read the preceeding four lines and see it's the same magic number. inquisitor_gender[i] = choose(0, 0, 0, 1, 1, 1, 1); inquisitor_type[i] = choose("Ordo Malleus", "Ordo Xenos", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus", "Ordo Hereticus"); inquisitor[i] = global.name_generator.generate_imperial_name(inquisitor_gender[i]); @@ -1366,6 +1366,7 @@ temp[33] = string_upper(scr_thought()); // Thought of the day var njm = 34, com = 0, vih = 0, word = "", masta = 0, forga = 0, chapla = 0, apa = 0, liba = 0, techa = 0, libra = 0, coda = 0, lexa = 0, apotha = 0, old_dudes = 0; var honoh = 0, termi = 0, veter = 0, capt = 0, chap = 0, apoth = 0, stand = 0, dread = 0, champ = 0, tact = 0, assa = 0, deva = 0, rhino = 0, speeder = 0, raider = 0, standard = 0, bike = 0, scou = 0, whirl = 0, pred = 0, lib = 0, serg = 0, vet_serg = 0; + for (var mm = 0; mm <= 100; mm++) { if (obj_ini.role[com][mm] == obj_ini.role[100][eROLE.ChapterMaster]) { masta = 1; @@ -1426,8 +1427,10 @@ if (liba == 1) { vih = string_pos(",", temp[njm]); temp[njm] = string_delete(temp[njm], vih, 1); + njm += 1; temp[njm] = "Specialist branches staffed by"; + if (techa > 0) { temp[njm] += $", {string_plural_count(obj_ini.role[100][16], techa)}"; } diff --git a/objects/obj_controller/Draw_64.gml b/objects/obj_controller/Draw_64.gml index 06aa1611a7..83e1793684 100644 --- a/objects/obj_controller/Draw_64.gml +++ b/objects/obj_controller/Draw_64.gml @@ -160,7 +160,7 @@ if (!zoomed && !zui) { } } // Checks if the chapter name is less than 140 chars, adjusts chapter_master_name_width accordingly var chapter_master_name_width = 1; - for (var i = 0; i < 10; i++) { + repeat (10) { if ((string_width(string_hash_to_newline(string(global.chapter_name))) * chapter_master_name_width) > 140) { chapter_master_name_width -= 0.1; } diff --git a/objects/obj_controller/Step_0.gml b/objects/obj_controller/Step_0.gml index f0e5fedd42..79850b45d7 100644 --- a/objects/obj_controller/Step_0.gml +++ b/objects/obj_controller/Step_0.gml @@ -1,16 +1,7 @@ try { // Handles most logic for main menus, audio and checks if cheats are enabled // TODO refactor will wait untill squads PR (#76) is merged - if ( - menu == 0 - && zoomed == 0 - && !instances_exist_any( - [ - obj_ingame_menu, - obj_ncombat - ] - ) - ) { + if (menu == 0 && zoomed == 0 && !instances_exist_any([obj_ingame_menu, obj_ncombat])) { scr_zoom_keys(); } if (double_click >= 0) { @@ -443,10 +434,7 @@ try { // Checks if the marine is not hidden var _unit = unit_focus; if (!is_array(last_unit)) { - last_unit = [ - -1, - -1 - ]; + last_unit = [-1, -1]; } if ((_unit.base_group != "none") && (last_unit[1] != _unit.marine_number || last_unit[0] != _unit.company)) { reset_manage_unit_constants(_unit); @@ -566,8 +554,8 @@ try { if (b == -1) { b = ma_lid[q]; } - var unit_id = display_unit[q][1]; - var company = display_unit[q][0]; + unit_id = display_unit[q][1]; + company = display_unit[q][0]; obj_ini.veh_loc[company][unit_id] = obj_ini.ship_location[b]; obj_ini.veh_lid[company][unit_id] = -1; obj_ini.veh_wid[company][unit_id] = unload; @@ -599,15 +587,7 @@ try { reset_manage_selections(); } - if ( - menu == 0 - && !instances_exist_any( - [ - obj_ncombat, - obj_fleet_controller - ] - ) - ) { + if (menu == 0 && !instances_exist_any([obj_ncombat, obj_fleet_controller])) { if (!array_contains(obj_ini.role[0], obj_ini.role[100][eROLE.ChapterMaster]) && (alarm[7] == -1)) { alarm[7] = 15; } diff --git a/objects/obj_en_fleet/Collision_obj_pnunit.gml b/objects/obj_en_fleet/Collision_obj_pnunit.gml index 8d4a544c4b..7088576cc6 100644 --- a/objects/obj_en_fleet/Collision_obj_pnunit.gml +++ b/objects/obj_en_fleet/Collision_obj_pnunit.gml @@ -1,17 +1,17 @@ exit; -if (other.sprite_index != self.sprite_index) { +/*if (other.sprite_index != self.sprite_index) { // The following is unreachable due to above exit statement exit; } // No colonists and fleets bashing together -//if (other.action="") and (action="") and (other.owner=owner) and (string_count("her",trade_goods)=0) and (string_count("her",string(other.trade_goods))=0){ -// if (obj_controller.faction_status[eFACTION.Imperium]="War") and (instance_nearest(x,y,obj_star).owner = eFACTION.Player) and (owner = eFACTION.Imperium) and (other.owner = eFACTION.Imperium){ -// if (id>other.id){ -// guardsmen+=other.guardsmen; -// capital_number+=other.capital_number; -// frigate_number+=other.frigate_number; -// escort_number+=other.escort_number; -// with(other){instance_destroy();} -// } -// } -//} +if (other.action="") and (action="") and (other.owner=owner) and (string_count("her",trade_goods)=0) and (string_count("her",string(other.trade_goods))=0){ + if (obj_controller.faction_status[eFACTION.Imperium]="War") and (instance_nearest(x,y,obj_star).owner = eFACTION.Player) and (owner = eFACTION.Imperium) and (other.owner = eFACTION.Imperium){ + if (id>other.id){ + guardsmen+=other.guardsmen; + capital_number+=other.capital_number; + frigate_number+=other.frigate_number; + escort_number+=other.escort_number; + with(other){instance_destroy();} + } + } +}*/ diff --git a/objects/obj_fleet/Alarm_1.gml b/objects/obj_fleet/Alarm_1.gml index ad405efc5b..11daac5c19 100644 --- a/objects/obj_fleet/Alarm_1.gml +++ b/objects/obj_fleet/Alarm_1.gml @@ -388,8 +388,7 @@ repeat (5) { /* */ -attack_mode = "offensive"; - +// attack_mode = "offensive"; // if (ambushers=1) or (enemy=8) then attack_mode="offensive"; // if (enemy=9) then attack_mode="defensive"; diff --git a/objects/obj_fleet/Alarm_2.gml b/objects/obj_fleet/Alarm_2.gml index 9feb22f26a..8399889599 100644 --- a/objects/obj_fleet/Alarm_2.gml +++ b/objects/obj_fleet/Alarm_2.gml @@ -2,67 +2,54 @@ capital_max = capital; frigate_max = frigate; escort_max = escort; -var i, k, temp1, temp2, x2, hei, man, sizz; -i = 0; -k = 0; -temp1 = 0; -temp2 = 0; -x2 = 224; -hei = 0; -man = 0; -sizz = 0; +var _enemy_ship; +var _enemy_ship_x_coord = 1200; +var _enemy_ship_y_coord = 0; sort_ships_into_columns(self); player_fleet_ship_spawner(); -if (enemy == 2) { - // This is an orderly Tau ship formation - var xx, yy, i, temp1, x2, man; - xx = 0; - yy = 0; - i = 0; - temp1 = 0; - x2 = 1200; - man = 0; +if (enemy == eFACTION.Imperium) { + // This is an orderly Imperium formation if (en_num[4] > 0) { - yy = (room_height / 2) - ((en_height[4] * en_num[4]) / 2); - yy += en_height[4] / 2; + _enemy_ship_y_coord = (room_height / 2) - ((en_height[4] * en_num[4]) / 2); + _enemy_ship_y_coord += en_height[4] / 2; repeat (en_num[4]) { - man = instance_create(x2, yy, obj_en_cruiser); - yy += en_height[4]; - man.class = en_column[4]; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[4]; + _enemy_ship.class = en_column[4]; } - x2 += en_width[4]; + _enemy_ship_x_coord += en_width[4]; } if (en_num[3] > 0) { - yy = (room_height / 2) - ((en_height[3] * en_num[3]) / 2); - yy += en_height[3] / 2; + _enemy_ship_y_coord = (room_height / 2) - ((en_height[3] * en_num[3]) / 2); + _enemy_ship_y_coord += en_height[3] / 2; repeat (en_num[3]) { - man = instance_create(x2, yy, obj_en_cruiser); - yy += en_height[3]; - man.class = en_column[3]; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[3]; + _enemy_ship.class = en_column[3]; } - x2 += en_width[3]; + _enemy_ship_x_coord += en_width[3]; } if (en_num[2] > 0) { - yy = (room_height / 2) - ((en_height[2] * en_num[2]) / 2); - yy += en_height[2] / 2; + _enemy_ship_y_coord = (room_height / 2) - ((en_height[2] * en_num[2]) / 2); + _enemy_ship_y_coord += en_height[2] / 2; repeat (en_num[2]) { - man = instance_create(x2, yy, obj_en_capital); - yy += en_height[2]; - man.class = en_column[2]; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_capital); + _enemy_ship_y_coord += en_height[2]; + _enemy_ship.class = en_column[2]; } - x2 += en_width[2]; + _enemy_ship_x_coord += en_width[2]; } if (en_num[1] > 0) { - yy = 256; + _enemy_ship_y_coord = 256; repeat (en_num[1]) { - man = instance_create(x2, yy, obj_en_capital); - yy += en_height[1]; - man.class = en_column[1]; - yy += en_height[1]; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_capital); + _enemy_ship_y_coord += en_height[1]; + _enemy_ship.class = en_column[1]; + _enemy_ship_y_coord += en_height[1]; } } } @@ -74,180 +61,147 @@ if (en_frigate>0){en_column[2]="Shadow Class";en_num[2]=en_frigate;en_size[2]=2; if (en_capital>0){en_column[1]="Void Stalker";en_num[1]=en_capital;en_size[1]=3;} */ -if (enemy == 6) { - // This is an orderly Tau ship formation - var xx, yy, i, temp1, x2, man; - xx = 0; - yy = 0; - i = 0; - temp1 = 0; - x2 = 1200; - man = 0; +if (enemy == eFACTION.Eldar) { + // This is an orderly Eldar formation if (en_num[4] > 0) { - yy = 128; + _enemy_ship_y_coord = 128; repeat (en_num[4]) { - man = instance_create(x2, yy, obj_en_cruiser); - yy += en_height[4]; - man.class = en_column[4]; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[4]; + _enemy_ship.class = en_column[4]; } } if (en_num[3] > 0) { - yy = room_height - 128; + _enemy_ship_y_coord = room_height - 128; repeat (en_num[3]) { - man = instance_create(x2, yy, obj_en_cruiser); - yy -= en_height[3]; - man.class = en_column[3]; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord -= en_height[3]; + _enemy_ship.class = en_column[3]; } } - x2 += max(en_width[3], en_width[4]); + _enemy_ship_x_coord += max(en_width[3], en_width[4]); if (en_num[2] > 0) { - yy = (room_height / 2) - ((en_height[2] * en_num[2]) / 2); - yy += en_height[2] / 2; + _enemy_ship_y_coord = (room_height / 2) - ((en_height[2] * en_num[2]) / 2); + _enemy_ship_y_coord += en_height[2] / 2; repeat (en_num[2]) { - man = instance_create(x2, yy, obj_en_capital); - yy += en_height[2]; - man.class = en_column[2]; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_capital); + _enemy_ship_y_coord += en_height[2]; + _enemy_ship.class = en_column[2]; } - x2 += en_width[2]; + _enemy_ship_x_coord += en_width[2]; } if (en_num[1] > 0) { - yy = 256; + _enemy_ship_y_coord = 256; repeat (en_num[1]) { - man = instance_create(x2, yy, obj_en_capital); - yy += en_height[1]; - man.class = en_column[1]; - yy += en_height[1]; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_capital); + _enemy_ship_y_coord += en_height[1]; + _enemy_ship.class = en_column[1]; + _enemy_ship_y_coord += en_height[1]; } } } -if ((enemy == 7) || (enemy == 10)) { - // This is spew out random ships without regard for formations - var xx, yy, dist, targ, numb, man; - xx = 0; - yy = 0; - dist = 0; - target = 0; - numb = 0; - man = 0; - - var i; - i = 0; - - repeat (5) { - i += 1; +if ((enemy == eFACTION.Ork) || (enemy == eFACTION.Chaos)) { + // This spews out random ships without regard for formations + for (var i = 0; i < 5; i++) { if (en_column[i] != "") { - for (s = 0; s < en_num[i]; s += 1) { + repeat (en_num[i]) { if (en_size[i] > 1) { - man = instance_create(random_range(1200, 1400), round(random(860) + 50), obj_en_capital); + _enemy_ship = instance_create(random_range(1200, 1400), round(random(860) + 50), obj_en_capital); } if (en_size[i] == 1) { - man = instance_create(random_range(1200, 1400), round(random(860) + 50), obj_en_cruiser); + _enemy_ship = instance_create(random_range(1200, 1400), round(random(860) + 50), obj_en_cruiser); } - man.class = en_column[i]; + _enemy_ship.class = en_column[i]; } } } } -if (enemy == 8) { - // This is an orderly Tau ship formation - var xx, yy, i, temp1, x2, man; - xx = 0; - yy = 0; - i = 0; - temp1 = 0; - x2 = 1200; - man = 0; - - yy = (room_height / 2) - ((en_height[5] * en_num[5]) / 2); - yy += en_height[5] / 2; +if (enemy == eFACTION.Tau) { + // This is an orderly Tau formation + + _enemy_ship_y_coord = (room_height / 2) - ((en_height[5] * en_num[5]) / 2); + _enemy_ship_y_coord += en_height[5] / 2; repeat (en_num[5]) { - man = instance_create(x2, yy, obj_en_cruiser); - yy += en_height[5]; - man.class = "Warden"; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[5]; + _enemy_ship.class = "Warden"; } - x2 += en_width[5]; + _enemy_ship_x_coord += en_width[5]; - yy = (room_height / 2) - ((en_height[2] * en_num[2]) / 2) - ((en_height[3] * en_num[3]) / 2); - yy += en_height[2] / 2; - yy += en_height[3] / 2; + _enemy_ship_y_coord = (room_height / 2) - ((en_height[2] * en_num[2]) / 2) - ((en_height[3] * en_num[3]) / 2); + _enemy_ship_y_coord += en_height[2] / 2; + _enemy_ship_y_coord += en_height[3] / 2; repeat (en_num[2]) { - man = instance_create(x2, yy, obj_en_cruiser); - yy += en_height[2]; - man.class = "Emissary"; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[2]; + _enemy_ship.class = "Emissary"; } repeat (en_num[3]) { - man = instance_create(x2, yy, obj_en_cruiser); - yy += en_height[3]; - man.class = "Protector"; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[3]; + _enemy_ship.class = "Protector"; } - x2 += max(en_width[2], en_width[3]); + _enemy_ship_x_coord += max(en_width[2], en_width[3]); - yy = (room_height / 2) - ((en_height[4] * en_num[4]) / 2); - yy += en_height[4] / 2; + _enemy_ship_y_coord = (room_height / 2) - ((en_height[4] * en_num[4]) / 2); + _enemy_ship_y_coord += en_height[4] / 2; repeat (en_num[4]) { - man = instance_create(x2, yy, obj_en_cruiser); - yy += en_height[4]; - man.class = "Castellan"; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[4]; + _enemy_ship.class = "Castellan"; } - x2 += en_width[4]; + _enemy_ship_x_coord += en_width[4]; - yy = (room_height / 2) - ((en_height[1] * en_num[1]) / 2); - yy += en_height[1] / 2; + _enemy_ship_y_coord = (room_height / 2) - ((en_height[1] * en_num[1]) / 2); + _enemy_ship_y_coord += en_height[1] / 2; repeat (en_num[1]) { - man = instance_create(x2, yy, obj_en_capital); - yy += en_height[1]; - man.class = "Custodian"; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_capital); + _enemy_ship_y_coord += en_height[1]; + _enemy_ship.class = "Custodian"; } } -if (enemy == 9) { - // This is an orderly Tyranid ship formation - var xx, yy, i, temp1, x2, man; - xx = 0; - yy = 0; - i = 0; - temp1 = 0; - x2 = 1200; - man = 0; - - yy = (room_height / 2) - ((en_height[4] * en_num[4]) / 2); - yy += en_height[4] / 2; +if (enemy == eFACTION.Tyranids) { + // This is an orderly Tyranid formation + + _enemy_ship_y_coord = (room_height / 2) - ((en_height[4] * en_num[4]) / 2); + _enemy_ship_y_coord += en_height[4] / 2; repeat (en_num[4]) { - man = instance_create(x2, yy, obj_en_cruiser); - yy += en_height[4]; - man.class = "Prowler"; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[4]; + _enemy_ship.class = "Prowler"; } - x2 += en_width[4]; + _enemy_ship_x_coord += en_width[4]; - yy = (room_height / 2) - ((en_height[3] * en_num[3]) / 2); - yy += en_height[3] / 2; + _enemy_ship_y_coord = (room_height / 2) - ((en_height[3] * en_num[3]) / 2); + _enemy_ship_y_coord += en_height[3] / 2; repeat (en_num[3]) { - man = instance_create(x2, yy, obj_en_cruiser); - yy += en_height[3]; - man.class = "Razorfiend"; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[3]; + _enemy_ship.class = "Razorfiend"; } - x2 += en_width[3]; + _enemy_ship_x_coord += en_width[3]; - yy = (room_height / 2) - ((en_height[2] * en_num[2]) / 2); - yy += en_height[2] / 2; + _enemy_ship_y_coord = (room_height / 2) - ((en_height[2] * en_num[2]) / 2); + _enemy_ship_y_coord += en_height[2] / 2; repeat (en_num[2]) { - man = instance_create(x2, yy, obj_en_cruiser); - yy += en_height[2]; - man.class = "Stalker"; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[2]; + _enemy_ship.class = "Stalker"; } - x2 += en_width[2]; + _enemy_ship_x_coord += en_width[2]; - yy = (room_height / 2) - ((en_height[1] * en_num[1]) / 2); - yy += en_height[1] / 2; + _enemy_ship_y_coord = (room_height / 2) - ((en_height[1] * en_num[1]) / 2); + _enemy_ship_y_coord += en_height[1] / 2; repeat (en_num[1]) { - man = instance_create(x2, yy, obj_en_capital); - yy += en_height[1]; - man.class = "Leviathan"; + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_capital); + _enemy_ship_y_coord += en_height[1]; + _enemy_ship.class = "Leviathan"; } } diff --git a/objects/obj_fleet/Alarm_6.gml b/objects/obj_fleet/Alarm_6.gml index 6ffaebf572..d6d4006868 100644 --- a/objects/obj_fleet/Alarm_6.gml +++ b/objects/obj_fleet/Alarm_6.gml @@ -88,7 +88,7 @@ if (total_allies > 0) { // Buffs here // if (ambushers=1) or (enemy=8) then -attack_mode = "offensive"; +// attack_mode = "offensive"; // if (enemy=9) then attack_mode="defensive"; if ((ambushers == 1) && (ambushers == 999)) { diff --git a/objects/obj_fleet/Create_0.gml b/objects/obj_fleet/Create_0.gml index c9352170f7..a9e33a8284 100644 --- a/objects/obj_fleet/Create_0.gml +++ b/objects/obj_fleet/Create_0.gml @@ -41,8 +41,8 @@ player_started = 0; player_lasers = 0; player_lasers_cd = 70; player_lasers_target = 0; -pla_fleet = 0; -ene_fleet = 0; +pla_fleet = noone; +ene_fleet = noone; victory = false; instance_deactivate_all(true); diff --git a/objects/obj_fleet_spawner/Alarm_0.gml b/objects/obj_fleet_spawner/Alarm_0.gml index 3d952708c4..dfc29c4c76 100644 --- a/objects/obj_fleet_spawner/Alarm_0.gml +++ b/objects/obj_fleet_spawner/Alarm_0.gml @@ -1,175 +1,398 @@ - - - - -if (number=1){ +if (number == 1) { // create blocks of infantry - - - var i=0,k=0,x2=224,hei=0,man=0,sizz=0; - + + var i = 0, k = 0, x2 = 224, hei = 0, man = 0, sizz = 0; sort_ships_into_columns(obj_fleet); - with (obj_fleet){ + with (obj_fleet) { player_fleet_ship_spawner(); } - - } +if ((number > 0) && (owner != 1)) { + en_escort = obj_fleet.en_escort[number]; + en_frigate = obj_fleet.en_frigate[number]; + en_capital = obj_fleet.en_capital[number]; + if (owner == eFACTION.Imperium) { + if (en_escort > 0) { + en_column[4] = "Sword Class Frigate"; + en_num[4] = en_escort; + en_size[4] = 1; + } -if (number>0) and (owner!=1){ - - en_escort=obj_fleet.en_escort[number]; - en_frigate=obj_fleet.en_frigate[number]; - en_capital=obj_fleet.en_capital[number]; + if (en_frigate > 0) { + en_column[3] = "Avenger Class Grand Cruiser"; + en_num[3] = en_frigate; + en_size[3] = 2; + } - - if (owner = eFACTION.Imperium){ - if (en_escort>0){ - en_column[4]="Sword Class Frigate"; - en_num[4]=en_escort; - en_size[4]=1; + var i; + i = 0; + i = en_capital; + if (i > 0) { + en_column[2] = "Apocalypse Class Battleship"; + en_num[2] = floor(random(i)) + 1; + if (en_num[2] < (en_capital * 0.6)) { + en_num[2] = round(en_capital * 0.6); + } + i -= en_num[2]; + en_size[2] = 3; } - - if (en_frigate>0){en_column[3]="Avenger Class Grand Cruiser";en_num[3]=en_frigate;en_size[3]=2;} - - var i;i=0;i=en_capital; - if (i>0){ - en_column[2]="Apocalypse Class Battleship";en_num[2]=floor(random(i))+1; - if (en_num[2]<(en_capital*0.6)) then en_num[2]=round(en_capital*0.6); - i-=en_num[2];en_size[2]=3; + + if (i > 0) { + en_column[1] = "Nemesis Class Fleet Carrier"; + en_num[1] = i; + i -= en_num[1]; + en_size[1] = 3; } - - if (i>0){en_column[1]="Nemesis Class Fleet Carrier";en_num[1]=i;i-=en_num[1];en_size[1]=3;} } - - - - if (owner = eFACTION.Eldar){ - if (en_escort>0){en_column[4]="Aconite";en_num[4]=max(1,floor(en_escort/2));en_size[4]=1;} - if (en_escort>1){en_column[3]="Hellebore";en_num[3]=max(1,floor(en_escort/2));en_size[3]=1;} - if (en_frigate>0){en_column[2]="Shadow Class";en_num[2]=en_frigate;en_size[2]=2;} - if (en_capital>0){en_column[1]="Void Stalker";en_num[1]=en_capital;en_size[1]=3;} + + if (owner == eFACTION.Eldar) { + if (en_escort > 0) { + en_column[4] = "Aconite"; + en_num[4] = max(1, floor(en_escort / 2)); + en_size[4] = 1; + } + if (en_escort > 1) { + en_column[3] = "Hellebore"; + en_num[3] = max(1, floor(en_escort / 2)); + en_size[3] = 1; + } + if (en_frigate > 0) { + en_column[2] = "Shadow Class"; + en_num[2] = en_frigate; + en_size[2] = 2; + } + if (en_capital > 0) { + en_column[1] = "Void Stalker"; + en_num[1] = en_capital; + en_size[1] = 3; + } } - - - - - if (owner = eFACTION.Ork){ - var i;i=0;i=en_capital; - - if (i>0){en_column[1]="Dethdeala";en_num[1]=floor(random(i))+1;i-=en_num[1];en_size[1]=3;} - - if (i>0){en_column[2]="Gorbag's Revenge";en_num[2]=floor(random(i))+1;i-=en_num[2];en_size[2]=3;}// en_num[2]+=en_num[1]+1; - - if (i>0){en_column[3]="Kroolboy";en_num[3]=i;i-=en_num[3];en_size[3]=3;}// en_num[3]+=en_num[2]+1; - - if (en_frigate>0){en_column[4]="Battlekroozer";en_num[4]=en_frigate;en_size[4]=2;}// en_num[4]+=en_num[3]+1; - - if (en_escort>0){en_column[5]="Ravager";en_num[5]=en_escort;en_size[5]=1;}// en_num[5]+=en_num[4]+1; + + if (owner == eFACTION.Ork) { + var i; + i = 0; + i = en_capital; + + if (i > 0) { + en_column[1] = "Dethdeala"; + en_num[1] = floor(random(i)) + 1; + i -= en_num[1]; + en_size[1] = 3; + } + + if (i > 0) { + en_column[2] = "Gorbag's Revenge"; + en_num[2] = floor(random(i)) + 1; + i -= en_num[2]; + en_size[2] = 3; + } // en_num[2]+=en_num[1]+1; + + if (i > 0) { + en_column[3] = "Kroolboy"; + en_num[3] = i; + i -= en_num[3]; + en_size[3] = 3; + } // en_num[3]+=en_num[2]+1; + + if (en_frigate > 0) { + en_column[4] = "Battlekroozer"; + en_num[4] = en_frigate; + en_size[4] = 2; + } // en_num[4]+=en_num[3]+1; + + if (en_escort > 0) { + en_column[5] = "Ravager"; + en_num[5] = en_escort; + en_size[5] = 1; + } // en_num[5]+=en_num[4]+1; } - - if (owner = eFACTION.Tau){ - var i;i=0;i=en_frigate; - - if (en_capital>0){en_column[1]="Custodian";en_num[1]=en_capital;en_size[1]=3;} - - if (i>0){en_column[2]="Emissary";en_num[2]=1;i-=en_num[2];en_size[2]=2;} - - if (i>0){en_column[3]="Protector";en_num[3]=i;i-=en_num[3];en_size[3]=2;}// en_num[3]+=en_num[2]+1; - - if (en_escort>0){en_column[4]="Castellan";en_num[4]=round((en_escort/3)*2);en_size[4]=1;} - - if (en_escort>2){en_column[5]="Warden";en_num[5]=en_escort-en_num[5];en_size[5]=1;} + + if (owner == eFACTION.Tau) { + var i; + i = 0; + i = en_frigate; + + if (en_capital > 0) { + en_column[1] = "Custodian"; + en_num[1] = en_capital; + en_size[1] = 3; + } + + if (i > 0) { + en_column[2] = "Emissary"; + en_num[2] = 1; + i -= en_num[2]; + en_size[2] = 2; + } + + if (i > 0) { + en_column[3] = "Protector"; + en_num[3] = i; + i -= en_num[3]; + en_size[3] = 2; + } // en_num[3]+=en_num[2]+1; + + if (en_escort > 0) { + en_column[4] = "Castellan"; + en_num[4] = round((en_escort / 3) * 2); + en_size[4] = 1; + } + + if (en_escort > 2) { + en_column[5] = "Warden"; + en_num[5] = en_escort - en_num[5]; + en_size[5] = 1; + } } - - if (owner = eFACTION.Tyranids){ - var i;i=0;i=en_escort; - - if (en_capital>0){en_column[1]="Leviathan";en_num[1]=en_capital;en_size[1]=3;} - - if (i>0){en_column[2]="Stalker";en_num[2]=floor(i/3)+1;i-=en_num[2];en_size[2]=1;} - - if (en_frigate>0){en_column[3]="Razorfiend";en_num[3]=en_frigate;en_size[3]=2;}// en_num[2]+=en_num[1]+1; - - if (i>0){en_column[4]="Prowler";en_num[4]=i;en_size[4]=1;}// en_num[5]+=en_num[4]+1; + + if (owner == eFACTION.Tyranids) { + var i; + i = 0; + i = en_escort; + + if (en_capital > 0) { + en_column[1] = "Leviathan"; + en_num[1] = en_capital; + en_size[1] = 3; + } + + if (i > 0) { + en_column[2] = "Stalker"; + en_num[2] = floor(i / 3) + 1; + i -= en_num[2]; + en_size[2] = 1; + } + + if (en_frigate > 0) { + en_column[3] = "Razorfiend"; + en_num[3] = en_frigate; + en_size[3] = 2; + } // en_num[2]+=en_num[1]+1; + + if (i > 0) { + en_column[4] = "Prowler"; + en_num[4] = i; + en_size[4] = 1; + } // en_num[5]+=en_num[4]+1; } - - if (owner = eFACTION.Chaos){ - var i;i=0;i=en_frigate; - - if (en_capital>0){en_column[1]="Desecrator";en_num[1]=en_capital;en_size[1]=3;} - - if (i>0){en_column[2]="Avenger";en_num[2]=floor(random(i))+1;i-=en_num[2];en_size[2]=2;} - - if (i>0){en_column[3]="Carnage";en_num[3]=floor(random(i))+1;i-=en_num[3];en_size[3]=2;}// en_num[2]+=en_num[1]+1; - - if (i>0){en_column[4]="Daemon";en_num[4]=i;i-=en_num[4];en_size[4]=2;}// en_num[3]+=en_num[2]+1; - - if (en_escort>0){en_column[5]="Iconoclast";en_num[5]=en_escort;en_size[5]=1;}// en_num[5]+=en_num[4]+1; + + if (owner == eFACTION.Chaos) { + var i; + i = 0; + i = en_frigate; + + if (en_capital > 0) { + en_column[1] = "Desecrator"; + en_num[1] = en_capital; + en_size[1] = 3; + } + + if (i > 0) { + en_column[2] = "Avenger"; + en_num[2] = floor(random(i)) + 1; + i -= en_num[2]; + en_size[2] = 2; + } + + if (i > 0) { + en_column[3] = "Carnage"; + en_num[3] = floor(random(i)) + 1; + i -= en_num[3]; + en_size[3] = 2; + } // en_num[2]+=en_num[1]+1; + + if (i > 0) { + en_column[4] = "Daemon"; + en_num[4] = i; + i -= en_num[4]; + en_size[4] = 2; + } // en_num[3]+=en_num[2]+1; + + if (en_escort > 0) { + en_column[5] = "Iconoclast"; + en_num[5] = en_escort; + en_size[5] = 1; + } // en_num[5]+=en_num[4]+1; } - - if (owner = eFACTION.Necrons){ - var i;i=0;i=en_escort; - - if (en_capital>0){en_column[1]="Reaper Class";en_num[1]=en_capital;en_size[1]=3;} + + if (owner == eFACTION.Necrons) { + var i; + i = 0; + i = en_escort; + + if (en_capital > 0) { + en_column[1] = "Reaper Class"; + en_num[1] = en_capital; + en_size[1] = 3; + } // Cairn Class Tombship are very rare - - if (i>0){en_column[2]="Shroud Class";en_num[2]=en_frigate;en_size[2]=2;} - - if (i>0){en_column[3]="Jackal Class";en_num[3]=round(i/2);i-=en_num[3];en_size[3]=1;} - if (en_escort>0){en_column[4]="Dirge Class";en_num[4]=i;en_size[4]=1;} + + if (i > 0) { + en_column[2] = "Shroud Class"; + en_num[2] = en_frigate; + en_size[2] = 2; + } + + if (i > 0) { + en_column[3] = "Jackal Class"; + en_num[3] = round(i / 2); + i -= en_num[3]; + en_size[3] = 1; + } + if (en_escort > 0) { + en_column[4] = "Dirge Class"; + en_num[4] = i; + en_size[4] = 1; + } } - - - - - var i;i=0; - repeat(5){i+=1; - if (en_column[i]="Avenger Class Grand Cruiser"){en_width[i]=196;en_height[i]=96;} - if (en_column[i]="Apocalypse Class Battleship"){en_width[i]=272;en_height[i]=128;} - if (en_column[i]="Nemesis Class Fleet Carrier"){en_width[i]=272;en_height[i]=128;} - if (en_column[i]="Sword Class Frigate"){en_width[i]=96;en_height[i]=64;} - - if (en_column[i]="Void Stalker"){en_width[i]=260;en_height[i]=192;} - if (en_column[i]="Shadow Class"){en_width[i]=212;en_height[i]=160;} - if (en_column[i]="Hellebore"){en_width[i]=160;en_height[i]=64;} - if (en_column[i]="Aconite"){en_width[i]=128;en_height[i]=64;} - - if (en_column[i]="Deathdeala"){en_width[i]=196;en_height[i]=128;} - if (en_column[i]="Gorbag's Revenge"){en_width[i]=196;en_height[i]=128;} - if (en_column[i]="Kroolboy"){en_width[i]=196;en_height[i]=128;} - if (en_column[i]="Slamblasta"){en_width[i]=196;en_height[i]=128;} - if (en_column[i]="Battlekroozer"){en_width[i]=160;en_height[i]=96;} - if (en_column[i]="Ravager"){en_width[i]=128;en_height[i]=64;} - - if (en_column[i]="Desecrator"){en_width[i]=196;en_height[i]=128;} - if (en_column[i]="Avenger"){en_width[i]=160;en_height[i]=96;} - if (en_column[i]="Carnage"){en_width[i]=160;en_height[i]=96;} - if (en_column[i]="Daemon"){en_width[i]=160;en_height[i]=96;} - if (en_column[i]="Iconoclast"){en_width[i]=128;en_height[i]=64;} - - if (en_column[i]="Custodian"){en_width[i]=128;en_height[i]=256;} - if (en_column[i]="Emissary"){en_width[i]=160;en_height[i]=96;} - if (en_column[i]="Protector"){en_width[i]=64;en_height[i]=180;} - if (en_column[i]="Castellan"){en_width[i]=48;en_height[i]=96;} - if (en_column[i]="Warden"){en_width[i]=48;en_height[i]=80;} - - if (en_column[i]="Leviathan"){en_width[i]=200;en_height[i]=128;} - if (en_column[i]="Razorfiend"){en_width[i]=160;en_height[i]=128;} - if (en_column[i]="Stalker"){en_width[i]=96;en_height[i]=64;} - if (en_column[i]="Prowler"){en_width[i]=80;en_height[i]=64;} - - if (en_column[i]="Cairn Class Tombship"){en_width[i]=256;en_height[i]=224;} - if (en_column[i]="Reaper Class"){en_width[i]=286;en_height[i]=161;} - if (en_column[i]="Shroud Class"){en_width[i]=200;en_height[i]=150;} - if (en_column[i]="Jackal Class"){en_width[i]=99;en_height[i]=123;} - if (en_column[i]="Dirge Class"){en_width[i]=100;en_height[i]=91;} + + var i; + i = 0; + repeat (5) { + i += 1; + if (en_column[i] == "Avenger Class Grand Cruiser") { + en_width[i] = 196; + en_height[i] = 96; + } + if (en_column[i] == "Apocalypse Class Battleship") { + en_width[i] = 272; + en_height[i] = 128; + } + if (en_column[i] == "Nemesis Class Fleet Carrier") { + en_width[i] = 272; + en_height[i] = 128; + } + if (en_column[i] == "Sword Class Frigate") { + en_width[i] = 96; + en_height[i] = 64; + } + + if (en_column[i] == "Void Stalker") { + en_width[i] = 260; + en_height[i] = 192; + } + if (en_column[i] == "Shadow Class") { + en_width[i] = 212; + en_height[i] = 160; + } + if (en_column[i] == "Hellebore") { + en_width[i] = 160; + en_height[i] = 64; + } + if (en_column[i] == "Aconite") { + en_width[i] = 128; + en_height[i] = 64; + } + + if (en_column[i] == "Deathdeala") { + en_width[i] = 196; + en_height[i] = 128; + } + if (en_column[i] == "Gorbag's Revenge") { + en_width[i] = 196; + en_height[i] = 128; + } + if (en_column[i] == "Kroolboy") { + en_width[i] = 196; + en_height[i] = 128; + } + if (en_column[i] == "Slamblasta") { + en_width[i] = 196; + en_height[i] = 128; + } + if (en_column[i] == "Battlekroozer") { + en_width[i] = 160; + en_height[i] = 96; + } + if (en_column[i] == "Ravager") { + en_width[i] = 128; + en_height[i] = 64; + } + + if (en_column[i] == "Desecrator") { + en_width[i] = 196; + en_height[i] = 128; + } + if (en_column[i] == "Avenger") { + en_width[i] = 160; + en_height[i] = 96; + } + if (en_column[i] == "Carnage") { + en_width[i] = 160; + en_height[i] = 96; + } + if (en_column[i] == "Daemon") { + en_width[i] = 160; + en_height[i] = 96; + } + if (en_column[i] == "Iconoclast") { + en_width[i] = 128; + en_height[i] = 64; + } + + if (en_column[i] == "Custodian") { + en_width[i] = 128; + en_height[i] = 256; + } + if (en_column[i] == "Emissary") { + en_width[i] = 160; + en_height[i] = 96; + } + if (en_column[i] == "Protector") { + en_width[i] = 64; + en_height[i] = 180; + } + if (en_column[i] == "Castellan") { + en_width[i] = 48; + en_height[i] = 96; + } + if (en_column[i] == "Warden") { + en_width[i] = 48; + en_height[i] = 80; + } + + if (en_column[i] == "Leviathan") { + en_width[i] = 200; + en_height[i] = 128; + } + if (en_column[i] == "Razorfiend") { + en_width[i] = 160; + en_height[i] = 128; + } + if (en_column[i] == "Stalker") { + en_width[i] = 96; + en_height[i] = 64; + } + if (en_column[i] == "Prowler") { + en_width[i] = 80; + en_height[i] = 64; + } + + if (en_column[i] == "Cairn Class Tombship") { + en_width[i] = 256; + en_height[i] = 224; + } + if (en_column[i] == "Reaper Class") { + en_width[i] = 286; + en_height[i] = 161; + } + if (en_column[i] == "Shroud Class") { + en_width[i] = 200; + en_height[i] = 150; + } + if (en_column[i] == "Jackal Class") { + en_width[i] = 99; + en_height[i] = 123; + } + if (en_column[i] == "Dirge Class") { + en_width[i] = 100; + en_height[i] = 91; + } } } action_set_alarm(1, 1); - diff --git a/objects/obj_fleet_spawner/Alarm_1.gml b/objects/obj_fleet_spawner/Alarm_1.gml index c802db6cd4..24b9baefb2 100644 --- a/objects/obj_fleet_spawner/Alarm_1.gml +++ b/objects/obj_fleet_spawner/Alarm_1.gml @@ -1,64 +1,66 @@ +var _enemy_ship; +var _enemy_ship_x_coord = 0; +var _enemy_ship_y_coord = 0; + +if ((owner == eFACTION.Imperium) || (owner == eFACTION.Eldar)) { + // This is an orderly Imperial ship formation + var fuck = 0; + if (obj_fleet.enemy_status[number] < 0) { + _enemy_ship_x_coord = 1200; + fuck = 5; + } else if (obj_fleet.enemy_status[number] > 0) { + _enemy_ship_x_coord = 50; + fuck = 0; + } + repeat (4) { + if (obj_fleet.enemy_status[number] < 0) { + fuck -= 1; + } + if (obj_fleet.enemy_status[number] > 0) { + fuck += 1; + } - -if (owner = eFACTION.Imperium) or (owner = eFACTION.Eldar){// This is an orderly Imperial ship formation - var xx,yy,i, temp1, x2, man; - xx=0;yy=0;i=0;temp1=0;x2=0;man=0; - var fuck=0; - if (obj_fleet.enemy_status[number]<0){ - x2=1200; - fuck=5 - }else if (obj_fleet.enemy_status[number]>0){ - x2=50; - fuck=0; - } - - repeat(4){ - if (obj_fleet.enemy_status[number]<0) then fuck-=1; - if (obj_fleet.enemy_status[number]>0) then fuck+=1; - - yy=y-((en_height[fuck]*en_num[fuck])/2); - if (en_num[fuck]>0){ - yy+=(en_height[fuck]/2); - repeat(en_num[fuck]){ - if (en_size[fuck]<3){ - if (obj_fleet.enemy_status[number]<0){ - man=instance_create(x2,yy,obj_en_cruiser); - yy+=en_height[fuck]; - man.class=en_column[fuck]; - man.owner=owner; - man.size=en_size[fuck]; + _enemy_ship_y_coord = y - ((en_height[fuck] * en_num[fuck]) / 2); + if (en_num[fuck] > 0) { + _enemy_ship_y_coord += en_height[fuck] / 2; + repeat (en_num[fuck]) { + if (en_size[fuck] < 3) { + if (obj_fleet.enemy_status[number] < 0) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[fuck]; + _enemy_ship.class = en_column[fuck]; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[fuck]; } - if (obj_fleet.enemy_status[number]>0){ - man=instance_create(x2,yy,obj_al_cruiser); - yy+=en_height[fuck]; - man.class=en_column[fuck]; - man.owner=owner; - man.size=en_size[fuck]; + if (obj_fleet.enemy_status[number] > 0) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_al_cruiser); + _enemy_ship_y_coord += en_height[fuck]; + _enemy_ship.class = en_column[fuck]; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[fuck]; } } - if (en_size[fuck]>=3){ - if (obj_fleet.enemy_status[number]<0){ - man=instance_create(x2,yy,obj_en_capital); - yy+=en_height[fuck]; - man.class=en_column[fuck]; - man.owner=owner; - man.size=en_size[fuck]; + if (en_size[fuck] >= 3) { + if (obj_fleet.enemy_status[number] < 0) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_capital); + _enemy_ship_y_coord += en_height[fuck]; + _enemy_ship.class = en_column[fuck]; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[fuck]; + } else if (obj_fleet.enemy_status[number] > 0) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_al_capital); + _enemy_ship_y_coord += en_height[fuck]; + _enemy_ship.class = en_column[fuck]; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[fuck]; } - else if (obj_fleet.enemy_status[number]>0){ - man=instance_create(x2,yy,obj_al_capital); - yy+=en_height[fuck]; - man.class=en_column[fuck]; - man.owner=owner; - man.size=en_size[fuck];} } } - x2+=en_width[fuck]; + _enemy_ship_x_coord += en_width[fuck]; } } - - - + /* if (en_num[4]>0){ yy=y-((en_height[4]*en_num[4])/2); @@ -105,11 +107,6 @@ if (owner = eFACTION.Imperium) or (owner = eFACTION.Eldar){// This is an orderly }*/ } - - - - - /* if (en_escort>0){en_column[4]="Aconite";en_num[4]=max(1,floor(en_escort/2));en_size[4]=1;} if (en_escort>1){en_column[3]="Hellebore";en_num[3]=max(1,floor(en_escort/2));en_size[3]=1;} @@ -117,7 +114,6 @@ if (en_frigate>0){en_column[2]="Shadow Class";en_num[2]=en_frigate;en_size[2]=2; if (en_capital>0){en_column[1]="Void Stalker";en_num[1]=en_capital;en_size[1]=3;} */ - /* if (owner = eFACTION.Eldar){// This is an orderly Eldar ship formation var xx,yy,i, temp1, x2, man; @@ -166,188 +162,170 @@ if (owner = eFACTION.Eldar){// This is an orderly Eldar ship formation } }*/ +if ((owner == eFACTION.Ork) || (owner == eFACTION.Chaos)) { + // This is spew out random ships without regard for formations - - - - -if (owner = eFACTION.Ork) or (owner = eFACTION.Chaos){// This is spew out random ships without regard for formations - var xx,yy,dist,targ,numb,man; - xx=0;yy=0;dist=0;targ=0;numb=0;man=0; - - var i;i=0; - - repeat(5){ - - i+=1; - - if (en_column[i]!="") then for(s = 0; s < en_num[i]; s += 1){ - if (en_size[i]>1) then man=instance_create(random_range(1200,1400),round(random_range(y,y+height)+50),obj_en_capital); - if (en_size[i]=1) then man=instance_create(random_range(1200,1400),round(random_range(y,y+height)+50),obj_en_cruiser); - man.class=en_column[i]; - man.owner=owner; - man.size=en_size[i]; + for (var i = 0; i < 5; i++) { + if (en_column[i] != "") { + repeat (en_num[i]) { + if (en_size[i] > 1) { + _enemy_ship = instance_create(random_range(1200, 1400), round(random_range(y, y + height) + 50), obj_en_capital); + } + if (en_size[i] == 1) { + _enemy_ship = instance_create(random_range(1200, 1400), round(random_range(y, y + height) + 50), obj_en_cruiser); + } + _enemy_ship.class = en_column[i]; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[i]; + } } - - } } - - - - - - -if (owner = eFACTION.Tau){// This is an orderly Tau ship formation - var xx,yy,i, temp1, x2, man; - xx=0;yy=0;i=0;temp1=0;x2=1200;man=0; - - yy=y-((en_height[5]*en_num[5])/2); - yy+=(en_height[5]/2); - repeat(en_num[5]){ - man=instance_create(x2,yy,obj_en_cruiser); - yy+=en_height[5]; - man.class="Warden";man.owner=owner; - man.size=en_size[5]; +if (owner == eFACTION.Tau) { + // This is an orderly Tau ship formation + + _enemy_ship_y_coord = y - ((en_height[5] * en_num[5]) / 2); + _enemy_ship_y_coord += en_height[5] / 2; + repeat (en_num[5]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[5]; + _enemy_ship.class = "Warden"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[5]; } - x2+=en_width[5]; - - yy=y-((en_height[2]*en_num[2])/2)-((en_height[3]*en_num[3])/2); - yy+=(en_height[2]/2); - yy+=(en_height[3]/2); - repeat(en_num[2]){ - man=instance_create(x2,yy,obj_en_cruiser); - yy+=en_height[2]; - man.class="Emissary";man.owner=owner; - man.size=en_size[2]; + _enemy_ship_x_coord += en_width[5]; + + _enemy_ship_y_coord = y - ((en_height[2] * en_num[2]) / 2) - ((en_height[3] * en_num[3]) / 2); + _enemy_ship_y_coord += en_height[2] / 2; + _enemy_ship_y_coord += en_height[3] / 2; + repeat (en_num[2]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[2]; + _enemy_ship.class = "Emissary"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[2]; } - repeat(en_num[3]){ - man=instance_create(x2,yy,obj_en_cruiser); - yy+=en_height[3]; - man.class="Protector";man.owner=owner; - man.size=en_size[3]; + repeat (en_num[3]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[3]; + _enemy_ship.class = "Protector"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[3]; } - x2+=max(en_width[2],en_width[3]); - - yy=y-((en_height[4]*en_num[4])/2); - yy+=(en_height[4]/2); - repeat(en_num[4]){ - man=instance_create(x2,yy,obj_en_cruiser); - yy+=en_height[4]; - man.class="Castellan";man.owner=owner; - man.size=en_size[4]; + _enemy_ship_x_coord += max(en_width[2], en_width[3]); + + _enemy_ship_y_coord = y - ((en_height[4] * en_num[4]) / 2); + _enemy_ship_y_coord += en_height[4] / 2; + repeat (en_num[4]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[4]; + _enemy_ship.class = "Castellan"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[4]; } - x2+=en_width[4]; - - yy=y-((en_height[1]*en_num[1])/2); - yy+=(en_height[1]/2); - repeat(en_num[1]){ - man=instance_create(x2,yy,obj_en_capital); - yy+=en_height[1]; - man.class="Custodian";man.owner=owner; - man.size=en_size[1]; + _enemy_ship_x_coord += en_width[4]; + + _enemy_ship_y_coord = y - ((en_height[1] * en_num[1]) / 2); + _enemy_ship_y_coord += en_height[1] / 2; + repeat (en_num[1]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_capital); + _enemy_ship_y_coord += en_height[1]; + _enemy_ship.class = "Custodian"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[1]; } - } - - - -if (owner = eFACTION.Tyranids){// This is an orderly Tyranid ship formation - var xx,yy,i, temp1, x2, man; - xx=0;yy=0;i=0;temp1=0;x2=1200;man=0; - - yy=y-((en_height[4]*en_num[4])/2); - yy+=(en_height[4]/2); - repeat(en_num[4]){ - man=instance_create(x2,yy,obj_en_cruiser); - yy+=en_height[4]; - man.class="Prowler";man.owner=owner; - man.size=en_size[4]; +if (owner == eFACTION.Tyranids) { + // This is an orderly Tyranid ship formation + + _enemy_ship_y_coord = y - ((en_height[4] * en_num[4]) / 2); + _enemy_ship_y_coord += en_height[4] / 2; + repeat (en_num[4]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[4]; + _enemy_ship.class = "Prowler"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[4]; } - x2+=en_width[4]; - - yy=y-((en_height[3]*en_num[3])/2); - yy+=(en_height[3]/2); - repeat(en_num[3]){ - man=instance_create(x2,yy,obj_en_cruiser); - yy+=en_height[3]; - man.class="Razorfiend";man.owner=owner; - man.size=en_size[3]; + _enemy_ship_x_coord += en_width[4]; + + _enemy_ship_y_coord = y - ((en_height[3] * en_num[3]) / 2); + _enemy_ship_y_coord += en_height[3] / 2; + repeat (en_num[3]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[3]; + _enemy_ship.class = "Razorfiend"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[3]; } - x2+=en_width[3]; - - yy=y-((en_height[2]*en_num[2])/2); - yy+=(en_height[2]/2); - repeat(en_num[2]){ - man=instance_create(x2,yy,obj_en_cruiser); - yy+=en_height[2]; - man.class="Stalker";man.owner=owner; - man.size=en_size[2]; + _enemy_ship_x_coord += en_width[3]; + + _enemy_ship_y_coord = y - ((en_height[2] * en_num[2]) / 2); + _enemy_ship_y_coord += en_height[2] / 2; + repeat (en_num[2]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[2]; + _enemy_ship.class = "Stalker"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[2]; } - x2+=en_width[2]; - - yy=y-((en_height[1]*en_num[1])/2); - yy+=(en_height[1]/2); - repeat(en_num[1]){ - man=instance_create(x2,yy,obj_en_capital); - yy+=en_height[1]; - man.class="Leviathan";man.owner=owner; - man.size=en_size[1]; + _enemy_ship_x_coord += en_width[2]; + + _enemy_ship_y_coord = y - ((en_height[1] * en_num[1]) / 2); + _enemy_ship_y_coord += en_height[1] / 2; + repeat (en_num[1]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_capital); + _enemy_ship_y_coord += en_height[1]; + _enemy_ship.class = "Leviathan"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[1]; } - } +if (owner == eFACTION.Necrons) { + // This is an orderly Necron ship formation - - -if (owner = eFACTION.Necrons){// This is an orderly Necron ship formation - var xx,yy,i, temp1, x2, man; - xx=0;yy=0;i=0;temp1=0;x2=1200;man=0; - - yy=y-((en_height[4]*en_num[4])/2); - yy+=(en_height[4]/2); - repeat(en_num[4]){ - man=instance_create(x2,yy,obj_en_cruiser); - yy+=en_height[4]; - man.class="Dirge Class";man.owner=owner; - man.size=en_size[4]; + _enemy_ship_y_coord = (y - ((en_height[4] * en_num[4]) / 2)) + (en_height[4] / 2); // Magic number + repeat (en_num[4]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[4]; + _enemy_ship.class = "Dirge Class"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[4]; } - x2+=en_width[4]; - - yy=y-((en_height[3]*en_num[3])/2); - yy+=(en_height[3]/2); - repeat(en_num[3]){ - man=instance_create(x2,yy,obj_en_cruiser); - yy+=en_height[3]; - man.class="Jackal Class";man.owner=owner; - man.size=en_size[3]; + _enemy_ship_x_coord += en_width[4]; + + _enemy_ship_y_coord = (y - ((en_height[3] * en_num[3]) / 2)) + (en_height[3] / 2); + repeat (en_num[3]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[3]; + _enemy_ship.class = "Jackal Class"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[3]; } - x2+=en_width[3]; - - yy=y-((en_height[2]*en_num[2])/2); - yy+=(en_height[2]/2); - repeat(en_num[2]){ - man=instance_create(x2,yy,obj_en_cruiser); - yy+=en_height[2]; - man.class="Shroud Class";man.owner=owner; - man.size=en_size[2]; + _enemy_ship_x_coord += en_width[3]; + + _enemy_ship_y_coord = (y - ((en_height[2] * en_num[2]) / 2)) + (en_height[2] / 2); + repeat (en_num[2]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_cruiser); + _enemy_ship_y_coord += en_height[2]; + _enemy_ship.class = "Shroud Class"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[2]; } - x2+=en_width[2]; - - yy=y-((en_height[1]*en_num[1])/2); - yy+=(en_height[1]/2); - repeat(en_num[1]){ - man=instance_create(x2,yy,obj_en_capital); - yy+=en_height[1]; - man.class="Reaper Class";man.owner=owner; - man.size=en_size[1]; + _enemy_ship_x_coord += en_width[2]; + + _enemy_ship_y_coord = (y - ((en_height[1] * en_num[1]) / 2)) + (en_height[1] / 2); + repeat (en_num[1]) { + _enemy_ship = instance_create(_enemy_ship_x_coord, _enemy_ship_y_coord, obj_en_capital); + _enemy_ship_y_coord += en_height[1]; + _enemy_ship.class = "Reaper Class"; + _enemy_ship.owner = owner; + _enemy_ship.size = en_size[1]; } } - - - /* */ /* */ diff --git a/objects/obj_fleet_spawner/Create_0.gml b/objects/obj_fleet_spawner/Create_0.gml index c5b8d2262e..f4a6860d47 100644 --- a/objects/obj_fleet_spawner/Create_0.gml +++ b/objects/obj_fleet_spawner/Create_0.gml @@ -1,16 +1,17 @@ +owner = 0; +height = 0; +number = 0; -owner=0; -height=0; -number=0; +en_escort = 0; +en_frigate = 0; +en_capital = 0; -alarm[0]=1; +alarm[0] = 1; -var i,t;i=-1;t=0; -repeat(11){i+=1; - en_column[i]="";en_width[i]=0; - en_height[i]=0;en_num[i]=0; - en_size[i]=0; +for (var i = 0; i <= 10; i++) { + en_column[i] = ""; + en_width[i] = 0; + en_height[i] = 0; + en_num[i] = 0; + en_size[i] = 0; } - - - diff --git a/objects/obj_fleet_spawner/Draw_0.gml b/objects/obj_fleet_spawner/Draw_0.gml index 66553f6253..f148fa62a6 100644 --- a/objects/obj_fleet_spawner/Draw_0.gml +++ b/objects/obj_fleet_spawner/Draw_0.gml @@ -1,13 +1,15 @@ - - exit; - -var y1,y2; -y1=y-(height/2); -y2=y+(height/2); - -draw_set_color(CM_GREEN_COLOR);draw_set_alpha(1); - -if (x<800) then draw_rectangle(-300,y1,300,y2,0); -if (x>800) then draw_rectangle((room_width)-300,y1,room_width+300,y2,0); - +/* // Everything below is unreachable due to above exit statement. I assume we don't want to see the spawners, except maybe in debug mode? In which case why not add a debug mode check like elsewhere. +var y1, y2; +y1 = y - (height / 2); +y2 = y + (height / 2); + +draw_set_color(CM_GREEN_COLOR); +draw_set_alpha(1); + +if (x < 800) { + draw_rectangle(-300, y1, 300, y2, 0); +} +if (x > 800) { + draw_rectangle(room_width - 300, y1, room_width + 300, y2, 0); +}*/ diff --git a/objects/obj_ncombat/Alarm_0.gml b/objects/obj_ncombat/Alarm_0.gml index 67536c6ca3..9dbf7e0240 100644 --- a/objects/obj_ncombat/Alarm_0.gml +++ b/objects/obj_ncombat/Alarm_0.gml @@ -30,8 +30,7 @@ try { fortified = 0; } - var i = 0, u; - i = xxx / 10; + var u; if ((fortified > 1) && (enemy + threat != 17)) { u = instance_create(0, 0, obj_nfort); @@ -63,11 +62,14 @@ try { u.maxhp[1] = u.hp[1]; } - for (var j = 0; j < 10; j++) { - i -= 1; - u = instance_create(i * 10, 240, obj_enunit); - u.column = i - ((xxx / 10) - 10); + var u_index = (xxx / 10); + + for (var i = 0; i < 10; i++) { + u_index--; + u = instance_create(u_index * 10, 240, obj_enunit); + u.column = u_index - ((xxx / 10) - 10); } + // *** Enemy Forces Special Event *** // * Malcadon Spyrer * if (string_count("spyrer", battle_special) > 0) { diff --git a/objects/obj_ncombat/Create_0.gml b/objects/obj_ncombat/Create_0.gml index 4aacc7ff6a..b238f861d3 100644 --- a/objects/obj_ncombat/Create_0.gml +++ b/objects/obj_ncombat/Create_0.gml @@ -3,23 +3,17 @@ if (instance_number(obj_ncombat) > 1) { } set_zoom_to_default(); -var co, i; -co = -1; -co = 0; -i = 0; -hue = 0; +hue = 0; turn_count = 0; + log_message("Ground Combat Started"); audio_stop_sound(snd_royal); audio_play_sound(snd_battle, 0, true); audio_sound_gain(snd_battle, 0, 0); -var nope = 0; -if ((obj_controller.master_volume == 0) || (obj_controller.music_volume == 0)) { - nope = 1; -} -if (nope != 1) { + +if ((obj_controller.master_volume != 0) && (obj_controller.music_volume != 0)) { audio_sound_gain(snd_battle, 0.25 * obj_controller.master_volume * obj_controller.music_volume, 2000); } @@ -57,11 +51,9 @@ instance_activate_object(obj_cursor); instance_activate_object(obj_ini); instance_activate_object(obj_img); -var i, u; -i = 11; -repeat (10) { - i -= 1; // This creates the objects to then be filled in - u = instance_create(i * 10, 240, obj_pnunit); +var u; +for (var i = 10; i >= 0; i--) { + u = instance_create(i * 10, 240, obj_pnunit); // This creates the objects to then be filled in } instance_create(0, 0, obj_centerline); @@ -140,7 +132,6 @@ enemy_forces = 0; enemy_max = 0; hulk_forces = 0; -i = -1; combat_messages = []; combat_messages_to_show = 24; combat_messages_shown = 0; @@ -152,8 +143,7 @@ dead_enemies = 0; units_lost_counts = {}; vehicles_lost_counts = {}; -repeat (70) { - i += 1; +for (var i = 0; i < 70; i++) { lines[i] = ""; lines_color[i] = ""; combat_messages[i] = ""; @@ -269,60 +259,73 @@ ambushers = 0; if (scr_has_adv("Ambushers")) { ambushers = 1; } + bolter_drilling = 0; if (scr_has_adv("Bolter Drilling")) { bolter_drilling = 1; } + enemy_eldar = 0; if (scr_has_adv("Enemy: Eldar")) { enemy_eldar = 1; } + enemy_fallen = 0; if (scr_has_adv("Enemy: Fallen")) { enemy_fallen = 1; } + enemy_orks = 0; if (scr_has_adv("Enemy: Orks")) { enemy_orks = 1; } + enemy_tau = 0; if (scr_has_adv("Enemy: Tau")) { enemy_tau = 1; } + enemy_tyranids = 0; if (scr_has_adv("Enemy: Tyranids")) { enemy_tyranids = 1; } + enemy_necrons = 0; if (scr_has_adv("Enemy: Necrons")) { enemy_necrons = 1; } + lightning = 0; if (scr_has_adv("Lightning Warriors")) { lightning = 1; } + siege = 0; if (scr_has_adv("Siege Masters")) { siege = 1; } + slow = 0; if (scr_has_adv("Devastator Doctrine")) { slow = 1; } + melee = 0; if (scr_has_adv("Assault Doctrine")) { melee = 1; } -// + black_rage = 0; if (scr_has_disadv("Black Rage")) { black_rage = 1; red_thirst = 1; } + shitty_luck = 0; if (scr_has_disadv("Shitty Luck")) { shitty_luck = 1; } + favoured_by_the_warp = 0; if (scr_has_adv("Favoured By The Warp")) { favoured_by_the_warp = 1; @@ -336,12 +339,12 @@ betchers = obj_ini.betchers; // slight melee penalty catalepsean = obj_ini.catalepsean; // minor global attack decrease occulobe = obj_ini.occulobe; // penalty if morning and susceptible to flash grenades mucranoid = obj_ini.mucranoid; // chance to short-circuit -// + global_melee = 1; global_bolter = 1; global_attack = 1; global_defense = 1; -// + if ((ambushers == 1) && (ambushers == 999)) { global_attack = global_attack * 1.1; } From 1f1ac33f006834690c85856f120ca48572aaedcd Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sun, 28 Dec 2025 17:36:52 -0500 Subject: [PATCH 42/45] Fixed a few GM1041 errors about mismatching types. These should theoretically result in further improvements to stability. --- objects/obj_creation/Create_0.gml | 6 +- scripts/NameGenerator/NameGenerator.gml | 2 +- .../scr_punit_combat_heplers.gml | 390 +++++++++--------- 3 files changed, 198 insertions(+), 200 deletions(-) diff --git a/objects/obj_creation/Create_0.gml b/objects/obj_creation/Create_0.gml index 635fe0ee29..d8f730d264 100644 --- a/objects/obj_creation/Create_0.gml +++ b/objects/obj_creation/Create_0.gml @@ -311,7 +311,7 @@ enum eCHAPTER_ORIGINS { * @description chapter constructor. This is just for the main menu bit, the full data comes in scr_chapter_new * @param {Enum.eCHAPTERS} _id e.g. CHAPTERS.DARK_ANGELS * @param {Enum.eCHAPTER_ORIGINS} _origin e.g. CHAPTER_ORIGIN.FOUNDING - * @param {Enum.eCHAPTERS} _progenitor This chapter's founding chapter, if one exits. Use 0 if none. + * @param {Enum.ePROGENITOR} _progenitor This chapter's founding chapter, if one exits. Use 0 if none. * @param {String} _name e.g. "Dark Angels" * @param {String} _tooltip e.g. "Some extremely lore friendly backstory" */ @@ -330,7 +330,7 @@ function ChapterDataLite(_id, _origin, _progenitor, _name, _tooltip, _icon_name // For new additions, as long as the order in the array is the same as the enum order, //you will be able to index the array by using syntax like so: `var dark_angels = all_chapters[CHAPTERS.DARK_ANGELS]` -all_chapters = [new ChapterDataLite(eCHAPTERS.UNKNOWN, eCHAPTER_ORIGINS.NONE, 0, "Unknown", "Error: The tooltip is missing", "unknown"), new ChapterDataLite(eCHAPTERS.DARK_ANGELS, eCHAPTER_ORIGINS.FOUNDING, 0, "Dark Angels", "The Dark Angels claim complete allegiance and service to the Emperor of Mankind, though their actions and secret goals seem to run counter to this- above all other things they strive to atone for an ancient crime of betrayal.", "dark_angels"), new ChapterDataLite(eCHAPTERS.WHITE_SCARS, eCHAPTER_ORIGINS.FOUNDING, 0, "White Scars", "Known and feared for their highly mobile way of war, the White Scars are the masters of lightning strikes and hit-and-run tactics. They are particularly adept in the use of Attack Bikes and field large numbers of them.", "white_scars"), new ChapterDataLite(eCHAPTERS.SPACE_WOLVES, eCHAPTER_ORIGINS.FOUNDING, 0, "Space Wolves", "Brave sky warriors hailing from the icy deathworld of Fenris, the Space Wolves are a non-Codex compliant chapter, and deadly in close combat. They fight on their own terms and damn any who wish otherwise.", "space_wolves"), new ChapterDataLite(eCHAPTERS.IMPERIAL_FISTS, eCHAPTER_ORIGINS.FOUNDING, 0, "Imperial Fists", "Siege-masters of utmost excellence, the Imperial Fists stoicism has lead them to great victories and horrifying defeats. To them, the idea of a tactical retreat is utterly inconsiderable. They hold ground on Inwit vigilantly, refusing to back down from any fight.", "imperial_fists"), new ChapterDataLite(eCHAPTERS.BLOOD_ANGELS, eCHAPTER_ORIGINS.FOUNDING, 0, "Blood Angels", "One of the most noble and renowned chapters, their combat record belies a dark flaw in their gene-seed caused by the death of their primarch. Their primarch had wings and a propensity for close combat, and this shows in their extensive use of jump packs and close quarters weapons.", "blood_angels"), new ChapterDataLite(eCHAPTERS.IRON_HANDS, eCHAPTER_ORIGINS.FOUNDING, 0, "Iron Hands", "The flesh is weak, and the weak shall perish. Such is the creed of these mercilessly efficient cyborg warriors. A chapter with strong ties to the Mechanicum, they crush the foes of the Emperor and Machine God alike with a plethora of exotic technology and ancient weaponry.", "iron_hands"), new ChapterDataLite(eCHAPTERS.ULTRAMARINES, eCHAPTER_ORIGINS.FOUNDING, 0, "Ultramarines", "An honourable and venerated chapter, the Ultramarines are considered to be amongst the best of the best. Their Primarch was the author of the great tome of the “Codex Astartes”, and they are considered exemplars of what a perfect Space Marine Chapter should be like.", "ultramarines"), new ChapterDataLite(eCHAPTERS.SALAMANDERS, eCHAPTER_ORIGINS.FOUNDING, 0, "Salamanders", "Followers of the Promethean Cult, the jet-black skinned Salamanders are forgemasters of legend. They are armed with the best wargear available and prefer flame based weaponry. Their only drawback is their low numbers and slow recruiting.", "salamanders"), new ChapterDataLite(eCHAPTERS.RAVEN_GUARD, eCHAPTER_ORIGINS.FOUNDING, 0, "Raven Guard", "Clinging to the shadows and riding the edge of lightning the Raven Guard strike out at the hated enemy with stealth and speed. Using lightning strikes, hit and run tactics, and guerrilla warfare, they are known for being there one second and gone the next.", "raven_guard"), new ChapterDataLite(eCHAPTERS.BLACK_TEMPLARS, eCHAPTER_ORIGINS.SUCCESSOR, eCHAPTERS.IMPERIAL_FISTS, "Black Templars", "Not adhering to the Codex Astartes, Black Templars are a Chapter on an Eternal Crusade with unique organization and high numbers. Masters of assault, they charge at the enemy with zeal unmatched. They hate psykers, and as such, have no Librarians.", "black_templars"), new ChapterDataLite(eCHAPTERS.MINOTAURS, eCHAPTER_ORIGINS.SUCCESSOR, eCHAPTERS.IMPERIAL_FISTS, "Minotaurs", "Bronze-clad Astartes of unknown Founding, the Minotaurs prefer to channel their righteous fury in a massive storm of fire, with tanks and artillery. They could be considered the Inquisition’s attack dog, since they often attack fellow chapters suspected of heresy.", "minotaurs"), new ChapterDataLite(eCHAPTERS.BLOOD_RAVENS, eCHAPTER_ORIGINS.SUCCESSOR, 0, "Blood Ravens", "Of unknown origins and Founding, the origins of the Blood Ravens are shrouded in mystery and are believed to be tied to a dark truth. This elusive Chapter is drawn to the pursuit of knowledge and ancient lore and produces an unusually high number of Librarians.", "blood_ravens"), new ChapterDataLite(eCHAPTERS.CRIMSON_FISTS, eCHAPTER_ORIGINS.SUCCESSOR, eCHAPTERS.IMPERIAL_FISTS, "Crimson Fists", "An Imperial Fists descendant, the Crimson Fists are more level-minded than their Progenitor and brother chapters. They suffer the same lacking zygotes as their ancestors, and more resemble the Ultramarines in their balanced approach to combat. After surviving a devastating Ork WAAAGH! the chapter clings dearly to its future.", "crimson_fists"), new ChapterDataLite(eCHAPTERS.LAMENTERS, eCHAPTER_ORIGINS.SUCCESSOR, eCHAPTERS.BLOOD_ANGELS, "Lamenters", "The Lamenter's accursed and haunted legacy seems to taint much of what they have achieved; their victories often become bitter ashes in their hands. Nearly extinct, they fight their last days on behalf of the common folk in a crusade of endless penitence.", "lamenters"), new ChapterDataLite(eCHAPTERS.CARCHARODONS, eCHAPTER_ORIGINS.SUCCESSOR, eCHAPTERS.RAVEN_GUARD, "Carcharodons", "Rumored to be Successors of the Raven Guard, these Astartes are known for their sudden attacks and shock assaults. Travelling through the Imperium via self-sufficient Nomad-Predation based fleets, no enemy is safe from the fury of these bloodthirsty Space Marines.", "carcharodons"), new ChapterDataLite(eCHAPTERS.SOUL_DRINKERS, eCHAPTER_ORIGINS.SUCCESSOR, eCHAPTERS.IMPERIAL_FISTS, "Soul Drinkers", "Sharing ancestry of the Black Templars or Crimson fists. As proud sons of Dorn they share the strong void combat traditions, fielding a large amount of Battle Barges. As well as being fearsome in close combat. Whispers of the Ruinous Powers are however quite enticing.", "soul_drinkers"), new ChapterDataLite(eCHAPTERS.ANGRY_MARINES, eCHAPTER_ORIGINS.NON_CANON, 0, "Angry Marines", "Frothing with pathological rage since the day their Primarch emerged from his pod with naught but a dented copy of battletoads. Every last Angry Marine is a homicidal, suicidal berserker with a voice that projects, and are always angry, all the time. A /tg/ classic.", "angry_marines"), new ChapterDataLite(eCHAPTERS.EMPERORS_NIGHTMARE, eCHAPTER_ORIGINS.NON_CANON, 0, "Emperor’s Nightmare", "The Emperor's Nightmare bear the curse of a bizarre mutation within their gene-seed. The Catalepsean Node is in a state of decay and thus do not sleep for months at a time until falling asleep suddenly. They prefer shock and awe tactics with stealth.", "emperors_nightmare"), new ChapterDataLite(eCHAPTERS.STAR_KRAKENS, eCHAPTER_ORIGINS.NON_CANON, 0, "Star Krakens", "In darkness, they dwell in The Deep. The Star Krakens stand divided in individual companies but united in the form of the Ten-Flag Council. They utilize boarding tactics and are the sole guardians of the ancient sensor array called “The Lighthouse”.", "star_krakens"), new ChapterDataLite(eCHAPTERS.CONSERVATORS, eCHAPTER_ORIGINS.NON_CANON, 0, "Conservators", "Hailing from the Asharn Marches and having established their homeworld on the planet Dekara, these proud sons of Dorn suffer from an extreme lack of supplies, Ork raids, and more. Though under strength and lacking equipment, they managed to forge an interstellar kingdom loyal to both Emperor and Imperium.", "conservators"), new ChapterDataLite(eCHAPTERS.CUSTOM_1, eCHAPTER_ORIGINS.CUSTOM, 0, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_2, eCHAPTER_ORIGINS.CUSTOM, 0, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_3, eCHAPTER_ORIGINS.CUSTOM, 0, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_4, eCHAPTER_ORIGINS.CUSTOM, 0, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_5, eCHAPTER_ORIGINS.CUSTOM, 0, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_6, eCHAPTER_ORIGINS.CUSTOM, 0, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_7, eCHAPTER_ORIGINS.CUSTOM, 0, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_8, eCHAPTER_ORIGINS.CUSTOM, 0, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_9, eCHAPTER_ORIGINS.CUSTOM, 0, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_10, eCHAPTER_ORIGINS.CUSTOM, 0, "Custom", "Your Chapter")]; +all_chapters = [new ChapterDataLite(eCHAPTERS.UNKNOWN, eCHAPTER_ORIGINS.NONE, ePROGENITOR.NONE, "Unknown", "Error: The tooltip is missing", "unknown"), new ChapterDataLite(eCHAPTERS.DARK_ANGELS, eCHAPTER_ORIGINS.FOUNDING, ePROGENITOR.NONE, "Dark Angels", "The Dark Angels claim complete allegiance and service to the Emperor of Mankind, though their actions and secret goals seem to run counter to this- above all other things they strive to atone for an ancient crime of betrayal.", "dark_angels"), new ChapterDataLite(eCHAPTERS.WHITE_SCARS, eCHAPTER_ORIGINS.FOUNDING, ePROGENITOR.NONE, "White Scars", "Known and feared for their highly mobile way of war, the White Scars are the masters of lightning strikes and hit-and-run tactics. They are particularly adept in the use of Attack Bikes and field large numbers of them.", "white_scars"), new ChapterDataLite(eCHAPTERS.SPACE_WOLVES, eCHAPTER_ORIGINS.FOUNDING, ePROGENITOR.NONE, "Space Wolves", "Brave sky warriors hailing from the icy deathworld of Fenris, the Space Wolves are a non-Codex compliant chapter, and deadly in close combat. They fight on their own terms and damn any who wish otherwise.", "space_wolves"), new ChapterDataLite(eCHAPTERS.IMPERIAL_FISTS, eCHAPTER_ORIGINS.FOUNDING, ePROGENITOR.NONE, "Imperial Fists", "Siege-masters of utmost excellence, the Imperial Fists stoicism has lead them to great victories and horrifying defeats. To them, the idea of a tactical retreat is utterly inconsiderable. They hold ground on Inwit vigilantly, refusing to back down from any fight.", "imperial_fists"), new ChapterDataLite(eCHAPTERS.BLOOD_ANGELS, eCHAPTER_ORIGINS.FOUNDING, ePROGENITOR.NONE, "Blood Angels", "One of the most noble and renowned chapters, their combat record belies a dark flaw in their gene-seed caused by the death of their primarch. Their primarch had wings and a propensity for close combat, and this shows in their extensive use of jump packs and close quarters weapons.", "blood_angels"), new ChapterDataLite(eCHAPTERS.IRON_HANDS, eCHAPTER_ORIGINS.FOUNDING, ePROGENITOR.NONE, "Iron Hands", "The flesh is weak, and the weak shall perish. Such is the creed of these mercilessly efficient cyborg warriors. A chapter with strong ties to the Mechanicum, they crush the foes of the Emperor and Machine God alike with a plethora of exotic technology and ancient weaponry.", "iron_hands"), new ChapterDataLite(eCHAPTERS.ULTRAMARINES, eCHAPTER_ORIGINS.FOUNDING, ePROGENITOR.NONE, "Ultramarines", "An honourable and venerated chapter, the Ultramarines are considered to be amongst the best of the best. Their Primarch was the author of the great tome of the “Codex Astartes”, and they are considered exemplars of what a perfect Space Marine Chapter should be like.", "ultramarines"), new ChapterDataLite(eCHAPTERS.SALAMANDERS, eCHAPTER_ORIGINS.FOUNDING, ePROGENITOR.NONE, "Salamanders", "Followers of the Promethean Cult, the jet-black skinned Salamanders are forgemasters of legend. They are armed with the best wargear available and prefer flame based weaponry. Their only drawback is their low numbers and slow recruiting.", "salamanders"), new ChapterDataLite(eCHAPTERS.RAVEN_GUARD, eCHAPTER_ORIGINS.FOUNDING, ePROGENITOR.NONE, "Raven Guard", "Clinging to the shadows and riding the edge of lightning the Raven Guard strike out at the hated enemy with stealth and speed. Using lightning strikes, hit and run tactics, and guerrilla warfare, they are known for being there one second and gone the next.", "raven_guard"), new ChapterDataLite(eCHAPTERS.BLACK_TEMPLARS, eCHAPTER_ORIGINS.SUCCESSOR, ePROGENITOR.IMPERIAL_FISTS, "Black Templars", "Not adhering to the Codex Astartes, Black Templars are a Chapter on an Eternal Crusade with unique organization and high numbers. Masters of assault, they charge at the enemy with zeal unmatched. They hate psykers, and as such, have no Librarians.", "black_templars"), new ChapterDataLite(eCHAPTERS.MINOTAURS, eCHAPTER_ORIGINS.SUCCESSOR, ePROGENITOR.IMPERIAL_FISTS, "Minotaurs", "Bronze-clad Astartes of unknown Founding, the Minotaurs prefer to channel their righteous fury in a massive storm of fire, with tanks and artillery. They could be considered the Inquisition’s attack dog, since they often attack fellow chapters suspected of heresy.", "minotaurs"), new ChapterDataLite(eCHAPTERS.BLOOD_RAVENS, eCHAPTER_ORIGINS.SUCCESSOR, ePROGENITOR.NONE, "Blood Ravens", "Of unknown origins and Founding, the origins of the Blood Ravens are shrouded in mystery and are believed to be tied to a dark truth. This elusive Chapter is drawn to the pursuit of knowledge and ancient lore and produces an unusually high number of Librarians.", "blood_ravens"), new ChapterDataLite(eCHAPTERS.CRIMSON_FISTS, eCHAPTER_ORIGINS.SUCCESSOR, ePROGENITOR.IMPERIAL_FISTS, "Crimson Fists", "An Imperial Fists descendant, the Crimson Fists are more level-minded than their Progenitor and brother chapters. They suffer the same lacking zygotes as their ancestors, and more resemble the Ultramarines in their balanced approach to combat. After surviving a devastating Ork WAAAGH! the chapter clings dearly to its future.", "crimson_fists"), new ChapterDataLite(eCHAPTERS.LAMENTERS, eCHAPTER_ORIGINS.SUCCESSOR, ePROGENITOR.BLOOD_ANGELS, "Lamenters", "The Lamenter's accursed and haunted legacy seems to taint much of what they have achieved; their victories often become bitter ashes in their hands. Nearly extinct, they fight their last days on behalf of the common folk in a crusade of endless penitence.", "lamenters"), new ChapterDataLite(eCHAPTERS.CARCHARODONS, eCHAPTER_ORIGINS.SUCCESSOR, ePROGENITOR.RAVEN_GUARD, "Carcharodons", "Rumored to be Successors of the Raven Guard, these Astartes are known for their sudden attacks and shock assaults. Travelling through the Imperium via self-sufficient Nomad-Predation based fleets, no enemy is safe from the fury of these bloodthirsty Space Marines.", "carcharodons"), new ChapterDataLite(eCHAPTERS.SOUL_DRINKERS, eCHAPTER_ORIGINS.SUCCESSOR, ePROGENITOR.IMPERIAL_FISTS, "Soul Drinkers", "Sharing ancestry of the Black Templars or Crimson fists. As proud sons of Dorn they share the strong void combat traditions, fielding a large amount of Battle Barges. As well as being fearsome in close combat. Whispers of the Ruinous Powers are however quite enticing.", "soul_drinkers"), new ChapterDataLite(eCHAPTERS.ANGRY_MARINES, eCHAPTER_ORIGINS.NON_CANON, ePROGENITOR.NONE, "Angry Marines", "Frothing with pathological rage since the day their Primarch emerged from his pod with naught but a dented copy of battletoads. Every last Angry Marine is a homicidal, suicidal berserker with a voice that projects, and are always angry, all the time. A /tg/ classic.", "angry_marines"), new ChapterDataLite(eCHAPTERS.EMPERORS_NIGHTMARE, eCHAPTER_ORIGINS.NON_CANON, ePROGENITOR.NONE, "Emperor’s Nightmare", "The Emperor's Nightmare bear the curse of a bizarre mutation within their gene-seed. The Catalepsean Node is in a state of decay and thus do not sleep for months at a time until falling asleep suddenly. They prefer shock and awe tactics with stealth.", "emperors_nightmare"), new ChapterDataLite(eCHAPTERS.STAR_KRAKENS, eCHAPTER_ORIGINS.NON_CANON, ePROGENITOR.NONE, "Star Krakens", "In darkness, they dwell in The Deep. The Star Krakens stand divided in individual companies but united in the form of the Ten-Flag Council. They utilize boarding tactics and are the sole guardians of the ancient sensor array called “The Lighthouse”.", "star_krakens"), new ChapterDataLite(eCHAPTERS.CONSERVATORS, eCHAPTER_ORIGINS.NON_CANON, ePROGENITOR.NONE, "Conservators", "Hailing from the Asharn Marches and having established their homeworld on the planet Dekara, these proud sons of Dorn suffer from an extreme lack of supplies, Ork raids, and more. Though under strength and lacking equipment, they managed to forge an interstellar kingdom loyal to both Emperor and Imperium.", "conservators"), new ChapterDataLite(eCHAPTERS.CUSTOM_1, eCHAPTER_ORIGINS.CUSTOM, ePROGENITOR.NONE, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_2, eCHAPTER_ORIGINS.CUSTOM, ePROGENITOR.NONE, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_3, eCHAPTER_ORIGINS.CUSTOM, ePROGENITOR.NONE, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_4, eCHAPTER_ORIGINS.CUSTOM, ePROGENITOR.NONE, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_5, eCHAPTER_ORIGINS.CUSTOM, ePROGENITOR.NONE, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_6, eCHAPTER_ORIGINS.CUSTOM, ePROGENITOR.NONE, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_7, eCHAPTER_ORIGINS.CUSTOM, ePROGENITOR.NONE, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_8, eCHAPTER_ORIGINS.CUSTOM, ePROGENITOR.NONE, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_9, eCHAPTER_ORIGINS.CUSTOM, ePROGENITOR.NONE, "Custom", "Your Chapter"), new ChapterDataLite(eCHAPTERS.CUSTOM_10, eCHAPTER_ORIGINS.CUSTOM, ePROGENITOR.NONE, "Custom", "Your Chapter")]; var missing_splash = 99; var custom_splash = 97; @@ -364,7 +364,7 @@ for (var c = 1; c < 40; c++) { use_app_data = true; } var json_chapter = new ChapterData(); - var success = json_chapter.load_from_json(c, use_app_data); + var success = json_chapter.load_from_json(eCHAPTERS[c], use_app_data); if (success) { all_chapters[c] = new ChapterDataLite(json_chapter.id, json_chapter.origin, json_chapter.founding, json_chapter.name, json_chapter.flavor,); all_chapters[c].json = true; diff --git a/scripts/NameGenerator/NameGenerator.gml b/scripts/NameGenerator/NameGenerator.gml index e1018e92cb..0047256ed8 100644 --- a/scripts/NameGenerator/NameGenerator.gml +++ b/scripts/NameGenerator/NameGenerator.gml @@ -17,7 +17,7 @@ function NameGenerator() constructor { }; static LoadCompositeNames = function(file_name, json_names_property_names = ["prefixes", "suffixes", "special"]) { - if (json_names_property_names == noone) { + if (json_names_property_names == []) { json_names_property_names = ["prefixes", "suffixes", "special"]; } diff --git a/scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml b/scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml index f53a26c2d0..7210dcbfe4 100644 --- a/scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml +++ b/scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml @@ -2,22 +2,21 @@ // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information function squeeze_map_forces() { - try { - var _player_front_row = get_rightmost(); - var _enemy_front = get_leftmost(obj_enunit, false); - if (_player_front_row != "none" && _enemy_front != "none") { - if (!collision_point(_player_front_row.x + 10, _player_front_row.y, obj_enunit, 0, 1)) { - var _enemy_front = get_leftmost(obj_enunit, false); - if (_enemy_front != "none") { - var _move_distance = calculate_block_distances(_player_front_row, _enemy_front) - 2; - with (obj_pnunit) { - move_unit_block("east", _move_distance, true); - } - } - } - } + try { + var _player_front_row = get_rightmost(); + var _enemy_front = get_leftmost(obj_enunit, false); + if (_player_front_row != "none" && _enemy_front != "none") { + if (!collision_point(_player_front_row.x + 10, _player_front_row.y, obj_enunit, 0, 1)) { + if (_enemy_front != "none") { + var _move_distance = calculate_block_distances(_player_front_row, _enemy_front) - 2; + with (obj_pnunit) { + move_unit_block("east", _move_distance, true); + } + } + } + } - /* var _enemy_front = get_leftmost(obj_enunit, false); + /* var _enemy_front = get_leftmost(obj_enunit, false); if (_enemy_front!="none"){ var _player_front_row=get_rightmost(); if (_player_front_row!="none"){ @@ -30,147 +29,147 @@ function squeeze_map_forces() { } }*/ - var _player_rear = get_leftmost(); - if (_player_rear != "none") { - var _enemy_flank = get_rightmost(obj_enunit, true, false); - if (_enemy_flank != "none") { - if (_enemy_flank.flank) { - var _move_distance = calculate_block_distances(_player_rear, _enemy_flank) - 1; - with (obj_enunit) { - if (flank && _player_rear.x > x) { - move_unit_block("east", _move_distance, true); - } - } - } - } - } - } catch (_exception) { - handle_exception(_exception); - } + var _player_rear = get_leftmost(); + if (_player_rear != "none") { + var _enemy_flank = get_rightmost(obj_enunit, true, false); + if (_enemy_flank != "none") { + if (_enemy_flank.flank) { + var _move_distance = calculate_block_distances(_player_rear, _enemy_flank) - 1; + with (obj_enunit) { + if (flank && _player_rear.x > x) { + move_unit_block("east", _move_distance, true); + } + } + } + } + } + } catch (_exception) { + handle_exception(_exception); + } } function target_block_is_valid(target, desired_type) { - try { - var _is_valid = false; - if (target == "none") { - return false; - } - if (instance_exists(target)) { - if (target.x > 0 && target.object_index == desired_type) { - if (target.men + target.veh + target.dreads > 0) { - _is_valid = true; - } else { - x = -5000; - instance_deactivate_object(id); - } - } - } - return _is_valid; - } catch (_exception) { - handle_exception(_exception); - } + try { + var _is_valid = false; + if (target == noone) { + return false; + } + if (instance_exists(target)) { + if (target.x > 0 && target.object_index == desired_type) { + if (target.men + target.veh + target.dreads > 0) { + _is_valid = true; + } else { + x = -5000; + instance_deactivate_object(id); + } + } + } + return _is_valid; + } catch (_exception) { + handle_exception(_exception); + } } function get_rightmost(block_type = obj_pnunit, include_flanking = true, include_main_force = true) { - try { - var rightmost = "none"; - if (instance_exists(block_type)) { - with (block_type) { - if (!include_flanking && flank) { - continue; - } - if (!include_main_force && !flank) { - continue; - } - if (x <= 0) { - continue; - } - if (block_type == obj_pnunit) { - if (men + veh + dreads <= 0) { - x = -5000; - instance_deactivate_object(id); - continue; - } - } - if (rightmost == "none" && x > 0) { - rightmost = block_type.id; - } else { - if (x > rightmost.x) { - rightmost = id; - } - } - } - } - return rightmost; - } catch (_exception) { - handle_exception(_exception); - } + try { + var rightmost = noone; + if (instance_exists(block_type)) { + with (block_type) { + if (!include_flanking && flank) { + continue; + } + if (!include_main_force && !flank) { + continue; + } + if (x <= 0) { + continue; + } + if (block_type == obj_pnunit) { + if (men + veh + dreads <= 0) { + x = -5000; + instance_deactivate_object(id); + continue; + } + } + if (rightmost == noone && x > 0) { + rightmost = block_type.id; + } else { + if (x > rightmost.x) { + rightmost = id; + } + } + } + } + return rightmost; + } catch (_exception) { + handle_exception(_exception); + } } function block_has_armour(target) { - try { - return target.veh + target.dreads; - } catch (_exception) { - handle_exception(_exception); - } + try { + return target.veh + target.dreads; + } catch (_exception) { + handle_exception(_exception); + } } function get_leftmost(block_type = obj_pnunit, include_flanking = true) { - try { - var left_most = "none"; - if (instance_exists(block_type)) { - with (block_type) { - if (!include_flanking && flank) { - continue; - } - if (x <= 0) { - continue; - } - if (block_type == obj_pnunit) { - if (men + veh + dreads <= 0) { - x = -5000; - instance_deactivate_object(id); - continue; - } - } - if (left_most == "none" && x > 0) { - left_most = block_type.id; - } else { - if (x < left_most.x && x > 0) { - left_most = id; - } - } - } - } - return left_most; - } catch (_exception) { - handle_exception(_exception); - } + try { + var left_most = "none"; + if (instance_exists(block_type)) { + with (block_type) { + if (!include_flanking && flank) { + continue; + } + if (x <= 0) { + continue; + } + if (block_type == obj_pnunit) { + if (men + veh + dreads <= 0) { + x = -5000; + instance_deactivate_object(id); + continue; + } + } + if (left_most == "none" && x > 0) { + left_most = block_type.id; + } else { + if (x < left_most.x && x > 0) { + left_most = id; + } + } + } + } + return left_most; + } catch (_exception) { + handle_exception(_exception); + } } function get_block_distance(block) { - try { - return point_distance(x, y, block.x, block.y) / 10; - } catch (_exception) { - handle_exception(_exception); - } + try { + return point_distance(x, y, block.x, block.y) / 10; + } catch (_exception) { + handle_exception(_exception); + } } function calculate_block_distances(first_block, second_block) { - try { - if (first_block.x == second_block.x) { - return 0; - } else { - if (first_block.x < second_block.x) { - var _temp_holder = second_block; - second_block = first_block; - first_block = _temp_holder; - } - } - return floor(floor((first_block.x - second_block.x) / 10)); - } catch (_exception) { - handle_exception(_exception); - } + try { + if (first_block.x == second_block.x) { + return 0; + } else { + if (first_block.x < second_block.x) { + var _temp_holder = second_block; + second_block = first_block; + first_block = _temp_holder; + } + } + return floor(floor((first_block.x - second_block.x) / 10)); + } catch (_exception) { + handle_exception(_exception); + } } /// @description Check if the current position of the unit block collides with the other. @@ -178,11 +177,11 @@ function calculate_block_distances(first_block, second_block) { /// @param {real} position_y Y position of the unit block /// @return {bool} function block_position_collision(position_x, position_y) { - try { - return collision_point(position_x, position_y, obj_enunit, 0, 1) || collision_point(position_x, position_y, obj_pnunit, 0, 1); - } catch (_exception) { - handle_exception(_exception); - } + try { + return collision_point(position_x, position_y, obj_enunit, 0, 1) || collision_point(position_x, position_y, obj_pnunit, 0, 1); + } catch (_exception) { + handle_exception(_exception); + } } /// @description Attempts to move an unit block and returns whenever the move succeeded or not. @@ -195,7 +194,7 @@ function move_unit_block(direction, blocks = 1, allow_collision = false) { try { var distance = 10 * blocks; var _new_pos = x; - + if (direction == "east") { _new_pos = x + distance; } else if (direction == "west") { @@ -203,11 +202,11 @@ function move_unit_block(direction, blocks = 1, allow_collision = false) { } if (allow_collision == true || !block_position_collision(_new_pos, y)) { - x = _new_pos; - return true; + x = _new_pos; + return true; } else { - return false; - } + return false; + } } catch (_exception) { handle_exception(_exception); } @@ -216,79 +215,78 @@ function move_unit_block(direction, blocks = 1, allow_collision = false) { /// @description Attempts to move an enemy unit block, choosing direction based on whenever they are flanking or not, only if `obj_nfort` doesn't exists. /// @mixin function move_enemy_block() { - if (instance_exists(obj_nfort)) { - exit; - } + if (instance_exists(obj_nfort)) { + exit; + } - var _direction = flank ? "east" : "west"; - move_unit_block(_direction); + var _direction = flank ? "east" : "west"; + move_unit_block(_direction); } /// @description Creates a priority queue of enemy units based on their x-position and then moves each with `move_enemy_block()`. function move_enemy_blocks() { - var _enemy_movement_queue = ds_priority_create(); - with (obj_enunit) { - ds_priority_add(_enemy_movement_queue, id, x); - } - while (!ds_priority_empty(_enemy_movement_queue)) { - var _enemy_block = ds_priority_delete_min(_enemy_movement_queue); - with (_enemy_block) { - move_enemy_block(); - } - } - ds_priority_destroy(_enemy_movement_queue); + var _enemy_movement_queue = ds_priority_create(); + with (obj_enunit) { + ds_priority_add(_enemy_movement_queue, id, x); + } + while (!ds_priority_empty(_enemy_movement_queue)) { + var _enemy_block = ds_priority_delete_min(_enemy_movement_queue); + with (_enemy_block) { + move_enemy_block(); + } + } + ds_priority_destroy(_enemy_movement_queue); } /// @mixin function block_composition_string() { var _composition_string = ""; - _composition_string = $"{unit_count}x Total; "; - if (men > 0) { - _composition_string += $"{string_plural_count("Normal Unit", men)}; "; - } - if (medi > 0) { - _composition_string += $"{string_plural_count("Big Unit", medi)}; "; - } - if (dreads > 0) { - _composition_string += $"{string_plural_count("Walker", dreads)}; "; - } - if (veh > 0) { - _composition_string += $"{string_plural_count("Vehicle", veh)}; "; - } - _composition_string += $"\n"; - + _composition_string = $"{unit_count}x Total; "; + if (men > 0) { + _composition_string += $"{string_plural_count("Normal Unit", men)}; "; + } + if (medi > 0) { + _composition_string += $"{string_plural_count("Big Unit", medi)}; "; + } + if (dreads > 0) { + _composition_string += $"{string_plural_count("Walker", dreads)}; "; + } + if (veh > 0) { + _composition_string += $"{string_plural_count("Vehicle", veh)}; "; + } + _composition_string += $"\n"; - _composition_string += arrays_to_string_with_counts(dudes, dudes_num, true, false); + _composition_string += arrays_to_string_with_counts(dudes, dudes_num, true, false); - return _composition_string; + return _composition_string; } function draw_block_composition(_x1, _composition_string) { - draw_set_alpha(1); - draw_set_color(CM_GREEN_COLOR); - draw_line_width(_x1+5,450,817,685, 2); - draw_set_font(fnt_40k_14b); - draw_text(817,688,"Row Composition:"); - draw_set_font(fnt_40k_14); - draw_text_ext(817,710,_composition_string,-1,758); + draw_set_alpha(1); + draw_set_color(CM_GREEN_COLOR); + draw_line_width(_x1 + 5, 450, 817, 685, 2); + draw_set_font(fnt_40k_14b); + draw_text(817, 688, "Row Composition:"); + draw_set_font(fnt_40k_14); + draw_text_ext(817, 710, _composition_string, -1, 758); } function draw_block_fadein() { - if (obj_ncombat.fadein > 0) { - draw_set_color(c_black); - draw_set_alpha(obj_ncombat.fadein/30); - draw_rectangle(822,239,1574,662,0); - draw_set_alpha(1); - } + if (obj_ncombat.fadein > 0) { + draw_set_color(c_black); + draw_set_alpha(obj_ncombat.fadein / 30); + draw_rectangle(822, 239, 1574, 662, 0); + draw_set_alpha(1); + } } /// @mixin function update_block_size() { - column_size = (men*0.5)+(medi)+(dreads*2)+(veh*2.5); + column_size = (men * 0.5) + medi + (dreads * 2) + (veh * 2.5); } /// @mixin function update_block_unit_count() { - unit_count = men + medi + dreads + veh; + unit_count = men + medi + dreads + veh; } From 147c834cef0608920dacd71f0bc861ab69c6b8d1 Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sun, 28 Dec 2025 18:07:20 -0500 Subject: [PATCH 43/45] Essentially making sure variables get initialized properly is the whole shtick of GM1041 errors. I have been calling them errors because thats what i have the gm editors warning error setting and its useful to see when data might be getting dropped accidentally, or needs a more graceful (and readable) conversion. --- .../JsonFileListLoader/JsonFileListLoader.gml | 58 +- scripts/NameGenerator/NameGenerator.gml | 63 +- scripts/scr_chapter_new/scr_chapter_new.gml | 1056 ++++++++--------- .../scr_player_fleet_combat_functions.gml | 716 +++++------ 4 files changed, 974 insertions(+), 919 deletions(-) diff --git a/scripts/JsonFileListLoader/JsonFileListLoader.gml b/scripts/JsonFileListLoader/JsonFileListLoader.gml index 4207c24d64..c14950c5df 100644 --- a/scripts/JsonFileListLoader/JsonFileListLoader.gml +++ b/scripts/JsonFileListLoader/JsonFileListLoader.gml @@ -1,10 +1,9 @@ function JsonFileListLoader() constructor { - load_list_from_json_file = function(relative_file_path, properties_to_read, app_data_dir = false) { var file_buffer = undefined; var result = { is_success: false, - values: {} + values: {}, }; if (is_array(properties_to_read) == false || array_length(properties_to_read) == 0) { @@ -14,19 +13,19 @@ function JsonFileListLoader() constructor { for (var i = 0; i < array_length(properties_to_read); i++) { struct_set(result.values, properties_to_read[i], []); - }; + } try { - var item_total = 0; + var item_total = 0; var file_path = working_directory + relative_file_path; - if (file_exists(file_path) == false){ + if (file_exists(file_path) == false) { log_error($"File does not exist at path {file_path}"); return result; } file_buffer = buffer_load(file_path); if (file_buffer == -1) { - throw ("Could not open file"); + throw "Could not open file"; } var json_string = buffer_read(file_buffer, buffer_string); @@ -34,20 +33,20 @@ function JsonFileListLoader() constructor { for (var i = 0; i < array_length(properties_to_read); i++) { var property = properties_to_read[i]; - var property_value = raw_data[$ property] + var property_value = raw_data[$ property]; if (is_array(property_value) == false) { - throw ($"No string array named '{property}' found"); + throw $"No string array named '{property}' found"; } var filtered_data_array = array_unique(property_value); - var property_data_count = array_length(filtered_data_array); + var property_data_count = array_length(filtered_data_array); if (property_data_count == 0) { - throw ($"No (unique) values found for '{property}'"); + throw $"No (unique) values found for '{property}'"; } - item_total += property_data_count; + item_total += property_data_count; result.values[$ property] = array_shuffle(filtered_data_array); } @@ -56,24 +55,25 @@ function JsonFileListLoader() constructor { log_message($"Successfully loaded {item_total} values from {relative_file_path}"); } catch (_exception) { handle_exception(_exception); - result.values = {}; // do not return incomplete/invalid data - } finally { + result.values = {}; + } finally // do not return incomplete/invalid data + { if (is_undefined(file_buffer) == false) { buffer_delete(file_buffer); } } return result; - } + }; /// @param {String} relative_file_path the file path and file name e.g. "main/data/file.json" /// @param {String} property_to_read the key which is the struct to pull out /// @param {Bool} app_data_dir if set to true, will read from %AppData%/Local/ChapterMaster instead of %GameInstallDir%/datafiles - load_struct_from_json_file = function(relative_file_path, property_to_read, app_data_dir = false){ + load_struct_from_json_file = function(relative_file_path, property_to_read, app_data_dir = false) { var file_buffer = undefined; var result = { is_success: false, - value: {} + value: {}, }; if (is_string(property_to_read) == false || string_length(property_to_read) == 0) { @@ -84,49 +84,47 @@ function JsonFileListLoader() constructor { struct_set(result.value, property_to_read, {}); try { - var item_total = 0; + var item_total = 0; var file_path; - if(app_data_dir == true){ + if (app_data_dir == true) { file_path = relative_file_path; } else { file_path = working_directory + relative_file_path; } - if(file_exists(file_path) == false){ + if (file_exists(file_path) == false) { result.value = $"File does not exist at path {file_path}"; return result; } file_buffer = buffer_load(file_path); if (file_buffer == -1) { - throw ("Could not open file"); + throw "Could not open file"; } var json_string = buffer_read(file_buffer, buffer_string); var raw_data = json_parse(json_string); var property = property_to_read; - var property_value = raw_data[$ property] + var property_value = raw_data[$ property]; if (is_struct(property_value) == false) { - throw ($"No struct named '{property}' found"); + throw $"No struct named '{property}' found"; } - + result.value[$ property] = property_value; result.is_success = true; - - // log_message($"Successfully loaded {property} value from {relative_file_path}"); } catch (_ex) { log_error($"Could not properly parse file at {file_path}: {_ex}."); scr_popup("Error Parsing JSON File", $"Could not properly parse file: #{file_path}.# Please check this file for typos or formatting errors.# # Full error message:# {_ex}", "debug"); - result.value = {}; // do not return incomplete/invalid data - } finally { + result.value = {}; + } finally // do not return incomplete/invalid data // log_message($"Successfully loaded {property} value from {relative_file_path}"); + { if (is_undefined(file_buffer) == false && file_buffer != -1) { buffer_delete(file_buffer); } } return result; - } - -} \ No newline at end of file + }; +} diff --git a/scripts/NameGenerator/NameGenerator.gml b/scripts/NameGenerator/NameGenerator.gml index 0047256ed8..f49fefd5eb 100644 --- a/scripts/NameGenerator/NameGenerator.gml +++ b/scripts/NameGenerator/NameGenerator.gml @@ -1,7 +1,40 @@ function NameGenerator() constructor { + // vars // TODO put these into a struct or dict or something + sector_names = []; + sector_used_names = []; + + star_names = []; + star_used_names = []; + star_names_generic_counter = 0; // TODO once we migrate Star data to proper structs and jsons, this can probably be removed + + space_marines_names = []; + space_marines_used_names = []; + + imperial_names = []; + imperial_used_names = []; + + chaos_names = []; + chaos_used_names = []; + + eldar_syllables = []; + + ork_name_composites = []; + + imperial_ship_names = []; + imperial_ship_used_names = []; + + ork_ship_names = []; + ork_ship_used_names = []; + + hulk_name_composites = []; + + tau_name_composites = []; + + genestealer_cult_names = []; + // TODO after save rework is finished, check if these static can be converted to instance versions static LoadSimpleNames = function(file_name, fallback_value, json_names_property_name = "names") { - if (json_names_property_name == noone) { + if (json_names_property_name == "") { json_names_property_name = "names"; } @@ -16,9 +49,20 @@ function NameGenerator() constructor { return [fallback_value]; }; - static LoadCompositeNames = function(file_name, json_names_property_names = ["prefixes", "suffixes", "special"]) { + static LoadCompositeNames = function( + file_name, + json_names_property_names = [ + "prefixes", + "suffixes", + "special" + ] + ) { if (json_names_property_names == []) { - json_names_property_names = ["prefixes", "suffixes", "special"]; + json_names_property_names = [ + "prefixes", + "suffixes", + "special" + ]; } var file_loader = new JsonFileListLoader(); @@ -42,32 +86,25 @@ function NameGenerator() constructor { return result; }; - // vars // TODO put these into a struct or dict or something + // init + sector_names = LoadSimpleNames("sector", "Sector 1"); - sector_used_names = []; star_names = LoadSimpleNames("star", "Star 1"); - star_used_names = []; - star_names_generic_counter = 0; // TODO once we migrate Star data to proper structs and jsons, this can probably be removed space_marines_names = LoadSimpleNames("space_marine", "Space Marine 1"); - space_marines_used_names = []; imperial_names = LoadSimpleNames("imperial", "Imperial 1"); - imperial_used_names = []; chaos_names = LoadSimpleNames("chaos", "Chaos 1"); - chaos_used_names = []; eldar_syllables = LoadCompositeNames("eldar", ["first_syllables", "second_syllables", "third_syllables"]); ork_name_composites = LoadCompositeNames("ork", ["prefixes", "suffixes", "special"]); imperial_ship_names = LoadSimpleNames("imperial_ship", "Imperial Ship 1"); - imperial_ship_used_names = []; ork_ship_names = LoadSimpleNames("ork_ship", "Ork Ship 1"); - ork_ship_used_names = []; hulk_name_composites = LoadCompositeNames("hulk", ["prefixes", "suffixes"]); @@ -75,8 +112,6 @@ function NameGenerator() constructor { genestealer_cult_names = LoadCompositeNames("genestealercult", ["main", "embelishment", "title"]); - // init - static SimpleNameGeneration = function(names, used_names, entity_name, reset_on_using_up_all_names = true) { try { if (array_length(names) == 0) { diff --git a/scripts/scr_chapter_new/scr_chapter_new.gml b/scripts/scr_chapter_new/scr_chapter_new.gml index f572f3f53c..a18bd97897 100644 --- a/scripts/scr_chapter_new/scr_chapter_new.gml +++ b/scripts/scr_chapter_new/scr_chapter_new.gml @@ -1,552 +1,538 @@ /// @description Constructor for loading Chapter data from JSON and providing type completion /// see the actual json files for extended documentation on each property function ChapterData() constructor { - id = eCHAPTERS.UNKNOWN; - name = ""; - points = 0; - flavor = ""; - origin = eCHAPTER_ORIGINS.NONE; - founding = ePROGENITOR.NONE; - successors = 0; - splash = 0; - icon_name = "unknown"; - aspirant_trial = eTrials.BLOODDUEL; - fleet_type = ePlayerBase.none; - strength = 0; - purity = 0; - stability = 0; - cooperation = 0; - homeworld = "Hive"; //e.g. "Death" - homeworld_name = global.name_generator.generate_star_name(); // e.g. "The Rock" - homeworld_exists = 0; - recruiting_exists = 0; - recruiting = "Death"; - recruiting_name = global.name_generator.generate_star_name(); - homeworld_rule = eHOMEWORLD_RULE.NONE; - home_spawn_loc = 1; - recruit_home_relationship = 1; - home_warp = 1; - culture_styles = []; - home_planets = 1; - - flagship_name = global.name_generator.generate_imperial_ship_name(); - monastary_name = ""; - advantages = array_create(9); - disadvantages = array_create(9); - discipline = "librarius"; // todo convert to enum - - full_liveries = ""; - company_liveries = ""; - complex_livery_data = complex_livery_default(); - - - colors = { - main: "Grey", - secondary: "Grey", - pauldron_r: "Grey", - pauldron_l: "Grey", - trim: "Grey", - lens: "Grey", - weapon: "Grey", - /// 0 - normal, 1 - Breastplate, 2 - Vertical, 3 - Quadrant - special: 0, - /// 0 no, 1 yes for special trim colours - //trim_on: 0, - }; - names = { - hchaplain: global.name_generator.generate_space_marine_name(), - clibrarian: global.name_generator.generate_space_marine_name(), - fmaster: global.name_generator.generate_space_marine_name(), - hapothecary: global.name_generator.generate_space_marine_name(), - recruiter: global.name_generator.generate_space_marine_name(), - admiral: global.name_generator.generate_space_marine_name(), - honorcapt: global.name_generator.generate_space_marine_name(), - watchmaster: global.name_generator.generate_space_marine_name(), - arsenalmaster: global.name_generator.generate_space_marine_name(), - marchmaster: global.name_generator.generate_space_marine_name(), - ritesmaster: global.name_generator.generate_space_marine_name(), - victualler: global.name_generator.generate_space_marine_name(), - lordexec: global.name_generator.generate_space_marine_name(), - relmaster: global.name_generator.generate_space_marine_name(), - }; - mutations = { - preomnor: 0, - voice: 0, - doomed: 0, - lyman: 0, - omophagea: 0, - ossmodula: 0, - membrane: 0, - zygote: 0, - betchers: 0, - catalepsean: 0, - secretions: 0, - occulobe: 0, - mucranoid: 0, - }; - battle_cry = "For the Emperor"; - equal_specialists = 0; - load_to_ships = { - escort_load: 2, - split_scouts: 0, - split_vets: 0, - }; - /// @type {Array} - disposition = array_create(10, 0); - /// @type {Array} - company_titles = array_create(11, ""); - chapter_master = { - name: global.name_generator.generate_space_marine_name(), - melee: 0, - ranged: 0, - specialty: eCM_SPECIALTY.NONE, - /// @type {Array} - traits: [], - gear: "", - mobi: "", - armour: "", - }; - extra_ships = { - battle_barges: 0, - gladius: 0, - strike_cruisers: 0, - hunters: 0 - }; - extra_specialists = { - chaplains: 0, - techmarines: 0, - apothecary: 0, - epistolary: 0, - codiciery: 0, - lexicanum: 0, - terminator: 0, - assault: 0, - veteran: 0, - devastator: 0, - }; - extra_marines = { - second: 0, - third: 0, - fourth: 0, - fifth: 0, - sixth: 0, - seventh: 0, - eighth: 0, - ninth: 0, - tenth: 0, - }; - extra_vehicles = { - rhino: 0, - whirlwind: 0, - predator: 0, - land_raider: 0, - land_speeder: 0, - } - extra_equipment = []; - custom_roles = {}; - squad_name = "Squad"; - custom_squads = {}; - - - custom_advisors = {}; - - - /// @desc Returns true if loaded successfully, false if not. - /// @param {Enum.eCHAPTERS} chapter_id - /// @param {Bool} use_app_data if set to true will read from %AppData%/Local/ChapterMaster instead of /datafiles - /// @returns {Bool} - function load_from_json(chapter_id, use_app_data = false){ - var file_loader = new JsonFileListLoader(); - var load_result; - if(use_app_data){ - load_result = file_loader.load_struct_from_json_file($"chaptersave#{chapter_id}.json", "chapter", true); - } else { - load_result = file_loader.load_struct_from_json_file($"main\\chapters\\{chapter_id}.json", "chapter", false); - } - if(!load_result.is_success){ - // log_error($"No chapter json exits for chapter_id {chapter_id}"); - return false; - } - var json_chapter = load_result.value.chapter; - var keys = struct_get_names(json_chapter); - for(var i = 0; i < array_length(keys); i++){ - var key = keys[i]; - var val = struct_get(json_chapter, key); - - // Treat incoming empty vals as 'use default' and don't overwrite - // a value if it was already set in the chapter constructor - if (struct_exists(self, key)){ - if(self[$key] != "" && val == ""){ - continue; - } - } - struct_set(self, key, val); - } - return true; - } + id = eCHAPTERS.UNKNOWN; + name = ""; + points = 0; + flavor = ""; + origin = eCHAPTER_ORIGINS.NONE; + founding = ePROGENITOR.NONE; + successors = 0; + splash = 0; + icon_name = "unknown"; + aspirant_trial = eTrials.BLOODDUEL; + fleet_type = ePlayerBase.none; + strength = 0; + purity = 0; + stability = 0; + cooperation = 0; + homeworld = "Hive"; //e.g. "Death" + homeworld_name = global.name_generator.generate_star_name(); // e.g. "The Rock" + homeworld_exists = 0; + recruiting_exists = 0; + recruiting = "Death"; + recruiting_name = global.name_generator.generate_star_name(); + homeworld_rule = eHOMEWORLD_RULE.NONE; + home_spawn_loc = 1; + recruit_home_relationship = 1; + home_warp = 1; + culture_styles = []; + home_planets = 1; + + flagship_name = global.name_generator.generate_imperial_ship_name(); + monastary_name = ""; + advantages = array_create(9); + disadvantages = array_create(9); + discipline = "librarius"; // todo convert to enum + + full_liveries = ""; + company_liveries = ""; + complex_livery_data = complex_livery_default(); + + colors = { + main: "Grey", + secondary: "Grey", + pauldron_r: "Grey", + pauldron_l: "Grey", + trim: "Grey", + lens: "Grey", + weapon: "Grey", + /// 0 - normal, 1 - Breastplate, 2 - Vertical, 3 - Quadrant + special: 0 + /// 0 no, 1 yes for special trim colours + , //trim_on: 0, + }; + names = { + hchaplain: global.name_generator.generate_space_marine_name(), + clibrarian: global.name_generator.generate_space_marine_name(), + fmaster: global.name_generator.generate_space_marine_name(), + hapothecary: global.name_generator.generate_space_marine_name(), + recruiter: global.name_generator.generate_space_marine_name(), + admiral: global.name_generator.generate_space_marine_name(), + honorcapt: global.name_generator.generate_space_marine_name(), + watchmaster: global.name_generator.generate_space_marine_name(), + arsenalmaster: global.name_generator.generate_space_marine_name(), + marchmaster: global.name_generator.generate_space_marine_name(), + ritesmaster: global.name_generator.generate_space_marine_name(), + victualler: global.name_generator.generate_space_marine_name(), + lordexec: global.name_generator.generate_space_marine_name(), + relmaster: global.name_generator.generate_space_marine_name(), + }; + mutations = { + preomnor: 0, + voice: 0, + doomed: 0, + lyman: 0, + omophagea: 0, + ossmodula: 0, + membrane: 0, + zygote: 0, + betchers: 0, + catalepsean: 0, + secretions: 0, + occulobe: 0, + mucranoid: 0, + }; + battle_cry = "For the Emperor"; + equal_specialists = 0; + load_to_ships = { + escort_load: 2, + split_scouts: 0, + split_vets: 0, + }; + /// @type {Array} + disposition = array_create(10, 0); + /// @type {Array} + company_titles = array_create(11, ""); + chapter_master = { + name: global.name_generator.generate_space_marine_name(), + melee: 0, + ranged: 0, + specialty: eCM_SPECIALTY.NONE, + /// @type {Array} + traits: [], + gear: "", + mobi: "", + armour: "", + }; + extra_ships = { + battle_barges: 0, + gladius: 0, + strike_cruisers: 0, + hunters: 0, + }; + extra_specialists = { + chaplains: 0, + techmarines: 0, + apothecary: 0, + epistolary: 0, + codiciery: 0, + lexicanum: 0, + terminator: 0, + assault: 0, + veteran: 0, + devastator: 0, + }; + extra_marines = { + second: 0, + third: 0, + fourth: 0, + fifth: 0, + sixth: 0, + seventh: 0, + eighth: 0, + ninth: 0, + tenth: 0, + }; + extra_vehicles = { + rhino: 0, + whirlwind: 0, + predator: 0, + land_raider: 0, + land_speeder: 0, + }; + extra_equipment = []; + custom_roles = {}; + squad_name = "Squad"; + custom_squads = {}; + + custom_advisors = {}; + + /// @desc Returns true if loaded successfully, false if not. + /// @param {Enum.eCHAPTERS} chapter_id + /// @param {Bool} use_app_data if set to true will read from %AppData%/Local/ChapterMaster instead of /datafiles + /// @returns {Bool} + function load_from_json(chapter_id, use_app_data = false) { + var file_loader = new JsonFileListLoader(); + var load_result; + if (use_app_data) { + load_result = file_loader.load_struct_from_json_file($"chaptersave#{chapter_id}.json", "chapter", true); + } else { + load_result = file_loader.load_struct_from_json_file($"main\\chapters\\{chapter_id}.json", "chapter", false); + } + if (!load_result.is_success) { + // log_error($"No chapter json exits for chapter_id {chapter_id}"); + return false; + } + var json_chapter = load_result.value.chapter; + var keys = struct_get_names(json_chapter); + for (var i = 0; i < array_length(keys); i++) { + var key = keys[i]; + var val = struct_get(json_chapter, key); + + // Treat incoming empty vals as 'use default' and don't overwrite + // a value if it was already set in the chapter constructor + if (struct_exists(self, key)) { + if (self[$ key] != "" && val == "") { + continue; + } + } + struct_set(self, key, val); + } + return true; + } } /// @mixin obj_creation /// @description called when a chapter's icon is clicked on the first page after the main menu. /// used to set up initialise the data that is later fed into `scr_initialize_custom` when the game starts function scr_chapter_new(chapter_identifier) { - - full_liveries = ""; // until chapter objects are in full use kicks off livery propogation - - company_liveries = ""; - - obj_creation.use_chapter_object = false; // for the new json testing - var chapter_id = eCHAPTERS.UNKNOWN; - - //1st captain = honor_captain_name - //2nd captain = watch_master_name - //3rd captain = arsenal_master_name - //4th captain = lord_admiral_name - //5th captain = march_master_name - //6th captain = rites_master_name - //7th captain = chief_victualler_name - //8th captain = lord_executioner_name - //9th captain = relic_master_name - //10th captain = recruiter_name - - var i = 0; - world = array_create(20, ""); - world_type = array_create(20, ""); - world_feature = array_create(20, ""); - - - points=100; - maxpoints=100; - - function load_default_gear(_role_id, _role_name, _wep1, _wep2, _armour, _mobi, _gear){ - for(var i = 100; i <=102; i++){ - obj_creation.role[i][_role_id] = _role_name; - obj_creation.wep1[i][_role_id] = _wep1; - obj_creation.wep2[i][_role_id] = _wep2; - obj_creation.armour[i][_role_id] = _armour; - obj_creation.mobi[i][_role_id] = _mobi; - obj_creation.gear[i][_role_id] = _gear; - obj_creation.race[i][_role_id] = 1; - } - } - load_default_gear(eROLE.HonourGuard, "Honour Guard", "Power Sword", "Bolter", "Artificer Armour", "", ""); - load_default_gear(eROLE.Veteran, "Veteran", "Combiflamer", "Combat Knife", STR_ANY_POWER_ARMOUR, "", ""); - load_default_gear(eROLE.Terminator, "Terminator", "Power Fist", "Storm Bolter", "Terminator Armour", "", ""); - load_default_gear(eROLE.Captain, "Captain", "Power Sword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Iron Halo"); - load_default_gear(eROLE.Dreadnought, "Dreadnought", "Dreadnought Lightning Claw", "Lascannon", "Dreadnought", "", ""); - load_default_gear(eROLE.Champion, "Champion", "Power Sword", STR_ANY_POWER_ARMOUR, STR_ANY_POWER_ARMOUR, "", "Combat Shield"); - load_default_gear(eROLE.Tactical, "Tactical", "Bolter", "Combat Knife", STR_ANY_POWER_ARMOUR, "", ""); - load_default_gear(eROLE.Devastator, "Devastator", "", "Combat Knife", STR_ANY_POWER_ARMOUR, "", ""); - load_default_gear(eROLE.Assault, "Assault", "Chainsword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "Jump Pack", ""); - load_default_gear(eROLE.Ancient, "Ancient", "Company Standard", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", ""); - load_default_gear(eROLE.Scout, "Scout", "Bolter", "Combat Knife", "Scout Armour", "", ""); - load_default_gear(eROLE.Chaplain, "Chaplain", "Crozius Arcanum", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Rosarius"); - load_default_gear(eROLE.Apothecary, "Apothecary", "Chainsword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Narthecium"); - load_default_gear(eROLE.Techmarine, "Techmarine", "Power Axe", "Bolt Pistol", "Artificer Armour", "Servo-arm", ""); - load_default_gear(eROLE.Librarian, "Librarian", "Force Staff", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", "Psychic Hood"); - load_default_gear(eROLE.Sergeant, "Sergeant", "Chainsword", "Bolt Pistol", STR_ANY_POWER_ARMOUR, "", ""); - load_default_gear(eROLE.VeteranSergeant, "Veteran Sergeant", "Chainsword", "Plasma Pistol", STR_ANY_POWER_ARMOUR, "", ""); - - - for(var c = 0; c < array_length(obj_creation.all_chapters); c++){ - if(chapter_identifier == obj_creation.all_chapters[c].name && obj_creation.all_chapters[c].json == true){ - obj_creation.use_chapter_object = true; - chapter_id = obj_creation.all_chapters[c].id; - } - } - - if(obj_creation.use_chapter_object){ - - var chapter_obj = new ChapterData(); - var successfully_loaded = chapter_obj.load_from_json(chapter_id); - if(!successfully_loaded){ - var issue = $"No json file exists for chapter id {chapter_id} and name {chapter_identifier}"; - // log_error(issue); - scr_popup("Error Loading Chapter", issue, "debug"); - return false; - } - - global.chapter_creation_object = chapter_obj; - maxpoints=150; - - - } - - #region Custom Chapter - //generates custom chapter if it exists - if (is_real(chapter_identifier) && chapter_identifier >= eCHAPTERS.CUSTOM_1 && chapter_identifier <= eCHAPTERS.CUSTOM_10){ - obj_creation.use_chapter_object = true; - var chapter_obj = new ChapterData(); - var successfully_loaded = chapter_obj.load_from_json(chapter_identifier, true); - if(!successfully_loaded){ - var issue = $"No json file exists for chapter id {chapter_identifier} and name {chapter_identifier}"; - log_error(issue); - scr_popup("Error Loading Chapter", issue, "debug"); - return false; - } - global.chapter_creation_object = chapter_obj; - maxpoints=100; - } - #endregion - - - - if(obj_creation.use_chapter_object){ - - var chapter_object = global.chapter_creation_object; - - // * All of this obj_creation setting is just to keep things working - obj_creation.founding = chapter_object.founding; - obj_creation.successors = chapter_object.successors; - obj_creation.homeworld_rule = chapter_object.homeworld_rule; - obj_creation.chapter_name = chapter_object.name; - - global.chapter_icon.name = chapter_object.icon_name; - obj_creation.fleet_type = chapter_object.fleet_type; - - obj_creation.homeworld_exists = chapter_object.homeworld_exists; - obj_creation.homeworld = chapter_object.homeworld; - obj_creation.homeworld_rule = chapter_object.homeworld_rule; - obj_creation.homeworld_name = chapter_object.homeworld_name; - - obj_creation.recruiting_exists = chapter_object.recruiting_exists; - obj_creation.recruiting = chapter_object.recruiting; - obj_creation.recruiting_name = chapter_object.recruiting_name; - - obj_creation.buttons.home_spawn_loc_options.current_selection = chapter_object.home_spawn_loc ?? 1; - obj_creation.buttons.recruit_home_relationship.current_selection = chapter_object.recruit_home_relationship ?? 1; - obj_creation.buttons.home_warp.current_selection = chapter_object.home_warp ?? 1; - obj_creation.buttons.home_planets.current_selection = chapter_object.home_planets ??1; - - obj_creation.aspirant_trial = trial_map(chapter_object.aspirant_trial); - - obj_creation.buttons.culture_styles.set(chapter_object.culture_styles); - obj_creation.full_liveries = chapter_object.full_liveries; - obj_creation.company_liveries = chapter_object.company_liveries; - obj_creation.complex_livery_data = chapter_object.complex_livery_data; - if (obj_creation.full_liveries!=""){ - obj_creation.livery_picker.map_colour = full_liveries[0]; - obj_creation.livery_picker.role_set = 0; - } - - obj_creation.color_to_main = chapter_object.colors.main; - obj_creation.color_to_secondary = chapter_object.colors.secondary; - obj_creation.color_to_pauldron = chapter_object.colors.pauldron_l; - obj_creation.color_to_pauldron2 = chapter_object.colors.pauldron_r; - obj_creation.color_to_trim = chapter_object.colors.trim; - obj_creation.color_to_lens = chapter_object.colors.lens; - obj_creation.color_to_weapon = chapter_object.colors.weapon; - obj_creation.col_special = chapter_object.colors.special; - //obj_creation.trim = chapter_object.colors.trim_on; - with (obj_creation){ - if (array_length(col)>0){ - if (color_to_main!=""){ - main_color = max(array_find_value(col,color_to_main),0); - color_to_main = ""; - } - if (color_to_secondary!=""){ - secondary_color = max(array_find_value(col,color_to_secondary),0); - color_to_secondary = ""; - } - if (color_to_trim!=""){ - main_trim = max(array_find_value(col,color_to_trim),0); - color_to_trim = ""; - } - if (color_to_pauldron2!=""){ - right_pauldron = max(array_find_value(col,color_to_pauldron2),0); - color_to_pauldron2 = ""; - } - if (color_to_pauldron!=""){ - left_pauldron = max(array_find_value(col,color_to_pauldron),0); - color_to_pauldron = ""; - } - if (color_to_lens!=""){ - lens_color = max(array_find_value(col,color_to_lens),0); - color_to_lens = ""; - } - if (color_to_weapon!=""){ - weapon_color = max(array_find_value(col,color_to_weapon),0); - color_to_weapon = ""; - } - } - var struct_cols = { - main_color :main_color, - secondary_color:secondary_color, - main_trim:main_trim, - right_pauldron:right_pauldron, - left_pauldron:left_pauldron, - lens_color:lens_color, - weapon_color:weapon_color - } - livery_picker = new ColourItem(100,230); - if (company_liveries == ""){ - livery_picker.scr_unit_draw_data(-1); - company_liveries = array_create(11,variable_clone(livery_picker.map_colour)); - } else { - livery_picker.scr_unit_draw_data(-1); - var _all_maps = struct_get_names(livery_picker.map_colour); - for (var i=0;i= eCHAPTERS.CUSTOM_1 && chapter_identifier <= eCHAPTERS.CUSTOM_10) { + obj_creation.use_chapter_object = true; + var chapter_obj = new ChapterData(); + var successfully_loaded = chapter_obj.load_from_json(chapter_identifier, true); + if (!successfully_loaded) { + var issue = $"No json file exists for chapter id {chapter_identifier} and name {chapter_identifier}"; + log_error(issue); + scr_popup("Error Loading Chapter", issue, "debug"); + return false; + } + global.chapter_creation_object = chapter_obj; + maxpoints = 100; + } + #endregion + + if (obj_creation.use_chapter_object) { + var chapter_object = global.chapter_creation_object; + + // * All of this obj_creation setting is just to keep things working + obj_creation.founding = chapter_object.founding; + obj_creation.successors = chapter_object.successors; + obj_creation.homeworld_rule = chapter_object.homeworld_rule; + obj_creation.chapter_name = chapter_object.name; + + global.chapter_icon.name = chapter_object.icon_name; + obj_creation.fleet_type = chapter_object.fleet_type; + + obj_creation.homeworld_exists = chapter_object.homeworld_exists; + obj_creation.homeworld = chapter_object.homeworld; + obj_creation.homeworld_rule = chapter_object.homeworld_rule; + obj_creation.homeworld_name = chapter_object.homeworld_name; + + obj_creation.recruiting_exists = chapter_object.recruiting_exists; + obj_creation.recruiting = chapter_object.recruiting; + obj_creation.recruiting_name = chapter_object.recruiting_name; + + obj_creation.buttons.home_spawn_loc_options.current_selection = chapter_object.home_spawn_loc ?? 1; + obj_creation.buttons.recruit_home_relationship.current_selection = chapter_object.recruit_home_relationship ?? 1; + obj_creation.buttons.home_warp.current_selection = chapter_object.home_warp ?? 1; + obj_creation.buttons.home_planets.current_selection = chapter_object.home_planets ?? 1; + + obj_creation.aspirant_trial = trial_map(chapter_object.aspirant_trial); + + obj_creation.buttons.culture_styles.set(chapter_object.culture_styles); + obj_creation.full_liveries = chapter_object.full_liveries; + obj_creation.company_liveries = chapter_object.company_liveries; + obj_creation.complex_livery_data = chapter_object.complex_livery_data; + if (obj_creation.full_liveries != "") { + obj_creation.livery_picker.map_colour = full_liveries[0]; + obj_creation.livery_picker.role_set = 0; + } + + obj_creation.color_to_main = chapter_object.colors.main; + obj_creation.color_to_secondary = chapter_object.colors.secondary; + obj_creation.color_to_pauldron = chapter_object.colors.pauldron_l; + obj_creation.color_to_pauldron2 = chapter_object.colors.pauldron_r; + obj_creation.color_to_trim = chapter_object.colors.trim; + obj_creation.color_to_lens = chapter_object.colors.lens; + obj_creation.color_to_weapon = chapter_object.colors.weapon; + obj_creation.col_special = chapter_object.colors.special; + //obj_creation.trim = chapter_object.colors.trim_on; + with (obj_creation) { + if (array_length(col) > 0) { + if (color_to_main != "") { + main_color = max(array_find_value(col, color_to_main), 0); + color_to_main = ""; + } + if (color_to_secondary != "") { + secondary_color = max(array_find_value(col, color_to_secondary), 0); + color_to_secondary = ""; + } + if (color_to_trim != "") { + main_trim = max(array_find_value(col, color_to_trim), 0); + color_to_trim = ""; + } + if (color_to_pauldron2 != "") { + right_pauldron = max(array_find_value(col, color_to_pauldron2), 0); + color_to_pauldron2 = ""; + } + if (color_to_pauldron != "") { + left_pauldron = max(array_find_value(col, color_to_pauldron), 0); + color_to_pauldron = ""; + } + if (color_to_lens != "") { + lens_color = max(array_find_value(col, color_to_lens), 0); + color_to_lens = ""; + } + if (color_to_weapon != "") { + weapon_color = max(array_find_value(col, color_to_weapon), 0); + color_to_weapon = ""; + } + } + var struct_cols = { + main_color: main_color, + secondary_color: secondary_color, + main_trim: main_trim, + right_pauldron: right_pauldron, + left_pauldron: left_pauldron, + lens_color: lens_color, + weapon_color: weapon_color, + }; + livery_picker = new ColourItem(100, 230); + if (company_liveries == "") { + livery_picker.scr_unit_draw_data(-1); + company_liveries = array_create(11, variable_clone(livery_picker.map_colour)); + } else { + livery_picker.scr_unit_draw_data(-1); + var _all_maps = struct_get_names(livery_picker.map_colour); + for (var i = 0; i < array_length(company_liveries); i++) { + var _comp_data = company_liveries[i]; + for (var s = 0; s < array_length(_all_maps); s++) { + var _name = _all_maps[s]; + if (!struct_exists(_comp_data, _name)) { + _comp_data[$ _name] = livery_picker.map_colour[$ _name]; + } + } + } + } + livery_picker.scr_unit_draw_data(); + if (full_liveries == "") { + livery_picker.scr_unit_draw_data(); + livery_picker.set_default_armour(struct_cols, col_special); + full_liveries = array_create(21, variable_clone(livery_picker.map_colour)); + full_liveries[eROLE.Librarian] = livery_picker.set_default_librarian(struct_cols); + + full_liveries[eROLE.Chaplain] = livery_picker.set_default_chaplain(struct_cols); + + full_liveries[eROLE.Apothecary] = livery_picker.set_default_apothecary(struct_cols); + + full_liveries[eROLE.Techmarine] = livery_picker.set_default_techmarines(struct_cols); + livery_picker.scr_unit_draw_data(); + livery_picker.set_default_armour(struct_cols, col_special); + } else { + if (array_length(full_liveries) != 21) { + full_liveries = array_create(21, variable_clone(full_liveries[0])); + struct_cols.left_pauldron = full_liveries[0].left_pauldron; + full_liveries[eROLE.Librarian] = livery_picker.set_default_librarian(struct_cols); + + full_liveries[eROLE.Chaplain] = livery_picker.set_default_chaplain(struct_cols); + + full_liveries[eROLE.Apothecary] = livery_picker.set_default_apothecary(struct_cols); + + full_liveries[eROLE.Techmarine] = livery_picker.set_default_techmarines(struct_cols); + } + } + livery_picker.map_colour = full_liveries[0]; + livery_picker.role_set = 0; + } + // handles making sure blank names are generated properly and only + // actual values being set in the json will overwrite them + struct_foreach(chapter_object.names, function(key, val) { + if (val != "") { + struct_set(obj_creation, key, val); + } + }); + + obj_creation.battle_cry = chapter_object.battle_cry; + obj_creation.discipline = chapter_object.discipline; + + var load = chapter_object.load_to_ships; + obj_creation.load_to_ships = [load.escort_load, load.split_scouts, load.split_vets]; + obj_creation.equal_specialists = chapter_object.equal_specialists; + if (struct_exists(chapter_object, "scout_company_behaviour")) { + obj_creation.scout_company_behaviour = chapter_object.scout_company_behaviour; + } else { + obj_creation.scout_company_behaviour = 0; //default + } + if (struct_exists(chapter_object, "equal_scouts")) { + obj_creation.equal_scouts = chapter_object.equal_scouts; + } else { + obj_creation.equal_scouts = 0; + } + + obj_creation.mutations = 0; + struct_foreach(chapter_object.mutations, function(key, val) { + struct_set(obj_creation, key, val); + if (val == 1) { + obj_creation.mutations += 1; + } + }); + + obj_creation.disposition = chapter_object.disposition; + + obj_creation.chapter_master = chapter_object.chapter_master; + + if (chapter_object.chapter_master.name != "") { + obj_creation.chapter_master_name = chapter_object.chapter_master.name; + } + obj_creation.chapter_master_melee = chapter_object.chapter_master.melee; + obj_creation.chapter_master_ranged = chapter_object.chapter_master.ranged; + obj_creation.chapter_master_specialty = chapter_object.chapter_master.specialty; + if (struct_exists(chapter_object, "company_titles")) { + obj_creation.company_title = chapter_object.company_titles; + } + + if (struct_exists(chapter_object, "artifact")) { + obj_creation.artifact = chapter_object.artifact; + } + + obj_creation.flagship_name = chapter_object.flagship_name; + obj_creation.extra_ships = chapter_object.extra_ships; + obj_creation.extra_specialists = chapter_object.extra_specialists; + obj_creation.extra_marines = chapter_object.extra_marines; + obj_creation.extra_vehicles = chapter_object.extra_vehicles; + obj_creation.extra_equipment = chapter_object.extra_equipment; + + obj_creation.squad_name = chapter_object.squad_name; + if (struct_exists(chapter_object, "custom_roles")) { + obj_creation.custom_roles = chapter_object.custom_roles; + } + if (struct_exists(chapter_object, "custom_squads")) { + obj_creation.custom_squads = chapter_object.custom_squads; + } + + if (struct_exists(chapter_object, "custom_advisors")) { + obj_creation.custom_advisors = chapter_object.custom_advisors; + } + + // Validate and clamp trait values to sane ranges (defaulting if missing/invalid) + obj_creation.strength = clamp(is_real(chapter_object.strength) ? chapter_object.strength : 5, 0, 10); + obj_creation.purity = clamp(is_real(chapter_object.purity) ? chapter_object.purity : 5, 0, 10); + obj_creation.stability = clamp(is_real(chapter_object.stability) ? chapter_object.stability : 50, 0, 100); + obj_creation.cooperation = clamp(is_real(chapter_object.cooperation) ? chapter_object.cooperation : 5, 0, 10); + points = 0; + + points += (obj_creation.strength - 5) * 10; + points += (obj_creation.purity - 5) * 10; + points += obj_creation.stability - 50; + points += (obj_creation.cooperation - 5) * 10; + + var _open_adv = 0; + for (var i = 0; i < array_length(obj_creation.all_advantages); i++) { + var _adv = obj_creation.all_advantages[i]; + if (array_contains(chapter_object.advantages, _adv.name)) { + _adv.add(_open_adv); + _open_adv++; + } + } + + var _open_disadv = 1; + for (var i = 0; i < array_length(obj_creation.all_disadvantages); i++) { + var _disadv = obj_creation.all_disadvantages[i]; + if (array_contains(chapter_object.disadvantages, _disadv.name)) { + _disadv.add(_open_disadv); + _open_disadv++; + } + } + } + + setup_chapter_trait_select(); + return true; } enum eHOMEWORLD_RULE { - NONE = 0, - GOVERNOR = 1, - COUNTRY, - PERSONAL, + NONE = 0, + GOVERNOR = 1, + COUNTRY, + PERSONAL, } enum eCM_SPECIALTY { - NONE = 0, - LEADER = 1, - CHAMPION, - PSYKER, + NONE = 0, + LEADER = 1, + CHAMPION, + PSYKER, } -enum eRecruitHomeRelationship{ - SAMEPLANET, - SAMESYSTEM, - DIFFERENTSYSTEM, +enum eRecruitHomeRelationship { + SAMEPLANET, + SAMESYSTEM, + DIFFERENTSYSTEM, } diff --git a/scripts/scr_player_fleet_combat_functions/scr_player_fleet_combat_functions.gml b/scripts/scr_player_fleet_combat_functions/scr_player_fleet_combat_functions.gml index 96bd4d704e..0a1f555bff 100644 --- a/scripts/scr_player_fleet_combat_functions/scr_player_fleet_combat_functions.gml +++ b/scripts/scr_player_fleet_combat_functions/scr_player_fleet_combat_functions.gml @@ -1,351 +1,387 @@ // Script assets have changed for v2.3.0 see // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information -function add_fleet_ships_to_combat(fleet, combat){ - var capital_count = array_length(fleet.capital); - var _ship_id; - var _ships = fleet_full_ship_array(fleet); - var _ship_array_length = array_length(_ships); - for (var i=0;i<_ship_array_length;i++){ - try{ - if (i>=array_length(_ships)) then break; - _ship_id = _ships[i]; - if (obj_ini.ship_hp[_ship_id]<=0 || obj_ini.ship[_ship_id]==""){ - continue; - } - if (obj_ini.ship_size[_ship_id]>=3) then combat.capital++; - if (obj_ini.ship_size[_ship_id]==2) then combat.frigate++; - if (obj_ini.ship_size[_ship_id]==1) then combat.escort++; - - array_push(combat.ship_class, player_ships_class(_ship_id)); - array_push(combat.ship, obj_ini.ship[_ship_id]); - array_push(combat.ship_id, _ship_id); - array_push(combat.ship_size, obj_ini.ship_size[_ship_id]); - array_push(combat.ship_leadership, 100); - array_push(combat.ship_hp, obj_ini.ship_hp[_ship_id]); - array_push(combat.ship_maxhp, obj_ini.ship_maxhp[_ship_id]); - array_push(combat.ship_conditions, obj_ini.ship_conditions[_ship_id]); - array_push(combat.ship_speed, obj_ini.ship_speed[_ship_id]); - array_push(combat.ship_turning, obj_ini.ship_turning[_ship_id]); - array_push(combat.ship_front_armour, obj_ini.ship_front_armour[_ship_id]); - array_push(combat.ship_other_armour, obj_ini.ship_other_armour[_ship_id]); - array_push(combat.ship_weapons, obj_ini.ship_weapons[_ship_id]); - - array_push(combat.ship_wep, obj_ini.ship_wep[_ship_id]); - array_push(combat.ship_wep_facing, obj_ini.ship_wep_facing[_ship_id]); - array_push(combat.ship_wep_condition, obj_ini.ship_wep_condition[_ship_id]); - - array_push(combat.ship_capacity, obj_ini.ship_capacity[_ship_id]); - array_push(combat.ship_carrying, obj_ini.ship_carrying[_ship_id]); - array_push(combat.ship_contents, obj_ini.ship_contents[_ship_id]); - array_push(combat.ship_turrets, obj_ini.ship_turrets[_ship_id]); - } catch (_exception){ - handle_exception(_exception); - } - } +function add_fleet_ships_to_combat(fleet, combat) { + var capital_count = array_length(fleet.capital); + var _ship_id; + var _ships = fleet_full_ship_array(fleet); + var _ship_array_length = array_length(_ships); + for (var i = 0; i < _ship_array_length; i++) { + try { + if (i >= array_length(_ships)) { + break; + } + _ship_id = _ships[i]; + if (obj_ini.ship_hp[_ship_id] <= 0 || obj_ini.ship[_ship_id] == "") { + continue; + } + if (obj_ini.ship_size[_ship_id] >= 3) { + combat.capital++; + } + if (obj_ini.ship_size[_ship_id] == 2) { + combat.frigate++; + } + if (obj_ini.ship_size[_ship_id] == 1) { + combat.escort++; + } + + array_push(combat.ship_class, player_ships_class(_ship_id)); + array_push(combat.ship, obj_ini.ship[_ship_id]); + array_push(combat.ship_id, _ship_id); + array_push(combat.ship_size, obj_ini.ship_size[_ship_id]); + array_push(combat.ship_leadership, 100); + array_push(combat.ship_hp, obj_ini.ship_hp[_ship_id]); + array_push(combat.ship_maxhp, obj_ini.ship_maxhp[_ship_id]); + array_push(combat.ship_conditions, obj_ini.ship_conditions[_ship_id]); + array_push(combat.ship_speed, obj_ini.ship_speed[_ship_id]); + array_push(combat.ship_turning, obj_ini.ship_turning[_ship_id]); + array_push(combat.ship_front_armour, obj_ini.ship_front_armour[_ship_id]); + array_push(combat.ship_other_armour, obj_ini.ship_other_armour[_ship_id]); + array_push(combat.ship_weapons, obj_ini.ship_weapons[_ship_id]); + + array_push(combat.ship_wep, obj_ini.ship_wep[_ship_id]); + array_push(combat.ship_wep_facing, obj_ini.ship_wep_facing[_ship_id]); + array_push(combat.ship_wep_condition, obj_ini.ship_wep_condition[_ship_id]); + + array_push(combat.ship_capacity, obj_ini.ship_capacity[_ship_id]); + array_push(combat.ship_carrying, obj_ini.ship_carrying[_ship_id]); + array_push(combat.ship_contents, obj_ini.ship_contents[_ship_id]); + array_push(combat.ship_turrets, obj_ini.ship_turrets[_ship_id]); + } catch (_exception) { + handle_exception(_exception); + } + } } -function sort_ships_into_columns(combat){ - var col = 5; - with (combat){ - for (var k = 0;k=3)) then combat.column_num[col]+=1; - if ((combat.column[col-1]="capital" && combat.ship_size[k]>=3)) then combat.column_num[col-1]+=1; - if ((combat.column[col-2]="capital" && combat.ship_size[k]>=3)) then combat.column_num[col-2]+=1; - if ((combat.column[col-3]="capital" && combat.ship_size[k]>=3)) then combat.column_num[col-3]+=1; - if ((combat.column[col-4]="capital" && combat.ship_size[k]>=3)) then combat.column_num[col-4]+=1; - - if (combat.ship_class[k]=combat.column[col]) then combat.column_num[col]+=1; - if (combat.ship_class[k]=combat.column[col-1]) then combat.column_num[col-1]+=1; - if (combat.ship_class[k]=combat.column[col-2]) then combat.column_num[col-2]+=1; - if (combat.ship_class[k]=combat.column[col-3]) then combat.column_num[col-3]+=1; - if (combat.ship_class[k]=combat.column[col-4]) then combat.column_num[col-4]+=1; - - if ((combat.column[col]="escort" && combat.ship_size[k]=1)) then combat.column_num[col]+=1; - if ((combat.column[col-1]="escort" && combat.ship_size[k]=1)) then combat.column_num[col-1]+=1; - if ((combat.column[col-2]="escort" && combat.ship_size[k]=1)) then combat.column_num[col-2]+=1; - if ((combat.column[col-3]="escort" && combat.ship_size[k]=1)) then combat.column_num[col-3]+=1; - if ((combat.column[col-4]="escort" && combat.ship_size[k]=1)) then combat.column_num[col-4]+=1; - } - } - +function sort_ships_into_columns(combat) { + var col = 5; + with (combat) { + for (var k = 0; k < array_length(combat.ship_size); k++) { + // This determines the number of ships in each column + if (combat.column[col] == "capital" && combat.ship_size[k] >= 3) { + combat.column_num[col] += 1; + } + if (combat.column[col - 1] == "capital" && combat.ship_size[k] >= 3) { + combat.column_num[col - 1] += 1; + } + if (combat.column[col - 2] == "capital" && combat.ship_size[k] >= 3) { + combat.column_num[col - 2] += 1; + } + if (combat.column[col - 3] == "capital" && combat.ship_size[k] >= 3) { + combat.column_num[col - 3] += 1; + } + if (combat.column[col - 4] == "capital" && combat.ship_size[k] >= 3) { + combat.column_num[col - 4] += 1; + } + + if (combat.ship_class[k] == combat.column[col]) { + combat.column_num[col] += 1; + } + if (combat.ship_class[k] == combat.column[col - 1]) { + combat.column_num[col - 1] += 1; + } + if (combat.ship_class[k] == combat.column[col - 2]) { + combat.column_num[col - 2] += 1; + } + if (combat.ship_class[k] == combat.column[col - 3]) { + combat.column_num[col - 3] += 1; + } + if (combat.ship_class[k] == combat.column[col - 4]) { + combat.column_num[col - 4] += 1; + } + + if (combat.column[col] == "escort" && combat.ship_size[k] == 1) { + combat.column_num[col] += 1; + } + if (combat.column[col - 1] == "escort" && combat.ship_size[k] == 1) { + combat.column_num[col - 1] += 1; + } + if (combat.column[col - 2] == "escort" && combat.ship_size[k] == 1) { + combat.column_num[col - 2] += 1; + } + if (combat.column[col - 3] == "escort" && combat.ship_size[k] == 1) { + combat.column_num[col - 3] += 1; + } + if (combat.column[col - 4] == "escort" && combat.ship_size[k] == 1) { + combat.column_num[col - 4] += 1; + } + } + } } - -function player_fleet_ship_spawner(){ - var x2 = 224; - var hei=0,sizz=0; - for (var col=5;col>0;col--){// Start repeat - temp1=0; - temp2=0; - - if (col<5) then x2-=column_width[col]; - - if (column_num[col]>0){// Start ship creation - if (column[col]=="capital"){ - hei=160; - sizz=3; - } - // if (column[col]="Slaughtersong"){hei=200;sizz=3;} - if (column[col]=="Strike Cruiser" || column[col]=="frigate"){ - hei=96; - sizz=2; - } - else if (column[col]=="Gladius"){ - hei=64; - sizz=1; - }else if (column[col]=="Hunter"){ - hei=64; - sizz=1; - } - else if (column[col]=="escort"){hei=64;sizz=1;} - - temp1=column_num[col]*hei; - temp2=((room_height/2)-(temp1/2))+64; - if (column_num[col]=1) then temp2+=20; - - // show_message(string(column_num[col])+" "+string(column[col])+" X:"+string(x2)); - for (var k = 0;k=3 && ship_class[k]!="") { - man=instance_create(x2,temp2,obj_p_capital); - man.ship_id=ship_id[k]; - temp2+=hei; - } - if (sizz=2 && ship_class[k]!="") { - man=instance_create(x2,temp2,obj_p_cruiser); - man.ship_id=ship_id[k]; - temp2+=hei; - } - if (sizz=1 && ship_class[k]!="") { - man=instance_create(x2,temp2,obj_p_escort); - man.ship_id=ship_id[k]; - temp2+=hei; - } - if (instance_exists(man)){ - with (man){ - setup_player_combat_ship(); - } - } - } - } - - - }// End ship creation - - }// End repeat +function player_fleet_ship_spawner() { + var x2 = 224; + var hei = 0, sizz = 0; + for (var col = 5; col > 0; col--) { + // Start repeat + temp1 = 0; + temp2 = 0; + + if (col < 5) { + x2 -= column_width[col]; + } + + if (column_num[col] > 0) { + // Start ship creation + if (column[col] == "capital") { + hei = 160; + sizz = 3; + } + // if (column[col]="Slaughtersong"){hei=200;sizz=3;} + if (column[col] == "Strike Cruiser" || column[col] == "frigate") { + hei = 96; + sizz = 2; + } else if (column[col] == "Gladius") { + hei = 64; + sizz = 1; + } else if (column[col] == "Hunter") { + hei = 64; + sizz = 1; + } else if (column[col] == "escort") { + hei = 64; + sizz = 1; + } + + temp1 = column_num[col] * hei; + temp2 = ((room_height / 2) - (temp1 / 2)) + 64; + if (column_num[col] == 1) { + temp2 += 20; + } + + // show_message(string(column_num[col])+" "+string(column[col])+" X:"+string(x2)); + for (var k = 0; k < array_length(ship_id); k++) { + if (ship_class[k] == column[col] || (player_ships_class(ship_id[k]) == column[col])) { + man = -1; + if (sizz >= 3 && ship_class[k] != "") { + man = instance_create(x2, temp2, obj_p_capital); + man.ship_id = ship_id[k]; + temp2 += hei; + } + if (sizz == 2 && ship_class[k] != "") { + man = instance_create(x2, temp2, obj_p_cruiser); + man.ship_id = ship_id[k]; + temp2 += hei; + } + if (sizz == 1 && ship_class[k] != "") { + man = instance_create(x2, temp2, obj_p_escort); + man.ship_id = ship_id[k]; + temp2 += hei; + } + if (instance_exists(man)) { + with (man) { + setup_player_combat_ship(); + } + } + } + } + } // End ship creation + } // End repeat } - -function setup_player_combat_ship(){ - action=""; - direction=0; - - - cooldown1=0; - cooldown2=0; - cooldown3=0; - cooldown4=0; - cooldown5=0; - - - name=obj_ini.ship[ship_id]; - class=obj_ini.ship_class[ship_id]; - hp=obj_ini.ship_hp[ship_id]*1; - maxhp=obj_ini.ship_hp[ship_id]*1; - conditions=obj_ini.ship_conditions[ship_id]; - shields=obj_ini.ship_shields[ship_id]*100; - maxshields=shields; - armour_front=obj_ini.ship_front_armour[ship_id]; - armour_other=obj_ini.ship_other_armour[ship_id]; - weapons=obj_ini.ship_weapons[ship_id]; - turrets=0; - ship_colour=obj_controller.body_colour_replace; - max_speed = obj_ini.ship_speed[ship_id]; +function setup_player_combat_ship() { + action = ""; + direction = 0; + + cooldown1 = 0; + cooldown2 = 0; + cooldown3 = 0; + cooldown4 = 0; + cooldown5 = 0; + + name = obj_ini.ship[ship_id]; + class = obj_ini.ship_class[ship_id]; + hp = obj_ini.ship_hp[ship_id] * 1; + maxhp = obj_ini.ship_hp[ship_id] * 1; + conditions = obj_ini.ship_conditions[ship_id]; + shields = obj_ini.ship_shields[ship_id] * 100; + maxshields = shields; + armour_front = obj_ini.ship_front_armour[ship_id]; + armour_other = obj_ini.ship_other_armour[ship_id]; + weapons = obj_ini.ship_weapons[ship_id]; + turrets = 0; + ship_colour = obj_controller.body_colour_replace; + max_speed = obj_ini.ship_speed[ship_id]; weapon = obj_ini.ship_wep[ship_id]; - - weapon_facing[1]=""; - weapon_cooldown[1]=0; - weapon_hp[1]=hp/4; - weapon_dam[1]=0; - weapon_ammo[1]=999; - weapon_range[1]=0; - weapon_minrange[1]=0; - weapon_facing[2]=""; - weapon_cooldown[2]=0; - weapon_hp[2]=hp/4; - weapon_dam[2]=0; - weapon_ammo[2]=999; - weapon_range[2]=0; - weapon_minrange[2]=0; - - weapon_facing[3]=""; - weapon_cooldown[3]=0; - weapon_hp[3]=hp/4; - weapon_dam[3]=0; - weapon_ammo[3]=999; - weapon_range[3]=0; - weapon_minrange[3]=0; - - weapon_facing[4]=""; - weapon_cooldown[4]=0; - weapon_hp[4]=hp/4; - weapon_dam[4]=0; - weapon_ammo[4]=999; - weapon_range[4]=0; - weapon_minrange[4]=0; - - weapon_facing[5]=""; - weapon_cooldown[5]=0; - weapon_hp[5]=hp/4; - weapon_dam[5]=0; - weapon_ammo[5]=999; - weapon_range[5]=0; - weapon_minrange[5]=0; - - - - - - if (class="Battle Barge"){ - turrets=3; - weapons=5; - shield_size=3; - sprite_index=spr_ship_bb; - weapon_facing[1]="left"; - weapon_dam[1]=15; - weapon_range[1]=450; - weapon_cooldown[1]=30; - weapon_facing[2]="right"; - weapon_dam[2]=15; - weapon_range[2]=450; - weapon_cooldown[2]=30; - weapon_facing[3]="special"; - weapon_cooldown[3]=90; - weapon_ammo[3]=3; - weapon_range[3]=9999; - weapon_facing[4]="front"; - weapon_dam[4]=12; - weapon_range[4]=1000; - weapon_cooldown[4]=120;// volley several - weapon_facing[5]="most"; - weapon_dam[5]=16; - weapon_range[5]=300; - weapon_cooldown[5]=30; - } - - else if (class=="Slaughtersong" || class=="Gloriana"){turrets=3; - weapons=5;shield_size=3;sprite_index=spr_ship_song; - weapon_facing[1]="most"; - weapon_dam[1]=16; - weapon_range[1]=550; - weapon_cooldown[1]=26; - weapon_facing[2]="most"; - weapon_dam[2]=16; - weapon_range[2]=550; - weapon_cooldown[2]=26; - weapon_facing[3]="most"; - weapon_dam[3]=16; - weapon_range[3]=550; - weapon_cooldown[3]=26; - weapon_facing[4]="front"; - weapon_dam[4]=32; - weapon_range[4]=1000; - weapon_cooldown[4]=90; - } - - - else if (class="Strike Cruiser"){turrets=1; - weapons=4;shield_size=1;sprite_index=spr_ship_stri; - weapon_facing[1]="left"; - weapon_dam[1]=8; - weapon_range[1]=300; - weapon_cooldown[1]=30; - weapon_facing[2]="right"; - weapon_dam[2]=8; - weapon_range[2]=300; - weapon_cooldown[2]=30; - weapon_facing[3]="special"; - weapon_cooldown[3]=90; - weapon_ammo[3]=3; - weapon_range[3]=9999; - weapon_facing[4]="most"; - weapon_dam[4]=12; - weapon_range[4]=300; - weapon_cooldown[4]=30; - } - - else if (class="Hunter"){turrets=1; - weapons=2; - shield_size=1;sprite_index=spr_ship_hunt; - weapon_facing[1]="front"; - weapon_dam[1]=8; - weapon_range[1]=450; - weapon_cooldown[1]=60; - weapon_facing[2]="most"; - weapon_dam[2]=8; - weapon_range[2]=300; - weapon_cooldown[2]=60; - } - - else if (class="Gladius"){ - turrets=1; - weapons=2; - shield_size=1; - sprite_index=spr_ship_glad; - weapon_facing[1]="most"; - weapon_dam[1]=8; - weapon_range[1]=300; - weapon_cooldown[1]=30; - } - - - // STC Bonuses - if (obj_controller.stc_bonus[5]=5){ - armour_front=round(armour_front*1.1);armour_other=round(armour_other*1.1); - } - if (obj_controller.stc_bonus[6]=2){ - armour_front=round(armour_front*1.1);armour_other=round(armour_other*1.1); - } - - - var i=0, unit, b=0; - - for (var co=0;co<=obj_ini.companies;co++){ - for (i=0;i(unit.max_health()/10)){ - array_push(board_co, co); - array_push(board_id, i); - array_push(board_location, 0); - array_push(board_raft, 0); - boarders+=1; - } - // Loc 0: on origin ship - // Loc 1: in transit - // Loc >1: (instance_id), on enemy vessel - if (co==0 && master_present==0 && i<100){ - if (unit.role()==obj_ini.role[100][eROLE.ChapterMaster] && unit.ship_location==ship_id){ - master_present=1; - obj_fleet.control=1; - } - } - } - } - } - - if (boarders>0){ - if (obj_controller.command_set[25]=1) then board_capital=true; - if (obj_controller.command_set[26]=1) then board_frigate=true; - } - - if (hp<=0){ - x=-1000; - y=room_height/2; - } + weapon_facing[1] = ""; + weapon_cooldown[1] = 0; + weapon_hp[1] = hp / 4; + weapon_dam[1] = 0; + weapon_ammo[1] = 999; + weapon_range[1] = 0; + weapon_minrange[1] = 0; + weapon_facing[2] = ""; + weapon_cooldown[2] = 0; + weapon_hp[2] = hp / 4; + weapon_dam[2] = 0; + weapon_ammo[2] = 999; + weapon_range[2] = 0; + weapon_minrange[2] = 0; + + weapon_facing[3] = ""; + weapon_cooldown[3] = 0; + weapon_hp[3] = hp / 4; + weapon_dam[3] = 0; + weapon_ammo[3] = 999; + weapon_range[3] = 0; + weapon_minrange[3] = 0; + + weapon_facing[4] = ""; + weapon_cooldown[4] = 0; + weapon_hp[4] = hp / 4; + weapon_dam[4] = 0; + weapon_ammo[4] = 999; + weapon_range[4] = 0; + weapon_minrange[4] = 0; + + weapon_facing[5] = ""; + weapon_cooldown[5] = 0; + weapon_hp[5] = hp / 4; + weapon_dam[5] = 0; + weapon_ammo[5] = 999; + weapon_range[5] = 0; + weapon_minrange[5] = 0; + + if (class == "Battle Barge") { + turrets = 3; + weapons = 5; + shield_size = 3; + sprite_index = spr_ship_bb; + weapon_facing[1] = "left"; + weapon_dam[1] = 15; + weapon_range[1] = 450; + weapon_cooldown[1] = 30; + weapon_facing[2] = "right"; + weapon_dam[2] = 15; + weapon_range[2] = 450; + weapon_cooldown[2] = 30; + weapon_facing[3] = "special"; + weapon_cooldown[3] = 90; + weapon_ammo[3] = 3; + weapon_range[3] = 9999; + weapon_facing[4] = "front"; + weapon_dam[4] = 12; + weapon_range[4] = 1000; + weapon_cooldown[4] = 120; // volley several + weapon_facing[5] = "most"; + weapon_dam[5] = 16; + weapon_range[5] = 300; + weapon_cooldown[5] = 30; + } else if (class == "Slaughtersong" || class == "Gloriana") { + turrets = 3; + weapons = 5; + shield_size = 3; + sprite_index = spr_ship_song; + weapon_facing[1] = "most"; + weapon_dam[1] = 16; + weapon_range[1] = 550; + weapon_cooldown[1] = 26; + weapon_facing[2] = "most"; + weapon_dam[2] = 16; + weapon_range[2] = 550; + weapon_cooldown[2] = 26; + weapon_facing[3] = "most"; + weapon_dam[3] = 16; + weapon_range[3] = 550; + weapon_cooldown[3] = 26; + weapon_facing[4] = "front"; + weapon_dam[4] = 32; + weapon_range[4] = 1000; + weapon_cooldown[4] = 90; + } else if (class == "Strike Cruiser") { + turrets = 1; + weapons = 4; + shield_size = 1; + sprite_index = spr_ship_stri; + weapon_facing[1] = "left"; + weapon_dam[1] = 8; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; + weapon_facing[2] = "right"; + weapon_dam[2] = 8; + weapon_range[2] = 300; + weapon_cooldown[2] = 30; + weapon_facing[3] = "special"; + weapon_cooldown[3] = 90; + weapon_ammo[3] = 3; + weapon_range[3] = 9999; + weapon_facing[4] = "most"; + weapon_dam[4] = 12; + weapon_range[4] = 300; + weapon_cooldown[4] = 30; + } else if (class == "Hunter") { + turrets = 1; + weapons = 2; + shield_size = 1; + sprite_index = spr_ship_hunt; + weapon_facing[1] = "front"; + weapon_dam[1] = 8; + weapon_range[1] = 450; + weapon_cooldown[1] = 60; + weapon_facing[2] = "most"; + weapon_dam[2] = 8; + weapon_range[2] = 300; + weapon_cooldown[2] = 60; + } else if (class == "Gladius") { + turrets = 1; + weapons = 2; + shield_size = 1; + sprite_index = spr_ship_glad; + weapon_facing[1] = "most"; + weapon_dam[1] = 8; + weapon_range[1] = 300; + weapon_cooldown[1] = 30; + } + + // STC Bonuses + if (obj_controller.stc_bonus[5] == 5) { + armour_front = round(armour_front * 1.1); + armour_other = round(armour_other * 1.1); + } + if (obj_controller.stc_bonus[6] == 2) { + armour_front = round(armour_front * 1.1); + armour_other = round(armour_other * 1.1); + } + + var i = 0, unit, b = 0; + + for (var co = 0; co <= obj_ini.companies; co++) { + for (i = 0; i < array_length(obj_ini.name[co]); i++) { + if (obj_ini.name[co][i] == "") { + continue; + } + unit = fetch_unit([co, i]); + if (unit.ship_location == ship_id) { + if (unit.is_boarder && unit.hp() > (unit.max_health() / 10)) { + array_push(board_co, co); + array_push(board_id, i); + array_push(board_location, 0); + array_push(board_raft, 0); + boarders += 1; + } + // Loc 0: on origin ship + // Loc 1: in transit + // Loc >1: (instance_id), on enemy vessel + if (co == 0 && master_present == 0 && i < 100) { + if (unit.role() == obj_ini.role[100][eROLE.ChapterMaster] && unit.ship_location == ship_id) { + master_present = 1; + obj_fleet.control = 1; + } + } + } + } + } + + if (boarders > 0) { + if (obj_controller.command_set[25] == 1) { + board_capital = true; + } + if (obj_controller.command_set[26] == 1) { + board_frigate = true; + } + } + + if (hp <= 0) { + x = -1000; + y = room_height / 2; + } } - - From f38cfcc140532168ce104b2595e3aa40252db14c Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sun, 28 Dec 2025 18:24:07 -0500 Subject: [PATCH 44/45] JSDocs are gonna be the life of me with what a method really expects/needs. --- objects/obj_creation/Create_0.gml | 4 +- scripts/scr_chapter_new/scr_chapter_new.gml | 2 +- .../scr_serialization_functions.gml | 92 +++++++++---------- .../scr_system_search_helpers.gml | 40 +++++++- 4 files changed, 84 insertions(+), 54 deletions(-) diff --git a/objects/obj_creation/Create_0.gml b/objects/obj_creation/Create_0.gml index d8f730d264..2e327cfc84 100644 --- a/objects/obj_creation/Create_0.gml +++ b/objects/obj_creation/Create_0.gml @@ -358,13 +358,13 @@ all_chapters[eCHAPTERS.CUSTOM_9].splash = custom_splash; all_chapters[eCHAPTERS.CUSTOM_10].splash = custom_splash; // Load from files to overwrite hardcoded ones -for (var c = 1; c < 40; c++) { +for (var c = 1; c < 31; c++) { var use_app_data = false; if (c < array_length(all_chapters) && all_chapters[c].origin == eCHAPTER_ORIGINS.CUSTOM) { use_app_data = true; } var json_chapter = new ChapterData(); - var success = json_chapter.load_from_json(eCHAPTERS[c], use_app_data); + var success = json_chapter.load_from_json(c, use_app_data); if (success) { all_chapters[c] = new ChapterDataLite(json_chapter.id, json_chapter.origin, json_chapter.founding, json_chapter.name, json_chapter.flavor,); all_chapters[c].json = true; diff --git a/scripts/scr_chapter_new/scr_chapter_new.gml b/scripts/scr_chapter_new/scr_chapter_new.gml index a18bd97897..78af803b1e 100644 --- a/scripts/scr_chapter_new/scr_chapter_new.gml +++ b/scripts/scr_chapter_new/scr_chapter_new.gml @@ -149,7 +149,7 @@ function ChapterData() constructor { custom_advisors = {}; /// @desc Returns true if loaded successfully, false if not. - /// @param {Enum.eCHAPTERS} chapter_id + /// @param {Real} chapter_id /// @param {Bool} use_app_data if set to true will read from %AppData%/Local/ChapterMaster instead of /datafiles /// @returns {Bool} function load_from_json(chapter_id, use_app_data = false) { diff --git a/scripts/scr_serialization_functions/scr_serialization_functions.gml b/scripts/scr_serialization_functions/scr_serialization_functions.gml index 81954a093f..6439da7531 100644 --- a/scripts/scr_serialization_functions/scr_serialization_functions.gml +++ b/scripts/scr_serialization_functions/scr_serialization_functions.gml @@ -4,50 +4,50 @@ /// @param {array} _exclude - List of variable names to exclude. /// @param {array} _exclude_start - List of string prefixes; variables starting with any of these will be excluded. function copy_serializable_fields(_source, _destination, _exclude = [], _exclude_start = []) { - /// Check all object variable values types and save the simple ones dynamically. - /// simple types are numbers, strings, bools. arrays of only simple types are also considered simple. - /// non-simple types are structs, functions, methods - /// functions and methods will be ignored completely, structs to be manually serialized/deserialised. - - var _all_names = struct_get_names(_source); - var _len = array_length(_all_names); - - for (var i = 0; i < _len; i++) { - var _field_name = _all_names[i]; - var _field_value = _source[$ _field_name]; - - if (is_method(_field_value)) { - continue; - } - - if (array_contains(_exclude, _field_name)) { - continue; // excluded by the full name - } - - if (string_starts_with_any(_field_name, _exclude_start)) { - continue; // excluded by the prefix - } - - if (struct_exists(_destination, _field_name)) { - continue; // already added - } - - if (is_basic_variable(_field_value)) { - variable_struct_set(_destination, _field_name, _field_value); - continue; - } - - if (is_array(_field_value)) { - if (!is_basic_array(_field_value, 2)) { - var _source_obj_name = struct_exists(_source, "object_index") ? object_get_name(_source.object_index) : ""; - log_warning($"Bad array save: '{_field_name}' internal type found was not a simple type and should probably have it's own serialize function - {_source_obj_name}!"); - } else { - variable_struct_set(_destination, _field_name, _field_value); - } - continue; - } - - var _source_obj_name = struct_exists(_source, "object_index") ? object_get_name(_source.object_index) : ""; - log_warning($"{_source_obj_name} - '{_field_name}' key contains a {typeof(_field_value)} variable which has not been serialized. \n\tEnsure that serialization is written into the serialize and deserialization function if it is needed for this value, or that the variable is added to the ignore list to suppress this warning!"); - } + /// Check all object variable values types and save the simple ones dynamically. + /// simple types are numbers, strings, bools. arrays of only simple types are also considered simple. + /// non-simple types are structs, functions, methods + /// functions and methods will be ignored completely, structs to be manually serialized/deserialised. + + var _all_names = struct_get_names(_source); + var _len = array_length(_all_names); + + for (var i = 0; i < _len; i++) { + var _field_name = _all_names[i]; + var _field_value = _source[$ _field_name]; + + if (is_method(_field_value)) { + continue; + } + + if (array_contains(_exclude, _field_name)) { + continue; // excluded by the full name + } + + if (string_starts_with_any(_field_name, _exclude_start)) { + continue; // excluded by the prefix + } + + if (struct_exists(_destination, _field_name)) { + continue; // already added + } + + if (is_basic_variable(_field_value)) { + variable_struct_set(_destination, _field_name, _field_value); + continue; + } + + if (is_array(_field_value)) { + if (!is_basic_array(_field_value, 2)) { + var _source_obj_name = struct_exists(_source, "object_index") ? object_get_name(_source.object_index) : ""; + log_warning($"Bad array save: '{_field_name}' internal type found was not a simple type and should probably have it's own serialize function - {_source_obj_name}!"); + } else { + variable_struct_set(_destination, _field_name, _field_value); + } + continue; + } + + var _source_obj_name = struct_exists(_source, "object_index") ? object_get_name(_source.object_index) : ""; + log_warning($"{_source_obj_name} - '{_field_name}' key contains a {typeof(_field_value)} variable which has not been serialized. \n\tEnsure that serialization is written into the serialize and deserialization function if it is needed for this value, or that the variable is added to the ignore list to suppress this warning!"); + } } diff --git a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml index 1aedb54e32..5ad1484d70 100644 --- a/scripts/scr_system_search_helpers/scr_system_search_helpers.gml +++ b/scripts/scr_system_search_helpers/scr_system_search_helpers.gml @@ -42,7 +42,13 @@ function population_larger(large_pop1, pop1, large_pop2, pop2) { //TODO make an adaptive allies system function NSystemSearchHelpers() constructor { - static default_allies = [eFACTION.Player, eFACTION.Imperium, eFACTION.Mechanicus, eFACTION.Inquisition, eFACTION.Ecclesiarchy]; + static default_allies = [ + eFACTION.Player, + eFACTION.Imperium, + eFACTION.Mechanicus, + eFACTION.Inquisition, + eFACTION.Ecclesiarchy + ]; } global.SystemHelps = new NSystemSearchHelpers(); @@ -50,7 +56,12 @@ global.SystemHelps = new NSystemSearchHelpers(); function fetch_faction_group(group = "imperium_default") { switch (group) { case "imperium_default": - var imperium = [eFACTION.Imperium, eFACTION.Mechanicus, eFACTION.Inquisition, eFACTION.Ecclesiarchy]; + var imperium = [ + eFACTION.Imperium, + eFACTION.Mechanicus, + eFACTION.Inquisition, + eFACTION.Ecclesiarchy + ]; if (obj_controller.faction_status[eFACTION.Imperium] != "War") { array_push(imperium, eFACTION.Player); } @@ -389,9 +400,9 @@ function nearest_from_array(xx, yy, list) { return _nearest; } -function is_dead_star(star = "none") { +function is_dead_star(star = noone) { var dead_star = true; - if (star == "none") { + if (star == noone) { for (var i = 1; i <= planets; i++) { if (p_type[i] != "dead") { dead_star = false; @@ -451,7 +462,26 @@ function meet_system_governors(system) { function scr_planet_image_numbers(p_type) { var image = 0; - image_map = ["", "Lava", "Lava", "Desert", "Forge", "Hive", "Death", "Agri", "Feudal", "Temperate", "Ice", "Dead", "Daemon", "Craftworld", "", "Space Hulk", "", "Shrine"]; + image_map = [ + "", + "Lava", + "Lava", + "Desert", + "Forge", + "Hive", + "Death", + "Agri", + "Feudal", + "Temperate", + "Ice", + "Dead", + "Daemon", + "Craftworld", + "", + "Space Hulk", + "", + "Shrine" + ]; for (var i = 0; i < array_length(image_map); i++) { if (image_map[i] == p_type) { return i; From 62782f5c094db3db80151b8d5b2cc245d1e2867e Mon Sep 17 00:00:00 2001 From: carys-the-weed-cloud <36204825+carys-the-weed-cloud@users.noreply.github.com> Date: Sun, 28 Dec 2025 18:57:18 -0500 Subject: [PATCH 45/45] A few more Type mismatches corrected. --- .../scr_draw_unit_stat_data.gml | 31 +- scripts/scr_hit/scr_hit.gml | 368 +++++++++--------- 2 files changed, 199 insertions(+), 200 deletions(-) diff --git a/scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml b/scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml index 73fefed116..780ed3746c 100644 --- a/scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml +++ b/scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml @@ -2,13 +2,12 @@ // https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information function scr_draw_unit_stat_data(manage = false, data_block = {x1: 1008, y1: 520, w: 569, h: 303}, squeezed = false) { var _cur_font = draw_get_font(); + var xx = 0; + var yy = 0; draw_set_font(fnt_40k_14); - if (event_number == ev_gui) { - xx = 0; - yy = 0; - } else { - var xx = camera_get_view_x(view_camera[0]) + 0; - var yy = camera_get_view_y(view_camera[0]) + 0; + if (event_number != ev_gui) { + xx = camera_get_view_x(view_camera[0]) + 0; + yy = camera_get_view_y(view_camera[0]) + 0; } var stat_tool_tips = []; var trait_tool_tips = []; @@ -28,21 +27,21 @@ function scr_draw_unit_stat_data(manage = false, data_block = {x1: 1008, y1: 520 data_block.y_mid = (data_block.y1 + data_block.y2) / 2; var attribute_box = { - x1: data_block.x1 + (squeezed ? 42 : 84), - y1: data_block.y1 + 8, - w: 32, - h: 48, + attr_top_left_x: data_block.x1 + (squeezed ? 42 : 84), + attr_top_left_y: data_block.y1 + 8, + attr_w: 32, + attr_h: 48, + attr_bottom_right_x: (attr_top_left_x + attr_w), + attr_bottom_right_y: (attr_top_left_y + attr_h), + x_mid: (attr_top_left_x + attr_bottom_right_x) / 2, + y_mid: (attr_top_left_y + attr_bottom_right_y) / 2, enter: function() { - return scr_hit(x1, y1, x2, y2); + return scr_hit(attr_top_left_x, attr_top_left_y, attr_bottom_right_x, attr_bottom_right_y); }, draw: function(outline) { - draw_rectangle(x1, y1, x2, y2, outline); + draw_rectangle(attr_top_left_x, attr_top_left_y, attr_bottom_right_x, attr_bottom_right_y, outline); }, }; - attribute_box.x2 = attribute_box.x1 + attribute_box.w; - attribute_box.y2 = attribute_box.y1 + attribute_box.h; - attribute_box.x_mid = (attribute_box.x1 + attribute_box.x2) / 2; - attribute_box.y_mid = (attribute_box.y1 + attribute_box.y2) / 2; stat_display_list = [["Measure of how quick and nimble unit is as well as their base ability to manipulate and do tasks with their hands.##Influences Ranged Attack", "dexterity"], ["How strong a unit. Strong units can wield heavier equipment without penalties and are more deadly in close combat.##Influences Melee Attack#Influences Melee Burden Cap#Influences Ranged Burden Cap", "strength"], ["Unit's general toughness and resistance to damage.##Influences Health#Influences Damage Resistance", "constitution"], ["Measure of learnt knowledge and specialist skill aptitude.##Influences esoteric knowledge and use of force weapons", "intelligence"], ["Unit's perception and street smarts including certain types of battlefield knowledge.##Influences tactical decisions and garrison effects", "wisdom"], ["Unit's faith in their given religion or general aptitude towards faith.##Influences resistance to corruption", "piety"], ["General skill with close combat weaponry.##Influences Melee Attack#Influences Melee Burden Cap", "weapon_skill"], ["General skill with ballistic and ranged weaponry.##Influences Ranged Attack#Influences Ranged Burden Cap", "ballistic_skill"], ["...Luck...", "luck"], ["Skill and understanding of technology and various technical thingies and ability to interact with the machine spirit.##Influences Forge point output", "technology"], ["General likeability and ability to interact with people.##Influences disposition increases and decreases#Influences ability to spread corruption", "charisma"]]; // draw_set_color(c_gray); diff --git a/scripts/scr_hit/scr_hit.gml b/scripts/scr_hit/scr_hit.gml index b1c4ea0724..a8ef05cc11 100644 --- a/scripts/scr_hit/scr_hit.gml +++ b/scripts/scr_hit/scr_hit.gml @@ -1,24 +1,23 @@ /// @function scr_hit /// @description Returns true if mouse is hovering on the specified rectangle area. /// @returns {bool} -function scr_hit(x1=0, y1=0, x2=0, y2=0) { - var _mouse_consts = return_mouse_consts(); - if (is_array(x1)){ - return point_in_rectangle(_mouse_consts[0],_mouse_consts[1],x1[0],x1[1],x1[2],x1[3]); - } else { - return point_in_rectangle(_mouse_consts[0],_mouse_consts[1],x1, y1, x2, y2); - } +function scr_hit(x1 = 0, y1 = 0, x2 = 0, y2 = 0) { + var _mouse_consts = return_mouse_consts(); + if (is_array(x1)) { + return point_in_rectangle(_mouse_consts[0], _mouse_consts[1], x1[0], x1[1], x1[2], x1[3]); + } else { + return point_in_rectangle(_mouse_consts[0], _mouse_consts[1], x1, y1, x2, y2); + } } -function scr_hit_relative(x1, relative = [0,0]){ - var _mouse_consts = return_mouse_consts(); - return point_in_rectangle(_mouse_consts[0],_mouse_consts[1],relative[0] + x1[0],relative[1] + x1[1],relative[0] + x1[2],relative[1] + x1[3]); +function scr_hit_relative(x1, relative = [0, 0]) { + var _mouse_consts = return_mouse_consts(); + return point_in_rectangle(_mouse_consts[0], _mouse_consts[1], relative[0] + x1[0], relative[1] + x1[1], relative[0] + x1[2], relative[1] + x1[3]); } -function scr_hit_dimensions(x1=0, y1=0,w=0,h=0){ - var _mouse_consts = return_mouse_consts(); - return point_in_rectangle(_mouse_consts[0],_mouse_consts[1],x1, y1,x1+w, y1+h); - +function scr_hit_dimensions(x1 = 0, y1 = 0, w = 0, h = 0) { + var _mouse_consts = return_mouse_consts(); + return point_in_rectangle(_mouse_consts[0], _mouse_consts[1], x1, y1, x1 + w, y1 + h); } /// @function point_and_click @@ -26,187 +25,188 @@ function scr_hit_dimensions(x1=0, y1=0,w=0,h=0){ /// @param {array} rect x1, y1, x2, y2 array. /// @returns {bool} function point_and_click(rect, cooldown = 60, lock_bypass = false) { - if (lock_bypass == false && global.ui_click_lock == true) { - return false; - } - - var _mouse_clicked = event_number==ev_gui ? device_mouse_check_button_pressed(0,mb_left) : mouse_check_button_pressed(mb_left); - if (!_mouse_clicked) { - return false; - } - - var _point_check = scr_hit(rect[0], rect[1],rect[2], rect[3]); - if (!_point_check) { - return false; - } - - var controller_exist = instance_exists(obj_controller); - var main_menu_exists = instance_exists(obj_main_menu); - var creation_screen_exists = instance_exists(obj_creation); - if (controller_exist && obj_controller.cooldown > 0) { - log_warning("Ignored click for cooldown, {obj_controller.cooldown} steps remaining!"); - log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); - return false; - } else if (main_menu_exists) { - if (main_menu_exists) { - if (obj_main_menu.cooldown > 0) { - log_warning($"Ignored click for cooldown, {obj_main_menu.cooldown} steps remaining!"); - log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); - return false; - } - } else if (creation_screen_exists) { - if (obj_creation.cooldown > 0) { - log_warning($"Ignored click for cooldown, {obj_creation.cooldown} steps remaining!"); - log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); - return false; - } - } - } - - var _mouse_consts = return_mouse_consts(); - var point_check = point_in_rectangle(_mouse_consts[0], _mouse_consts[1], rect[0], rect[1],rect[2], rect[3]); - if (point_check && cooldown > 0) { - if (controller_exist) { - obj_controller.cooldown = cooldown * delta_time/1000000; - if(is_debug_overlay_open()){ - show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); - } - } if (main_menu_exists) { - obj_main_menu.cooldown = cooldown * delta_time/1000000; - if(is_debug_overlay_open()){ - show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); - } - } else if (creation_screen_exists) { - obj_creation.cooldown = cooldown * delta_time/1000000; - if(is_debug_overlay_open()){ - show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); - } - } - // log_message("scr_click_left: clicked and set cooldown!"); - // show_debug_message($"{array_to_string_list(debug_get_callstack())}"); - } - - if(is_debug_overlay_open()){ - show_debug_message($"Mouse Clicked at: x: {_mouse_consts[0]} y: {_mouse_consts[1]} {array_to_string_list(debug_get_callstack(), true)}!"); - } - - return true; + if (lock_bypass == false && global.ui_click_lock == true) { + return false; + } + + var _mouse_clicked = event_number == ev_gui ? device_mouse_check_button_pressed(0, mb_left) : mouse_check_button_pressed(mb_left); + if (!_mouse_clicked) { + return false; + } + + var _point_check = scr_hit(rect[0], rect[1], rect[2], rect[3]); + if (!_point_check) { + return false; + } + + var controller_exist = instance_exists(obj_controller); + var main_menu_exists = instance_exists(obj_main_menu); + var creation_screen_exists = instance_exists(obj_creation); + if (controller_exist && obj_controller.cooldown > 0) { + log_warning("Ignored click for cooldown, {obj_controller.cooldown} steps remaining!"); + log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); + return false; + } else if (main_menu_exists) { + if (main_menu_exists) { + if (obj_main_menu.cooldown > 0) { + log_warning($"Ignored click for cooldown, {obj_main_menu.cooldown} steps remaining!"); + log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); + return false; + } + } else if (creation_screen_exists) { + if (obj_creation.cooldown > 0) { + log_warning($"Ignored click for cooldown, {obj_creation.cooldown} steps remaining!"); + log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); + return false; + } + } + } + + var _mouse_consts = return_mouse_consts(); + var point_check = point_in_rectangle(_mouse_consts[0], _mouse_consts[1], rect[0], rect[1], rect[2], rect[3]); + if (point_check && cooldown > 0) { + if (controller_exist) { + obj_controller.cooldown = cooldown * delta_time / 1000000; + if (is_debug_overlay_open()) { + show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); + } + } + if (main_menu_exists) { + obj_main_menu.cooldown = cooldown * delta_time / 1000000; + if (is_debug_overlay_open()) { + show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); + } + } else if (creation_screen_exists) { + obj_creation.cooldown = cooldown * delta_time / 1000000; + if (is_debug_overlay_open()) { + show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); + } + } + // log_message("scr_click_left: clicked and set cooldown!"); + // show_debug_message($"{array_to_string_list(debug_get_callstack())}"); + } + + if (is_debug_overlay_open()) { + show_debug_message($"Mouse Clicked at: x: {_mouse_consts[0]} y: {_mouse_consts[1]} {array_to_string_list(debug_get_callstack(), true)}!"); + } + + return true; } -function point_and_click_sprite(x1, y1, sprite, x_scale = 1, y_scale = 1){ - var _width = sprite_get_width(sprite) * x_scale; - var _height = sprite_get_height(sprite) * y_scale; - return point_and_click([x1, y1, x1 +_width, y1 + _height]); +function point_and_click_sprite(x1, y1, sprite, x_scale = 1, y_scale = 1) { + var _width = sprite_get_width(sprite) * x_scale; + var _height = sprite_get_height(sprite) * y_scale; + return point_and_click([x1, y1, x1 + _width, y1 + _height]); } -function scr_click_left(cooldown = 60, lock_bypass = false){ - if (lock_bypass == false && global.ui_click_lock == true) { - return false; - } - - var mouse_clicked = event_number==ev_gui ? device_mouse_check_button_pressed(0,mb_left) : mouse_check_button_pressed(mb_left); - if (!mouse_clicked) { - return false; - } - - var controller_exist = instance_exists(obj_controller); - if (controller_exist && obj_controller.cooldown > 0) { - log_warning($"Ignored click for cooldown, {obj_controller.cooldown} steps remaining!"); - log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); - return false; - } else if (controller_exist && cooldown > 0) { - // log_message("scr_click_left: clicked and set cooldown!"); - // show_debug_message($"{array_to_string_list(debug_get_callstack())}"); - obj_controller.cooldown = cooldown * delta_time/1000000; - if(is_debug_overlay_open()){ - show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); - } - } else if (!controller_exist) { - var main_menu_exists = instance_exists(obj_main_menu); - var creation_screen_exists = instance_exists(obj_creation); - if (main_menu_exists) { - if (obj_main_menu.cooldown > 0) { - log_warning($"Ignored click for cooldown, {obj_main_menu.cooldown} steps remaining!"); - log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); - return false; - } else if (cooldown > 0) { - obj_main_menu.cooldown = cooldown * delta_time/1000000; - if(is_debug_overlay_open()){ - show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); - } - } - } else if (creation_screen_exists) { - if (obj_creation.cooldown > 0) { - log_warning($"Ignored click for cooldown, {obj_creation.cooldown} steps remaining!"); - log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); - return false; - } else if (cooldown > 0) { - obj_creation.cooldown = cooldown * delta_time/1000000; - if(is_debug_overlay_open()){ - show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); - } - } - } - } - - if(is_debug_overlay_open()){ - show_debug_message($"Mouse Clicked! {array_to_string_list(debug_get_callstack(), true)}"); - } - - return mouse_clicked; +function scr_click_left(cooldown = 60, lock_bypass = false) { + if (lock_bypass == false && global.ui_click_lock == true) { + return false; + } + + var mouse_clicked = event_number == ev_gui ? device_mouse_check_button_pressed(0, mb_left) : mouse_check_button_pressed(mb_left); + if (!mouse_clicked) { + return false; + } + + var controller_exist = instance_exists(obj_controller); + if (controller_exist && obj_controller.cooldown > 0) { + log_warning($"Ignored click for cooldown, {obj_controller.cooldown} steps remaining!"); + log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); + return false; + } else if (controller_exist && cooldown > 0) { + // log_message("scr_click_left: clicked and set cooldown!"); + // show_debug_message($"{array_to_string_list(debug_get_callstack())}"); + obj_controller.cooldown = cooldown * delta_time / 1000000; + if (is_debug_overlay_open()) { + show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); + } + } else if (!controller_exist) { + var main_menu_exists = instance_exists(obj_main_menu); + var creation_screen_exists = instance_exists(obj_creation); + if (main_menu_exists) { + if (obj_main_menu.cooldown > 0) { + log_warning($"Ignored click for cooldown, {obj_main_menu.cooldown} steps remaining!"); + log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); + return false; + } else if (cooldown > 0) { + obj_main_menu.cooldown = cooldown * delta_time / 1000000; + if (is_debug_overlay_open()) { + show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); + } + } + } else if (creation_screen_exists) { + if (obj_creation.cooldown > 0) { + log_warning($"Ignored click for cooldown, {obj_creation.cooldown} steps remaining!"); + log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); + return false; + } else if (cooldown > 0) { + obj_creation.cooldown = cooldown * delta_time / 1000000; + if (is_debug_overlay_open()) { + show_debug_message($"Cooldown Set! {array_to_string_list(debug_get_callstack(), true)}"); + } + } + } + } + + if (is_debug_overlay_open()) { + show_debug_message($"Mouse Clicked! {array_to_string_list(debug_get_callstack(), true)}"); + } + + return mouse_clicked; } function mouse_button_held(_button = mb_left) { - var mouse_held = event_number==ev_gui ? device_mouse_check_button(0,_button) : mouse_check_button(_button); - if (!mouse_held) { - return false; - } - - var controller_exist = instance_exists(obj_controller); - if (controller_exist && obj_controller.cooldown > 0) { - log_warning($"Ignored click for cooldown, {obj_controller.cooldown} steps remaining!"); - log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); - return false; - } else if (!controller_exist) { - var main_menu_exists = instance_exists(obj_main_menu); - var creation_screen_exists = instance_exists(obj_creation); - if (main_menu_exists) { - if (obj_main_menu.cooldown > 0) { - log_warning($"Ignored click for cooldown, {obj_main_menu.cooldown} steps remaining!"); - log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); - return false; - } - } else if (creation_screen_exists) { - if (obj_creation.cooldown > 0) { - log_warning($"Ignored click for cooldown, {obj_creation.cooldown} steps remaining!"); - log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); - return false; - } - } - } - - return mouse_held; + var mouse_held = event_number == ev_gui ? device_mouse_check_button(0, _button) : mouse_check_button(_button); + if (!mouse_held) { + return false; + } + + var controller_exist = instance_exists(obj_controller); + if (controller_exist && obj_controller.cooldown > 0) { + log_warning($"Ignored click for cooldown, {obj_controller.cooldown} steps remaining!"); + log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); + return false; + } else if (!controller_exist) { + var main_menu_exists = instance_exists(obj_main_menu); + var creation_screen_exists = instance_exists(obj_creation); + if (main_menu_exists) { + if (obj_main_menu.cooldown > 0) { + log_warning($"Ignored click for cooldown, {obj_main_menu.cooldown} steps remaining!"); + log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); + return false; + } + } else if (creation_screen_exists) { + if (obj_creation.cooldown > 0) { + log_warning($"Ignored click for cooldown, {obj_creation.cooldown} steps remaining!"); + log_warning($"Click callstack: \n{array_to_string_list(debug_get_callstack(), true)}"); + return false; + } + } + } + + return mouse_held; } -function return_mouse_consts(){ - var mouse_const_x; - var mouse_const_y; - if (event_number==ev_gui){ - mouse_const_x = device_mouse_x_to_gui(0); - mouse_const_y = device_mouse_y_to_gui(0); - } else { - mouse_const_x = mouse_x; - mouse_const_y = mouse_y; - } - return [mouse_const_x,mouse_const_y] +function return_mouse_consts() { + var mouse_const_x; + var mouse_const_y; + if (event_number == ev_gui) { + mouse_const_x = device_mouse_x_to_gui(0); + mouse_const_y = device_mouse_y_to_gui(0); + } else { + mouse_const_x = mouse_x; + mouse_const_y = mouse_y; + } + return [mouse_const_x, mouse_const_y]; } -function mouse_distance_less(xx, yy, distance){ - var _mouse_consts = return_mouse_consts(); - return (point_distance(xx,yy,_mouse_consts[0],_mouse_consts[1])<=distance) +function mouse_distance_less(xx, yy, distance) { + var _mouse_consts = return_mouse_consts(); + return point_distance(xx, yy, _mouse_consts[0], _mouse_consts[1]) <= distance; } -function return_mouse_consts_tooltip(){ - var consts = return_mouse_consts(); - return [consts[0], consts[1]] +function return_mouse_consts_tooltip() { + var consts = return_mouse_consts(); + return [consts[0], consts[1]]; }