I'm using http://www.rune-server.org/runescape...n-release.html and there is problem that NPCs doesn't move anywhere even if I attack them.
I have changed "0" to "1" in spawn-config.cfg
Here is NPCHandler.java
Code:
/**
* Random walking and walking home
**/
if (npcs[i] == null) continue;
if((!npcs[i].underAttack || npcs[i].walkingHome) && npcs[i].randomWalk && !npcs[i].isDead) {
npcs[i].facePlayer(0);
npcs[i].killerId = 0;
if(npcs[i].spawnedBy == 0) {
if((npcs[i].absX > npcs[i].makeX + Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absX < npcs[i].makeX - Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absY > npcs[i].makeY + Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absY < npcs[i].makeY - Config.NPC_RANDOM_WALK_DISTANCE)) {
npcs[i].walkingHome = true;
}
}
if (npcs[i].walkingHome && npcs[i].absX == npcs[i].makeX && npcs[i].absY == npcs[i].makeY) {
npcs[i].walkingHome = false;
} else if(npcs[i].walkingHome) {
npcs[i].moveX = GetMove(npcs[i].absX, npcs[i].makeX);
npcs[i].moveY = GetMove(npcs[i].absY, npcs[i].makeY);
npcs[i].getNextNPCMovement(i);
npcs[i].updateRequired = true;
}
if(npcs[i].walkingType == 1) {
if(Misc.random(3)== 1 && !npcs[i].walkingHome) {
int MoveX = 0;
int MoveY = 0;
int Rnd = Misc.random(9);
if (Rnd == 1) {
MoveX = 1;
MoveY = 1;
} else if (Rnd == 2) {
MoveX = -1;
} else if (Rnd == 3) {
MoveY = -1;
} else if (Rnd == 4) {
MoveX = 1;
} else if (Rnd == 5) {
MoveY = 1;
} else if (Rnd == 6) {
MoveX = -1;
MoveY = -1;
} else if (Rnd == 7) {
MoveX = -1;
MoveY = 1;
} else if (Rnd == 8) {
MoveX = 1;
MoveY = -1;
}
if (MoveX == 1) {
if (npcs[i].absX + MoveX < npcs[i].makeX + 1) {
npcs[i].moveX = MoveX;
} else {
npcs[i].moveX = 0;
}
}
if (MoveX == -1) {
if (npcs[i].absX - MoveX > npcs[i].makeX - 1) {
npcs[i].moveX = MoveX;
} else {
npcs[i].moveX = 0;
}
}
if(MoveY == 1) {
if(npcs[i].absY + MoveY < npcs[i].makeY + 1) {
npcs[i].moveY = MoveY;
} else {
npcs[i].moveY = 0;
}
}
if(MoveY == -1) {
if(npcs[i].absY - MoveY > npcs[i].makeY - 1) {
npcs[i].moveY = MoveY;
} else {
npcs[i].moveY = 0;
}
}
int x = (npcs[i].absX + npcs[i].moveX);
int y = (npcs[i].absY + npcs[i].moveY);
if (VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, x, y, 0))
npcs[i].getNextNPCMovement(i);
else
{
npcs[i].moveX = 0;
npcs[i].moveY = 0;
}
npcs[i].updateRequired = true;
}
}
}
This is checked:
Code:
public static final int NPC_RANDOM_WALK_DISTANCE = 5;