summaryrefslogtreecommitdiff
path: root/npc/functions
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-04-29 09:16:18 -0300
committerJesusaves <cpntb1@ymail.com>2019-04-29 09:16:18 -0300
commit0c11c0ed4f48aeb1ba523692ecd111ecde954ddb (patch)
tree4cb0a7674ffbf43a5aa73fa8da3446ba0bbed855 /npc/functions
parentdf24e30846bba3398a1f4a635523155b0ad49cdc (diff)
downloadserverdata-0c11c0ed4f48aeb1ba523692ecd111ecde954ddb.tar.gz
serverdata-0c11c0ed4f48aeb1ba523692ecd111ecde954ddb.tar.bz2
serverdata-0c11c0ed4f48aeb1ba523692ecd111ecde954ddb.tar.xz
serverdata-0c11c0ed4f48aeb1ba523692ecd111ecde954ddb.zip
More siege functions
Diffstat (limited to 'npc/functions')
-rw-r--r--npc/functions/siege.txt99
-rw-r--r--npc/functions/timer.txt1
2 files changed, 100 insertions, 0 deletions
diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt
index 010ef0da3..6fe15287c 100644
--- a/npc/functions/siege.txt
+++ b/npc/functions/siege.txt
@@ -17,3 +17,102 @@ function script siege_spawn {
return;
}
+// Calculate player average level
+// if highest is set, it will return highest player level, with minimum the value
+// passed. (A level "0" is clearly not valid, of course)
+// siege_calcdiff ( map{, highest_lvl} )
+function script siege_calcdiff {
+ .@bsum=0;
+ .@highest=getarg(1, false);
+ .@c = getunits(BL_PC, .@players, false, getarg(0));
+ for (.@i = 0; .@i < .@c; .@i++) {
+ .@b=;readparam(BaseLevel, .@players[.@i])
+ .@bsum+=.@b;
+ if (.@b > .@highest)
+ .@highest=.@b;
+ }
+ if (getarg(1,false))
+ return .@highest;
+ else
+ return (.@bsum/.@c);
+}
+
+// push to @mobs the <mobID> if their level is within a 20 level range
+// above or below <level>
+// siege_push ( mobID, level )
+function script siege_push {
+ .@mi=getarg(0);
+ .@lv=getarg(1,0);
+
+ if (is_between(.@lv-20, .@lv+20, atoi(strmobinfo(3, .@mi)) ) )
+ array_push(@mobs, .@mi);
+ return;
+}
+
+// Selects a monster based on player average strength and base difficulty
+// It'll select monsters from 20 levels below to 20 levels above
+// tp_mask is the same as TP_* constants and changes mobs present. Only TP_TULIM,
+// 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.
+// siege_selectmob ( blvl, difficulty{, tp_mask} )
+function script siege_selectmob {
+ .@blv=getarg(0);
+ .@dif=getarg(1);
+ .@tp=getarg(2, 0);
+
+ // 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
+ // First, mobs on all envs
+ siege_push(BlackScorpion, .@blv);
+ siege_push(GreenSlime, .@blv);
+ siege_push(CaveMaggot, .@blv);
+ siege_push(MagicGoblin, .@blv);
+ siege_push(AngryBat, .@blv);
+ siege_push(BlackSlime, .@blv);
+ siege_push(BlackScorpion, .@blv);
+ siege_push(Forain, .@blv);
+ siege_push(GreenDragon, .@blv);
+ siege_push(Terranite, .@blv);
+ siege_push(JackO, .@blv);
+ siege_push(BlackMamba, .@blv);
+ siege_push(TerraniteProtector, .@blv);
+
+ // Now, mobs on only certain envs
+ if (.@tp & TP_TULIM) {
+ siege_push(AngryScorpion, .@blv);
+ siege_push(AngryRedScorpion, .@blv);
+ siege_push(DesertBandit, .@blv);
+ siege_push(LavaSlime, .@blv);
+ siege_push(OldSnake, .@blv);
+ siege_push(Snake, .@blv);
+ }
+ if (.@tp & TP_HURNS) {
+ siege_push(RedSlime, .@blv);
+ siege_push(Bandit, .@blv);
+ siege_push(RedMushroom, .@blv);
+ siege_push(RobinBandit, .@blv);
+ siege_push(AngryYellowSlime, .@blv);
+ siege_push(GrassSnake, .@blv);
+ siege_push(WickedMushroom, .@blv);
+ }
+ if (.@tp & TP_NIVAL) {
+ siege_push(Bluepar, .@blv);
+ siege_push(Wolvern, .@blv);
+ siege_push(Yeti, .@blv);
+ siege_push(Moggun, .@blv); // PS. Not aggressive
+ }
+
+ // Removed
+ //siege_push(DarkLizard, .@blv);
+ //siege_push(Crafty, .@blv);
+
+ return;
+}
+
+
diff --git a/npc/functions/timer.txt b/npc/functions/timer.txt
index cd1684b94..ac7d130bd 100644
--- a/npc/functions/timer.txt
+++ b/npc/functions/timer.txt
@@ -46,6 +46,7 @@ function script maptimer {
return .@i;
}
+// Same as maptimer() but deletes any previously running timer
// maptimer2("<map>", <tick>, "<npc>::<event>")
function script maptimer2 {
.@c = getunits(BL_PC, .@players, false, getarg(0));