Thread: Trying out Npc Vs Npcs Combat[PI]

Results 1 to 5 of 5
  1. #1 Trying out Npc Vs Npcs Combat[PI] 
    Registered Member
    Join Date
    Jan 2014
    Posts
    14
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    So im trying to get NPC vs NPC working, more specifically i want them to be aggressive.These methods are all in NPC Handler This is what i have so far:
    Code:
    public boolean npcVsNpc(int i)
    	{
    		switch (npcs[i].npcType) {
    		case 118:
    		case 3200:
    		case 1007:
    		
    			return true;
    		}
    		return false;
    	}
    Code:
    public int getCloseNpc(int i) {
    		ArrayList<Integer> npcs = new ArrayList<Integer>();
    		for (int j = 0; j < NPCHandler.npcs.length; j++) {
    			if (NPCHandler.npcs[j] != null
    					&& (goodDistance(NPCHandler.npcs[j].getAbsX(),
    							NPCHandler.npcs[j].getAbsY(),
    							NPCHandler.npcs[i].getAbsX(), NPCHandler.npcs[i].getAbsY(),
    							7 + followDistance(i)) 
    							|| isFightCaveNpc(i) 
    							|| isRFDNpc(i)
    							|| isBarbarianNpc(i))
    							&& ((NPCHandler.npcs[j].underAttackBy <= 0 && NPCHandler.npcs[j].underAttackBy2 <= 0) || NPCHandler.npcs[j]
    									.inMulti())
    									&& NPCHandler.npcs[j].heightLevel == NPCHandler.npcs[i].heightLevel) {
    				npcs.add(j);
    			}
    		}
    		return npcs.size() > 0 ? npcs
    				.get(Misc.random(npcs.size() - 1)) : 0;
    	}
    This is in process in NPCHandler
    Code:
    if (npcVsNpc(i) && !npcs[i].isDead) {
    					npcs[i].underAttack = true;
    					npcs[i].killerId = getCloseNpc(i);
    				}

    The problem is thats its not working, they are not attacking or going close to an npc. Any ideas?
    Reply With Quote  
     

  2. #2  
    Registered Member Keepin_Green's Avatar
    Join Date
    Oct 2012
    Posts
    225
    Thanks given
    12
    Thanks received
    19
    Rep Power
    13
    I've been looking for this same thing for ages, but no one knows much about it. If anyone can help, pleaseee doooooo.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jan 2014
    Posts
    14
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Keepin_Green View Post
    I've been looking for this same thing for ages, but no one knows much about it. If anyone can help, pleaseee doooooo.
    Yeah im looking at tuts atm.
    Reply With Quote  
     

  4. #4  
    Registered Member Text's Avatar
    Join Date
    Nov 2012
    Posts
    302
    Thanks given
    61
    Thanks received
    27
    Rep Power
    21
    Sorry to gravedig, but I would also like help on this!
    Reply With Quote  
     

  5. #5  
    Banned
    Join Date
    Aug 2014
    Age
    33
    Posts
    134
    Thanks given
    53
    Thanks received
    19
    Rep Power
    0
    In the getClose method you might have to call the dwarf, ele and wizard ids from npcVsNpc method in a way that could be used.
    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

Similar Threads

  1. [pi] Npc vs Npc
    By MrClassic in forum Help
    Replies: 4
    Last Post: 07-30-2011, 12:03 PM
  2. [PI] Npc Vs Npc? [PI]
    By Lennard in forum Requests
    Replies: 4
    Last Post: 05-29-2011, 12:03 PM
  3. Replies: 17
    Last Post: 12-24-2009, 03:26 AM
  4. Lol my combat for now; Npc vs npc
    By Kelvin in forum Show-off
    Replies: 10
    Last Post: 12-08-2009, 12:04 PM
  5. npc vs npc combat for pest control!
    By travisman26 in forum Requests
    Replies: 13
    Last Post: 01-07-2009, 02:27 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •