Thread: Making Npcs attack with Mage! - ##

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1 Making Npcs attack with Mage! - ## 
    Oo Java
    Guest
    Purpose: To make NPCS attack with mage, and do animations!

    Difficulty: 4/10

    Server base: Any

    Classes modified: NPCHandler

    NOTE: BACKUP YOUR SERVER!!!!

    Step 1: Open NPCHandler ..

    Step 2: Find..

    Code:
    AttackPlayerMage(i)
    You should see something like...

    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:
    || npcs[i].npcType == XXXX)
    So it would look like..

    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:
                                                    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:
    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:
                                                   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:
    if(npcs[NPCID].npcType == XXXX) {
    Add this..

    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:
                                                   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:
                                                   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:
    			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);
    			}
    			}
    			}
                                                   	}
    Okay this is pretty simple, if your not using Magic Protect/Melee Protect, jad will hit 70..
    If you are using using Magic/Melee protect, he will only hit 120/2..

    Again, if you havent got these methods/ints. It will not work, so i suggest not to use the one above.. If your server has an entirely different one, what you can do, is copy it.. paste it underneath and edit it.. so it will work.

    Credits: 100% me

    -- Post all errors, ill be happy to help! Hope you liked

    P.S - Really sorry this is kinda long, yes it could have been shorter, but i wanted to explain it fully and not word it wrong.. If i have worded something wrong, please tell me what you dont understand

    Thanks

    - NOTE: I r X J K X off mopar, dont say i leeched. This is found in many sources, but this explains how to add new ones.
     

  2. #2  
    Banned

    Join Date
    May 2007
    Posts
    2,690
    Thanks given
    115
    Thanks received
    45
    Rep Power
    0
    nice tut again
     

  3. #3  
    Oo Java
    Guest
    Quote Originally Posted by A N G E L View Post
    nice tut again
    Thanks, again lol
     

  4. #4  
    Swift Sneckers Joker~'s Avatar
    Join Date
    Jan 2007
    Posts
    181
    Thanks given
    0
    Thanks received
    1
    Rep Power
    8
    nice tut again
    I'm a oldie


    been here since jan 2007, thats like 3 years
     

  5. #5  
    Money
    Guest
    sorry the npcs ju7st attacks with melee
     

  6. #6  
    Oo Java
    Guest
    Quote Originally Posted by Money View Post
    sorry the npcs ju7st attacks with melee
    You've done it wrong then because ive tested on like 5-7 sources, works perf
     

  7. #7  
    Valar Morghulis

    Laxika's Avatar
    Join Date
    Sep 2006
    Age
    32
    Posts
    2,813
    Thanks given
    1,804
    Thanks received
    274
    Rep Power
    2128
    Very nice!
     

  8. #8  
    Oo Java
    Guest
    Quote Originally Posted by laxika View Post
    Very nice!
    Thank you
     

  9. #9  
    Mr.Andrew Gover
    Guest
    you keep make tuts that other ppl have maked lol

    EDIT:: try replay a tut that uhh npc attack npc and npc attack pp100% magic new mini game or quest and much moreeeeee!
     

  10. #10  
    Oo Java
    Guest
    Quote Originally Posted by Mr.ROFLMAO View Post
    you keep make tuts that other ppl have maked lol

    EDIT:: try replay a tut that uhh npc attack npc and npc attack pp100% magic new mini game or quest and much moreeeeee!
    Hmm i havent seen one like this, and ive been using forums for bout 1 yr *Not rune-server*
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •