Reborn Posted April 19, 2019 Posted April 19, 2019 Hello everyone. Can anyone help me make this script? What I need to do is this. The player will require item ID 501 for them to play this npc. setarray .itemReward[0], ItemID, ItemChance, ... setarray .itemReward[0],501,10,502,20,503,30,504,40,505,50; The player will get one item reward depending on the chances that they will get. Rare item will have small chance only. Quote
0 HD Scripts Posted April 19, 2019 Posted April 19, 2019 try this https://rathena.org/board/topic/117555-item-x-or-item-y-receive-item-z/ Quote
0 Sakurada Posted April 19, 2019 Posted April 19, 2019 (edited) prontera,156,187,2 script Valkyrie#1 4_F_LGTGIRL,{ if (countitem(501) >= 1) { delitem 501,1; @chancezz = rand(1, 100); mes "ok lets see"; if (@chancezz <= 50) { mes "You got the common prize!"; getitem 501, 2; close; end; } if (@chancezz >= 80) { mes "You got the rare prize!"; getitem 501, 12; close; end; } if (@chancezz >= 51) { mes "You got the uncommon prize!"; getitem 501, 5; close; end; } } mes "Sorry no potions, no items"; close; end; } Well i tried my best It works at least https://github.com/rathena/rathena/blob/master/npc/other/comodo_gambling.txt Edited April 19, 2019 by Sakurada Quote
0 Royr Posted April 19, 2019 Posted April 19, 2019 5 hours ago, neXus said: Hello everyone. Can anyone help me make this script? What I need to do is this. The player will require item ID 501 for them to play this npc. setarray .itemReward[0], ItemID, ItemChance, ... setarray .itemReward[0],501,10,502,20,503,30,504,40,505,50; The player will get one item reward depending on the chances that they will get. Rare item will have small chance only. Raw Script:Lucky Gambler prontera.gat, 155, 185, 5 script Lucky Gambler 757,{ /* Note: Calculations: 100/50 = 2 so 2 is 50% */ // Required Item .@item_ID = 501; // .@item_List[0],<rates>,<item_id>,......... setarray .@item_List[0], 2,5738, 20,5443, 25,2294, 30,5509, 50,5150 ; setarray .@item_Ann[0], 5738, 5443, 2294, 5509, 5150 ; mes "Do you want to use your "+getitemname( .@item_ID )+" to try and get something valuable items."; next; if( select("- Yes:- No")-1 ) close; if( !countitem( .@item_ID ) ) { mes "You don't have any "+getitemname( .@item_ID )+"."; mes "Please come back to me if you have it already."; } else { delitem .@item_ID,1; for( .@j = 0; .@j < getarraysize(.@item_List); .@j+= 2 ) { if( rand(.@item_List[.@j]) == 1 ) { getitem( .@item_List[.@j+1] ),1; mes "Congratulations!"; for( .@i = 0; .@i < getarraysize(.@item_List); .@i++ ) { if( .@item_List[.@j+1] == .@item_Ann[.@i] ) { announce "[ Lucky Gambler ]: Player " + strcharinfo(0) +" has obtained "+ ((.@item_List[.@j]>=50)?"'Low'":"'High'") +" "+getitemname( .@item_List[.@j+1] )+" with ["+ (100/.@item_List[.@j]) +"%] Chance.",bc_all,0xBA55D3; } } specialeffect 154; close; } } specialeffect 155; mes "It's failed, sorry."; } close; } Quote
0 Skorm Posted April 20, 2019 Posted April 20, 2019 14 hours ago, neXus said: Hello everyone. Can anyone help me make this script? What I need to do is this. The player will require item ID 501 for them to play this npc. setarray .itemReward[0], ItemID, ItemChance, ... setarray .itemReward[0],501,10,502,20,503,30,504,40,505,50; The player will get one item reward depending on the chances that they will get. Rare item will have small chance only. @AnnieRuru Made a fantastic post with three excellent ways on how to do this already... Quote
Question
Reborn
Hello everyone. Can anyone help me make this script?
What I need to do is this.
The player will require item ID 501 for them to play this npc.
setarray .itemReward[0], ItemID, ItemChance, ...
setarray .itemReward[0],501,10,502,20,503,30,504,40,505,50;
The player will get one item reward depending on the chances that they will get. Rare item will have small chance only.
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.