From e6488a8be673bd2f607934ba5c621cc5316eb1af Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 29 Apr 2019 09:27:45 -0300 Subject: Siege milestone with util functions for variable difficulty. It is weird if siege happens at multiple places at once. Experimental and unfinished, siege still happens immediately. --- npc/012-1/guards.txt | 22 ++++++++++++++++++---- npc/functions/siege.txt | 12 ++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/npc/012-1/guards.txt b/npc/012-1/guards.txt index bd9937d01..31c781b75 100644 --- a/npc/012-1/guards.txt +++ b/npc/012-1/guards.txt @@ -592,6 +592,16 @@ OnInit: 012-1,0,0,0 script #HurnscaldSiege NPC_HIDDEN,{ end; + +// Respawn monster from $@SIEGE_TMPMOBS memory +OnRespawn: + getmapxy(.@m$,.@x,.@y,3); + siege_spawn(.@m$, any_of($@SIEGE_TMPMOBS), 1, "#HurnscaldSiege::OnRespawn"); + if (rand(10000) <= $coinsrate+($@SIEGE_HURNS*50)) + makeitem StrangeCoin, 1, .@m$, .@x, .@y; + end; + +// Deprecated OnBlackScorpionDeath: siege_spawn("014-3", BlackScorpion, 1, "#HurnscaldSiege::OnBlackScorpionDeath"); getmapxy(.@m$,.@x,.@y,3); @@ -692,12 +702,14 @@ OnTimer15000: end; OnTimer60000: + debugmes "6k"; 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"); end; OnTimer120000: + debugmes "12k"; if ($@SIEGE_HURNS >= 5) { mapannounce("012-1", "##1The Monster Colonel arrived!", bc_map); areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, ("Monster Colonel"), 1036, 1, "#HurnscaldSiege::OnColonelDeath"); @@ -713,10 +725,12 @@ OnTimer120000: end; OnTimer180000: - 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, CandiedSlime), 1089, 10, "#HurnscaldSiege::OnCandiedSlimeDeath"); - areamonster("012-1", 20, 20, getmapinfo(MAPINFO_SIZE_X)-20, getmapinfo(MAPINFO_SIZE_Y)-20, strmobinfo(1, ManaGhost), 1068, 2, "#HurnscaldSiege::OnManaGhostDeath"); + debugmes "18k"; + siege_selectmob(siege_calcdiff("012-1"), $@SIEGE_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: diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt index 6fe15287c..72566549e 100644 --- a/npc/functions/siege.txt +++ b/npc/functions/siege.txt @@ -37,7 +37,7 @@ function script siege_calcdiff { return (.@bsum/.@c); } -// push to @mobs the if their level is within a 20 level range +// push to $@SIEGE_TMPMOBS the if their level is within a 20 level range // above or below // siege_push ( mobID, level ) function script siege_push { @@ -45,7 +45,7 @@ function script siege_push { .@lv=getarg(1,0); if (is_between(.@lv-20, .@lv+20, atoi(strmobinfo(3, .@mi)) ) ) - array_push(@mobs, .@mi); + array_push($@SIEGE_TMPMOBS, .@mi); return; } @@ -55,7 +55,7 @@ function script siege_push { // TP_HURNS and TP_NIVAL are supported. You can use them with the "|" operand, eg., // TP_TULIM | TP_HURNS. // -// It currently only creates @mobs, you need to use any_of() manually. +// It currently only creates $@SIEGE_TMPMOBS, you need to use any_of() manually. // siege_selectmob ( blvl, difficulty{, tp_mask} ) function script siege_selectmob { .@blv=getarg(0); @@ -65,9 +65,9 @@ function script siege_selectmob { // We don't need .@dif, so we convert difficulty to levels .@blv+=.@dif*3; - deletearray @mobs; - setarray @mobs, ManaGhost, CandiedSlime, Bif; - // Now we must select mobs, using array_push() to @mobs + deletearray $@SIEGE_TMPMOBS; + setarray $@SIEGE_TMPMOBS, ManaGhost, CandiedSlime, Bif; + // Now we must select mobs, using array_push() to $@SIEGE_TMPMOBS // First, mobs on all envs siege_push(BlackScorpion, .@blv); siege_push(GreenSlime, .@blv); -- cgit v1.2.3-60-g2f50