• 0
uDe

Custom Box Script Rate

Question

Hello guys..

 

Can you guys help me with this script..

function	script	CustomBox	{
    setarray .BoxItems[0],
	31799,
	31823,
	
	set .Random, rand( getarraysize( .BoxItems ) );
	getitem .BoxItems[ .Random ], 1;
	announce "Congratulations ["+strcharinfo(0)+"] for getting ["+getitemname(.BoxItems[ .Random ])+"] from Gift Box!!",0;
end;
}

I need to add rate for getting those item..

 

Example :

 

Item 31799 had 20% chance to get it; and Item 31823 had 70% chance to get it.

 

EDIT : I'm using eAthena 3ceAM.

Edited by uDe

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

Try use this:

set .Random, rand(1,100);
if( .Random <= 20 ) { getitem 31799, 1; announce "Congratulations ["+strcharinfo(0)+"] for getting ["+getitemname(31799)+"] from Gift Box!!",0; end; }
if( .Random > 20 ) { getitem 31823, 1; announce "Congratulations ["+strcharinfo(0)+"] for getting ["+getitemname(31823)+"] from Gift Box!!",0; end; }
Edited by Phenomena

Share this post


Link to post
Share on other sites

http://rathena.org/board/topic/78263-scripting-faqtipstricks/

this topic show a way for you to calculate rate..

 

I'm using eAthena.. Can I refer that tutorial also?

 

Try use this:

set .Random, rand(1,100);
if( .Random <= 20 ) { getitem 31799, 1; announce "Congratulations ["+strcharinfo(0)+"] for getting ["+getitemname(31799)+"] from Gift Box!!",0; end; }
if( .Random > 20 ) { getitem 31823, 1; announce "Congratulations ["+strcharinfo(0)+"] for getting ["+getitemname(31799)+"] from Gift Box!!",0; end; }

 

Thank you. I will try this also..

  • Upvote 1
  • Love 1
  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now