mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added NPC combat control mod to example mods
Updated item highlighting mod and NPC armor mod.
This commit is contained in:
Binary file not shown.
@@ -23,6 +23,7 @@
|
||||
#define FID_OBJ_CRITTER (0x01000000)
|
||||
|
||||
procedure update_armor_apperance;
|
||||
procedure canuseweapon_handler;
|
||||
|
||||
variable
|
||||
modIni := "npcarmor.ini",
|
||||
@@ -165,7 +166,9 @@ end
|
||||
|
||||
procedure start begin
|
||||
variable sect, sects, armorTypes, armorType, npc, pid, pids, i;
|
||||
if game_loaded and (sfall_ver_major < 4 and sfall_ver_build >= 29) then begin
|
||||
if game_loaded then begin
|
||||
if (sfall_ver_major >= 4 or sfall_ver_build < 29) then return;
|
||||
|
||||
armorTypes := get_ini_section(modIni, "ArmorTypes");
|
||||
armorPidMap := create_array_map;
|
||||
foreach (armorType: pids in armorTypes) begin
|
||||
@@ -205,6 +208,7 @@ procedure start begin
|
||||
register_hook_proc(HOOK_INVENWIELD, invenwield_handler);
|
||||
register_hook_proc(HOOK_ADJUSTFID, adjustfid_handler);
|
||||
register_hook_proc(HOOK_INVENTORYMOVE, inventorymove_handler);
|
||||
register_hook_proc_spec(HOOK_CANUSEWEAPON, canuseweapon_handler);
|
||||
|
||||
debug_msg("NPC armor appearance mod: Done.");
|
||||
end
|
||||
@@ -222,3 +226,16 @@ procedure update_armor_apperance begin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
// prevent NPCs from equipping "unusable" weapons - for 3.8.40+
|
||||
procedure canuseweapon_handler begin
|
||||
variable critter, canUse;
|
||||
critter := get_sfall_arg;
|
||||
if (critter != dude_obj and get_sfall_arg_at(3)) then begin
|
||||
canUse := check_weapon_change(critter, get_sfall_arg, true);
|
||||
if (canUse == false) then begin
|
||||
set_sfall_arg(3, 0);
|
||||
set_sfall_return(0); // overrides the result of engine function. Any non-zero value allows using the weapon
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,10 +8,10 @@ Can be adopted to any mod by adjusting armor PIDs, allowed weapon anim codes, NP
|
||||
|
||||
Requires sfall 3.8.29 or higher.
|
||||
|
||||
To use, copy gl_npcarmor_lite.int to your scripts folder, and copy npcarmor.ini to the same directory as sfall.
|
||||
To use, copy gl_npcarmor_lite.int to your scripts folder and copy npcarmor.ini to the same directory as sfall.
|
||||
|
||||
The default npcarmor.ini is set up for Restoration Project 2.3.3.
|
||||
Check the included "npcarmor - vanilla.ini" for an example that does not require any new graphics.
|
||||
|
||||
Note that due to the lack of newer game hooks in sfall 3.8.x, there is a minor glitch in the lite version:
|
||||
- in combat, NPCs can pick up and try to equip weapons with anim codes that are not allowed in INI file but supported by their appearance.
|
||||
- in combat, NPCs can pick up and try to equip weapons with anim codes that are not allowed in INI file but supported by their appearance (fixed in 3.8.40+).
|
||||
|
||||
Reference in New Issue
Block a user