Jump to content
  • 0

Lotti Girl support


Question

Posted
prontera,139,172,4	script	Lotti Girl	714,{
	mes "[Lotti Girl]";
	mes "Hello Sir! Are you out";
	mes "shopping in the city?!";
	next;
	mes "[Lotti Girl]";
	mes "I'm Lotti! I'll exchange cool";
	mes "random prizes for every";
	mes "^ff00001 Lottery Ticket^000000.";
	next;
	mes "[Lotti Girl]";
	mes "Our Grand prize is:";
	mes "^ff0000+9 Weapon Refine Deed^000000";
	mes "^ff0000+10 Weapon Refine Deed^000000";
	mes "^ff0000+9 Armor Refine Deed^000000";
	mes "^ff0000+10 Armor Refine Deed^000000";
	next;
	mes "[Lotti Girl]";
	mes "Special prizes are:";
	mes "^ff0000+5 Armor Refine Deed^000000";
	mes "^ff0000+6 Armor Refine Deed^000000";
	mes "^ff0000+7 Armor Refine Deed^000000";
	mes "^ff0000+8 Armor Refine Deed^000000";
	mes "^ff0000+5 Weapon Refine Deed^000000";
	mes "^ff0000+6 Weapon Refine Deed^000000";
	mes "^ff0000+7 Weapon Refine Deed^000000";
	mes "^ff0000+8 Weapon Refine Deed^000000";
	next;
	mes "[Lotti Girl]";
	mes "MVP Card & Headgear prizes are:";
	mes "^ff0000Tao Gunka Card^000000";
	mes "^ff0000Turtle General Card^000000";
	mes "^ff0000Japan Anniversary Hat^000000";
	next;
	mes "Consolation prizes are:";
	mes "^ff0000Food Buffs^000000";
	mes "^ff0000Healing Foods^000000";
	mes "^ff0000Random Dye Box^000000";
	if (countitem(7528) < 1)
		close;
	next;
	if(select("Deal me in!:No way...")==2)
		close;
	mes "[Lotti Girl]";
	mes "Here we go...";
	delitem 7528,1;
	set .@Total,33;
	//<%>,<ItemID>,<Amount>
	setarray .@P1[0],6,8001,1;
	setarray .@P2[0],5,8002,1;
	setarray .@P3[0],4,8003,1;
	setarray .@P4[0],3,8004,1;
	setarray .@P5[0],2,8005,1;
	setarray .@P6[0],1,8006,1;
	setarray .@P7[0],6,8007,1;
	setarray .@P8[0],5,8008,1;
	setarray .@P9[0],4,8009,1;
	setarray .@P10[0],3,8010,1;
	setarray .@P11[0],2,8011,1;
	setarray .@P12[0],1,8012,1;
	setarray .@P13[0],20,13517,3;
	setarray .@P14[0],20,12080,5;
	setarray .@P15[0],20,12075,5;
	setarray .@P16[0],20,12085,5;
	setarray .@P17[0],20,12090,5;
	setarray .@P18[0],20,12095,5;
	setarray .@P18[0],20,12100,5;
	setarray .@P19[0],50,26000,1;
	setarray .@P20[0],40,7528,1;
	setarray .@P21[0],1,4305,1;
	setarray .@P22[0],45,12033,10;
	setarray .@P23[0],45,13548,2;
	setarray .@P24[0],60,12709,20;
	setarray .@P25[0],65,663,50;
	setarray .@P26[0],50,26048,1;
	setarray .@P27[0],1,5846,1;
	setarray .@P28[0],1,4302,1;
	setarray .@P29[0],80,13517,1;
	setarray .@P30[0],80,13517,1;
	setarray .@P31[0],80,13517,1;
	setarray .@P32[0],80,13517,1;
	setarray .@P33[0],80,13517,1;
	setarray .@Default[0],13517,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<=4)
		announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" from Lotti Girl!",0;
	specialeffect2 248;
	close;
}

 

I am using this script but after i edited the prizes, it only gives mostly the default prize which is 

 

    setarray .@Default[0],13517,1;

i don't know i'f im wrong or maybe the npc is more likely choosing the default....Can you help me with this? even i put 100% on the item mostyly the item give is default.

14 answers to this question

Recommended Posts

Posted
    setarray .@P29[0],80,13517,1;
    setarray .@P30[0],80,13517,1;
    setarray .@P31[0],80,13517,1;
    setarray .@P32[0],80,13517,1;
    setarray .@P33[0],80,13517,1;
    setarray .@Default[0],13517,1;

 

you set a 80% change of 13517 same as your default that why

Posted (edited)

It set the .@i variable to a number between 1 and .@Total value ( which is actualy 33)

i have this now

 

	delitem 7539,15;
	set .@Total,21;
	//<%>,<ItemID>,<Amount>
	setarray .@P1[0],10,8005,1;
	setarray .@P2[0],10,8006,1;
	setarray .@P3[0],10,8011,1;
	setarray .@P4[0],10,8012,1;
	setarray .@P5[0],20,616,20;
	setarray .@P6[0],25,14232,3;
	setarray .@P7[0],10,13583,1;
	setarray .@P8[0],50,26000,10;
	setarray .@P9[0],50,12246,5;
	setarray .@P10[0],50,12080,10;
	setarray .@P11[0],50,12075,10;
	setarray .@P12[0],50,12085,10;
	setarray .@P13[0],50,12090,10;
	setarray .@P14[0],50,12095,10;
	setarray .@P15[0],50,12100,10;
	setarray .@P16[0],10,18785,1;
	setarray .@P17[0],20,18632,1;
	setarray .@P18[0],20,18633,1;
	setarray .@P19[0],20,18634,1;
	setarray .@P20[0],20,18635,1;
	setarray .@P21[0],20,5335,1;
	setarray .@P21[0],10,5486,1;
	setarray .@Default[0],12709,60;
	set .@i, rand(1,.@Total);
	if (rand(1,100) > getd(".@P"+.@i+"[0]"))
	{

 

 

but still default occurs alot, is there a way to remove the default and make the script choose only from those  21 array??

 

and how can i make it announce for 10% and below? i dont know where to change but i think it should be here somewhere..

 

	if(1<=.@gz&&.@gz<=4)
		announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" from Lotti Girl!",0;
	specialeffect2 248;
	close;
}

bump~

Edited by xienne15
Posted

The rand() command is only so random... So to increase randomization you can shuffle the values. This can be done through an array.

 

Example...

// Randomize Answer Order
set .@r, rand(0,getarraysize(.@answers$)-1);
for (set .@i,getarraysize(.@answers$) - 1; .@i > 0;set .@i,.@i-1){
    set .@n, rand(.@r,.@i);
    set .@temp$, .@answers$[.@i];
    set .@answers$[.@i], .@answers$[.@n];
    set .@answers$[.@n], .@temp$;
}

 

You could try a function I made awhile ago although I doubt the randomization of it.

/// callfunc("package_func",<itemid>,<amount>,<chance>{,<itemid>,<amount>,<chance>{,<itemid>,<amount>,<chance>{,...},<accountid>}})

function	script	package_func	{
	set .@len, getargcount()-((getarg(getargcount()-1)>=2000000)?1:0);
	set .@id, ((getarg(getargcount()-1)>=2000000)?getarg(getargcount()-1):getcharid(3));
	while(set(.@i,.@i+3)-3<.@len)
		if(rand(101)<=getarg(.@i-1))
			getitem(set(@package_item[.@a++-1],getarg(.@i-3)),set(@package_amount[.@a-1],getarg(.@i-2)),.@id);
	return .@a;
}

Works for rAthena/Hercules.

  • Upvote 1
Posted

Thanks Skorm, can you help me where to put that random in this script?

 

// http://rathena.org/board/topic/83017-pro-lotti-girl-refine-master/
prontera,139,172,4	script	Lotti Girl	714,{
	mes "[Lotti Girl]";
	mes "Hello Sir! Are you out";
	mes "shopping in the city?!";
	next;
	mes "[Lotti Girl]";
	mes "I'm Lotti! I'll exchange cool";
	mes "random prizes for every";
	mes "^ff00001 Lottery Ticket^000000.";
	next;
	mes "[Lotti Girl]";
	mes "Our Grand prize is:";
	mes "^ff0000+9 Weapon Refine Deed^000000";
	mes "^ff0000+10 Weapon Refine Deed^000000";
	mes "^ff0000+9 Armor Refine Deed^000000";
	mes "^ff0000+10 Armor Refine Deed^000000";
	next;
	mes "[Lotti Girl]";
	mes "Special prizes are:";
	mes "^ff0000+5 Armor Refine Deed^000000";
	mes "^ff0000+6 Armor Refine Deed^000000";
	mes "^ff0000+7 Armor Refine Deed^000000";
	mes "^ff0000+8 Armor Refine Deed^000000";
	mes "^ff0000+5 Weapon Refine Deed^000000";
	mes "^ff0000+6 Weapon Refine Deed^000000";
	mes "^ff0000+7 Weapon Refine Deed^000000";
	mes "^ff0000+8 Weapon Refine Deed^000000";
	next;
	mes "[Lotti Girl]";
	mes "MVP Card & Headgear prizes are:";
	mes "^ff0000Tao Gunka Card^000000";
	mes "^ff0000Turtle General Card^000000";
	mes "^ff0000Japan Anniversary Hat^000000";
	next;
	mes "[Lotti Girl]";
	mes "You can still get random item";
	mes "if you failed to get the grand";
	mes "prize and special prizes.";
	next;
	mes "Consolation prizes are:";
	mes "^ff0000Food Buffs^000000";
	mes "^ff0000Healing Foods^000000";
	mes "^ff0000Random Dye Box^000000";
	if (countitem(7528) < 1)
		close;
	next;
	if(select("Deal me in!:No way...")==2)
		close;
	mes "[Lotti Girl]";
	mes "Here we go...";
	delitem 7528,1;
	set .@Total,33;
	//<%>,<ItemID>,<Amount>
	setarray .@P1[0],6,8001,1;
	setarray .@P2[0],5,8002,1;
	setarray .@P3[0],4,8003,1;
	setarray .@P4[0],3,8004,1;
	setarray .@P5[0],2,8005,1;
	setarray .@P6[0],1,8006,1;
	setarray .@P7[0],6,8007,1;
	setarray .@P8[0],5,8008,1;
	setarray .@P9[0],4,8009,1;
	setarray .@P10[0],3,8010,1;
	setarray .@P11[0],2,8011,1;
	setarray .@P12[0],1,8012,1;
	setarray .@P13[0],20,13517,3;
	setarray .@P14[0],20,12080,5;
	setarray .@P15[0],20,12075,5;
	setarray .@P16[0],20,12085,5;
	setarray .@P17[0],20,12090,5;
	setarray .@P18[0],20,12095,5;
	setarray .@P18[0],20,12100,5;
	setarray .@P19[0],50,26000,1;
	setarray .@P20[0],40,7528,1;
	setarray .@P21[0],1,4305,1;
	setarray .@P22[0],45,12033,10;
	setarray .@P23[0],45,13548,2;
	setarray .@P24[0],60,12709,20;
	setarray .@P25[0],65,663,50;
	setarray .@P26[0],50,26048,1;
	setarray .@P27[0],1,5846,1;
	setarray .@P28[0],1,4302,1;
	setarray .@P29[0],80,13517,1;
	setarray .@P30[0],80,13517,1;
	setarray .@P31[0],80,13517,1;
	setarray .@P32[0],80,13517,1;
	setarray .@P33[0],80,13517,1;
	setarray .@Default[0],13517,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<=4)
		announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" from Lotti Girl (prontera 139 173)!",0;
	specialeffect2 248;
	close;
}

 

 

and how can i configure the announcement when getting 10% and below items from it? Thanks!

Posted

So you'd only get one item from this per lotto ticket? Did you maybe want more?

 

If it's one you could do something like this maybe it's untested but yeah.

 

Although your odds are still only as high as the item you land on... each item you land on would be rather random.

Leaving the gap for failure pretty large...

 

setarray .@answers$, "501|10|1", "501|1|5", "501|20|100";
set .@r, rand(getarraysize(.@answers$));
for (set .@i,getarraysize(.@answers$) - 1; .@i > 0;set .@i,.@i-1){
    set .@n, rand(.@r,.@i);
    set .@temp$, .@answers$[.@i];
    set .@answers$[.@i], .@answers$[.@n];
    set .@answers$[.@n], .@temp$;
}

explode(.@array$,.@answers$[rand(getarraysize(.@answers$))],"|");
setarray .@array, atoi(.@array$[0]), atoi(.@array$[1]), atoi(.@array$[2]);
set .@a, callfunc("package_func",.@array[0],.@array[1],.@array[2]);

if(.@a) {
	if(atoi(.@array[2])<=10)
		announce strcharinfo(0)+" got "+.@array[1]+" "+getitemname(.@array[0])+" at "+.@array[2]+"%",bc_yellow|bc_all;
	mes "Wow you got "+.@array[1]+" "+getitemname(.@array[0])+"(s)";
	close;
}
mes "Aww, better luck next time!";
close;

function	script	package_func	{
	set .@len, getargcount()-((getarg(getargcount()-1)>=2000000)?1:0);
	set .@id, ((getarg(getargcount()-1)>=2000000)?getarg(getargcount()-1):getcharid(3));
	while(set(.@i,.@i+3)-3<.@len)
		if(rand(101)<=getarg(.@i-1))
			getitem(set(@package_item[.@a++-1],getarg(.@i-3)),set(@package_amount[.@a-1],getarg(.@i-2)),.@id);
	return .@a;
}
  • Upvote 1
Posted

Yup it would act like lotti girl its like give this ticket and he will give the items something like this format

 

%,itemid,amount

 

something like that



bump



the percentage here is like we have in our db?

 

    //<%>,<ItemID>,<Amount>
    setarray .@P1[0],600,8001,1;
 

 

 

600 = 6% chance ?

or 

600 = 600% chance ?

Posted
Thanks emistry  :) and how can i change the announcement for only 10% and below?
if( .@gz && .@gz <= 10 )
	announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" from Lotti Girl (prontera 139 173)!",0;
  • Upvote 1
Posted

 

Thanks emistry  :) and how can i change the announcement for only 10% and below?
if( .@gz && .@gz <= 10 )
	announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" from Lotti Girl (prontera 139 173)!",0;

Thanks again sir emistry, last question how can i disable this?     setarray .@Default[0],13517,1; so it will only choose on the arrays i added...because the npc always give default, and few on the array items.

Posted

change


	setarray .@Default[0],13517,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;
			}
		}
	}

into

        do{
		set .@i, rand(1,.@Total);
	}while( 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 1
Posted

change


	setarray .@Default[0],13517,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;
			}
		}
	}

into

        do{
		set .@i, rand(1,.@Total);
	}while( 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;
		}
	}

Thank you so much sir emistry! i will try this later~!

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