Get your own Chat Box! Go Large!
ChassyScape Forums
November 22, 2009, 06:24:51 am
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Remember, downloads MUST have a virus scan.
 
  Home Help Search Arcade Staff List Login Register  

[TUT]How to add in a new NPC and add in drops[TUT]


Pages: [1]
  Print  
Author Topic: [TUT]How to add in a new NPC and add in drops[TUT]  (Read 54 times)
koopa king
Fairly Good Poster
***

Rep: 2
Posts: 164


And We Shall Let Their Cities Burn

k00p4k1ng
View Profile
« on: June 21, 2009, 10:55:10 pm »

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.
Code:
spawn = [NPCID] [XCOORD] [YCOORD] 0 0 0 0 0 1 [NPCDESCRIPTION]

Now, go into your NPChandler.java file and search
Code:
public void MonsterDropItem(int NPCID)
Underneath the line
Code:
!= null) {
Add in
Code:
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.
Code:
    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.
Code:
npc = [NPCID] [NPCNAME] [NPCLEVEL] [NPCHEALTH]

If you need any help or get an error, please send me a private message. Thank you.
Report Spam   Logged



Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal

Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2006, Simple Machines LLC
ServerBeach Coupon