Jump to content
  • 0

Question

Posted
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

10 answers to this question

Recommended Posts

  • 1
Posted
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
  • 0
Posted
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

  • 0
Posted
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

  • 0
Posted
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];
		}
  • 0
Posted

@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

  • 0
Posted (edited)

Solved 

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

.max_stats = 301;



 

Edited by Bringer

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