From eba87fde79daedc5721daeda218e0a96e3d3307d Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 4 Feb 2022 15:34:04 -0300 Subject: Theoretically, this is Mirio's Quest --- npc/004-2/mirio.txt | 127 ++++++++++++++++++++++++++++++++++++++++++++++++-- npc/004-2/pachua.txt | 9 +++- npc/functions/hub.txt | 2 + 3 files changed, 132 insertions(+), 6 deletions(-) diff --git a/npc/004-2/mirio.txt b/npc/004-2/mirio.txt index 672919f45..ae087b009 100644 --- a/npc/004-2/mirio.txt +++ b/npc/004-2/mirio.txt @@ -4,25 +4,31 @@ // Description: // Part of Speed Run Quest // Structure: -// HalinarzoQuest_Speed( state, time, bonus ) +// HalinarzoQuest_Speed( state, time, record ) -004-2,146,115,0 script Mirio NPC_INDIGENOUS_YOUNG,{ +004-2,146,115,0 script Mirio NPC_INDIGENOUS_YOUNG,1,1,{ function neutral; function naked; function disarmed; function hungry; function speed; + function start; function slow; + function running; + function restricted; + function retry; .@q = getq(HalinarzoQuest_Speed); .@t = getq2(HalinarzoQuest_Speed); - .@b = getq3(HalinarzoQuest_Speed); + .@r = getq3(HalinarzoQuest_Speed); if (BaseLevel < 40) neutral(); if (getequipid(EQI_HEAD_MID) < 1) naked(); if (getequipid(EQI_HEAD_TOP) < 1) naked(); if (getequipid(EQI_HAND_R) < 1) disarmed(); if (getequipid(EQI_HAND_L) < 1) disarmed(); + if (@pachua) running(); if (.@q <= 0) hungry(); if (.@q == 1) speed(); + if (.@q < 10) retry(); neutral(); close; @@ -47,7 +53,13 @@ function disarmed { function slow { mesn; - mesq l("...Try allocating some points in agility before we continue. I think %d should be suffice.", 40); + mesq l("...Try allocating some points in agility before we continue. I think %d should be suffice.", getarg(0, 40)); + close; +} + +function restricted { + mesn; + mesq l("Sorry, but this quest cannot be done by staff."); close; } @@ -96,13 +108,118 @@ function hungry { close; } +///////////////////////////////////////////////////////////////////////////////// function speed { - if (readparam2(bAgi) < 40) speed(); + if (is_staff() && !$@GM_OVERRIDE && !debug) restricted(); + if (readparam2(bAgi) < 40) slow(); mesn; mesq l("Have you thought on my proposal? I'll only charge you %d GP or a %s for each attempt made.", .price, getitemlink(.alt)); + next; + select + l("Not now, thanks."), + rif(Zeny >= .price, l("I'll pay the GP.")), + rif(countitem(.alt), l("I'll give you the item.")); + mes ""; + if (@menu == 1) close; + if (@menu == 2) Zeny -= .price; + if (@menu == 3) delitem .alt, 1; + start(); + return; +} + +function start { + mesn; + mesq l("Great! It is simple, really. Pachua and I are scouting the desert. Run as fast as you can to Pachua, and then run back here. Pachua will send a smoke signal when you talk to him, so I'll know you haven't cheated."); + next; + mesn; + mesq l("Try to make a good time, and... Good luck! On my signal, 3, 2, 1..."); + next; + setq2 HalinarzoQuest_Speed, gettimetick(2) + 1; // Grace time due @refresh + @pachua = 1; + slide 146, 115; + closeclientdialog; + // META: How they know your name? ...Via label, obviously. + npctalk3 l("GO! Run, %s, RUN!!!!", strcharinfo(0)); + atcommand("@refresh"); + close; +} + +function running { + if (@pachua < 2) { + npctalk3 l("What are you waiting for?! Get running, Pachua is waiting!"); + closeclientdialog; + close; + } + // Pachua == 2, completed the run + .@to = getq2(HalinarzoQuest_Speed); + .@q = getq(HalinarzoQuest_Speed); + .@t = gettimetick(2) - .@to; + .@r = getq3(HalinarzoQuest_Speed); + @pachua = 0; + mesn; + mesq l("...And stop! You took %s this time!", FuzzyTime(.@t)); + if (.@t < 15) { + mesc l("That's obviously impossible, so I'll voiding your result!"); + close; + } + if (.@t < .@r) { + mesc l("That's %d seconds better than your previous record!", .@r - .@t); + } + if (!.@r || .@t < .@r) + setq3 HalinarzoQuest_Speed, .@t; + setq2 HalinarzoQuest_Speed, 0; + next; + // Condition + .@g = 320 - (.@q * 20); + if (.@t > .@g) { + mesn; + mesq l("You took more than %s to do this, that is lame! Better luck next time.", FuzzyTime(.@g)); + // Consolation Prize + if (.@t < 450) { + next; + mesn; + mesq l("...Well, I'll refund you 10% because it was not utterly terrible."); + Zeny += .price / 10; + } + // MISSION FAILED + mesc l("RACE FAILED."), 1; + close; + } + // Ooh, you did it! + setq1 HalinarzoQuest_Speed, .@q + 1; + getexp 2500, 0; + mesn; + mesq l("I'm proud of you!"); + if (getq(HalinarzoQuest_Speed) < 10) + mesc l("Feel free to try again whenever."); close; } +function retry { + if (is_staff() && !$@GM_OVERRIDE && !debug) restricted; + .@q = getq(HalinarzoQuest_Speed); + .@p = .price * .@q; + .@s = 40 + (.@q * 5); + if (readparam2(bAgi) < .@s) slow(.@s); + mesn; + mesq l("To retry, I will charge you %d GP or %d %s for each attempt made. You'll have less time to finish as well.", .@p, .@q, getitemlink(.alt)); + next; + select + l("Not now, thanks."), + rif(Zeny >= .@p, l("I'll pay the GP.")), + rif(countitem(.alt) >= .@q, l("I'll give you the item.")); + mes ""; + if (@menu == 1) close; + if (@menu == 2) Zeny -= .@p; + if (@menu == 3) delitem .alt, .@q; + start(); + return; +} + +OnTouch: + if (@pachua) running(); + end; + OnInit: .distance = 4; .sex = G_MALE; diff --git a/npc/004-2/pachua.txt b/npc/004-2/pachua.txt index a9ab4c312..dcf5983a4 100644 --- a/npc/004-2/pachua.txt +++ b/npc/004-2/pachua.txt @@ -4,11 +4,18 @@ // Description: // Part of Speed Run Quest, and an unplanned assassin quest. -004-2,61,118,0 script Pachua NPC_INDIGENOUS_OLD,{ +004-2,61,118,0 script Pachua NPC_INDIGENOUS_OLD,1,1,{ + if (@pachua == 1) goto OnTouch; mesn; mesq l("Howdy! Mirio and I scout this canyon to protect our clan. I am also a retired assassin, maybe someday I can exchange some knowledge with you! Hahaha!"); close; +OnTouch: + if (@pachua != 1) end; + message strcharinfo(0), "Pachua quickly inhales from his pipe and releases a ring of smoke towards the sky!"; + @pachua = 2; + end; + OnInit: .distance = 4; .sex = G_MALE; diff --git a/npc/functions/hub.txt b/npc/functions/hub.txt index d3d72ed12..907cd20a9 100644 --- a/npc/functions/hub.txt +++ b/npc/functions/hub.txt @@ -1324,6 +1324,8 @@ function script HUB_PCBonus { bonus2 bSubRace, RC_Legendary, getskilllv(AL_DP)-10; if (getq(LoFQuest_Barbara) >= 4 || getq(General_Narrator) >= 19) bonus bMaxSP, 40; + if (getq(HalinarzoQuest_Speed) > 1) + bonus bSpeedAddRate, min(getq(HalinarzoQuest_Speed), 10); return; } -- cgit v1.2.3-60-g2f50