Jump to content
  • 0

Lotti / Gacha script Req


Yami

Question


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

Hi there, I've been trying to modify my lotti script into not have a default prize (If you lose you get this item).

I just want a Lotti / Gacha script that will take the payment, then randomly select a reward (items that I set) with their respective chances.

As my current lotti script goes (the one from rathena) when you roll and if you don't get any of the set rewards you will be rewarded with a DEFAULT prize. I don't want to get default prize, I just want to get the items that are set by how high the chance to get them.

Just roll me all the items, highest chance to lowest chance. Thank you for the help

This is the script

// http://rathena.org/board/topic/83017-pro-lotti-girl-refine-master/
turbo_room,135,97,3	script	Lotti Girl	720,{
	mes "[Lotti Girl]";
	mes "I'm Lotti! I'll exchange";
	mes "Random Prizes for every";
	mes "^ff000050,000 zeny^000000.";
	next;
	mes "[Lotti Girl]";
	mes "Our Grand prize is:";
	mes "^ff0000 +4 Refine Ticket^000000";
	mes "Consolations are:";
	mes "^ff0000 x1 Silver Coin^000000";
	mes "^ff0000 x1 Bronze Coin^000000";
	mes "^ff0000 x?? War Badges^000000";
	mes "And many more!!";
	if (Zeny < 50000)
		close;
	next;
	if(select("Let's Do This!!:No thanks...")==2) close;
	mes "[Lotti Girl]";
	mes "Here we go...";
	set Zeny, Zeny - 50000;
	set .@Total,5;
	//<%>,<ItemID>,<Amount>
	setarray .@P1[0],2,6456,1;
	setarray .@P2[0],3,675,1;
	setarray .@P3[0],4,673,1;
	setarray .@P4[0],5,7773,rand(1,2);
	setarray .@Default[0],11502,rand(1,3);
	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<=2)
		announce "Hey! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" from Lotti Girl!",0;
	specialeffect2 248;
	close;
}

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 2

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  


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

change to


	if (rand(1,100) < getd(".@P"+.@i+"[0]"))
	{
		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;
			}
		}
	}

 

  • Upvote 2
Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  241
  • Reputation:   18
  • Joined:  06/04/14
  • Last Seen:  

On 6/21/2021 at 12:54 PM, Yami said:

Hi there, I've been trying to modify my lotti script into not have a default prize (If you lose you get this item).

I just want a Lotti / Gacha script that will take the payment, then randomly select a reward (items that I set) with their respective chances.

As my current lotti script goes (the one from rathena) when you roll and if you don't get any of the set rewards you will be rewarded with a DEFAULT prize. I don't want to get default prize, I just want to get the items that are set by how high the chance to get them.

Just roll me all the items, highest chance to lowest chance. Thank you for the help

This is the script


// http://rathena.org/board/topic/83017-pro-lotti-girl-refine-master/
turbo_room,135,97,3	script	Lotti Girl	720,{
	mes "[Lotti Girl]";
	mes "I'm Lotti! I'll exchange";
	mes "Random Prizes for every";
	mes "^ff000050,000 zeny^000000.";
	next;
	mes "[Lotti Girl]";
	mes "Our Grand prize is:";
	mes "^ff0000 +4 Refine Ticket^000000";
	mes "Consolations are:";
	mes "^ff0000 x1 Silver Coin^000000";
	mes "^ff0000 x1 Bronze Coin^000000";
	mes "^ff0000 x?? War Badges^000000";
	mes "And many more!!";
	if (Zeny < 50000)
		close;
	next;
	if(select("Let's Do This!!:No thanks...")==2) close;
	mes "[Lotti Girl]";
	mes "Here we go...";
	set Zeny, Zeny - 50000;
	set .@Total,5;
	//<%>,<ItemID>,<Amount>
	setarray .@P1[0],2,6456,1;
	setarray .@P2[0],3,675,1;
	setarray .@P3[0],4,673,1;
	setarray .@P4[0],5,7773,rand(1,2);
	setarray .@Default[0],11502,rand(1,3);
	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<=2)
		announce "Hey! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" from Lotti Girl!",0;
	specialeffect2 248;
	close;
}

 

 

Use search bar next time mate.

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