-
Adding NPC Drop's
This is acualy VERY simple. You will need to modify 2 .java files, these are: Item2.java and NPCHandler.java.
We will start with NPCHandler.java, Search for:
Code:
public static boolean IsDropping = false;
and near the end of that you see somthing like
Code:
if (server.itemHandler.DroppedItemsID[i] > 0) {
} else {
Lets say you wanted to add a abyssal demon's drop's, you would add
Code:
if(npcs[NPCID].npcType == 1615) {
ItemHandler.addItem(Item2.randomAbyssal(), npcs[NPCID].absX, npcs[NPCID].absY, 1,
GetNpcKiller(NPCID), false);
}
now, notice is seys Item2.randomAbyssal(). That is what its looking for, so, now save that and open Item2.java and make sure you have this at the very very top:
Code:
import java.io.*;
public class Item2
{
if you do, after the { add
Code:
public static int abyssal[] = {592,4111,4113,2503,2489,3749,577,772,592,544,772};
public static int randomAbyssal()
{
return abyssal[(int)(Math.random()*abyssal.length)];
}
now you have abyssal demon's droping items, the numbers in
Code:
abyssal[] = {592,4111,4113,2503,2489,3749,577,772,592,544,772};
are the item ID's
and are very inportant, these are what you change in npchandler as well, lets say you wanted it to be Ahrim's. You would change them to:
and (in item2.java) and in NPCHandler.java you would change
Code:
(Item2.randomAbyssal()
to [code[(Item2.randomAhrims()[/code]. Now you can see that the Ahrims() is the same in Item2.java and NPCHandler.java.
Here is the basic layout of the code's you need to be able to add drop's.
Item2.java Code
Code:
public static int NAME OF NPC[] = {ITEM ID'S THAT DROP SEPERATE WITH A ,};
public static int randomWHAT YOUR GOING TO ADD INTO NPCHANDLER.JAVA()
{
return NAME OF NPC[(int)(Math.random()*NAME OF NPC.length)];
}
NPCHandler.java Code
Code:
if(npcs[NPCID].npcType == @@@@) {
ItemHandler.addItem(Item2.randomItem2.java RandomNAME HERE(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false);
}
the @'s are the NPC's ID
I hoep this helps every1 :)
~ Newservermaker of Rune-server.org and Moparscape.org
-
-
Can be item.java , item3.java and you only need it to save space in npchandler for multiple drops.
Fabjan made a better version of this.
-
true(h) (yes i will pickup my egoism before someone trips over it ;))
-