From 40825ec61cc779c6b974c0cd424119a969e82733 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 3 Jun 2024 23:57:11 -0300 Subject: By popular demand, make Nylo's crops quest repeatable. However, becomes unprofitable and boring after Lv 15 or so. --- npc/005-1-1/main.txt | 62 ++++++++++++++++++++++++++++++---------------------- npc/005-5/nylo.txt | 50 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 26 deletions(-) diff --git a/npc/005-1-1/main.txt b/npc/005-1-1/main.txt index 8b3ed4a74..777739726 100644 --- a/npc/005-1-1/main.txt +++ b/npc/005-1-1/main.txt @@ -38,6 +38,7 @@ end; OnStart: + .@q=getq(CandorQuest_Marggo); mesn; mesq l("The maggots will spawn in @@ at random.", b(l("5 seconds"))); mes l("Read the instructions carefully."); @@ -47,39 +48,42 @@ OnStart: mes l("Four minutes after the warp, or when the last maggot die, it'll be over."); next; mesn l("Victory Conditions"); - mes l("If you save 80% from the crops or more, you'll get @@ GP.", 300); - mes l("If you save 90% from the crops or more, you'll also get a @@.", getitemlink(RoundLeatherShield)); - mes l("== If you decide to complete the quest you cannot repeat it."); + if (!.@q) { + mes l("If you save 80% from the crops or more, you'll get @@ GP.", 300); + mes l("If you save 90% from the crops or more, you'll also get a @@.", getitemlink(RoundLeatherShield)); + mes l("== If you decide to complete the quest you cannot repeat it."); + } else { + mes l("Your money reward depends on how much of the crops you save."); + } next; closeclientdialog; dispbottom "Nylo : " + l("Good luck!"); - addtimer(5300, "Nylo#Marggo::OnBegin"); - addtimer(5000, "Nylo#Marggo::OnTimer5000"); - addtimer(4000, "Nylo#Marggo::OnTimer4000"); - addtimer(3000, "Nylo#Marggo::OnTimer3000"); - addtimer(2000, "Nylo#Marggo::OnTimer2000"); addtimer(1000, "Nylo#Marggo::OnTimer1000"); close; OnTimer1000: dispbottom "4!"; + addtimer(1000, "Nylo#Marggo::OnTimer2000"); end; OnTimer2000: dispbottom "3!"; + addtimer(1000, "Nylo#Marggo::OnTimer3000"); end; OnTimer3000: dispbottom "2!"; + addtimer(1000, "Nylo#Marggo::OnTimer4000"); end; OnTimer4000: dispbottom "1!"; + addtimer(1000, "Nylo#Marggo::OnTimer5000"); end; OnTimer5000: dispbottom l("Start!"); - //stopnpctimer; + addtimer(300, "Nylo#Marggo::OnBegin"); end; OnBegin: @@ -195,29 +199,35 @@ OnFinish: MARGGO_ID=0; .@trueratio=100*getarraysize(@DESTROYED$)/169; .@ratio=100-.@trueratio; - debugmes("Player lost %d crops", getarraysize(@DESTROYED$)); + if ($@GM_OVERRIDE) + debugmes("Player lost %d crops", getarraysize(@DESTROYED$)); deletearray(@DESTROYED$); mesn l("Nylo"); mes l("You managed to save @@ % of my crops!", .@ratio); next; - if (.@ratio >= 80) { - inventoryplace RoundLeatherShield, 1; - mesc l("Complete Quest?"); - if (.@ratio < 90) - mesc l("You won't be able to aim for a better record!"), 1; - menuint - l("Yes, I'm done with it."), ASK_YES, - l("No, I want to aim for a higher score."), ASK_NO; - mes ""; - if (@menuret == ASK_YES) { - setq CandorQuest_Marggo, 1; - Zeny=Zeny+300; - getexp .@ratio*8/10, (.@ratio/3); - if (.@ratio >= 90) - getitem RoundLeatherShield, 1; + if (!getq(CandorQuest_Marggo)) { + if (.@ratio >= 80) { + inventoryplace RoundLeatherShield, 1; + mesc l("Complete Quest?"); + if (.@ratio < 90) + mesc l("You won't be able to aim for a better record!"), 1; + menuint + l("Yes, I'm done with it."), ASK_YES, + l("No, I want to aim for a higher score."), ASK_NO; + mes ""; + if (@menuret == ASK_YES) { + setq CandorQuest_Marggo, 1, gettimetick(2) + 300; // 5 minutes now + Zeny=Zeny+300; + getexp .@ratio*8/10, (.@ratio/3); + if (.@ratio >= 90) + getitem RoundLeatherShield, 1; + } + mes ""; } - mes ""; + } else { + setq2 CandorQuest_Marggo, gettimetick(2) + 900; // 15 minutes cooldown + Zeny += .@ratio; } mesn l("Nylo"); mes l("Thanks for the help!"); diff --git a/npc/005-5/nylo.txt b/npc/005-5/nylo.txt index 18c3d3148..338614040 100644 --- a/npc/005-5/nylo.txt +++ b/npc/005-5/nylo.txt @@ -13,12 +13,14 @@ l("Visiting the bank too right? We're only a small village but Cynric is the best bank guy I know."); .@q=getq(CandorQuest_Marggo); + .@q2=getq2(CandorQuest_Marggo); do { select l("Yeah, you're right."), l("You store a large collection of goods. Could you perhaps sell me some?"), rif(!.@q,l("What do you for a living?")), + rif(.@q && .@q2 < gettimetick(2),l("Can I help you again?")), l("What is banking?"); switch (@menu) { @@ -57,6 +59,9 @@ goto L_Main; break; case 4: + goto L_Repeat; + break; + case 5: nylo_explain(); .@mask=0; do { @@ -143,6 +148,51 @@ L_Main: closeclientdialog; close; +L_Repeat: + mesn; + mesq l("Why, of course! But I can't reward you so well this time."); + next; + mesn; + mes l("Eight Maggots will rise from the ground and will start destroying the crops."); + mes l("You must kill them before the crops are gone. I'll reward you, but it won't be much."); + next; + mesn; + mesq l("Interested?"); + if (askyesno() == ASK_NO) { + mes ""; + mesn; + mesq l("Heh. Fair enough."); + close; + } + + .@ID=getcharid(0); + .@MAP$="MRGO@"+str(.@ID); + + // Create the Marggo + .@INSTID = instance_create("MRGX@"+(.@ID), 0, IOT_NONE); + if (.@INSTID < 0) + .@instanceMapName$ = ""; + else + .@instanceMapName$ = instance_attachmap("005-1-1", .@INSTID, 0, .@MAP$); + // Instance already exists + if (.@instanceMapName$ == "") { + mesn; + mesq l("Wait. I remember you. You ruined my crops a few seconds ago!!"); + next; + mesn; + mesq l("Shooo, shooo! Give my crops some time to recover, your noob."); + close; + } + // It was just created, so begin Marggo Quest + instance_set_timeout(300, 300, .@INSTID); + instance_init(.@INSTID); + warp .@MAP$, 29, 20; + + // We'll need instance ID later and @vars are unreliable + MARGGO_ID=.@INSTID; + doevent("Nylo#Marggo::OnStart"); + closeclientdialog; + close; // Functions function nylo_thanks { -- cgit v1.2.3-60-g2f50