[NPC]Skill book NPC

Results 1 to 13 of 13
  1. #1
    Account Upgraded | Title Enabled! blkancientss is offline
    MemberRank
    Oct 2009 Join Date
    248Posts

    [NPC]Skill book NPC

    Ok guys. I coded this over a time of 2 days. It was a pain in the ass you could say but here it is. Because im to stupid to get normal skill books using i made this.

    NPC:
    PHP Code:
    //Coded by blkancients of RaGEZONE. Also Hero of SimpleMS.
    var status 0;
    var 
    random Math.floor(Math.random() * 101);
    var 
    0;
    var 
    skillSelected 0;
    var 
    jobMessage "These are the skills you can master.";
    var 
    job 0;
    var 
    aFound 0;
    var 
    bookMessage "These are the books you can use. ";
    var 
    jobs = [112,122,132,212,222,232,312,322,412,422,522,512,2112];
    var 
    masteryBooks = [
    [
    //Start Hero
              
    [2290002,2290003], //HERO Achilles
              
    [2290008,2290009],//HERO Advanced Combo
              
    [2290014,2290015],//Hero Guardian
              
    [2290010,2290011],//Hero Brandish
              
    [2290016,2290017],//Hero Enrage
              
    [2290096,2290125],//Hero Maple Hero
              
    [2290000,2290001],//Hero Monster Magnet
              
    [2290004,2290005],//Hero Rush
              
    [2290006,2290007]//Hero Power Stance
    ],//End HERO
    [//Start Paladin
              
    [2290002,2290003],//Paladin Achilles
              
    [2290012,2290013],//Paladin Blast
              
    [2290014,2290015],//Paladin Guardian
              
    [2290019],//Paladin Divine Charage
              
    [2290018],//Paladin Holy Charge
              
    [2290096,2290125],//Paladin Maple Hero
              
    [2290000,2290001],//Paladin Monster Magnet
              
    [2290004,2290005],//Paladin Rush
              
    [2290020,2290021],//Paladin Heaven's Hammmer
              
    [2290006,2290007]//Paladin Power Stance
    ],//End Paladin
    [//Start Dark Knight
              
    [2290002,2290003],//Dark Knight Achilles
              
    [2290022,2290023],//Dark Knight Berserk
              
    [2290096,2290125],//Dark Knight Maple Hero
              
    [2290000,2290001],//Dark Knight Monster Magnet
              
    [2290004,2290005],//Dark Knight Rush
              
    [2290006,2290007]//Dark Knight Power Stance
    ],//End Dark Knight
    [//Start FP Mage
              
    [2290026,2290027],//FP Mage Big Bang
              
    [2290038,2290039],//FP Mage Elquines
              
    [2290036,2290037],//FP Mage Fire Demon
              
    [2290024,2290025],//FP Mage Mana Reflection
              
    [2290096,2290125],//FP Mage Maple Hero
              
    [2290040,2290041],//FP Mage Meteor Shower
              
    [2290030,2290031]//FP Mage Paralyze
    ],//End FP Mage
    [//Start IL Mage
              
    [2290026,2290027],//IL Mage Big Bang
              
    [2290046,2290047],//IL Mage Blizzard
              
    [2290032,2290033],//IL Mage Chain Lightning
              
    [2290042,2290043],//IL Mage Ice Demon
              
    [2290044,2290045],//IL Mage Ifrit
              
    [2290028,2290029],//IL Mage Infinity
              
    [2290024,2290025],//IL Mage Mana Reflection
              
    [2290096,2290125]//IL Mage Maple Hero
    ],//End IL Mage
    [//Start Bishop
              
    [2290050,2290051],//Bishop Angel Ray
              
    [2290026,2290027],//Bishop Big Bang
              
    [2290048,2290049],//Bishop Genesis
              
    [2290034,2290035],//Bishop Holy Shield
              
    [2290028,2290029],//Bishop Infinity
              
    [2290024,2290025],//Bishop Mana Reflection
              
    [2290096,2290125]//Bishop Maple Hero
    ],//End Bishop
    [//Start BowMaster
              
    [2290056,2290057],//BowMaster Bow Expert
              
    [2290064,2290065],//BowMaster Concentrate
              
    [2290054,2290055],//BowMaster Dragon's Breath
              
    [2290058,2290059],//BowMaster Hamstring Shot
              
    [2290096,2290125],//BowMaster Maple Hero
              
    [2290062,2290063],//BowMaster Phoenix
              
    [2290052,2290053],//BowMaster Sharp Eyes
              
    [2290060,2290061]//BowMaster Hurricane
    ],//End BowMaster
    [//Start CrossBow
              
    [2290068,2290069],//CrossBow Blind
              
    [2290066,2290067],//CrossBow Marksman Boost
              
    [2290054,2290055],//CrossBow Dragon's Breath
              
    [2290072,2290073],//CrossBow Frostprey
              
    [2290096,2290125],//CrossBow Maple Hero
              
    [2290070,2290071],//CrossBow Piercing
              
    [2290052,2290053],//CrossBow Sharp Eyes
              
    [2290074,2290075]//CrossBow Snipe
    ],//End CrossBow
    [//Start NightLord
              
    [2290076,2290077],//NightLord Shadow Shifter
              
    [2290096,2290125],//NightLord Maple Hero
              
    [2290082,2290083],//NightLord Ninja Ambush
              
    [2290086,2290087],//NightLord Ninja Storm
              
    [2290080,2290081],//NightLord Taunt
              
    [2290088,2290089],//NightLord Shadow Claw
              
    [2290084,2290085],//NightLord Triple Throw
              
    [2290078,2290079]//NightLord Venomous Star
    ],//End NightLord
    [//Start Shadower
              
    [2290092,2290093],//Shadower Assassinate
              
    [2290090,2290091],//Shadower Boomerang Step
              
    [2290076,2290077],//Shadower Shadow Shifter
              
    [2290096,2290125],//Shadower Maple Hero
              
    [2290082,2290083],//Shadower Ninja Ambush
              
    [2290080,2290081],//Shadower Taunt
              
    [2290094,2290095],//Shadower Smokescreen
              
    [2290078,2290079]//Shadower Venomous Stab
    ],//End Shadower
    [//Start Buccaneer
              
    [2290096,22900125],//Buccaneer Maple Hero
              
    [2290097,2290098],//Buccaneer Dragon Strike
              
    [2290099,2290100],//Buccaneer Energy Orb
              
    [2290101],//Buccaneer Super Transform
              
    [2290102,2290103],//Buccaneer Demolition
              
    [2290104,2290105],//Buccaneer Snatch
              
    [2290106,2290107],//Buccaneer Barrage
              
    [2290108,2290109],//Buccaneer Speed Infusion
              
    [2290110,2290111]//Buccaneer Time Leap
    ],//End Buccaneer
    [//Start Corsair
              
    [2290096,2290125],//Corsair Maple Hero
              
    [2290112,2290113],//Corsair Elemental Boost
              
    [2290114],//Corsair Wrath of the Octopi
              
    [2290115,2290116],//Corsair Air Strike
              
    [2290117,2290118],//Corsair Rapid Fire
              
    [2290119,2290120],//Corsair BattleShip Cannon
              
    [2290121,2290122],//Corsair BattleShip Torpedo
              
    [2290123],//Corsair Hypnotize
              
    [2290124]//Corsair Bullseye
    ],//End Corsair
    [//Start Aran
              
    [2290096,2290125],//Aran Maple Hero
              
    [2290128,2290129],//Aran High Mastery
              
    [2290130,2290131],//Aran Freeze Standing
              
    [2290134,2290135],//Aran High Defence
              
    [2290136,2290137],//Aran Combo Tempist
              
    [2290138,2290139],//Aran Combo Barrier
              
    [2290126,2290127],//Aran Overswing
              
    [2290132,2290133]//Aran Final Blow
    ]//End aran          
    ];//END ARRAY
    var skills = [
                [
    112000411200031120005,1121008,1121010,1121000,1121001,1121006,1121002],//Hero Skills
                
    [1220005,1221009,1220006,1221004,1221003,1221000,1221001,1221007,1221011,1221002],//Paladin
                
    [1320005,1320006,1321000,1321001,1321003,1321002],//Dark Knight
                
    [2121001,2121005,2121003,2121004,2121002,2121000,2121007,2121006],//FP Mage
                
    [2221001,2221007,2221006,2221003,2221005,2221004,2221002,2221000],//IL Mage
                
    [2321007,2321001,2321008,2321005,2321004,2321002,2321000,2321006],//Bishop
                
    [3120005,3121008,3121003,3121007,3121000,3121006,3121002,3121004],//Bowmaster
                
    [3221006,3220004,3221003,3221005,3221000,3221001,3221002,3221007],//Crossbow
                
    [4120002,4121000,4121004,4121008,4121003,4121006,4121007,4120005],//Nightlord
                
    [4221000,4221007,4220002,4221000,4221004,4221003,4221006,4220005],//Shadower
                
    [5121000,5121001,5121002,5121003,5121004,5121005,5121007,5121010],//Buccaneer
                
    [5221000,5220001,5220002,5221003,5221004,5221007,5221008,5221009,5220011],//Corsair
                
    [21121000,21120001,21120003,21120004,21120006,21120007,21120009,21120010,21120005,21120002]//Aran
                
    ]; //Removed Hero's Will for all. No mastery Book required.
    function start() {
        
    status = -1;
        
    action(100);
    }
    function 
    action(modetypeselection) {
        if (
    mode == -1) {
            
    cm.dispose();
        } else {
            if (
    mode == 0) {
                
    cm.sendOk("Alright, see you next time.");
                
    cm.dispose();
                return;
            }
            
    status++;
            if (
    status == 0) {
                
    cm.sendNext("I am the SimpleMS Skill Mastery NPC. To master a skill you need a skill book.");
            } else if (
    status == 1) {
                for (
    0jobs.length-1i++) {
                    if (
    jobs[i] == cm.getJobId()) {
                        var 
    len skills[i].length-1
                        
    for (var 0lena++)
                            
    jobMessage += "\r\n\r\n#L" "##q" skills[i][a] + "##l";
                        
    job i;
                        break;
                    }
                }
                
    cm.sendSimple(jobMessage);
            } else if (
    status == 2) {
                
    skillSelected selection;
                for (var 
    0masteryBooks[job][selection].lengthi++)
                    
    bookMessage += "\r\n\r\n\r\n #L" " # #t" masteryBooks[job][selection][i] + "# #i " masteryBooks[job][selection][i] + "# #l";
                
    cm.sendSimple(bookMessage);
            } else if (
    status == 3) {
                if (
    cm.haveItem(masteryBooks[job][skillSelected][selection], 1)) {
                    if (
    selection == 0) {
                        if (
    cm.getMasterLevel(skills[job][skillSelected]) < 19) {
                            if (
    cm.getSkillLevel(skills[job][skillSelected]) > 4) {
                                if (
    random && random 70) {
                                    
    cm.gainItem(masteryBooks[job][skillSelected][selection], -1);
                                    
    cm.useSkillBook(skills[job][skillSelected], 20);
                                    
    cm.sendOk("Your skill book worked! Enjoy your new mastered skills!");
                                } else {
                                    
    cm.sendOk("Your skill book has failed.");
                                                                    
    cm.gainItem(masteryBooks[job][skillSelected][selection], -1);
                                                            }
                            } else {
                                
    cm.sendOk("You do not have the required level to use this skill book.");
                                
    cm.dispose();
                                return;
                            }
                        } else {
                            
    cm.sendOk("You have already used a skillbook on this skill.");
                            
    cm.dispose();
                            return;
                        }    
                    } else if (
    selection == 1) {
                        if (
    cm.getMasterLevel(skills[job][skillSelected]) < 30 && cm.getMasterLevel(skills[job][skillSelected]) > 19) {
                            if (
    cm.getSkillLevel(skills[job][skillSelected]) > 14) {
                                if (
    random && random 50) {
                                    
    cm.gainItem(masteryBooks[job][skillSelected][selection], -1);
                                    
    cm.useSkillBook(skills[job][skillSelected], 30);
                                    
    cm.sendOk("Your skill book worked! Enjoy your new mastered skills!");
                                } else {
                                    
    cm.sendOk("Your skill book has failed.");
                                                                    
    cm.gainItem(masteryBooks[job][skillSelected][selection], -1);
                                                            }
                            } else {
                                
    cm.sendOk("You do not have the required level to use this skill book.");
                                
    cm.dispose();
                                return;
                            }
                        } else {
                            
    cm.sendOk("You have already used a skill book on this skill or it is not the required level.");
                            
    cm.dispose();
                            return;
                        }
                    }
                } else
                    
    cm.sendOk("Sorry you do not have that mastery book.");
                
    cm.dispose();
            }
        }

    add this to NPCConversationManager.java
    PHP Code:
    public void useSkillBook(int skillint level) {
            
    getPlayer().changeSkillLevel(SkillFactory.getSkill(skill), getPlayer().getSkillLevel(skill), level);
        }
        public 
    int getMasterLevel(int skill) {
            return 
    getPlayer().getMasterLevel(SkillFactory.getSkill(skill));
        }
        public 
    int getSkillLevel(int skill) {
            return 
    getPlayer().getSkillLevel(SkillFactory.getSkill(skill));
        } 

    Also add this to NPCConversationManager.java
    PHP Code:
    public void maxMastery() {
            
    int[] arraySet = {3221000,3221001,3221002,3221003,3220004,3221005,3221006,3221007,3221008,3121000,3121002,3121003,3121004,3120005,3121006,3121007,3121008,3121009,2121000,2121001,2121002,2121003,2121004,2121005,2121006,2121007,2121008,2221000,2221001,2221002,2221003,2221004,2221005,2221006,2221007,2221008,2321000,2321001,2321002,2321003,2321004,2321005,2321006,2321007,2321008,2321009,4121000,4120002,4121003,4121004,4120005,4121006,4121007,4121008,4121009,4221000,4220002,4221003,4221004,4220005,4221006,4221007,4221001,4221008,1121000,1121001,1121002,1120003,1120004,1120005,1121006,1121008,1121010,1121011,1221000,1221001,1221002,1221003,1221004,1220005,1220006,1221007,1221009,1220010,1221011,1221012,1321000,1321001,1321002,1321003,1320005,1320006,1321007,1320008,1320009,1321010,5220001,5220002,5220011,5221000,5221003,5221004,5221006,5221007,5221008,5221009,5221010,5121000,5121001,5121002,5121003,5121004,5121005,5121007,5121008,5121009,5121010,21120001,21120004,21120005,21120006,21120007,21120002,21121000,21121003,21121008};
            
    int[] maxLevels = {10,5,10,5,5,10,5,20,5,10,10,5,5,5,5,5,5,5,10,10,10,10,10,10,10,10,5,10,10,10,10,10,10,10,10,5,10,10,10,30,10,10,10,5,10,5,10,10,10,10,10,10,5,10,5,10,10,10,10,10,10,10,10,5,10,5,10,5,5,5,10,10,10,5,10,5,10,5,5,5,5,10,5,10,10,5,10,10,10,10,10,10,10,25,25,5,10,10,10,10,10,5,10,10,10,10,5,10,10,10,10,10,10,10,5,5,10,10,5,5,5,5,10,5,10,5};
            for (
    int i 0arraySet.length-1i++) {
                
    getPlayer().changeSkillLevel(SkillFactory.getSkill(arraySet[i]), 0maxLevels[i]);
            }
        } 
    and put
    PHP Code:
    cm.maxMastery(); 
    Into the part of your job advancer when you advance to 4th job.

    Mabey alot. But what ever. It was more of learning multidemintional arrays for me.

    NOTE: Unless you know what you are doing. DO NOT mess with the arrays in the NPC. They are EXTREMELY sensetive to order how i coded it. If you mess with the order. It will not work correctly.


    Edited by Shawn: This is for v83.
    Last edited by blkancientss; 10-11-10 at 10:51 PM.


  2. #2
    Valued Member DejaVu is offline
    MemberRank
    Oct 2010 Join Date
    124Posts

    Re: Skill book NPC

    Very nice release. You should edit the CODE tags around your NPC to PHP

  3. #3
    Account Upgraded | Title Enabled! blkancientss is offline
    MemberRank
    Oct 2009 Join Date
    248Posts

    Re: Skill book NPC

    Quote Originally Posted by DejaVu View Post
    Very nice release. You should edit the CODE tags around your NPC to PHP
    Thanks. Added PHP tags.

  4. #4
    Account Upgraded | Title Enabled! Diglett is offline
    MemberRank
    Sep 2010 Join Date
    Diglett WorldLocation
    289Posts

    Re: Skill book NPC

    Goodjob. (:

  5. #5
    Account Upgraded | Title Enabled! blkancientss is offline
    MemberRank
    Oct 2009 Join Date
    248Posts

    Re: Skill book NPC

    Thanks, most of the hard work was getting all the id's in order.

  6. #6
    Account Upgraded | Title Enabled! natkemon is offline
    MemberRank
    Jul 2008 Join Date
    424Posts

    Re: Skill book NPC

    What do i do?

    PHP Code:
    init:
    deps-jar:
    Compiling 1 source file to C:\Documents and Settings\MyStoryMS\Desktop\MoopleDev\build\classes
    C
    :\Documents and Settings\MyStoryMS\Desktop\MoopleDev\src\scripting\npc\NPCConversationManager.java:91changeSkillLevel(client.ISkill,int,int,longin client.MapleCharacter cannot be applied to (client.ISkill,int,int)
            
    getPlayer().changeSkillLevel(SkillFactory.getSkill(skill), getPlayer().getSkillLevel(skill), level); 
    1 error
    BUILD FAILED 
    (total time0 seconds

  7. #7
    bleh.... Shawn is offline
    MemberRank
    Oct 2008 Join Date
    Mississauga, CaLocation
    5,904Posts

    Re: [NPC]Skill book NPC

    In the future, use [NPC] tags when releasing NPCs. Also, be sure to state what version it is for, so the people who aren't as experienced can know if it would be of use to them.

  8. #8
    Account Upgraded | Title Enabled! blkancientss is offline
    MemberRank
    Oct 2009 Join Date
    248Posts

    Re: Skill book NPC

    Quote Originally Posted by natkemon View Post
    What do i do?

    PHP Code:
    init:
    deps-jar:
    Compiling 1 source file to C:\Documents and Settings\MyStoryMS\Desktop\MoopleDev\build\classes
    C
    :\Documents and Settings\MyStoryMS\Desktop\MoopleDev\src\scripting\npc\NPCConversationManager.java:91changeSkillLevel(client.ISkill,int,int,longin client.MapleCharacter cannot be applied to (client.ISkill,int,int)
            
    getPlayer().changeSkillLevel(SkillFactory.getSkill(skill), getPlayer().getSkillLevel(skill), level); 
    1 error
    BUILD FAILED 
    (total time0 seconds
    change in you npc to:
    PHP Code:
    getPlayer().changeSkillLevel(SkillFactory.getSkill(skill), getPlayer().getSkillLevel(skill), level, -1); 

  9. #9
    Account Upgraded | Title Enabled! BlessTheKnife is offline
    MemberRank
    Sep 2009 Join Date
    554Posts

    Re: [NPC]Skill book NPC

    Wow good job on this! Imma use (:

  10. #10
    Enthusiast Auphhy is offline
    MemberRank
    Sep 2008 Join Date
    28Posts

    Re: [NPC]Skill book NPC

    This causes all the skills level to be back to 0, causing players to lose SPs

  11. #11
    Account Upgraded | Title Enabled! blkancientss is offline
    MemberRank
    Oct 2009 Join Date
    248Posts

    Re: [NPC]Skill book NPC

    Quote Originally Posted by Auphhy View Post
    This causes all the skills level to be back to 0, causing players to lose SPs
    Well. No. I've tested it and as you can see.

    PHP Code:
    getPlayer().changeSkillLevel(SkillFactory.getSkill(skill), getPlayer().getSkillLevel(skill), level); 
    What that function is doing is changing the skill level. It is sending the skill, skill's current level, and mastery level.

    So it will keep the skills current level.

    It works for me.

  12. #12
    Account Upgraded | Title Enabled! LoveOfHacking is offline
    MemberRank
    Aug 2009 Join Date
    New York :oLocation
    343Posts

    Re: [NPC]Skill book NPC

    Nice job,..Take some pain reliever for your ass.

  13. #13
    Account Upgraded | Title Enabled! blkancientss is offline
    MemberRank
    Oct 2009 Join Date
    248Posts

    Re: [NPC]Skill book NPC

    Thank you lol.

    Script edited.
    - Was not removing books if failed.
    Last edited by blkancientss; 10-11-10 at 10:52 PM.



Advertisement