summaryrefslogtreecommitdiff
path: root/npc/functions
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-05-23 22:30:29 -0300
committerJesusaves <cpntb1@ymail.com>2019-05-23 22:30:29 -0300
commit47abb1ee1826eeaf2495b52f7b5641ff7de60006 (patch)
tree0c04118a56d2e31d766aea1da1badf44870e441b /npc/functions
parente31d15407908c90fac899f0200b854d7793a3966 (diff)
downloadserverdata-47abb1ee1826eeaf2495b52f7b5641ff7de60006.tar.gz
serverdata-47abb1ee1826eeaf2495b52f7b5641ff7de60006.tar.bz2
serverdata-47abb1ee1826eeaf2495b52f7b5641ff7de60006.tar.xz
serverdata-47abb1ee1826eeaf2495b52f7b5641ff7de60006.zip
*cough cough* I present to you all, the unification of Siege System.
So I can work with all sieges at once.
Diffstat (limited to 'npc/functions')
-rw-r--r--npc/functions/siege.txt105
1 files changed, 105 insertions, 0 deletions
diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt
index 7071a68f1..9d6b479d7 100644
--- a/npc/functions/siege.txt
+++ b/npc/functions/siege.txt
@@ -165,6 +165,26 @@ function script siege_setup {
return;
}
+// Check if boss was killed or not
+// siege_check ( map )
+function script siege_check {
+ .@m$=getarg(0);
+ .@mb=0;
+
+ .@mb+=mobcount(.@m$, "#SiegeCtrl::OnSergeantDeath");
+ .@mb+=mobcount(.@m$, "#SiegeCtrl::OnLieutenantDeath");
+ .@mb+=mobcount(.@m$, "#SiegeCtrl::OnCaptainDeath");
+ .@mb+=mobcount(.@m$, "#SiegeCtrl::OnColonelDeath");
+ .@mb+=mobcount(.@m$, "#SiegeCtrl::OnGeneralDeath");
+
+ // Players failed, so reduce score in 1
+ if (.@mb) {
+ $MK_TEMPVAR-=1;
+ kamibroadcast("Players failed to defend the city!!"+.@mb);
+ }
+ return;
+}
+
// Revert what siege_setup did
// siege_revert ( map )
function script siege_revert {
@@ -323,6 +343,91 @@ function script siege_cast {
}
+////////////////////////////////////////////
+// Utility Function
+// do_siege ( town, outskirts, varcode, flag, npc, timer )
+function script do_siege {
+ .@m$=getarg(0);
+ .@o$=getarg(1);
+ .@c$=getarg(2);
+ .@tp=getarg(3);
+ .@n$=getarg(4);
+ .@t=getarg(5);
+
+ switch (.@t) {
+ // Warmup
+ case 70:
+ case 95:
+ siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ case 35:
+ siege_cast(.@o$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ break;
+ // Setup and casts
+ case 0:
+ siege_setup(.@o$);
+ siege_cast("014-3", .name$, 0, TP_HURNS);
+ break;
+ case 60:
+ siege_setup(.@m$);
+ siege_cast(.@o$, .@n$, 0, .@tp);
+ mapannounce(.@m$, "##2Message to all NPCs in town: Take shelter!", bc_map);
+ break;
+ case 90:
+ siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ siege_cast(.@o$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ break;
+ // Boss stage
+ case 280:
+ siege_boss(.@m$, getd("$@SIEGE_"+.@c$));
+ siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ break;
+ // Difficulty Raisers
+ case 310:
+ case 520:
+ case 640:
+ .@varsig=getd("$@SIEGE_"+.@c$);
+ setd("$@SIEGE_"+.@c$, .@varsig+1);
+ // Regular flow
+ case 195:
+ case 220:
+ case 265:
+ //case 280: BOSS WAVE
+ //case 310: difficulty raiser
+ case 355:
+ case 400:
+ case 445:
+ case 490:
+ //case 520: difficulty raiser
+ case 535:
+ case 580:
+ case 625:
+ //case 640: difficulty raiser
+ case 670:
+ siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ break;
+ // Ending flow
+ case 700:
+ mapannounce("012-1", "##1The Monster Army is preparing the retreat in about one minute!", bc_map);
+ siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ break;
+ case 760:
+ mapannounce("012-1", "##1The Monster Army is withdrawing within 30 seconds!", bc_map);
+ $@MK_SCENE=MK_NONE;
+ $@MK_AGGRO=$@MK_AGGRO/20;
+ break;
+ // Check db/constants.conf to change this value!
+ case MK_SIEGE_DURATION:
+ siege_check(.@m$);
+ siege_revert(.@m$);
+ siege_revert(.@o$);
+ enablenpc("Mana Stone");
+ setd("$@SIEGE_"+.@c$, 0);
+ break;
+ }
+
+ return;
+}
+
// Utility NPC
- script #SiegeCtrl NPC_HIDDEN,{
end;