Thread: Aggression

Results 1 to 2 of 2
  1. #1 Aggression 
    Member #35, most veteran member left? :D


    Join Date
    Jul 2006
    Age
    30
    Posts
    2,660
    Thanks given
    53
    Thanks received
    331
    Rep Power
    925
    This is mainly for Scu

    NPCHandler Process:
    Code:
    if(npcs[i].isAggressive(npcs[i].npcType) && npcs[i].attackingPlayer <= 0 && !npcs[i].underAttack && npcs[i].killerId <= 0) {
    	if(!npcs[i].isDead) {
    		for(Player p : Server.playerHandler.players) {
    			if(p != null) {
    				Client c = (Client) p;
    				if (c != null) {
    					if(c.goodDistance(npcs[i].getX(), npcs[i].getY(), c.getX(), c.getY(), 3)) {
    						if(c.underAttackByNPC <= 0) {
    							if(npcs[i].attackTimer <= 0) {
    								followPlayer(i, c.playerId);
    								attackPlayer(c, i);
    							}
    						}
    					}
    				}
    			}
    		}
    	}
    }
    Effective?

    Probably not.


    `Ex-global moderator x3 (resigned)
    Reply With Quote  
     

  2. #2  
    Aggression



    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    16,307
    Thanks given
    7,215
    Thanks received
    12,308
    Rep Power
    5000
    nope, if you have 50 aggressive npcs and 300 players on, you're looping 300 players 50 times each tick, you only need to loop the ones on the npcs viewport

    Attached image
    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. Aggression
    By Ventrix in forum Requests
    Replies: 13
    Last Post: 07-07-2009, 01:03 AM
  2. NPC Aggression
    By w::v::d in forum Help
    Replies: 5
    Last Post: 04-27-2009, 10:43 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
  •