From 1fd851287f8720c78808657d54093fc1be20c1c9 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Mon, 6 Jul 2026 02:27:29 +0700 Subject: [PATCH] Add mp_hostage_fear cvar to control CZ hostage fear reactions When improved hostage AI (hostage_ai_enable 1) is used in CS 1.6, hostages panic and scatter in response to gunfire, explosions and nearby deaths. Setting mp_hostage_fear 0 keeps them calm, restoring 1.6-like hostage behavior while retaining the rest of the improved AI. Related to #1125 Co-Authored-By: Claude Fable 5 --- README.md | 1 + dist/game.cfg | 8 ++++++++ regamedll/dlls/game.cpp | 2 ++ regamedll/dlls/game.h | 1 + regamedll/dlls/hostage/hostage_improv.cpp | 6 ++++++ 5 files changed, 18 insertions(+) diff --git a/README.md b/README.md index 7d0892a1b..be2e6a353 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab | mp_timelimit | 0 | - | - | Period between map rotations.
`0` means no limit | | mp_forcerespawn | 0 | 0 | - | Players will automatically respawn when killed.
`0` disabled
`>0.00001` time delay to respawn | | mp_hostage_hurtable | 1 | 0 | 1 | The hostages can take damage.
`0` disabled
`1` from any team
`2` only from `CT`
`3` only from `T` | +| mp_hostage_fear | 1 | 0 | 1 | The hostages with improved AI (`hostage_ai_enable 1`) get scared of gunfire, explosions and nearby deaths.
`0` disabled (hostages stay calm)
`1` enabled | | mp_show_radioicon | 1 | 0 | 1 | Show radio icon.
`0` disabled
`1` enabled | | mp_show_scenarioicon | 0 | 0 | 1 | Show scenario icon in HUD such as count of alive hostages or ticking bomb.
`0` disabled
`1` enabled | | mp_old_bomb_defused_sound | 1 | 0 | 1 | Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused
`0` disabled
`1` enabled | diff --git a/dist/game.cfg b/dist/game.cfg index 4ca190530..66b7d432d 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -177,6 +177,14 @@ mp_forcerespawn "0" // Default value: "1" mp_hostage_hurtable "1" +// The hostages with improved AI (hostage_ai_enable 1) +// get scared of gunfire, explosions and nearby deaths. +// 0 - disabled (hostages stay calm) +// 1 - enabled (default behaviour) +// +// Default value: "1" +mp_hostage_fear "1" + // Show radio icon. // 0 - disabled // 1 - enabled (default behavior) diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 2c6d9fbff..971f235ed 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -123,6 +123,7 @@ cvar_t round_restart_delay = { "mp_round_restart_delay", "5", FCVAR_SERVER, 0. cvar_t showtriggers = { "showtriggers", "0", 0, 0.0f, nullptr }; // debug cvar shows triggers // TODO: Maybe it's better to register in the engine? cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 1.0f, nullptr }; +cvar_t hostagefear = { "mp_hostage_fear", "1", FCVAR_SERVER, 1.0f, nullptr }; cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr }; cvar_t forcerespawn = { "mp_forcerespawn", "0", FCVAR_SERVER, 0.0f, nullptr }; cvar_t show_radioicon = { "mp_show_radioicon", "1", 0, 1.0f, nullptr }; @@ -403,6 +404,7 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&showtriggers); CVAR_REGISTER(&hostagehurtable); + CVAR_REGISTER(&hostagefear); CVAR_REGISTER(&roundover); CVAR_REGISTER(&forcerespawn); CVAR_REGISTER(&show_radioicon); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index ecf1001c8..397810b80 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -152,6 +152,7 @@ extern cvar_t round_restart_delay; extern cvar_t showtriggers; extern cvar_t hostagehurtable; +extern cvar_t hostagefear; extern cvar_t roundover; extern cvar_t forcerespawn; extern cvar_t show_radioicon; diff --git a/regamedll/dlls/hostage/hostage_improv.cpp b/regamedll/dlls/hostage/hostage_improv.cpp index 6932d2185..c98a64f98 100644 --- a/regamedll/dlls/hostage/hostage_improv.cpp +++ b/regamedll/dlls/hostage/hostage_improv.cpp @@ -1560,6 +1560,12 @@ bool CHostageImprov::IsScared() const void CHostageImprov::Frighten(ScareType scare) { +#ifdef REGAMEDLL_ADD + // keep hostages calm, they won't get scared of gunfire, explosions or nearby deaths + if (hostagefear.value <= 0.0f) + return; +#endif + const float ignoreTime = 10.0f; if (!IsScared())