Jump to content
  • 0

Assistance on this lotti like script


Question

Posted

Hi,

This script works perfectly well, kudos to the owner of this script, I forgot who I apologize but just wondering if we can make the Default prize  on random as well?
For example:
Set default prize on random of red, yellow, white potion. instead of 1 default prize of red potion only.

Gotta make     setarray .@Default[0],19578,1;  random, not just the 19578.

function	script	Get_MysteryBox	{
	set .@Total,7;
	//<%>,<ItemID>,<Amount>
	setarray .@P1[0],50,19543,1;
	setarray .@P2[0],90,19525,1;
	setarray .@P3[0],90,31171,1;
	setarray .@P4[0],90,19620,1;
	setarray .@P5[0],90,19527,1;
	setarray .@P6[0],90,19733,1;
	setarray .@P7[0],90,20057,1;
	setarray .@Default[0],19578,1;
	set .@i, rand(1,.@Total);
	if (rand(1,100) > getd(".@P"+.@i+"[0]"))
	{
		for(set .@j,0; .@j<getarraysize(.@Default); set .@j,.@j+2)
		{
			getitem .@Default[.@j], .@Default[.@j+1];
			if(!.@k[0])
				setarray .@k[0], .@Default[.@j], .@Default[.@j+1];
		}
	}
	else{
		for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2)
		{
			getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
			if (!.@k[0])
			{
				set .@gz,.@i;
				setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
				break;
			}
		}
	}
	if(1<=.@gz&&.@gz<=1)
		announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" from the Mystery Costume Box!",0;
	specialeffect2 248;
	close;
}

 

1 answer to this question

Recommended Posts

  • 0
Posted
	setarray .@P1[0],50,501,1;
	setarray .@P2[0],90,501,1;
	setarray .@P3[0],90,501,1;
	setarray .@P4[0],90,501,1;
	setarray .@P5[0],90,501,1;
	setarray .@P6[0],90,501,1;
	setarray .@P7[0],90,501,1;
	setarray .@Default[0],502,1,503,1,504,1,505,1;

when it hit .@Default, this line will give me a whole set of item ID 502,503,504,505 ...  4 items

if you want random then go F_Rand as usual

setarray .@Default[0],F_Rand(502,503,504,505),1;

 

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...