Code:
final int pX = c.getX();
final int pY = c.getY();
final int nX = Server.npcHandler.npcs[c.oldNpcIndex].getX();
final int nY = Server.npcHandler.npcs[c.oldNpcIndex].getY();
final int offX = (pY - nY)* -1;
final int offY = (pX - nX)* -1;
c.SSPLIT = true;
c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 50, 2263, 9, 9, c.oldNpcIndex + 1, 24, 0);
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer b) {
Server.npcHandler.npcs[c.oldNpcIndex].gfx0(2264); // 1738
c.SSPLIT = false;
b.stop();
}
}, 500);
EventManager.getSingleton().addEvent(new Event() { // CAUSES CRASH
public void execute(EventContainer b) {
c.getPA().createPlayersProjectile2(nX, nY, offX, offY, 50, 50, 2263, 9, 9, - c.playerId - 1, 24, 0);
b.stop();
}
}, 800);
} catch (Exception e) {
e.printStackTrace();
im Getting a nullpointer exception from...
Code:
Server.npcHandler.npcs[c.oldNpcIndex].gfx0(2264);
I know that this soulsplit method is flawed and horrible way to do it with events and such, Wondering if anyone would be willing to share a better way which isnt riddled with memory leaks?