From b41d2e967777049ad5ddbbd37955a1bceacfb699 Mon Sep 17 00:00:00 2001 From: Lexx2k Date: Sun, 16 Jun 2024 14:55:15 +0200 Subject: [PATCH] Glow chess game - 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. --- .../Mapper/source/scripts/09glow/ZAX.ssl | 254 ++++++++++-------- .../scripts/GlobalScripts/gl_0_settings.ssl | 1 + .../Mapper/source/scripts/headers/command.h | 28 ++ .../Mapper/source/scripts/headers/define.h | 2 +- .../Mapper/source/scripts/headers/exppoint.h | 1 + .../Mapper/source/scripts/headers/fo1.h | 1 + .../Mapper/source/scripts/headers/global.h | 4 +- Fallout2/Fallout1in2/config/fo1_settings.ini | 10 +- .../mods/fo1_base/data/Vault13.gam | 2 +- .../mods/fo1_base/text/english/dialog/ZAX.msg | 11 +- 10 files changed, 193 insertions(+), 121 deletions(-) diff --git a/Fallout2/Fallout1in2/Mapper/source/scripts/09glow/ZAX.ssl b/Fallout2/Fallout1in2/Mapper/source/scripts/09glow/ZAX.ssl index 0c18ea7e3..e2470165a 100644 --- a/Fallout2/Fallout1in2/Mapper/source/scripts/09glow/ZAX.ssl +++ b/Fallout2/Fallout1in2/Mapper/source/scripts/09glow/ZAX.ssl @@ -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; @@ -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); @@ -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 @@ -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 diff --git a/Fallout2/Fallout1in2/Mapper/source/scripts/GlobalScripts/gl_0_settings.ssl b/Fallout2/Fallout1in2/Mapper/source/scripts/GlobalScripts/gl_0_settings.ssl index 33559ba8c..def957c78 100644 --- a/Fallout2/Fallout1in2/Mapper/source/scripts/GlobalScripts/gl_0_settings.ssl +++ b/Fallout2/Fallout1in2/Mapper/source/scripts/GlobalScripts/gl_0_settings.ssl @@ -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 diff --git a/Fallout2/Fallout1in2/Mapper/source/scripts/headers/command.h b/Fallout2/Fallout1in2/Mapper/source/scripts/headers/command.h index 23b72a214..baa8b036c 100644 --- a/Fallout2/Fallout1in2/Mapper/source/scripts/headers/command.h +++ b/Fallout2/Fallout1in2/Mapper/source/scripts/headers/command.h @@ -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 // diff --git a/Fallout2/Fallout1in2/Mapper/source/scripts/headers/define.h b/Fallout2/Fallout1in2/Mapper/source/scripts/headers/define.h index 694f69c90..66dfaf323 100644 --- a/Fallout2/Fallout1in2/Mapper/source/scripts/headers/define.h +++ b/Fallout2/Fallout1in2/Mapper/source/scripts/headers/define.h @@ -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" diff --git a/Fallout2/Fallout1in2/Mapper/source/scripts/headers/exppoint.h b/Fallout2/Fallout1in2/Mapper/source/scripts/headers/exppoint.h index fd5cb0b8e..3c02b36af 100644 --- a/Fallout2/Fallout1in2/Mapper/source/scripts/headers/exppoint.h +++ b/Fallout2/Fallout1in2/Mapper/source/scripts/headers/exppoint.h @@ -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) diff --git a/Fallout2/Fallout1in2/Mapper/source/scripts/headers/fo1.h b/Fallout2/Fallout1in2/Mapper/source/scripts/headers/fo1.h index 073b38d50..dff431ebc 100644 --- a/Fallout2/Fallout1in2/Mapper/source/scripts/headers/fo1.h +++ b/Fallout2/Fallout1in2/Mapper/source/scripts/headers/fo1.h @@ -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) diff --git a/Fallout2/Fallout1in2/Mapper/source/scripts/headers/global.h b/Fallout2/Fallout1in2/Mapper/source/scripts/headers/global.h index 79b1b9175..52764fa10 100644 --- a/Fallout2/Fallout1in2/Mapper/source/scripts/headers/global.h +++ b/Fallout2/Fallout1in2/Mapper/source/scripts/headers/global.h @@ -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) diff --git a/Fallout2/Fallout1in2/config/fo1_settings.ini b/Fallout2/Fallout1in2/config/fo1_settings.ini index 7b069a21f..2782bb005 100644 --- a/Fallout2/Fallout1in2/config/fo1_settings.ini +++ b/Fallout2/Fallout1in2/config/fo1_settings.ini @@ -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 @@ -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 diff --git a/Fallout2/Fallout1in2/mods/fo1_base/data/Vault13.gam b/Fallout2/Fallout1in2/mods/fo1_base/data/Vault13.gam index e04085ebb..ff25d57ef 100644 --- a/Fallout2/Fallout1in2/mods/fo1_base/data/Vault13.gam +++ b/Fallout2/Fallout1in2/mods/fo1_base/data/Vault13.gam @@ -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) diff --git a/Fallout2/Fallout1in2/mods/fo1_base/text/english/dialog/ZAX.msg b/Fallout2/Fallout1in2/mods/fo1_base/text/english/dialog/ZAX.msg index 8b83627ea..e4b023245 100644 --- a/Fallout2/Fallout1in2/mods/fo1_base/text/english/dialog/ZAX.msg +++ b/Fallout2/Fallout1in2/mods/fo1_base/text/english/dialog/ZAX.msg @@ -55,10 +55,15 @@ {145}{}{In this fashion, I am effectively capable of 'faith'. Barring evidence to the contrary, I therefore have 'faith' that I possess the equivalent of a 'soul'.} {146}{}{May I ask some other questions?} {147}{}{I see. Interesting.} + +{148}{}{I would be delighted.} + +{300}{}{This system is too advanced for you.} + # -# 148 continues at 228, listing wins/draws/losses. Space is intentional. +# 1481 continues at 228, listing wins/draws/losses. Space is intentional. FIXT addition. # -{148}{}{I would be delighted. Your current record is } +{1481}{}{I would be delighted. Your current record is } {149}{}{It would seem that you have defeated me. Extraordinary.} {150}{}{Excellent form. However, you will need additional practice to defeat me.} {151}{}{Play again?} @@ -131,7 +136,7 @@ {207}{}{Thanks.} {208}{}{Several doors require a specific passkey to access. You must physically locate and use the correct passkey.} -{209}{}{I do, however, have control of the secondary security locks to the weapon locker. I will release those locks. You will still need the Red Passkey to open the locker, however.} +{209}{}{I do, however, have control of the secondary security locks to the weapon locker. I will release those locks. You will still need a red key card to open the locker.} {210}{}{You do not register as an individual of sufficient clearance to requisition that information.} {211}{}{However, sensors indicate that this facility is no longer operational in its original capacity. Probability favors destruction through nuclear force. Therefore, security concerns are now irrelevant.}