Jump to content

KodoKTempuR

Members
  • Content Count

    0
  • Joined

  • Last visited


Reputation Activity

  1. Upvote
    KodoKTempuR reacted to Mumbles in Req> NPC Gatcha   
    Here's a version that pulls a "rare" item from the array .rare_id and determines whether or not you have received it, defined by the chance allocated after it (format: <item constant/ID>, <chance>):
     
    prontera,147,174,5 script Odd Fellow::randomstuff 1_M_WIZARD,{ /*----------------------------------------------------- Script -----------------------------------------------------*/ mes .npc_name$; mes "Hello there! For "+ .coin_amount +" "+ getitemname(.coin_id) +", I'll give you a random item!"; next; mes .npc_name$; if (countitem(.coin_id) < .coin_amount) { mes "Come back when you have "+ .coin_amount +" "+ getitemname(.coin_id) +"!"; close; } mes "Would you like to give it a try?"; next; if (select("Sure, why not!:No, thanks") == 2) { mes .npc_name$; mes "Okay, come back if you change your mind!"; close; } // Generate random prize ID do { .@prize_id = rand(.prize_min_id, .prize_max_id); } while (getitemname(.@prize_id) == "null"); // Determine index location of rare item to randomly pick from do { .@rare_index = rand(getarraysize(.rare_id)); } while (.@rare_id % 2); // Determine whether or not to change prize to rare item if (!rand(.rare_id[.@rare_index + 1])) { .@prize_id = .@rare_id; } mes .npc_name$; mes "Here you go! You got "+ .prize_amount +" "+ getitemname(.@prize_id) +"!"; getitem .@prize_id, .prize_amount; close; /*----------------------------------------------------- Configuration -----------------------------------------------------*/ OnInit: .npc_name$ = "[Odd Fellow]"; .coin_id = Poring_Coin; // Coin constant/ID .coin_amount = 1; // Count amount required .prize_min_id = 501; // Prize minimum ID .prize_max_id = 30000; // Prize maximum ID .prize_amount = 1; // Prize amount rewarded // Rare item constants/IDs and chance in x to obtain rare item (default: 5 [20%]) setarray .rare_id[0], Apple, 10, Red_Potion, 20, Jellopy, 30, Fluff, 4, Clover, 5; end;}
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.