Purpose: To add a fun Mini-Game to your Server.
Difficulty: 2/10
Assumed Knowledge: C&P
Server Base: WhiteScape/Cheezscape
Classes Modified: Autospawn.CFG, Client.java, and Item2.java.
Procedure
Firstly open up Autospawn and add:
Now open Client.java and search for void UpdateNPCChat() {, go down to the last case and add these(You may have to change the case numbers if these are already taken).Code:spawn = 0 2664 9805 0 3264 3285 3260 3281 2 hans spawn = 53 2660 9808 0 3264 3285 3260 3281 2 baby red dragon spawn = 53 2659 9810 0 3264 3285 3260 3281 2 baby red dragon spawn = 53 2662 9811 0 3264 3285 3260 3281 2 baby red dragon spawn = 53 2667 9809 0 3264 3285 3260 3281 2 baby red dragon spawn = 53 2665 9806 0 3264 3285 3260 3281 2 baby red dragon spawn = 1571 2646 9866 0 3264 3285 3260 3281 2 Harold Evans spawn = 55 2644 9867 0 3264 3285 3260 3281 2 Blue Dragon spawn = 55 2648 9865 0 3264 3285 3260 3281 2 Blue Dragon spawn = 37 2546 9844 0 3264 3285 3260 3281 2 Sigbert the Adventurer spawn = 54 2542 9844 0 3264 3285 3260 3281 2 Black Dragon spawn = 37 2612 9816 0 3264 3285 3260 3281 2 Sigbert the Adventurer spawn = 50 2613 9812 0 3264 3285 3260 3281 2 King Black Dragon
Now search for case 155: and add these.Code:case 8: sendFrame200(4883, 591); sendFrame126(GetNpcName(NpcTalkTo), 4884); sendFrame126("Thanks for coming, get the key from the dragons", 4885); sendFrame75(NpcTalkTo, 4883); sendFrame164(4882); NpcDialogueSend = true; break; case 9: sendFrame200(4883, 591); sendFrame126(GetNpcName(NpcTalkTo), 4884); sendFrame126("Good job, now help Harold", 4885); sendFrame75(NpcTalkTo, 4883); sendFrame164(4882); NpcDialogueSend = true; teleportToX = 2646; teleportToY = 9866; break; case 10: sendFrame200(4883, 591); sendFrame126(GetNpcName(NpcTalkTo), 4884); sendFrame126("Please help me, I've been trapped here for days", 4885); sendFrame75(NpcTalkTo, 4883); sendFrame164(4882); NpcDialogueSend = true; break; case 11: sendFrame200(4883, 591); sendFrame126(GetNpcName(NpcTalkTo), 4884); sendFrame126("Thank you for your help", 4885); sendFrame75(NpcTalkTo, 4883); sendFrame164(4882); NpcDialogueSend = true; teleportToX = 2546; teleportToY = 9844; break; case 12: sendFrame200(4883, 591); sendFrame126(GetNpcName(NpcTalkTo), 4884); sendFrame126("Oh no, help me!", 4885); sendFrame75(NpcTalkTo, 4883); sendFrame164(4882); NpcDialogueSend = true; break; case 13: sendFrame200(4883, 591); sendFrame126(GetNpcName(NpcTalkTo), 4884); sendFrame126("Thank yo--wait, what happened!?", 4885); sendFrame75(NpcTalkTo, 4883); sendFrame164(4882); NpcDialogueSend = true; teleportToX = 2612; teleportToY = 9815; break; case 14: sendFrame200(4883, 591); sendFrame126(GetNpcName(NpcTalkTo), 4884); sendFrame126("You're really strong! Take this as a reward.", 4885); sendFrame75(NpcTalkTo, 4883); sendFrame164(4882); NpcDialogueSend = true; teleportToX = 3185; teleportToY = 3426; addItem(1149, 1); addItem(4087, 1); addItem(3140, 1); addItem(1187, 1); break;
Now it's time to add the drops.Code:if(NPCID == 0){ if(!IsItemInBag(2944)){ skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 8; } if(IsItemInBag(2887)){ skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 9; } } if(NPCID == 1571){ if(!IsItemInBag(2945)){ skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 10; } if(IsItemInBag(2944)){ skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 11; } } if(NPCID == 37){ if(!IsItemInBag(989)){ skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 12; } if(IsItemInBag(2945)){ skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 13; } if(IsItemInBag(989)){ skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 14; } }
WHITESCAPE
Open npcdrops.cfg and add these.
OTHER SERVERSCode:npcdrop = 53 0 2887 1 npcdrop = 55 0 2944 1 npcdrop = 54 0 2945 1 npcdrop = 50 0 989 1
Open Item2.java and add these, if any of these NPC's already have drops set then just add the drops into it.
Now open NpcHandler.java and search for:Code:public static int BlackDragon[] = {2945,2945,2945,2945}; public static int randomBlackDragon() { return BlackDragon[(int)(Math.random()*Name.length)]; } public static int RedDragon[] = {2887,2889,2887,2887}; public static int randomRedDragon() { return RedDragon[(int)(Math.random()*Name.length)]; } public static int BlueDragon[] = {2945,2945,2945,2945}; public static int randomBlueDragon() { return BlueDragon[(int)(Math.random()*Name.length)]; } public static int KBD[] = {2945,2945,2945,2945}; public static int randomKBD() { return KBD[(int)(Math.random()*Name.length)]; }
Under that add:Code:public void MonsterDropItem(int NPCID)
Now it's time to add a command to get there.Code:else if(npcs[NPCID].npcType == 54) { ItemHandler.addItem(526, npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false); ItemHandler.addItem(Item2.randomBlackDragon(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false); } else if(npcs[NPCID].npcType == 53) { ItemHandler.addItem(526, npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false); ItemHandler.addItem(Item2.randomRedDragon(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false); } else if(npcs[NPCID].npcType == 55) { ItemHandler.addItem(526, npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false); ItemHandler.addItem(Item2.randomBlueDragon(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false); } else if(npcs[NPCID].npcType == 50) { ItemHandler.addItem(526, npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false); ItemHandler.addItem(Item2.randomKBD(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false); }
Search for: ("pickup") in Client.java, above that add:
If you get:Code:else if (command.equalsIgnoreCase("dragon")) { teleportToX = 2663; teleportToY = 9805; }
You will have to open NpcHandler.java, you should see this at the top, public static int maxNPCDrops =, add a 0 to the number.Code:Exception in thread "main" java.lang.NumberFormatException: For input string: "5 5 0 2944 1" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at NPCHandler.loadNPCDrops(NPCHandler.java:753) at NPCHandler.<init>(NPCHandler.java:22) at server.main(server.java:23)
If your client freezes when you attack a monster you'll have to set the Dragon's HP in npc.cfg.
Credits: Sync
Pictures:
Added some pictures.








Reply With Quote![[Tut] Dragon Mini-Game](http://ragezone.com/hyper728.png)


