From 4a5783a26d27f908a4f341ce681cbbc4bbc07447 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 12 Jul 2018 23:16:49 -0300 Subject: Pihro Scripts. --- npc/017-4/pihro.txt | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) (limited to 'npc/017-4/pihro.txt') diff --git a/npc/017-4/pihro.txt b/npc/017-4/pihro.txt index bc6f38999..ab9b29b51 100644 --- a/npc/017-4/pihro.txt +++ b/npc/017-4/pihro.txt @@ -5,6 +5,87 @@ // Description: // Forge bullets 017-4,35,35,0 script Pihro NPC_PLAYER,{ + // cond_check(ItemID, ItemAmount) + // Returns 1 if ID is zero + function cond_check { + if (getarg(0) == 0) + return 1; + else + return (countitem(getarg(0)) > getarg(1)); + } + + // craft_ammo( PrizeItem, Price, Lead Amount, {Elemental Item, Amount, {Elemental Item2, Amount2}} ) + function craft_ammo { + .@prize=getarg(0); + .@price=getarg(1); + .@base1=LeadIngot; + .@amon1=getarg(2); + .@base2=getarg(2,0); + .@amon2=getarg(3,0); + .@base3=getarg(4,0); + .@amon3=getarg(5,0); + + mesn; + mesq l("Do you want to craft @@? For that I will need:", getitemlink(.@prize)); + mesc l("@@/@@ @@", countitem(.@base1), .@amon1, getitemlink(.@base1)); + if (.@amon2 > 0) + mesc l("@@/@@ @@", countitem(.@base2), .@amon2, getitemlink(.@base2)); + if (.@amon3 > 0) + mesc l("@@/@@ @@", countitem(.@base3), .@amon3, getitemlink(.@base3)); + mesc l("@@/@@ GP", format_number(Zeny), .@price); + next; + + select + l("Yes"), + l("No"); + + if (@menu == 2) + return; + + if (countitem(.@base1) >= .@amon1 && + cond_check(.@base2, .@amon2) && + cond_check(.@base3, .@amon3) && + Zeny >= .@price) { + inventoryplace .@prize, 220; + delitem .@base1, .@amon1; + delitem .@base2, .@amon2; + delitem .@base3, .@amon3; + Zeny = Zeny - .@price; + getitem .@prize, rand(100,220); + + mes ""; + mesn; + mesq l("Many thanks! Come back soon."); + } else { + speech S_FIRST_BLANK_LINE,// | S_LAST_NEXT, + l("You don't have enough material, sorry."); + } + return; + } + mesn; + mesq l("Hello there! I make bullets for the weapons my friend Pyndragon makes."); + next; + +L_Craft: + mesn; + mesq l("Some bullets have Elemental Properties, by the way. Now, what will it be?"); + next; + select + l("Nothing, sorry."), + l("Normal Bullet"), + l("Sacred Bullet"); + + switch (@menu) { + case 2: + // craft_ammo( PrizeItem, Price, Lead Amount, {Elemental Item, Amount, {Elemental Item2, Amount2}} ) + craft_ammo(Bullet, 200, 1); + goto L_Craft; + case 3: + craft_ammo(SacredBullet, 200, 1, WhiteFur, 5); + goto L_Craft; + } + close; + OnInit: .@npcId = getnpcid(0, .name$); -- cgit v1.2.3-60-g2f50