Need help with monsters on maps attacking players.

It doesn't appear like that script is designed to do what you want it to do. It doesn't seem like it is able to set patrol routes for enemies. At least, I can't figure out how.
Yeah, I'm using that script for the 'chase player' part in another mini-game. Not the patrol routes. I'm not sure what other pathfinding script I need.
it can be done with that script, I just haven't found the time to give you screenshot of how it works.
check back here tomorrow or the day after
@Tanarex sorry for the wait - and I still can't give you screenshots.
but I'll describe how to do it:

you'll need an event with three pages (or four for a slightly different variant)
This assumes that the patrol path is between two points - if not you'll need one page for each waypoint and one more for the disabling after the fight.

on the first page, you'll use custom autonomous movement with two script commands.
the first is find_path(x,y) with the xy from the end of the patrol route
the second script command would be the command to control a self-switch of this event, let's say A
(You'll need a script command because the move commands can only change regular switches by default. if you're using regular switches because your patrol route has more waypoints than self-switches, use that directly)

the content of the first page would be your battle processing and any commands what to do, followed by a self-switch D ON, and the page set to event touch.

The second page would be an almost copy of the first one, with only two differences:
the second page would be conditioned to the self-switch or switch set in the move route of the first page, and the move route itself would contain one script command to move back to the first point of the patrol route or a command to move to the third point if more than two waypoints. Then a command to switch off the self-switch for the current page (and switch ON the switch for the third page if three waypoints)

The last page after all waypoint pages would be a parallel process conditioned on self-switch D that has no movement and is set with trhough=on and a wait(60) or so before control self-switch D off.


It will need some tweaking and testing, but basically the event would move by pathfinding to the next waypoint. upon reaching that waypoint it would switch pages for the next waypoint or back to the first point of the patrol route.
and whenever it touches a player, it does its functions or battles or whatever, before placing itself into a disabled state for one second and go back to its last move segment after that pause.

The fact that the pages always reset after a contact won't matter anymore because the pathfinding will always target a specific waypoint no matter where the event currently stands.
So how would find_path(x,y) look for example in a script? I've made some simple jumping mechanics using the X and y thing but that's about it.
So how would find_path(x,y) look for example in a script?
find_path(10,2) if you want to go to position 10,2 for example.
you need to check on the map itself in the editor what coordinates your waypoints have, and then use those coordinates as x and y.
nope. Still confused. I'm trying to figure out how to add a self switch to a script command.
I'm trying to figure out how to add a self switch to a script command.
For this specific query:
Code:
$game_self_switches[[map, event, 'self_switch']] = value
  • Map is either @map_id for the current map, or a number (no leading zeroes) for a map not the current.
  • Event is either @event_id for the current event, or a number for an event not the current (EV001 would be 1).
  • self_switch is 'A', 'B', 'C' or 'D' , must have single (or double) quotes.
  • value is either true or false.
I think I'll just see if I can hire a scripter again.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-monsters-on-maps-attacking-players.145232/