Jump to content
  • 0

R> Add custom points in this Random Box Function


Question

Posted (edited)
function	script	F_RBox	{

	// change Item ID here
	setarray @i1[0],607,608; // Common Items 
	setarray @i2[0],512,513; // Rare Items
	setarray @i3[0],514,515; // Super Rare Items

	set @i1rand,rand( getarraysize(@i1) ); // Randomize Common Items; just change max amount if you add items
	set @i2rand,rand( getarraysize(@i2) ); // Randomize Rare Items; just change max amount if you add items
	set @i3rand,rand( getarraysize(@i3) ); //Randomize Super Rare Items; just change max amount if you add items

	.chance = rand(100);

		// Super Rare Item 1%
		if (.chance == 1) {
			getitem @i3[@i3rand],1;
			announce "["+strcharinfo(0)+"] won a ["+getitemname(@i3[@i3rand])+"] from the Super Rare Box.",0;
			end;
		} 

		// Rare Item 10%
		else if (.chance <= 11 && .chance >= 1){
			getitem @i2[@i2rand],1;
			announce "["+strcharinfo(0)+"] won a ["+getitemname(@i2[@i2rand])+"] from the Rare Item Box.",0;
			end;
		} 

		// Common Items
		else {
			getitem @i1[@i1rand],1;
	end; }
}

Ex. #pvppoints #HourlyPoints #Cashpoints

Edited by lelouchxv

2 answers to this question

Recommended Posts

  • 0
Posted
function	script	F_RBox	{

	// change Item ID here
	setarray .@i1[0],607,608; // Common Items 
	setarray .@i2[0],512,513; // Rare Items
	setarray .@i3[0],514,515; // Super Rare Items

	set .@i1rand,rand( getarraysize(.@i1) ); // Randomize Common Items; just change max amount if you add items
	set .@i2rand,rand( getarraysize(.@i2) ); // Randomize Rare Items; just change max amount if you add items
	set .@i3rand,rand( getarraysize(.@i3) ); //Randomize Super Rare Items; just change max amount if you add items

	.@chance = rand(100);

	// Super Rare Item 1%
	if (.@chance == 0) {
		getitem .@i3[.@i3rand],1;
		announce "["+strcharinfo(0)+"] won a ["+getitemname(.@i3[.@i3rand])+"] from the Super Rare Box.",0;
	}
	else if (.chance <= 10) { // 10%
		getitem .@i2[.@i2rand],1;
		announce "["+strcharinfo(0)+"] won a ["+getitemname(.@i2[.@i2rand])+"] from the Rare Item Box.",0;
	}
	else if (.chance <= 15) { // 5%
		#pvppoints += 1;
		announce "["+strcharinfo(0)+"] won a [1 #pvppoints] from the Rare Item Box.",0;
	}
	else if (.chance <= 22) { // 7%
		#HourlyPoints += 2;
		announce "["+strcharinfo(0)+"] won a [2 #HourlyPoints] from the Rare Item Box.",0;
	}
	else if (.chance <= 50) { // 28%
		#Cashpoints += 3;
		announce "["+strcharinfo(0)+"] won a [3 #Cashpoints] from the Rare Item Box.",0;
	}

	// Common Items // 50%
	else {
		getitem .@i1[.@i1rand],1;
	}
	end;
}

 

  • Love 1
  • 0
Posted (edited)
On 4/23/2021 at 8:14 AM, Emistry said:
function	script	F_RBox	{

	// change Item ID here
	setarray .@i1[0],607,608; // Common Items 
	setarray .@i2[0],512,513; // Rare Items
	setarray .@i3[0],514,515; // Super Rare Items

	set .@i1rand,rand( getarraysize(.@i1) ); // Randomize Common Items; just change max amount if you add items
	set .@i2rand,rand( getarraysize(.@i2) ); // Randomize Rare Items; just change max amount if you add items
	set .@i3rand,rand( getarraysize(.@i3) ); //Randomize Super Rare Items; just change max amount if you add items

	.@chance = rand(100);

	// Super Rare Item 1%
	if (.@chance == 0) {
		getitem .@i3[.@i3rand],1;
		announce "["+strcharinfo(0)+"] won a ["+getitemname(.@i3[.@i3rand])+"] from the Super Rare Box.",0;
	}
	else if (.chance <= 10) { // 10%
		getitem .@i2[.@i2rand],1;
		announce "["+strcharinfo(0)+"] won a ["+getitemname(.@i2[.@i2rand])+"] from the Rare Item Box.",0;
	}
	else if (.chance <= 15) { // 5%
		#pvppoints += 1;
		announce "["+strcharinfo(0)+"] won a [1 #pvppoints] from the Rare Item Box.",0;
	}
	else if (.chance <= 22) { // 7%
		#HourlyPoints += 2;
		announce "["+strcharinfo(0)+"] won a [2 #HourlyPoints] from the Rare Item Box.",0;
	}
	else if (.chance <= 50) { // 28%
		#Cashpoints += 3;
		announce "["+strcharinfo(0)+"] won a [3 #Cashpoints] from the Rare Item Box.",0;
	}

	// Common Items // 50%
	else {
		getitem .@i1[.@i1rand],1;
	}
	end;
}

 

thank you so much

Edited by iFox

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