summaryrefslogtreecommitdiff
path: root/npc/functions
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions')
-rw-r--r--npc/functions/main.txt7
-rw-r--r--npc/functions/mobhunter.txt72
2 files changed, 79 insertions, 0 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index ca828b056..2d4d3a11a 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -259,6 +259,13 @@ function script any_of {
// TMW2 Custom Functions
/////////////////////////////////////////////
+// Function meant to be used by Grand Hunter Quest
+// VarDiffValue ( old, new, target)
+function script VarDiffValue {
+ .@val=getarg(2);
+ return (getarg(0) < .@val && getarg(1) >= .@val);
+}
+
function script getmap {
if (getmapxy(.@mapName$, .@xpos, .@ypos, getarg(0,0)) != 0)
return false;
diff --git a/npc/functions/mobhunter.txt b/npc/functions/mobhunter.txt
index 4d61c77f6..c4c496908 100644
--- a/npc/functions/mobhunter.txt
+++ b/npc/functions/mobhunter.txt
@@ -101,6 +101,7 @@ function script GHQ_Assign {
switch (@menu) {
case 2:
+ GHQ_GetRewardsOnMilestone();
GHMEMO[getq(General_Hunter)]=getq2(General_Hunter);
setq(General_Hunter, .@id, GHMEMO[.@id]);
mesn;
@@ -120,6 +121,8 @@ function script GHQ_GetRewardsOnCompletion {
inventoryplace StrangeCoin, 1, NPCEyes, 1;
mes l("Current progress: @@/10000 @@", getq2(General_Hunter), getmonsterlink(GHQ_GetMonsterIDByQuestID(getq(General_Hunter))));
mes "";
+ GHQ_GetRewardsOnMilestone();
+
GHMEMO[getq(General_Hunter)]=getq2(General_Hunter);
.@xp=atoi(strmobinfo(3, GHQ_GetMonsterIDByQuestID(getq(General_Hunter))))*3150;
getexp .@xp, 100;
@@ -186,6 +189,75 @@ function script GHQ_GetRewardsOnCompletion {
return;
}
+
+// Handle milestone rewards; it does NOT update stuff
+function script GHQ_GetRewardsOnMilestone {
+
+ // Check if you can store a Strange Coin (you really should)
+ // Another item too, which I'm sure you won't get it anywhere.
+ inventoryplace StrangeCoin, 1, NPCEyes, 1;
+ .@old=GHMEMO[getq(General_Hunter)];
+ .@new=getq2(General_Hunter);
+ .@blv=atoi(strmobinfo(3, GHQ_GetMonsterIDByQuestID(getq(General_Hunter))));
+ .@bhp=atoi(strmobinfo(4, GHQ_GetMonsterIDByQuestID(getq(General_Hunter))));
+ .@xp=0;
+ .@gp=0;
+ .@jp=0;
+
+ // 1st step: 1000 kills
+ if (VarDiffValue(.@old, .@new, 1000)) {
+ mesc l("Goal: @@/@@ reached!", .@new, 1000), 2;
+ .@xp+=.@blv*10;
+ .@gp+=.@bhp;
+ .@jp+=10;
+ } else if (.@new < 1000) {
+ mesc l("@@: @@/@@", l("1st step"), .@new, 1000);
+ }
+
+ // 2nd step: 2500 kills
+ if (VarDiffValue(.@old, .@new, 2500)) {
+ mesc l("Goal: @@/@@ reached!", .@new, 2500), 2;
+ .@xp+=.@blv*25;
+ .@gp+=.@bhp;
+ .@jp+=25;
+ } else if (.@new < 2500) {
+ mesc l("@@: @@/@@", l("2nd step"), .@new, 2500);
+ }
+
+ // 3rd step: 5000 kills
+ if (VarDiffValue(.@old, .@new, 5000)) {
+ mesc l("Goal: @@/@@ reached!", .@new, 5000), 2;
+ .@xp+=.@blv*50;
+ .@gp+=.@bhp;
+ .@jp+=50;
+ } else if (.@new < 5000) {
+ mesc l("@@: @@/@@", l("3rd step"), .@new, 5000);
+ }
+
+ // 4th step: 7500 kills
+ if (VarDiffValue(.@old, .@new, 7500)) {
+ mesc l("Goal: @@/@@ reached!", .@new, 7500), 2;
+ .@xp+=.@blv*75;
+ .@gp+=.@bhp;
+ .@jp+=75;
+ } else if (.@new < 7500) {
+ mesc l("@@: @@/@@", l("4th step"), .@new, 7500);
+ }
+
+ // 5th step: 10000 kills
+ if (VarDiffValue(.@old, .@new, 10000)) {
+ mesc l("Goal: @@/@@ reached!", .@new, 10000), 2;
+ mesc l("You must talk to Aidan to claim rewards!");
+ }
+
+ // Get reward (must have Job Exp)
+ if (.@jp) {
+ getexp .@xp, .@jp;
+ Zeny=Zeny+.@gp;
+ }
+ return;
+}
+
function script mobhunter {
if (getq(General_Hunter) == 0)
return;