From 220aa50297dedb4b9d2138ac63cf09f4c92d39f2 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 23 Sep 2021 22:12:24 -0300 Subject: Global hotfix for monster long respawn rate based on total player count. Up to 22 players, spawn rates can become 4× faster. This is based on the historical average of the previous day/night cycle. It refreshes during the day/night cycle change and keeps the -30% bonus at night. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- npc/functions/weather.txt | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/npc/functions/weather.txt b/npc/functions/weather.txt index 91e9bfe5e..9c6111bf9 100644 --- a/npc/functions/weather.txt +++ b/npc/functions/weather.txt @@ -49,6 +49,8 @@ OnInit: // This is weather startup .@init=true; $@WEATHER_NIGHT=is_night(true); + .tpc=0; + .tcl=0; // Bind commands bindatcmd "wsnow", "#WeatherCore::OnSnow", 80, 80, 1; bindatcmd "wrain", "#WeatherCore::OnRain", 80, 80, 1; @@ -115,6 +117,8 @@ OnMinute45: end; //debugmes "[Weather.sys] Starting to regen"; + .tpc+=getusers(1); + .tcl+=1; .@hti = htiterator(.wcore); for(.@key$ = htinextkey(.@hti); hticheck(.@hti); .@key$ = htinextkey(.@hti)) { @@ -214,8 +218,20 @@ OnMinute45: // Player might be on cave, and this will help them tracking time. .@current=is_night(true); .@update = (.@current != $@WEATHER_NIGHT); - if (.@update) + if (.@update) { $@WEATHER_NIGHT=.@current; + if (.tcl > 0) { + .tpc = .tpc / .tcl; + // Monsters spawn faster based on average player count of previous + // cycle, 2% faster per player, capped at 2/3 of the lowest rate + // Default lowest is 70%, so it can go down up to 45% reduction + // For a total of (70-45 = 25%) or monsters spawning 4× faster + // when server is at "full" load (22 players or so) + .@bon = min(.tpc * 2, min($BCONFN_SPAWN, $BCONFD_SPAWN) * 2 / 3); + } + .tpc=0; + .tcl=0; + } if (is_night() && .@update) { .@c = getunits(BL_PC, .@players, MAX_CYCLE_PC); for (.@i = 0; .@i < .@c; .@i++) { @@ -225,7 +241,7 @@ OnMinute45: message(.@players[.@i], "The night falls."); detachrid(); } - setbattleflag("mob_spawn_delay", $BCONFN_SPAWN); + setbattleflag("mob_spawn_delay", $BCONFN_SPAWN - .@bon); setbattleflag("monster_hp_rate", $BCONFN_MOBHP); //charcommand("@reloadbattleconf"); // Careful! donpcevent("@exprate::OnInheirtedReload"); @@ -239,7 +255,7 @@ OnMinute45: message(.@players[.@i], "The day rises."); detachrid(); } - setbattleflag("mob_spawn_delay", $BCONFD_SPAWN); + setbattleflag("mob_spawn_delay", $BCONFD_SPAWN - .@bon); setbattleflag("monster_hp_rate", $BCONFD_MOBHP); //charcommand("@reloadbattleconf"); // Careful! donpcevent("@exprate::OnInheirtedReload"); -- cgit v1.2.3-60-g2f50