summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2023-07-10 10:40:56 -0300
committerJesusaves <cpntb1@ymail.com>2023-07-10 10:40:56 -0300
commit5eece0fed1731009c928488a5150d417b9c7f8a6 (patch)
tree6332a6ca772ace917a1ac6850b03bef4943c1851 /npc
parentb800445114b4c2ddc65a4303a798b6068d1106a7 (diff)
downloadserverdata-5eece0fed1731009c928488a5150d417b9c7f8a6.tar.gz
serverdata-5eece0fed1731009c928488a5150d417b9c7f8a6.tar.bz2
serverdata-5eece0fed1731009c928488a5150d417b9c7f8a6.tar.xz
serverdata-5eece0fed1731009c928488a5150d417b9c7f8a6.zip
This, in theory, handles if the MK GID becomes a nullptr.
And trust me, this happens WAY too often.
Diffstat (limited to 'npc')
-rw-r--r--npc/functions/mkbot.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/npc/functions/mkbot.txt b/npc/functions/mkbot.txt
index 23912cba5..80632f383 100644
--- a/npc/functions/mkbot.txt
+++ b/npc/functions/mkbot.txt
@@ -87,6 +87,15 @@ OnTimer90000:
end;
}
+ // Check if MK is still alive
+ if (getunittype($@MK) < 0) {
+ consolebug("Monster King GID %d is not a valid unit type!", $@MK);
+ sleep(300); // Wait 5 minutes for the respawn
+ consolewarn("Forcefully respawning Monster King now (GID was invalid)");
+ .bar=true;
+ goto OnInit;
+ }
+
// The Monster King is online. This loop is not needed
if (isloggedin(.aid, .cid)) {
if (!$@MK_SCENE)