From 9cc22523194b78f0f1edc1f56c5a4f12cba1357e Mon Sep 17 00:00:00 2001 From: Crazyfefe Date: Fri, 9 Mar 2018 14:58:23 -0300 Subject: Ishi --- npc/003-1/ishi.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'npc/003-1/ishi.txt') diff --git a/npc/003-1/ishi.txt b/npc/003-1/ishi.txt index 7d63c04e7..dd2127010 100644 --- a/npc/003-1/ishi.txt +++ b/npc/003-1/ishi.txt @@ -4,8 +4,7 @@ // Jesusalva // // Do not add void items to array. -// note : the rare item system suck. Must be ordered from less rare to most rare. -// TODO FIXME: Not reading properly from @Rares$ array, no idea how to fix that! +// note : the rare item system suck. 003-1,97,97,0 script Ishi NPC_PLAYER,{ @@ -29,7 +28,7 @@ "Coal","SnakeSkin","CottonCloth","GrassSeeds","HardSpike","CobaltHerb","GambogeHerb", "MauveHerb","IronOre","MaggotSlime","RawLog","ScorpionStinger","SilkCocoon","TreasureKey", "FluffyFur","EmptyBottle","RustyKnife","TolchiArrow","Arrow","IronArrow","BlueCottonDye"; - setarray @Rares$, "BronzeGift", 120, "IronIngot", 70, "BrimedHat", 40; + setarray @Rares$, "BrimedHat", 5, "IronIngot", 10, "BronzeGift", 10; mesn l("Ishi, the Rewards Master"); mesq l("Welcome! I see you have @@ Monster Points. Would you like to exchange some of those for items?", Mobpt); @@ -122,14 +121,18 @@ L_Items: goto L_NoPlace; debugmes "Testing rares"; + @lucky = rand(10000) + 1; for (.@b = 0; .@b < getarraysize(@Rares$); .@b=.@b+2) { - .@lucky = rand(10000); // 0 - 99999 debugmes "Checking "+@Rares$[.@b]+" - b is now "+.@b; - debugmes l("Check @@ <= @@", .@lucky, @Rares$[.@b+1]); - if (.@lucky <= atoi(@Rares$[.@b+1])) { + debugmes l("Check @@ <= @@", @lucky, @Rares$[.@b+1]); + if (.@b == 0) + @control = 0; + if(@lucky >= (@control + 1) && @lucky <= @control + atoi(@Rares$[.@b+1])) + { .@lucked=1; .@reward$ = @Rares$[.@b]; } + @control = @control + atoi(@Rares$[.@b+1]); } debugmes "Setting reward"; // could be if (!.@lucked) but for sanity... -- cgit v1.2.3-60-g2f50