Ok well, I made this tutorial because a good bit of people do not know how to do this.
Difficulty: 2/10
Files being changed:
Autospawn.cfg
NPChandler.java
Item2.java
npc.cfg (Only if you want to change the NPC's health)
First thing you need to do is make the NPC. To do this, go into your autospawn.cfg file. Now, fill in a new line for your new NPC.
spawn = [NPCID] [XCOORD] [YCOORD] 0 0 0 0 0 1 [NPCDESCRIPTION]
Now, go into your NPChandler.java file and search
public void MonsterDropItem(int NPCID)
Underneath the line
!= null) {
Add in
if (npcs[NPCID].npcType == [NPCID]) {
ItemHandler.addItem(Item2, random[NPCNAME](),
npcs[NPCID].absX, npcs[NPCID].absY, 1,
GetNpcKiller(NPCID), false);
}
Now open up your Item2.java file. At the bottom before the last closing bracket (It looks like this "}" for those that don't know), copy and paste the following and fill in what you need.
public static int [NPCNAME][] = { [ID'S OF ITEMS YOU WANT IT TO DROP};
public static int random[NPCNAME]() {
return [NPCNAME][(int) (Math.random() * [NPCNAME].length)];
}
Now if you want to change the amount of health your new NPC has, go into your npc.cfg file. Search for the ID of your new NPC.
npc = [NPCID] [NPCNAME] [NPCLEVEL] [NPCHEALTH]
If you need any help or get an error, please send me a private message. Thank you.