Jump to content
  • 0
Jb Roxas

how to put more id numbers and random chances of winning

Question

for example:

headgear's id#

5738 chance 5%

5443 chance 5%

2294 chance 4%

5509 chance 3%

5150 chance 2%

5426 chance 1%

Chances of Losing is 20%

item to use to get those prize is id# 20078 Quantity 1

Npc special effect

IF WON = /grat

IF LOSE = npc effect like the refiner who failed to refine the items :(

splendide,210,199,5 script Sample 757,{
set .OriValkID,2357;
set .RareValkID,2305;
set .Rate,10;

mes "Do you want to refine your "+getitemname( .OriValkID )+" into "+getitemname( .RareValkID )+" ?";
next;
if( select("Yes:No") == 2 ) close;
if( !countitem( .OriValkID ) ){
mes "You didnt have "+getitemname( .OriValkID )+" now.";
}else{
delitem .OriValkID,1;
if( rand(100) < .Rate ){
getitem .RareValkID,1;
mes "Done, congratz.";
}else
mes "But Failed.";
}
close;
}

Edited by Jb Roxas
Link to comment
Share on other sites

14 answers to this question

Recommended Posts

try this

prontera,155,181,5 script Sample 757,{
set .RequiredID,20078;
if( !countitem( .RequiredID ) ){
mes "You need 1 "+getitemname( .RequiredID )+" to exchange.";
}else if( rand(100) < 20 ){
mes "You have failed in this trade, "+getitemname( .RequiredID )+" will be removed.";
delitem .RequiredID,1;
specialeffect 155;
}else{
mes "Congratz.....";
specialeffect 154;
set .Random,rand(100);
if( .Random <= 5 ) getitem 5738,1;
else if( .Random > 5 && .Random <= 10 ) getitem 5443,1;
else if( .Random > 10 && .Random <= 14 ) getitem 2294,1;
else if( .Random > 14 && .Random <= 17 ) getitem 5509,1;
else if( .Random > 17 && .Random <= 19 ) getitem 5150,1;
else if( .Random > 19 && .Random <= 20 ) getitem 5426,1;
else
 mes "You gained nothing.";
}
close;
}

Link to comment
Share on other sites

http://mysticpaste.c...ate/nvt5Eq5cJ5/

Tested works really well, actually.

splendide,210,199,5 script Sample 757,{
setarray [email protected][0],20,5738,20,5443,25,2294,33,5509,50,5150,100,5426; set [email protected],20078;
mes "Do you want to use your "+getitemname( [email protected] )+" to try and get something awesome?"; next;
if( select("Yes:No")-1 ) close;
if( !countitem( [email protected] ) ){
 mes "You don't have any "+getitemname( [email protected] )+".";
} else {
 delitem [email protected],1;
 for(set [email protected],0; [email protected] < getarraysize([email protected]); set [email protected],[email protected]+2){
  if(rand([email protected][[email protected]])==1){ getitem ([email protected][[email protected]+1]),1; emotion e_grat; mes "Done, congratz."; close; }
 }
 specialeffect2 611;
 mes "It failed, sorry.";
 }
close;
}
}

To add more items. Simply put there probability out of 100 then there itemid in the [email protected] array.

Example:

If I wanted to add angra(1599) at 20%

100/20=5

setarray [email protected][0],20,5738,20,5443,25,2294,33,5509,50,5150,100,5426,5,1599;

Edit: Sorry Emistry I didn't realize you had replied.

Edit-Edit:

Because 5%+5%+4%+3%+2%+1%+20%=40%?

Doesn't add up to 100% (LOL) there is a 60% gap so the losing percent is actually something like 50% because of the gained percentage of having multiple chances to win.

Edited by Skorm
Link to comment
Share on other sites

http://mysticpaste.c...ate/nvt5Eq5cJ5/

Tested works really well, actually.

splendide,210,199,5 script Sample 757,{
setarray [email protected][0],20,5738,20,5443,25,2294,33,5509,50,5150,100,5426; set [email protected],20078;
mes "Do you want to use your "+getitemname( [email protected] )+" to try and get something awesome?"; next;
if( select("Yes:No")-1 ) close;
if( !countitem( [email protected] ) ){
 mes "You don't have any "+getitemname( [email protected] )+".";
} else {
 delitem [email protected],1;
 for(set [email protected],0; [email protected] < getarraysize([email protected]); set [email protected],[email protected]+2){
  if(rand([email protected][[email protected]])==1){ getitem ([email protected][[email protected]+1]),1; emotion e_grat; mes "Done, congratz."; close; }
 }
 specialeffect2 611;
 mes "It failed, sorry.";
 }
close;
}
}

Edit: Sorry Emistry I didn't realize you had replied.

Edit-Edit:

Because 5%+5%+4%+3%+2%+1%+20%=40%?

Doesn't add up to 100% (LOL) there is a 60% gap so the losing percent is actually something like 50% because of the gained percentage of having multiple chances to win.

Yeahy, Tested it works i have (Few Edited)

So can i ask for help? how can i make announce that 'ONLY SELECTED ITEM'

I only want I.D 5738 to be announce?

Thank you for this.

Melody :3

Link to comment
Share on other sites

http://mysticpaste.com/private/sY9NTAipgr/

prontera.gat,155,185,5 script Event Random 757,{

setarray [email protected][0],20,5738,20,5443,25,2294,33,5509,50,5150,100,5426;
setarray [email protected]_announce[0],5738,5150;
set [email protected]_required,1201;

mes "Do you want to use your "+getitemname( [email protected]_required )+" to try and get something awesome?"; next;
if( select("- Yes:- No")-1 ) close;
if( !countitem( [email protected]_required ) ){
mes "You don't have any "+getitemname( [email protected]_required )+".";
mes "Please come back soon, if you have already them";
} else {
delitem [email protected]_required,1;
for(set [email protected],0; [email protected] < getarraysize([email protected]); set [email protected],[email protected]+2){
if(rand([email protected][[email protected]])==1){
getitem ([email protected][[email protected]+1]),1;
mes "Congratulations!";
for(set [email protected],0; [email protected] < getarraysize([email protected]); set [email protected],[email protected]+1){
if([email protected][[email protected]+1][email protected]_announce[[email protected]]) { announce "[Event Random]: Player " + strcharinfo(0) +", has obtain "+ (([email protected][[email protected]]>=50)?"Low":"High") +" "+getitemname( [email protected][[email protected]+1] )+" with ["+ (100/[email protected][[email protected]]) +"%] Chance.",bc_all,0xBA55D3; }
}
specialeffect 154;
close;
}
}
specialeffect 155;
mes "lt's failed, sorry.";
}
close;
}

Edited by Skorm
Link to comment
Share on other sites

else if( .Random > 5 && .Random <= 10 ) getitem 5443,1; <<- it means 5% over 100% ??

else if( .Random > 10 && .Random <= 14 ) getitem 2294,1;

else if( .Random > 14 && .Random <= 17 ) getitem 5509,1;

else if( .Random > 17 && .Random <= 19 ) getitem 5150,1;

else if( .Random > 19 && .Random <= 20 ) getitem 5426,1; <<-- it means 1% over 100% ??

Link to comment
Share on other sites

else if( .Random > 5 && .Random <= 10 ) getitem 5443,1; <<- it means 5% over 100% ??

else if( .Random > 10 && .Random <= 14 ) getitem 2294,1;

else if( .Random > 14 && .Random <= 17 ) getitem 5509,1;

else if( .Random > 17 && .Random <= 19 ) getitem 5150,1;

else if( .Random > 19 && .Random <= 20 ) getitem 5426,1; <<-- it means 1% over 100% ??

depend on this.

set .Random,rand(100);

Link to comment
Share on other sites

/no1

set .Random,rand(BaseRate);

if( .Random > .Num1 && .Random <= Num2 ) getitem ......

to calculate your rate...

( Num2 - Num1 ) / BaseRate

to broadcast..

announce "You get item NAME",0;

Link to comment
Share on other sites

elseif(.Random>5&&.Random<=10) getitem 5443,1;

announce "You get item NAME",5443;

elseif(.Random>10&&.Random<=14) getitem 2294,1;

announce "You get item NAME",2294;

elseif(.Random>14&&.Random<=17) getitem 5509,1;

announce "You get item NAME",5509;

elseif(.Random>17&&.Random<=19) getitem 5150,1;

announce "You get item NAME",5150;

elseif(.Random>19&&.Random<=20) getitem 5426,1;

announce "You get item NAME",5426;

is it right?

Edited by Jb Roxas
Link to comment
Share on other sites

Sir can u type how to put the broadcast on this script if i win this item

elseif(.Random>5&&.Random<=10) getitem 5443,1; <---- that is Cherub Hat

Example of broadcast, YOU WON CHERUB HAT

Edited by Jb Roxas
Link to comment
Share on other sites

@jb Roxas I've already made a script that does all of that, are you blind?

prontera.gat,155,185,5 script Event Random 757,{

setarray [email protected][0],20,5738,20,5443,25,2294,33,5509,50,5150,100,5426;
setarray [email protected]_announce[0],5738,5150;
set [email protected]_required,1201;

mes "Do you want to use your "+getitemname( [email protected]_required )+" to try and get something awesome?"; next;
if( select("- Yes:- No")-1 ) close;
if( !countitem( [email protected]_required ) ){
mes "You don't have any "+getitemname( [email protected]_required )+".";
mes "Please come back soon, if you have already them";
} else {
delitem [email protected]_required,1;
for(set [email protected],0; [email protected] < getarraysize([email protected]); set [email protected],[email protected]+2){
if(rand([email protected][[email protected]])==1){
getitem ([email protected][[email protected]+1]),1;
mes "Congratulations!";
for(set [email protected],0; [email protected] < getarraysize([email protected]); set [email protected],[email protected]+1){
if([email protected][[email protected]+1][email protected]_announce[[email protected]]) { announce "[Event Random]: Player " + strcharinfo(0) +", has obtain "+ (([email protected][[email protected]]>=50)?"Low":"High") +" "+getitemname( [email protected][[email protected]+1] )+" with ["+ (100/[email protected][[email protected]]) +"%] Chance.",bc_all,0xBA55D3; }
}
specialeffect 154;
close;
}
}
specialeffect 155;
mes "lt's failed, sorry.";
}
close;
}

Will broadcast any item that is in the array.

setarray .@items_announce[0],5738,5150;

Edited by Skorm
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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