• 0
Sign in to follow this  
Bringer

Stats Seller

Question

prontera,155,181,5	script	Stats Mistress	757,{
	
	mes "[ Stats Mistress ]";
	mes "Hello! I sell ^FF00CC1 stats for 400,000z^000000 would you like to buy!";
	[email protected] = select( .stat_menu$ ) - 1;
	input [email protected],0,( .max_stats - readparam( [email protected] ) );
	if ( [email protected] > 0 )
		callsub( __OnBuyStat,[email protected],[email protected] );
	close;
	
	
	__OnBuyStat:
		[email protected]= getarg(0);
		[email protected] = getarg(1);
		[email protected] = ( .cost_per_stat * [email protected] );
		
		mes "Stats : "+.stat$[[email protected]]+" +"+F_InsertComma( [email protected] );
		mes "Price : "+F_InsertComma( [email protected] )+"z";
		mes "Do you wish to continue ?";
		
		if ( Zeny >= [email protected] )
			if ( select( "Buy "+F_InsertComma( [email protected] )+" "+.stat$[[email protected]] ) ) {
				Zeny -= [email protected];
				statusup2 ( 13 + [email protected] ),[email protected];
			}
		return;

	OnInit:
		.max_stats = 300;
		
		.cost_per_stat = 400000;
		
		setarray .stat$,"Buy ^FF00CCSTR^000000","Buy ^FF00CCAGI^000000","Buy ^FF00CCVIT^000000","Buy ^FF00CCINT^000000","Buy ^FF00CCDEX^000000","Buy ^FF00CCLUK^000000";
		[email protected]_size = getarraysize( .stat$ );
		while ( [email protected] < [email protected]_size ) {
			.stat_menu$ = .stat_menu$ + .stat$[[email protected]] + ":";
			[email protected]++;
		}
		end;
}

how i can add if player max is stats..
the npc give this message like on screenshot

image.png.de983041fc1fc86a3edbd19a6d7f7196.png

Share this post


Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 1
prontera,155,181,5	script	Stats Mistress	757,{
	
	mes "[ Stats Mistress ]";
	mes "Hello! I sell ^FF00CC1 stats for 400,000z^000000 would you like to buy!";
	[email protected] = select( .stat_menu$ ) - 1;
	input [email protected],0,( .max_stats - readparam( [email protected] ) );
	if ( [email protected] > 0 ) {
		[email protected] = ( .cost_per_stat * [email protected] );
		mes "Stats : "+.stat$[[email protected]]+" +"+F_InsertComma( [email protected] );
		mes "Price : "+F_InsertComma( [email protected] )+"z";
		mes "Do you wish to continue ?";
		
		[email protected]_stat = readparam(bStr + [email protected]);
		if ([email protected]_stat >= .max_stats) {
			message strcharinfo(0), "You've reached the maximum "+.stat$[[email protected]];
		}
		else if (([email protected]_stat+ [email protected]) >= .max_stats) {
			message strcharinfo(0), "You can't exceed the maximum stats of "+.max_stats;
		}
		else if ( Zeny >= [email protected] ) {
			if ( select( "Buy "+F_InsertComma( [email protected] )+" ^FF00CC"+.stat$[[email protected]]+"^000000" ) ) {
				Zeny -= [email protected];
				statusup2 (bStr + [email protected]),[email protected];
				message strcharinfo(0), "Gained "+F_InsertComma( [email protected] )+" "+.stat$[[email protected]];
			}
		}
	}
	close;
	
	OnInit:
		.max_stats = 300;
		.cost_per_stat = 400000;
		
		setarray .stat$,
			"STR",
			"AGI",
			"VIT",
			"INT",
			"DEX",
			"LUK";
		[email protected]_size = getarraysize( .stat$ );
		while ( [email protected] < [email protected]_size ) {
			.stat_menu$ = .stat_menu$ + "^FF00CC"+.stat$[[email protected]]+"^000000" + ":";
			[email protected]++;
		}
		end;
}

 

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
13 minutes ago, Emistry said:
prontera,155,181,5	script	Stats Mistress	757,{
	
	mes "[ Stats Mistress ]";
	mes "Hello! I sell ^FF00CC1 stats for 400,000z^000000 would you like to buy!";
	[email protected] = select( .stat_menu$ ) - 1;
	input [email protected],0,( .max_stats - readparam( [email protected] ) );
	if ( [email protected] > 0 ) {
		[email protected] = ( .cost_per_stat * [email protected] );
		mes "Stats : "+.stat$[[email protected]]+" +"+F_InsertComma( [email protected] );
		mes "Price : "+F_InsertComma( [email protected] )+"z";
		mes "Do you wish to continue ?";
		
		[email protected]_stat = readparam(bStr + [email protected]);
		if ([email protected]_stat >= .max_stats) {
			message strcharinfo(0), "You've reached the maximum "+.stat$[[email protected]];
		}
		else if (([email protected]_stat+ [email protected]) >= .max_stats) {
			message strcharinfo(0), "You can't exceed the maximum stats of "+.max_stats;
		}
		else if ( Zeny >= [email protected] ) {
			if ( select( "Buy "+F_InsertComma( [email protected] )+" ^FF00CC"+.stat$[[email protected]]+"^000000" ) ) {
				Zeny -= [email protected];
				statusup2 (bStr + [email protected]),[email protected];
				message strcharinfo(0), "Gained "+F_InsertComma( [email protected] )+" "+.stat$[[email protected]];
			}
		}
	}
	close;
	
	OnInit:
		.max_stats = 300;
		.cost_per_stat = 400000;
		
		setarray .stat$,
			"STR",
			"AGI",
			"VIT",
			"INT",
			"DEX",
			"LUK";
		[email protected]_size = getarraysize( .stat$ );
		while ( [email protected] < [email protected]_size ) {
			.stat_menu$ = .stat_menu$ + "^FF00CC"+.stat$[[email protected]]+"^000000" + ":";
			[email protected]++;
		}
		end;
}

 

image.thumb.png.e67e9cd9e06aef65b4859a07dd6a6bb2.png

i try to buy 299 int but failed

Share this post


Link to post
Share on other sites
  • 0
3 hours ago, Disabled LOOLP said:

Find:
if ([email protected]_stat >= .max_stats) {
and
else if (([email protected]_stat+ [email protected]) >= .max_stats) {

 

UPDATE:

if ([email protected]_stat > .max_stats) {
and
else if (([email protected]_stat+ [email protected]) > .max_stats) {

		if ([email protected]_stat > .max_stats) {
			message strcharinfo(0), "You've reached the maximum "+.stat$[[email protected]];
		}
		else if (([email protected]_stat+ [email protected]) > .max_stats) {
			message strcharinfo(0), "You can't exceed the maximum stats of "+.max_stats;
		}

if i changed them is working but message strcharinfo(0) is not working

Share this post


Link to post
Share on other sites
  • 0
This kind of message can sometimes be buggy depending on your exe version.
Why not use one ..

mes "blablabla";
close;

or

dispbottom "blablabla";

I believe dispbottom will have a cleaner idea for the user.

Share this post


Link to post
Share on other sites
  • 0

i use dispbottom but is not working too

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, Disabled LOOLP said:

what error ?

no error but this code not appear even i have max str/int/dex

 

if ([email protected]_stat > .max_stats) {
			message strcharinfo(0), "You've reached the maximum "+.stat$[[email protected]];
		}

Share this post


Link to post
Share on other sites
  • 0
prontera,155,181,5	script	Stats Mistress	757,{
	
	mes "[ Stats Mistress ]";
	mes "Hello! I sell ^FF00CC1 stats for 400,000z^000000 would you like to buy!";
	.@index = select( .stat_menu$ ) - 1;
	input .@amount,0,( .max_stats - readparam( 13+.@index ) );
	if ( .@amount > 0 ) {
		.@cost = ( .cost_per_stat * .@amount );
		mes "Stats : "+.stat$[.@index]+" +"+F_InsertComma( .@amount );
		mes "Price : "+F_InsertComma( .@cost )+"z";
		mes "Do you wish to continue ?";
		
		.@current_stat = readparam("b" + .@index);
		if (.@current_stat > .max_stats) {
			message strcharinfo(0), "You've reached the maximum "+.stat$[.@index];
		}
		else if ((.@current_stat+ .@amount) > .max_stats) {
			message strcharinfo(0), "You can't exceed the maximum stats of "+.max_stats;
		}
		else if ( Zeny >= .@cost ) {
			if ( select( "Buy "+F_InsertComma( .@amount )+" ^FF00CC"+.stat$[.@index]+"^000000" ) ) {
				Zeny -= .@cost;
				statusup2 ("b" + .@index),.@amount;
				message strcharinfo(0), "Gained "+F_InsertComma( .@amount )+" "+.stat$[.@index];
			}
		}
	}
	close;
	
	OnInit:
		.max_stats = 300;
		.cost_per_stat = 400000;
		
		setarray .stat$,
			"STR",
			"AGI",
			"VIT",
			"INT",
			"DEX",
			"LUK";
		.@stat_size = getarraysize( .stat$ );
		while ( .@i < .@stat_size ) {
			.stat_menu$ = .stat_menu$ + "^FF00CC"+.stat$[.@i]+"^000000" + ":";
			.@i++;
		}
		end;
}

I can't teste now.. but, try this.

you use "bSTR" all time ..

i alter:
[email protected]_stat = readparam("b" + [email protected]);
received : readparam(bSTR or bDEX) etc etc

Share this post


Link to post
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.

Loading...
Sign in to follow this