1st and 2nd Job Npcs (Have to collect dark marbles for 2nd job adv.)

Page 1 of 3 123 LastLast
Results 1 to 25 of 63
  1. #1
    Valued Member monsoon2004 is offline
    MemberRank
    Mar 2008 Join Date
    Dallesport, WALocation
    117Posts

    1st and 2nd Job Npcs (Have to collect dark marbles for 2nd job adv.)

    First off, Credits:
    credits to toxicwind for the checkhasItem function, and also for the getItemAmount function -> http://forum.ragezone.com/f427/relea...5/#post3273835
    credits to oung for his 1st and 2nd job npc scripts because I started out from those -> http://forum.ragezone.com/f427/relea...4/#post3270560
    credits to reiyhn for the setsp and getsp functions -> http://forum.ragezone.com/f427/relea...1/#post3269318

    These npcs work like the ones in GMS where at level 30 you need to take a letter to the 2nd job instructor and collect dark marbles.

    You might have to add the dark marble drop(its id is 4031013) for these monsters: Curse Eye 2, Horned Mushroom 2, Fire Boar 2, Lupin 2, Zombie Mushroom 2, Cold Eye 2, and Blue Mushroom 2,(their ids are 9000001, 9000002, 9000100, 9000101, 9000201, 9000300, and 9000301).

    Includes
    Code:
    #include "NPCs.h"
    #include "Player.h"
    #include "NPCsScripts.h"
    #include "Inventory.h"
    #include "Players.h"
    #include "PlayersPacket.h"
    NPCsScripts.h(add the ones you dont already have):
    Code:
                //1st Job Npcs
                case 1012100: npc_1012100(npc); break;
                case 1052001: npc_1052001(npc); break;
                case 1032001: npc_1032001(npc); break;
                case 1022000: npc_1022000(npc); break;
                //2nd Job Npcs
                case 1072000: npc_1072000(npc); break;
                case 1072001: npc_1072001(npc); break;
                case 1072002: npc_1072002(npc); break;
                case 1072003: npc_1072003(npc); break;
                //2nd Job Dungeon Npcs
                case 1072006: npc_1072006(npc); break;
                case 1072004: npc_1072004(npc); break;
                case 1072005: npc_1072005(npc); break;
                case 1072007: npc_1072007(npc); break;
    Code:
        //1st Job Npcs
        static void npc_1052001(NPC* npc);
        static void npc_1012100(NPC* npc);
        static void npc_1032001(NPC* npc);
        static void npc_1022000(NPC* npc);
        //2nd Job Npcs
        static void npc_1072000(NPC* npc);
        static void npc_1072001(NPC* npc);
        static void npc_1072002(NPC* npc);
        static void npc_1072003(NPC* npc);
        //2nd Job Dungeon Npcs
        static void npc_1072006(NPC* npc);
        static void npc_1072004(NPC* npc);
        static void npc_1072005(NPC* npc);
        static void npc_1072007(NPC* npc);

    in whichever .cpp you use for npcs:

    Athena
    Code:
    //Athena Pierce
    void NPCsScripts::npc_1012100(NPC* npc){
        Player* player = npc->getPlayer();
        int state = npc->getState();
        if(state == 0){
            if(player->getJob() == 000){
                if(player->getLevel() >= 10 && player->getDex() >= 25){
                    npc->addText("Would you like to become an Archer?");
                    state = 1;
                    npc->sendYesNo();
                }
                else{
                    npc->addText("I'm sorry but you're too weak at the moment.");
                    npc->sendOK();
                    npc->end();
                }
            }
            if(player->getJob() == 300 && player->getLevel() >= 30){
                if(npc->getItemAmount(4031010) == 0){
                    if(npc->checkhasItem(player, 4031012)){
                        npc->addText("I knew the test wouldn't be a problem for you. Are you ready to choose your next path?");
                        npc->sendYesNo();
                    }
                    else{
                        npc->addText("You have improved significantly. Would you like to take the second job test?");
                        state = 1;
                        npc->sendYesNo();
                    }
                }
                else{
                    npc->addText("Please come back after you have passed the test.");
                    npc->sendOK();
                    npc->end();
                }
            }
            else{
                npc->addText("How goes your training?");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 1){
            if(npc->getSelected() == YES){
                if(player->getLevel() == 10){
                    player->setJob(300);
                    npc->addText("You are now an Archer.");
                    npc->setSP(player->getSp() + 1);
                    npc->sendOK();
                    npc->end();
                }
                else if(player->getLevel() >= 30){
                    if(npc->getItemAmount(4031010) == 0){
                        if(npc->getItemAmount(4031012) == 1){
                            npc->addText("Choose your path. \r\n#L0#Hunter#l\r\n#L1#Crossbowman#l");
                            npc->sendSimple();
                        }
                        else{
                            npc->addText("Very well, I will give you my recommendation letter. Take it to my assistant and she will give you your next task.");
                            npc->sendOK();
                            npc->end();
                            npc->giveItem(4031010, 1);
                        }
                    }
                }
            }
            else{
                npc->addText("Hmm.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 2){
            int type = npc->getSelected();
            npc->setVariable("type", type);
            if(type == 0){
                npc->giveItem(4031012, -1);
                player->setJob(310);
                npc->setSP(player->getSp() + 1);
                npc->addText("You are now a Hunter, nothing escapes your bow.");
                npc->sendOK();
                npc->end();
            }
            else if(type == 1){
                npc->giveItem(4031012, -1);
                player->setJob(320);
                npc->setSP(player->getSp() + 1);
                npc->addText("You are now a Sniper, extremely accurate and deadly.");
                npc->sendOK();
                npc->end();
            }
        }
    }
    2nd Job Instructor-Bowman
    Code:
    //2nd Job Instructor-Bowman
    void NPCsScripts::npc_1072002(NPC* npc){
    Player* player = npc->getPlayer();
    int state = npc->getState();
    if(state == 0){
    	if(player->getJob() == 300){
    		if(player->getLevel() >= 30){
    			if(npc->getItemAmount(4031012) == 0){
    				if(npc->checkhasItem(player, 4031010)){
    					npc->addText("Ah yes this is Athena's handwriting. She must have great faith in you. So are you ready to take the test?");
    					state = 1;
    					npc->sendYesNo();
    				}
    				else{
    					npc->addText("You can't take the test without a recommendation.");
    					npc->sendOK();
    					npc->end();
    				}
    			}
    			else{
    				npc->addText("What are you waiting for? Take that medal to Athena.");
    				npc->sendOK();
    				npc->end();
    			}
    		}
    		else{
    			npc->addText("You are too weak to advance.  Come back when you are at least level 30.");
    			npc->sendOK();
                npc->end();
    		}
    	}
    	else{
    		npc->addText("Wonderful day isn't it?");
    		npc->sendOK();
    		npc->end();
    	}
    }
    else if(state == 1){
    	if(npc->getSelected() == YES){
    		npc->addText("Very well. Let the test commence.");
    		npc->giveItem(4031010, -1);
    		npc->teleport(108000100);
    		npc->end();
    	}
    	else{
    		npc->addText("I see.  Come back when you are ready to take the test.");
    		npc->sendOK();
    		npc->end();
    	}
    }
    }
    //Bowman dungeon npc
    void NPCsScripts::npc_1072006(NPC* npc){
        Player* player = npc->getPlayer();
        int state = npc->getState();
        if(state == 0){
            if(npc->getItemAmount(4031013) >= 30){
                    npc->addText("You are stronger than I thought. I'll give you a medal to show Athena that you have accomplished this feat.");
                    npc->sendNext();
            }
            else{
                npc->addText("You aren't quite finished yet.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 1){
            npc->giveItem(4031013, - npc->getItemAmount(4031013));
            npc->giveItem(4031012, 1);
            npc->teleport(106010000);
            npc->end();
        }
    }

    Dances with Balrogs
    Code:
    //Dances with Balrogs
    void NPCsScripts::npc_1022000(NPC* npc){
        Player* player = npc->getPlayer();
        int state = npc->getState();
        if(state == 0){
            if(player->getJob() == 000){
                if(player->getLevel() >= 10 && player->getStr() >= 35){
                    npc->addText("Welcome. Have you come to become a Swordsman?");
                    state = 1;
                    npc->sendYesNo();
                }
                else{
                    npc->addText("You're too weak. Come back when you're at least level 10 and have a minimum of 35 str.");
                    npc->sendOK();
                    npc->end();
                }
            }
            if(player->getJob() == 100 && player->getLevel() >= 30){
                if(npc->getItemAmount(4031008) == 0){
                    if(npc->checkhasItem(player, 4031012)){
                        npc->addText("I'm glad to see that you passed the test. Would you like to choose your next path now?");
                        npc->sendYesNo();
                    }
                    else{
                        npc->addText("I see that you're a lot stronger than you were when you first came here. Would you like to become even more powerful?");
                        state = 1;
                        npc->sendYesNo();
                    }
                }
                else{
                    npc->addText("There are no shortcuts, you must pass the test or I won't help you.");
                    npc->sendOK();
                    npc->end();
                }
            }
            else{
                npc->addText("Remember, strength is your friend.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 1){
            if(npc->getSelected() == YES){
                if(player->getLevel() == 10){
                    player->setJob(100);
                    npc->addText("You now have some understanding of how to fight. It is up to you to train and increase your power.");
                    npc->setSP(player->getSp() + 1);
                    npc->sendOK();
                    npc->end();
                }
                else if(player->getLevel() >= 30){
                    if(npc->getItemAmount(4031008) == 0){
                        if(npc->getItemAmount(4031012) == 1){
                            npc->addText("Choose your path. \r\n#L0#Fighter#l\r\n#L1#Page#l\r\n#L2#Spearman#l");
                            npc->sendSimple();
                        }
                        else{
                            npc->addText("If you're sure that you're ready, then take this letter to my assistant so that he may test you. Good luck young warrior.");
                            npc->sendOK();
                            npc->end();
                            npc->giveItem(4031008, 1);
                        }
                    }
                }
            }
            else{
                npc->addText("Very well.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 2){
            int type = npc->getSelected();
            npc->setVariable("type", type);
            if(type == 0){
                npc->giveItem(4031012, -1);
                player->setJob(110);
                npc->setSP(player->getSp() + 1);
                npc->addText("You are now a Fighter, with the ability to masterfully wield swords and axes no one would dare challenge you.");
                npc->sendOK();
                npc->end();
            }
            else if(type == 1){
                npc->giveItem(4031012, -1);
                player->setJob(120);
                npc->setSP(player->getSp() + 1);
                npc->addText("You are now an Page, your range of elemental attacks can take almost any enemy by surprise.");
                npc->sendOK();
                npc->end();
            }
            else if(type == 2){
                npc->giveItem(4031012, -1);
                player->setJob(130);
                npc->setSP(player->getSp() + 1);
                npc->addText("You are now a Spearman, easily capable of keeping any enemy at bay until you are ready to finish them off.");
                npc->sendOK();
                npc->end();
            }
        }
    }
    2nd Job Instructor-Warrior
    Code:
    //2nd Job Instructor-Warrior
    void NPCsScripts::npc_1072000(NPC* npc){
    Player* player = npc->getPlayer();
    int state = npc->getState();
    if(state == 0){
    	if(player->getJob() == 100){
    		if(player->getLevel() >= 30){
    			if(npc->getItemAmount(4031012) == 0){
    				if(npc->checkhasItem(player, 4031008)){
    					npc->addText("I see, so Dances with Balrogs wishes for me to test you. Well then, are you ready to begin the test?");
    					state = 1;
    					npc->sendYesNo();
    				}
    				else{
    					npc->addText("You must have a recommendation from Dances with Balrogs to take this test.");
    					npc->sendOK();
    					npc->end();
    				}
    			}
    			else{
    				npc->addText("You're still here? Hurry up and take that to Dances with Balrogs.");
    				npc->sendOK();
    				npc->end();
    			}
    		}
    		else{
    			npc->addText("You are too weak to advance.  Come back when you are at least level 30.");
    			npc->sendOK();
                npc->end();
    		}
    	}
    	else{
    		npc->addText("Hello traveller.");
    		npc->sendOK();
    		npc->end();
    	}
    }
    else if(state == 1){
    	if(npc->getSelected() == YES){
    		npc->addText("Very well. Let the test commence.");
    		npc->giveItem(4031008, -1);
    		npc->teleport(108000300);
    		npc->end();
    	}
    	else{
    		npc->addText("I see.  Come back when you are ready to take the test.");
    		npc->sendOK();
    		npc->end();
    	}
    }
    }
    //Warrior dungeon npc
    void NPCsScripts::npc_1072004(NPC* npc){
        Player* player = npc->getPlayer();
        int state = npc->getState();
        if(state == 0){
            if(npc->getItemAmount(4031013) >= 30){
                    npc->addText("You are stronger than I thought. I'll give you a medal to show Dances with Balrogs that you have passed this test.");
                    npc->sendNext();
            }
            else{
                npc->addText("You aren't quite finished yet.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 1){
            npc->giveItem(4031013, - npc->getItemAmount(4031013));
            npc->giveItem(4031012, 1);
            npc->teleport(102020300);
            npc->end();
        }
    }

    Dark Lord
    Code:
    //Dark Lord
    void NPCsScripts::npc_1052001(NPC* npc){
        Player* player = npc->getPlayer();
        int state = npc->getState();
        if(state == 0){
            if(player->getJob() == 000){
                if(player->getLevel() >= 10 && player->getDex() >= 25){
                    npc->addText("Are you here to become a Rogue and be my minion?");
                    state = 1;
                    npc->sendYesNo();
                }
                else{
                    npc->addText("You're too weak, come back when you're at least level 10 and have a minimum of 25 dex.");
                    npc->sendOK();
                    npc->end();
                }
            }
            if(player->getJob() == 400 && player->getLevel() >= 30){
                if(npc->getItemAmount(4031011) == 0){
                    if(npc->checkhasItem(player, 4031012)){
                        npc->addText("I see you survived.  Very well, would you like to choose your next path?");
                        npc->sendYesNo();
                    }
                    else{
                        npc->addText("You're a lot stronger than when I first saw you. Do you wish to become even stronger?");
                        state = 1;
                        npc->sendYesNo();
                    }
                }
                else{
                    npc->addText("Come back when you've completed the test.");
                    npc->sendOK();
                    npc->end();
                }
            }
            else{
                npc->addText("Steal from the rich and keep it for yourself.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 1){
            if(npc->getSelected() == YES){
                if(player->getLevel() == 10){
                    player->setJob(400);
                    npc->addText("You are now an Rogue. The first step in becoming a great thief like me.");
                    npc->setSP(player->getSp() + 1);
                    npc->sendOK();
                    npc->end();
                }
                else if(player->getLevel() >= 30){
                    if(npc->getItemAmount(4031011) == 0){
                        if(npc->getItemAmount(4031012) == 1){
                            npc->addText("Choose your path. \r\n#L0#Assassin#l\r\n#L1#Bandit#l");
                            npc->sendSimple();
                        }
                        else{
                            npc->addText("Then take this letter to my assistant and he'll test you to see if you're worthy.");
                            npc->sendOK();
                            npc->end();
                            npc->giveItem(4031011, 1);
                        }
                    }
                }
            }
            else{
                npc->addText("Quit wasting my time.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 2){
            int type = npc->getSelected();
            npc->setVariable("type", type);
            if(type == 0){
                npc->giveItem(4031012, -1);
                player->setJob(410);
                npc->setSP(player->getSp() + 1);
                npc->addText("You are now an Assassin, using your mighty arm you throw stars into the eyes of your enemies.");
                npc->sendOK();
                npc->end();
            }
            else if(type == 1){
                npc->giveItem(4031012, -1);
                player->setJob(420);
                npc->setSP(player->getSp() + 1);
                npc->addText("You are now a Bandit, your dagger stabs into your enemies before they even know what hit them.");
                npc->sendOK();
                npc->end();
            }
        }
    }
    2nd Job Instructor-Thief
    Code:
    //2nd Job Instructor-Thief
    void NPCsScripts::npc_1072003(NPC* npc){
    Player* player = npc->getPlayer();
    int state = npc->getState();
    if(state == 0){
    	if(player->getJob() == 400){
    		if(player->getLevel() >= 30){
    			if(npc->getItemAmount(4031012) == 0){
    				if(npc->checkhasItem(player, 4031011)){
    					npc->addText("Hmm. This is the seal of master Dark Lord. Very well, are you ready to be tested?");
    					state = 1;
    					npc->sendYesNo();
    				}
    				else{
    					npc->addText("You can not take this test without a recommendation from master Dark Lord.");
    					npc->sendOK();
    					npc->end();
    				}
    			}
    			else{
    				npc->addText("Quit bothering me and take that to master Dark Lord.");
    				npc->sendOK();
    				npc->end();
    			}
    		}
    		else{
    			npc->addText("You are too weak.  Come back when you are at least level 30.");
    			npc->sendOK();
                npc->end();
    		}
    	}
    	else{
    		npc->addText("What do you want?");
    		npc->sendOK();
    		npc->end();
    	}
    }
    else if(state == 1){
    	if(npc->getSelected() == YES){
    		npc->addText("Very well. Let the test commence.");
    		npc->giveItem(4031011, -1);
    		npc->teleport(108000400);
    		npc->end();
    	}
    	else{
    		npc->addText("I see.  Come back when you are ready to take the test.");
    		npc->sendOK();
    		npc->end();
    	}
    }
    }
    //Thief dungeon npc
    void NPCsScripts::npc_1072007(NPC* npc){
        Player* player = npc->getPlayer();
        int state = npc->getState();
        if(state == 0){
            if(npc->getItemAmount(4031013) >= 30){
                    npc->addText("You are stronger than I thought. I'll give you a medal to show master Dark Lord that you have passed.");
                    npc->sendNext();
            }
            else{
                npc->addText("You aren't quite finished yet.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 1){
            npc->giveItem(4031013, - npc->getItemAmount(4031013));
            npc->giveItem(4031012, 1);
            npc->teleport(102040000);
            npc->end();
        }
    }

    Grendel the Really Old
    Code:
    //Grendel the Really Old
    void NPCsScripts::npc_1032001(NPC* npc){
        Player* player = npc->getPlayer();
        int state = npc->getState();
        if(state == 0){
            if(player->getJob() == 000){
                if(player->getLevel() >= 8 && player->getInt() >= 25){
                    npc->addText("Hello young adventurer. Do you wish to harness the power of magic?");
                    state = 1;
                    npc->sendYesNo();
                }
                else{
                    npc->addText("You lack the focus required to use magic. Come back when you're at least level 8 and have a minimum of 25 int.");
                    npc->sendOK();
                    npc->end();
                }
            }
            if(player->getJob() == 200 && player->getLevel() >= 30){
                if(npc->getItemAmount(4031009) == 0){
                    if(npc->checkhasItem(player, 4031012)){
                        npc->addText("I see you survived.  Very well, would you like to choose your next path?");
                        npc->sendYesNo();
                    }
                    else{
                        npc->addText("You've increased your magic power considerably. Would you like to increase it even further?");
                        state = 1;
                        npc->sendYesNo();
                    }
                }
                else{
                    npc->addText("Finish the test and then I will help you to become more powerful.");
                    npc->sendOK();
                    npc->end();
                }
            }
            else{
                npc->addText("Always remained focused when using magic.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 1){
            if(npc->getSelected() == YES){
                if(player->getLevel() == 10){
                    player->setJob(200);
                    npc->addText("Your magic power has been awakened. It is up to you to improve upon it.");
                    npc->setSP(player->getSp() + 1);
                    npc->sendOK();
                    npc->end();
                }
                else if(player->getLevel() >= 30){
                    if(npc->getItemAmount(4031009) == 0){
                        if(npc->getItemAmount(4031012) == 1){
                            npc->addText("Choose your path. \r\n#L0#Fire/Poison Wizard#l\r\n#L1#Ice/Lightning Wizard#l\r\n#L2#Cleric#l");
                            npc->sendSimple();
                        }
                        else{
                            npc->addText("If you truly wish to become more powerful then you must first be tested. Take this letter to my assistant and they will test your power.");
                            npc->sendOK();
                            npc->end();
                            npc->giveItem(4031009, 1);
                        }
                    }
                }
            }
            else{
                npc->addText("Very well.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 2){
            int type = npc->getSelected();
            npc->setVariable("type", type);
            if(type == 0){
                npc->giveItem(4031012, -1);
                player->setJob(210);
                npc->setSP(player->getSp() + 1);
                npc->addText("You are now a Fire/Poison Wizard, your fire melts steel and your poison can take down giants.");
                npc->sendOK();
                npc->end();
            }
            else if(type == 1){
                npc->giveItem(4031012, -1);
                player->setJob(220);
                npc->setSP(player->getSp() + 1);
                npc->addText("You are now an Ice/Lightning Wizard, your lightning is more powerful than a thunderstorm and your ice is colder than the arctic.");
                npc->sendOK();
                npc->end();
            }
            else if(type == 2){
                npc->giveItem(4031012, -1);
                player->setJob(230);
                npc->setSP(player->getSp() + 1);
                npc->addText("You are now a Cleric, you heal the wounds of others and the undead make a habit of avoiding you.");
                npc->sendOK();
                npc->end();
            }
        }
    }
    2nd Job Instructor-Magician
    Code:
    //2nd Job Instructor-Magician
    void NPCsScripts::npc_1072001(NPC* npc){
    Player* player = npc->getPlayer();
    int state = npc->getState();
    if(state == 0){
    	if(player->getJob() == 200){
    		if(player->getLevel() >= 30){
    			if(npc->getItemAmount(4031012) == 0){
    				if(npc->checkhasItem(player, 4031009)){
    					npc->addText("You must be powerful if Grendel sent you. Very well, are you ready?");
    					state = 1;
    					npc->sendYesNo();
    				}
    				else{
    					npc->addText("You need a recommendation from Grendel before you can take this test.");
    					npc->sendOK();
    					npc->end();
    				}
    			}
    			else{
    				npc->addText("What are you waiting for? Get moving and take that to Grendel.");
    				npc->sendOK();
    				npc->end();
    			}
    		}
    		else{
    			npc->addText("You are too weak to advance.  Come back when you are at least level 30.");
    			npc->sendOK();
                npc->end();
    		}
    	}
    	else{
    		npc->addText("Yes?");
    		npc->sendOK();
    		npc->end();
    	}
    }
    else if(state == 1){
    	if(npc->getSelected() == YES){
    		npc->addText("Very well. Let the test commence.");
    		npc->giveItem(4031009, -1);
    		npc->teleport(108000200);
    		npc->end();
    	}
    	else{
    		npc->addText("I see.  Come back when you are ready to take the test.");
    		npc->sendOK();
    		npc->end();
    	}
    }
    }
    //Magician dungeon npc
    void NPCsScripts::npc_1072005(NPC* npc){
        Player* player = npc->getPlayer();
        int state = npc->getState();
        if(state == 0){
            if(npc->getItemAmount(4031013) >= 30){
                    npc->addText("You are stronger than I thought. I'll give you a medal to show Grendel that you have passed this test.");
                    npc->sendNext();
            }
            else{
                npc->addText("You aren't quite finished yet.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(state == 1){
            npc->giveItem(4031013, - npc->getItemAmount(4031013));
            npc->giveItem(4031012, 1);
            npc->teleport(101020000);
            npc->end();
        }
    }


    NPCs.cpp
    add this at the bottom:
    Code:
    int NPC::checkhasItem(Player* player, int item){
        return Inventory::hasItem(player, item);
    }
    int NPC::getItemAmount(int itemid){
        return player->inv->getItemAmount(itemid);
    }
    and add this:
    Code:
    void NPC::setSP(short sp)
    {
        player->setSp(sp);
    }
    above this:
    Code:
    void NPC::setPlayerHP(short hp){
        player->setHP(hp);
    }


    NPCs.h
    add this:
    Code:
    int checkhasItem(Player* player, int item);
    int getItemAmount(int itemid);
    below this:
    Code:
    void giveEXP(int exp);
    and add this:
    Code:
    void setSP(short sp);
    below this:
    Code:
    void setGetText(char* text){
            strcpy_s(this->gettext, strlen(text)+1, text);
        }


    Inventory.cpp
    add this at the bottom:
    Code:
    int Inventory::hasItem(Player* player, int item) {
        for(int i=0; i<player->inv->getItemNum(); i++) {
            if(player->inv->getItem(i)->id == item){
                return 1;
            }
        }
        return 0;
    }
    Inventory.h
    add this:
    Code:
    static int hasItem(Player* player, int item);
    below this:
    Code:
    static void stopChair(Player* player, unsigned char* packet);
    I've tested them all and they worked for me, if you have any errors feel free to post them.
    Last edited by monsoon2004; 27-04-08 at 12:19 AM. Reason: more organized


  2. #2
    Account Upgraded | Title Enabled! Spyker710 is offline
    MemberRank
    Apr 2008 Join Date
    ...stalker much...Location
    460Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    Nice release!

  3. #3
    Member pakakid1 is offline
    MemberRank
    Apr 2008 Join Date
    51Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    would you happen to have any 3rd job npcs workin cuz mine cant seemed to be clicked on unless ur an gm lol

  4. #4
    Account Upgraded | Title Enabled! nitros is offline
    MemberRank
    Sep 2005 Join Date
    lllllllllllllllLocation
    538Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    really awesome thanks allot for your hard work

  5. #5
    Account Upgraded | Title Enabled! npmaple is offline
    MemberRank
    Apr 2008 Join Date
    Israel - a bad placeLocation
    281Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    hehe lol nice job
    but why to make people work ;p?
    lol

  6. #6
    Valued Member iarehenry is offline
    MemberRank
    Aug 2007 Join Date
    144Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    Good job.
    and thanks.

  7. #7
    Enthusiast Pro-Surf is offline
    MemberRank
    Apr 2008 Join Date
    49Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    Great release =]
    tnx

  8. #8
    Account Upgraded | Title Enabled! DreadBoy is offline
    MemberRank
    Apr 2008 Join Date
    319Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    nice relese... :P

  9. #9
    Account Upgraded | Title Enabled! marcus32 is offline
    MemberRank
    Nov 2005 Join Date
    221Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    umm...can u change the setSP to setSp? some repack have problems...haha

  10. #10
    Delta Sparks is offline
    MemberRank
    Apr 2008 Join Date
    2,073Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    Um... While everyones looking at this thread does anyone know a possible solution to Krytical's problem.

    Because you start at level 0 and you gain the EXP but you won't level =\

    I've looked in players.cpp / playerspacket.cpp and it doesnt exactly show anything to work with.

  11. #11
    Valued Member monsoon2004 is offline
    MemberRank
    Mar 2008 Join Date
    Dallesport, WALocation
    117Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    Quote Originally Posted by pakakid1 View Post
    would you happen to have any 3rd job npcs workin cuz mine cant seemed to be clicked on unless ur an gm lol
    I modified oung's third job npc scripts a little and they work for me:

    Code:
    //3rd job
    
    //Bowman
    void NPCsScripts::npc_2020010(NPC* npc){
    Player* player = npc->getPlayer();
    int state = npc->getState();
    if(state == 0){
        if(player->getJob() == 310){
            if(player->getLevel() >= 70){
            npc->addText("Would you like to become a Ranger?");
            npc->sendYesNo();
            }
            else{
                npc->addText("You must be at least level 70.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(player->getJob() == 320){
            if(player->getLevel() >= 70){
            npc->addText("Would you like to become a Sniper?");
            npc->sendYesNo();
            }
            else{
                npc->addText("You must be at least level 70.");
                npc->sendOK();
                npc->end();
            }
        }
        else{
        npc->addText("What business do you have here?");
        npc->sendOK();
        npc->end();
        }
    }
    else if(state == 1){
    if(npc->getSelected() == YES){
            if(player->getJob() == 310){
            player->setJob(311);
            npc->addText("You are now a Ranger.\n");
            npc->setSP(player->getSp() + 1);
            npc->sendOK();
            npc->end();
            }
            else
            {
            player->setJob(321);
            npc->addText("You are now a Sniper.\n");
            npc->setSP(player->getSp() + 1);
            npc->sendOK();
            npc->end();
            }
    }
    else{
        npc->addText("I see.  Come back when you are ready to advance.");
        npc->sendOK();
        npc->end();
    }
    }
    }
    //Warrior 
    void NPCsScripts::npc_2020008(NPC* npc){
    Player* player = npc->getPlayer();
    int state = npc->getState();
    if(state == 0){
        if(player->getJob() == 110){
            if(player->getLevel() >= 70){
            npc->addText("Would you like to become a Crusader?");
            npc->sendYesNo();
            }
            else{
                npc->addText("You lack training, come back when you are level 70 or higher.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(player->getJob() == 120){
            if(player->getLevel() >= 70){
            npc->addText("Would you like to become a White Knight?");
            npc->sendYesNo();
            }
            else{
                npc->addText("You lack training, come back when you are level 70 or higher.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(player->getJob() == 130){
            if(player->getLevel() >= 70){
            npc->addText("Would you like to become a Dragon Knight?");
            npc->sendYesNo();
            }
            else{
                npc->addText("You lack training, come back when you are level 70 or higher.");
                npc->sendOK();
                npc->end();
            }
        }
        else{
            npc->addText("Hello.");
            npc->sendOK();
            npc->end();
        }
    }
    else if(state == 1){
    if(npc->getSelected() == YES){
            if(player->getJob() == 110){
            player->setJob(111);
            npc->addText("You are now a Crusader.\n");
            npc->setSP(player->getSp() + 1);
            npc->sendOK();
            npc->end();
            }
            else if(player->getJob() == 120){
            player->setJob(121);
            npc->addText("You are now a White Knight.\n");
            npc->setSP(player->getSp() + 1);
            npc->sendOK();
            npc->end();
            }
            else if(player->getJob() == 130){
            player->setJob(131);
            npc->addText("You are now a Dragon Knight.\n");
            npc->setSP(player->getSp() + 1);
            npc->sendOK();
            npc->end();
            }
    }
    else{
        npc->addText("When you are ready to advance come see me.");
        npc->sendOK();
        npc->end();
    }
    }
    }
    //Magician
    void NPCsScripts::npc_2020009(NPC* npc){
    Player* player = npc->getPlayer();
    int state = npc->getState();
    if(state == 0){
        if(player->getJob() == 210){
            if(player->getLevel() >= 70){
            npc->addText("Would you like to become a Fire/Poison Mage?");
            npc->sendYesNo();
            }
            else{
                npc->addText("Your magic is still too weak, come back when you are at least level 70.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(player->getJob() == 220){
            if(player->getLevel() >= 70){
            npc->addText("Would you like to become an Ice/Lightning Mage?");
            npc->sendYesNo();
            }
            else{
                npc->addText("Your magic is still too weak, come back when you are at least level 70.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(player->getJob() == 230){
            if(player->getLevel() >= 70){
            npc->addText("Would you like to become a Priest?");
            npc->sendYesNo();
            }
            else{
                npc->addText("Your magic is still too weak, come back when you are at least level 70.");
                npc->sendOK();
                npc->end();
            }
        }
        else{
            npc->addText("What is it?");
            npc->sendOK();
            npc->end();
        }
    }
    else if(state == 1){
    if(npc->getSelected() == YES){
            if(player->getJob() == 210){
            player->setJob(211);
            npc->addText("You are now a Fire/Poison Mage.\n");
            npc->setSP(player->getSp() + 1);
            npc->sendOK();
            npc->end();
            }
            else if(player->getJob() == 220){
            player->setJob(221);
            npc->addText("You are now an Ice/Lightning Mage.\n");
            npc->setSP(player->getSp() + 1);
            npc->sendOK();
            npc->end();
            }
            else if(player->getJob() == 230){
            player->setJob(231);
            npc->addText("You are now a Priest.\n");
            npc->setSP(player->getSp() + 1);
            npc->sendOK();
            npc->end();
            }
    }
    else{
        npc->addText("When you are ready to advance come see me.");
        npc->sendOK();
        npc->end();
    }
    }
    }
    //Thief
    void NPCsScripts::npc_2020011(NPC* npc){
    Player* player = npc->getPlayer();
    int state = npc->getState();
    if(state == 0){
        if(player->getJob() == 410){
            if(player->getLevel() >= 70){
            npc->addText("Would you like to become a Hermit?");
            npc->sendYesNo();
            }
            else{
                npc->addText("You are still too weak, come back when you are at least level 70.");
                npc->sendOK();
                npc->end();
            }
        }
        else if(player->getJob() == 420){
            if(player->getLevel() >= 70){
            npc->addText("Would you like to become a Chief Bandit?");
            npc->sendYesNo();
            }
            else{
                npc->addText("You are still too weak, come back when you are at least level 70.");
                npc->sendOK();
                npc->end();
            }
        }
        else{
        npc->addText("I have no business with you.");
        npc->sendOK();
        npc->end();
        }
    }
    else if(state == 1){
    if(npc->getSelected() == YES){
            if(player->getJob() == 410){
            player->setJob(411);
            npc->addText("You are now a Hermit.\n");
            npc->setSP(player->getSp() + 1);
            npc->sendOK();
            npc->end();
            }
            else
            {
            player->setJob(421);
            npc->addText("You are now a Chief Bandit.\n");
            npc->setSP(player->getSp() + 1);
            npc->sendOK();
            npc->end();
            }
    }
    else{
        npc->addText("Are you sure? Well when you are ready to advance come see me.");
        npc->sendOK();
        npc->end();
    }
    }
    }

  12. #12
    Account Upgraded | Title Enabled! ctZ'... is offline
    MemberRank
    Dec 2006 Join Date
    533Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    Awsome release mate, are you thinking of working in the 3rd job quest?

  13. #13
    Apprentice Yourspoon is offline
    MemberRank
    Apr 2008 Join Date
    24Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    i dc when i click npc anyone know why?

  14. #14
    Proficient Member NotHere is offline
    MemberRank
    Apr 2008 Join Date
    170Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    I added them all in the same file, but sadly I keep getting DC when I click on, "let me know more about the magician" or w/e it says. I looked and re-looked I didn't find what could be wrong. Any idea?

  15. #15
    Valued Member monsoon2004 is offline
    MemberRank
    Mar 2008 Join Date
    Dallesport, WALocation
    117Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    Quote Originally Posted by Yourspoon View Post
    i dc when i click npc anyone know why?
    Did you add the checkhasitem and getitemamount codes from toxicwind's thread?


    Quote Originally Posted by NotHere View Post
    I added them all in the same file, but sadly I keep getting DC when I click on, "let me know more about the magician" or w/e it says. I looked and re-looked I didn't find what could be wrong. Any idea?
    same as above

  16. #16
    Valued Member Wildman is offline
    MemberRank
    Apr 2008 Join Date
    114Posts

    Re: [Release]1st and 2nd Job Npcs (Have to collect dark marbles for 2nd job adv.)

    hey would it be possible to create a new .cpp like JobNpcs.cpp
    and just paste the codes into that and it would work
    also if so what would be the #includes and anything else i would need besides the npc script codes?

  17. #17
    Valued Member monsoon2004 is offline
    MemberRank
    Mar 2008 Join Date
    Dallesport, WALocation
    117Posts

    Re: [Release]1st and 2nd Job Npcs (Have to collect dark marbles for 2nd job adv.)

    Quote Originally Posted by Wildman View Post
    hey would it be possible to create a new .cpp like JobNpcs.cpp
    and just paste the codes into that and it would work
    also if so what would be the #includes and anything else i would need besides the npc script codes?
    As long as you add it to the project it should, and the includes i'm using are
    Code:
    #include "NPCs.h"
    #include "Player.h"
    #include "NPCsScripts.h"
    #include "Inventory.h"
    #include "Players.h"
    #include "PlayersPacket.h"

  18. #18
    Account Upgraded | Title Enabled! xnBlaze is offline
    MemberRank
    Apr 2008 Join Date
    860Posts

    Re: [Release]1st and 2nd Job Npcs (Have to collect dark marbles for 2nd job adv.)

    nice release, good script for the servers that want to have that real ms feel.

  19. #19
    Valued Member Wildman is offline
    MemberRank
    Apr 2008 Join Date
    114Posts

    Re: [Release]1st and 2nd Job Npcs (Have to collect dark marbles for 2nd job adv.)

    ok i created a new .cpp called JobNPC and pasted your NPC scripts into that and i get an error that says setsp is not a member in NPC.h
    got any ideas how to fix

  20. #20
    Valued Member monsoon2004 is offline
    MemberRank
    Mar 2008 Join Date
    Dallesport, WALocation
    117Posts

    Re: [Release]1st and 2nd Job Npcs (Have to collect dark marbles for 2nd job adv.)

    Quote Originally Posted by Wildman View Post
    ok i created a new .cpp called JobNPC and pasted your NPC scripts into that and i get an error that says setsp is not a member in NPC.h
    got any ideas how to fix
    Are you using a repack?

  21. #21
    Valued Member Wildman is offline
    MemberRank
    Apr 2008 Join Date
    114Posts

    Re: [Release]1st and 2nd Job Npcs (Have to collect dark marbles for 2nd job adv.)

    no im using rev 007

  22. #22
    Apprentice Yourspoon is offline
    MemberRank
    Apr 2008 Join Date
    24Posts

    Re: [Release]1st and 2nd Job Npcs(GMS-like)

    Quote Originally Posted by monsoon2004 View Post
    Did you add the checkhasitem and getitemamount codes from toxicwind's thread?




    same as above

    yes i have both checkhasitem and getitemamount

  23. #23
    Valued Member monsoon2004 is offline
    MemberRank
    Mar 2008 Join Date
    Dallesport, WALocation
    117Posts

    Re: [Release]1st and 2nd Job Npcs (Have to collect dark marbles for 2nd job adv.)

    Quote Originally Posted by Wildman View Post
    no im using rev 007
    in NPCs.h

    this
    Code:
    void setSP(short sp);
    under this
    Code:
    void setGetText(char* text){
            strcpy_s(this->gettext, strlen(text)+1, text);
        }

    in NPCs.cpp

    this
    Code:
    void NPC::setSP(short sp)
    {
        player->setSp(sp);
    }
    above this
    Code:
    void NPC::setPlayerHP(short hp){
        player->setHP(hp);
    }

  24. #24
    Account Upgraded | Title Enabled! Abubakr is offline
    MemberRank
    Apr 2008 Join Date
    Mississauga,Ontario,CanadaLocation
    240Posts

    Re: [Release]1st and 2nd Job Npcs (Have to collect dark marbles for 2nd job adv.)

    Quote Originally Posted by Wildman View Post
    ok i created a new .cpp called JobNPC and pasted your NPC scripts into that and i get an error that says setsp is not a member in NPC.h
    got any ideas how to fix
    Try in NPCs.h finding:

    Code:
    void giveEXP(int exp);
    and under it pasting:

    Code:
    void setSp(short sp);
    Only a possibility, I just started learning C++...

    Edit: I was missing some stuff and monsoon beat me to it. Oh well, atleast I tried to help out a little and not just leach all the time. xD

  25. #25
    Valued Member Wildman is offline
    MemberRank
    Apr 2008 Join Date
    114Posts

    Re: [Release]1st and 2nd Job Npcs (Have to collect dark marbles for 2nd job adv.)

    ty ty monsoon it worked lol
    you might wanna think about adding that to your tut because apparently the setsp is not in rev 007 files



Page 1 of 3 123 LastLast

Advertisement