diff options
Diffstat (limited to 'world/map/npc/functions/spawns_on_mobkill.txt')
-rw-r--r-- | world/map/npc/functions/spawns_on_mobkill.txt | 81 |
1 files changed, 81 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..fadb6cd1 --- /dev/null +++ b/world/map/npc/functions/spawns_on_mobkill.txt @@ -0,0 +1,81 @@ +// Mob splitting/spawn logic By Hello=) + +// Spawns some mobs on death of other mob. E.g. split BIG slime -> few smaller ones +// This function meant to be called with player RID attached (usually in OnMobKillEvent) +// Inputs: nothing, but expects @mobID, @mobX and @mobY set (usually by server) +// Return: nothing, but spawns few things. +function|script|spawns_on_mobkill +{ + if (@mobID == SeaSlimeMother) goto L_SplitSea; + if ((@mobID == GreenSlimeMother) || (@mobID == GreenSuperSlime)) goto L_SplitGreen; + if (@mobID == YellowSuperSlime) goto L_SplitYellow; + if (@mobID == RedSuperSlime) goto L_SplitRed; + if (@mobID == BlueSuperSlime) goto L_SplitBlue; + if (@mobID == Tormenta) goto L_TorWitchDead; + if ((@mobID == Luvia) && (getmap() != "052-2")) goto L_LuvWitchDead; // Skip spawns if its Illia + if (@mobID == Blanc1) goto L_Blanc1Dead; + return; // Not mob of interest -> do nothing + +L_SplitSea: + void call("spawn_mobs_around", getmap(), @mobX, @mobY, AngrySeaSlime, rand(8, 16)); + return; + +L_SplitGreen: + void call("spawn_mobs_around", getmap(), @mobX, @mobY, AngryGreenSlime, rand(8, 16)); + return; + +L_SplitYellow: + void call("spawn_mobs_around", getmap(), @mobX, @mobY, YellowSlime, rand(6, 16)); + return; + +L_SplitRed: + void call("spawn_mobs_around", getmap(), @mobX, @mobY, RedSlime, rand(6, 16)); + return; + +L_SplitBlue: + void call("spawn_mobs_around", getmap(), @mobX, @mobY, BlueSlime, rand(3, 6)); + return; + +L_TorWitchDead: + void call("spawn_mobs_around", getmap(), @mobX, @mobY, VoidBat, rand(7, 12)); + void call("spawn_mobs_around", getmap(), @mobX, @mobY, DemonicSpirit, rand(5, 10)); + void call("spawn_mobs_around", getmap(), @mobX, @mobY, UndeadWitch, 1); + return; + +L_LuvWitchDead: + void call("spawn_mobs_around", getmap(), @mobX, @mobY, VoidBat, rand(7, 12)); + void call("spawn_mobs_around", getmap(), @mobX, @mobY, DemonicSpirit, rand(5, 8)); + void call("spawn_mobs_around", getmap(), @mobX, @mobY, UndeadWitch, 1); + return; + +L_Blanc1Dead: + void call("spawn_mobs_around", getmap(), @mobX, @mobY, Blanc2, 1); + 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, arg4: amount +// Return: nothing, but spawns few things. +function|script|spawn_mobs_around +{ + set .@map$, getarg(0, ""); // map where to spawn + set .@mobX, getarg(1, -1); // X coord + set .@mobY, getarg(2, -1); // Y coord + set .@mobID, getarg(3, -1); // Mob ID to spawn. + set .@mobQTY, getarg(4, -1); // Amount. + if ((.@map$ == "") || (.@mobX < 1) || (.@mobY < 1) || (.@mobID < 1002) || + (.@mobX > getmapmaxx(.@map$)) || (.@mobY > getmapmaxy(.@map$)) || + (.@mobQTY < 1)) // Invalid parameters given? + goto L_Abort; // Yell and return + if ((.@mobX > 1) && (.@mobY > 1) && (.@mobX < getmapmaxx(.@map$)) && + (.@mobY < getmapmaxy(.@map$)) && (.@mobQTY > 1)) //Enough room for 3x3 && "mass" spawn + areamonster .@map$, (.@mobX-1), (.@mobY-1), (.@mobX+1), (.@mobY+1), "", .@mobID, .@mobQTY; + else + monster .@map$, .@mobX, .@mobY, "", .@mobID, .@mobQTY; // 3x3 wouldnt fit or just 1 mob. + return; + +L_Abort: + debugmes "spawn_mob_around: invalid args! Map=" + .@map$ + " x=" + .@mobX + " y=" + .@mobY + " mobID=" + .@mobID + " mobQTY=" + .@mobQTY; + return; +} |