summaryrefslogtreecommitdiff
path: root/npc/functions/siege.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-10-28 01:40:52 -0300
committerJesusaves <cpntb1@ymail.com>2019-10-28 01:40:52 -0300
commitf6554808d519ae3d880467c1f84d071e49758d57 (patch)
treecb3841e0f6b1a9acef04771ff781d445ec27d6ec /npc/functions/siege.txt
parent75479db52de54baba8056b3d548d624343a8bc9a (diff)
downloadserverdata-f6554808d519ae3d880467c1f84d071e49758d57.tar.gz
serverdata-f6554808d519ae3d880467c1f84d071e49758d57.tar.bz2
serverdata-f6554808d519ae3d880467c1f84d071e49758d57.tar.xz
serverdata-f6554808d519ae3d880467c1f84d071e49758d57.zip
Minimum 1 active player for siege to happen (active in the past 5 minutes)
If not, cancel the siege and clear the runtime.
Diffstat (limited to 'npc/functions/siege.txt')
-rw-r--r--npc/functions/siege.txt17
1 files changed, 17 insertions, 0 deletions
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_<town> 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)