Thread: [667/*] Npc drop with random amount

Results 1 to 5 of 5
  1. #1 [667/*] Npc drop with random amount 
    Registered Member
    Join Date
    Mar 2012
    Posts
    88
    Thanks given
    4
    Thanks received
    3
    Rep Power
    36
    Difficulty: 1/10
    Files edited: src.com.rs.game.npc.NPCDropLoader.java, src.com.rs.game.npc.NPC.java

    in the void load()
    change
    Code:
    drops.add(new Drop(buffer.getShort(), buffer.getDouble(), buffer.getInt()));
    to
    Code:
    drops.add(new Drop(buffer.getShort(), buffer.getDouble(), buffer.getInt(), buffer.getInt()));
    and change the whole "public static class Drop {" with this one:
    Code:
    public static class Drop {
    
    		public static Drop create(int itemId, int rate, int minAmount, int maxAmount) {
    			return new Drop((short) itemId, rate, minAmount, maxAmount);
    		}
    
    		private short itemId;
    		private double rate;
    		private int minAmount;
    		private int maxAmount;
    
    		public Drop(short itemId, double rate, int minAmount, int maxAmount) {
    			this.itemId = itemId;
    			this.rate = rate;
    			this.minAmount = minAmount;
    			this.maxAmount = maxAmount;
    		}
    
    		public short getItemId() {
    			return itemId;
    		}
    
    		public double getRate() {
    			return rate;
    		}
    
    		public void setItemId(short itemId) {
    			this.itemId = itemId;
    		}
    
    		public void setRate(double rate) {
    			this.rate = rate;
    		}
    
    		public int getMinAmount() {
    			return minAmount;
    		}
    		
    		public int getMaxAmount() {
    			return maxAmount;
    		}
    
    		public void setMinAmount(int minAmount) {
    			this.minAmount = minAmount;
    		}
    		
    		public void setMaxAmount(int maxAmount) {
    			this.maxAmount = maxAmount;
    		}
    	}
    in NPC.java;
    search for:
    Code:
    int chance =
    shoud be in the drop() method

    under it add:
    Code:
    int amount = Misc.random(d.getMinAmount(), d.getMaxAmount());
    Look a bit further for:
    Code:
    World.addGroundItem(new Item(d.getItemId(),.....
    replace it with:
    Code:
    World.addGroundItem(new Item(d.getItemId(), amount),
    							new WorldTile(getCoordFaceX(size),
    									getCoordFaceY(size), getPlane()), killer,
    							false, 180, true);

    use this as DropEditor; [Only registered and activated users can see links. ]

    credits:
    Steve for the original DropEditor (Dementhium source)
    Me


    in DropEditor you will add drops as:
    itemId
    dropRate
    minAmount
    maxAmount
    Reply With Quote  
     

  2. #2  
    Registered Member
    maffia-rpg's Avatar
    Join Date
    Jul 2011
    Posts
    2,776
    Thanks given
    587
    Thanks received
    759
    Rep Power
    120
    Orient didnīt made the original drop editor.
    Quote Originally Posted by Nando View Post
    why would I care about trying to get you to care about me homosexual?
    back to coding shit revisions
    1080% lost.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Mar 2012
    Posts
    88
    Thanks given
    4
    Thanks received
    3
    Rep Power
    36
    sorry i'll change it, you know who did make it?
    Reply With Quote  
     

  4. #4  
    Hi.

    'Mystic Flow's Avatar
    Join Date
    Nov 2007
    Posts
    7,141
    Thanks given
    256
    Thanks received
    1,247
    Rep Power
    3636
    Quote Originally Posted by Coinflipper View Post
    sorry i'll change it, you know who did make it?
    Steve was the one who made it, that was from the Dementhium source

    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    Registered Member
    Join Date
    Mar 2012
    Posts
    88
    Thanks given
    4
    Thanks received
    3
    Rep Power
    36
    Quote Originally Posted by 'Mystic Flow View Post
    Steve was the one who made it, that was from the Dementhium source
    Alright ty, added credits
    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. Using Math Random in Array (NPC Drop System)
    By Project-317 in forum Help
    Replies: 10
    Last Post: 05-01-2012, 12:29 PM
  2. Replies: 6
    Last Post: 09-23-2011, 04:33 AM
  3. Random amount of an item on a drop[DELTA]
    By shoopdawhoop in forum Snippets
    Replies: 2
    Last Post: 12-10-2010, 11:43 AM
  4. [Delta]Monster drop random amount of item
    By shoopdawhoop in forum Tutorials
    Replies: 8
    Last Post: 05-12-2010, 12:18 PM
  5. Making a NPC drop random items.
    By Mafia in forum Tutorials
    Replies: 4
    Last Post: 12-04-2007, 05:56 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •