From 8bcd2b6d501e620a4992ee4efc2ce8826b8a5d5e Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 18 Sep 2019 21:40:22 -0300 Subject: Maxime: Rewrite the code to use a function --- npc/003-0-1/maxime.txt | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'npc') diff --git a/npc/003-0-1/maxime.txt b/npc/003-0-1/maxime.txt index d8e918b1d..10a9cd46c 100644 --- a/npc/003-0-1/maxime.txt +++ b/npc/003-0-1/maxime.txt @@ -6,6 +6,7 @@ // Bakes Tonori Delight 003-0-1,77,40,0 script Maxime NPC_PLAYER,{ + function MaximeOven; mesn; mesq l("Hello. I know the secrets of the legendary @@.", getitemlink(TonoriDelight)); next; @@ -28,6 +29,27 @@ if (@menu == 2) goto L_Close; + if (!MaximeOven()) + goto L_Missing; + + mesn; + mesq l("Here you go, fresh from the oven!"); + next; + +L_Close: + closedialog; + goodbye; + close; + +L_Missing: + mesn; + mesq l("You don't have everything I asked you for."); + next; + mesn; + mesq l("I always wonder if I should raise my price to teach bad kids to don't lie."); + close; + +function MaximeOven { if ( countitem(MaggotSlime) < 12 || countitem(Plushroom) < 8 || @@ -35,7 +57,7 @@ countitem(ScorpionStinger) < 3 || countitem(CactusDrink) < 2 || countitem(RoastedMaggot) < 1 || - Zeny < 120) goto L_Missing; + Zeny < 120) return false; // 4~7 normaly, 5~10 during Summer // Xanthem Patch: +20% craft and -20% effect @@ -54,23 +76,8 @@ } Zeny=Zeny-120; getexp rand2(30, 60), 0; - - mesn; - mesq l("Here you go, fresh from the oven!"); - next; - -L_Close: - closedialog; - goodbye; - close; - -L_Missing: - mesn; - mesq l("You don't have everything I asked you for."); - next; - mesn; - mesq l("I always wonder if I should raise my price to teach bad kids to don't lie."); - close; + return true; +} OnInit: .@npcId = getnpcid(.name$); -- cgit v1.2.3-60-g2f50