Thread: NPC size and attack distance

Results 1 to 7 of 7
  1. #1 NPC size and attack distance 
    Registered Member
    Join Date
    Oct 2017
    Posts
    9
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Hey guys, I am adding Godwars to this server right now and I am running into some problems with the bosses.

    For example, General Graardor. I have his "size" set at 5, because anything lower than this he clips through the eastern wall. But since his size is 5, the closest he stands to a player is 5 tiles. In doing this, if I set his attack distance to 5, he can attack from an unnaturally long ways away. I need his attackDistance to be set at 2. How can I allow him to remain size 5 but be able to walk closer to players by himself? Here his definition:

    Code:
     	{
    		"npcId": 2215,
            "name": "General Graardor",
    		"size": 5,
    		"attackable": true,
    		"aggressive": true,
    		"combat-follow": 15,
    		"respawn": 130,
    		"hitpoints": 255,
    		"combat-level": 624,
    		"attack-level": 280,
    		"strength-level": 350,
    		"ranged-level": 350,
    		"magic-level": 80,
    		"defence-melee": 270,
    		"defence-ranged": 90,
    		"defence-magic": 298,	
    		"max-hit": 60,
    		"attack-speed": 6,
    		"defence-anim": 7019,
    		"death-anim": 4321,
    		"attack-anim": 7018,
    		"examine": "That's a large General.",
    		"walk-radius": 8
        },

    And here is the combatMethod I made for him

    Code:
    public class GraardorCombatMethod implements CombatMethod {
    
    	private static final Animation MELEE_ATTACK_ANIMATION = new Animation(7018);
    	private static final Animation RANGE_ATTACK_ANIMATION = new Animation(7021);
    	private int attackDistance = 2;
    	
    	private CombatType currentAttackType = CombatType.MELEE;
    
    	@Override
    	public CombatType getCombatType() {
    		return currentAttackType;
    	}
    
    	@Override
    	public boolean canAttack(Character character, Character target) {
    		return true;
    	}
    
    	@Override
    	public PendingHit[] getHits(Character character, Character target) {
    		return new PendingHit[]{new PendingHit(character, target, this, true, 1)};
    	}
    
    	@Override
    	public void preQueueAdd(Character character, Character target) {
    		if(currentAttackType == CombatType.RANGED) {
    			new Projectile(character, target, -1, 40, 55, 31, 43, 0).sendProjectile();
    		}
    	}
    
    	@Override
    	public int getAttackSpeed(Character character) {
    		return character.getBaseAttackSpeed();
    	}
    
    	@Override
    	public int getAttackDistance(Character character) {
    		return attackDistance;
    	}
    
    	@Override
    	public void startAnimation(Character character) {
    		if(currentAttackType == CombatType.MELEE) {
    			character.performAnimation(MELEE_ATTACK_ANIMATION);
    		} else if(currentAttackType == CombatType.RANGED) {
    			character.performAnimation(RANGE_ATTACK_ANIMATION);
    		}
    	}
    
    	@Override
    	public void finished(Character character) {
    
    			currentAttackType = CombatType.MELEE;
    			attackDistance = 2;
    			
    			if(Misc.getRandom(100) <= 10) {
    				currentAttackType = CombatType.RANGED;
    				attackDistance = 100;
    				}
    			}
    
    	@Override
    	public void handleAfterHitEffects(PendingHit hit) {
    		if(!hit.isAccurate() || hit.getTarget() == null || !hit.getTarget().isPlayer()) {
    			return;
    		}
    	}
    }
    Reply With Quote  
     

  2. #2  
    Sweet milk.
    Sense's Avatar
    Join Date
    May 2012
    Posts
    128
    Thanks given
    20
    Thanks received
    12
    Rep Power
    4
    Make an exception for that specific npc in the npcAttack method as is if the npc's size was smaller
    Dont drink and drive, smoke and fly.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2017
    Posts
    9
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Quote Originally Posted by Sense View Post
    Make an exception for that specific npc in the npcAttack method as is if the npc's size was smaller
    Would that not just momentarily reduce the NPC's size, which would kind of bring me back to my original clipping problem? Or should that allow him to stay the same size but walk as if he was smaller?
    Reply With Quote  
     

  4. #4  
    Sweet milk.
    Sense's Avatar
    Join Date
    May 2012
    Posts
    128
    Thanks given
    20
    Thanks received
    12
    Rep Power
    4
    You shouldnt reduce the actual npcsize, just make an exception if(npcsize == 2 || npcid == 2215)
    Dont drink and drive, smoke and fly.
    Reply With Quote  
     

  5. #5  
    Banned
    Join Date
    Aug 2017
    Posts
    98
    Thanks given
    21
    Thanks received
    33
    Rep Power
    0
    Shouldn't you change this in the npcdef client side?
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Oct 2017
    Posts
    9
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Quote Originally Posted by Shabs View Post
    Shouldn't you change this in the npcdef client side?
    Yes, thank you very much. I do not know why this was not crossing my mind. Reminding me to check the NPC defs client sided helped me solve more than just this problem Thank you
    Reply With Quote  
     

  7. #7  
    Banned
    Join Date
    Aug 2017
    Posts
    98
    Thanks given
    21
    Thanks received
    33
    Rep Power
    0
    Quote Originally Posted by Revamp View Post
    Yes, thank you very much. I do not know why this was not crossing my mind. Reminding me to check the NPC defs client sided helped me solve more than just this problem Thank you
    Not a problem at all, sometimes it can be right in front of you but you just need a set fresh of eyes to take a look Happy it helpedq
    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. Replies: 1
    Last Post: 07-13-2014, 06:48 PM
  2. All npc death and attack anims 634!
    By Exidia in forum Configuration
    Replies: 2
    Last Post: 09-18-2013, 07:03 PM
  3. [PI] NPC Death and Attack Animations
    By Karma_K in forum Help
    Replies: 3
    Last Post: 01-22-2013, 10:14 PM
  4. Replies: 6
    Last Post: 03-19-2012, 03:10 AM
  5. NPC GFXs and Attack Styles
    By Janizary in forum Help
    Replies: 2
    Last Post: 10-11-2009, 01:14 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •