Thread: If anyone has an idea..

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 If anyone has an idea.. 
    Registered Member
    Join Date
    Nov 2015
    Posts
    77
    Thanks given
    16
    Thanks received
    22
    Rep Power
    51
    https://gyazo.com/41636fe63a15d9501f492d0671544610 - example 1

    https://gyazo.com/24e7684bbe493526cc72948542a6afea - example 2

    I have no idea how to fix this. For some reason when i apply death to the line for catching implings, to make them re spawn. It doesn't matter which impling you click, it will always delete the first one in my spawn list and only that one. Does anyone have any idea what could be going on here, or how to fix this?
    Reply With Quote  
     

  2. #2  
    Registered Member
    hc747's Avatar
    Join Date
    Dec 2013
    Age
    26
    Posts
    1,474
    Thanks given
    3,312
    Thanks received
    691
    Rep Power
    1098
    Without the code we cannot offer any solutions.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Nov 2015
    Posts
    77
    Thanks given
    16
    Thanks received
    22
    Rep Power
    51
    Quote Originally Posted by hc747 View Post
    Without the code we cannot offer any solutions.
    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int Npc) {
    for (int i = 0; i < NPCHandler.maxNPCs; i++) {
    NPC npc = NPCHandler.npcs[i];
    if (npc == null)
    continue;
    npc.clearUpdateFlags();
    if (System.currentTimeMillis() - c.hunterDelay >= 1500 && c.getItems().playerHasItem(11260)) {
    c.sendMessage(new StringBuilder() .append("You catch a regular ")
    .append(ImpName) .append(", and receive a ")
    .append(Item.getItemName(JarAdded).toLowerCase()) .append(".").toString());
    c.getPA().addSkillXP(XPAdded, 21);
    c.startAnimation(HunterAnim);
    c.getItems().deleteItem(11260, 1);
    c.getItems().addItem(JarAdded, 1);
    npc.updateRequired = true;
    npc.isDead = true;
    break;
    }
    c.hunterDelay = System.currentTimeMillis();
    }
    if (!c.getItems().playerHasItem(11260)) {
    c.sendMessage("You require an Impling jar to do this.");
    return;
    }
    }

    here is the method that is called for actually catching the impling
    Reply With Quote  
     

  4. #4  
    Registered Member
    hc747's Avatar
    Join Date
    Dec 2013
    Age
    26
    Posts
    1,474
    Thanks given
    3,312
    Thanks received
    691
    Rep Power
    1098
    Quote Originally Posted by Crusty Rob View Post
    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int Npc) {
    for (int i = 0; i < NPCHandler.maxNPCs; i++) {
    NPC npc = NPCHandler.npcs[i];
    if (npc == null)
    continue;
    npc.clearUpdateFlags();
    if (System.currentTimeMillis() - c.hunterDelay >= 1500 && c.getItems().playerHasItem(11260)) {
    c.sendMessage(new StringBuilder() .append("You catch a regular ")
    .append(ImpName) .append(", and receive a ")
    .append(Item.getItemName(JarAdded).toLowerCase()) .append(".").toString());
    c.getPA().addSkillXP(XPAdded, 21);
    c.startAnimation(HunterAnim);
    c.getItems().deleteItem(11260, 1);
    c.getItems().addItem(JarAdded, 1);
    npc.updateRequired = true;
    npc.isDead = true;
    break;
    }
    c.hunterDelay = System.currentTimeMillis();
    }
    if (!c.getItems().playerHasItem(11260)) {
    c.sendMessage("You require an Impling jar to do this.");
    return;
    }
    }

    here is the method that is called for actually catching the impling
    Code:
    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int Npc) {
        if (!c.getItems().playerHasItem(11260)) {
            c.sendMessage("You require an Impling jar to do this.");
            return;
        }
        if (System.currentTimeMillis() - c.hunterDelay >= 1500) {
            //assuming that the int 'Npc' is the npc index, do something like.
            final NPC npc = NPCHandler[Npc];
            if (npc != null) {
                npc.clearUpdateFlags();
                c.sendMessage(new StringBuilder().append("You catch a regular ")
                    .append(ImpName).append(", and receive a ")
                    .append(Item.getItemName(JarAdded).toLowerCase()).append(".").toString());
                c.getPA().addSkillXP(XPAdded, 21);
                c.startAnimation(HunterAnim);
                c.getItems().deleteItem(11260, 1);
                c.getItems().addItem(JarAdded, 1);
                npc.updateRequired = true;
                npc.isDead = true;
                c.hunterDelay = System.currentTimeMillis();
            }
        }
    }
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Dec 2016
    Posts
    181
    Thanks given
    61
    Thanks received
    52
    Rep Power
    0
    Code:
    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int Npc) {
        if (!c.getItems().playerHasItem(11260)) {
            c.sendMessage("You require an Impling jar to do this.");
            return;
        }
        if (System.currentTimeMillis() - c.hunterDelay >= 1500) {
            //assuming that the int 'Npc' is the npc index, do something like.
            final NPC npc = NPCHandler[Npc];
            if (npc != null) {
                npc.clearUpdateFlags();
                c.sendMessage(new StringBuilder().append("You catch a regular ")
                    .append(ImpName).append(", and receive a ")
                    .append(Item.getItemName(JarAdded).toLowerCase()).append(".").toString());
                c.getPA().addSkillXP(XPAdded, 21);
                c.startAnimation(HunterAnim);
                c.getItems().deleteItem(11260, 1);
                c.getItems().addItem(JarAdded, 1);
                npc.updateRequired = true;
                npc.isDead = true;
                c.hunterDelay = System.currentTimeMillis();
            }
        }
    }
    Your passing the npc information using an integer then finding an npc with that integer id, thats why you have this issue.

    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int Npc) {

    use the index of the npc and initiate this method from the npc_click_packet with the index of of the npc

    Code:
    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int INDEX) {
            final NPC npc = getNPCForIndex(INDEX)
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Nov 2015
    Posts
    77
    Thanks given
    16
    Thanks received
    22
    Rep Power
    51
    Quote Originally Posted by snowman5069 View Post
    Code:
    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int Npc) {
        if (!c.getItems().playerHasItem(11260)) {
            c.sendMessage("You require an Impling jar to do this.");
            return;
        }
        if (System.currentTimeMillis() - c.hunterDelay >= 1500) {
            //assuming that the int 'Npc' is the npc index, do something like.
            final NPC npc = NPCHandler[Npc];
            if (npc != null) {
                npc.clearUpdateFlags();
                c.sendMessage(new StringBuilder().append("You catch a regular ")
                    .append(ImpName).append(", and receive a ")
                    .append(Item.getItemName(JarAdded).toLowerCase()).append(".").toString());
                c.getPA().addSkillXP(XPAdded, 21);
                c.startAnimation(HunterAnim);
                c.getItems().deleteItem(11260, 1);
                c.getItems().addItem(JarAdded, 1);
                npc.updateRequired = true;
                npc.isDead = true;
                c.hunterDelay = System.currentTimeMillis();
            }
        }
    }
    Your passing the npc information using an integer then finding an npc with that integer id, thats why you have this issue.

    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int Npc) {

    use the index of the npc and initiate this method from the npc_click_packet with the index of of the npc

    Code:
    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int INDEX) {
            final NPC npc = getNPCForIndex(INDEX)
    Im not entirely sure what you mean by 'use the index'.

    Code:
    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int Npc) {
    	    if (!c.getItems().playerHasItem(11260)) {
    	        c.sendMessage("You require an Impling jar to do this.");
    	        return;
    	    }
    	    if (System.currentTimeMillis() - c.hunterDelay >= 1500) {
    	        //assuming that the int 'Npc' is the npc index, do something like.
    	        final NPC npc = NPCHandler.npcs[Npc];
    	        if (npc != null) {
    	            npc.clearUpdateFlags();
    	            c.sendMessage(new StringBuilder().append("You catch a regular ")
    	                .append(ImpName).append(", and receive a ")
    	                .append(Item.getItemName(JarAdded).toLowerCase()).append(".").toString());
    	            c.getPA().addSkillXP(XPAdded, 21);
    	            c.startAnimation(HunterAnim);
    	            c.getItems().deleteItem(11260, 1);
    	            c.getItems().addItem(JarAdded, 1);
    	            npc.updateRequired = true;
    	            npc.isDead = true;
    	            c.hunterDelay = System.currentTimeMillis();
    	        }
    	    }
    	}
    I implimented this, the method doesn't seem to want to delete any Npc now.
    Reply With Quote  
     

  7. #7  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    Quote Originally Posted by Crusty Rob View Post
    Im not entirely sure what you mean by 'use the index'.

    Code:
    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int Npc) {
    	    if (!c.getItems().playerHasItem(11260)) {
    	        c.sendMessage("You require an Impling jar to do this.");
    	        return;
    	    }
    	    if (System.currentTimeMillis() - c.hunterDelay >= 1500) {
    	        //assuming that the int 'Npc' is the npc index, do something like.
    	        final NPC npc = NPCHandler.npcs[Npc];
    	        if (npc != null) {
    	            npc.clearUpdateFlags();
    	            c.sendMessage(new StringBuilder().append("You catch a regular ")
    	                .append(ImpName).append(", and receive a ")
    	                .append(Item.getItemName(JarAdded).toLowerCase()).append(".").toString());
    	            c.getPA().addSkillXP(XPAdded, 21);
    	            c.startAnimation(HunterAnim);
    	            c.getItems().deleteItem(11260, 1);
    	            c.getItems().addItem(JarAdded, 1);
    	            npc.updateRequired = true;
    	            npc.isDead = true;
    	            c.hunterDelay = System.currentTimeMillis();
    	        }
    	    }
    	}
    I implimented this, the method doesn't seem to want to delete any Npc now.
    Make it where you trigger this method have the backend grab it's index number from the packet.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Nov 2015
    Posts
    77
    Thanks given
    16
    Thanks received
    22
    Rep Power
    51
    Quote Originally Posted by arch337 View Post
    Make it where you trigger this method have the backend grab it's index number from the packet.
    Code:
    public void firstClickNpc(int i) {
    		c.clickNpcType = 0;
    		c.npcClickIndex = 0;
    		if (c.playerRights == 3) {
    			c.sendMessage("NPC ID: " + i + " NPC X: " + c.objectX + " NPC Y: " + c.objectY);
    		}
    		
    		if(c.getHunter().hasReqs(i)){			
    			c.getHunter().Checking(i);	    
    			}
    		
    		switch (i) {
    you mean here, under the firstclicknpc in the actionhandler?

    Code:
    public void Checking(int NpcClicked) {
    		for(Otherhunternpcs o : Otherhunternpcs.values()) {
    				if(NpcClicked == o.Npc) {
    						CatchOthers(o.name, o.JarAdded, o.XPAdded, o.LevelNeed, o.Npc);
    			}
    		}
    		for(Implings i : Implings.values()) {
    				if(NpcClicked == i.Npc) {
    						CatchImps(i.name, i.JarAdded, i.XPAdded, i.LevelNeed, i.Npc);
    			}
    		}
    	}
    or here, the method that is being called through the actionhandler?
    Reply With Quote  
     

  9. #9  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    Quote Originally Posted by Crusty Rob View Post
    Code:
    public void firstClickNpc(int i) {
    		c.clickNpcType = 0;
    		c.npcClickIndex = 0;
    		if (c.playerRights == 3) {
    			c.sendMessage("NPC ID: " + i + " NPC X: " + c.objectX + " NPC Y: " + c.objectY);
    		}
    		
    		if(c.getHunter().hasReqs(i)){			
    			c.getHunter().Checking(i);	    
    			}
    		
    		switch (i) {
    you mean here, under the firstclicknpc in the actionhandler?

    Code:
    public void Checking(int NpcClicked) {
    		for(Otherhunternpcs o : Otherhunternpcs.values()) {
    				if(NpcClicked == o.Npc) {
    						CatchOthers(o.name, o.JarAdded, o.XPAdded, o.LevelNeed, o.Npc);
    			}
    		}
    		for(Implings i : Implings.values()) {
    				if(NpcClicked == i.Npc) {
    						CatchImps(i.name, i.JarAdded, i.XPAdded, i.LevelNeed, i.Npc);
    			}
    		}
    	}
    or here, the method that is being called through the actionhandler?
    Seems to be fine. If you get the xp and animation it is your method of killing it. You might need to set it's hp to 0 and have it set to be able to respawn. If it does not send xp animations etc then you got a problem with your checking method click npc method.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Apr 2015
    Posts
    40
    Thanks given
    2
    Thanks received
    2
    Rep Power
    18
    Code:
    public void CatchImps(String ImpName, int JarAdded, int XPAdded, int LevelNeeded, int Npc) {
    	    if (!c.getItems().playerHasItem(11260)) {
    	        c.sendMessage("You require an Impling jar to do this.");
    	        return;
    	    }
    	    if (System.currentTimeMillis() - c.hunterDelay >= 1500) {
    	        //assuming that the int 'Npc' is the npc index, do something like.
    	        final NPC npc = NPCHandler.npcs[Npc];
    	        if (npc != null) {
    	            npc.clearUpdateFlags();
    	            c.sendMessage(new StringBuilder().append("You catch a regular ")
    	                .append(ImpName).append(", and receive a ")
    	                .append(Item.getItemName(JarAdded).toLowerCase()).append(".").toString());
    	            c.getPA().addSkillXP(XPAdded, 21);
    	            c.startAnimation(HunterAnim);
    	            c.getItems().deleteItem(11260, 1);
    	            c.getItems().addItem(JarAdded, 1);
    	            npc.updateRequired = true;
    	            npc.isDead = true;
    	            c.hunterDelay = System.currentTimeMillis();
    	        }
    	    }
    	}

    Code:
    public void Checking(int NpcClicked) {
    		for(Otherhunternpcs o : Otherhunternpcs.values()) {
    				if(NpcClicked == o.Npc) {
    						CatchOthers(o.name, o.JarAdded, o.XPAdded, o.LevelNeed, NpcClicked);
    			}
    		}
    		for(Implings i : Implings.values()) {
    				if(NpcClicked == i.Npc) {
    						CatchImps(i.name, i.JarAdded, i.XPAdded, i.LevelNeed, NpcClicked);
    			}
    		}
    	}

    This should fix it
    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. any one has an idea ?
    By hatem in forum Help
    Replies: 5
    Last Post: 01-25-2014, 02:54 PM
  2. Need some models if anyone has theam
    By Christian_ in forum Models
    Replies: 0
    Last Post: 05-28-2013, 07:37 PM
  3. Replies: 71
    Last Post: 12-09-2011, 11:12 PM
  4. Anyone got an idea?
    By asidy in forum Help
    Replies: 2
    Last Post: 04-12-2010, 03:15 AM
  5. Replies: 10
    Last Post: 03-05-2008, 11:04 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
  •