Thread: [PI]Boss Pets keep stacking

Results 1 to 10 of 10
  1. #1 [PI]Boss Pets keep stacking 
    Banned

    Join Date
    Apr 2014
    Posts
    419
    Thanks given
    117
    Thanks received
    56
    Rep Power
    0
    Title says all,
    Screenshot by Lightshot

    PickUpPet method:
    Code:
    public static void pickUpPet(Client c, int pet)
            {
                c.setPetSummoned(false);
                c.petID = 0;
                c.sendMessage("You pick up your pet.");
            		c.startAnimation(827);
                    for (int i = 0; i < PetData.petData.length; i++)
                    {
                            if (PetData.petData[i][0] == pet)
                            {
                                    c.getItems().addItem(PetData.petData[i][1], 1);
                            }
                    }
                    for (int i = 0; i < NPCHandler.maxNPCs; i++)
                    {
                            if (NPCHandler.npcs[i] == null)
                            {
                                    continue;
                            }
                            if (NPCHandler.npcs[i].summonedBy == c.playerId)
                            {
                                    deletePet(NPCHandler.npcs[i]);
                            }
                    }        
            }
    Code:
    public static void pickUpPetRequirements(Client player, int npcType)
            {
            	for (int i = 0; i < PetData.petData.length; i++)
                 {
                         if (PetData.petData[i][0] == npcType)
                         {
                         	if (NPCHandler.npcs[player.npcClickIndex].summonedBy == player.playerId)
                             {
                         		if (player.getItems().freeSlots() > 0)
                         		{
                         				pickUpPet(player, npcType);
                         		}
                             	else
                             	{
                             		player.sendMessage("Not enough space in your inventory.");
                             	}
                             }
                         	else
                         	{
                         		player.sendMessage("This is not your pet.");
                         	}
                         }
                 }
            }
    Will repp++ if someone will help me out
    Reply With Quote  
     

  2. #2  
    Donator

    Join Date
    Oct 2014
    Posts
    587
    Thanks given
    29
    Thanks received
    76
    Rep Power
    26
    Post your delete pet method.
    Programming service - Fast, Cheap & Quality
    http://www.rune-server.org/black-mar...-services.html

    Project that I am currently working on:
    http://www.rune-server.org/runescape...emon-rsps.html

    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Apr 2014
    Posts
    419
    Thanks given
    117
    Thanks received
    56
    Rep Power
    0
    Quote Originally Posted by Excision Pk View Post
    Post your delete pet method.
    Hmm, looks like I didn't add this method yet...
    Reply With Quote  
     

  4. #4  
    Server developer


    Join Date
    Jul 2010
    Posts
    881
    Thanks given
    265
    Thanks received
    55
    Rep Power
    94
    He meant this method:

    Code:
    deletePet(NPCHandler.npcs[i]);


    I am the one who knocks
    - - - - -

    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Apr 2014
    Posts
    419
    Thanks given
    117
    Thanks received
    56
    Rep Power
    0
    Quote Originally Posted by Excision Pk View Post
    Post your delete pet method.
    Quote Originally Posted by klaasvaakjes View Post
    He meant this method:

    Code:
    deletePet(NPCHandler.npcs[i]);
    Never Mind guys, stupid misstake, got it working thanks both!
    Reply With Quote  
     

  6. #6  
    Registered Member Joseph69's Avatar
    Join Date
    Sep 2012
    Posts
    293
    Thanks given
    45
    Thanks received
    20
    Rep Power
    56
    Quote Originally Posted by InisityPS View Post
    Never Mind guys, stupid misstake, got it working thanks both!
    I would love to know what you did to fix this issue, I keep having it.
    Reply With Quote  
     

  7. #7  
    anInt69

    Max _'s Avatar
    Join Date
    Feb 2012
    Age
    26
    Posts
    1,801
    Thanks given
    426
    Thanks received
    727
    Rep Power
    599
    Quote Originally Posted by Joseph69 View Post
    I would love to know what you did to fix this issue, I keep having it.
    When dropping you check if they already have a pet. You remove the npc. It's extremely simple
    Reply With Quote  
     

  8. #8  
    Registered Member Joseph69's Avatar
    Join Date
    Sep 2012
    Posts
    293
    Thanks given
    45
    Thanks received
    20
    Rep Power
    56
    Quote Originally Posted by Max _ View Post
    When dropping you check if they already have a pet. You remove the npc. It's extremely simple
    Oh I've having a different issue where if you have a pet our and pick it up, then drop your other pet it turns into your first pet, and begins to flash. It's hard to explain easy to show.
    Reply With Quote  
     

  9. #9  
    anInt69

    Max _'s Avatar
    Join Date
    Feb 2012
    Age
    26
    Posts
    1,801
    Thanks given
    426
    Thanks received
    727
    Rep Power
    599
    Quote Originally Posted by Joseph69 View Post
    Oh I've having a different issue where if you have a pet our and pick it up, then drop your other pet it turns into your first pet, and begins to flash. It's hard to explain easy to show.
    Post a Gif?

    And show your pickup/drop methods please.
    Reply With Quote  
     

  10. #10  
    Registered Member Joseph69's Avatar
    Join Date
    Sep 2012
    Posts
    293
    Thanks given
    45
    Thanks received
    20
    Rep Power
    56
    Quote Originally Posted by Max _ View Post
    Post a Gif?

    And show your pickup/drop methods please.
    Video of the bug: Dailymotion - Familie Filter

    Code:
    /**
    	 * Spawns the pet
    	 * 
    	 * @param player
    	 *            the player
    	 * @param id
    	 *            the id
    	 * @return spawns the pet
    	 */
    	public static boolean spawn(final Client player, int id, boolean login)
    	{		
    		/**
    		 * A pet
    		 */
    		final Pet pet = Pet.forItem(id);
    		
    		/**
    		 * Not a pet
    		 */
    		if (pet == null)
    			return false;
    		
    		/**
    		 * Already spawned
    		 */
    		if (player.getPet() > 0 && !login)
    		{
    			player.sendMessage("You already have a pet following you!");
    			return true;
    		}
    		
    		player.getItems().deleteItem(id, 1);
    		player.setPet(pet.getItemId());
    		
    		final Npc fam = NpcHandler.getNpcHandler().spawnPet(player, pet.getNpcId(), player.absX, player.absY - 1, player.heightLevel, 0, 0, 0, false, 0, 0);
    		
    		CycleEventHandler.getSingleton().addEvent(player, new CycleEvent()
    		{
    			Npc npc = fam;
    			
    			@Override
    			public void execute(CycleEventContainer container)
    			{
    				if (player.petSlot > 0)
    				{
    					if (npc != null)
    					{
    						if (!Operations.goodDistance(npc.absX,npc.absY, player.absX, player.absY, 11))
    						{
    							NpcHandler.getNpcHandler().killrNpc(player.petSlot);
    							
    							npc = NpcHandler.getNpcHandler().spawnPet(player, pet.getNpcId(), player.absX, player.absY - 1, player.heightLevel, 0, 0, 0, false, 0, 0);
    						}
    					}
    				} 
    				else
    				{
    					container.stop();
    				}
    			}
    			@Override
    			public void stop() {
    
    			}
    		}, 5);
    		return true;
    	}
    
    	/**
    	 * Picking up pet
    	 * 
    	 * @param player
    	 *            the player
    	 * @param id
    	 *            the id
    	 * @param npc
    	 *            the npc
    	 */
    
    
    
    
    	public static boolean pickup(Client player, int id, Npc npc) {
    		/**
    		 * A pet
    		 */
    		Pet pet = Pet.forId(id);
    		/**
    		 * Not a pet
    		 */
    		if (pet == null) {
    			return false;
    		}
    		/**
    		 * Checks
    		 */
    		if (npc.owner != player.playerId) {
    			player.sendMessage("This isn't your pet! This is "
    					+ PlayerHandler.players[npc.owner].username + "s' pet.");
    			return true;
    		}
    		/**
    		 * Checks if has pet
    		 */
    		if (player.getPet() < 1) {
    			return false;
    		}
    
    		/**
    		 * Picks up pet
    		 */
    		if (player.getItems().addItem(pet.getItemId(), 1)) {
    			NpcHandler.getNpcHandler().killrNpc(player.npcClickIndex);
    			player.petSlot = -1;
    			player.setPet(0);
    		} else {
    			player.sendMessage("You need inventory space to dismiss your pet!");
    		}
    		return true;
    	}
    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] 317 Boss Pets
    By Runecraftinq in forum Help
    Replies: 9
    Last Post: 03-12-2015, 11:23 AM
  2. [PI] Boss Pets
    By CrimsonGFX in forum Help
    Replies: 10
    Last Post: 10-25-2014, 04:26 PM
  3. [PI] Dragon Pets
    By GetCrunk in forum Help
    Replies: 8
    Last Post: 07-20-2011, 06:11 AM
  4. [pi] i made rocktail stack but i cant withdraw
    By OwnerProjectX in forum Help
    Replies: 1
    Last Post: 05-28-2011, 02:10 AM
  5. Replies: 17
    Last Post: 12-09-2010, 06:03 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
  •