// TMW2 scripts. // Authors: // Jesusalva // Description: // Part of Speed Run Quest // Structure: // HalinarzoQuest_Speed( state, time, record ) 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); .@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; function neutral { mesn; mesq l("Howdy! Pachua and I scout this canyon to protect our clan. I acknowledge only those whom are fast like the wind! I would love to challenge you for a race... But not today."); close; } function naked { mesn; mesq l("...I know it is hot in this desert, but if you don't wear some armor and a hat, monsters will get to you. Really harsh, nowadays."); close; } function disarmed { .@pn$ = lg("girl", "dude"); mesn; mesq l("...%s, as far as you should be concerned, this is an hostile land and I'm not your friend. You should use a weapon and a shield if possible. Never trust strangers, specially if they look like an assassin... exactly like me.", .@pn$); close; } function slow { mesn; 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; } function hungry { .@pn$ = lg("gal", "pal"); mesn; mesq l("Howdy, partner! Man, you have no idea how I'm hungry. Been scouting this canyon for weeks, under the scorching sun, and there's only snake meat to eat... I'm get tired of this repulsive stuff."); next; mesn; mesq l("So let's strike a deal, bring me %d %s, %d %s, %d %s, and a %s. I'll reward you, promise.", 10, getitemlink(LettuceLeaf), 5, getitemlink(Cheese), 2, getitemlink(TonoriDelight), getitemlink(HalfCroconut)); next; select l("Sure, I'll be back."), l("I have everything you asked me."); mes ""; if (@menu == 1) closeclientdialog; if (@menu == 2) { if (countitem(LettuceLeaf) < 10 || countitem(Cheese) < 5 || countitem(TonoriDelight) < 2 || countitem(HalfCroconut) < 1) { mesc l("A dagger is stuck to your heart."), 1; mesn; mesq l("Told ya, %s, should know better than to mess with an... assassin!", .@pn$); percentheal -100, 0; close; } inventoryplace CaveSnakeSkin, 1, SnakeSkin, 1; delitem LettuceLeaf, 10; delitem Cheese, 5; delitem TonoriDelight, 2; delitem HalfCroconut, 1; getitem SnakeSkin, 1; getitem CaveSnakeSkin, 1; setq HalinarzoQuest_Speed, 1; mesn; mesq l("Ah, good. You didn't even bother poisoning it? Hahah, that's great, %s! Here is a couple skins I had lying around, may be useful.", .@pn$); next; mesn; mesq l("How about this, I can teach you how to be a tiny bit faster, so you can use heavier armor. I'll even give you a discount. Give it some thought, come back to me after you make up your mind."); } close; } ///////////////////////////////////////////////////////////////////////////////// function 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(.@to)); 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 * 2, getitemlink(.alt)); next; select l("Not now, thanks."), rif(Zeny >= .@p, l("I'll pay the GP.")), rif(countitem(.alt) >= .@q * 2, l("I'll give you the item.")); mes ""; if (@menu == 1) close; if (@menu == 2) Zeny -= .@p; if (@menu == 3) delitem .alt, .@q * 2; start(); return; } OnTouch: if (@pachua) running(); end; OnInit: .distance = 4; .sex = G_MALE; .price = 320; .alt = TonoriDelight; end; }