From c6864e01f61cc9d4776b93d0fb71cc507f0d2b12 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Tue, 28 Nov 2017 00:30:29 +0800 Subject: [PATCH] Added the damage type offset of weapon proto to define_extra.h. Fixed a typo in hookscripts.txt. Added a new example mod gl_autodoors (by Mr.Stalin) to modderspack. #19 --- .../example_mods/AutoDoors/gl_autodoors.int | Bin 0 -> 1202 bytes .../example_mods/AutoDoors/gl_autodoors.ssl | 77 ++++++++++++++++++ artifacts/example_mods/AutoDoors/readme.txt | 9 ++ artifacts/scripting/headers/define_extra.h | 1 + artifacts/scripting/hookscripts.txt | 2 +- 5 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 artifacts/example_mods/AutoDoors/gl_autodoors.int create mode 100644 artifacts/example_mods/AutoDoors/gl_autodoors.ssl create mode 100644 artifacts/example_mods/AutoDoors/readme.txt diff --git a/artifacts/example_mods/AutoDoors/gl_autodoors.int b/artifacts/example_mods/AutoDoors/gl_autodoors.int new file mode 100644 index 0000000000000000000000000000000000000000..91ae7288d4f4f260d6a19673372e3daf070692e6 GIT binary patch literal 1202 zcmZo*I>5-lz#!DX3!)i?8dw?x8l)N&8l)N&8>AYP8l)PO8&n!p8`KyW7+4t?7}yw4 z0HYR^D*>gU6kJ>ZDgdRJvY-qTC=I2UHZU+SfL!7N6@XGK6;MV3gMc0i0J){OB(bQ3 zfk7xYu^>J*uOzi7z97D!C_kBjfq}0$wIn_zKffqGEhjOZfk7lWKQ}3{q@=VcFFqqN zFC{0nh=GBDD?cx%GCn^qIhEl*6g237LV|$-LN+jiXhy9DmIiGwtF1AmK_ASDYZ3s_ z3@i<15D^Ax2)`)_L^Gx}uz+X=o5m~<%~%5oW2nhY4Xh1PAaSN3h&skcARYrlgAkZz zY%p#Bo5#4OL83vwL8?&$Y6~RB7#f5@>KJdJn92weV_-%%n<)q^4l|nxW;PQS+-z5< z=@1j3rZbsf_>lqP8>RrLy%0Y_biwUqU})fNkZjOu&}`sokO9*&knm%GsDzn6jZ9OZ zu>4p=8M)GW?MNZ2wo zm_Skj^Q8uf23Js80IOqxs$*_2YO(~2FgCa~m_Xu@#Q~D47+|VckyPt}Rl`IW8z8z_ zA+EsC!PsEg1o1JIR&tfn^q0KP+8>(mW)Lpm_#c GIsyRJ#q9zB literal 0 HcmV?d00001 diff --git a/artifacts/example_mods/AutoDoors/gl_autodoors.ssl b/artifacts/example_mods/AutoDoors/gl_autodoors.ssl new file mode 100644 index 00000000..db7dfa97 --- /dev/null +++ b/artifacts/example_mods/AutoDoors/gl_autodoors.ssl @@ -0,0 +1,77 @@ +/* + +Auto Doors mod for Fallout 2 by Mr.Stalin +----------------------------------------- + +- allows the player to automatically open/walk through unlocked doors when not in combat + +Requires sfall 3.7b or higher + +NOTE: this script requires compiler from sfall modderspack with -s option +(short circuit evaluation) + +*/ + +#include "..\headers\define.h" +#include "..\headers\command.h" +#include "..\headers\sfall\sfall.h" +#include "..\headers\sfall\define_extra.h" + +procedure start; +procedure map_enter_p_proc; +procedure set_door_flag(variable state); +procedure combatturn_handler; + +#define PORTAL (0) +#define DOOR_FLAGS (0x24) + +variable only_once := 0; + +procedure start begin + if game_loaded then begin + if (sfall_ver_major >= 4) then + register_hook_proc(HOOK_COMBATTURN, combatturn_handler); + else + set_global_script_repeat(60); + call map_enter_p_proc; + end else begin + if (only_once == 1 and combat_is_initialized) then begin + only_once := 2; + call set_door_flag(false); + end else if (only_once == 2 and not(combat_is_initialized)) then begin + only_once := 1; + if (sfall_ver_major >= 4) then + set_global_script_repeat(0); + call set_door_flag(FLAG_WALKTHRU); + end + end +end + +procedure map_enter_p_proc begin + only_once := 1; + call set_door_flag(FLAG_WALKTHRU); +end + +procedure set_door_flag(variable state) begin + variable objectMap, obj, objPid, arrayPid, i; + + objectMap := list_as_array(LIST_SCENERY); + arrayPid := temp_array(1, 0); + + foreach (obj in objectMap) begin + objPid := obj_pid(obj); + + if (proto_data(objPid, sc_type) != PORTAL) or is_in_array(objPid, arrayPid) then + continue; + + arrayPid[i] := objPid; + i++; + resize_array(arrayPid, i + 1); + set_proto_data(objPid, DOOR_FLAGS, state); + end +end + +procedure combatturn_handler begin + if (only_once == 1) then + set_global_script_repeat(60); +end diff --git a/artifacts/example_mods/AutoDoors/readme.txt b/artifacts/example_mods/AutoDoors/readme.txt new file mode 100644 index 00000000..23e945c2 --- /dev/null +++ b/artifacts/example_mods/AutoDoors/readme.txt @@ -0,0 +1,9 @@ +Auto Doors mod for Fallout 2 by Mr.Stalin +----------------------------------------- + +- allows the player to automatically open/walk through unlocked doors when not in combat + + +Requires sfall 3.7b or higher. + +To use, copy gl_autodoors.int to your scripts folder. diff --git a/artifacts/scripting/headers/define_extra.h b/artifacts/scripting/headers/define_extra.h index 84863296..35313738 100644 --- a/artifacts/scripting/headers/define_extra.h +++ b/artifacts/scripting/headers/define_extra.h @@ -89,6 +89,7 @@ #define PROTO_WP_ANIM (36) #define PROTO_WP_DMG_MIN (40) #define PROTO_WP_DMG_MAX (44) +#define PROTO_WP_DMG_TYPE (48) #define PROTO_WP_RANGE_1 (52) #define PROTO_WP_RANGE_2 (56) #define PROTO_WP_PROJ_PID (60) diff --git a/artifacts/scripting/hookscripts.txt b/artifacts/scripting/hookscripts.txt index 2db7513a..54616129 100644 --- a/artifacts/scripting/hookscripts.txt +++ b/artifacts/scripting/hookscripts.txt @@ -309,7 +309,7 @@ Runs when retriving the damage rating of the players used weapon. (Which may be int arg1 - The default min damage int arg2 - The default max damage -Item arg3 - The weapin used. (0 if unarmed) +Item arg3 - The weapon used. (0 if unarmed) Critter arg4 - The critter doing the attacking int arg5 - The type of attack int arg6 - non zero if this is an attack using a melee weapon