summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-09-17 10:56:54 -0300
committerJesusaves <cpntb1@ymail.com>2019-09-17 10:56:54 -0300
commit6bf011745e0ced95158de80f623fcf5c91b7f07a (patch)
tree4cf03bedd774ddd09bbc4deba63b66e4da00d829 /npc
parentf781723166ee2a2d2bf9fa3b239dbf102d5267ef (diff)
downloadserverdata-6bf011745e0ced95158de80f623fcf5c91b7f07a.tar.gz
serverdata-6bf011745e0ced95158de80f623fcf5c91b7f07a.tar.bz2
serverdata-6bf011745e0ced95158de80f623fcf5c91b7f07a.tar.xz
serverdata-6bf011745e0ced95158de80f623fcf5c91b7f07a.zip
Light bringer NPC - Players are now officially allowed to hold it, as long
as they got at least 60 LB Matrix points.
Diffstat (limited to 'npc')
-rw-r--r--npc/functions/gmbot.txt182
-rw-r--r--npc/functions/mkbot.txt8
-rw-r--r--npc/scripts.conf2
3 files changed, 188 insertions, 4 deletions
diff --git a/npc/functions/gmbot.txt b/npc/functions/gmbot.txt
new file mode 100644
index 000000000..4615c0f58
--- /dev/null
+++ b/npc/functions/gmbot.txt
@@ -0,0 +1,182 @@
+// TMW2 scripts.
+// Authors:
+// Jesusalva
+// Description:
+// The most powerful sword ever. It's alive.
+
+boss,45,42,0 script Lightbringer NPC_LIGHTBRINGER,{
+ function movelb;
+ function matrixlb;
+
+ if ($GAME_STORYLINE >= 3) goto L_Today;
+ npctalkonce l("It still isn't time to awake the King Of Holy Swords, Light Bringer.");
+ end;
+
+L_Today:
+ .@q=getq(General_Narrator);
+ // Prologue missed - straight refusal
+ if (.@q < 19) {
+ npctalk3 l("The sword glows too much. Perhaps @@ could take it.", $MOST_HEROIC$);
+ end;
+ }
+ // Determine if you are worthy (from 0 to 101)
+ if (!@lbscore)
+ @lbscore=matrixlb();
+
+ if (is_staff())
+ dispbottom "I only did "+@lbscore+" points...";
+
+ if (@lbscore <= 30) {
+ npctalk3 l("...");
+ end;
+ } else if (@lbscore <= 60) {
+ npctalk3 l("You are not worthy...");
+ end;
+ }
+
+ // Else: score > 60, 1 minute per additional score
+ rentitem Lightbringer, (60*(@lbscore-60));
+ dispbottom l("This live sword drafts itself to your hand. You can wield it for a while.");
+ disablenpc .name$;
+ .busy=gettimetick(2)+(60*(@lbscore-60));
+ end;
+
+OnInit:
+ .sex = G_MALE;
+ .distance = 2;
+
+ if ($GAME_STORYLINE < 3)
+ disablenpc .name$;
+
+ .npcId=getnpcid();
+ .users=getusers(1);
+ .busy=false;
+ // Constants
+
+ // We should jump straight to loop (it runs every 5 minutes)
+OnTimer300000:
+ .users=getusers(1);
+ // If $LIGHTBRINGER_OWNER$ is set, we die here
+ if ($LIGHTBRINGER_OWNER$ != "")
+ end;
+
+ // Proccess busy time
+ if (.busy) {
+ if (.busy < gettimetick(2)) {
+ .busy=false;
+ enablenpc .name$;
+ } else {
+ initnpctimer;
+ end;
+ }
+ }
+
+ // Min. 2 NPCs for the Lightbringer to show up
+ if (!.busy) {
+ if (.users <= 2 && !$@GM_OVERRIDE) {
+ disablenpc .name$;
+ .busy=true;
+ }
+ }
+
+ // You cannot interact with it during events
+ if ($@MK_SCENE || $@GM_EVENT) {
+ disablenpc .name$;
+ .busy=true;
+ initnpctimer;
+ end;
+ }
+
+ // Move Lightbringer to a random map
+ movelb(.npcId);
+
+ // Debug markers
+ if ($@GM_OVERRIDE)
+ debugmes "Light Bringer (bot): "+.map$+" ("+.x+", "+.y+")";
+
+ // We're done, restart loop timer
+ initnpctimer;
+ end;
+
+// Functions
+// movelb(npcid)
+function movelb {
+ .@id=getarg(0);
+ setarray .@m$, "boss", "boss", "001-1", "001-3", "001-7",
+ "004-2", "004-2-1",
+ "010-1", "010-1-1", "011-2", "011-3",
+ "013-1", "014-5", "015-1", "015-2", "015-3", "015-4", "015-5", "015-6", "015-7",
+ "018-1", "018-1-1", "018-2", "018-3", "018-4", "018-4-1", "018-5-1",
+ "019-4", "021-1", "021-2", "021-3", "022-1", "023-1";
+ .mp$=any_of(.@m$);
+
+ // Try to warp randomly: 30 attempts for a walkable spot
+ .@e=0; .@x=0; .@y=0;
+ .@mx=getmapinfo(MAPINFO_SIZE_X, .mp$)-20;
+ .@my=getmapinfo(MAPINFO_SIZE_Y, .mp$)-20;
+ do {
+ if (.@e >= 30) {
+ .mp$="boss";
+ .@x=45;
+ .@y=42;
+ break;
+ }
+ .@x = rand2(20, .@mx);
+ .@y = rand2(20, .@my);
+ .@e+=1;
+ } while (!checknpccell(.mp$, .@x, .@y, cell_chkpass));
+
+ if (!checknpccell(.mp$, .@x, .@y, cell_chkpass)) {
+ Exception("gm.bot runtime error: GM_ERR_128 highlight @Jesusalva", RB_DEBUGMES|RB_IRCBROADCAST); .mp$="boss"; .@x=45; .@y=42;
+ }
+
+ // Time to warp the NPC
+ npctalk("...");
+ sleep(20);
+ unitwarp(.@id, .mp$, .@x, .@y);
+ sleep(50); // For some reason or other, adding sleep(norid) and sleep2(rid).
+ return;
+}
+
+// matrixlb()
+function matrixlb {
+ .@pts=0;
+ // Heroic Matrice
+ .@pts+=($MOST_HEROIC$ == strcharinfo(0) ? 10 : 0);
+ // Magic Matrice
+ .@pts+=min(7, MAGIC_LVL);
+ // Main levels matrix
+ .@pts+=min(15, BaseLevel/10);
+ .@pts+=min(15, JobLevel/10);
+ // Scoreboards matrix
+ .@br=array_find($@hoblvl_name$, strcharinfo(0));
+ .@jr=array_find($@hojlvl_name$, strcharinfo(0));
+ .@mr=array_find($@hofortune_name$, strcharinfo(0));
+ .@br=limit(0, (.@br >= 0 ? 10-.@br : 0), 10);
+ .@jr=limit(0, (.@jr >= 0 ? 10-.@jr : 0), 10);
+ .@mr=limit(0, (.@mr >= 0 ? 10-.@mr : 0), 10);
+ .@pts+=.@br;
+ .@pts+=.@jr;
+ .@pts+=.@mr;
+ // Reputation matrix
+ .@pts+=min(3, reputation("Tulim")/33);
+ .@pts+=min(3, reputation("Hurns")/33);
+ .@pts+=min(3, reputation("LoF")/33);
+ .@pts+=min(3, reputation("Nival")/33);
+ .@pts+=min(3, reputation("Halin")/33);
+ .@pts+=min(3, reputation("Frostia")/33);
+ .@pts+=min(3, reputation("Candor")/33);
+ // What about Lilit?
+
+ // Who am I bonus TODO
+ // Temporaly I'll use Candor Battle Top 3
+ .@cr=array_find($@cfefe_name$, strcharinfo(0));
+ .@cr=limit(0, (.@cr >= 0 ? 3-.@cr : 0), 3);
+ .@pts+=.@cr;
+
+ // Max points: 101
+ return .@pts;
+}
+
+}
+
diff --git a/npc/functions/mkbot.txt b/npc/functions/mkbot.txt
index f71334435..adca606ed 100644
--- a/npc/functions/mkbot.txt
+++ b/npc/functions/mkbot.txt
@@ -114,6 +114,8 @@ OnTimer90000:
// Try to warp randomly, up to 30 attempts
.@e=0; .@x=0; .@y=0;
+ .@mx=getmapinfo(MAPINFO_SIZE_X, .mp$)-20;
+ .@my=getmapinfo(MAPINFO_SIZE_Y, .mp$)-20;
do {
if (.@e >= 30) {
.mp$="boss";
@@ -121,12 +123,12 @@ OnTimer90000:
.@y=45;
break;
}
- .@x = rand2(20, 300);
- .@y = rand2(20, 300);
+ .@x = rand2(20, .@mx);
+ .@y = rand2(20, .@my);
.@e+=1;
} while (!checknpccell(.mp$, .@x, .@y, cell_chkpass));
if (!checknpccell(.mp$, .@x, .@y, cell_chkpass)) {
- Exception("gm.bot runtime error: GM_ERR_128 highlight @Jesusalva", RB_DEBUGMES|RB_IRCBROADCAST); .mp$="boss"; .@x=45; .@y=45;
+ Exception("mk.bot runtime error: GM_ERR_128 highlight @Jesusalva", RB_DEBUGMES|RB_IRCBROADCAST); .mp$="boss"; .@x=45; .@y=45;
}
unitwarp($@MK, .mp$, .@x, .@y);
sleep(50); // For some reason or other, adding sleep(norid) and sleep2(rid).
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 707883ae0..1448fc947 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -132,7 +132,7 @@
"npc/functions/estate2.txt",
"npc/functions/hub.txt",
"npc/functions/mkbot.txt",
-//"npc/functions/gmbot.txt",
+"npc/functions/gmbot.txt",
"npc/functions/instances.txt",
// Maps specific scripts