Without the code we cannot offer any solutions.
|
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?
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(); } } }
Your passing the npc information using an integer then finding an npc with that integer id, thats why you have this issue.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(); } } }
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'.
I implimented this, the method doesn't seem to want to delete any Npc now.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(); } } }
you mean here, under the firstclicknpc in the actionhandler?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) {
or here, the method that is being called through 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); } } }
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
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |