diff options
-rw-r--r-- | npc/functions/fishing.txt | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/npc/functions/fishing.txt b/npc/functions/fishing.txt index 9952fa17..85bb85a6 100644 --- a/npc/functions/fishing.txt +++ b/npc/functions/fishing.txt @@ -3,6 +3,7 @@ // gumi // omatt // Travolta +// Jesusalva // Description: // Fishing functions. // Variable @@ -101,11 +102,23 @@ function script fishing { .@pull_rand_max = getvariableofnpc(.pull_rand_max, .@npc$); .@pull_rand_max = (.@pull_rand_max ? .@pull_rand_max : 800); - .@fish_id = getvariableofnpc(.common_fish, .@npc$); - .@fish_id = (.@fish_id ? .@fish_id : CommonCarp); + .@fish_id = CommonCarp; // failsafe - .@rare_id = getvariableofnpc(.rare_fish, .@npc$); - .@rare_fish = (.@rare_fish ? .@rare_fish : GrassCarp); + .@common_fish=getvariableofnpc(.common_fish, .@npc$); + if (getarraysize(.@common_fish) < 1) + { + // default fishes + setarray .@common_fish, + CommonCarp; + } + + .@rare_fish=getvariableofnpc(.rare_fish, .@npc$); + if (getarraysize(.@rare_fish) < 1) + { + // default fishes + setarray .@rare_fish, + GrassCarp; + } .@rare_fish_chance = getvariableofnpc(.rare_fish_chance, .@npc$); .@rare_fish_chance = (.@rare_fish_chance ? .@rare_fish_chance : 25); @@ -120,6 +133,7 @@ function script fishing { UrchinMeat, 0, TortugaTongue, 2, Tentacles, 0; + } if (.@baits < 1) @@ -178,14 +192,13 @@ function script fishing { return -4; } - // RNG to obtain a rare fish - // TODO: chance booster - if (rand(.@rare_fish_chance) == 0) + // RNG to obtain a rare fish or common fish + if (rand(.@rare_fish_chance) <= getvariableofnpc(.bait_ids[@bait_d+1], .@npc$)) { - // TODO: rare fish array - .@fish_id = .@rare_id; + .@fish_id = .@rare_fish[rand(getarraysize(.@rare_fish))]; + } else { + .@fish_id = .@common_fish[rand(getarraysize(.@common_fish))]; } - // TODO: else common fish array // RNG to obtain a fish if (rand(gettimetick(0) - @fishing_tick) <= .@pull_rand_max) @@ -249,6 +262,7 @@ function script fishing { if (getvariableofnpc(.bait_ids[.@i], .@npc$) == .@bait) { .@bait_c = true; + @bait_d = .@i; break; } } |