Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.
Original Source
- Original title: Event check if player if following them, stop and wait if too far away.
- Original author: jchedges
- Original date: April 6, 2016
- Source thread: https://forums.rpgmakerweb.com/threads/event-check-if-player-if-following-them-stop-and-wait-if-too-far-away.60061/
- Source forum path: Game Development Engines > Legacy Engine Support > RPG Maker MV Support
Summary
Hi everyone. I'm currently trying to script the following behavior to an event. Basically I want this NPC to go to it's smartpath destination, but when the player is too far away it stops, tells the player to keep up, and waits for them to be close enough. Then it keeps walking. So something like this:
Archived First Post
Hi everyone.
I'm currently trying to script the following behavior to an event.
Basically I want this NPC to go to it's smartpath destination, but when the player is too far away it stops, tells the player to keep up, and waits for them to be close enough. Then it keeps walking.
So something like this:
Track player X and Y position
Track this event's X and Y position
if (eventX - playerX >= 10 || eventY - player Y >= 10)
cancel event smart path to destination
Gab window text "Hey, keep up!"
wait until player is close enough, then re establish smart path
else
smart path to destination
This is what I've put together so far, which is not working. It's just going through the script over and over, as shown by my console log literally 2 seconds after the game starts. For whatever reason it's not actually stopping and waiting for the player.
Am I going about this the wrong way? I'm pretty new to this so there might be a way easier way to do this.
Thanks in advance!
I'm currently trying to script the following behavior to an event.
Basically I want this NPC to go to it's smartpath destination, but when the player is too far away it stops, tells the player to keep up, and waits for them to be close enough. Then it keeps walking.
So something like this:
Track player X and Y position
Track this event's X and Y position
if (eventX - playerX >= 10 || eventY - player Y >= 10)
cancel event smart path to destination
Gab window text "Hey, keep up!"
wait until player is close enough, then re establish smart path
else
smart path to destination
This is what I've put together so far, which is not working. It's just going through the script over and over, as shown by my console log literally 2 seconds after the game starts. For whatever reason it's not actually stopping and waiting for the player.
Protected download
Protected download
Protected download
Protected download
Protected download
Am I going about this the wrong way? I'm pretty new to this so there might be a way easier way to do this.
Thanks in advance!
Downloads / Referenced Files
Log in to download
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadReferenced Images / Attachments
Creator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
0
replies
1
view
Topic Summary
Loading summary...