Added GainReputation to NPC combat control mod

This commit is contained in:
NovaRain
2022-06-06 12:54:02 +08:00
parent 1d8004623a
commit 0516aabcc1
3 changed files with 18 additions and 1 deletions
+3
View File
@@ -43,6 +43,9 @@ Mode=0
;Set a comma delimited list of perk IDs for perks to be inherited from the player during the combat control
PerksList=0,73
;Set to 1 to allow the player to gain a positive reputation when killing NPCs while controlling other critters
GainReputation=0
;Choose a notification box to display the name of the controlled critter above the interface bar
;Must be between 5 and (4 + the value of BoxBarCount in ddraw.ini)
;For sfall 4.1.6+ the number for the notification box is set automatically, so just use any value
Binary file not shown.
+15 -1
View File
@@ -26,10 +26,10 @@ procedure CombatTurn_Handler;
procedure GameModeChange_Handler;
procedure InventoryMove_Handler;
procedure InvenWield_Handler;
procedure SetGlobalVar_Handler;
variable
controlMode,
noCheckArray,
pidList, perksList,
lightInt, lightDist, npcControl,
displayName, displayNameColor, isShowTag,
@@ -157,6 +157,16 @@ procedure InvenWield_Handler begin
end
end
procedure SetGlobalVar_Handler begin
if (npcControl and get_sfall_arg == GVAR_PLAYER_REPUTATION and obj_pid(dude_obj) != PID_PLAYER) then begin
variable value := global_var(GVAR_PLAYER_REPUTATION);
if (get_sfall_arg > value) then begin
set_sfall_arg(1, value);
set_sfall_return(value);
end
end
end
procedure start begin
if (game_loaded and sfall_ver_major >= 4) then begin
//variable configSection := "CombatControl";
@@ -199,6 +209,10 @@ procedure start begin
register_hook_proc(HOOK_GAMEMODECHANGE, GameModeChange_Handler);
register_hook_proc(HOOK_INVENTORYMOVE, InventoryMove_Handler);
register_hook_proc(HOOK_INVENWIELD, InvenWield_Handler);
if (GetConfig("CombatControl", "GainReputation", 0) == 0) then begin
register_hook_proc(HOOK_SETGLOBALVAR, SetGlobalVar_Handler);
end
end else begin
exit;
end