diff options
Diffstat (limited to 'npc/functions/weather.txt')
-rw-r--r-- | npc/functions/weather.txt | 22 |
1 files 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"); |