Thread: NPC size

Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1 NPC size 
    hmu

    Jakey's Avatar
    Join Date
    Sep 2007
    Age
    31
    Posts
    6,489
    Thanks given
    109
    Thanks received
    277
    Rep Power
    1218
    Confused a little bit on this issue, NPC size reading doesnt work as if its bigger then 1x1 it will noclip through walls, but anything 1x1 doesnt.


    Code:
    	public int getNextWalkingDirection() {
    		currentTile = new Tile(absX + moveX, absY + moveY, heightLevel);
    		if(!WalkingCheck.tiles.containsKey(currentTile.getH() << 28 | currentTile.getX() << 14 | currentTile.getY())){
    			int dir;
    			dir = misc.direction(absX, absY, (absX + moveX), (absY + moveY));
    			if (dir == -1)
    				return -1;
    			dir >>= 1;
    			absX += moveX;
    			absY += moveY;
    			return dir;
    		} else if(WalkingCheck.tiles.get(currentTile.getH() << 28 | currentTile.getX() << 14 | currentTile.getY()) == true) {
    			return -1;
    		} else {
    			return -1;
    		}
    	}
    what shall be done?
    to contact me, PM me on rune-server.
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Oct 2008
    Posts
    1,540
    Thanks given
    27
    Thanks received
    71
    Rep Power
    465
    set up the npcsizes manually through npc.cfg, so
    Code:
    NPC = npcid maxhit hp size
    or however yours is
    Then set it up so only so much distance can be between the npc and an object depending on their size.

    I could be wrong, just a shot in the dark.

    setup such as:

    Code:
    if(npcFollowing = 1 && npcWalking = 1) {
    if (withinDis(npc.absX, npc.absY, tileX, tileY, npcSize) {
    npcCanMove = true;
    } else {
    npcCanMove = false;
    }
    once again, a shot in the dark. This wont work without many modifications.
    Reply With Quote  
     

  3. #3  
    hmu

    Jakey's Avatar
    Join Date
    Sep 2007
    Age
    31
    Posts
    6,489
    Thanks given
    109
    Thanks received
    277
    Rep Power
    1218
    Quote Originally Posted by Horizons View Post
    set up the npcsizes manually through npc.cfg, so
    NPC = npcid maxhit hp size or however yours is
    Then set it up so only so much distance can be between the npc and an object depending on their size.

    I could be wrong, just a shot in the dark.

    setup such as:

    if(npcAttacking = 1) {
    if (withinDis(absX, absY, tileX, tileY, npcSize) {
    npcCanMove = true;
    } else {
    npcCanMove = false;
    }

    once again, a shot in the dark. This wont work without many modifications.

    Hmm dont really understand what you are meaning other than you are wanting me to setup the NPC size through a config file and there loading the NPC size in my method to read if the NPC is close to the object that it doesnt go through it depending on its size..

    i get it sort of but wouldnt know how to do it. Im asking that here.
    to contact me, PM me on rune-server.
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Oct 2008
    Posts
    1,540
    Thanks given
    27
    Thanks received
    71
    Rep Power
    465
    i gave you a base code, it really wouldn't be hard to get that to work if you know what your doing. i'll probably end up adding it to my server soon enough anyways
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Oct 2008
    Posts
    1,540
    Thanks given
    27
    Thanks received
    71
    Rep Power
    465
    Possibly something like this:

    Code:
    	if (npcSize == 3) {
    		if (tileX != npcX + 3 && tileY != npcY + 3 || tileY != npcY - 3 && tileY != npcY - 3) {
    			npcCanWalk = true;
    		} else {
    			if (tileX != npcX > 4 && tileY != npcY > 4 || tileY != npcY < 2 && tileY != npcY < 2) {
    				npcCanWalk = false;
    	}
    and so forth, for each npc size.
    Reply With Quote  
     

  6. #6  
    hmu

    Jakey's Avatar
    Join Date
    Sep 2007
    Age
    31
    Posts
    6,489
    Thanks given
    109
    Thanks received
    277
    Rep Power
    1218
    I get it now. So pretty much do something like that for each NPC size?
    to contact me, PM me on rune-server.
    Reply With Quote  
     

  7. #7  
    Banned

    Join Date
    Jan 2009
    Age
    28
    Posts
    2,662
    Thanks given
    66
    Thanks received
    207
    Rep Power
    0
    Quote Originally Posted by Horizons View Post
    Possibly something like this:

    Code:
    	if (npcSize == 3) {
    		if (tileX != npcX + 3 && tileY != npcY + 3 || tileY != npcY - 3 && tileY != npcY - 3) {
    			npcCanWalk = true;
    		} else {
    			if (tileX != npcX > 4 && tileY != npcY > 4 || tileY != npcY < 2 && tileY != npcY < 2) {
    				npcCanWalk = false;
    	}
    and so forth, for each npc size.
    wouldn't just putting npcSize and npcSize+1 instead of 4 checks be better?
    Reply With Quote  
     

  8. #8  
    hmu

    Jakey's Avatar
    Join Date
    Sep 2007
    Age
    31
    Posts
    6,489
    Thanks given
    109
    Thanks received
    277
    Rep Power
    1218
    how would it check better if it was 1 then 4?
    to contact me, PM me on rune-server.
    Reply With Quote  
     

  9. #9  
    Respected Member


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    32
    Posts
    12,549
    Thanks given
    177
    Thanks received
    5,784
    Discord
    View profile
    Rep Power
    5000
    Quote Originally Posted by Ronaldo View Post
    how would it check better if it was 1 then 4?
    Get a list of npc sizes.

    Reply With Quote  
     

  10. #10  
    hmu

    Jakey's Avatar
    Join Date
    Sep 2007
    Age
    31
    Posts
    6,489
    Thanks given
    109
    Thanks received
    277
    Rep Power
    1218
    Quote Originally Posted by Duke Lukem View Post
    Get a list of npc sizes.
    and then?
    to contact me, PM me on rune-server.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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
  •