Hello!
I'm currently trying to add Wilderness Agility course, but I have been stuck since this morning.
I can't find the issue. It's really irritating me and I'll decide to give up soon..
If anyone can help me, that'd be great!!
Alright, so the issue is, that my walkTo method doesn't work Inside events. I've tried the Task scheduler, Cycle eventhandler and even the normal eventhandler, same issue.
I'm currently using this command:
Code:
if(playerCommand.equalsIgnoreCase("test")) {
c.getPA().walkTo(0, 1);
return;
}
When I type ::test, my players walks. It works 100%!
BUT if I put the walkTo in an event, it won't do it.
Code:
public static void enterPipe(final Client c) {
//Start event :)
eventTicker = 0;
c.cantDoActions = false;
c.startAnimation(844);
CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
@Override
public void execute(CycleEventContainer container) {
eventTicker++; // 13 needed
c.startAnimation(844);
c.getPA().playerWalk(0, 1);
// c.startAnimation(844);
}
//Stop event :)
@Override
public void stop() {
eventTicker = 0;
c.cantDoActions = false;
}
}, 3);
}
The red part indicates that each 3 cycles, the player will walk 1 Y, but it doesn't work..
Here's the method for walkingTo:
Code:
public void walkTo(int i, int j) {
c.newWalkCmdSteps = 0;
if (++c.newWalkCmdSteps > 50) {
c.newWalkCmdSteps = 0;
}
int k = c.getX() + i;
k -= c.mapRegionX * 8;
c.getNewWalkCmdX()[0] = c.getNewWalkCmdY()[0] = 0;
int l = c.getY() + j;
l -= c.mapRegionY * 8;
for (int n = 0; n < c.newWalkCmdSteps; n++) {
c.getNewWalkCmdX()[n] += k;
c.getNewWalkCmdY()[n] += l;
}
}
As I mentioned before, any help is greatly appriciated!!