Thread: NPC drops system

Results 1 to 4 of 4
  1. #1 NPC drops system 
    pljay03
    Guest
    Basically how it works is you create a new text file with the ID of the NPC as the name. Then you can easily add the types of drops (be it rare, common, etc.) and then the item ID, and the amount. Here's an example:
    Code:
    #npc
    name "Vampire"
    level "72"
    health "86"
    
    #bones
    type "always"	526	1
    type "always"	528	1
    type "always"	531	6
    
    #party hats
    type "super_rare"	1038	1
    type "super_rare"	1040	2
    type "super_rare"	1042	3
    type "super_rare"	1044	4
    type "super_rare"	1046	5
    type "super_rare"	1048	6
    
    #whip + cannon parts
    type "rare"	4151	1
    type "rare"	6	1
    type "rare"	8	1
    type "rare"	10	1
    type "rare"	12	1
    
    #rare runes
    type "uncommon"	565	3
    type "uncommon" 566 4
    
    #regular runes
    type "common" 554 50
    type "common" 555 12
    type "common" 556 17
    type "common" 557 10
    type "common" 558 10
    type "common" 559 10
    type "common" 560 10
    type "common" 561 8
    type "common" 562 6
    type "common" 563 3
    type "common" 564 17
    Here are some drop rates, you kill this NPC ten times, here are your chances:
    Code:
    NPCAI> Super rare:      0
    NPCAI> Rare:            0
    NPCAI> Uncommon:        4
    NPCAI> Common:          6
    You kill this NPC 100 times, here are your chances:
    Code:
    NPCAI> Super rare:      0
    NPCAI> Rare:            5
    NPCAI> Uncommon:        21
    NPCAI> Common:          74
    You kill this NPC 1000 times, here are your chances:
    Code:
    NPCAI> Super rare:      6
    NPCAI> Rare:            37
    NPCAI> Uncommon:        220
    NPCAI> Common:          737
    You guys have any suggestions? And if people like it, I can release it.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Nov 2008
    Posts
    385
    Thanks given
    8
    Thanks received
    7
    Rep Power
    15
    Really nice did you just make them into like percents? Like super rare = 5 percent common = 80 percent?
    [Only registered and activated users can see links. ] To see my latest project
    Reply With Quote  
     

  3. #3  
    pljay03
    Guest
    Quote Originally Posted by *~Pwnt~* View Post
    Really nice did you just make them into like percents? Like super rare = 5 percent common = 80 percent?
    Thanks

    I didn't use percents simply because I'm pretty stupid when it comes to mathematics, but the drop rates are pretty good right now though I think. Here's how it works:
    Code:
    	public void TestDropRate(int kills)
    	{
    		int Difference;
    		
    		for (int x = 0; x < kills; x++)
    		{
    			int ChanceOne = misc.random(100), ChanceTwo = misc.random(100);
    			Difference = (ChanceOne > ChanceTwo ? ChanceOne - ChanceTwo : ChanceTwo - ChanceOne);
    			
    			if (Difference == 0) super_rare++;
    			else if (Difference > 0 && Difference < 3) rare++;
    			else if (Difference > 2 && Difference < 16) uncommon++;
    			else common++;	
    		}
    		
    		log("Super rare: \t" + super_rare);
    		log("Rare: \t\t" + rare);
    		log("Uncommon: \t" + uncommon);
    		log("Common: \t\t" + common);
    	}
    Let's for example the drop it chose was a rare one, it would read through all the rare drops in the text file, and choose one of them randomly.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jan 2008
    Posts
    1,778
    Thanks given
    0
    Thanks received
    7
    Rep Power
    0
    Looks good i suppose
    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

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •