From dc55c5f61922628494c2698abac0719fec7aa9f4 Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 17 Feb 2018 11:56:12 -0500 Subject: spawn a ghost when players die in the graveyard --- world/map/npc/functions/ghost.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 world/map/npc/functions/ghost.txt (limited to 'world/map/npc/functions/ghost.txt') diff --git a/world/map/npc/functions/ghost.txt b/world/map/npc/functions/ghost.txt new file mode 100644 index 00000000..1439d543 --- /dev/null +++ b/world/map/npc/functions/ghost.txt @@ -0,0 +1,26 @@ +function|script|SpawnGhost +{ + if (BaseLevel >= 40 && + (getmap() == "026-1" || + getmap() == "027-1")) + goto L_Spawn; + return; + +L_Spawn: + set .@x, POS_X; + set .@y, POS_Y; + + if (!(iscollision(getmap(), .@x, .@y - 1))) set .@y, .@y - 1; // up + elif (!(iscollision(getmap(), .@x, .@y + 1))) set .@y, .@y + 1; // down + elif (!(iscollision(getmap(), .@x - 1, .@y))) set .@x, .@x - 1; // left + elif (!(iscollision(getmap(), .@x + 1, .@y))) set .@x, .@x + 1; // right + // else on the player + + if (@GHOST_MAP$ != "") + killmonster @GHOST_MAP$, "~GH~" + getcharid(0); + + set @GHOST_MAP$, getmap(); + specialeffect2 39; + monster getmap(), .@x, .@y, strcharinfo(0), 1125, 1, "~GH~" + getcharid(0); + return; +} -- cgit v1.2.3-60-g2f50