summaryrefslogtreecommitdiff
path: root/npc/functions/ghost.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-07-07 20:36:00 -0300
committerJesusaves <cpntb1@ymail.com>2021-07-07 20:36:00 -0300
commit6967b9e0b63d19141d4f59b7933a960ac81916d0 (patch)
tree8ecd9cd2461f3598cb7faece71eb77162aa4ef2a /npc/functions/ghost.txt
parent9877fd4ad81120af8e63e96d5d429092014dc017 (diff)
parent046c659193e1ca8bd13478678d1277df8bf9395c (diff)
downloadserverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.tar.gz
serverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.tar.bz2
serverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.tar.xz
serverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.zip
Merge branch 'master' into legacy
Override all files with 'master' version. This version is meant to preserve git history as requested by bjorn.
Diffstat (limited to 'npc/functions/ghost.txt')
-rw-r--r--npc/functions/ghost.txt36
1 files changed, 36 insertions, 0 deletions
diff --git a/npc/functions/ghost.txt b/npc/functions/ghost.txt
new file mode 100644
index 00000000..1325525b
--- /dev/null
+++ b/npc/functions/ghost.txt
@@ -0,0 +1,36 @@
+function script SpawnGhost {
+ if ($GHOSTS_DISABLED)
+ goto L_Return;
+
+ if (BaseLevel >= 40 &&
+ (getmapname() == "026-1" ||
+ getmapname() == "027-1" ||
+ getmapname() == "027-2" ||
+ getmapname() == "027-3" ||
+ getmapname() == "027-4" ||
+ getmapname() == "027-5"))
+ goto L_Spawn;
+ return;
+
+L_Spawn:
+ .@x = POS_X;
+ .@y = POS_Y;
+
+ if (!(iscollision(getmapname(), .@x, .@y - 1))) set .@y, .@y - 1; // up
+ else if (!(iscollision(getmapname(), .@x, .@y + 1))) set .@y, .@y + 1; // down
+ else if (!(iscollision(getmapname(), .@x - 1, .@y))) set .@x, .@x - 1; // left
+ else if (!(iscollision(getmapname(), .@x + 1, .@y))) set .@x, .@x + 1; // right
+ // else on the player
+
+ // FIXME (Is this a valid event label??)
+ if (@GHOST_MAP$ != "")
+ killmonster @GHOST_MAP$, "~GH~" + getcharid(0);
+
+ @GHOST_MAP$ = getmapname();
+ specialeffect(39, SELF, getcharid(3));
+ monster getmapname(), .@x, .@y, strcharinfo(0), 1136, 1, "~GH~" + getcharid(0);
+ return;
+
+L_Return:
+ return;
+}