Thread: Help with Npc vs Npc

Results 1 to 7 of 7
  1. #1 Help with Npc vs Npc 
    Registered Member
    Join Date
    Jun 2010
    Posts
    211
    Thanks given
    12
    Thanks received
    1
    Rep Power
    7
    I've added a Npc vs Npc system into my server but how can i activate it?
    Reply With Quote  
     

  2. #2  
    Banned
    Join Date
    May 2010
    Posts
    1,550
    Thanks given
    92
    Thanks received
    154
    Rep Power
    0
    So, you have the knowledge to add NPC vs NPC, but can't "activate" it?

    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jun 2010
    Posts
    211
    Thanks given
    12
    Thanks received
    1
    Rep Power
    7
    i was helped with it...
    Reply With Quote  
     

  4. #4  
    Community Veteran

    Dust R I P's Avatar
    Join Date
    Jan 2008
    Posts
    2,599
    Thanks given
    197
    Thanks received
    221
    Rep Power
    586
    If you don't know how you don't deserve it
    Reply With Quote  
     

  5. #5  
    Registered Member
    Lil Str Kid's Avatar
    Join Date
    Jul 2007
    Age
    31
    Posts
    1,302
    Thanks given
    169
    Thanks received
    71
    Rep Power
    260
    How is your npc vs npc done?

    Entity? or are players and npc handled differently?


    Reply With Quote  
     

  6. #6  
    Banned

    Join Date
    Jan 2009
    Age
    31
    Posts
    2,661
    Thanks given
    66
    Thanks received
    207
    Rep Power
    0
    i'm not sure how your source is but heres an example

    add method in npchandler like this

    This will make npc Index's attack each other NOT IDS!!
    so make sure you figure out what each npcs index is so you can set them properly
    i have it making npcs 1 attack 2
    and 3 attack 4
    and 5 attack 6

    Choose 1 Of the 2 which ever you like better.
    Code:
              static {
                     setNPCAttackers();
              }
    
              public NPC() {
                     setNPCAttackers();
              }
    Then Add This Inside Your Npc Class And Change NPC to your npc class's name that holds the npc stuff.
    Code:
              private static final NPC[][] AUTO_ATTACK_NPCS = {{1,2},{3,4},{5,6}};
    
              private static void setNPCAttackers() {
                     for(NPC[] n : AUTO_ATTACK_NPCS) {
                         NPCS[n[0]].setAlwaysAttack(NPCS[n[1]]);
                         NPCS[n[1]].setAlwaysAttack(NPCS[n[0]]);
                     }
              }
    Code:
             private NPC alwaysAttack;
    
             public void setAlwaysAttack(NPC n) {
                     alwaysAttack = n;
             }
    
             public NPC getAlwaysAttack() {
                     return alwaysAttack;
             }
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jun 2010
    Posts
    211
    Thanks given
    12
    Thanks received
    1
    Rep Power
    7
    so then when ever I'm making a minigame and I want Npc vs Npc just add

    Code:
    setNPCAttackers()
    Reply With Quote  
     


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
  •