Restrict random movements

Hi all,


First time poster here! I'm having a very simple problem. In my game, I have birds flying around with priority above characters and with the option 'Through' checked (so that the birds aren't restricted by trees and rocks and all of that).


My game is locked to the default 17 width, but the birds eventually fly out of the screen width... and then they eventually fly back. I tried Yanfly's Region Restriction script for the first time but it isn't working with my events for some reason. Any ideas on how I restrict the birds to the map height and width? Thanks in advance!


Steve

Screenshot MV.png
It should work, because that is what that plugin is intended for - are you sure that you installed it correctly? Can you give us a screenshot of the plugin properties?


That said, you made another mistake on the event: NEVER, never set an empty event to autorun. That will do nothing but create a lot of lag and timing problems. Change it to action button.
To the map height and width, or to the screen height and width?  Do you want to stop them flying off the edge of the screen and out of sight, and restrict them to just staying where they'll be visible?



If so, that plugin won't help you.  You'd probably need something custom written, because the part of the map you want to restrict them to will vary depending on where the player is.  And I'm not sure how successful it would be anyway, because the bird could be moving left to the edge of the screen, and the player moves right at the same time, repositioning the screen, and the bird is still off the screen.


In addition to Andar's comment above about the autorun - you NEVER need to set an event to autorun or parallel process unless it has event commands.  If you have set up autonomous movement, or stepping animation (which you want to check on your event, btw - otherwise if the bird doesn't move to another tile and stays in place, it'll stop flapping its wings, which would be a bit weird), that movement will just happen - you don't need to change the event trigger to make it happen.  So yes, set the event trigger back to action button.
Thanks Andar & Shaz for your help... much appreciated 🙂  


Alright so I've figured out the problem. So the RegionRestrictions script was working fine. The problem is that I had a cliff and a repeating parallax background (I made a simple mockup map to show my dilemma).


1. If I set the birds to 'Through' then they overwrote the RegionRestrictions script.


2. If I didn't set the birds to 'Through' then they were restricted to the RegionRestriction... but they also got restricted by the cliff. It meant they couldn't fly up to the parallax background. 


In the end, I just had to make the parallax background passable and then put a restriction around the borders.


Thanks again for the help, and thanks for the 'not setting events to autorun' tip. 

Original thread: https://forums.rpgmakerweb.com/threads/restrict-random-movements.66315/