summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--npc/012-1/guards.txt99
-rw-r--r--npc/functions/siege.txt55
2 files changed, 71 insertions, 83 deletions
diff --git a/npc/012-1/guards.txt b/npc/012-1/guards.txt
index d8d5389db..8039a5ca3 100644
--- a/npc/012-1/guards.txt
+++ b/npc/012-1/guards.txt
@@ -601,42 +601,7 @@ OnRespawn:
makeitem StrangeCoin, 1, .@m$, .@x, .@y;
end;
-// Deprecated
-OnBlackScorpionDeath:
- siege_spawn("014-3", BlackScorpion, 1, "#HurnscaldSiege::OnBlackScorpionDeath");
- getmapxy(.@m$,.@x,.@y,3);
- if (rand(10000) <= 90+($@SIEGE_HURNS*100))
- makeitem StrangeCoin, 1, .@m$, .@x, .@y;
- end;
-
-OnBlackScorpion2Death:
- siege_spawn("012-1", BlackScorpion, 1, "#HurnscaldSiege::OnBlackScorpion2Death");
- getmapxy(.@m$,.@x,.@y,3);
- if (rand(10000) <= 850+($@SIEGE_HURNS*100))
- makeitem StrangeCoin, 1, .@m$, .@x, .@y;
- end;
-
-OnGreenSlimeDeath:
- siege_spawn("012-1", GreenSlime, 1, "#HurnscaldSiege::OnGreenSlimeDeath");
- getmapxy(.@m$,.@x,.@y,3);
- if (rand(10000) <= 200+($@SIEGE_HURNS*100))
- makeitem StrangeCoin, 1, .@m$, .@x, .@y;
- end;
-
-OnCandiedSlimeDeath:
- siege_spawn("012-1", CandiedSlime, 1, "#HurnscaldSiege::OnCandiedSlimeDeath");
- getmapxy(.@m$,.@x,.@y,3);
- if (rand(10000) <= 150+($@SIEGE_HURNS*100))
- makeitem StrangeCoin, 1, .@m$, .@x, .@y;
- end;
-
-OnManaGhostDeath:
- siege_spawn("012-1", ManaGhost, 1, "#HurnscaldSiege::OnManaGhostDeath");
- getmapxy(.@m$,.@x,.@y,3);
- if (rand(10000) <= 900+($@SIEGE_HURNS*100))
- makeitem StrangeCoin, 1, .@m$, .@x, .@y;
- end;
-
+// Boss Death Labels
OnLieutenantDeath:
getitem StrangeCoin, 1;
mapannounce("012-1", l("##2The Monster Lieutenant was defeated by @@!", strcharinfo(0)), bc_map);
@@ -650,8 +615,8 @@ OnColonelDeath:
$MK_TEMPVAR+=10;
end;
+// Begin Siege
OnMKSiege:
- debugmes "Begin";
siege_setup("014-3");
siege_setup("012-1", "WARNING! WARNING! Siege starting at Hurnscald!!");
disablenpc("Mana Stone");
@@ -662,8 +627,8 @@ OnMKSiege:
// Timers
OnTimer5000:
- siege_spawn("014-3", BlackScorpion, 5+$@SIEGE_HURNS, "#HurnscaldSiege::OnBlackScorpionDeath");
- siege_spawn("012-1", BlackScorpion, 5+$@SIEGE_HURNS, "#HurnscaldSiege::OnBlackScorpion2Death");
+ siege_cast("014-3", .name$, 0, TP_HURNS);
+ siege_cast("012-1", .name$, 0, TP_HURNS);
mapannounce("012-1", "##2Message to all Hurnscald NPCs: Take shelter!", bc_map);
disablenpc "Gwendolyn";
disablenpc "Milly";
@@ -680,8 +645,8 @@ OnTimer5000:
end;
OnTimer15000:
- siege_spawn("014-3", BlackScorpion, 5+$@SIEGE_HURNS, "#HurnscaldSiege::OnBlackScorpionDeath");
- siege_spawn("012-1", BlackScorpion, 5+$@SIEGE_HURNS, "#HurnscaldSiege::OnBlackScorpion2Death");
+ siege_cast("014-3", .name$, $@SIEGE_HURNS, TP_HURNS);
+ siege_cast("012-1", .name$, $@SIEGE_HURNS, TP_HURNS);
disablenpc "Shoppa Kep";
disablenpc "Richard";
@@ -697,9 +662,7 @@ OnTimer15000:
end;
OnTimer60000:
- siege_spawn("012-1", BlackScorpion, 3, "#HurnscaldSiege::OnBlackScorpion2Death");
- siege_spawn("012-1", GreenSlime, 10+$@SIEGE_HURNS, "#HurnscaldSiege::OnGreenSlimeDeath");
- siege_spawn("012-1", CandiedSlime, 1+$@SIEGE_HURNS, "#HurnscaldSiege::OnCandiedSlimeDeath");
+ siege_cast("012-1", .name$, $@SIEGE_HURNS, TP_HURNS);
end;
OnTimer120000:
@@ -737,48 +700,29 @@ OnTimer120000:
// Announce and spawn
siege_spawn("012-1", .@mobId, 1, "#HurnscaldSiege::On"+.@ts$+"Death");
- mapannounce("012-1", "##1The Monster "+.@ts$+" arrived! It is a "+strmobinfo(1, any_of($@SIEGE_TMPMOBS)), bc_map);
-
- // Clear $@SIEGE_TMPMOBS
- siege_selectmob(siege_calcdiff("012-1"), $@SIEGE_HURNS, TP_HURNS);
- siege_spawn("012-1", any_of($@SIEGE_TMPMOBS), 1+$@SIEGE_HURNS, "#HurnscaldSiege::OnRespawn");
- siege_spawn("012-1", any_of($@SIEGE_TMPMOBS), 2+$@SIEGE_HURNS, "#HurnscaldSiege::OnRespawn");
- siege_spawn("012-1", any_of($@SIEGE_TMPMOBS), 2+$@SIEGE_HURNS, "#HurnscaldSiege::OnRespawn");
- siege_spawn("012-1", any_of($@SIEGE_TMPMOBS), 2+$@SIEGE_HURNS, "#HurnscaldSiege::OnRespawn");
- end;
+ mapannounce("012-1", "##1The Monster "+.@ts$+" arrived! It is a "+strmobinfo(1, .@mobId), bc_map);
-OnTimer180000:
- siege_selectmob(siege_calcdiff("012-1"), $@SIEGE_HURNS, TP_HURNS);
- siege_spawn("012-1", any_of($@SIEGE_TMPMOBS), 1+$@SIEGE_HURNS, "#HurnscaldSiege::OnRespawn");
- siege_spawn("012-1", any_of($@SIEGE_TMPMOBS), 2+$@SIEGE_HURNS, "#HurnscaldSiege::OnRespawn");
- siege_spawn("012-1", any_of($@SIEGE_TMPMOBS), 2+$@SIEGE_HURNS, "#HurnscaldSiege::OnRespawn");
- siege_spawn("012-1", any_of($@SIEGE_TMPMOBS), 2+$@SIEGE_HURNS, "#HurnscaldSiege::OnRespawn");
- end;
-
-OnTimer240000:
- debugmes "24k";
- areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, strmobinfo(1, SlimeBlast), 1090, 25);
- areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, ("Black Scorpion"), BlackScorpion, 1, "#HurnscaldSiege::OnBlackScorpion2Death");
- areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, strmobinfo(1, ManaGhost), 1068, 2, "#HurnscaldSiege::OnManaGhostDeath");
+ // Clear $@SIEGE_TMPMOBS and start casting
+ siege_cast("012-1", .name$, $@SIEGE_HURNS, TP_HURNS);
end;
+// At the middle (5 min), we spawn at 014-3 again
OnTimer300000:
- areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, strmobinfo(1, SlimeBlast), 1090, 5);
- areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, strmobinfo(1, CandiedSlime), 1089, 1, "#HurnscaldSiege::OnCandiedSlimeDeath");
- areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, strmobinfo(1, ManaGhost), 1068, 1, "#HurnscaldSiege::OnManaGhostDeath");
+ siege_cast("014-3", .name$, $@SIEGE_HURNS, TP_HURNS);
+ siege_cast("012-1", .name$, $@SIEGE_HURNS, TP_HURNS);
end;
+OnTimer180000:
+OnTimer240000:
OnTimer360000:
OnTimer420000:
OnTimer480000:
- areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, strmobinfo(1, SlimeBlast), 1090, 5+$@SIEGE_HURNS);
- areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, ("Red Slime"), 1092, 1+$@SIEGE_HURNS);
+ siege_cast("012-1", .name$, $@SIEGE_HURNS, TP_HURNS);
end;
OnTimer540000:
mapannounce("012-1", "##1The Monster Army is getting tired of resistance!", bc_map);
- areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, strmobinfo(1, SlimeBlast), 1090, 5+$@SIEGE_HURNS);
- areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, strmobinfo(1, ManaGhost), 1068, 1, "#HurnscaldSiege::OnManaGhostDeath");
+ siege_cast("012-1", .name$, $@SIEGE_HURNS, TP_HURNS);
end;
OnTimer600000:
@@ -787,15 +731,10 @@ OnTimer600000:
mapannounce("012-1", "##1The Monster King army is preparing to withdraw!", bc_map);
end;
OnTimer630000:
- removemapmask "012-1", MASK_MATTACK;
- removemapmask "014-3", MASK_MATTACK;
- changemusic "012-1", "caketown.ogg"; // Restore to default
+ siege_revert("012-1");
+ siege_revert("014-3");
enablenpc("Mana Stone");
$@SIEGE_HURNS=0;
- killmonsterall("012-1", 0);
- killmonsterall("014-3", 0);
- pvpoff("012-1");
- pvpoff("014-3");
announce(("Hurnscald siege is over!"), bc_all);
enablenpc "Gwendolyn";
enablenpc "Milly";
diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt
index 261492ac2..1a0d92dbe 100644
--- a/npc/functions/siege.txt
+++ b/npc/functions/siege.txt
@@ -25,6 +25,12 @@ function script siege_calcdiff {
.@bsum=0;
.@highest=getarg(1, false);
.@c = getunits(BL_PC, .@players, false, getarg(0));
+
+ // Fallback: No players on map, always return 0
+ if (.@c == 0)
+ return 0;
+
+ // There is at least one player, do things properly
for (.@i = 0; .@i < .@c; .@i++) {
.@b=readparam(BaseLevel, .@players[.@i]);
.@bsum+=.@b;
@@ -62,7 +68,7 @@ function script siege_push {
// siege_selectmob ( blvl, difficulty{, tp_mask} )
function script siege_selectmob {
.@blv=getarg(0);
- .@dif=getarg(1);
+ .@dif=getarg(1, 0);
.@tp=getarg(2, 0);
// We don't need .@dif, so we convert difficulty to levels
@@ -124,11 +130,10 @@ function script siege_selectmob {
return;
}
-
+/////////////////////////////////////////////////////////////
// Prepare a siege with optional announce
// siege_setup ( map{, announce} )
function script siege_setup {
- debugmes "Cast";
.@m$=getarg(0);
.@msg$=getarg(1, "");
@@ -136,8 +141,52 @@ function script siege_setup {
changemusic .@m$, any("mythica.ogg", "eric_matyas_ghouls.ogg", "misuse.ogg", "Arabesque.ogg");
disablenpc("Mana Stone");
pvpon(.@m$);
+ setmapflag(.@m$,mf_bexp,rand(140,160)); // 40~60% EXP UP on siege maps
if (.@msg$ != "")
kamibroadcast(col(.@msg$,1));
return;
}
+// Revert what siege_setup did
+// siege_revert ( map )
+function script siege_revert {
+ .@m$=getarg(0);
+
+ removemapmask .@m$, MASK_MATTACK;
+ changemusic .@m$, "caketown.ogg"; // :>
+ enablenpc("Mana Stone");
+ pvpoff(.@m$);
+ removemapflag(.@m$,mf_bexp);
+ killmonsterall(.@m$);
+ return;
+}
+
+// Spawn some monsters
+// siege_cast ( map, NPCName, {, difficulty{, tpflag}} )
+function script siege_cast {
+ // mz - map ; n - name ; d - difficulty ; tp - teleport
+ // a - ammount ; e - mobId
+ .@mz$=getarg(0);
+ .@n$=getarg(1);
+ .@d=getarg(2,0);
+ .@tp=getarg(3,0);
+
+ siege_selectmob(siege_calcdiff(.@mz$), .@d, .@tp);
+
+ // How many monsters?
+ .@a=(.@d/3)+1;
+
+ .@e=any_of($@SIEGE_TMPMOBS);
+ array_remove($@SIEGE_TMPMOBS, .@e);
+ siege_spawn(.@mz$, .@e, .@a, .@n$+"::OnRespawn");
+
+ .@e=any_of($@SIEGE_TMPMOBS);
+ array_remove($@SIEGE_TMPMOBS, .@e);
+ siege_spawn(.@mz$, .@e, .@a, .@n$+"::OnRespawn");
+
+ .@e=any_of($@SIEGE_TMPMOBS);
+ array_remove($@SIEGE_TMPMOBS, .@e);
+ siege_spawn(.@mz$, .@e, .@a, .@n$+"::OnRespawn");
+ return;
+}
+