What other plugins do you have?
Rough stab at it
page one move route on repeat (can have 'wait' commands in the middle so it only scans occasionally)
for seeing it you'd have to include a 'cansee' function, which would be a lot more elaborate (since it needs to scan for walls)
Rough stab at it
Code:
Game_CharacterBase.prototype.goTowardsPlayer = function (){
var vx = $gamePlayer.x - this.x;
var vy = $gamePlayer.y - this.y;
var length = Math.sqrt( vx * vx + vy * vy );
if ( length > this.stepDistance ) {
this.setDirectionVector( vx, vy );
vx *= 1/length;
vy *= 1/length;
this._moveTarget = true;
this._moveTargetSkippable = true;
this._moveTargetX = this.x + vx ;
this._moveTargetY = this.y + vy;
}
}
Game_CharacterBase.prototype.setSelf = function(switchName,switchValue)
{
var key = [$gameMap._mapId, this._eventId, switchName];
$gameSelfSwitches.setValue(key, switchValue);
}
//calculates the distance from an event to a given point.
Game_CharacterBase.prototype.distanceToPoint = function(xcoord,ycoord)
{
var distance = Math.sqrt( (this.x-xcoord)*(this.x-xcoord) + (this.y-ycoord)*(this.y-ycoord) );
return distance;
}page one move route on repeat (can have 'wait' commands in the middle so it only scans occasionally)
Code:
page two with 'd' activeif (this.distanceToPoint($gamePlayer.x,$gamePlayer.y)<5){setSelf('d',true)}Code:
if (this.distanceToPoint($gamePlayer.x,$gamePlayer.y)>5){setSelf('d',false)}else{this.goTowardsPlayer()}for seeing it you'd have to include a 'cansee' function, which would be a lot more elaborate (since it needs to scan for walls)