//ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\\
// /ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\ \\
// | Stat Upper                                                                 | \\
// | Version: 0.2                                                               | \\
// |----------------------------------------------------------------------------| \\
// | Written By: Izkuru                                                         | \\
// | Email:      teh_face_x_o@yahoo.com                                         | \\
// | Tested With: OmniAthena 1033 [ Only with modification to the source ]      | \\
// |----------------------------------------------------------------------------| \\
// | NOTE: This version requires the readparam() function to be fixed. In OA    | \\
// | 962,1013,and 1033, readparam() is BROKEN for obtaining the players current | \\
// | stat ammount of a stat. You can find a fixed map-server.exe, fixed by me,  | \\
// | or if you would rater compile it yourself, the changed source file, at the | \\
// | following location:                                                        | \\
// |              http://www.geocities.com/teh_face_x_o/mapfix.zip              | \\
// |----------------------------------------------------------------------------| \\
// | This is a NPC that will increase the ammount that a player has in a stat   | \\
// | above the limit of 99. It is designed so that they sill need to have       | \\
// | enough Status Points to buy that ammount of stats. Uses a global variable  | \\
// | to specify the price per point. I am going to eventually add support for   | \\
// | and admin to modify this global variable by simply speaking to the NPC,    | \\
// | but getgmlevel seems to not work for me xD                                 | \\
// |----------------------------------------------------------------------------| \\
// | To install: Place this TXT file anywhere in your Athena scripts folder,    | \\
// | and include it in scripts.conf. Then add the following to save/mapreg.txt. | \\
// |----------------------------------------------------------------------------| \\
// | $statUpCost	250000                                                  | \\
// |----------------------------------------------------------------------------| \\
// | Then, change the value as you see fit. Also, by default, Athena limits the | \\
// | maximum a player can have in any one stat to 99. To change this, modify    | \\
// | the value of max_parameter in conf/battle_athena.conf.                     | \\
// |----------------------------------------------------------------------------| \\
// | Started on: Jun 22 2004                                                    | \\
// | Last Modified: Jun 26 2004                                                 | \\
// |----------------------------------------------------------------------------| \\
// | Changelog:                                                                 | \\
// | Version 0.1 - Jun 22 2004                                                  | \\
// |               Initial release                                              | \\
// | Version 0.2 - Jun 26 2004                                                  | \\
// |               Will figure out if the player has enough Status Points to    | \\
// |         buy the inputed ammount.                                           | \\
// |               Changed some of the dialog, and fixed some minor errors.     | \\
// \____________________________________________________________________________/ \\
//________________________________________________________________________________\\

prontera.gat,153,193,4	script	Stat Upper	799,{
		mes "[Tidus]";
		mes "Hey there. I'm here for one reason. To raise your stats beyond the limit of 99.";
	next;
		mes "[Tidus]";
		mes "Sounds to good to be true? Well, it isn't. There is one catch, however.";
	next;
		mes "[Tidus]";
		mes "I can't afford to offer this service for free. ^FF0)00I also cannot increase your stats unless you have enough Status Points to afford them.^000000";
	next;
		mes "[Tidus]";
		mes "So, what do you say? I charge " + $statUpCost + "z per stat point.";
	next;
	menu "Raise stats",L_Raise,"Nevermind",-;
	L_No:
		mes "[Tidus]";
		mes "Too bad. Let me know if you change your mind and decide to raise your stats.";
	close;
L_Raise:
	if(StatusPoint <= 0) goto L_NoStP;
		mes "[Tidus]";
		mes "So, what stat do you want to raise?";
	next;
	menu "Strength",L_STR,"Agility",L_AGI,"Vitality",L_VIT,"Intelligence",L_INT,"Dexterity",L_DEX,"Luck",L_LUK,"Cancel",-;
		mes "[Tidus]";
		mes "Changed you mind? See you some other time then.";
	close;
L_STR:
	set @stat,bStr;
	set @type$, "STR";
	Goto L_Give_Stats;
L_AGI:
	set @stat,bAgi;
	set @type$, "AGI";
	Goto L_Give_Stats;
L_VIT:
	set @stat,bVit;
	set @type$, "VIT";
	Goto L_Give_Stats;
L_INT:
	set @stat,bInt;
	set @type$, "INT";
	Goto L_Give_Stats;
L_DEX:
	set @stat,bDex;
	set @type$, "DEX";
	Goto L_Give_Stats;
L_LUK:
	set @stat,bLuk;
	set @type$, "LUK";
	Goto L_Give_Stats;
L_Give_Stats:
		mes "[Tidus]";
		mes "Allright, now how many " + @type$ + " points do you want?";
		mes "[Please enter a number from 1 to 10]";
	next;
	Input @ammount;
	if((@ammount < 1) || (@ammount > 10)) goto L_INV;

// Added in v0.2
// Loops to find the cost to raise the stat they chose by the ammount they chose
// Formula for 1 stat point is:
//                            ((Ammount of Stat - 1) / 10) + 2
// Another one that works to achieve the same result is:
//                            ((Ammout of Stat + 9) / 10) + 1
// The first being something I came up on my own, the second being what the
// actuall source does xD

	set @temp,readparam(@stat);
	set @lcv,0;
	set @cost,0;
L_CostLoopStart:
	if(@lcv == @ammount) goto L_CostLoopEnd;
		set @cost,@cost + (((@temp - 1) /  10) + 2);
		set @temp,@temp + 1;
		set @lcv,@lcv + 1;
	goto L_CostLoopStart;
L_CostLoopEnd:	

		mes "[Tidus]";
		mes "So, you want " + @ammount + " " + @type$ + " points?";
	next;
		mes "[Tidus]";
		mes "That will cost ^006600" + @ammount * $statUpCost + "^000000z and will require ^FF0000" + @cost + " Status Points^000000.";
	next;
		mes "[Tidus]";
		mes "Do you wish to continue?";
	next;
	menu "Yes",-,"No",L_No;
	if(zeny < @ammount * $statUpCost) Goto L_ErrZ;
	if(StatusPoint < @cost) goto L_ErrStP;
	
	set Zeny, zeny - (@ammount * $statUpCost);
	set @loop,0;
L_StatLoopStart:
	if(@loop == @ammount) Goto L_StatLoopEnd;
		Statusup @stat;
		set @loop, @loop + 1;
	goto L_StatLoopStart;
L_StatLoopEnd:

		mes "[Tidus]";
		mes "There you go. Have a nice day.";
	close;
	
L_ErrZ:
		mes "[Tidus]";
		mes "Look, you only have " + zeny + "z, but it costs " + @ammount * $statUpCost + "z to buy the stats you want.";
	next;
		mes "[Tidus]";
		mes "Come back when you have the " + ((@ammount * $statUpCost) - zeny) + "z that you lack.";
	close;
	
L_INV:
		mes "[Tidus]";
		mes "Please enter a positive number between 1 and 10 ~__~;";
	close;
	
L_NoStP:
		mes "[Tidus]";
		mes "Did you not her what I just said a minute ago? ^FF0000You need enough Status Points to buy stats, but you have NONE.^000000";
	close;
	
L_ErrStP:
		mes "[Tidus]";
		mes "You only have " + StatusPoint + " Status Points, but you need " + @cost + " to buy " + @ammount + " " + @type$ + " points.";
	next;
		mes "[Tidus]";
		mes "Come back when you have the " + (@cost - StatusPoint) + " Status Points that you lack.";
	close;
}

    Source: geocities.com/teh_face_x_o