Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

@str @int @dex @luk resets ap *UPDATED*

Experienced Elementalist
Joined
Jul 26, 2008
Messages
280
Reaction score
0
I've been working on this project of reducing ap with @str @int @dex @luk commands lately and i've got the basic idea of how it should work. However, I wasn't successful because it is almost impossible to combine the resetting ap command and the adding ap command together. I have given up hope on this one, so, here is where I stopped. For those of you who want to further improve this command feel free to but remember to give me credits for the base script.
Code:
} else if (splitted[0].equals("@str")) {
                   int up;
                    up = Integer.parseInt(splitted[1]);
                    if (up > 0 && player.getRemainingAp() >= up &&  player.getRemainingAp() > 0 && player.getStr() < 31000) {
                          player.setStr(player.getStr() + up);
                          player.setRemainingAp(player.getRemainingAp() - up);
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                          player.updateSingleStat(MapleStat.STR, player.getStr());
                    } else {
                        mc.dropMessage("Insufficient AP or above the 31000 limit");
                    if ( up < 0 && player.getStr() >= 4 && player.getStr() + up >= 4 && player.getStr() > -up) {
                          player.setStr(player.getStr() + up);
                          player.setRemainingAp(player.getRemainingAp() -up);
                          player.updateSingleStat(MapleStat.STR, player.getStr());
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                    } else {
                          mc.dropMessage("Not enough str to reset or reached minimum str.");
                        
                }
                    }
                }else if (splitted[0].equals("@int")) {
                   int up;
                    up = Integer.parseInt(splitted[1]);
                    if (up > 0 && player.getRemainingAp() >= up &&  player.getRemainingAp() > 0 && player.getInt() < 31000) {
                          player.setInt(player.getInt() + up);
                          player.setRemainingAp(player.getRemainingAp() - up);
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                          player.updateSingleStat(MapleStat.INT, player.getInt());
                    } else {
                        mc.dropMessage("Insufficient AP or above the 31000 limit");
                    if ( up < 0 && player.getInt() >= 4 && player.getInt() + up >= 4 && player.getInt() > -up) {
                          player.setInt(player.getInt() + up);
                          player.setRemainingAp(player.getRemainingAp() -up);
                          player.updateSingleStat(MapleStat.INT, player.getInt());
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                    } else {
                          mc.dropMessage("Not enough int to reset or reached minimum int.");
                }
                    }
                    //DEX
                }else if (splitted[0].equals("@dex")) {
                   int up;
                    up = Integer.parseInt(splitted[1]);
                    if (up > 0 && player.getRemainingAp() >= up &&  player.getRemainingAp() > 0 && player.getDex() < 31000) {
                          player.setDex(player.getDex() + up);
                          player.setRemainingAp(player.getRemainingAp() - up);
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                          player.updateSingleStat(MapleStat.DEX, player.getDex());
                    } else {
                        mc.dropMessage("Insufficient AP or above the 31000 limit");
                    if ( up < 0 && player.getDex() >= 4 && player.getDex() + up >= 4 && player.getDex() > -up) {
                          player.setDex(player.getDex() + up);
                          player.setRemainingAp(player.getRemainingAp() -up);
                          player.updateSingleStat(MapleStat.DEX, player.getDex());
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                    } else {
                          mc.dropMessage("Not enough dex to reset or reached minimum dex.");
                }
                    }
                    //LUCK
                }else if (splitted[0].equals("@luk")) {
                   int up;
                    up = Integer.parseInt(splitted[1]);
                    if (up > 0 && player.getRemainingAp() >= up &&  player.getRemainingAp() > 0 && player.getLuk() < 31000) {
                          player.setLuk(player.getLuk() + up);
                          player.setRemainingAp(player.getRemainingAp() - up);
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                          player.updateSingleStat(MapleStat.LUK, player.getLuk());
                    } else {
                        mc.dropMessage("Insufficient AP or above the 31000 limit");
                    if ( up < 0 && player.getLuk() >= 4 && player.getLuk() + up >= 4 && player.getLuk() > -up) {
                          player.setLuk(player.getLuk() + up);
                          player.setRemainingAp(player.getRemainingAp() -up);
                          player.updateSingleStat(MapleStat.LUK, player.getLuk());
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                    } else {
                          mc.dropMessage("Not enough luk to reset or reached minimum luk.");
                }
                    }
                }
How this works? It is an add-on to the @str @int @dex @luk command, except this one enables you to do @str -5 @int -192 @dex -54 @luk -73 and etc to reset stats. But this one is abit buggy because it can make you have negative stats and ap which I have no idea how to fix -.- So feel free to improve this to those who want to. I still recommend my previous version of it. Heres the other version of it. It is basically a separate command since I can't combine it together.
Code:
} else if (splitted[0].equals("@resetstr")) {
                   int down;
                    down = Integer.parseInt(splitted[1]);
                    if ( player.getStr() < 4 || player.getStr() - down <= 4) {
                        mc.dropMessage("Reached minimum str.");
                    } else if ( player.getStr() < down) {
                        mc.dropMessage("Not enough str to reset");
                    } else {
                          player.setStr(player.getStr() - down);
                          player.setRemainingAp(player.getRemainingAp() + down);
                          player.updateSingleStat(MapleStat.STR, player.getStr());
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                }
                    //INT 
                }else if (splitted[0].equals("@resetint")) {
                   int down;
                    down = Integer.parseInt(splitted[1]);
                    if ( player.getInt() < 4 || player.getInt() - down <= 4) {
                        mc.dropMessage("Reached minimum int.");
                    } else if ( player.getInt() < down) {
                        mc.dropMessage("Not enough int to reset");
                    } else {
                          player.setInt(player.getInt() - down);
                          player.setRemainingAp(player.getRemainingAp() + down);
                          player.updateSingleStat(MapleStat.INT, player.getInt());
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                }
                    //DEX
                }else if (splitted[0].equals("@resetdex")) {
                   int down;
                    down = Integer.parseInt(splitted[1]);
                    if ( player.getDex() < 4 || player.getDex() - down <= 4) {
                        mc.dropMessage("Reached minimum dex.");
                    } else if ( player.getDex() < down) {
                        mc.dropMessage("Not enough dex to reset");
                    } else {
                          player.setDex(player.getDex() - down);
                          player.setRemainingAp(player.getRemainingAp() + down);
                          player.updateSingleStat(MapleStat.DEX, player.getDex());
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                }
                    //LUCK
                }else if (splitted[0].equals("@resetluk")) {
                   int down;
                    down = Integer.parseInt(splitted[1]);
                    if ( player.getLuk() < 4 || player.getLuk() - down <= 4) {
                        mc.dropMessage("Reached minimum luk.");
                    } else if ( player.getLuk() < down) {
                        mc.dropMessage("Not enough luk to reset");
                    } else {
                          player.setLuk(player.getLuk() - down);
                          player.setRemainingAp(player.getRemainingAp() + down);
                          player.updateSingleStat(MapleStat.LUK, player.getLuk());
                          player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
                }
*EDIT* PARTIALLY FIXED. Changing || to && fixes the negative stats problem somehow.. However you still can get negative ap.
 
Initiate Mage
Joined
May 12, 2008
Messages
2
Reaction score
0
Re: [Release] @str @int @dex @luk resets ap

soucre ? titan ?
 
Supreme Arcanarch
Loyal Member
Joined
Jul 21, 2008
Messages
969
Reaction score
1
Re: [Release] @str @int @dex @luk resets ap

Ok. Ima see what i can make out of it. Thanks anyway.

Odin
 
Experienced Elementalist
Joined
Jul 26, 2008
Messages
280
Reaction score
0
Re: [Release] @str @int @dex @luk resets ap

Changing the || to && in
Code:
if (up > 0 || player.getRemainingAp() >= up ||  player.getRemainingAp() > 0 || player.getStr() < 31000) {
MIGHT work. Not sure though.
 
Experienced Elementalist
Joined
Jul 8, 2008
Messages
246
Reaction score
0
Re: [Release] @str @int @dex @luk resets ap

Changing the || to && in
Code:
if (up > 0 || player.getRemainingAp() >= up ||  player.getRemainingAp() > 0 || player.getStr() < 31000) {
MIGHT work. Not sure though.

they mean the same thing,
 
Experienced Elementalist
Joined
Jul 26, 2008
Messages
280
Reaction score
0
Re: [Release] @str @int @dex @luk resets ap

Yeah I know but using || doesn't work although the script looks perfectly fine so maybe using && will work.
 
Experienced Elementalist
Joined
Jul 26, 2008
Messages
280
Reaction score
0
Re: [Release] @str @int @dex @luk resets ap

IT WORKS ! Only partially though. Changing it to && solves the negative stats problem but there is still the negative ap problem. Player can get 10000 str if they do @str 10000 although they don't have 10000 ap. Then they will just have -10000 ap.
 
Initiate Mage
Joined
Aug 14, 2008
Messages
1
Reaction score
0
Re: [Release] @str @int @dex @luk resets ap *UPDATED*

where do I put the code in?
 
Elite Diviner
Loyal Member
Joined
Apr 30, 2008
Messages
414
Reaction score
0
Re: [Release] @str @int @dex @luk resets ap *UPDATED*

Looks interesting.
 
Back
Top