From f6554808d519ae3d880467c1f84d071e49758d57 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 28 Oct 2019 01:40:52 -0300 Subject: Minimum 1 active player for siege to happen (active in the past 5 minutes) If not, cancel the siege and clear the runtime. --- npc/functions/siege.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'npc/functions/siege.txt') diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt index 765de269c..35b681102 100644 --- a/npc/functions/siege.txt +++ b/npc/functions/siege.txt @@ -346,6 +346,23 @@ function script do_siege { .@n$=getarg(4); .@t=getarg(5); + // If no active player, KILL THE SCRIPT + .@c = getunits(BL_PC, .@players, MAX_CYCLE_PC); + .@idle = 0; + for (.@i = 0; .@i < .@c; .@i++) { + attachrid(.@players[.@i]); + if (checkidle() < 300) + .@idle++; + detachrid(); + } + + // No one is active, cancel the event + if (!.@idle) { + kamibroadcast(col(b("EVENT CANCELLED DUE TO PLAYER INACTIVITY"),1)); + $@MK_AGGRO=$@MK_AGGRO/5; // Lower aggro bar to 20% + end; + } + // In past, we had a $@SIEGE_ to determine difficulty // This behavior is now deprecated, we use a global $SIEGE_DIFFICULTY // Which raises in 1 every victory and lowers in 1 every defeat (capped at 1) -- cgit v1.2.3-60-g2f50