Jump to content
  • 0

Stats Seller


Bringer

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

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!";
	.@i = select( .stat_menu$ ) - 1;
	input .@amount,0,( .max_stats - readparam( 13+.@i ) );
	if ( .@amount > 0 )
		callsub( __OnBuyStat,.@i,.@amount );
	close;
	
	
	__OnBuyStat:
		.@index= getarg(0);
		.@amount = getarg(1);
		.@cost = ( .cost_per_stat * .@amount );
		
		mes "Stats : "+.stat$[.@index]+" +"+F_InsertComma( .@amount );
		mes "Price : "+F_InsertComma( .@cost )+"z";
		mes "Do you wish to continue ?";
		
		if ( Zeny >= .@cost )
			if ( select( "Buy "+F_InsertComma( .@amount )+" "+.stat$[.@index] ) ) {
				Zeny -= .@cost;
				statusup2 ( 13 + .@index ),.@amount;
			}
		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";
		.@stat_size = getarraysize( .stat$ );
		while ( .@i < .@stat_size ) {
			.stat_menu$ = .stat_menu$ + .stat$[.@i] + ":";
			.@i++;
		}
		end;
}

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

image.png.de983041fc1fc86a3edbd19a6d7f7196.png

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 1

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

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(bStr + .@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 (bStr + .@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;
}

 

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

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!";
	.@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(bStr + .@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 (bStr + .@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;
}

 

image.thumb.png.e67e9cd9e06aef65b4859a07dd6a6bb2.png

i try to buy 299 int but failed

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  233
  • Reputation:   49
  • Joined:  12/20/18
  • Last Seen:  

Find:
if (.@current_stat >= .max_stats) {
and
else if ((.@current_stat+ .@amount) >= .max_stats) {

 

UPDATE:

if (.@current_stat > .max_stats) {
and
else if ((.@current_stat+ .@amount) > .max_stats) {

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

3 hours ago, Disabled LOOLP said:

Find:
if (.@current_stat >= .max_stats) {
and
else if ((.@current_stat+ .@amount) >= .max_stats) {

 

UPDATE:

if (.@current_stat > .max_stats) {
and
else if ((.@current_stat+ .@amount) > .max_stats) {

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

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  233
  • Reputation:   49
  • Joined:  12/20/18
  • Last Seen:  

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.
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

i use dispbottom but is not working too

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

2 hours ago, Disabled LOOLP said:

what error ?

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

 

if (.@current_stat > .max_stats) {
			message strcharinfo(0), "You've reached the maximum "+.stat$[.@index];
		}
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  233
  • Reputation:   49
  • Joined:  12/20/18
  • Last Seen:  

@Bringer send me all code

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:
.@current_stat = readparam("b" + .@index);
received : readparam(bSTR or bDEX) etc etc

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

Solved 

		if ((.@current_stat+ .@amount) >= .max_stats) {
			message strcharinfo(0), "You've already reached the Maximum "+.stat$[.@index];
		}

.max_stats = 301;



 

Edited by Bringer
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...