From 8a8455efea8ae0cde02f5b7805f6cb4fb70d0c11 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Thu, 14 Mar 2024 10:20:42 +0800 Subject: [PATCH] Added a new example mod gl_static_books --- .../StaticBooks/gl_static_books.int | Bin 0 -> 1074 bytes .../StaticBooks/gl_static_books.ssl | 84 ++++++++++++++++++ artifacts/example_mods/StaticBooks/readme.txt | 11 +++ 3 files changed, 95 insertions(+) create mode 100644 artifacts/example_mods/StaticBooks/gl_static_books.int create mode 100644 artifacts/example_mods/StaticBooks/gl_static_books.ssl create mode 100644 artifacts/example_mods/StaticBooks/readme.txt diff --git a/artifacts/example_mods/StaticBooks/gl_static_books.int b/artifacts/example_mods/StaticBooks/gl_static_books.int new file mode 100644 index 0000000000000000000000000000000000000000..f112c0be55f940b5c45d3eb929853a0c7cfd569d GIT binary patch literal 1074 zcmZo*I>5-lz#!DX3#QLBurvrXNHr)lNHr)nNHr)mNHr)os5GcHs4*}wFf%YPurZ*5 zdr+EFi0^-q*kOR$LA&%#FrMNB$lMc7bh2G7L*i&RW#^;{lL(`45sfjurz3cSw9+6 z8uY;|Au!3*lmw<38h9Hd8?+iU8+aOIz_bih2LnX@03*m|Fq;)j!o@+pXnX<@YcPbe z7#j>hA}mrMl7X?osNp1-#oAyDwV$!Us1afY8$>PR4zLQg1|u--30KJj<}*Q5F)M+2 zED#>kf(8~4pYaQbWPs`Qf$N3DB}}g}SQVOHCIhf2Om6^OFB@1KrdI{bL)V)F7KP~z zgXH)e8+zCQulG;-kR?5}HhJ8Z{s+2C$Er z+nTZ)AmPc-_!MjcY7FlOi!n7AHLL=&SRvub>;UF5G(hA78$Lr#Wd_*@O7{)cU=@rF zmSCEx!3In-L-kidd5}0{YOqDquK|{4YA|Z#hMK_KU?^PxMvV|t85_+&>U$s| z#SK-*(r~K5s=>P9&je6@Wos&HfTprWbC7Ci2q?fpfCc6oWZxRWLYr9;tOpvt5WNg6 Q4Ms5C42)RA50q1600~p>(*OVf literal 0 HcmV?d00001 diff --git a/artifacts/example_mods/StaticBooks/gl_static_books.ssl b/artifacts/example_mods/StaticBooks/gl_static_books.ssl new file mode 100644 index 00000000..6d6fcf82 --- /dev/null +++ b/artifacts/example_mods/StaticBooks/gl_static_books.ssl @@ -0,0 +1,84 @@ +/* + +Static Books mod for Fallout 2 by NovaRain +------------------------------------------ + +- changes vanilla skill books to increase skills by a fixed amount +- reading a book gives +5% to a skill (+6% if tagged), +8% with the Comprehension perk +- books can still increase skills when over 91% + +Requires sfall 3.5 or higher + +*/ + +#include "..\headers\define.h" +#include "..\headers\command.h" +#include "..\headers\sfall\sfall.h" + +#define BOOK_BONUS (5) + +procedure start; +procedure useobj_handler; + +procedure start begin + if game_loaded then begin + register_hook_proc(HOOK_USEOBJ, useobj_handler); + end +end + +procedure useobj_handler begin + variable + user := get_sfall_arg, + obj := get_sfall_arg, + skill := -1, + bonus := BOOK_BONUS, + msg, skLevel; + + if (obj_item_subtype(obj) == item_type_misc_item) then begin + switch obj_pid(obj) begin + case PID_BIG_BOOK_OF_SCIENCE: + skill := SKILL_SCIENCE; + msg := 802; + case PID_DEANS_ELECTRONICS: + skill := SKILL_REPAIR; + msg := 803; + case PID_FIRST_AID_BOOK: + skill := SKILL_FIRST_AID; + msg := 804; + case PID_SCOUT_HANDBOOK: + skill := SKILL_OUTDOORSMAN; + msg := 806; + case PID_GUNS_AND_BULLETS: + skill := SKILL_SMALL_GUNS; + msg := 805; + end + + // read book + if (skill != -1) then begin + if combat_is_initialized then begin + display_msg(mstr_proto(902)); + set_sfall_return(0); + return; + end + + skLevel := has_skill(dude_obj, skill); + if (dude_perk(PERK_comprehension_perk)) then begin + bonus := (bonus * 3 + 1) / 2; // +50%, rounding up + end + if (bonus % 2) then begin + bonus += is_skill_tagged(skill); // adjustment for tagged skill when the bonus is an odd number + end + critter_mod_skill(dude_obj, skill, bonus); + gfade_out(1); + game_time_advance(ONE_GAME_HOUR * (11 - dude_iq)); + exec_map_update_scripts; + gfade_in(1); + display_msg(mstr_proto(800)); + if (has_skill(dude_obj, skill) == skLevel) then begin + msg := 801; + end + display_msg(mstr_proto(msg)); + set_sfall_return(1); // remove + end + end +end diff --git a/artifacts/example_mods/StaticBooks/readme.txt b/artifacts/example_mods/StaticBooks/readme.txt new file mode 100644 index 00000000..5ae85754 --- /dev/null +++ b/artifacts/example_mods/StaticBooks/readme.txt @@ -0,0 +1,11 @@ +Static Books mod for Fallout 2 by NovaRain +------------------------------------------ + +- changes vanilla skill books to increase skills by a fixed amount +- reading a book gives +5% to a skill (+6% if tagged), +8% with the Comprehension perk +- books can still increase skills when over 91% + + +Requires sfall 3.5 or higher + +To use, copy gl_static_books.int to your scripts folder.