Complete Stat Reset Player Command

Newbie Spellweaver
Joined
Aug 21, 2008
Messages
18
Reaction score
0
Once again im sure this has been released before but seeing as how i cant find one here it is! =)

Insert it into your commandprocesser and it'l work perfectly

Code:
else if (splitted[0].equals("@resetstats")) {
	int Dex = player.getDex();
	int Int = player.getInt();
	int Str = player.getStr();
	int Luk = player.getLuk();
	int newStat = player.getRemainingAp() + Dex + Int + Str + Luk - 16

	player.setRemainingAp(newStat);
	player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
	player.setDex(4);
	player.setInt(4);
	player.setStr(4);
	player.setLuk(4);
	player.updateSingleStat(MapleStat.DEX, player.getDex());
	player.updateSingleStat(MapleStat.INT, player.getInt());
	player.updateSingleStat(MapleStat.STR, player.getStr());
	player.updateSingleStat(MapleStat.LUK, player.getLuk());
	mc.dropMessage("Your Stats has been reset. please note that some equips may not work because your stats have changed.");

}
 
Last edited:
If you're gonna use these
Code:
	int Dex = player.getDex();
	int Int = player.getInt();
	int Str = player.getStr();
	int Luk = player.getLuk();
Why not use them here as well?
Code:
	player.updateSingleStat(MapleStat.DEX, player.getDex());
	player.updateSingleStat(MapleStat.INT, player.getInt());
	player.updateSingleStat(MapleStat.STR, player.getStr());
	player.updateSingleStat(MapleStat.LUK, player.getLuk());
 
this will give you lots of errors, i suggest cleaning this up a little

No, this works.

THis is my way of doing it. No need to have one in npcconversationmanager anymore
PHP:
    public void resetStats() {
        int totAp = getRemainingAp() + getStr() + getDex() + getInt() + getLuk();
        setStr(4);
        setDex(4);
        setInt(4);
        setLuk(4);
        setRemainingAp(totAp - 16);
        updateSingleStat(MapleStat.STR, 4);
        updateSingleStat(MapleStat.DEX, 4);
        updateSingleStat(MapleStat.LUK, 4);
        updateSingleStat(MapleStat.INT, 4);
        updateSingleStat(MapleStat.AVAILABLEAP, getRemainingAp());
    }
GM Command
PHP:
else if (splitted[0].equals("!resetstats")) {
			player.resetStats();
			mc.dropMessage("Done");
		}
NPC
PHP:
cm.getChar().resetStats();
 
If you're gonna use these
Code:
	int Dex = player.getDex();
	int Int = player.getInt();
	int Str = player.getStr();
	int Luk = player.getLuk();
Why not use them here as well?
Code:
	player.updateSingleStat(MapleStat.DEX, player.getDex());
	player.updateSingleStat(MapleStat.INT, player.getInt());
	player.updateSingleStat(MapleStat.STR, player.getStr());
	player.updateSingleStat(MapleStat.LUK, player.getLuk());

dont really get what your trieing to say there o.o
EDIT: OH i see what you mean now, i used them above because of the newStat integer but didnt think about using them below i wasnt paying attention.
 
player.setRemainingAp(newStat);
should be

player.setRemainingAp(getRemainingAp + newStat);

Not it shouldn't.

Cleaned up your command
PHP:
else if (splitted[0].equals("@resetstats")) {
	int newStat = player.getDex() + player.getInt() + player.getStr() + player.getLuk() - 16;
	player.setRemainingAp(newStat);
	player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
	player.setDex(4);
	player.setInt(4);
	player.setStr(4);
	player.setLuk(4);
	player.updateSingleStat(MapleStat.DEX, 4);
	player.updateSingleStat(MapleStat.INT, 4);
	player.updateSingleStat(MapleStat.STR, 4);
	player.updateSingleStat(MapleStat.LUK, 4);
	mc.dropMessage("Your stats has been reset. Please note that some equips may not work because your stats have changed.");
}
 
No, this works.

THis is my way of doing it. No need to have one in npcconversationmanager anymore
PHP:
    public void resetStats() {
        int totAp = getRemainingAp() + getStr() + getDex() + getInt() + getLuk();
        setStr(4);
        setDex(4);
        setInt(4);
        setLuk(4);
        setRemainingAp(totAp - 16);
        updateSingleStat(MapleStat.STR, 4);
        updateSingleStat(MapleStat.DEX, 4);
        updateSingleStat(MapleStat.LUK, 4);
        updateSingleStat(MapleStat.INT, 4);
        updateSingleStat(MapleStat.AVAILABLEAP, getRemainingAp());
    }
GM Command
PHP:
else if (splitted[0].equals("!resetstats")) {
			player.resetStats();
			mc.dropMessage("Done");
		}
NPC
PHP:
cm.getChar().resetStats();

Gee i feel special the great moogra answered :D
Just a beginning java coder here i didn;t realise that you can also use commands from the npc conversation manager in the command processer. learnin something new with every post :D
 
yes i realise that now. thanks for pointing it out :D
Still learning :D

He's not right.
I'm not coding with an IDE or even notepad. I'm typing right in the box so there's going to be errors.
I'm not using NPCConversationManager but I guess I could...

edit:
I messed up because you messed up in your first post. I was cleaning up your code.
 
edit:
I messed up because you messed up in your first post. I was cleaning up your code.

i like how you messed up because i messed up o.o
although surprisingly enough i havnt gotten any errors lol

moogra add me i wish to learn from your wisdom =P lols
 
repeat the question? that made no sense to me at all o.o

i mean if i have dex , str , luk , int all max stats like 32767
wad if i do @apreset
and the max ap i can have is 32767
and 32767 x 4 is already too much and all of them will be wasted? or we cant reset ap o_o
 
i mean if i have dex , str , luk , int all max stats like 32767
wad if i do @apreset
and the max ap i can have is 32767
and 32767 x 4 is already too much and all of them will be wasted? or we cant reset ap o_o

if you do that the available AP box will be some random number but youll still have that same Ap that was applied to you stats to use, although you would just have to put it all back into the stats again (which takes a while without the @<stat> command if you know hwat i mean =P
 
Back