summaryrefslogtreecommitdiff
path: root/world/map/npc/functions/spawns_on_mobkill.txt
diff options
context:
space:
mode:
authorHello=) <hello@themanaworld.org>2024-11-19 21:08:22 +0300
committerHello TMW <hello@themanaworld.org>2024-12-13 10:33:54 +0000
commitde142f3ae1a67fd4987c8ef68500b849b34dd79e (patch)
treec54faedf3850d5d35f1c4bb0f576b0577c1e5812 /world/map/npc/functions/spawns_on_mobkill.txt
parent7a9cbd6dc8aab71daad6b94d38537d09486ded28 (diff)
downloadserverdata-de142f3ae1a67fd4987c8ef68500b849b34dd79e.tar.gz
serverdata-de142f3ae1a67fd4987c8ef68500b849b34dd79e.tar.bz2
serverdata-de142f3ae1a67fd4987c8ef68500b849b34dd79e.tar.xz
serverdata-de142f3ae1a67fd4987c8ef68500b849b34dd79e.zip
This adds script logic to spawn mob on other mob's death.
Useful to sub-split slimes and do similar extra tricks. Relies on https://git.themanaworld.org/legacy/tmwa/-/merge_requests/292 Mentioned server change provides X/Y of mob kill so e.g. slime "split" can look reasonable - spawning new slimes where killed mob been. This is preliminary version, so far it introduces following spawns: Mob Killed -> What appears 1) Sea Slime Mother -> angry sea slimes on kill. 2) Green Slime Mother -> angry green slimes on kill. 3) Blue Slime -> few SlimeBlast (same as it spawns) 4) Tormenta -> Void Bats + Demonic Spirits + undead witch. 5) Luvia -> Void Bats + Demonic Spirits (slightly fewer so Illia players arent instakilled hopefully) TODO: Add few BIG slimes decaying into existent "normal" ones. E.g. BIG green slime -> bunch of angry green slimes. or BIG Sea Slime -> bunch of angry sea slimes. (this needs GFX of big slime and turning it into mob)
Diffstat (limited to 'world/map/npc/functions/spawns_on_mobkill.txt')
-rw-r--r--world/map/npc/functions/spawns_on_mobkill.txt71
1 files changed, 71 insertions, 0 deletions
diff --git a/world/map/npc/functions/spawns_on_mobkill.txt b/world/map/npc/functions/spawns_on_mobkill.txt
new file mode 100644
index 00000000..991f2567
--- /dev/null
+++ b/world/map/npc/functions/spawns_on_mobkill.txt
@@ -0,0 +1,71 @@
+// Spawns some mobs on death of some other mob. Say split slime -> few smaller ones
+// This function meant to be called with player RID attached (usually in OnMobKillEvent)
+// Inputs: nothing, but expects @mobID, @mob_X and @mob_Y set (usually by server)
+// Return: nothing, but spawns few things.
+// TODO: Add few big slime mobs and "split" these (this needs big slime GFX and making mob).
+function|script|spawns_on_mobkill
+{
+ debugmes "spawns_on_death ->";
+ debugmes "spawns_on_death mobID=" + @mobID + " @mob_X=" + @mob_X + " @mob_Y=" + @mob_Y;
+ if (@mobID == SeaSlimeMother) goto L_SplitSea;
+ if (@mobID == GreenSlimeMother) goto L_SplitGreen;
+ if (@mobID == BlueSlime) goto L_SplitBlue;
+ if (@mobID == Tormenta) goto L_TorWitchDead;
+ if (@mobID == Luvia) goto L_LuvWitchDead;
+ debugmes "spawns_on_death <-";
+ return;
+
+L_SplitSea:
+ debugmes "slime_split - Sea Mother";
+ void call("spawn_mobs_around", getmap(), @mob_X, @mob_Y, AngrySeaSlime, rand(8, 20));
+ return;
+
+L_SplitGreen:
+ debugmes "slime_split - Greens Mother";
+ void call("spawn_mobs_around", getmap(), @mob_X, @mob_Y, AngryGreenSlime, rand(8, 20));
+ return;
+
+L_SplitBlue:
+ debugmes "slime_split - BigBlue";
+ void call("spawn_mobs_around", getmap(), @mob_X, @mob_Y, SlimeBlast, rand(1, 6));
+ return;
+
+L_TorWitchDead:
+ void call("spawn_mobs_around", getmap(), @mob_X, @mob_Y, VoidBat, rand(7, 12));
+ void call("spawn_mobs_around", getmap(), @mob_X, @mob_Y, DemonicSpirit, rand(5, 10));
+ void call("spawn_mobs_around", getmap(), @mob_X, @mob_Y, UndeadWitch, 1);
+ return;
+
+L_LuvWitchDead:
+ void call("spawn_mobs_around", getmap(), @mob_X, @mob_Y, "", VoidBat, rand(6, 10));
+ void call("spawn_mobs_around", getmap(), @mob_X, @mob_Y, "", DemonicSpirit, rand(4, 8));
+ return;
+}
+
+// Spawns mobs around spot, if it can - or stacks mobs on spot if no room for 3x3 area
+// This function can be called from any context.
+// Inputs: arg0: map (string), arg1: X, arg2: Y, arg3: mob ID, ard4: amount
+// Return: nothing, but spawns few things.
+function|script|spawn_mobs_around
+{
+ set .@map$, getarg(0, "");
+ set .@mobX, getarg(1, -1);
+ set .@mobY, getarg(2, -1);
+ set .@mobID, getarg(3, -1);
+ set .@mobQTY, getarg(4, -1);
+ debugmes "spawn_mob_around ->";
+ debugmes "spawn_mob_around: map$=" + .@map$ + " x=" + .@mobX + " y=" + .@mobY + " mobID=" + .@mobID + " mobQTY=" + .@mobQTY;
+ if ((.@map$ == "") || (.@mobX < 1) || (.@mobY < 1) || (.@mobID < 1002) ||
+ (.@mobX > getmapmaxx(.@map$)) || (.@mobX > getmapmaxy(.@map$)) ||
+ (.@mobQTY < 1)) goto L_Abort;
+ debugmes "spawn_mob_arounc: map$=" + .@map$ + " x=" + .@mobX + " y=" + .@mobY + " mobID=" + .@mobID + " mobQTY=" + .@mobQTY;
+ if ((.@mobX > 1) && (.@mobY > 1) && (.@mobX < getmapmaxx(.@map$)) && (.@mobY < getmapmaxy(.@map$)))
+ areamonster .@map$, (.@mobX-1), (.@mobY-1), (.@mobX+1), (.@mobY+1), "", .@mobID, .@mobQTY; // Enough room for 3x3
+ else
+ monster .@map$, .@mobX, .@mobY, "", .@mobID, .@mobQTY; // 3x3 wouldnt fit -> use spot.
+ return;
+
+L_Abort:
+ debugmes "spawn_mob_around: invalid args! Map=" + .@map$ + " x=" + .@mobX + " y=" + .@mobY + " mobID=" + .@mobID + " mobQTY=" + .@mobQTY;
+ return;
+}