XP RpgMaker XP script for Fov.

I've been trying to figure out how to make a script in the Conditional Branch that works similar to Pokemon essentials pbNoticePlayer(get_self) script. I've looked online for script commands but all I'm finding is stuff Vx ace and the newer stuff. i have got one script to do close to what I want. its not working right though. I'm trying to make my enemies see 5 tiles straight in front of them.

Code:
The top lines in my first Conditional Branch 2nd line is inside the first in another Conditional Branch.

(($game_map.events[@event_id].x - $game_player.x).abs + ($game_map.events[@event_id].y - $game_player.y).abs) == 1

($game_map.events[@event_id].direction == 2 && $game_map.events[@event_id].y < $game_player.y) || ($game_map.events[@event_id].direction == 8 && $game_map.events[@event_id].y > $game_player.y) ||  ($game_map.events[@event_id].direction == 4 && $game_map.events[@event_id].x < $game_player.x) ||  ($game_map.events[@event_id].direction == 6 && $game_map.events[@event_id].x > $game_player.x) && (($game_map.events[@event_id].x - $game_player.x).abs + ($game_map.events[@event_id].y - $game_player.y).abs) == 1
I guess this is about detecting the player if it gets too close to an event. How far should the player be? 1 tile away? 2 tiles?

Anyway, I grew tired of reading the second line of code mainly because it is just unbearable, uncomfortable. You see, you're trying to cram too much stuff in a single line. I suspect that is 1 of the reasons it's failing. It's too long, making it hard for you to find bugs there.

So what would a scripter do in such cases?

Well, I'd recommend to add this script as a new script section in your editor. This will make it quite READABLE. Seriously, it'd help you find bugs if you add these extra methods to your events.

Ruby:
class Game_Character
  def face_down?
    @direction == 2
  end

  def face_left?
    @direction == 4
  end

  def face_right?
    @direction == 6
  end

  def face_up?
    @direction == 8
  end
end

class Game_Event
  def close_to_player?
    ((@x - $game_player.x).abs + (@y - $game_player.y).abs) == 1
  end
end

Before even calling a conditional branch, call this scriptlet.

Ruby:
@event = $game_map.events[@event_id]

Then enter this as the stand-alone script condition:

Ruby:
@event.close_to_player?

If you still want to check the position and see if it's getting close to the player, you could use this:

Ruby:
(@event.face_down? && @event.y < $game_player.y) || (@event.face_up? && @event.y > $game_player.y) ||  (@event.face_left? && @event.x > $game_player.x) || (@event.face_right? && @event.x < $game_player.x) && @event.close_to_player?

I also think your condition testing the absolute value of the X & Y distances was incorrectly defined. Just as the left and right direction checks were...
New to this so I wasn't typing a lot of it right. Main problem was the long line being incorrect and asking to much. I thought I had to have all of it to get one direction.
I tried to do what you told me but I messed it up some how. thanks tho
This is what i ended up doing.

Ruby:
 @Conditional Branch: $game_map.events[@event_id].direction == 2 && $game_map.events[@event_id].y < $game_player.y

  @Conditional Branch:($game_map.events[@event_id].y - $game_player.y).abs <= 3 && $game_map.events[@event_id].x == $game_player.x ||
    ($game_map.events[@event_id].x - $game_player.x).abs <= 3 && $game_map.events[@event_id].y == $game_player.y

I did see where you commented on another topic about adding states to the battle scene. Is there a script I could add for showing enemies states in text if more than one apply? I added a window to show the enemies name and level. I would like to add the states below the name if possible.

Original thread: https://forums.rpgmakerweb.com/threads/rpgmaker-xp-script-for-fov.179541/