Thread: [PI] Problem teleporting in heights

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 [PI] Problem teleporting in heights 
    Registered Member
    Join Date
    Feb 2014
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Whenever someone is on a height other than 0, if one person teleports, all of the monsters in that height level disappear. I have no idea how to fix this, and would like some help.
    Reply With Quote  
     

  2. #2  
    Banned [PI] Problem teleporting in heights Market Banned


    Join Date
    Jan 2011
    Age
    26
    Posts
    3,112
    Thanks given
    1,198
    Thanks received
    1,479
    Rep Power
    0
    probably has something to do with npc updating
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Feb 2014
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    So how can I fix this?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Feb 2014
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    bump
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Feb 2014
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    bump
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Aug 2010
    Posts
    254
    Thanks given
    14
    Thanks received
    17
    Rep Power
    12
    Quote Originally Posted by kevv View Post
    bump
    Can you show me your npc / player updating method? P.S. I'm not so familiar with PI, so if you know what I mean, show me that.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Feb 2014
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by tommy1234 View Post
    Can you show me your npc / player updating method? P.S. I'm not so familiar with PI, so if you know what I mean, show me that.
    public void updateNPC(Player plr, Stream str) {
    // synchronized(plr) {
    updateBlock.currentOffset = 0;

    str.createFrameVarSizeWord(65);
    str.initBitAccess();

    str.writeBits(8, plr.npcListSize);
    int size = plr.npcListSize;
    plr.npcListSize = 0;
    for (int i = 0; i < size; i++) {
    if (plr.RebuildNPCList == false && plr.withinDistance(plr.npcList[i]) == true) {
    plr.npcList[i].updateNPCMovement(str);
    plr.npcList[i].appendNPCUpdateBlock(updateBlock);
    plr.npcList[plr.npcListSize++] = plr.npcList[i];
    } else {
    int id = plr.npcList[i].npcId;
    plr.npcInListBitmap[id >> 3] &= ~(1 << (id & 7));
    str.writeBits(1, 1);
    str.writeBits(2, 3);
    }
    }

    for (int i = 0; i < NPCHandler.maxNPCs; i++) {
    if (NPCHandler.npcs[i] != null) {
    int id = NPCHandler.npcs[i].npcId;
    if (plr.RebuildNPCList == false && (plr.npcInListBitmap[id >> 3] & (1 << (id & 7))) != 0) {

    } else if (plr.withinDistance(NPCHandler.npcs[i]) == false) {

    } else {
    plr.addNewNPC(NPCHandler.npcs[i], str, updateBlock);
    }
    }
    }

    plr.RebuildNPCList = false;

    if (updateBlock.currentOffset > 0) {
    str.writeBits(14, 16383);
    str.finishBitAccess();
    str.writeBytes(updateBlock.buffer, updateBlock.currentOffset, 0);
    } else {
    str.finishBitAccess();
    }
    str.endFrameVarSizeWord();
    // }
    }

    private Stream updateBlock = new Stream(new byte[Config.BUFFER_SIZE]);

    public void updatePlayer(Player plr, Stream str) {
    // synchronized(plr) {
    updateBlock.currentOffset = 0;
    if (updateRunning && !updateAnnounced) {
    str.createFrame(114);
    str.writeWordBigEndian(updateSeconds * 50 / 30);
    }
    plr.updateThisPlayerMovement(str);
    boolean saveChatTextUpdate = plr.isChatTextUpdateRequired();
    plr.setChatTextUpdateRequired(false);
    plr.appendPlayerUpdateBlock(updateBlock);
    plr.setChatTextUpdateRequired(saveChatTextUpdate);
    str.writeBits(8, plr.playerListSize);
    int size = plr.playerListSize;
    if (size >= 79)
    size = 79;
    plr.playerListSize = 0;
    for (int i = 0; i < size; i++) {
    if (!plr.didTeleport && !plr.playerList[i].didTeleport && plr.withinDistance(plr.playerList[i])) {
    plr.playerList[i].updatePlayerMovement(str);
    plr.playerList[i].appendPlayerUpdateBlock(updateBlock);
    plr.playerList[plr.playerListSize++] = plr.playerList[i];
    } else {
    int id = plr.playerList[i].playerId;
    plr.playerInListBitmap[id >> 3] &= ~(1 << (id & 7));
    str.writeBits(1, 1);
    str.writeBits(2, 3);
    }
    }

    for (int i = 0; i < Config.MAX_PLAYERS; i++) {
    if (players[i] == null || !players[i].isActive || players[i] == plr)
    continue;
    int id = players[i].playerId;
    if ((plr.playerInListBitmap[id >> 3] & (1 << (id & 7))) != 0)
    continue;
    if (!plr.withinDistance(players[i]))
    continue;
    plr.addNewPlayer(players[i], str, updateBlock);
    }

    if (updateBlock.currentOffset > 0) {
    str.writeBits(11, 2047);
    str.finishBitAccess();
    str.writeBytes(updateBlock.buffer, updateBlock.currentOffset, 0);
    } else
    str.finishBitAccess();

    str.endFrameVarSizeWord();
    // }
    }
    There's the updatenpc and updateplayer
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Aug 2010
    Posts
    254
    Thanks given
    14
    Thanks received
    17
    Rep Power
    12
    Quote Originally Posted by kevv View Post
    There's the updatenpc and updateplayer
    Can you show me this method please?

    Code:
    addNewNPC(NPCHandler.npcs[i], str, updateBlock);
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Feb 2014
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by tommy1234 View Post
    Can you show me this method please?

    Code:
    	public void addNewNPC(NPC npc, Stream str, Stream updateBlock) {
    		//synchronized(this) {
    			int id = npc.npcId;
    			npcInListBitmap[id >> 3] |= 1 << (id&7);	
    			npcList[npcListSize++] = npc;
    	
    			str.writeBits(14, id);	
    			
    			int z = npc.absY-absY;
    			if(z < 0) z += 32;
    			str.writeBits(5, z);	
    			z = npc.absX-absX;
    			if(z < 0) z += 32;
    			str.writeBits(5, z);	
    	
    			str.writeBits(1, 0); 
    			str.writeBits(14, npc.npcType);
    			
    			boolean savedUpdateRequired = npc.updateRequired;
    			npc.updateRequired = true;
    			npc.appendNPCUpdateBlock(updateBlock);
    			npc.updateRequired = savedUpdateRequired;	
    			str.writeBits(1, 1); 
    		}
    there you are.
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Feb 2014
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    bump
    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

Similar Threads

  1. [PI] Problem loggin in
    By 1994 Baby in forum Help
    Replies: 1
    Last Post: 12-16-2013, 07:37 AM
  2. Replies: 2
    Last Post: 11-13-2012, 01:48 AM
  3. [PI]Stop teleporting in combat
    By Richie in forum Snippets
    Replies: 18
    Last Post: 10-24-2012, 05:35 PM
  4. [PI]Adding Teleports in Tele Tab
    By Glenn in forum Help
    Replies: 2
    Last Post: 08-17-2011, 12:37 AM
  5. Replies: 8
    Last Post: 12-24-2010, 08:02 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
  •