Use npc to fix negative exp, no need edit .java

Newbie Spellweaver
Joined
Jul 30, 2008
Messages
16
Reaction score
0
Here is the edited one, thanks to those guy that encourage me. The reason i release it because there is alot of people using repack and dont have @exp command. The formatting of the java script is like this without indent and outdent is that it is hard to set here.

* Changes- Remove the add level and add ap, it set exp to 0 when it is negative.

* Any Kind soul can teach me how to format the script nicely here, as i paste from my netbean it look ok but here all the formating change.

The code do work for goodness say for those saying what syntax error. I do make the mistake of forgeting 2 semicolon.

Hi all, this may be a bit outdated release for some of you,
but someone may need this especially those using repack
that dont have the @exp command.

This npc script that let u reset stats as well as fix negative exp
(Check if exp is negative, if negative set to 0). Prompt you
dont have negative exp if that person is trying to fix negative exp.

Feel free to edit this. This is my first npc script that i have done.
This actually my 2101.js for heena and place her in my fm. You
can copy the whole code and put in other npc that you like.

Code:
/*
	This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <[email protected]> 
                       Matthias Butz <[email protected]>
                       Jan Christian Meyer <[email protected]>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/*
======>Heena npcid 2001<======
*/



function start() {
	cm.sendSimple ("\r\n#L0#Reset your Stats!#l\r\n#L1#Fix your negative EXP!");
}

function action(mode, type, selection) {
	cm.dispose();
        
	if (selection == 0) {
                          var p = cm.c.getPlayer();
		var statup = new java.util.ArrayList();
		var totAp = p.getRemainingAp() + p.getStr() + p.getDex() + p.getInt() + p.getLuk();
		p.setStr(4);
		p.setDex(4);
		p.setInt(4);
		p.setLuk(4);
		p.setRemainingAp (totAp);
		statup.add (new net.sf.odinms.tools.Pair(net.sf.odinms.client.MapleStat.STR, java.lang.Integer.valueOf(4)));
		statup.add (new net.sf.odinms.tools.Pair(net.sf.odinms.client.MapleStat.DEX, java.lang.Integer.valueOf(4)));
		statup.add (new net.sf.odinms.tools.Pair(net.sf.odinms.client.MapleStat.LUK, java.lang.Integer.valueOf(4)));
		statup.add (new net.sf.odinms.tools.Pair(net.sf.odinms.client.MapleStat.INT, java.lang.Integer.valueOf(4)));
		statup.add (new net.sf.odinms.tools.Pair(net.sf.odinms.client.MapleStat.AVAILABLEAP, java.lang.Integer.valueOf(p.getRemainingAp())));
                statup.add (new net.sf.odinms.tools.Pair(net.sf.odinms.client.MapleStat.EXP, java.lang.Integer.valueOf(0)));
		p.getClient().getSession().write (net.sf.odinms.tools.MaplePacketCreator.updatePlayerStats(statup));
		cm.dispose;
	} else if (selection == 1) {
                var p = cm.c.getPlayer();
                var exp = p.getExp();
                if( exp < 0) {
                	var statup = new java.util.ArrayList();                         
                	statup.add (new net.sf.odinms.tools.Pair(net.sf.odinms.client.MapleStat.EXP, java.lang.Integer.valueOf(0)));
                	p.getClient().getSession().write (net.sf.odinms.tools.MaplePacketCreator.updatePlayerStats(statup));
                	cm.dispose();
                }else{
                cm.sendOk("You Dont have negative exp");
                cm.dispose();
                }
                 
        }else{
                cm.dispose();
	}
}
 
Last edited:
Re: [RELEASE] Use npc to fix negative exp, no need edit .java

This will never work, why? }else{ should be } else { and it's in Quotes. not in
Code:
 format.
 
Re: [RELEASE] Use npc to fix negative exp, no need edit .java

This won't work. I agree with thisisakevin. 100% FAIL
 
Re: [RELEASE] Use npc to fix negative exp, no need edit .java

Lol java is supposed to be organized but this is a total mess.
 
Re: [RELEASE] Use npc to fix negative exp, no need edit .java

*Added to the great big book of phailures*
 
Re: [RELEASE] Use npc to fix negative exp, no need edit .java

This will never work, why? }else{ should be } else { and it's in Quotes. not in
Code:
 format.[/QUOTE]

You obviously don't know that java is NOT space/line oriented. It doesn't matter if everything is on one line, or if there's 3 lines inbetween each line. It doesn't matter if it's } else { or }else{ or }
else
  {.

And he forgot some semicolons, lulz
 
Re: [RELEASE] Use npc to fix negative exp, no need edit .java

i have the negative fix part o.O anyone needs? Lol! guys, at least he tried right? (:
 
Re: [RELEASE] Use npc to fix negative exp, no need edit .java

the (exp < 0 or something like that should be exp > -1 if i am not wrong check out mine, mine is even more simple this has been released twice 1 by me and 1 by Mooblar if i am u i rather use the @exp command
 
Re: [RELEASE] Use npc to fix negative exp, no need edit .java

lol semi-colons.

Seriously this is the only important part
PHP:
statup.add (new net.sf.odinms.tools.Pair(net.sf.odinms.client.MapleStat.AVAILABLEAP, java.lang.Integer.valueOf(p.getRemainingAp())));
statup.add (new net.sf.odinms.tools.Pair(net.sf.odinms.client.MapleStat.EXP, java.lang.Integer.valueOf(0)));
p.getClient().getSession().write (net.sf.odinms.tools.MaplePacketCreator.updatePlayerStats(statup));
 
Re: [RELEASE] Use npc to fix negative exp, no need edit .java

Cant we just use
PHP:
if (exp < 0) {
     cm.getPlayer().gainExp(-exp, false, false);
     cm.dispose();
}

for the exp fix?
Sorry if it's wrong.. i'm lousy at these things..
 
Re: [RELEASE] Use npc to fix negative exp, no need edit .java

hmmm maybe it'll be better if it was gainExp(exp,false,false) but I guess if you're exp is below 1.13b, that'll work. You want to gain the absolute value of teh exp you have right now, which is negative.
 
Re: [RELEASE] Use npc to fix negative exp, no need edit .java

now now ppl...
at least give some encouraging words to let him try to improve better in coding..
not just shoot him and kill him...
how are we suppose to get good coders like this... lol
 
Back