Thread: [562/659/] Npc vs npc

Results 1 to 2 of 2
  1. #1 [562/659/] Npc vs npc 
    Registered Member
    Join Date
    Feb 2010
    Posts
    252
    Thanks
    9
    Thanked 29 Times in 19 Posts
    Rep Power
    4
    Hey I was wondering how exactly would I make a npc attack each other? I know on the server there is already a npcvsnpc.java and a command that allows npcid vs npcid.
    Code:
    } else if(cmd[0].equals("npcattack") && (player.coowner == 1 || player.owner == 1 || player.getUsername().equals("bob"))) {
    					if(cmd.length == 3) {
    						NPC n1 = World.getWorld().getNpcs().get(Integer.valueOf(cmd[1]));
    						NPC n2 = World.getWorld().getNpcs().get(Integer.valueOf(cmd[2]));
    						Combat.attack(n1, n2);
    					} else {
    						player.getActionSender().sendMessage("Invalid syntax, use: [id1] [id2].");
    					}
    When i use the code the 2 npcs just turn and look at each other o.O and they don't attack. Im thinking that I need to modify something in npcvsnpc.java but I don't know which.

    Thanks
    Last edited by darkside1222; 04-29-2012 at 11:54 PM. Reason: fixed.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Feb 2010
    Posts
    252
    Thanks
    9
    Thanked 29 Times in 19 Posts
    Rep Power
    4
    NVM I FIXED IT
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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

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