it's spelt fine in the script, Stefan, I do have the block checks in there but I have to have the this.x += temp.newx or else the baddy just keeps moving from the original positions, __-__ just figured the problem i had temp.x instead of temp.newx in the tiletype check haha, thanks guys :P
EDIT : grr... well it doesnt walk if the newx and newy are blocking but if the player walks in front and stops the baddy it still screws up. Here's a part of the script
PHP Code:
function onTimeOut() {
temp.rx = int(random(-5, 5));
temp.ry = int(random(-5, 5));
temp.rs = random(0, 5);
temp.rt = random(0, 7);
temp.newx = this.x + temp.rx;
temp.newy = this.y + temp.ry;
if (tiletype[ temp.newx, temp.newy] != 22 && tiletype[ temp.newx, temp.newy] != 11) {
move(temp.rx, temp.ry, temp.rs, 4 + 8 + 16);
setcharani( "nir_baddy_walk", this.baddy.nick, this.baddy.hp, this.baddy.fullhp, this.baddy.aggressor);
}
else
setTimer(temp.rt);
sleep(temp.rs);
setcharani( "nir_baddy_idle", this.baddy.nick, this.baddy.hp, this.baddy.fullhp, this.baddy.aggressor);
this.x += temp.rx;
this.y += temp.ry;
setTimer(temp.rt);
}