Bringer Posted October 17, 2019 Posted October 17, 2019 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 Quote
1 Emistry Posted October 17, 2019 Posted October 17, 2019 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; } 1 Quote
0 Bringer Posted October 17, 2019 Author Posted October 17, 2019 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; } i try to buy 299 int but failed Quote
0 LOOLP - OFF Posted October 17, 2019 Posted October 17, 2019 Find: if (.@current_stat >= .max_stats) { andelse if ((.@current_stat+ .@amount) >= .max_stats) { UPDATE: if (.@current_stat > .max_stats) { andelse if ((.@current_stat+ .@amount) > .max_stats) { 1 Quote
0 Bringer Posted October 17, 2019 Author Posted October 17, 2019 3 hours ago, Disabled LOOLP said: Find: if (.@current_stat >= .max_stats) { andelse if ((.@current_stat+ .@amount) >= .max_stats) { UPDATE: if (.@current_stat > .max_stats) { andelse 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 Quote
0 LOOLP - OFF Posted October 17, 2019 Posted October 17, 2019 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. Quote
0 Bringer Posted October 17, 2019 Author Posted October 17, 2019 i use dispbottom but is not working too Quote
0 Bringer Posted October 18, 2019 Author Posted October 18, 2019 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]; } Quote
0 LOOLP - OFF Posted October 18, 2019 Posted October 18, 2019 @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 Quote
0 Bringer Posted October 19, 2019 Author Posted October 19, 2019 (edited) Solved if ((.@current_stat+ .@amount) >= .max_stats) { message strcharinfo(0), "You've already reached the Maximum "+.stat$[.@index]; } .max_stats = 301; Edited October 19, 2019 by Bringer Quote
Question
Bringer
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
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.