Jump to content
  • 0

How to make the default random? Like 5 items in random..


Meister

Question


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

prontera,155,181,5 script Lotti Girl 100,{

mes "[Lotti Girl]";

mes "It costs "+ .cost[1] +"x "+ getitemname( .cost[0] ) +" to play.";

mes " ";

for ( .@i = 0; .@i < 20; .@i++ )

mes $lotti_girl_ladder$[.@i];

if ( countitem( .cost[0] ) < .cost[1] ) close;

next;

if ( select( "Deal me in!", "No way..." ) == 2 ) close;

mes "[Lotti Girl]";

while (1) {

mes "Here we go...";

delitem .cost[0], .cost[1];

.@rand = rand(.totalchance);

.@r = 0; // <-- think you forgot to put this

while ( ( .@rand = .@rand - getd( ".p"+ .@r +"[0]" ) ) >= 0 ) .@r++;

.@size = getarraysize( getd(".p"+ .@r ) );

for ( .@i = 1; .@i < .@size; .@i += 2 )

getitem getd( ".p"+ .@r +"["+ .@i +"]" ), getd( ".p"+ .@r +"["+( .@i +1 )+"]" );

if ( getd( ".p"+ .@r +"[0]" ) < 50 ) // announce if below 50% chance

announce "Congratulations to "+strcharinfo(0)+" for getting "+ .ann$[.@r] +"!", 0;

if ( getd( ".p"+ .@r +"[0]" ) < 10 ) { // score the ladder if below 10% chance

copyarray $lotti_girl_ladder$[1], $lotti_girl_ladder$[0], 19;

$lotti_girl_ladder$ = strcharinfo(0) +" gains "+ .ann$[.@r] +" at "+ gettimestr( "%d/%m/%Y %H:%M %p", 21 );

}

mes " ";

mes "wanna try again ?";

next;

if ( select( "Yes", "No" ) == 2 ) close;

mes "[Lotti Girl]";

if ( countitem( .cost[0] ) < .cost[1] ) {

mes "it seems you have ran out of "+ getitemname( .cost[0] );

close;

}

}

close;

OnInit:

// setarray .p1, 70, 501,25; // debugging ...

// setarray .p2, 70, 502,1;

// setarray .p3, 40, 503,1;

// setarray .p4, 40, 504,1;

// setarray .p5, 40, 505,1;

// setarray .p6, 50, 506,1, 507,1, 508,1, 509,1;

// setarray .p7, 25, 512,1;

// setarray .p8, 5, 513,1;



setarray .p1, 70, 607,25;

setarray .p2, 70, 13710,1;

setarray .p3, 40, 5471,1;

setarray .p4, 40, 5210,1;

setarray .p5, 40, 5224,1;

setarray .p6, 50, 2357,1, 2524,1, 2421,1, 2115,1;

setarray .p7, 25, 2701,1;

setarray .p8, 5, 2394,1;

setarray .p9, 30+30+60+60+60+50+75+95, 12214,1; // default ... the chance are added up by 100-n%

setarray .cost, 7227,300;

.total = 9;



freeloop 1;

.@i = 1;

while ( .@i <= .total ) {

.totalchance = .totalchance + getd(".p"+ .@i );

.@j = 1;

.@size = getarraysize( getd(".p"+ .@i ) );

while ( .@j < .@size ) {

.ann$[.@i] = .ann$[.@i] + getd( ".p"+ .@i +"["+( .@j +1 )+"]" ) +"x "+ getitemname( getd( ".p"+ .@i +"["+ .@j +"]" ) ) +( ( .@j == .@size -2 )? "":"," ); // I think Euphy forgotten to make announcement when configuration has set more than 1 items

.@j += 2;

}

.@i++;

}

freeloop 0;

}

 

yeah. The default item is convex mirror box. How to make it a random one. for example the default items are. YGG Box, Convex Mirror Box, ESB and other.. how to set it?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Maybe you mean 1 random item in the list of randoms items by default ?

prontera,155,181,5	script	Lotti Girl	100,{

	mes "[Lotti Girl]";
	mes "It costs "+ .cost[1] +"x "+ getitemname( .cost[0] ) +" to play.";
	mes " ";
	for ( .@i = 0; .@i < 20; .@i++ )
		mes $lotti_girl_ladder$[.@i];
	if ( countitem( .cost[0] ) < .cost[1] ) close;
	next;
	if ( select( "Deal me in!", "No way..." ) == 2 ) close;
	mes "[Lotti Girl]";
	while (1) {
		callsub L_default;
		mes "Here we go...";
		delitem .cost[0], .cost[1];
		.@rand = rand(.totalchance);
		.@r = 0; // <-- think you forgot to put this
		while ( ( .@rand = .@rand - getd( ".p"+ .@r +"[0]" ) ) >= 0 ) .@r++;
		.@size = getarraysize( getd(".p"+ .@r ) );
		for ( .@i = 1; .@i < .@size; .@i += 2 )
			getitem getd( ".p"+ .@r +"["+ .@i +"]" ), getd( ".p"+ .@r +"["+( .@i +1 )+"]" );
		if ( getd( ".p"+ .@r +"[0]" ) < 50 ) // announce if below 50% chance
			announce "Congratulations to "+strcharinfo(0)+" for getting "+ .ann$[.@r] +"!", 0;
		if ( getd( ".p"+ .@r +"[0]" ) < 10 ) { // score the ladder if below 10% chance
			copyarray $lotti_girl_ladder$[1], $lotti_girl_ladder$[0], 19;
			$lotti_girl_ladder$ = strcharinfo(0) +" gains "+ .ann$[.@r] +" at "+ gettimestr( "%d/%m/%Y %H:%M %p", 21 );
		}

		mes " ";
		mes "wanna try again ?";
		next;

		if ( select( "Yes", "No" ) == 2 ) close;
		mes "[Lotti Girl]";
		if ( countitem( .cost[0] ) < .cost[1] ) {
			mes "it seems you have ran out of "+ getitemname( .cost[0] );
			close;
		}
	}
	close;

OnInit:
	// setarray .p1, 70, 501,25; // debugging ...
	// setarray .p2, 70, 502,1;
	// setarray .p3, 40, 503,1;
	// setarray .p4, 40, 504,1;
	// setarray .p5, 40, 505,1;
	// setarray .p6, 50, 506,1, 507,1, 508,1, 509,1;
	// setarray .p7, 25, 512,1;
	// setarray .p8, 5, 513,1;

	setarray .p1, 70, 607,25;
	setarray .p2, 70, 13710,1;
	setarray .p3, 40, 5471,1;
	setarray .p4, 40, 5210,1;
	setarray .p5, 40, 5224,1;
	setarray .p6, 50, 2357,1, 2524,1, 2421,1, 2115,1;
	setarray .p7, 25, 2701,1;
	setarray .p8, 5, 2394,1;
	callsub L_default;
	setarray .cost, 7227,300;
	.total = 9;

	freeloop 1;
	.@i = 1;
	while ( .@i <= .total ) {
		.totalchance = .totalchance + getd(".p"+ .@i );
		.@j = 1;
		.@size = getarraysize( getd(".p"+ .@i ) );
		while ( .@j < .@size ) {
			.ann$[.@i] = .ann$[.@i] + getd( ".p"+ .@i +"["+( .@j +1 )+"]" ) +"x "+ getitemname( getd( ".p"+ .@i +"["+ .@j +"]" ) ) +( ( .@j == .@size -2 )? "":"," ); // I think Euphy forgotten to make announcement when configuration has set more than 1 items
			.@j += 2;
		}
		.@i++;
	}
	freeloop 0;
	end;
L_default:
	deletearray .p9;
	setarray .p9, 30+30+60+60+60+50+75+95, callfunc( "F_RandMes", 5, 12214,502,503,504,505 ),1; // default ... the chance are added up by 100-n%
	return;
}

List of randoms items

callfunc( "F_RandMes", 5, 12214,502,503,504,505 )// count, item ID, item ID..
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  52
  • Topics Per Day:  0.01
  • Content Count:  185
  • Reputation:   20
  • Joined:  01/06/13
  • Last Seen:  

like this?

setarray .p6, 50, 2357,1, 2524,1, 2421,1, 2115,1;
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

like this?

setarray .p6, 50, 2357,1, 2524,1, 2421,1, 2115,1;

 

No the default p9. Its the default item that will be given. I want it to be like dynamically changing from.. yggberry, convex mirror with the same percentage. 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  92
  • Reputation:   8
  • Joined:  01/11/13
  • Last Seen:  

the same percentage against an item makes the item random so agree with what saisho posted

 

hint: take a look at the gift box items

Edited by kamikaze666
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Teeway capuche! I'll try this!

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