[Lithium] MSI Npc

Results 1 to 10 of 10
  1. #1
    Member Calvin Yang is offline
    MemberRank
    Jan 2013 Join Date
    Honolulu, HawaiLocation
    69Posts

    [Lithium] MSI Npc

    The Npc works but after I logout, I check Mysql and the AP = 131072 but on Maplestory it shows 0 AP before I logged out. I was wondering how to make it so that it stays 0 and not change into 131072 when I logout.



    Here's my NPC Script:
    PHP Code:
    var status 0;  
    var 
    selected 1;  
    var 
    wui 0;  


    function 
    start() {  
    status = -1;  
    action(100);  
    }  


    function 
    action(modetypeselection) {  
    selected selection;  
    if (
    mode == -1) {  
    cm.dispose();  
    } else {  
    if (
    mode == && status == 0) {  
    cm.dispose();  
    return;  
    }  
    if (
    mode == 1)  
    status++;  
    else  
    status--;  
    if (
    status == 0) {  
    cm.sendAcceptDecline("Hey, I am the Max Stat Item NPC!#k\r\n#rPlease have these Requirements to Make a Max Stat Item: \r\n

    \r\n#b30,000 in STR,DEX,INT,LUK\r\n\r\n#b1,000 Maple Leafs\r\n\r\n#b10 Vote Points#l"
    );  
    } else if (
    status == 1) {  
    if (
    cm.getPlayer().getStat().getStr() > 29999 && cm.getPlayer().getStat().getDex() > 29999 && cm.getPlayer().getStat

    ().getInt() > 29999 && cm.getPlayer().getStat().getLuk() > 29999  && cm.getPlayer().getVPoints() >= 10 && cm.haveItem

    (40011261000)){  
    var 
    String "Please Choose your desired item or nx you want as your new MSI. Please check your Inventory to make sure you 

    have enough room because, we don't give back refunds. Enjoy!\r\n\r\n"
    ;  
    cm.sendSimple(String+cm.EquipList(cm.getC())); //isn't it cm.getPlayer().getClient() ? O.O 
    } else {  
    cm.sendOk ("You do not have the requirements.");  
    cm.dispose();   
    }  
    } else if (
    status == 2) { 
    cm.MakeGMItem(selectedcm.getPlayer()); 
    cm.gainItem(4001126, -1000);     
    cm.getPlayer().setVPoints(cm.getPlayer().getVPoints() - 10);
    cm.reloadChar();  
    cm.getPlayer().resetStats(4444);
    cm.getPlayer().resetAPSP(); 
    cm.dispose();  //I always put this on the bottom.. 
    }  
    }  

    Last edited by Calvin Yang; 30-03-13 at 12:05 PM.


  2. #2
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    Re: [Lithium] MSI Npc

    Fixed.
    PHP Code:
    var status 0
    var 
    selected 1
    var 
    wui 0


    function 
    start() { 
    status = -1
    action(100); 



    function 
    action(modetypeselection) { 
    selected selection
    if (
    mode == -1) { 
    cm.dispose(); 
    } else { 
    if (
    mode == && status == 0) { 
    cm.dispose(); 
    return; 

    if (
    mode == 1
    status++; 
    else 
    status--; 
    if (
    status == 0) { 
    cm.sendAcceptDecline("Hey, I am the Max Stat Item NPC!#k\r\n#rPlease have these Requirements to Make a Max Stat Item: \r\n\r\n#b30,000 [ STR,DEX,INT,LUK ]\r\n\r\n#b1,000 Maple Leafs\r\n\r\n#b10 Vote Points#l"); 
    } else if (
    status == 1) { 
    if (
    cm.getPlayer().getStat().getStr() > 29999 && cm.getPlayer().getStat().getDex() > 29999 && cm.getPlayer().getStat().getInt() > 29999 && cm.getPlayer().getStat().getLuk() > 29999  && cm.getPlayer().getVPoints() >= 10 && cm.haveItem(40011261000)){ 
    var 
    String "Please Choose your desired item or nx you want as your new MSI. Please check your Inventory to make sure you have enough room because, we don't give back refunds. Enjoy!\r\n\r\n"
    cm.sendSimple(String+cm.EquipList(cm.getC())); //isn't it cm.getPlayer().getClient() ? O.O
    } else { 
    cm.sendOk ("You do not have the requirements."); 
    cm.dispose();  

    } else if (
    status == 2) {
    cm.MakeGMItem(selectedcm.getP());
    cm.gainItem(4001126, -1000); 
    cm.getPlayer().resetAPSP();
    cm.getPlayer().resetStats(4444);  
    cm.reloadChar(); 
    cm.dispose();  //I always put this on the bottom..



    I'm not so sure about your variables, but after I changed them to how they work inside my source it works.
    Incase you wanted to know what variables gave me errors:
    cm.getC() - Mine is cm.getPlayer().getClient()
    cm.getPlayer().getStat().getStr() - Mine is just cm.getPlayer().getStr(), etc.
    cm.getVPoints() - Mine is cm.getVotingPoints()
    cm.getPlayer().resetAPSP() - Don't have that at all, i should add it though.
    cm.getPlayer().resetStats(4, 4, 4, 4); - Don't have that at all either, seems cool to add rather then manually updating all.

    What I changed:
    Where status >=0 && mode == 0 I swapped around to mode == 0 && status == 0 (Easier for me, plus I use this way o-o)
    in your status = 1, I made your cm.dispose() go from the top to the bottom.
    I removed all of your if (selection == 2) { stuff. Not needed plus clicking decline isn't a "selection". (At least, I don't think anyways?)

    EDIT: If this doesn't work, it's your NPCConversationManager missing the functions required inside of your NPC.

    Hope it works for you~ ;D

  3. #3
    Member Calvin Yang is offline
    MemberRank
    Jan 2013 Join Date
    Honolulu, HawaiLocation
    69Posts

    Re: [Lithium] MSI Npc

    Found the solution

    PHP Code:
    var status 0;  
    var 
    selected 1;  
    var 
    wui 0;  


    function 
    start() {  
    status = -1;  
    action(100);  
    }  


    function 
    action(modetypeselection) {  
    selected selection;  
    if (
    mode == -1) {  
    cm.dispose();  
    } else {  
    if (
    mode == && status == 0) {  
    cm.dispose();  
    return;  
    }  
    if (
    mode == 1)  
    status++;  
    else  
    status--;  
    if (
    status == 0) {  
    cm.sendAcceptDecline("Hey, I am the Max Stat Item NPC!#k\r\n#rPlease have these Requirements to Make a Max Stat Item: \r\n

    \r\n#b30,000 [ STR,DEX,INT,LUK ]\r\n\r\n#b1,000 Maple Leafs\r\n\r\n#b10 Vote Points#l"
    );  
    } else if (
    status == 1) {  
    if (
    cm.getPlayer().getStat().getStr() > 29999 && cm.getPlayer().getStat().getDex() > 29999 && cm.getPlayer().getStat

    ().getInt() > 29999 && cm.getPlayer().getStat().getLuk() > 29999  && cm.getPlayer().getVPoints() >= 10 && cm.haveItem

    (40011261000)){  
    var 
    String "Please Choose your desired item or nx you want as your new MSI. Please check your Inventory to make sure you 

    have enough room because, we don't give back refunds. Enjoy!\r\n\r\n"
    ;  
    cm.sendSimple(String+cm.EquipList(cm.getC())); //isn't it cm.getPlayer().getClient() ? O.O 
    } else {  
    cm.sendOk ("You do not have the requirements.");  
    cm.dispose();   
    }  
    } else if (
    status == 2) { 
    cm.MakeGMItem(selectedcm.getPlayer()); 
    cm.gainItem(4001126, -1000);  
    cm.getPlayer().resetAPSP(); 
    cm.getPlayer().resetStats(4444);   
    cm.reloadChar();  
    cm.getPlayer().resetAPSP(); 
    cm.dispose();  //I always put this on the bottom.. 
    }  
    }  

    For the cm.MakeGMItem(selected, cm.getP());
    it was supposed to be
    cm.MakeGMItem(selected, cm.getPlayer());

    I kinda got this script from a v83 Server so I was testing around.

  4. #4
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    Re: [Lithium] MSI Npc

    Quote Originally Posted by Calvin Yang View Post
    Found the solution

    PHP Code:
    var status 0;  
    var 
    selected 1;  
    var 
    wui 0;  


    function 
    start() {  
    status = -1;  
    action(100);  
    }  


    function 
    action(modetypeselection) {  
    selected selection;  
    if (
    mode == -1) {  
    cm.dispose();  
    } else {  
    if (
    mode == && status == 0) {  
    cm.dispose();  
    return;  
    }  
    if (
    mode == 1)  
    status++;  
    else  
    status--;  
    if (
    status == 0) {  
    cm.sendAcceptDecline("Hey, I am the Max Stat Item NPC!#k\r\n#rPlease have these Requirements to Make a Max Stat Item: \r\n

    \r\n#b30,000 [ STR,DEX,INT,LUK ]\r\n\r\n#b1,000 Maple Leafs\r\n\r\n#b10 Vote Points#l"
    );  
    } else if (
    status == 1) {  
    if (
    cm.getPlayer().getStat().getStr() > 29999 && cm.getPlayer().getStat().getDex() > 29999 && cm.getPlayer().getStat

    ().getInt() > 29999 && cm.getPlayer().getStat().getLuk() > 29999  && cm.getPlayer().getVPoints() >= 10 && cm.haveItem

    (40011261000)){  
    var 
    String "Please Choose your desired item or nx you want as your new MSI. Please check your Inventory to make sure you 

    have enough room because, we don't give back refunds. Enjoy!\r\n\r\n"
    ;  
    cm.sendSimple(String+cm.EquipList(cm.getC())); //isn't it cm.getPlayer().getClient() ? O.O 
    } else {  
    cm.sendOk ("You do not have the requirements.");  
    cm.dispose();   
    }  
    } else if (
    status == 2) { 
    cm.MakeGMItem(selectedcm.getPlayer()); 
    cm.gainItem(4001126, -1000);  
    cm.getPlayer().resetAPSP(); 
    cm.getPlayer().resetStats(4444);   
    cm.reloadChar();  
    cm.getPlayer().resetAPSP(); 
    cm.dispose();  //I always put this on the bottom.. 
    }  
    }  

    For the cm.MakeGMItem(selected, cm.getP());
    it was supposed to be
    cm.MakeGMItem(selected, cm.getPlayer());

    I kinda got this script from a v83 Server so I was testing around.
    Yeah, I thought it was one of your NPCConversationManager functions xD
    What's weird for me is I actually somehow had cm.getP(), never knew I had that..

  5. #5
    Member Calvin Yang is offline
    MemberRank
    Jan 2013 Join Date
    Honolulu, HawaiLocation
    69Posts

    Re: [Lithium] MSI Npc

    Yeah I was checking the errors and I was like hmm..... cm.getP..... P could stand for Player. So then I added that and it worked xD

  6. #6
    Member Calvin Yang is offline
    MemberRank
    Jan 2013 Join Date
    Honolulu, HawaiLocation
    69Posts

    Re: [Lithium] MSI Npc

    Updated, need further assist. Can't get AP to stay 0 because it turns into 131072 in the Mysql when I logout.

  7. #7
    Member mixta11 is offline
    MemberRank
    Jan 2012 Join Date
    UKLocation
    56Posts

    Re: [Lithium] MSI Npc

    im not on a v117 server for msi or anything, but i did a little maths into your problem, it appears that if you divide 131072 by 4 you get 32768.
    is this not adding all the stats into ap after a relog? just a query
    PHP Code:
    var status 0;  
    var 
    selected 1;  
    var 
    wui 0;  


    function 
    start() {  
    status = -1;  
    action(100);  
    }  


    function 
    action(modetypeselection) {  
    selected selection;  
    if (
    mode == -1) {  
    cm.dispose();  
    } else {  
    if (
    mode == && status == 0) {  
    cm.dispose();  
    return;  
    }  
    if (
    mode == 1)  
    status++;  
    else  
    status--;  
    if (
    status == 0) {  
    cm.sendAcceptDecline("Hey, I am the Max Stat Item NPC!#k\r\n#rPlease have these Requirements to Make a Max Stat Item: \r\n

    \r\n#b30,000 [ STR,DEX,INT,LUK ]\r\n\r\n#b1,000 Maple Leafs\r\n\r\n#b10 Vote Points#l"
    );  
    } else if (
    status == 1) {  
    if (
    cm.getPlayer().getStat().getStr() > 29999 && cm.getPlayer().getStat().getDex() > 29999 && cm.getPlayer().getStat

    ().getInt() > 29999 && cm.getPlayer().getStat().getLuk() > 29999  && cm.getPlayer().getVPoints() >= 10 && cm.haveItem

    (40011261000)){  
    var 
    String "Please Choose your desired item or nx you want as your new MSI. Please check your Inventory to make sure you 

    have enough room because, we don't give back refunds. Enjoy!\r\n\r\n"
    ;  
    cm.sendSimple(String+cm.EquipList(cm.getC())); //isn't it cm.getPlayer().getClient() ? O.O 
    } else {  
    cm.sendOk ("You do not have the requirements.");  
    cm.dispose();   
    }  
    } else if (
    status == 2) { 
    cm.MakeGMItem(selectedcm.getPlayer()); 
    cm.gainItem(4001126, -1000);   
    cm.getPlayer().resetStats(4444);     
    cm.getPlayer().resetAPSP(); 
    cm.reloadChar();
    cm.dispose();  //I always put this on the bottom.. 
    }  
    }  

    just a test, dunno if it will work but try it...

  8. #8
    Member Calvin Yang is offline
    MemberRank
    Jan 2013 Join Date
    Honolulu, HawaiLocation
    69Posts

    Re: [Lithium] MSI Npc

    Quote Originally Posted by mixta11 View Post
    im not on a v117 server for msi or anything, but i did a little maths into your problem, it appears that if you divide 131072 by 4 you get 32768.
    is this not adding all the stats into ap after a relog? just a query
    PHP Code:
    var status 0;  
    var 
    selected 1;  
    var 
    wui 0;  


    function 
    start() {  
    status = -1;  
    action(100);  
    }  


    function 
    action(modetypeselection) {  
    selected selection;  
    if (
    mode == -1) {  
    cm.dispose();  
    } else {  
    if (
    mode == && status == 0) {  
    cm.dispose();  
    return;  
    }  
    if (
    mode == 1)  
    status++;  
    else  
    status--;  
    if (
    status == 0) {  
    cm.sendAcceptDecline("Hey, I am the Max Stat Item NPC!#k\r\n#rPlease have these Requirements to Make a Max Stat Item: \r\n

    \r\n#b30,000 [ STR,DEX,INT,LUK ]\r\n\r\n#b1,000 Maple Leafs\r\n\r\n#b10 Vote Points#l"
    );  
    } else if (
    status == 1) {  
    if (
    cm.getPlayer().getStat().getStr() > 29999 && cm.getPlayer().getStat().getDex() > 29999 && cm.getPlayer().getStat

    ().getInt() > 29999 && cm.getPlayer().getStat().getLuk() > 29999  && cm.getPlayer().getVPoints() >= 10 && cm.haveItem

    (40011261000)){  
    var 
    String "Please Choose your desired item or nx you want as your new MSI. Please check your Inventory to make sure you 

    have enough room because, we don't give back refunds. Enjoy!\r\n\r\n"
    ;  
    cm.sendSimple(String+cm.EquipList(cm.getC())); //isn't it cm.getPlayer().getClient() ? O.O 
    } else {  
    cm.sendOk ("You do not have the requirements.");  
    cm.dispose();   
    }  
    } else if (
    status == 2) { 
    cm.MakeGMItem(selectedcm.getPlayer()); 
    cm.gainItem(4001126, -1000);   
    cm.getPlayer().resetStats(4444);     
    cm.getPlayer().resetAPSP(); 
    cm.reloadChar();
    cm.dispose();  //I always put this on the bottom.. 
    }  
    }  

    just a test, dunno if it will work but try it...
    Didn't work, I still get the 131072 ap when I logout and do a refresh in the Mysql

    Here's my
    public void resetAPSP() {
    PHP Code:
    public void resetAPSP() {
            
    resetSP(0);
            
    gainAp((short) -this.remainingAp);
        } 

  9. #9
    Sorcerer Supreme hecari is offline
    Member +Rank
    Dec 2008 Join Date
    336Posts

    Re: [Lithium] MSI Npc

    Quote Originally Posted by Calvin Yang View Post
    Didn't work, I still get the 131072 ap when I logout and do a refresh in the Mysql

    Here's my
    public void resetAPSP() {
    PHP Code:
    public void resetAPSP() {
            
    resetSP(0);
            
    gainAp((short) -this.remainingAp);
        } 
    Why reset your AP and remove it while you can try setting your AP to 4,4,4,4. Instead of resetting the stats, make a function to set your whole STR,DEX,INT,LUK.

    Based on ExiledDEV v117 MapleCharacter.java, assuming that it's Lithium-Based.

    ADD INTO MAPLECHARACTER.JAVA
    PHP Code:
    public final void setAllStats(int amount) {
             
    this.str amount;
             
    this.dex amount;
             
    this.int_ amount;
             
    this.luk amount;
             
    stats.recalcLocalStats(this);

    NPC SCRIPT:
    PHP Code:
    var status 0;  
    var 
    selected 1;  
    var 
    wui 0;  


    function 
    start() {  
    status = -1;  
    action(100);  
    }  


    function 
    action(modetypeselection) {  
    selected selection;  
    if (
    mode == -1) {  
    cm.dispose();  
    } else {  
    if (
    mode == && status == 0) {  
    cm.dispose();  
    return;  
    }  
    if (
    mode == 1)  
    status++;  
    else  
    status--;  
    if (
    status == 0) {  
    cm.sendAcceptDecline("Hey, I am the Max Stat Item NPC!#k\r\n#rPlease have these Requirements to Make a Max Stat Item: \r\n

    \r\n#b30,000 in STR,DEX,INT,LUK\r\n\r\n#b1,000 Maple Leafs\r\n\r\n#b10 Vote Points#l"
    );  
    } else if (
    status == 1) {  
    if (
    cm.getPlayer().getStat().getStr() > 29999 && cm.getPlayer().getStat().getDex() > 29999 && cm.getPlayer().getStat

    ().getInt() > 29999 && cm.getPlayer().getStat().getLuk() > 29999  && cm.getPlayer().getVPoints() >= 10 && cm.haveItem

    (40011261000)){  
    var 
    String "Please Choose your desired item or nx you want as your new MSI. Please check your Inventory to make sure you 

    have enough room because, we don't give back refunds. Enjoy!\r\n\r\n"
    ;  
    cm.sendSimple(String+cm.EquipList(cm.getC())); //isn't it cm.getPlayer().getClient() ? O.O 
    } else {  
    cm.sendOk ("You do not have the requirements.");  
    cm.dispose();   
    }  
    } else if (
    status == 2) { 
    cm.MakeGMItem(selectedcm.getPlayer()); 
    cm.gainItem(4001126, -1000);     
    cm.getPlayer().setVPoints(cm.getPlayer().getVPoints() - 10); 
    cm.getPlayer().setAllStats(4); // set all your stats to 4 without giving any AP to remainingAP.
    cm.getPlayer().resetSP(0); 
    cm.reloadChar(); 
    cm.dispose();  //I always put this on the bottom.. 
    }  
    }  

    Last edited by hecari; 30-03-13 at 08:52 PM.

  10. #10
    Member Calvin Yang is offline
    MemberRank
    Jan 2013 Join Date
    Honolulu, HawaiLocation
    69Posts

    Re: [Lithium] MSI Npc

    Quote Originally Posted by hecari View Post
    Why reset your AP and remove it while you can try setting your AP to 4,4,4,4. Instead of resetting the stats, make a function to set your whole STR,DEX,INT,LUK.

    Based on ExiledDEV v117 MapleCharacter.java, assuming that it's Lithium-Based.

    ADD INTO MAPLECHARACTER.JAVA
    PHP Code:
    public final void setAllStats(int amount) {
             
    this.str amount;
             
    this.dex amount;
             
    this.int_ amount;
             
    this.luk amount;
             
    stats.recalcLocalStats(this);

    NPC SCRIPT:
    PHP Code:
    var status 0;  
    var 
    selected 1;  
    var 
    wui 0;  


    function 
    start() {  
    status = -1;  
    action(100);  
    }  


    function 
    action(modetypeselection) {  
    selected selection;  
    if (
    mode == -1) {  
    cm.dispose();  
    } else {  
    if (
    mode == && status == 0) {  
    cm.dispose();  
    return;  
    }  
    if (
    mode == 1)  
    status++;  
    else  
    status--;  
    if (
    status == 0) {  
    cm.sendAcceptDecline("Hey, I am the Max Stat Item NPC!#k\r\n#rPlease have these Requirements to Make a Max Stat Item: \r\n

    \r\n#b30,000 in STR,DEX,INT,LUK\r\n\r\n#b1,000 Maple Leafs\r\n\r\n#b10 Vote Points#l"
    );  
    } else if (
    status == 1) {  
    if (
    cm.getPlayer().getStat().getStr() > 29999 && cm.getPlayer().getStat().getDex() > 29999 && cm.getPlayer().getStat

    ().getInt() > 29999 && cm.getPlayer().getStat().getLuk() > 29999  && cm.getPlayer().getVPoints() >= 10 && cm.haveItem

    (40011261000)){  
    var 
    String "Please Choose your desired item or nx you want as your new MSI. Please check your Inventory to make sure you 

    have enough room because, we don't give back refunds. Enjoy!\r\n\r\n"
    ;  
    cm.sendSimple(String+cm.EquipList(cm.getC())); //isn't it cm.getPlayer().getClient() ? O.O 
    } else {  
    cm.sendOk ("You do not have the requirements.");  
    cm.dispose();   
    }  
    } else if (
    status == 2) { 
    cm.MakeGMItem(selectedcm.getPlayer()); 
    cm.gainItem(4001126, -1000);     
    cm.getPlayer().setVPoints(cm.getPlayer().getVPoints() - 10); 
    cm.getPlayer().setAllStats(4); // set all your stats to 4 without giving any AP to remainingAP.
    cm.getPlayer().resetSP(0); 
    cm.reloadChar(); 
    cm.dispose();  //I always put this on the bottom.. 
    }  
    }  

    Just fixed it, thanks for this though.

    What I did was this :
    PHP Code:
    public void resetStats(final int str, final int dex, final int int_, final int luk) {
            
    Map<MapleStatIntegerstat = new EnumMap<MapleStatInteger>(MapleStat.class);
            
    int total stats.getStr() + stats.getDex() + stats.getLuk() + stats.getInt() + getRemainingAp();

            
    total -= str;
            
    stats.str = (shortstr;

            
    total -= dex;
            
    stats.dex = (shortdex;

            
    total -= int_;
            
    stats.int_ = (shortint_;

            
    total -= luk;
            
    stats.luk = (shortluk;

            
    gainApBank(total);
            
    stats.recalcLocalStats(this);
            
    stat.put(MapleStat.STRstr);
            
    stat.put(MapleStat.DEXdex);
            
    stat.put(MapleStat.INTint_);
            
    stat.put(MapleStat.LUKluk);
            
    client.getSession().write(CWvsContext.updatePlayerStats(statfalsethis));
        } 



Advertisement