i did this snippet [Only registered and activated users can see links. ]
on how to convert process into events, but now any spec done on npc doesn't work
i removed
Code:
if((clickNpcType > 0) && NPCHandler.npcs[npcClickIndex] != null) {
if(goodDistance(getX(), getY(), NPCHandler.npcs[npcClickIndex].getX(), NPCHandler.npcs[npcClickIndex].getY(), 1)) {
if(clickNpcType == 1) {
turnPlayerTo(NPCHandler.npcs[npcClickIndex].getX(), NPCHandler.npcs[npcClickIndex].getY());
NPCHandler.npcs[npcClickIndex].facePlayer(playerId);
getActions().firstClickNpc(npcType);
}
if(clickNpcType == 2) {
turnPlayerTo(NPCHandler.npcs[npcClickIndex].getX(), NPCHandler.npcs[npcClickIndex].getY());
NPCHandler.npcs[npcClickIndex].facePlayer(playerId);
getActions().secondClickNpc(npcType);
}
if(clickNpcType == 3) {
turnPlayerTo(NPCHandler.npcs[npcClickIndex].getX(), NPCHandler.npcs[npcClickIndex].getY());
NPCHandler.npcs[npcClickIndex].facePlayer(playerId);
getActions().thirdClickNpc(npcType);
}
}
}
and added this under
Code:
CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
@Override
public void execute(CycleEventContainer container) {
if((c.clickNpcType == 1) && NPCHandler.npcs[c.npcClickIndex] != null) {
if(c.goodDistance(c.getX(), c.getY(), NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY(), 1)) {
c.turnPlayerTo(NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY());
NPCHandler.npcs[c.npcClickIndex].facePlayer(c.playerId);
c.getActions().firstClickNpc(c.npcType);
container.stop();
}
}
if(c.clickNpcType == 0 || c.clickNpcType > 1)
container.stop();
}
@Override
public void stop() {
c.clickNpcType = 0;
}
}, 1);
this under
Code:
CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
@Override
public void execute(CycleEventContainer container) {
if((c.clickNpcType == 2) && NPCHandler.npcs[c.npcClickIndex] != null) {
if(c.goodDistance(c.getX(), c.getY(), NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY(), 1)) {
c.turnPlayerTo(NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY());
NPCHandler.npcs[c.npcClickIndex].facePlayer(c.playerId);
c.getActions().secondClickNpc(c.npcType);
container.stop();
}
}
if(c.clickNpcType < 2 || c.clickNpcType > 2)
container.stop();
}
@Override
public void stop() {
c.clickNpcType = 0;
}
}, 1);
and this under
Code:
CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
@Override
public void execute(CycleEventContainer container) {
if((c.clickNpcType == 3) && NPCHandler.npcs[c.npcClickIndex] != null) {
if(c.goodDistance(c.getX(), c.getY(), NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY(), 1)) {
c.turnPlayerTo(NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY());
NPCHandler.npcs[c.npcClickIndex].facePlayer(c.playerId);
c.getActions().thirdClickNpc(c.npcType);
container.stop();
}
}
if(c.clickNpcType < 3)
container.stop();
}
@Override
public void stop() {
c.clickNpcType = 0;
}
}, 1);
the clicknpctype 2 works when i spec say a level higher than my self and the attack option comes up as second because the npc level is higher the spec works but say im level 126 and trying to spec a rock crabs level 13 i would be the first option clicknpctype 1.... and it doesn't spec....just prints out this error
Code:
[2/11/01 2:20 AM]: java.lang.ArrayIndexOutOfBoundsException: 262
[2/11/01 2:20 AM]: at server.model.players.CombatAssistant.activateSpecial(
CombatAssistant.java:2793)
[2/11/01 2:20 AM]: at server.model.players.CombatAssistant.attackNpc(Combat
Assistant.java:208)
[2/11/01 2:20 AM]: at server.model.players.Client.process(Client.java:800)
[2/11/01 2:20 AM]: at server.model.players.PlayerHandler.process(PlayerHand
ler.java:137)
[2/11/01 2:20 AM]: at server.Server.main(Server.java:165)
here's line 2793
Code:
if(Server.playerHandler.players[i] == null && c.playerIndex > 0) {
return;
}