W00tSc4p3 V5
March 22, 2010, 06:20:29 am
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to the w00tsc4p3 V5 forum!
 
  Home   Forum   Help Search Arcade Gallery Staff List Login Register  

How to make NPC's Attack With Mage


Pages: [1]   Go Down
  Print  
Author Topic: How to make NPC's Attack With Mage  (Read 16 times)
Lego My eggo
Full Member
*

Rep: 0
Offline Offline

Moods: http://i95.photobucket.com/albums/l142/guitarmadness/Blah.gif
Posts: 12


View Profile WWW Email
« on: December 23, 2007, 07:18:40 pm »

Purpose: To make NPCS attack with mage, and do animations!

Difficulty: 4/10

Server base: Any

Clbuttes modified: NPCHandler

NOTE: BACKUP YOUR SERVER!!!!

Step 1: Open NPCHandler ..

Step 2: Find..

Code:

Code:
AttackPlayerMage(i)

You should see something like...

Code:

Code:
                                                if(npcs[i].npcType == 1645 || npcs[i].npcType == 1913 || npcs[i].npcType == 1241 || npcs[i].npcType == 1246 || npcs[i].npcType == 1977 || npcs[i].npcType == 1914 || npcs[i].npcType == 1975)
                                                AttackPlayerMage(i);

Step 3:

On the end of that number, 1975.. Add this

Code:
Code:
|| npcs[i].npcType == XXXX)

So it would look like..

Code:
Code:
                                                if(npcs[i].npcType == 1645 || npcs[i].npcType == 1913 || npcs[i].npcType == 1241 || npcs[i].npcType == 1246 || npcs[i].npcType == 1977 || npcs[i].npcType == 1914 || npcs[i].npcType == 1975 || npcs[i].npcType == XXXX)
                                                AttackPlayerMage(i);

Ok basically, the XXXX means the npc ID.. So lets use Jad as an example..


Code:


Code:
                                                if(npcs[i].npcType == 1645 || npcs[i].npcType == 1913 || npcs[i].npcType == 1241 || npcs[i].npcType == 1246 || npcs[i].npcType == 1977 || npcs[i].npcType == 1914 || npcs[i].npcType == 1975 || npcs[i].npcType == 2745)
                                                AttackPlayerMage(i);

Ok now you have added Jad to attack with mage, now to set his spell GFX and his animation when attacking..

Step 4:

(Now this is where it varies alot.. Depending on which sevrer source you have...)

Ok right, if you look above, where you just added jad to attack with mage. You will see (the first NPC) is..

Code:

Code:
if(npcs[i].npcType == 1645

Now your will be different, depending on what source your using.. Anyways.. Your first NPC, search it in NPCHandler, untill you come to something like this...

Code:

                                         
Code:
      if(npcs[NPCID].npcType == XXXX) {
                                               p.stillgfx(YYY, p.absY, p.absX);
                                               hitDiff = 6 + misc.random(PP);
                                               }
Ok now, add this with your others... Change the XXXX, to the NPC ID...
The YYY means GFX that the npc attacks with..
And PP means the hit.. So if you put, hitDiff 6 + misc.random(50);
It will do a random hit below 56...

Step 5:
Now to add the animation of what the NPC does... underneath

Code:

Code:
if(npcs[NPCID].npcType == XXXX) {

Add this..

Code:

Code:
npcs[NPCID].animNumber = MMM; // mage attack

MMM = The animation that the npc does... (Change it)..

Alright now, small example of what it should be like, again, i will use jad..

Code:

                                         
Code:
      if(npcs[NPCID].npcType == 2745) {
                                               npcs[NPCID].animNumber = 2565; // mage attack
                                               p.stillgfx(451, p.absY, p.absX);
                                               hitDiff = 6 + misc.random(70);
                                               }
Okay, thats how jad hits in real rs, the GFX and the animation.. I think i might have got the animation wrong, if its not 2565, its 2656..

Step 6:
This is how to make your npc hit with double gfx... Really simple..

Code:

                                           
Code:
   if(npcs[NPCID].npcType == 2745) {
                                               npcs[NPCID].animNumber = 2565; // mage attack
                                               p.stillgfx(451, p.absY, p.absX);
                                               p.stillgfx(452, p.absY, p.absX);
                                               hitDiff = 6 + misc.random(70);
                                               }
That will hit with GFX 451, and 452..

Step 7:
NOTE: This is only for some sources.. WILL NOT work on others...
Okay, this part is to like, make prayer effect work...
Replace what you added with.

Code:


         
Code:
if(npcs[NPCID].npcType == 2745) { //Jad
if (misc.random(2)==1) {
npcs[NPCID].animNumber = 2656; // mage attack
                                               p.stillgfx(451, p.absY, p.absX);
p.EntangleDelay = 10;
if (server.playerHandler.players[Player].MagicProtect == false) {
                                               hitDiff = 0 + misc.random(70);
}
if (server.playerHandler.players[Player].MagicProtect == true) {
hitDiff = misc.random(120/2);
}
} else {
if (GoodDistance(npcs[NPCID].absX, npcs[NPCID].absY, EnemyX, EnemyY, 2) == true) {
if (server.playerHandler.players[Player].MeleeProtect == false) {
                                               hitDiff = 0 + misc.random(70);
}
if (server.playerHandler.players[Player].MeleeProtect == true) {
hitDiff = misc.random(120/2);
}
npcs[NPCID].animNumber = 451; // mage attack
} else {
npcs[NPCID].animNumber = 2656; // mage attack
                                               p.stillgfx(451, p.absY, p.absX);
p.EntangleDelay = 10;
if (server.playerHandler.players[Player].MagicProtect == false) {
                                               hitDiff = 0 + misc.random(70);
}
if (server.playerHandler.players[Player].MagicProtect == true) {
hitDiff = misc.random(120/2);
}
}
}
                                                }

Thanks If it doesn't work ask someone this was the best i could do and i f works rep me


Share Report Spam   Logged


Pages: [1]   Go Up
  Print  
 
Jump to:  


Get Your Own Chat Box! Go Large!
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Hostgator Hosting