Author Topic: [DELTA] Adding and creating a 'Boss' (As well as other NPCs) [DELTA]  (Read 235 times)

Offline The Unholy

  • Steel Member
  • *
  • Posts: 36
  • Rep 4
    • View Profile
Difficulty: 2/10
Files edited: NPC.CFG, AutoSpawn.CFG, NPCHandler.Java
Credits: The Unholy

This tutorial will explain how to add 'bosses' into your server, including their attacks, health and drops. You may also learn how to add attacks and strengths to different kinds of regular NPC's too!

Ok, firstly, we're going to need to choose an NPC, for this I suggest looking through NPC.Config, for the purpose of this tutorial I'm going to use The Draugen.

Code: [Select]
npc = 1279 The_Draugen 69 70 11279 - The ID of the NPC.
The_Draugen - The name of the NPC (You may replace the underscore with a space)
69 - The combat level of the NPC (Changing this will do nothing)
70 -  The Health of the NPC.
1 - The respawn time of the NPC (in seconds)

Ok, so you may want to start by changing the monsters HP. For the purpose of this tutorial I'll change The Draugen's HP to 250, and a respawn time of 60 seconds. (Note that some monsters don't have a respawn time so you'll only see two numbers, the Combat level and the HP, to give the monster a respawn tab, simply tab after the second number and add any number, remember it's in seconds!)

Code: [Select]
npc = 1279 The_Draugen 69 250 60
Save and compile to make sure you have no errors.

Second open up Autospawn.CFG, we now want to add the NPC into your server! To get the coordinates of where you may want to add your NPC, many Delta bases use the ::mypos command.

Code: [Select]
spawn = 1279 3224 3489 2 3227 3492 3221 3486 1
SPAWN = NPCID       XCORD        YCORD         HEIGHT       WALKX+        WALKY+      WALKX-       WALKY-      1

It's hard for me to explain what this is about, basically if you want to make your NPC to move, have your WALKX/Y+'s 1-3 greater than the original X & Y coords, and have the WALKX/Y-'s 1-3 less than your original X & Y coords, as shown in my example.

Save and compile to make sure you have no errors.

Now the fun stuff! We're going to make your monster pro!  :tf:

Open up NPCHandler.java!

Search for:
Code: [Select]
case 2745:
Directly under that add:
Code: [Select]
case 1279:
The number (1279 in this case) is your NPC's ID!

If you want your NPC to be aggressive, search for
Code: [Select]
public boolean npcGetsAnnoyed(int Npc) {
And add:
Code: [Select]
case YOURNPCID:
Somewhere under an existing case, preferably case 2745: to avoid errors.

Now search for:
Code: [Select]
if (npcs[NPCID].npcType == 2745) { // jad
You should get something similar to:
Code: [Select]
if (npcs[NPCID].npcType == 2745) { // jad
  rand_npc = misc.random(500);
  }

If I'm not mistaken, each time the monster is attacked this method randomly makes its defence level somewhere between 1-500 ( in this case).
Underneath that method add:
Code: [Select]
if (npcs[NPCID].npcType == 1279) { // YOURNPCNAME
  rand_npc = misc.random(200); //NPCS RANDOM DEFENCE LIMIT
  }

Now search for:
Code: [Select]
} else if (npcs[NPCID].npcType == 82 && plr.ProtMelee == true) {
Underneath the complete method for npcType == 2, add this:
Code: [Select]
} else if (npcs[NPCID].npcType == 1279 && plr.ProtMelee == false) {
npcs[NPCID].animNumber = 64;
hitDiff = 20 + misc.random(55);
} else if (npcs[NPCID].npcType == 1279 && plr.ProtMelee == true) {
npcs[NPCID].animNumber = 64;
         hitDiff = 6 + misc.random(14);

EXPLANATION
For the first half of the code, if the npc type (ID) is 1279, and protect from melee is not active, the npc will always hit at least 20, plus a random number between 0-55. ( Resulting in a max hit of 75.)
For the second half of the code, if the npc type (ID) is 1279 and protect from melee is active, the npc will always hit at least 6 and a random number between 0-14. (Resulting in a max hit of 20).

If you would like to make the monster always hit zeros on Protection prayers, then change the hitDiff to 0 and remove '+misc.random(#);'.

The anim number is the monsters attack animation, change it to whatever you want :).

Save, compile, leave some feedback! :)




« Last Edit: March 29, 2011, 06:13:59 pm by The Unholy »

Share on Bluesky Share on Facebook


Offline Kyle

  • Administrator
  • Torva Member
  • *
  • Posts: 1636
  • Rep 10
    • View Profile

Offline Sam

  • Bandos Member
  • *
  • Posts: 372
  • Rep 1
    • View Profile
Good job! :)

Offline AdotSells

  • Firecape Member
  • *
  • Posts: 300
  • Rep 4
    • View Profile
Well done Broskie =D
Fame <3

Offline The Unholy

  • Steel Member
  • *
  • Posts: 36
  • Rep 4
    • View Profile
Thanks for the positive feedback  :hurr:

Offline Holy

  • Adamant Member
  • *
  • Posts: 98
  • Rep 0
  • The Next Lionel Messi.
  • Location: Written in the stars,Million miles away...
    • View Profile
Simple tutorial,should go under snippets most likely,anyways good job :)
+1Fame
-Holy

Offline AdotSells

  • Firecape Member
  • *
  • Posts: 300
  • Rep 4
    • View Profile
i say this is long enough for tutorial section tbh. 

Offline The Unholy

  • Steel Member
  • *
  • Posts: 36
  • Rep 4
    • View Profile
It would be a snippet if I hadn't explained the code, since I have, it's a tutorial  ;;)

Offline Tampon Abuse

  • Dragon Member
  • *
  • Posts: 193
  • Rep 1
  • All vote for Rune-Kingdom!
  • Location: Oklahoma, Oklahoma City
    • View Profile
Good Tutorial

Everyone Vote For RUNE-KINGDOM at http://www.mmorpgtop200.com/in.php?site=6792