summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
Diffstat (limited to 'npc')
-rw-r--r--npc/functions/util.txt16
-rw-r--r--npc/soren/main.txt119
2 files changed, 132 insertions, 3 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index 953b5f21f..1558fb4b7 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -120,3 +120,19 @@ function script nard_time {
return INT_MAX;
}
+// Determines if player is still in range.
+// eg.
+// if (reachable(.x, .y, .distance)) {
+function script reachable {
+ .@x=getarg(0);
+ .@y=getarg(1);
+ .@z=getarg(2);
+ getmapxy(.@mp$, .@xp, .@yp, 0);
+
+ if (distance(.@x, .@y, .@xp, .@yp) <= .@z)
+ return 1;
+ else
+ return 0;
+}
+
+
diff --git a/npc/soren/main.txt b/npc/soren/main.txt
index 8934f33b4..b9cead7a4 100644
--- a/npc/soren/main.txt
+++ b/npc/soren/main.txt
@@ -22,7 +22,7 @@
//
// Obviously NPC variables was more sane.
//
-// The use of compareandsetq HurnscaldQuest_Celestia, 2, 3;
+// The use of compareandsetq HurnscaldQuest_Celestia
// Ensures you're NOT capable of skipping to final stage in order to finish
// the quest. Nice attempt, but that won't work. The scripts will advance,
// but you'll stay at the same quest state, and when it's checked, you will
@@ -32,6 +32,23 @@ soren,105,57,0 script Soren's House NPC_NO_SPRITE,0,0,{
end;
OnTouch:
+ .@st1=getvariableofnpc(.lifetime, "Soren's Fountain")-gettimetick(2);
+ .@st2=getvariableofnpc(.lifetime, "Soren's Lake")-gettimetick(2);
+ .@st3=getvariableofnpc(.lifetime, "Soren's Dizmo")-gettimetick(2);
+ if (.@st1 > 0 && .@st2 > 0 && .@st3 > 0) {
+ compareandsetq HurnscaldQuest_Celestia, 3, 4;
+ warp "soren-2", 32, 36;
+ end;
+ } else {
+ mesn l("Soren's House Tutorial");
+ mes col("There's a strong magic barrier. We need to disarm it in order to enter there.", 9);
+ mes col("There are three singularities on this island. If I disarm more than one, I'll have a penalty.", 9);
+ mes col("I should have full mana before attempting to disarm one.", 9);
+ mes col("Also, if I move away from the singularity during disarm process, it'll be lost.", 9);
+ mes col("The singularities keep arming themselves up again, so I have five minutes between first disarm and entering here.", 9);
+ mes col("We should split our team, and have someone to protect our backs. Otherwise, we might not do it.", 9);
+ close;
+ }
end;
}
@@ -40,15 +57,109 @@ OnTouch:
soren,105,92,0 script Soren's Fountain NPC_NO_SPRITE,0,0,{
-
+ // Initial Checks
+ if (.lifetime > gettimetick(2)) {
+ npctalk l("This singularity will remain disarmed for @@ more!", FuzzyTime(.lifetime, 2, 2));
+ end;
+ }
+ if (.st) {
+ npctalk l("A disarm process is already running.");
+ end;
+ }
+
+ // Main menu
+ mes col("Attempt to disarm the singularity?", 9);
+ if (askyesno() == ASK_YES) {
+ .casterId=getcharid(3);
+ .st=1;
+ npctalk l("@@ started disarm process. Please stand by.");
+ initnpctimer;
+ close;
+ }
+ end;
+
+// Waves (total: 6 waves)
+OnTimer5000:
+OnTimer10300:
+OnTimer14000:
+OnTimer18000:
+OnTimer25000:
+OnTimer29000:
+ if (!attachrid(.casterId)) {
+ npctalk "Disarm process aborted: Disarmer is gone.";
+ stopnpctimer; .st=0;
+ end;
+ }
+ if (!reachable(.x, .y, .distance)) {
+ npctalk l("Disarm process aborted: Disarmer is out of reach.");
+ stopnpctimer; .st=0;
+ end;
+ }
+
+ // Monster Gen
+ .@amount=rand(.st+1, .st+4);
+ .@mid=rand(1,3)+.st;
+ switch (.@mid) {
+ case 1:
+ case 2:
+ .@monsterId = CaveMaggot ; break;
+ case 3:
+ case 4:
+ case 5:
+ .@monsterId = LavaSlime ; break;
+ case 6:
+ case 7:
+ .@monsterId = MountainSnake ; break;
+ default:
+ .@monsterId = Yeti ; break;
+ }
+ // Item Gen
+ .@mid=rand(1,5)+.st;
+ switch (.@mid) {
+ case 1:
+ case 2:
+ .@itemId = Acorn ; break;
+ case 3:
+ .@itemId = ChocolateMouboo ; break;
+ case 4:
+ case 5:
+ .@itemId = OrangeCupcake ; break;
+ case 6:
+ .@itemId = CherryCake ; break;
+ case 7:
+ case 8:
+ .@itemId = Chagashroom ; break;
+ case 9:
+ .@itemId = HastePotion ; break;
+ case 10:
+ .@itemId = rand(Diamond, Amethyst) ; break;
+ case 11:
+ .@itemId = rand(CopperOre, TitaniumOre) ; break;
+ }
+ // Defines
+ .@lx=.x-distance;
+ .@ly=.y-distance;
+ .@ux=.x+distance;
+ .@uy=.y+distance;
+
+ // Core function
+ areamonster .map$, .@lx, .@ly, .@ux, .@uy, strmobinfo(1, .@monsterId), .@monsterId, .@amount; makeitem(.@itemId, 1, .map$, rand(.@lx, .@ux), rand(.@ly, .@uy)); ++.st;
+
+ // If we're done with waves
+ if (.st >= 6) {
+ .lifetime=gettimetick(2)+300;
+ npctalk l("Disarmed with success for: @@", FuzzyTime(.lifetime, 2, 2));
+ stopnpctimer; .st=0;
+ }
end;
OnInit:
.sex = G_OTHER;
.distance = 2;
- .casterId=""; // getcharid(3) → Account number!!
+ .casterId=0; // getcharid(0) → 3 is account number!!
.lifetime=0; // When will this gate expire (five minutes) (gettimetick(2) + (60*5))
+ .st=0; // Status after started
end;
}
@@ -66,6 +177,7 @@ OnInit:
.casterId=""; // getcharid(3) → Account number!!
.lifetime=0; // When will this gate expire (five minutes) (gettimetick(2) + (60*5))
+ .st=0; // Status after started
end;
}
@@ -84,6 +196,7 @@ OnInit:
.casterId=""; // getcharid(3) → Account number!!
.lifetime=0; // When will this gate expire (five minutes) (gettimetick(2) + (60*5))
+ .st=0; // Status after started
end;
}