Enemies movement on map

Hello.

I want to make all enemies in game visible and walking on map. You know, in default, enemies just appears from nowhere. It's easy to make them "visible" - just some events, when player is touching it (event touch) - battle is strating. Only my problem is movement of this enemies. "Approach" or "Turn toward player" are no good. They're going to player from begin and do not stop. What I need is some script about their movement. They should randomly walk, but when player is nearby, they should trigger and follow him. If player run away and he's far enough, enemy should stop following and continue to randomly walk.
I found this



It's similar to my conception, but problem is it's MV plugin while I'm doing it in VXA. I still don't get it, is it possible to put MV plugin into VXA script. I opened js. in wordpad, copied to scrpits, but it's not working, game crashes with error while I put this to scripts. In MV this plugin is working.

It's not necessery to put THIS script, maybe there's something like that just for VXA, I don't know.
Moved to ACE Script Requests.

For starters you cannot put MV plug-ins in ACE as MV uses Javascript and ACE uses Ruby. They are two different languages and not at all compatible with each other. You will need to find an ACE specific version.
I've seen a few possibilities out there for VX Ace, I think, but don't know which work best. Here's one I found that might do what you need it to, but I haven't tested it myself: https://www.rpgmakercentral.com/topic/6138-simple-detect-script/

There might be others if you do a specific search for "RPG Maker VX Ace" and "event detect" or some phrases like that. You should put quotes around the search terms, so that it remains engine specific, otherwise you'll probably get the MV plugins that you've found already.
I tried to copy+paste script from another game, it doesn't work. I found this script, it called "Symbol Encounter"
Spoiler

I tried to copy it to my scripts, but it's same error.
Error is:
Script '' line 322: NoMethodError occured.
undefined method `zero?' for nil:NilClass
Line 322 is:
!@stealth_count.zero?

I don't know what could be wrong, why it's working in another game, but doesn't work in mine.

Original thread: https://forums.rpgmakerweb.com/threads/enemies-movement-on-map.138543/