Skip to content

Commit

Permalink
Glow chess game
Browse files Browse the repository at this point in the history
- Fixed: It is now possible to win the chess game against Zax in the Glow when using the vanilla chess game dialog (advanced chess game has been moved behind a new toggle option in the fo1_settings.ini file).
- Tweaked: Restored the original chess game dialog with Zax in the Glow.
- Tweaked: The expanded chess game with Zax is now behind a new GVAR_ENABLE_FIXT_CHESS toggle option (see fo1_settings.ini file). Disabled by default.
  • Loading branch information
Lexx2k committed Jun 16, 2024
1 parent d2c1d2d commit b41d2e9
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 121 deletions.
254 changes: 142 additions & 112 deletions Fallout2/Fallout1in2/Mapper/source/scripts/09glow/ZAX.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,148 @@ procedure ZAX11 begin
end

procedure ZAX12 begin
Reply(mstr(148) + local_var(LVAR_Chess_Wins) + mstr(228) + local_var(LVAR_Chess_Draws) + mstr(229) + local_var(LVAR_Chess_Losses) + mstr(230));
NOption(215, ChessBlack, 5);
NOption(216, ChessWhite, 5);
if (fixt_enabled or fo1in2_fixt_chess_enabled) then begin
Reply(mstr(1481) + local_var(LVAR_Chess_Wins) + mstr(228) + local_var(LVAR_Chess_Draws) + mstr(229) + local_var(LVAR_Chess_Losses) + mstr(230));
NOption(215, ChessBlack, 5);
NOption(216, ChessWhite, 5);
end
else begin
variable Intelligence_Roll := 0;
NMessage(148);
gfade_out(600);
game_time_advance(game_ticks(7200));
Intelligence_Roll := roll_vs_stat(dude_obj, STAT_iq, 0);
gfade_in(600);
if (is_success(Intelligence_Roll)) then begin
if (is_critical(Intelligence_Roll)) then begin
Reply(149);
set_local_var(LVAR_Chess_GiveExp, 1);
set_global_var(GVAR_GLOW_ZAX_STATE, 2);
give_xp_msg(EXP_WON_IN_CHESS, mstr(227));
inc_glow_rep(REP_BONUS_DEFEAT_ZAX);
end
else begin
Reply(150);
end
end
else begin
Reply(150);
end
if (local_var(LVAR_Chess_GiveExp) == 0) then begin
NOption(151, Zax12, 5);
end
NOption(152, Zax01, 5);
end
end

procedure ZAX13 begin
NMessage(153);
end

procedure ZAX14 begin
Reply(154);
NOption(155, ZAX13, 5);
NOption(156, ZAX01, 5);
end

procedure ZAX15 begin
NMessage(157);
Reply(158);
NOption(159, ZAX16, 5);
NOption(160, ZAX17, 7);
NOption(161, ZAX18, 9);
end

procedure ZAX16 begin
Reply(162);
NOption(163, ZAX01, 5);
NOption(164, ZAX17, 7);
NOption(165, ZAX18, 9);
end

procedure ZAX17 begin
Reply(166);
NOption(167, ZAX01, 5);
NOption(168, ZAX18, 9);
end

procedure ZAX18 begin
NMessage(169);
NMessage(170);
NMessage(171);
NMessage(172);
Reply(173);
NOption(174, ZAX19, 9);
NOption(175, ZAX20, 10);
NOption(176, ZAX01, 5);
NOption(177, ZAX13, 5);
end

procedure ZAX19 begin
NMessage(178);
NMessage(179);
Reply(180);
NOption(181, ZAX20, 10);
NOption(182, ZAX01, 5);
NOption(183, ZAX13, 5);
end

procedure ZAX20 begin
Reply(184);
NOption(185, ZAX19, 9);
NOption(186, ZAX01, 5);
NOption(187, ZAX13, 5);
end

procedure ZAX21 begin
Reply(188);
NOption(189, ZAX22, 5);
NOption(190, ZAX23, 5);
NOption(191, ZAX24, 5);
NOption(192, ZAX01, 5);
end

procedure ZAX22 begin
Reply(193);
NOption(194, ZAX23, 5);
NOption(195, ZAX24, 5);
NOption(196, ZAX01, 5);
NOption(197, ZAX13, 5);
end

procedure ZAX23 begin
Reply(198);
NOption(199, ZAX22, 5);
NOption(200, ZAX24, 5);
NOption(201, ZAX01, 5);
NOption(202, ZAX13, 5);
end

procedure ZAX24 begin
Reply(203);
NOption(204, ZAX22, 5);
NOption(205, ZAX23, 5);
NOption(206, ZAX01, 5);
NOption(207, ZAX13, 5);
end

procedure ZAX25 begin
NMessage(208);
if glow_weapons_locked then begin
NMessage(209);
set_glow_weapons_unlocked;
end
end

procedure ZAXClearance begin
if glow_traps_active then begin
NMessage(210);
NMessage(211);
set_glow_taps_active;
end
end

// FIXT CHESS GAME
procedure ChessBlack begin
BLACK := 1;
WHITE := 0;
Expand Down Expand Up @@ -365,113 +502,6 @@ procedure ChessPLAY begin
NOption(152, ZAX01, 5);
end

procedure ZAX13 begin
NMessage(153);
end

procedure ZAX14 begin
Reply(154);
NOption(155, ZAX13, 5);
NOption(156, ZAX01, 5);
end

procedure ZAX15 begin
NMessage(157);
Reply(158);
NOption(159, ZAX16, 5);
NOption(160, ZAX17, 7);
NOption(161, ZAX18, 9);
end

procedure ZAX16 begin
Reply(162);
NOption(163, ZAX01, 5);
NOption(164, ZAX17, 7);
NOption(165, ZAX18, 9);
end

procedure ZAX17 begin
Reply(166);
NOption(167, ZAX01, 5);
NOption(168, ZAX18, 9);
end

procedure ZAX18 begin
NMessage(169);
NMessage(170);
NMessage(171);
NMessage(172);
Reply(173);
NOption(174, ZAX19, 9);
NOption(175, ZAX20, 10);
NOption(176, ZAX01, 5);
NOption(177, ZAX13, 5);
end

procedure ZAX19 begin
NMessage(178);
NMessage(179);
Reply(180);
NOption(181, ZAX20, 10);
NOption(182, ZAX01, 5);
NOption(183, ZAX13, 5);
end

procedure ZAX20 begin
Reply(184);
NOption(185, ZAX19, 9);
NOption(186, ZAX01, 5);
NOption(187, ZAX13, 5);
end

procedure ZAX21 begin
Reply(188);
NOption(189, ZAX22, 5);
NOption(190, ZAX23, 5);
NOption(191, ZAX24, 5);
NOption(192, ZAX01, 5);
end

procedure ZAX22 begin
Reply(193);
NOption(194, ZAX23, 5);
NOption(195, ZAX24, 5);
NOption(196, ZAX01, 5);
NOption(197, ZAX13, 5);
end

procedure ZAX23 begin
Reply(198);
NOption(199, ZAX22, 5);
NOption(200, ZAX24, 5);
NOption(201, ZAX01, 5);
NOption(202, ZAX13, 5);
end

procedure ZAX24 begin
Reply(203);
NOption(204, ZAX22, 5);
NOption(205, ZAX23, 5);
NOption(206, ZAX01, 5);
NOption(207, ZAX13, 5);
end

procedure ZAX25 begin
NMessage(208);
if glow_weapons_locked then begin
NMessage(209);
set_glow_weapons_unlocked;
end
end

procedure ZAXClearance begin
if glow_traps_active then begin
NMessage(210);
NMessage(211);
set_glow_taps_active;
end
end

procedure Term01 begin
gsay_reply(SCRIPT_GPWRTERM, 100);
giq_option(4, SCRIPT_GPWRTERM, 101, Term02, NEUTRAL_REACTION);
Expand Down Expand Up @@ -638,7 +668,7 @@ procedure Mainframe00 begin
end
else begin
gsay_message(SCRIPT_GPWRTERM, 201, NEUTRAL_REACTION);
display_msg(mstr(214));
display_msg(mstr(300));
end
end

Expand Down Expand Up @@ -726,7 +756,7 @@ procedure Mainframe04a begin
end
else begin
if (local_var(9) == 1) then begin
display_msg(mstr(214));
display_msg(mstr(300));
call Mainframe10;
end
else begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ procedure settings begin
gvar_settings(GVAR_BOS_LORRI_NUM_OPS_ALLOWED);
gvar_settings(GVAR_ENABLE_HOOKERS);
gvar_settings(GVAR_HUNTER_RESPAWNS);
gvar_settings(GVAR_ENABLE_FIXT_CHESS);
end
procedure start begin
Expand Down
28 changes: 28 additions & 0 deletions Fallout2/Fallout1in2/Mapper/source/scripts/headers/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,34 @@ variable step_tile;
#define stat_success(x,y,z) is_success(do_check(x,y,z))
#define dude_stat_success(y,z) stat_success(dude_obj,y,z)

/**
Taken from RPU - https://github.com/BGforgeNet/Fallout2_Unofficial_Patch/blob/master/scripts_src/headers/command.h#L490
* Like `roll_vs_skill`, but for stat roll checks.
* Because `do_check` can't generate criticals.
* Returns one of the ROLL_* constants, can be used in `is_critical`.
* Average luck of 5 provides DnD-like 1/20 chance to upgrade success to critical.
* For failures, engine doesn't use mods, we follow suit.
* Maybe Jinxed should work here too.
* @arg {ObjPtr} who Critter
* @arg {int} stat STAT_*
* @arg {int} mod Difficulty mod
* @ret {int}
*/
procedure roll_vs_stat(variable who, variable stat, variable mod) begin
variable rnd = random(1, 100);
variable success = is_success(do_check(who, stat, mod));
// success
if success then begin
// critical
if (rnd + (get_critter_stat(who, STAT_lu) - 5)) > 95 then return ROLL_CRITICAL_SUCCESS;
else return ROLL_SUCCESS;
end else begin // failure
// critical
if rnd > 95 then return ROLL_CRITICAL_FAILURE;
end
return ROLL_FAILURE;
end

//
// misc triplets
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "..\headers\itempid.h"
#include "..\headers\scripts.h"
#include "..\headers\teams.h"
//#include "..\headers\condtion.h"
#include "..\headers\condition.h"
#include "..\headers\aipacket.h"
#include "..\headers\exppoint.h"
#include "..\headers\scenepid.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
#define EXP_REPAIR_ROBOT_BATTERY_SEC (300)
#define EXP_REPAIR_ROBOT_BATTERY_MFC (500)
#define EXP_REPAIR_ROBOT_SENSORS (150)
#define EXP_WON_IN_CHESS (700)

// Brotherhood of Steel
#define EXP_DELIVERED_GRENADES (300)
Expand Down
1 change: 1 addition & 0 deletions Fallout2/Fallout1in2/Mapper/source/scripts/headers/fo1.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#define fo1in2_0800_resting_enabled (global_var(GVAR_ENABLE_FO2_0800_RESTING) > 0)
#define fo1in2_expanded_wrecks_enabled (global_var(GVAR_ENABLE_EXPANDED_WRECKS) > 0)
#define fo1in2_fo2_hitchance_enabled (global_var(GVAR_ENABLE_FO2_HITCHANCE) > 0)
#define fo1in2_fixt_chess_enabled (global_var(GVAR_ENABLE_FIXT_CHESS) > 0)

#define fixt_enabled (global_var(GVAR_FIXT_ENABLED) == 1)
#define fixt_disabled not(fixt_enabled)
Expand Down
4 changes: 2 additions & 2 deletions Fallout2/Fallout1in2/Mapper/source/scripts/headers/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -4042,8 +4042,8 @@
#define RESERVED_FOR_FALLOUT_FIXT (4900)
#define RESERVED_FOR_FALLOUT_FIXT (4901)
#define RESERVED_FOR_FALLOUT_FIXT (4902)
#define RESERVED_FOR_FALLOUT_FIXT (4903)
#define RESERVED_FOR_FALLOUT_FIXT (4904)*/
#define RESERVED_FOR_FALLOUT_FIXT (4903)*/
#define GVAR_ENABLE_FIXT_CHESS (4904)
#define GVAR_ENABLE_FO2_HITCHANCE (4905)
#define GVAR_ENABLE_AUTO_DOORS (4906)
#define GVAR_ENABLE_EXPANDED_WRECKS (4907)
Expand Down
10 changes: 8 additions & 2 deletions Fallout2/Fallout1in2/config/fo1_settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,11 @@ GVAR_JUNKTOWN_INVASION_DAYS=0
GVAR_SHADY_SANDS_INVASION_DAYS=0

[FIXT]
; Enable / Disable all Fixt additions?
; Most of the following settings will only work if this is set to 1!
; Enable / Disable additional Fixt changes? Ex.:
; - Various critters will have more items
; - More random citizens will spawn in Vault 13
; - Necropolis invasion mutants will spawn with heavy weapons
; - Random Glow encounters give more radiation points
GVAR_FIXT_ENABLED=0

; Player starts with: 0==Fo1 default, 1==only base items, 2==only Tag items, 3==no items
Expand All @@ -134,6 +137,9 @@ GVAR_ENABLE_HOOKERS=0
; Does Chris the bounty hunter respawn endlessly? -- (as in Fallout 2)
GVAR_HUNTER_RESPAWNS=0

; Enable advanced chess game?
GVAR_ENABLE_FIXT_CHESS=0

[DEBUG]
; Activate debug menu (use binocular on player)?
GVAR_ENABLE_DEBUG_MENU=0
Expand Down
2 changes: 1 addition & 1 deletion Fallout2/Fallout1in2/mods/fo1_base/data/Vault13.gam
Original file line number Diff line number Diff line change
Expand Up @@ -4912,7 +4912,7 @@ RESERVED_FOR_FALLOUT_FIXT :=0; // (4902)
RESERVED_FOR_FALLOUT_FIXT :=0; // (4903)
RESERVED_FOR_FALLOUT_FIXT :=0; // (4904)
RESERVED_FOR_FALLOUT_FIXT :=0; // (4905)
RESERVED_FOR_FALLOUT_FIXT :=0; // (4906)
GVAR_ENABLE_FIXT_CHESS :=0; // (4906)
GVAR_ENABLE_FO2_HITCHANCE :=0; // (4907)
GVAR_ENABLE_AUTO_DOORS :=0; // (4908)
GVAR_VASQUEZ_HIRELING_STATUS :=0; // (4909)
Expand Down
Loading

0 comments on commit b41d2e9

Please sign in to comment.