Thread: npcdrops

Results 1 to 10 of 10
  1. #1 npcdrops 
    Banned
    Join Date
    Jan 2012
    Age
    27
    Posts
    551
    Thanks given
    53
    Thanks received
    37
    Rep Power
    0
    When i kill a monster i never get loot, even tho in, npcdrops.tsm there is added drops, and in npcdrops.cfg, anyone knows whats wrong?
    Reply With Quote  
     

  2. #2  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    It could be easily loaded through NPCHandler, like a couple select good private server. Pastin the class.
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Jan 2012
    Age
    27
    Posts
    551
    Thanks given
    53
    Thanks received
    37
    Rep Power
    0
    Quote Originally Posted by Gohan View Post
    It could be easily loaded through NPCHandler, like a couple select good private server. Pastin the class.
    how do i activate it then ?
    Reply With Quote  
     

  4. #4  
    Banned
    Join Date
    Jan 2012
    Age
    27
    Posts
    551
    Thanks given
    53
    Thanks received
    37
    Rep Power
    0
    is anyone going to help me?
    Reply With Quote  
     

  5. #5  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Quote Originally Posted by Tha King View Post
    how do i activate it then ?
    Search for dropItems in NPCHandler.java in the npcs directory. In that method there will be a line that states how they're dropped. If you would rather upload your NPCHandler class like I first suggested this could be fixed a lot sooner...

    Quote Originally Posted by Tha King View Post
    is anyone going to help me?
    You've waited 8 minutes for a reply, be more patient.
    Reply With Quote  
     

  6. #6  
    Banned
    Join Date
    Jan 2012
    Age
    27
    Posts
    551
    Thanks given
    53
    Thanks received
    37
    Rep Power
    0
    Quote Originally Posted by Gohan View Post
    Search for dropItems in NPCHandler.java in the npcs directory. In that method there will be a line that states how they're dropped. If you would rather upload your NPCHandler class like I first suggested this could be fixed a lot sooner...



    You've waited 8 minutes for a reply, be more patient.
    is it this?

    Code:
    	public void dropItems(int i) {
    		int npc = 0;
    		//long start = System.currentTimeMillis();
    		Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
    		if(c != null) {
    			if (npcs[i].npcType == 912 || npcs[i].npcType == 913 || npcs[i].npcType == 914)
    				c.magePoints += 1;
    			if (npcs[i].npcType == 3847)
    			c.getItems().deleteItem(14123,1);
    			c.getItems().deleteItem(13740,1);
    			 } else { 
    			c.getItems().addItem(14123,1);
    			c.getItems().addItem(13740,1);
    		c.sendMessage("Here Take A Divine Spirit Sheild & Chaotic Rapier For The Battle!");
    			if(npcs[i].npcType == 3340)
    		c.getItems().addItem(995,10000000);
    		c.getItems().deleteItem(13744,10);
    		c.getItems().deleteItem(13740,10);
    		c.getItems().deleteItem(14125,10);
    		c.getItems().deleteItem(14123,10);
    		c.sendMessage("Congratulations on completing new Dung mini-game!");
    		c.sendMessage("You have received 100 Pkp Points && 10Mill!!");
    		c.getPA().movePlayer(3559, 9895, 0);
    		c.pkPoints += 100;
    			if(npcs[i].npcType == 253)  {
    				c.Assaultkills += 1;
    				c.sendMessage("Assault Points: " + c.Assaultkills);
    			}

    or

    Code:
    dropItems(i); // npc drops items!
    Reply With Quote  
     

  7. #7  
    Programming Enthusiast

    o paws's Avatar
    Join Date
    Sep 2011
    Age
    28
    Posts
    301
    Thanks given
    52
    Thanks received
    40
    Rep Power
    108
    In your npcs folder add make a text file called NPCDrops.java and add this in it
    Code:
    package server.model.npcs;
    
    import java.io.File;
    import java.util.HashMap;
    import java.util.StringTokenizer;
    import java.util.Scanner;
    
    /**
     * @author Sanity
     */
    
    public class NPCDrops {
    	
    	public NPCDrops() {
    		loadDrops();
    	}
    	
    
    	
    	public static HashMap<Integer, int[][]> normalDrops = new HashMap<Integer, int[][]>();
    	public static HashMap<Integer, int[][]> rareDrops = new HashMap<Integer, int[][]>();
    	public static HashMap<Integer, int[]> constantDrops = new HashMap<Integer, int[]>();
    	public static HashMap<Integer, Integer> dropRarity = new HashMap<Integer,Integer>();
    	
    	public void loadDrops() {
    		try {
    			int[][][] npcDrops = new int [62585][][];
    			int[][][] rareDrops2 = new int [62585][][];
    			int[] itemRarity = new int [62585];
    			File f = new File("./Data/cfg/NPCDrops.TSM");
    			Scanner s = new Scanner(f);
    			while (s.hasNextLine()) {
    				String line = s.nextLine();
    				if (line.startsWith("#"))
    					continue;
    				StringTokenizer normalTok = new StringTokenizer(line, "\t");
    				line = s.nextLine();
    				if (line.startsWith("#"))
    					continue;
    				StringTokenizer rareTok = new StringTokenizer(line, "\t");
    				String[] information = normalTok.nextToken().split(":");
    				int npcId = Integer.parseInt(information[0]);
    				itemRarity[npcId] = Integer.parseInt(information[1])-1;
    				npcDrops[npcId] = new int[normalTok.countTokens()][2];
    				rareDrops2[npcId] = new int[rareTok.countTokens()][2];
    				int count = 0;
    				while (normalTok.hasMoreTokens()) {
    					String[] temp = normalTok.nextToken().split(":");
    					npcDrops[npcId][count][0] = Integer.parseInt(temp[0]);
    					npcDrops[npcId][count][1] = Integer.parseInt(temp[1]);
    					count++;
    				}
    				count = 0;
    				while (rareTok.hasMoreTokens()) {
    					String[] temp = rareTok.nextToken().split(":");
    					rareDrops2[npcId][count][0] = Integer.parseInt(temp[0]);
    					//System.out.println("Raredrop: " + count + " " + rareDrops2[npcId][count][0]);
    					rareDrops2[npcId][count][1] = Integer.parseInt(temp[1]);
    					//System.out.println("Raredrop: " + count + " " + rareDrops2[npcId][count][1]);
    					count++;
    				}
    				normalDrops.put(npcId, npcDrops[npcId]);
    				rareDrops.put(npcId, rareDrops2[npcId]);
    				dropRarity.put(npcId, itemRarity[npcId]);
    			}
    			loadConstants();
    		} catch (Exception e) {
    			e.printStackTrace();
    		}	
    	}
    	
    	public void loadConstants() {
    		try {
    			File f = new File("./Data/cfg/NpcConstants.TSM");
    			Scanner s = new Scanner(f);
    			while (s.hasNextLine()) {
    				String line = s.nextLine();
    				if (line.startsWith("#"))
    					continue;
    				StringTokenizer constantTok = new StringTokenizer(line, "\t");
    				int npcId = Integer.parseInt(constantTok.nextToken());
    				int count = 0;
    				int[] temp = new int[constantTok.countTokens()];
    				while (constantTok.hasMoreTokens()) {
    					temp[count] = Integer.parseInt(constantTok.nextToken());
    					count++;
    				}
    				constantDrops.put(npcId,temp);
    			}
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	
    	}
    	
    	
    }
    Also make sure to use tabs between items and amounts in the tsm file
    Reply With Quote  
     

  8. #8  
    Banned
    Join Date
    Jan 2012
    Age
    27
    Posts
    551
    Thanks given
    53
    Thanks received
    37
    Rep Power
    0
    Quote Originally Posted by ForgivenX View Post
    In your npcs folder add make a text file called NPCDrops.java and add this in it
    Code:
    package server.model.npcs;
    
    import java.io.File;
    import java.util.HashMap;
    import java.util.StringTokenizer;
    import java.util.Scanner;
    
    /**
     * @author Sanity
     */
    
    public class NPCDrops {
    	
    	public NPCDrops() {
    		loadDrops();
    	}
    	
    
    	
    	public static HashMap<Integer, int[][]> normalDrops = new HashMap<Integer, int[][]>();
    	public static HashMap<Integer, int[][]> rareDrops = new HashMap<Integer, int[][]>();
    	public static HashMap<Integer, int[]> constantDrops = new HashMap<Integer, int[]>();
    	public static HashMap<Integer, Integer> dropRarity = new HashMap<Integer,Integer>();
    	
    	public void loadDrops() {
    		try {
    			int[][][] npcDrops = new int [62585][][];
    			int[][][] rareDrops2 = new int [62585][][];
    			int[] itemRarity = new int [62585];
    			File f = new File("./Data/cfg/NPCDrops.TSM");
    			Scanner s = new Scanner(f);
    			while (s.hasNextLine()) {
    				String line = s.nextLine();
    				if (line.startsWith("#"))
    					continue;
    				StringTokenizer normalTok = new StringTokenizer(line, "\t");
    				line = s.nextLine();
    				if (line.startsWith("#"))
    					continue;
    				StringTokenizer rareTok = new StringTokenizer(line, "\t");
    				String[] information = normalTok.nextToken().split(":");
    				int npcId = Integer.parseInt(information[0]);
    				itemRarity[npcId] = Integer.parseInt(information[1])-1;
    				npcDrops[npcId] = new int[normalTok.countTokens()][2];
    				rareDrops2[npcId] = new int[rareTok.countTokens()][2];
    				int count = 0;
    				while (normalTok.hasMoreTokens()) {
    					String[] temp = normalTok.nextToken().split(":");
    					npcDrops[npcId][count][0] = Integer.parseInt(temp[0]);
    					npcDrops[npcId][count][1] = Integer.parseInt(temp[1]);
    					count++;
    				}
    				count = 0;
    				while (rareTok.hasMoreTokens()) {
    					String[] temp = rareTok.nextToken().split(":");
    					rareDrops2[npcId][count][0] = Integer.parseInt(temp[0]);
    					//System.out.println("Raredrop: " + count + " " + rareDrops2[npcId][count][0]);
    					rareDrops2[npcId][count][1] = Integer.parseInt(temp[1]);
    					//System.out.println("Raredrop: " + count + " " + rareDrops2[npcId][count][1]);
    					count++;
    				}
    				normalDrops.put(npcId, npcDrops[npcId]);
    				rareDrops.put(npcId, rareDrops2[npcId]);
    				dropRarity.put(npcId, itemRarity[npcId]);
    			}
    			loadConstants();
    		} catch (Exception e) {
    			e.printStackTrace();
    		}	
    	}
    	
    	public void loadConstants() {
    		try {
    			File f = new File("./Data/cfg/NpcConstants.TSM");
    			Scanner s = new Scanner(f);
    			while (s.hasNextLine()) {
    				String line = s.nextLine();
    				if (line.startsWith("#"))
    					continue;
    				StringTokenizer constantTok = new StringTokenizer(line, "\t");
    				int npcId = Integer.parseInt(constantTok.nextToken());
    				int count = 0;
    				int[] temp = new int[constantTok.countTokens()];
    				while (constantTok.hasMoreTokens()) {
    					temp[count] = Integer.parseInt(constantTok.nextToken());
    					count++;
    				}
    				constantDrops.put(npcId,temp);
    			}
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	
    	}
    	
    	
    }
    Also make sure to use tabs between items and amounts in the tsm file
    npc folder?, i got no npcfolder

    its all here: C:\Users\Simon\Desktop\cobrascape-source\Data\cfg
    Reply With Quote  
     

  9. #9  
    Programming Enthusiast

    o paws's Avatar
    Join Date
    Sep 2011
    Age
    28
    Posts
    301
    Thanks given
    52
    Thanks received
    40
    Rep Power
    108
    Do you have team viewer? This would be a lot easier to show you in that
    Reply With Quote  
     

  10. #10  
    Banned
    Join Date
    Jan 2012
    Age
    27
    Posts
    551
    Thanks given
    53
    Thanks received
    37
    Rep Power
    0
    yh ill pm info
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 4
    Last Post: 01-31-2012, 08:51 AM
  2. Devo npcdrops No more ITEM2.java just npcdrops.cfg
    By zaradomin in forum Tutorials
    Replies: 10
    Last Post: 06-25-2010, 08:33 AM
  3. npcdrops
    By coolmarcis in forum Help
    Replies: 7
    Last Post: 03-07-2010, 04:26 PM
  4. npcdrops..
    By Sneerz in forum Help
    Replies: 1
    Last Post: 11-18-2009, 12:13 PM
  5. npcdrops
    By austin_gct in forum Help
    Replies: 2
    Last Post: 10-20-2009, 12:53 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •