1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// 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, @mobX and @mobY 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
{
if (@mobID == SeaSlimeMother) goto L_SplitSea;
if (@mobID == GreenSlimeMother) goto L_SplitGreen;
if (@mobID == Tormenta) goto L_TorWitchDead;
if ((@mobID == Luvia) && (getmap() != "052-2")) goto L_LuvWitchDead; // Skip spawns if its Illia
return;
L_SplitSea:
void call("spawn_mobs_around", getmap(), @mobX, @mobY, AngrySeaSlime, rand(8, 20));
return;
L_SplitGreen:
void call("spawn_mobs_around", getmap(), @mobX, @mobY, AngryGreenSlime, rand(8, 20));
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(6, 10));
void call("spawn_mobs_around", getmap(), @mobX, @mobY, 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, 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$)) || (.@mobX > getmapmaxy(.@map$)) ||
(.@mobQTY < 1)) goto L_Abort;
if ((.@mobX > 1) && (.@mobY > 1) && (.@mobX < getmapmaxx(.@map$)) && (.@mobY < getmapmaxy(.@map$))) //Enough room for 3x3
areamonster .@map$, (.@mobX-1), (.@mobY-1), (.@mobX+1), (.@mobY+1), "", .@mobID, .@mobQTY;
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;
}
|