Jump to content
  • 0

how to put more id numbers and random chances of winning


Question

Posted (edited)

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

14 answers to this question

Recommended Posts

Posted

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;
}

Posted (edited)

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

Tested works really well, actually.

splendide,210,199,5 script Sample 757,{
setarray .@items[0],20,5738,20,5443,25,2294,33,5509,50,5150,100,5426; set .@id,20078;
mes "Do you want to use your "+getitemname( .@id )+" to try and get something awesome?"; next;
if( select("Yes:No")-1 ) close;
if( !countitem( .@id ) ){
 mes "You don't have any "+getitemname( .@id )+".";
} else {
 delitem .@id,1;
 for(set .@a,0; .@a < getarraysize(.@items); set .@a,.@a+2){
  if(rand(.@items[.@a])==1){ getitem (.@items[.@a+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 .@items array.

Example:

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

100/20=5

setarray .@items[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
Posted

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

Tested works really well, actually.

splendide,210,199,5 script Sample 757,{
setarray .@items[0],20,5738,20,5443,25,2294,33,5509,50,5150,100,5426; set .@id,20078;
mes "Do you want to use your "+getitemname( .@id )+" to try and get something awesome?"; next;
if( select("Yes:No")-1 ) close;
if( !countitem( .@id ) ){
 mes "You don't have any "+getitemname( .@id )+".";
} else {
 delitem .@id,1;
 for(set .@a,0; .@a < getarraysize(.@items); set .@a,.@a+2){
  if(rand(.@items[.@a])==1){ getitem (.@items[.@a+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

Posted (edited)

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

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

setarray .@items[0],20,5738,20,5443,25,2294,33,5509,50,5150,100,5426;
setarray .@items_announce[0],5738,5150;
set .@item_required,1201;

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

Edited by Skorm
Posted

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% ??

Posted

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);

Posted

/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;

Posted (edited)

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
Posted

when your script / script going to read more than 1 line..

you have to use curley to wrap your script..

if(  condition ){
   < script here.......>
}else{
 < balblabla script...>
}

Posted (edited)

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
Posted (edited)

@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 .@items[0],20,5738,20,5443,25,2294,33,5509,50,5150,100,5426;
setarray .@items_announce[0],5738,5150;
set .@item_required,1201;

mes "Do you want to use your "+getitemname( .@item_required )+" to try and get something awesome?"; next;
if( select("- Yes:- No")-1 ) close;
if( !countitem( .@item_required ) ){
mes "You don't have any "+getitemname( .@item_required )+".";
mes "Please come back soon, if you have already them";
} else {
delitem .@item_required,1;
for(set .@a,0; .@a < getarraysize(.@items); set .@a,.@a+2){
if(rand(.@items[.@a])==1){
getitem (.@items[.@a+1]),1;
mes "Congratulations!";
for(set .@b,0; .@b < getarraysize(.@items); set .@b,.@b+1){
if(.@items[.@a+1]==.@items_announce[.@b]) { announce "[Event Random]: Player " + strcharinfo(0) +", has obtain "+ ((.@items[.@a]>=50)?"Low":"High") +" "+getitemname( .@items[.@a+1] )+" with ["+ (100/.@items[.@a]) +"%] 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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...